공이 튕기는 듯한 이즈액션



c++)

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "test144.hpp"
 
USING_NS_CC;
 
Scene* Test144::createScene()
{
    auto scene = Scene::create();
    
    auto layer = Test144::create();
    scene->addChild(layer);
    
    return scene;
}
 
 
bool Test144::init()
{
    if ( !Layer::init())
    {
        return false;
    }
    
    
    auto sprite1 = Sprite::create("ball.png");
    sprite1->setPosition(Point(100300));
    this->addChild(sprite1);
    
    auto sprite2 = Sprite::create("ball.png");
    sprite2->setPosition(Point(200300));
    this->addChild(sprite2);
    
    auto sprite3 = Sprite::create("ball.png");
    sprite3->setPosition(Point(300300));
    this->addChild(sprite3);
    
    
    //EaseBounce 이즈 액션 : 공이 튕기는 듯한 이즈 액션
    auto action1 = MoveTo::create(2.0, Point(100,50));
    auto ease1 = EaseBounceIn::create(action1);
    
    auto action2 = MoveTo::create(2.0, Point(200,50));
    auto ease2 = EaseBounceOut::create(action2);
 
    auto action3 = MoveTo::create(2.0, Point(300,50));
    auto ease3 = EaseBounceInOut::create(action3);
    
    
    //스프라이트 객체에 이즈 액션 실행
    sprite1->runAction(ease1);
    sprite2->runAction(ease2);
    sprite3->runAction(ease3);
    
    
    return true;
}
 
cs



결과

공이 튕기는 듯한 액션을 취한다



+ Recent posts