Skip to main content

euv_engine/easing/
enum.rs

1/// The complete set of Robert Penner easing functions used to warp a linear
2/// interpolation parameter into an accelerated / decelerated curve.
3///
4/// Each variant maps a normalized input `t` in the range 0.0 to 1.0 to an
5/// eased output, following the same naming as mainstream engines
6/// (Godot `Tween::EaseType`, Phaser `Ease`, CSS `timing-function`).
7#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
8pub enum Easing {
9    /// Constant velocity: `f(t) = t`.
10    #[default]
11    Linear,
12    /// Quadratic acceleration from zero velocity.
13    InQuad,
14    /// Quadratic deceleration to zero velocity.
15    OutQuad,
16    /// Quadratic acceleration until halfway, then deceleration.
17    InOutQuad,
18    /// Cubic acceleration from zero velocity.
19    InCubic,
20    /// Cubic deceleration to zero velocity.
21    OutCubic,
22    /// Cubic acceleration until halfway, then deceleration.
23    InOutCubic,
24    /// Quartic acceleration from zero velocity.
25    InQuart,
26    /// Quartic deceleration to zero velocity.
27    OutQuart,
28    /// Quartic acceleration until halfway, then deceleration.
29    InOutQuart,
30    /// Quintic acceleration from zero velocity.
31    InQuint,
32    /// Quintic deceleration to zero velocity.
33    OutQuint,
34    /// Quintic acceleration until halfway, then deceleration.
35    InOutQuint,
36    /// Sinusoidal acceleration from zero velocity.
37    InSine,
38    /// Sinusoidal deceleration to zero velocity.
39    OutSine,
40    /// Sinusoidal acceleration until halfway, then deceleration.
41    InOutSine,
42    /// Exponential acceleration from zero velocity.
43    InExpo,
44    /// Exponential deceleration to zero velocity.
45    OutExpo,
46    /// Exponential acceleration until halfway, then deceleration.
47    InOutExpo,
48    /// Circular acceleration from zero velocity.
49    InCirc,
50    /// Circular deceleration to zero velocity.
51    OutCirc,
52    /// Circular acceleration until halfway, then deceleration.
53    InOutCirc,
54    /// Overshoots backwards before moving forwards.
55    InBack,
56    /// Overshoots the target then settles back onto it.
57    OutBack,
58    /// Overshoots backwards then forwards past the target before settling.
59    InOutBack,
60    /// Elastic oscillation building up from rest.
61    InElastic,
62    /// Elastic oscillation settling down onto the target.
63    OutElastic,
64    /// Elastic oscillation at both ends.
65    InOutElastic,
66    /// Bounces off the start before moving forwards.
67    InBounce,
68    /// Bounces off the target like a dropped ball.
69    OutBounce,
70    /// Bounces at both ends.
71    InOutBounce,
72}