pub trait AnimationExt {
// Provided methods
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>
where Self: Sized { ... }
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>
where Self: Sized { ... }
}Expand description
An extension trait for adding the animation wrapper to both Elements and Components
Animations rendered through this trait automatically respect
App::reduce_motion: when it is set,
the element is rendered in a static state (the end state for oneshot
animations, the start state for repeating ones) and no animation frames are
scheduled.
Provided Methods§
Sourcefn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with an animation
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".