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.
Trait Implementations§
impl Copy for Curve
impl StructuralPartialEq for Curve
Auto Trait Implementations§
impl Freeze for Curve
impl RefUnwindSafe for Curve
impl Send for Curve
impl Sync for Curve
impl Unpin for Curve
impl UnsafeUnpin for Curve
impl UnwindSafe for Curve
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more