#[non_exhaustive]pub enum Easing {
Linear,
EaseInQuad,
EaseOutQuad,
EaseInOutQuad,
EaseInCubic,
EaseOutCubic,
EaseInOutCubic,
EaseInSine,
EaseOutSine,
EaseInOutSine,
EaseOutElastic,
EaseOutBounce,
}Expand description
A normalized easing curve: reshapes a linear progress fraction (0.0..=1.0) into an eased
one, the same named curves as CSS transitions and https://easings.net.
Linear is the default. The In variants start slow, Out variants end
slow, and InOut variants do both (matching the usual naming convention: “In” describes the
start of the motion, not a direction).
EaseOutElastic and EaseOutBounce are the
only curves in their families: both are used for a settle/overshoot effect at the end of a
motion, and the in/in-out variants (the same shape mirrored to the start) are uncommon enough
in practice that this curated set omits them.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Linear
Constant speed: t unchanged.
1 | ,-'
| ,-'
| ,-'
| ,-'
0 +-'------------
0 1EaseInQuad
Starts slow, accelerates, quadratically.
1 | ,'
| ,'
| ,'
| __,-''
0 +------''-------
0 1EaseOutQuad
Starts fast, decelerates, quadratically.
1 | __,,-------
| ,-'
| ,'
| ,'
0 +'---------------
0 1EaseInOutQuad
Slow -> fast -> slow, quadratically.
1 | ___,,--
| ,-'
| ,'
| __,-'
0 +-''-------------
0 1EaseInCubic
Starts slow, accelerates, cubically: a stronger version of EaseInQuad.
1 | ,'
| ,
| ,'
| ____,-'
0 +-------''--------
0 1EaseOutCubic
Starts fast, decelerates, cubically: a stronger version of EaseOutQuad.
1 | __,,-----------
| ,'
|,
|'
0 +-----------------
0 1EaseInOutCubic
Slow -> fast -> slow, cubically: a stronger version of EaseInOutQuad.
1 | ___,---
| ,'
| ,
| __,'
0 +-----''----------
0 1EaseInSine
A gentle sine-shaped start.
1 | ,--'
| ,-'
| ,-'
| ,--'
0 +--''-------------
0 1EaseOutSine
A gentle sine-shaped end.
1 | ,--''''''''''''
| ,'
| ,'
|,'
0 +-----------------
0 1EaseInOutSine
A gentle sine-shaped start and end.
1 | ____,----
| ,'
| ,'
| __,'
0 +--''--------------
0 1EaseOutElastic
Springs past the target and oscillates back before settling, going outside 0.0..=1.0
for part of the curve.
,-.
1 -+ \ ______________
| \ /
| `--'
0 -+
0 1EaseOutBounce
Bounces (like a dropped ball) to a stop at the target.
1 | __ _ _.
| / \ / |_/ |
| / \ / |
| / \_/ |
0 +----' |
0 1