유니티 필수 에셋 중에 하나인 아이트윈
유니티에서 물체의 움직임을 보다 쉽게 설정 할 수 있습니다.
파일을 여시면 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 |


