홈페이지 : http://dotween.demigiant.com/index.php
설명 : http://dotween.demigiant.com/documentation.php
// 0.4.0 좌표로 이동
redCube.DOMove(new Vector3(0,4,0), 2);
// 0.4.0 좌표에서 출발
greenCube.DOMove(new Vector3(0,4,0), 2).From();
// 현재 좌표에서 0.4.0 만큼 더한 값만큼 이동
blueCube.DOMove(new Vector3(0,4,0), 2).SetRelative();
// 매트리얼 칼라 변경
purpleCube.GetComponent<Renderer>().material.DOColor(Color.yellow, 2).SetLoops(-1, LoopType.Yoyo);
// value 수정
DG.Tweening.DOVirtual.Float(0, 10, 1, (t)=> {
Debug.Log(t);
} );
// Update
public static Tweener Float(float from, float to, float duration, TweenCallback onVirtualUpdate)
{
float val = from;
return DOTween.To(() => val, x => val = x, to, duration).OnUpdate(() => onVirtualUpdate(val));
}
Float(0, 100, 3, aaa);
private void aaa(float value)
{
Debug.Log(value);
// throw new NotImplementedException();
}
// 패스
public class Paths : MonoBehaviour
{
public Transform target;
public PathType pathType = PathType.CatmullRom;
public Vector3[] waypoints = new[] {
new Vector3(4, 2, 6),
new Vector3(8, 6, 14),
new Vector3(4, 6, 14),
new Vector3(0, 6, 6),
new Vector3(-3, 0, 0)
};
void Start()
{
// Create a path tween using the given pathType, Linear or CatmullRom (curved).
// Use SetOptions to close the path
// and SetLookAt to make the target orient to the path itself
Tween t = target.DOPath(waypoints, 4, pathType)
.SetOptions(true)
.SetLookAt(0.001f);
// Then set the ease to Linear and use infinite loops
t.SetEase(Ease.Linear).SetLoops(-1);
}
}
// 시퀀스
IEnumerator Start()
{
// Start after one second delay (to ignore Unity hiccups when activating Play mode in Editor)
yield return new WaitForSeconds(1);
// Create a new Sequence.
// We will set it so that the whole duration is 6
Sequence s = DOTween.Sequence();
// Add an horizontal relative move tween that will last the whole Sequence's duration
s.Append(cube.DOMoveX(6, duration).SetRelative().SetEase(Ease.InOutQuad));
// Insert a rotation tween which will last half the duration
// and will loop forward and backward twice
s.Insert(0, cube.DORotate(new Vector3(0, 45, 0), duration / 2).SetEase(Ease.InQuad).SetLoops(2, LoopType.Yoyo));
// Add a color tween that will start at half the duration and last until the end
s.Insert(duration / 2, cube.GetComponent<Renderer>().material.DOColor(Color.yellow, duration / 2));
// Set the whole Sequence to loop infinitely forward and backwards
s.SetLoops(-1, LoopType.Yoyo);
}
기타
transform.DOMoveX(100, 1);
transform.DORestart();
DOTween.Play();
myTween.SetLoops(4, LoopType.Yoyo).SetSpeedBased();
myTween.OnStart(myStartFunction).OnComplete(myCompleteFunction);
'Unity > 기타' 카테고리의 다른 글
즐겨찾기-최적화 (0) | 2020.12.13 |
---|---|
코드로 Player Settings 창 열기 (0) | 2020.06.02 |
Debug Log 에 칼라 넣기 (0) | 2019.10.11 |
TextMeshProUGUI 에서 한글 폰트 만들기 (0) | 2019.09.18 |
Task를 취소하기 (0) | 2019.09.17 |