pub enum Curve {
Linear,
Decelerate,
Cubic {
x1: f32,
y1: f32,
x2: f32,
y2: f32,
},
CriticalSpring {
omega: f32,
},
Interval {
begin: f32,
end: f32,
inner: Box<Curve>,
},
Flipped(Box<Curve>),
ThreePointCubic {
a1: [f32; 2],
b1: [f32; 2],
midpoint: [f32; 2],
a2: [f32; 2],
b2: [f32; 2],
},
}Expand description
An easing curve remapping [0,1] → [0,1].
f(0) = 0 and f(1) = 1 hold for every variant.
Variants§
Linear
The identity: f(t) = t.
Decelerate
A quadratic ease-out, f(t) = 1 − (1 − t)²: fast at once, then coasting to
a stop. It is the shape of something arriving — a glow flaring at an edge,
a value settling — where the interesting part is the start.
Cubic
A cubic Bézier defined by its two control points (x1,y1) and (x2,y2) —
the same parameterisation as CSS’s cubic-bezier().
Fields
CriticalSpring
The step response of a critically damped spring: starts at rest, settles
gently with no overshoot, renormalised so that f(1) = 1. omega sets how
lively it feels.
Interval
Applies inner only over the sub-window [begin, end]: 0 before, 1
after. This is what unlocks staggered animations.
Fields
Flipped(Box<Curve>)
Mirrored: f(t) = 1 − inner(1 − t), which turns an ease-in into an
ease-out.
ThreePointCubic
Two cubic Béziers joined at midpoint, each scaled into its own part of the
unit square: the first runs from (0, 0) to midpoint with control points a1
and b1, the second from midpoint to (1, 1) with a2 and b2 (milestone
619). The shape of the reference’s emphasized motion, which one cubic cannot
draw: a slow start, a fast middle and a long settle.
Implementations§
Source§impl Curve
impl Curve
Sourcepub fn ease_in_out() -> Curve
pub fn ease_in_out() -> Curve
ease-in-out: slow at both ends.
Sourcepub fn ease_in_out_cubic_emphasized() -> Curve
pub fn ease_in_out_cubic_emphasized() -> Curve
The reference’s emphasized easing, easeInOutCubicEmphasized: Material 3’s
motion for things that move across the screen — a page arriving, a sheet rising.
Sourcepub fn fast_ease_in_to_slow_ease_out() -> Curve
pub fn fast_ease_in_to_slow_ease_out() -> Curve
The reference’s fastEaseInToSlowEaseOut: an iOS page sliding in.
Sourcepub fn linear_to_ease_out() -> Curve
pub fn linear_to_ease_out() -> Curve
The reference’s linearToEaseOut, cubic-bezier(0.35, 0.91, 0.33, 0.97): an
iOS page leaving under the one that arrives.
Sourcepub fn ease_in_to_linear() -> Curve
pub fn ease_in_to_linear() -> Curve
The reference’s easeInToLinear, cubic-bezier(0.67, 0.03, 0.65, 0.09): the
same page coming back.
Sourcepub fn critical_spring() -> Curve
pub fn critical_spring() -> Curve
The framework’s default spring curve (omega = 8): the feel of screen and
sheet transitions, in closed form.