Esempio n. 1
0
        public static IEnumerator Start(float duration, Action <float> onUpdate, Action onComplete, Func <float, float> ease)
        {
            if (ease == null)
            {
                ease = EaseFactory.GetEquation(Ease.QuadEaseInOut);
            }

            var start = Time.time;
            var end   = start + duration;

            while (Time.time < end)
            {
                var progress = (Time.time - start) / duration;
                if (progress > 1f)
                {
                    progress = 1f;
                }
                onUpdate(ease.Invoke(progress));
                yield return(null);
            }
            onUpdate(1f);
            onComplete();
        }
Esempio n. 2
0
 public static IEnumerator Start(float duration, Action <float> onUpdate, Action onComplete, Ease ease = Ease.QuadEaseInOut)
 {
     return(Start(duration, onUpdate, onComplete, EaseFactory.GetEquation(ease)));
 }