loading...

Unity Dotween snippets

octi profile image Hiromichi Yamada Updated on ・1 min read
  • import lib.
using DG.Tweening;
  • Delayed Action.
DOVirtual.DelayedCall (0.5f, ()=>Foo());

DOVirtual.DelayedCall (0.5f, ()=>Debug.Log("called after 0.5 sec."));

  • Blink UGUI Image.
Image image = this.gameObject.GetComponent<Image> ();

DOTween.ToAlpha (
    () => image.color,
    color => image.color = color,
    0.2f,  // target alpha.
    2.0f   // time.
).SetLoops (-1, LoopType.Yoyo).SetEase (Ease.InOutCirc);
  • Infinite Loop UGUI Object.
RectTransform rt = progressObj.transform as RectTransform;
rt.DORotate (new Vector3 (0.0f, 0.0f, -360.0f), 1.0f, RotateMode.LocalAxisAdd).SetLoops (-1, LoopType.Restart).SetEase(Ease.Linear);

Discussion

markdown guide