public static IEnumerator MoveTo(this MonoBehaviour v, EaseType easeType, float duration, Vector3 to) { Vector3 from = v.transform.localPosition; var ease = new EaseRunner(easeType, duration); while (ease.IsPlaying()) { v.transform.localPosition = Vector3.Lerp(from, to, ease.Run()); yield return new WaitForEndOfFrame(); } }
public static IEnumerator AlphaTo(this UIPanel v, EaseType easeType, float duration, float to) { float from = v.alpha; var ease = new EaseRunner(easeType, duration); while (ease.IsPlaying()) { v.alpha = Mathf.Lerp(from, to, ease.Run()); yield return new WaitForEndOfFrame(); } }
public static IEnumerator ColorTo(this UIWidget v, EaseType easeType, float duration, Color to) { Color from = v.color; var ease = new EaseRunner(easeType, duration); while (ease.IsPlaying()) { v.color = Color.Lerp(from, to, ease.Run()); yield return new WaitForEndOfFrame(); } }
public static IEnumerator ScaleTo(this MonoBehaviour v, EaseType easeType, float duration, Vector3 to) { Vector3 from = v.transform.localScale; var ease = new EaseRunner(easeType, duration); while (ease.IsPlaying()) { v.transform.localScale = Vector3.Lerp(from, to, ease.Run()); yield return(new WaitForEndOfFrame()); } }