Jump to content

Difference between anchor and pivot


rorypicko
 Share

Recommended Posts

What is the difference between pivot and anchor?

 

Anchor is set to percentages of width, and pivot is set to exact pixel values, but is that the only difference?

 

If i have a sprite that it 100x100 and i do either of the following code

 

sprite.anchor.set(0.5, 0.5);

 

or

 

sprite.pivot.set(50,50);

 

it appears to do exactly the same thing? 

Including when i rotate the sprite, which appears to be the difference in the description.

 

and also, setting both of these seems to have weird results not sure which is being favoured.

 

 

Link to comment
Share on other sites

Pivot is currently "broken":

 

https://github.com/GoodBoyDigital/pixi.js/pull/730

 

You're right, at the moment it just works like `anchor`, except with weird effects if the sprite is a different width and height than its texture.

Hopefully it will be "fixed" because it would be extremely useful to be able to rotate a sprite while still maintaining its x/y anchor at the top left corner.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...