본문 바로가기

카테고리 없음

[cocos2d-x] 이즈액션(EaseSine,EaseExponental)

 

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "HelloWorldScene.h"
 
Scene* HelloWorld::createScene()
{
    auto scene = Scene::create();
 
    auto layer = HelloWorld::create();
    scene->addChild(layer);
 
    return scene;
}
 
bool HelloWorld::init()
{
    if (!Layer::init())
    {
        return false;
    }
 
    auto spr = Sprite::create("ball.png");
    spr->setPosition(Point(100100));
    this->addChild(spr);
 
    auto action_0 = MoveTo::create(1.0, Point(450100));
    auto action_1 = EaseSineIn::create(action_0); 
// EaseSine은 속도가 변화하는 구간의 차이가 적은 메소드
//auto action_1 = EaseExponentialIn::create(action_0); 
// EaseExponential은 속도가 변화하는 구간의 차이가 많은 메소드
    spr->runAction(action_1);
 
    return true;
}
cs