Z
Z
Zaur Abdulgalimov2015-09-20 13:30:06
C++ / C#
Zaur Abdulgalimov, 2015-09-20 13:30:06

How to show animation of sprite appearance via scale from point in Cocos2d-x?

There is a Sprite object, if you put it on the scene, it is displayed in the middle of the window as it should.
Now I have added the animation code:

this->stopAllActions();
this->setScale(0.01f);
this->runAction(ScaleBy::create(0.5f, 100.0f));

The animation of the appearance from the upper right corner is played, i.e. initial position: upper right corner; end position: center of the screen.
How can I make the animation also start from the center of the screen? Those. I want the animation to appear from the center.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Silin, 2015-09-20
@abdulgalimov

Set the anchor point to the middle.

A
Armenian Radio, 2015-09-20
@gbg

There should be two animations - movement from the center to the corner and simultaneous scaling.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question