These are chat archives for pixijs/pixi.js

24th
Aug 2017
Mark van Veen
@Mark2xv
Aug 24 2017 20:15
@jakubrpawlowski - Hi, sorry, took a few days... :p
I set it up so I've got a sprite in a container. What do I need to do to rotate the thing clockwise, while remaining on the same coordinate?
https://jsfiddle.net/x4m7dL7k/1/
(Edited the URL)
Jakub R Pawlowski
@jakubrpawlowski
Aug 24 2017 20:16
Let me look
Mark van Veen
@Mark2xv
Aug 24 2017 20:16
This is probably something really simple but for whatever reason I'm not seeing it ...
Jakub R Pawlowski
@jakubrpawlowski
Aug 24 2017 20:25
sprite.anchor.set(0.5);
You're missing this.
Mark van Veen
@Mark2xv
Aug 24 2017 20:25
No, then it's not centered?
Mark van Veen
@Mark2xv
Aug 24 2017 20:27
I mean, okay, that's possible. Then translate it by half it's dimensions or something?
Jakub R Pawlowski
@jakubrpawlowski
Aug 24 2017 20:28
Correct
I will do it let me log in on pc
Mark van Veen
@Mark2xv
Aug 24 2017 20:29
Thanks! But to be sure I understand, what exactly do you translate in that case? The sprite as well?
Or the entire container?
Jakub R Pawlowski
@jakubrpawlowski
Aug 24 2017 20:30
container.x = renderer.width/2;
nothing has to be substracted from it when the anchor is set to 0.5
container.y = renderer.height /2;
Mark van Veen
@Mark2xv
Aug 24 2017 20:32
Alright... now I get it. Anchor is -much much- more than something for rotation only
Jakub R Pawlowski
@jakubrpawlowski
Aug 24 2017 20:32
and you translate entire container
yeah it makes your entire logic revolve around the center of the sprite rather than corner
oh and you can also rotate just a sprite if you want
Mark van Veen
@Mark2xv
Aug 24 2017 20:37
Thank you very much :)
Jakub R Pawlowski
@jakubrpawlowski
Aug 24 2017 20:38
Yeah my pleasure. I'm just figuring it all out as well.