Jump to content

Going from Processing / P5 to Pixi questions


Glenn Marshall
 Share

Recommended Posts

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.   

 

Link to comment
Share on other sites

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

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