adamk33n3r Posted June 14, 2015 Share Posted June 14, 2015 Graphics objects have a rotation property which affects everything drawn with that object. In order to only rotate certain things I create multiple Graphics objects. I used to accomplish this with normal canvas by using save and restore. Is that what Graphics is doing behind the scenes? Like is each one a "state"? Or is it something else? The real question is this: what is the best way of drawing multiple shapes? Is it fine to create multiple Graphics objects or is there a better way? Quote Link to comment Share on other sites More sharing options...
xerver Posted June 14, 2015 Share Posted June 14, 2015 Creating multiple graphics objects is OK, but lots of them will not perform very well. > I used to accomplish this with normal canvas by using save and restore. Is that what Graphics is doing behind the scenes? No, Graphics is just a display object container like anything else in pixi (sprites for example). When you rotate it we add the rotation to the matrix transformation calculation. How this is interpreted is dependent upon which renderer you use. You could also rotate the verts of the polyogn you want to draw, and have each shape in a single graphics object. 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.