GameCorder.net

このエントリーをはてなブックマークに追加

scale animation with ease

Let's do scale animation with ease.
I create custom dialog and appear this with scale and ease.
First learn how to scale with ease animation to ui component.


// create base ui
ui::Layout* base = ui::Layout::create();
// WIDTH or HEIGHT is layer size
base->setSize(cocos2d::Size(WIDTH,HEIGHT));
// set scale point in center
base->setAnchorPoint(Vec2(0.5,0.5));
// DISPLAY_WIDTH・HEIGHT is size of screen place center this layer.
base->setPosition(cocos2d::Vec2(DISPLAY_WIDTH / 2,DISPLAY_HEIGHT / 2));

// Scale half of size
base->setScale(0.5);
// use ScaleBy to scale
auto scaleBy = ScaleBy::create(0.2,2.0f,2.0f);
// action with EaseBackOut
base->runAction(EaseBackOut::create(scaleBy));
	

this animate like this.

use scaleBy or scaleTo

In this case To scale using scaleBy.
scaleBy has parent name scaleTo
If use scaleTo write like this.


// scale with ease
base->setScale(0.5);
auto scaleTo = ScaleTo::create(0.2,1.0f);
base->runAction(EaseBackOut::create(scaleTo));
	

EaseAnimation

When run action use EaseBackOut::create
Ease animation king display tutorial site.
Use class displayed.

I confirm version 3.15.1.