public IEnumerator ShowText(bool val) { float t = 0; float d = .25f; float a = 0; while (t < d) { t += Time.fixedDeltaTime; float p = Mathf.Clamp01(t / d); if (val) { a = start.a * EZEasings.SmoothStop3(p); } else { a = start.a - start.a * EZEasings.SmoothStart3(p); } current = new Color(start.r, start.g, start.b, a); GetComponent <TMP_Text>().color = current; yield return(new WaitForFixedUpdate()); } }
public IEnumerator RevealBlock(bool val) { float t = 0; float d = .15f; float a = val ? 1f : 0f; while (t < d) { t += Time.fixedDeltaTime; float p = Mathf.Clamp01(t / d); if (val) { alpha = a * EZEasings.SmoothStop3(p); s.color = new Color(color.r, color.g, color.b, alpha); } else { alpha = a - a * EZEasings.SmoothStart3(p); s.color = new Color(color.r, color.g, color.b, alpha); } yield return(new WaitForFixedUpdate()); } }
IEnumerator Explode() { float t = 0; float targetScale = 40; while (t < explodeDuration) { t += Time.fixedDeltaTime; target.transform.localScale = Vector3.one + Vector3.one * targetScale * EZEasings.SmoothStop3(t / explodeDuration); yield return(new WaitForFixedUpdate()); } }
IEnumerator ShowGrab() { float t = 0; float d = grabDuration; while (t < d) { float p = Mathf.Clamp01(t / d); t += Time.fixedDeltaTime; targetRadius = grabRadius + (jumpRadius - grabRadius) * (1 - EZEasings.SmoothStop3(p)); yield return(new WaitForFixedUpdate()); } }
IEnumerator Flash() { float d = flashDuration; float t = 0; while (t < d) { t += Time.fixedDeltaTime; float p = t / d; float alpha = (1 - EZEasings.SmoothStop3(p)) * flashColor.a; Color adjustedColor = new Color(flashColor.r, flashColor.g, flashColor.b, alpha); s.color = adjustedColor; yield return(new WaitForFixedUpdate()); } }
public static float GetSmoothStop3Range(Property p, float t) { return(p.start + (p.end - p.start) * EZEasings.SmoothStop3(t)); }