Skip to main content

euv_engine/easing/
enum.rs

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