SHARE
TWEET

DOTween DoRotate (0-120), (120-0), (0-60), (60-0)

Demigiant Jan 27th, 2020 76 in 157 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // UIRotate.cs
  2. // Desc: Rotate using DOTween
  3. // From: 90 degrees to 120 degrees
  4. // To: 120 degrees back to 90 degrees
  5. // From: 90 degrees to 60 degrees
  6. // To: 60 degrees back to 90 degrees
  7.  
  8. using UnityEngine;
  9. using DG.Tweening;
  10.  
  11. public class UIRotate : MonoBehaviour
  12. {
  13.     // public fields
  14.    
  15.     // private fields
  16.     private RectTransform rctTFM;
  17.    
  18.     // called before Start method
  19.     void Awake ()
  20.     {
  21.         // cach eour RectTransform
  22.         rctTFM = GetComponent<RectTransform>();
  23.     }
  24.  
  25.     // Use this for initialization
  26.     void Start ()
  27.     {
  28.         DOTween.Sequence()
  29.            .Append(rctTFM.DORotate(new Vector3(0f, 0f, 120f), 1f))
  30.            .Append(rctTFM.DORotate(new Vector3(0f, 0f, 90f), 1f))
  31.            .Append(ctTFM.DORotate(new Vector3(0f, 0f, 60f), 1f))
  32.            .Append(rrctTFM.DORotate(new Vector3(0f, 0f, 90f), 1f))
  33.            .SetLoops(-1, LoopType.Restart);
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top