본문 바로가기
Unity3D

iTween 사용방법

by CodeDiver 2013. 10. 15.

너무 잘 정리된 블로그가 있음.

http://hatoru.tistory.com/157


예를들어 _char 이라는 GameObject를 이동하고 싶다면 아래와 같이 작성하면 된다.

Hashtable h = new Hashtable();

h.Add ("x", posChar.x);

h.Add ("y", posChar.y);

h.Add ("z", posChar.z);

h.Add ("time", 2);

iTween.MoveTo(_char, h);


자세한 사용법은 제작사 사이트에서 볼수 있음.

http://itween.pixelplacement.com/documentation.php


<첨부파일: iTween>

애셋 스토어가 접속이 되지 않을때를 대비하여 이곳에 올려둡니다. (지금도 접속이 안되네요.;;)

iTween.unitypackage




이렇게도 가능.

void OnRotateComplete(GameObject obj) {

nCnt++;


if (nCnt < fRotAngle.Length) {

Hashtable h = new Hashtable();

h.Add ("z", fRotAngle[nCnt]);

h.Add ("time", 0.1f);

h.Add ("oncompletetarget", obj);

h.Add ("oncomplete", "OnRotateComplete");

h.Add ("oncompleteparams", obj);

iTween.RotateTo(obj, h);

}

}





<참고: iTween의 해쉬 String >

Property NameTypePurpose
namestringan individual name useful for stopping iTweens by name
audiosourceAudioSourcefor which AudioSource to use
volumefloat or doublefor the target level of volume
pitchfloat or doublefor the target pitch
timefloat or double

for the time in seconds the animation will take to complete
애니메이션이 완료되는 시간이며 속도를 설정한다.

delayfloat or doublefor the time in seconds the animation will wait before beginning
애니메이션 시작 전 대기 시간을 설정 한다.
easetypeEaseType or stringfor the shape of the easing curve applied to the animation
애니메이션에 적용할  완곡 곡선 설정
looptypeLoopType or stringfor the type of loop to apply once the animation has completed
onstartstringfor the name of a function to launch at the beginning of the animation
onstarttargetGameObjectfor a reference to the GameObject that holds the "onstart" method
onstartparamsObjectfor arguments to be sent to the "onstart" method
onupdatestringfor the name of a function to launch on every step of the animation
onupdatetargetGameObjectfor a reference to the GameObject that holds the "onupdate" method
onupdateparamsObjectfor arguments to be sent to the "onupdate" method
oncompletestring

for the name of a function to launch at the end of the animation
애니메이션이 끝났을때 지정된 함수를 수행한다.

oncompletetargetGameObject

for a reference to the GameObject that holds the "oncomplete" method
"oncomplete"를 hold하고 있는 게임오브젝트 참조

oncompleteparamsObjectfor arguments to be sent to the "oncomplete" method
ignoretimescalebooleansetting 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