pub enum Easing {
Show 31 variants
Linear,
InQuad,
OutQuad,
InOutQuad,
InCubic,
OutCubic,
InOutCubic,
InQuart,
OutQuart,
InOutQuart,
InQuint,
OutQuint,
InOutQuint,
InSine,
OutSine,
InOutSine,
InExpo,
OutExpo,
InOutExpo,
InCirc,
OutCirc,
InOutCirc,
InBack,
OutBack,
InOutBack,
InElastic,
OutElastic,
InOutElastic,
InBounce,
OutBounce,
InOutBounce,
}Expand description
The complete set of Robert Penner easing functions used to warp a linear interpolation parameter into an accelerated / decelerated curve.
Each variant maps a normalized input t in the range 0.0 to 1.0 to an
eased output, following the same naming as mainstream engines
(Godot Tween::EaseType, Phaser Ease, CSS timing-function).
Variants§
Linear
Constant velocity: f(t) = t.
InQuad
Quadratic acceleration from zero velocity.
OutQuad
Quadratic deceleration to zero velocity.
InOutQuad
Quadratic acceleration until halfway, then deceleration.
InCubic
Cubic acceleration from zero velocity.
OutCubic
Cubic deceleration to zero velocity.
InOutCubic
Cubic acceleration until halfway, then deceleration.
InQuart
Quartic acceleration from zero velocity.
OutQuart
Quartic deceleration to zero velocity.
InOutQuart
Quartic acceleration until halfway, then deceleration.
InQuint
Quintic acceleration from zero velocity.
OutQuint
Quintic deceleration to zero velocity.
InOutQuint
Quintic acceleration until halfway, then deceleration.
InSine
Sinusoidal acceleration from zero velocity.
OutSine
Sinusoidal deceleration to zero velocity.
InOutSine
Sinusoidal acceleration until halfway, then deceleration.
InExpo
Exponential acceleration from zero velocity.
OutExpo
Exponential deceleration to zero velocity.
InOutExpo
Exponential acceleration until halfway, then deceleration.
InCirc
Circular acceleration from zero velocity.
OutCirc
Circular deceleration to zero velocity.
InOutCirc
Circular acceleration until halfway, then deceleration.
InBack
Overshoots backwards before moving forwards.
OutBack
Overshoots the target then settles back onto it.
InOutBack
Overshoots backwards then forwards past the target before settling.
InElastic
Elastic oscillation building up from rest.
OutElastic
Elastic oscillation settling down onto the target.
InOutElastic
Elastic oscillation at both ends.
InBounce
Bounces off the start before moving forwards.
OutBounce
Bounces off the target like a dropped ball.
InOutBounce
Bounces at both ends.
Implementations§
Source§impl Easing
Implements easing curve evaluation for Easing.
impl Easing
Implements easing curve evaluation for Easing.
Sourcepub fn evaluate(&self, t: f64) -> f64
pub fn evaluate(&self, t: f64) -> f64
Evaluates the easing curve at the given normalized time.
The input is clamped into the range 0.0 to 1.0 before evaluation, so callers may pass slightly out-of-range accumulators without producing out-of-range output.
§Arguments
f64- The normalized time, typically in the range 0.0 to 1.0.
§Returns
f64- The eased value, where 0.0 maps to the start and 1.0 to the end.