pub enum Curve {
Linear,
EaseIn,
EaseOut,
EaseInOut,
Spring {
response: f64,
damping: f64,
},
}Expand description
The timing curve of an animation (§8.4). Native backends map each variant onto their own
easing (CAMediaTimingFunction, QEasingCurve, ArkUI ARKUI_CURVE_*, spring animators); the
canvas/self-driven path samples it via Curve::fraction. Spring matches SwiftUI’s
.spring(response:dampingFraction:).
Variants§
Linear
EaseIn
EaseOut
EaseInOut
Spring
response = approximate settling period (seconds); damping = damping ratio (1.0 =
critically damped, <1 = bouncy overshoot).
Implementations§
Source§impl Curve
impl Curve
Sourcepub fn fraction(self, elapsed: f64, duration: f64) -> f64
pub fn fraction(self, elapsed: f64, duration: f64) -> f64
Fraction of the transition complete at elapsed seconds (0 at start, reaching — or, for an
under-damped spring, overshooting — 1). Easing curves clamp to duration; springs evaluate
their analytic unit-step response and use duration only as a settle cap. Drives the
self-driven/canvas path; native backends interpolate on their own compositor instead.
Sourcepub fn ease(self, t: f64) -> f64
pub fn ease(self, t: f64) -> f64
Eased progress for normalized t in 0.0..=1.0 (springs pass through — use [fraction]).
Sourcepub fn is_settled(self, elapsed: f64, duration: f64) -> bool
pub fn is_settled(self, elapsed: f64, duration: f64) -> bool
Whether the transition has settled, so the canvas frame clock can stop ticking it.