크기 변경하는 액션기능 (ScaleTo)
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 | #include "test116.hpp" USING_NS_CC; Scene* Test116::createScene() { auto scene = Scene::create(); auto layer = Test116::create(); scene->addChild(layer); return scene; } bool Test116::init() { if ( !Layer::init()) { return false; } auto sprite = Sprite::create("ball.png"); //스프라이트 이미지 객체 생성 sprite->setPosition(Point(100,100)); //스프라이트 위치 지정 sprite->setScale(2); //크기지정(2배 확대) this->addChild(sprite); //레이어에 추가 //ScaleTo::create(액션시간, 크기) //ScaleBy : 현재크기 기준(8배 확대), ScaleTo : 지정한크기 기준(3배 확대) auto action = ScaleBy::create(2, 3); sprite->runAction(action); return true; } | cs |
결과
이미지가 8배로 확대된다
'IT > - 프로그래밍' 카테고리의 다른 글
OpenCV error LNK2019: _cvReleaseImage 외부 기호(참조 위치: _main 함수)에서 확인하지 못했습니다. (0) | 2017.02.11 |
---|---|
Cocos 회전하는 액션기능 (RotateBy) (0) | 2017.02.10 |
Cocos 위치 변경하는 액셔기능 (Place) (0) | 2017.02.08 |
Cocos 베지어 액션기능 (BezierTo) (0) | 2017.02.07 |
Cocos 액션기능으로 점프하기 (JumpBy) (0) | 2017.02.06 |