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§
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 1Implementations§
Trait Implementations§
impl Copy for Easing
impl Eq for Easing
impl StructuralPartialEq for Easing
Auto Trait Implementations§
impl Freeze for Easing
impl RefUnwindSafe for Easing
impl Send for Easing
impl Sync for Easing
impl Unpin for Easing
impl UnsafeUnpin for Easing
impl UnwindSafe for Easing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).