public static IEnumerator Tween(Interpolator.Type type, float start, float end, float duration, OnTweenFrame callback) { float elapsed = 0; while (elapsed < duration) { float value = Interpolate(type, start, end, elapsed / duration); callback(value); elapsed += Time.deltaTime; yield return(null); } }
public static float Interpolate(Interpolator.Type type, float a, float b, float pct) { Interpolator i = new Interpolator(type); return(i.GetValue(a, b, pct)); }