/// <summary> /// Animates a Scroll Indicator /// </summary> /// <param name="startValue"></param> /// <param name="endValue"></param> /// <param name="verticalScrollIndicator"></param> /// <param name="lerpDuration"></param> /// <param name="onDone">Method to execute after it's done animating.</param> /// <returns></returns> public static IEnumerator ScrollIndicatorAnimator(float startValue, float endValue, VerticalScrollIndicator verticalScrollIndicator, float lerpDuration = 0.3f, Action onDone = null) { float timeElapsed = 0f; while (timeElapsed < lerpDuration) { verticalScrollIndicator.progress = Mathf.Lerp(startValue, endValue, Easings.EaseOutCubic(timeElapsed / lerpDuration)); timeElapsed += Time.deltaTime; yield return(null); } verticalScrollIndicator.progress = endValue; onDone?.Invoke(); }