이동
MoveTo MoveBy를 사용하여 대상 객체가 설정된 시간후에 이동한다.
C++
auto mySprite = Sprite::create("mysprite.png");
// Move a sprite to a specific location over 2 seconds.
auto moveTo = MoveTo::create(2, Vec2(50, 0));
mySprite->runAction(moveTo);
// Move a sprite 50 pixels to the right, and 0 pixels to the top over 2 seconds.
auto moveBy = MoveBy::create(2, Vec2(50, 0));
mySprite->runAction(moveBy);
출처: <http://dygks910910.tistory.com/14?category=295210>
회전
RotateTo RotateBy 를 사용해서 노드가 설정한 시간에 따라 시계방향으로 회전하는걸 보자.
C++
auto mySprite = Sprite::create("mysprite.png");
// Rotates a Node to the specific angle over 2 seconds
auto rotateTo = RotateTo::create(2.0f, 40.0f);
mySprite->runAction(rotateTo);
// Rotates a Node clockwise by 40 degree over 2 seconds
auto rotateBy = RotateBy::create(2.0f, 40.0f);
mySprite->runAction(rotateBy);
출처: <http://dygks910910.tistory.com/14?category=295210>
스케일
ScaleBy ScaleTo 를 사용하여 노드의 스케일을 조절한다.
C++
auto mySprite = Sprite::create("mysprite.png");
// Scale uniformly by 3x over 2 seconds
auto scaleBy = ScaleBy::create(2.0f, 3.0f);
mySprite->runAction(scaleBy);
// Scale X by 5 and Y by 3x over 2 seconds
auto scaleBy = ScaleBy::create(2.0f, 3.0f, 3.0f);
mySprite->runAction(scaleBy);
// Scale to uniformly to 3x over 2 seconds
auto scaleTo = ScaleTo::create(2.0f, 3.0f);
mySprite->runAction(scaleTo);
// Scale X to 5 and Y to 3x over 2 seconds
auto scaleTo = ScaleTo::create(2.0f, 3.0f, 3.0f);
mySprite->runAction(scaleTo);
출처: <http://dygks910910.tistory.com/14?category=295210>
'Cocos2d-x v3.17 > 기본기능' 카테고리의 다른 글
[Cocos2d-x 기본기능]프레임 애니메이션 (0) | 2018.08.11 |
---|---|
[Cocos2d-x 기본기능]FadeIn,FadeOut,TintTo,TintBy (0) | 2018.08.11 |
[Cocos2d-x 기본기능]Action 소개 및 By 와 To 의 구별 (0) | 2018.08.11 |
[Cocos2d-x 기본기능]다각형 스프라이트 Polygon Sprite (0) | 2018.08.11 |
[Cocos2d-x 기본기능]스프라이트 컨트롤하기 (0) | 2018.08.11 |