IT/- 프로그래밍
Cocos 베지어 액션기능 (BezierTo)
혁준7519
2017. 2. 7. 09:27
베지어 액션기능 (BezierTo)
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 | #include "test112.hpp" USING_NS_CC; Scene* Test112::createScene() { auto scene = Scene::create(); auto layer = Test112::create(); scene->addChild(layer); return scene; } bool Test112::init() { if ( !Layer::init()) { return false; } auto sprite = Sprite::create("ball.png"); //스프라이트 이미지 객체 sprite->setPosition(Point(50,50)); //위치 지정 this->addChild(sprite); //레이어에 추가 //베지어 곡선의 설정 ccBezierConfig config; config.controlPoint_1 = Point(200,250); //제어점 설정 config.controlPoint_2 = Point(400,150); //제어점 설정 config.endPosition = Point(450,50); //도착점 설정 //BezierTo::create(액션시간 , 설정) auto action = BezierTo::create(3.0f, config); //베지어 액션 생성 sprite->runAction(action); //노드에 액션 설정 return true; } | cs |