I almost have read everything about Anchor Point and scaling. I still have no idea what is going on with a sprites position when i scale it.
The scenario is this:
When i tap on screen, sprite's width will decrease about %50 and height will increase about same scale. Then it will get back to its normal scale.
id scaleUpAction = [CCEaseInOut actionWithAction:[CCScaleTo actionWithDuration:.35 scaleX:0.5 scaleY:1.5] rate:1.0];
id scaleDownAction = [CCEaseInOut actionWithAction:[CCScaleTo actionWithDuration:.35 scaleX:1.0 scaleY:1.0] rate:1.0];
CCSequence *scaleSeq = [CCSequence actions:scaleUpAction, scaleDownAction, nil];
[self.boxShape runAction:scaleSeq];
I dont understand why scaling makes the sprites "move".
If I have a sprite with size 40x60 at position (100, 100) on the screen, when I scale it down , it moves left. Why?
Thanks.
scaleX:0.5 scaleY:1.5
: that's not 50% in each direction. That's 50% less in X direction, but only 33% up in Y. You probably wantscaleY:2.0
– Stephane Delcroix