Jump to content

set graphics transform.worldTransform


fengFanYong
 Share

Recommended Posts

ok, so we have "graphics.transform" which is actually a combined "graphics.position", "graphics.scale", "graphics.rotation" and so on. But you can set them from matrix directly.

 

var matrix = new PIXI.Matrix();
matrix.set(1,1,1,1,0,0);

graphics.transform.setFromMatrix(matrix);

I DO NOT ADVICE TO USE (1,1,1,1), because that's actually a very bad matrix. Where did you take those parameters?

Link to comment
Share on other sites

@ivan.popelyshev

 When i create a sprite,it children is graphics,but i hope this position of graphics is a Actual pixel。

    var sp = new PIXI.Sprite();
    sp.x = 100;
    sp.y = 100;
    sp.width = 100;
    sp.height = 100;
    var g = new PIXI.Graphics();
    g.beginFill(0x123123);
    g.drawRect(0,0,100,100);
    g.endFill();
    sp.addChild(g);

 i hope draw a circle 100*100 pixel.

THANK!

Link to comment
Share on other sites

if you have a circle with center (50,50), position of graphics is (100,100) and position of the parent sprite is (200, 200) , then, as a result, center will be shown at (350, 350).

There's no way to change that in pixi: graphics coordinates are multilied by graphics matrix and then by parent sprite matrix.

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