Class Ease
Provides a complete library of static easing functions for tween interpolation.
Each function transforms a normalized time value t in the range
[0, 1] into an eased output value, mapping the tween's linear progress
to a curve that controls the perceived speed of the animation.
All functions respect the mathematical boundary conditions f(0) = 0
and f(1) = 1 except for easing types that intentionally overshoot
(Elastic, Back). Inputs outside [0, 1] produce extrapolated results
unless the individual function clamps them (InExpo, OutExpo, InOutExpo,
InElastic, OutElastic, InOutElastic).
The two primary entry points for the tween engine are Evaluate(EaseType, float) (for a one-off sample) and GetFunction(EaseType) (to cache a delegate for repeated evaluation). Individual named methods are also public so callers can invoke a specific curve directly without going through the dispatch switch.
Inherited Members
Namespace: Scylla.Core.Util.Tween
Assembly: ScyllaCore.dll
Syntax
public static class Ease
Methods
Evaluate(EaseType, float)
Evaluates the easing function identified by easeType at the
given normalized time t and returns the eased output value.
This method dispatches to the corresponding named easing function via a switch expression. For hot paths where the same ease type is sampled many times consider calling GetFunction(EaseType) once and caching the returned delegate.
If easeType is Custom or an unrecognised
value, the method falls through to Linear(float) so the caller receives a
safe default. Custom ease delegates must be evaluated separately through the tween
engine's EasedProgress property in TweenBase.
Declaration
public static float Evaluate(EaseType easeType, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| EaseType | easeType | The EaseType that identifies which easing curve to sample. Custom falls back to Linear(float). |
| float | t | The normalized time to evaluate, typically in the range |
Returns
| Type | Description |
|---|---|
| float | The eased output value. For most easing types this is in |
Flash(float)
A non-standard triangular flash curve that ramps linearly from 0 to 1
during the first half of the duration (t < 0.5) and then ramps linearly
back from 1 to 0 during the second half. The peak of exactly
1 is reached at t = 0.5.
This is useful for brief visibility pulses, health-hit flashes, and button highlight effects where the animated property should return to its original value by the end of the tween without needing a Yoyo loop configuration.
Declaration
public static float Flash(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
GetFunction(EaseType)
Returns a Func<T, TResult> delegate that wraps the easing method
corresponding to easeType. The returned delegate can be cached
and invoked repeatedly without the overhead of the dispatch switch on each call.
Because each named easing method is a static method, the delegate is allocated
once per call to GetFunction. Cache the result at configuration time
(e.g. when a tween is created) rather than calling GetFunction every frame.
If easeType is Custom or an
unrecognised value, the delegate wrapping Linear(float) is returned.
Declaration
public static Func<float, float> GetFunction(EaseType easeType)
Parameters
| Type | Name | Description |
|---|---|---|
| EaseType | easeType | The EaseType that identifies which easing curve to retrieve. Custom returns a Linear(float) delegate. |
Returns
| Type | Description |
|---|---|
| Func<float, float> | A |
InBack(float)
Back easing in - the property first moves slightly in the negative direction
(anticipation) before accelerating forward to the end value. The overshoot amount
is controlled by the internal constant BACK_S = 1.70158 (Robert Penner's
standard value). Formula: f(t) = t² * ((BACK_S + 1) * t - BACK_S).
The minimum output (the anticipation dip) is approximately -0.09,
so the return value can be slightly below 0. Use with unclamped
lerp methods such as those in TweenLerp.
Declaration
public static float InBack(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value; output is slightly below |
InBounce(float)
Bounce easing in - the property bounces multiple times near the start value before
launching forward to the end. Implemented as the time-reversal of
OutBounce(float): f(t) = 1 - OutBounce(1 - t).
Output stays within [0, 1].
Declaration
public static float InBounce(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InCirc(float)
Circular easing in - the property starts slowly and accelerates following the
quarter-circle curve f(t) = 1 - √(1 - t²). The gradient becomes infinite
at t = 1, so the curve arrives at the end value with a very sharp burst
of speed.
Declaration
public static float InCirc(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InCubic(float)
Cubic easing in - starts slowly and accelerates following a cubic curve.
Formula: f(t) = t³. More pronounced acceleration than InQuad(float);
the curve stays near zero for most of its range and rises steeply at the end.
Declaration
public static float InCubic(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InElastic(float)
Elastic easing in - simulates a stretched spring that pulls the property backward
at the start before releasing it forward to the end value. The property oscillates
with decaying amplitude around 0 before accelerating toward 1.
The oscillation is governed by the period constant ELASTIC_P = 0.3 and
the amplitude constant ELASTIC_A = 1.0 defined in this class.
Output is clamped to exactly 0 at t <= 0 and 1
at t >= 1; intermediate values can exceed the [0, 1] range.
Declaration
public static float InElastic(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value; may be outside |
InExpo(float)
Exponential easing in - the property starts from absolute rest and then accelerates
explosively following a base-2 exponential curve.
Formula: f(t) = 2^(10*(t-1)).
The function is explicitly clamped to return exactly 0 when
t <= 0 to prevent a small non-zero offset caused by the floating-point
asymptote of the formula at zero.
Declaration
public static float InExpo(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutBack(float)
Back easing in/out - anticipation at the start and overshoot at the end. Uses a
larger overshoot coefficient (BACK_S2 = BACK_S * 1.525 ≈ 2.594) to produce
visually balanced curvature across both halves. The curve dips below 0 early
and rises above 1 late before settling.
Declaration
public static float InOutBack(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value; output can be outside |
InOutBounce(float)
Bounce easing in/out - bounces at both the start and the end. The first half
mirrors InBounce(float) scaled to [0, 0.5] and the second half
mirrors OutBounce(float) scaled to [0.5, 1]. Output stays within
[0, 1].
Declaration
public static float InOutBounce(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutCirc(float)
Circular easing in/out - sharp start-acceleration, smooth midpoint transition, and
sharp end-deceleration. The curve is the steepest InOut variant due to the infinite
derivative at each boundary. Implemented using two separate circular expressions
joined with C¹ continuity at t = 0.5.
Declaration
public static float InOutCirc(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutCubic(float)
Cubic easing in/out - slow start, peak speed at the midpoint, slow finish.
Uses 4t³ for the first half and a symmetric cubic expression for the second
half to ensure a C¹-continuous join at t = 0.5.
Declaration
public static float InOutCubic(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutElastic(float)
Elastic easing in/out - oscillates around the start during the first half and
around the end during the second half. Uses an extended period
(ELASTIC_P * 1.5) so the total oscillation fits within the unit interval
without feeling rushed.
Output is clamped to exactly 0 at t <= 0 and 1
at t >= 1; intermediate values can significantly exceed the
[0, 1] range. Use with unclamped lerp methods.
Declaration
public static float InOutElastic(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value; may be significantly outside |
InOutExpo(float)
Exponential easing in/out - nearly motionless start, explosive acceleration through
the midpoint, and nearly motionless finish. Combines InExpo(float) for the
first half and OutExpo(float) for the second half, scaled so the midpoint
is exactly 0.5.
Explicitly clamped to 0 at t <= 0 and 1 at
t >= 1 to avoid floating-point asymptote artefacts.
Declaration
public static float InOutExpo(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutQuad(float)
Quadratic easing in/out - slow start, peak speed at the midpoint, slow finish.
Implemented with separate expressions for each half so the midpoint is exactly
0.5 and the curve is C¹-continuous at the join.
Declaration
public static float InOutQuad(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutQuart(float)
Quartic easing in/out - very slow start, very sharp peak at the midpoint, very slow
finish. Uses 8t⁴ for the first half and a symmetric quartic expression for
the second half to maintain C¹ continuity at t = 0.5.
Declaration
public static float InOutQuart(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutQuint(float)
Quintic easing in/out - extremely slow start, extremely sharp peak at the midpoint,
extremely slow finish. Uses 16t⁵ for the first half and a symmetric quintic
expression for the second half. The most aggressive of the polynomial InOut types.
Declaration
public static float InOutQuint(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InOutSine(float)
Sinusoidal easing in/out - slow start, full speed at the midpoint, slow finish.
Formula: f(t) = -0.5 * (cos(π * t) - 1). Produces a symmetric S-curve
shaped like a quarter of a cosine period. The gentlest of all InOut easing types.
Declaration
public static float InOutSine(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InQuad(float)
Quadratic easing in - starts slowly and accelerates following a parabola.
Formula: f(t) = t². The most commonly used ease-in; provides moderate
acceleration without looking mechanical.
Declaration
public static float InQuad(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InQuart(float)
Quartic easing in - starts very slowly and accelerates sharply following a
fourth-power curve. Formula: f(t) = t⁴. The curve is nearly flat for
most of its range, creating a strong dramatic rush toward the end.
Declaration
public static float InQuart(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InQuint(float)
Quintic easing in - starts from absolute rest and accelerates following a fifth-power
curve. Formula: f(t) = t⁵. The most aggressive of the polynomial ease-in
types; the output is essentially zero for the first third of the range.
Declaration
public static float InQuint(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
InSine(float)
Sinusoidal easing in - the animated value starts very slowly and accelerates
following the shape of a cosine curve. Formula: f(t) = 1 - cos(t * π/2).
The derivative at t = 0 is zero (starts from rest) and at t = 1
equals π/2 (fastest at the end).
Declaration
public static float InSine(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
Linear(float)
Returns t unchanged - linear interpolation with a constant
rate of change. The output equals the input: f(t) = t.
Declaration
public static float Linear(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | The normalized input time, typically in |
Returns
| Type | Description |
|---|---|
| float |
|
OutBack(float)
Back easing out - the property overshoots the end value before settling back.
The overshoot amount is controlled by the internal constant BACK_S = 1.70158.
Formula: f(t) = (t-1)² * ((BACK_S + 1) * (t-1) + BACK_S) + 1.
The maximum output (the overshoot peak) is approximately 1.09,
so the return value can be slightly above 1. Use with unclamped
lerp methods.
Declaration
public static float OutBack(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value; output is slightly above |
OutBounce(float)
Bounce easing out - the property arrives at the end value and then bounces back and
forth with decreasing amplitude before settling. Produces four distinct bounces at
the parabolic segments defined by the constants 7.5625 and 2.75
(Robert Penner's standard bounce coefficients). Output stays within [0, 1].
Declaration
public static float OutBounce(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutCirc(float)
Circular easing out - the property starts very fast and decelerates gently following
the complementary quarter-circle curve. Formula: f(t) = √(1 - (t-1)²).
The gradient at t = 0 is infinite, giving an instantaneous burst at the start.
Declaration
public static float OutCirc(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutCubic(float)
Cubic easing out - starts at full speed and decelerates following the mirror of a
cubic curve. Formula: f(t) = (t - 1)³ + 1. The deceleration is more
pronounced than OutQuad(float).
Declaration
public static float OutCubic(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutElastic(float)
Elastic easing out - the property accelerates to the end value and then oscillates around it with decaying amplitude before settling. This creates a spring-like overshoot effect at the finish of the animation.
The oscillation is governed by the period constant ELASTIC_P = 0.3 and
the amplitude constant ELASTIC_A = 1.0 defined in this class.
Output is clamped to exactly 0 at t <= 0 and 1
at t >= 1; intermediate values can exceed the [0, 1] range.
Declaration
public static float OutElastic(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value; may be outside |
OutExpo(float)
Exponential easing out - the property starts at explosive speed and decelerates
asymptotically toward the end value following a negative base-2 exponential curve.
Formula: f(t) = 1 - 2^(-10*t).
The function is explicitly clamped to return exactly 1 when
t >= 1 to prevent a small under-shoot caused by the floating-point
asymptote of the formula at one.
Declaration
public static float OutExpo(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutQuad(float)
Quadratic easing out - starts at full speed and decelerates following the mirror
of a parabola. Formula: f(t) = t * (2 - t). This is the default ease type
for the Scylla tween system (DefaultEaseType).
Declaration
public static float OutQuad(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutQuart(float)
Quartic easing out - starts very fast and decelerates sharply following the mirror of
a fourth-power curve. Formula: f(t) = 1 - (t - 1)⁴. Produces a dramatic
snap-to-target feel with a very sharp initial burst of speed.
Declaration
public static float OutQuart(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutQuint(float)
Quintic easing out - starts at maximum speed and decelerates following the mirror
of a fifth-power curve. Formula: f(t) = (t - 1)⁵ + 1. The most aggressive
of the polynomial ease-out types; nearly all motion completes in the first two-thirds
of the range.
Declaration
public static float OutQuint(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |
OutSine(float)
Sinusoidal easing out - the animated value starts at maximum speed and decelerates
following the shape of a sine curve. Formula: f(t) = sin(t * π/2).
The derivative at t = 0 is π/2 (fastest at the start) and at
t = 1 is zero (settles gently).
Declaration
public static float OutSine(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | Normalized time in |
Returns
| Type | Description |
|---|---|
| float | Eased value in |