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 | #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(100, 100)); this->addChild(spr); auto action_0 = MoveTo::create(1.0f, Point(450, 100)); auto action_1 = EaseIn::create(action_0, 3.0); //3.0은 가속 비율을 나타냄 //auto action_1 = EaseOut::create(action_0, 3.0); //EaseOut은 액션의 뒷부분 EaseIn은 액션의 앞부분을 나타냄 //auto action_1 = EaseInOut::create(action_0, 3.0); spr->runAction(action_1); return true; } | cs |