eggborne Posted March 13, 2014 Share Posted March 13, 2014 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! Quote Link to comment Share on other sites More sharing options...
enpu Posted March 13, 2014 Share Posted March 13, 2014 There is no anchor point in DisplayObjectContainer, but you can place content in container using negative positioning to make them rotate around (0,0) point. Quote Link to comment Share on other sites More sharing options...
xerver Posted March 13, 2014 Share Posted March 13, 2014 I think you are looking for the pivot property of containers: http://www.goodboydigital.com/pixijs/docs/classes/DisplayObjectContainer.html#property_pivot It is similar to anchor for sprites, but controls the point of rotation for containers. Quote Link to comment Share on other sites More sharing options...
eggborne Posted March 13, 2014 Author Share Posted March 13, 2014 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! Quote Link to comment Share on other sites More sharing options...
LuckySpammer Posted April 8, 2014 Share Posted April 8, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.