public static IEnumerator DoEaseCoroutine(float duration, EaseType easeType, Action <float> lerpCallback) { for (float time = 0.0f; time <= duration; time += Time.deltaTime) { float p = Easings.Interpolate(time / duration, easeType); lerpCallback.Invoke(p); yield return(null); } lerpCallback.Invoke(1.0f); }
// PRAGMA MARK - Static public static Coroutine DoEaseFor(this MonoBehaviour m, float duration, EaseType easeType, Action <float> lerpCallback, Action finishedCallback = null) { return(m.DoLerpFor(duration, (p) => lerpCallback.Invoke(Easings.Interpolate(p, easeType)), finishedCallback)); }