pub struct Callbacks<A> { /* private fields */ }Expand description
An animation wrapper that emits events at milestones.
Wraps any Animation and queues AnimationEvents during tick().
Call drain_events to retrieve and clear them.
Implementations§
Source§impl<A: Animation> Callbacks<A>
impl<A: Animation> Callbacks<A>
Sourcepub fn on_complete(self) -> Self
pub fn on_complete(self) -> Self
Enable the Completed event (builder pattern).
Sourcepub fn at_progress(self, threshold: f32) -> Self
pub fn at_progress(self, threshold: f32) -> Self
Add a progress threshold event (builder pattern).
Fires when the animation’s value crosses threshold (clamped to [0.0, 1.0]).
Sourcepub fn drain_events(&mut self) -> Vec<AnimationEvent>
pub fn drain_events(&mut self) -> Vec<AnimationEvent>
Drain all pending events. Clears the event queue.
Sourcepub fn pending_event_count(&self) -> usize
pub fn pending_event_count(&self) -> usize
Number of pending events.
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for Callbacks<A>where
A: Freeze,
impl<A> RefUnwindSafe for Callbacks<A>where
A: RefUnwindSafe,
impl<A> Send for Callbacks<A>where
A: Send,
impl<A> Sync for Callbacks<A>where
A: Sync,
impl<A> Unpin for Callbacks<A>where
A: Unpin,
impl<A> UnwindSafe for Callbacks<A>where
A: UnwindSafe,
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