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) -> Self
pub fn spring(response: f64, damping: f64) -> Self
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) -> Self
pub fn ease_in(duration_ms: u32) -> Self
pub fn ease_out(duration_ms: u32) -> Self
pub fn ease_in_out(duration_ms: u32) -> Self
Sourcepub fn repeat(self, count: u32, autoreverse: bool) -> Self
pub fn repeat(self, count: u32, autoreverse: bool) -> Self
Repeat count extra times (builder); autoreverse ping-pongs each cycle.
Sourcepub fn repeat_forever(self, autoreverse: bool) -> Self
pub fn repeat_forever(self, autoreverse: bool) -> Self
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§
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