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 AnimateRing() { SpriteRenderer target = foreground; float time = 0; float targetRadius = targetMax - baseRadius; while (time < ringDuration) { time += Time.fixedDeltaTime; float t = time / ringDuration; float radius = 0; radius = baseRadius + targetRadius * EZEasings.SmoothStart3(t); target.transform.localScale = Vector3.one * radius; yield return(new WaitForFixedUpdate()); } }
IEnumerator AnimateMask() { SpriteRenderer target = background; float time = 0; float targetRadius = targetMax - baseRadius; while (time < maskDuration) { time += Time.fixedDeltaTime; float t = time / maskDuration; float radius = 0; radius = baseRadius + targetRadius * EZEasings.SmoothStart3(t) * 1.01f; target.transform.localScale = Vector3.one * radius; yield return(new WaitForFixedUpdate()); } Destroy(gameObject); }
IEnumerator FadeOut() { if (fadeDuration < threshold) { Destroy(gameObject); } float t = 0; while (t < fadeDuration) { t += Time.fixedDeltaTime; myColor = s.color; myColor.a = startAlpha * (1 - EZEasings.SmoothStart3(t / fadeDuration)); s.color = myColor; yield return(new WaitForFixedUpdate()); } Destroy(gameObject); }
// Update is called once per frame void Update() { mousePos = Input.mousePosition; if (Input.GetMouseButtonDown(0)) { startPos = mousePos; } if (Input.GetMouseButton(0)) { if (Input.mousePosition.y < Screen.height / 2) { // mouseDelta = (Vector2)Input.mousePosition - lastPosition; // lastPosition = Input.mousePosition; drag = mousePos - startPos; value += EZEasings.SmoothStart3(drag.x); } } }
IEnumerator AnimateCircle() { float t = 0; while (t < animationDuration) { t += Time.deltaTime; float percent = t / animationDuration; radius = maxRadius * EZEasings.SmoothStart3(percent); float alpha = alphaOverTime.Evaluate(percent); Color lineColor = GetComponent <LineRenderer>().material.color; lineColor.a = alpha; line.material.color = lineColor; line.startColor = lineColor; line.endColor = lineColor; yield return(new WaitForEndOfFrame()); } }
void SpawnCircle(Vector2 position) { Vector3 targetPos = position; targetPos.z = -1; CircleEffect f = Instantiate(circle); f.transform.position = targetPos; radiusDiff = maxRadius - minRadius; widthDiff = maxWidthPercent - minWidthPercent; timeDiff = maxTime - minTime; float circleRadius = minRadius + radiusDiff * EZEasings.SmoothStart3(percent); Debug.Log(radiusDiff * EZEasings.SmoothStart3(percent)); float lineWidth = minWidthPercent + widthDiff * EZEasings.SmoothStart3(percent); float duration = minTime + timeDiff * EZEasings.SmoothStart3(percent); f.TriggerCircle(circleRadius, lineWidth, myColor, duration, true); }
void UpdateColor(Vector2 offset) { float t = gradientIndexPct + (EZEasings.SmoothStart3(offset.x) * gradientAdjustmentRate * Time.deltaTime); if (useConstantFlow) { t += constantFlowRate * Time.deltaTime; } if (t < 0) { t = 1 - t; } else { t %= 1; } gradientIndexPct = t; bgColor = colorRange.Evaluate(t); s.color = bgColor; }
public static float GetSmoothStart3Range(Property p, float t) { return(p.start + (p.end - p.start) * EZEasings.SmoothStart3(t)); }
public IEnumerator PlayMaskOut() { float t = 0; while (t < maskOutDuration) { t += Time.fixedDeltaTime; mask.transform.localScale = Vector3.zero + Vector3.one * baseScale * (1 - EZEasings.SmoothStart3(t / maskOutDuration)); yield return(new WaitForFixedUpdate()); } }