pub struct AnimSpec {
pub duration_ms: u32,
pub delay_ms: u32,
pub curve: Curve,
pub repeat: u32,
pub autoreverse: bool,
}Expand description
Animation intent (§8.4). Native-widget backends map it onto their own animator (Core Animation,
ViewPropertyAnimator, XAML Composition, OH_ArkUI_AnimateTo, …); the canvas/self-driven path
samples curve via Curve::fraction. Threaded through Toolkit::update/set_frame/
set_opacity/set_transform.
Fields§
§duration_ms: u32§delay_ms: u32§curve: Curve§repeat: u32Repeat count beyond the first play (0 = play once); u32::MAX = repeat forever.
autoreverse: boolImplementations§
Source§impl AnimSpec
impl AnimSpec
Sourcepub fn spring(response: f64, damping: f64) -> AnimSpec
pub fn spring(response: f64, damping: f64) -> AnimSpec
A smooth spring: response = settling period (s), damping = ratio (1.0 = no bounce, <1
bouncy). duration_ms is a nominal cap for backends that need a duration; spring backends
use response/damping directly.
pub fn linear(duration_ms: u32) -> AnimSpec
pub fn ease_in(duration_ms: u32) -> AnimSpec
pub fn ease_out(duration_ms: u32) -> AnimSpec
pub fn ease_in_out(duration_ms: u32) -> AnimSpec
Sourcepub fn repeat(self, count: u32, autoreverse: bool) -> AnimSpec
pub fn repeat(self, count: u32, autoreverse: bool) -> AnimSpec
Repeat count extra times (builder); autoreverse ping-pongs each cycle.
Sourcepub fn repeat_forever(self, autoreverse: bool) -> AnimSpec
pub fn repeat_forever(self, autoreverse: bool) -> AnimSpec
Repeat forever (builder) — e.g. a pulsing indicator.
pub fn duration_secs(&self) -> f64
pub fn delay_secs(&self) -> f64
Trait Implementations§
impl Copy for AnimSpec
impl StructuralPartialEq for AnimSpec
Auto Trait Implementations§
impl Freeze for AnimSpec
impl RefUnwindSafe for AnimSpec
impl Send for AnimSpec
impl Sync for AnimSpec
impl Unpin for AnimSpec
impl UnsafeUnpin for AnimSpec
impl UnwindSafe for AnimSpec
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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