'action'에 해당되는 글 2건
- 2014.01.09 [유니티3d][에셋] 유니티 필수 에셋 iTween 에 대해서 알아보자(Action!)
- 2014.01.08 [Action] cocos2d-x 액션 사용법
유니티 필수 에셋 중에 하나인 아이트윈
유니티에서 물체의 움직임을 보다 쉽게 설정 할 수 있습니다.
파일을 여시면 sample 소스가 존재합니다. sample 소스를 보시면 iTween 이라는게 뭐구나 하고 싶게 이해 할수있으실겁니다.
간단하게 샘플 소스에 대해 알아보겠습니다.
using UnityEngine;
using System.Collections;
public class MoveSample : MonoBehaviour
{
void Start(){
iTween.MoveBy(gameObject, iTween.Hash("x", 2, "easeType", "easeInOutExpo", "loopType", "pingPong", "delay", .1));
}
}
moveSample 입니다.
moveBy를 호출하는 방법은 위와 같이 두가지 방법이 있습니다.
첫번째는 호출 방법은 위치와 시간을 집어넣어주는 함수이고
두번째는 호출 방법은 해쉬테이블을 집어넣는 방식입니다.
위함수에서는
x = 2;
easeType = "easeInOutExpo"
loopType = "pingPong"
delay = .1;
해쉬테이블의 name 에 각 값들을 집어넣은 것과 같습니다.
해쉬테이블을 미리 선언하고 아래와 같이 집어넣을 수 도 있습니다.
Hashtable ht = new Hashtable();
void Awake(){
ht.Add("x",3);
ht.Add("time",4);
ht.Add("delay",1);
ht.Add("onupdate","myUpdateFunction");
ht.Add("looptype",iTween.LoopType.pingPong);
}
void Start(){
iTween.MoveTo(gameObject,ht);
}함수의 종류는 아래와 같습니다.
using UnityEngine;
using System.Collections;
public class RotateSample : MonoBehaviour
{
void Start(){
iTween.RotateBy(gameObject, iTween.Hash("x", .25, "easeType", "easeInOutBack", "loopType", "pingPong", "delay", .4));
}
}
RotateSample 입니다.
RotateBy BACK TO TOP
Multiplies supplied values by 360 and rotates a GameObject by calculated amount over time.
- RotateBy(GameObject target, Vector3 amount, float time)
- RotateBy(GameObject target, Hashtable args)
| Property Name | Type | Purpose |
|---|---|---|
| name | string | an individual name useful for stopping iTweens by name |
| amount | Vector3 | for the amount to be multiplied by 360 to rotate the GameObject. |
| x | float or double | for the individual setting of the x axis |
| y | float or double | for the individual setting of the y axis |
| z | float or double | for the individual setting of the z axis |
| space | Space or string | for applying the transformation in either the world coordinate or local cordinate system. Defaults to local space. |
| time | float or double | for the time in seconds the animation will take to complete |
| speed | float or double | can be used instead of time to allow animation based on speed |
| delay | float or double | for the time in seconds the animation will wait before beginning |
| easetype | EaseType or string | for the shape of the easing curve applied to the animation |
| looptype | LoopType or string | for the type of loop to apply once the animation has completed |
| onstart | string | for the name of a function to launch at the beginning of the animation |
| onstarttarget | GameObject | for a reference to the GameObject that holds the "onstart" method |
| onstartparams | Object | for arguments to be sent to the "onstart" method |
| onupdate | string | for the name of a function to launch on every step of the animation |
| onupdatetarget | GameObject | for a reference to the GameObject that holds the "onupdate" method |
| onupdateparams | Object | for arguments to be sent to the "onupdate" method |
| oncomplete | string | for the name of a function to launch at the end of the animation |
| oncompletetarget | GameObject | for a reference to the GameObject that holds the "oncomplete" method |
| oncompleteparams | Object | for arguments to be sent to the "oncomplete" method |
| ignoretimescale | boolean | setting this to true will allow the animation to continue independent of the current time which is helpful for animating menus after a game has been paused by setting Time.timeScale=0 |
보다 많은 정보는 iTwwen 홈페이지에서 찾아볼수있습니다.
ITwen 홈페이지 :http://itween.pixelplacement.com/index.php
관련 동영상 강좌 입니다.
https://www.youtube.com/watch?v=qRafXt26a_E
https://www.youtube.com/watch?v=qE5hpp4YaH4
https://www.youtube.com/watch?v=hbSxwoWjBgQ -> 한글
'잡다한것들전부 > 에셋' 카테고리의 다른 글
| [iTween] 유도 미사일 구현 관련 내용 (0) | 2014.01.10 |
|---|---|
| [유니티3d][에셋] 유니티 필수 에셋 iTween 에 대해서 알아보자(Action!) (0) | 2014.01.09 |
Actions
Actions 클래스는 CCNode 를 상속받는 모든 객체에 명령을 부여합니다. 액션은 오브젝트의 위치, 회전, 크기 기타등등 값들을 수정합니다
일정기간동안 수정하는 작업이면 -> CCIntervalAction actions 그렇지 않으면 -> CCInstantAction 입니다.
예를들면 CCMoveBy는 일정기간동안 수정합니다. CCIntervalAction 액션입니다.
액션의 사용 예:
가속 관련된 액션들 (점점 빨라지거나 느려지는등)
- CCEaseIn
- CCEaseOut
- CCEaseInOut
- CCSpeed
Etc. (See the ActionsEaseTest.cpp example for more info)
CCActionManager를 사용하면 중간에 액션을 일시정지 하고 재시작 할수도있다.(해당객체의)
Basic Actions
Basic actions are the ones that modify basic properties like:
Position(위치수정관련)
CCMoveBy
CCMoveTo
CCJumpBy
CCJumpTo
CCBezierBy
CCBezierTo
CCPlace
Scale(크기수정관련)
Rotation(회전)
Visibility(보이는거)
CCShow
CCHide
CCBlink
CCToggleVisibility
Opacity(알파값)
Color(색깔)
Example:
The act1 will be a CCMoveBy action of duration 0.5, but with the position value of ccp(100,0).
뒤에 By 붙는거와 To 붙는거 차이
By는 현재 값 기준으로 변경 To는 그냥 그런거 상관없이 변경
만약 현재 캐릭터 위치가 120 .30 이면
만약 CCMoveBy::create(2, ccp(50,10)); //현재 캐릭터 위치 기준으로 50,10만큼 이동 -> 170,40
CCMoveTo::create(2, ccp(50,10)); //좌표값에 50, 10으로 이동 -> 50,10
'잡다한것들전부 > Basic Concepts' 카테고리의 다른 글
| [Effects] cocos2-dx 이펙트에 대해서 알아보자! (0) | 2014.01.09 |
|---|---|
| [Basic Concepts] Director, Scene, Layer, Sprite 개념 정리 (0) | 2014.01.09 |
| [Coordinate System] cocos2d-x 좌표 시스템 (0) | 2014.01.09 |
| [Animations] cocos2d-x 에니메이션 적용하기 (0) | 2014.01.08 |
| [Action] cocos2d-x 액션 사용법 (0) | 2014.01.08 |
| cocos2d-x 기본 컨셉 (0) | 2013.09.23 |


