Glenn Marshall Posted January 19, 2018 Share Posted January 19, 2018 Hi Just wondering if any of you could help me beginning to use Pixi. I normally use Processing & P5, and these are the main things I'm not sure of at the minute.. How would I do the following matrix / global type transformations in Pixi.. push(); translate(100,50); scale(.5); pop(); also, how would I create an overlay layer, independent of the global transformations above, so that I can place UI elements or HUD text. Thanks for now. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 19, 2018 Share Posted January 19, 2018 Every element has a transform, its applied to element and its children. There's no push and pop, global transforms are recalculated for each element if something was changed. Of course you can assume that its pushed when you go inside and popped when you're out, the result should be the same. However, push and pop are used only for filters. For your case, container.position.set(100, 50); container.scale.set(0.5); Container and its children will be affected. Its declarative, order is always "position,rotation,scale,pivot" , it doesnt matter if you change the order of lines. You have to write your own Transform class to change the order: https://github.com/pixijs/pixi.js/blob/dev/src/core/display/TransformStatic.js Quote Link to comment Share on other sites More sharing options...
Glenn Marshall Posted January 19, 2018 Author Share Posted January 19, 2018 ah I see - so I put everything inside a container, then scale / translate it, then do local transformations on the children, which will also be multiplied by the transformations of the container. I think I understand. Thanks very much. ivan.popelyshev 1 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.