shabeerahmedshah Posted March 31, 2016 Share Posted March 31, 2016 Is it possible in pixi.js to scale the stage from the very center of the stage as there is no anchor available in it. What I basically need is to focus on an object whose size will always be less the canvas size but it should be zoom-able with the mouse scroll. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 31, 2016 Share Posted March 31, 2016 There's no anchor for containers, because their width/height are not trivial. There's pivot, in pixels. That's how I do it: //go into center stage.position.x = renderer.width/2; stage.position.y = renderer.height/2; //scale stage.scale.x = 2.0; stage.scale.y = 2.0; //go back. You can use center of stage instead of these coords: stage.pivot.x = stageCenterX stage.pivot.y = stageCenterY; Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 31, 2016 Share Posted March 31, 2016 Code is updated, please look again. Quote Link to comment Share on other sites More sharing options...
shabeerahmedshah Posted March 31, 2016 Author Share Posted March 31, 2016 Yeah, It worked after setting the positions 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.