Jump to content

Is there a simple way to change the anchor point of a DisplayObjectContainer?


eggborne
 Share

Recommended Posts

I want to be able to rotate the whole container's contents with a chosen point as anchor. As it is, it rotates on point (0,0) and I don't se any way to easily change that. I realize some acrobatics could be done to compensate the container's position each frame to keep the center where I want, but I want to make sure I'm not missing something obvious first.
 
Thanks!

Link to comment
Share on other sites

I have set Container.pivot.x and Container.pivot.y to 0.5 and nothing seems to have changed.
 
edit: It seems that the pivot property defines a universal point to pivot around, not an area of the container itself (i.e. I had to set pivot.x to window.innerWidth/2 and pivot.y to window.innerHeight/2). Now it's working! Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

I have set Container.pivot.x and Container.pivot.y to 0.5 and nothing seems to have changed.

 

edit: It seems that the pivot property defines a universal point to pivot around, not an area of the container itself (i.e. I had to set pivot.x to window.innerWidth/2 and pivot.y to window.innerHeight/2). Now it's working! Thanks!

 

Can someone point me to an example of this? Setting a Container's pivot property seems to have no effect for me. 

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...