public static IEnumerator LerpAmount(this Text text, string format, NumberFormats.Format numberType, UInt128 to, float duration) { NumberFormats.TryParse(text.text.ToLower().Replace(",", "").Replace("$", "").Replace("x", ""), numberType, out UInt128 from); var start = DateTime.UtcNow; for (;;) { var elapsed = (float)(DateTime.UtcNow - start).TotalSeconds; var percent = Curve.Evaluate(elapsed / duration); var normed = UInt128.Lerp(from, to, percent); text.SetAmount(format, numberType, normed); if (elapsed >= duration) { yield break; } yield return(null); } }