#[repr(C, u8)]pub enum AnimationInterpolationFunction {
Ease,
Linear,
EaseIn,
EaseOut,
EaseInOut,
CubicBezier(SvgCubicCurve),
Spring(SpringCurve),
}Expand description
Represents an animation timing function.
Variants§
Ease
Linear
EaseIn
EaseOut
EaseInOut
CubicBezier(SvgCubicCurve)
Spring(SpringCurve)
A physical spring rather than a fixed-duration curve.
Unlike every other variant this one has NO duration: it runs until the mass settles. That is the point — a spring can be retargeted mid-flight while preserving position AND velocity, so an interrupted animation bends toward the new target instead of restarting from a standstill. A bezier cannot express that, which is why engine-driven layout transitions default to this.
Implementations§
Source§impl AnimationInterpolationFunction
impl AnimationInterpolationFunction
Sourcepub const fn get_curve(self) -> SvgCubicCurve
pub const fn get_curve(self) -> SvgCubicCurve
Returns the cubic bezier curve corresponding to this timing function.
Sourcepub const fn is_spring(self) -> bool
pub const fn is_spring(self) -> bool
Whether this function is a physical spring, and therefore has no duration and cannot be evaluated as a curve.
Callers that own a timeline must branch on this: asking a spring for its
value at t silently gives them an ease-in-out instead.
Sourcepub fn evaluate(self, t: f64) -> f32
pub fn evaluate(self, t: f64) -> f32
Evaluates the interpolation function at time t, returning the eased value.
For a spring this evaluates the ease-in-out stand-in from
Self::get_curve; integrate the spring instead if you need its real
trajectory.
Trait Implementations§
Source§impl Clone for AnimationInterpolationFunction
impl Clone for AnimationInterpolationFunction
Source§fn clone(&self) -> AnimationInterpolationFunction
fn clone(&self) -> AnimationInterpolationFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more