Esempio n. 1
0
    void Start()
    {
        AnimateThis anim = GetComponent <AnimateThis>();

        AnimateThis.Animation a = anim.Transformate()
                                  .ToPosition(new Vector3(0, 10, 0))
                                  .ToScale(new Vector3(10, 2, 3))
                                  .ToRotation(Quaternion.AngleAxis(90, Vector3.up))
                                  .Delay(1)
                                  .Duration(2)
                                  .Ease(AnimateThis.EaseSmooth)
                                  .Start();
    }
        private IEnumerator StartAnimation2()
        {
            AnimateThis.Animation a1 = null;

            AnimateThis.With(this)
            .Transform()
            .ToScale(3).Duration(10).Start();

            while (true)
            {
                a1 = AnimateThis.With(this)
                     .Cancel(a1)
                     .Transform()
                     .ToPosition(UnityEngine.Random.insideUnitSphere * 2).Duration(3)
                     .Ease(AnimateThis.EaseSmooth).OnCancel(() => Debug.Log("Cancelled"))
                     .Start();

                yield return(new WaitForSeconds(3 * UnityEngine.Random.value));
            }
        }