pub struct Motion<T> { /* private fields */ }Expand description
A typed handle to an animation stored in a MotionRuntime.
Handles become invalid after their animation is removed.
Implementations§
Source§impl<T: Animatable> Motion<T>
impl<T: Animatable> Motion<T>
Sourcepub fn transition_to(self, target: T, runtime: &mut MotionRuntime) -> bool
pub fn transition_to(self, target: T, runtime: &mut MotionRuntime) -> bool
Transitions this motion toward target.
Returns false when the handle is no longer valid.
Sourcepub fn play(
self,
animation: impl Animation<T>,
runtime: &mut MotionRuntime,
) -> bool
pub fn play( self, animation: impl Animation<T>, runtime: &mut MotionRuntime, ) -> bool
Replaces this motion’s current animation.
Returns false when the handle is no longer valid.
Sourcepub fn value(self, runtime: &MotionRuntime) -> T
pub fn value(self, runtime: &MotionRuntime) -> T
Sourcepub fn value_ref(self, runtime: &MotionRuntime) -> &T
pub fn value_ref(self, runtime: &MotionRuntime) -> &T
Sourcepub fn try_value(self, runtime: &MotionRuntime) -> Option<&T>
pub fn try_value(self, runtime: &MotionRuntime) -> Option<&T>
Borrows the current value when the handle is valid.
Sourcepub fn state(self, runtime: &MotionRuntime) -> Option<AnimationState>
pub fn state(self, runtime: &MotionRuntime) -> Option<AnimationState>
Returns the current state when the handle is valid.
Sourcepub fn is_active(self, runtime: &MotionRuntime) -> bool
pub fn is_active(self, runtime: &MotionRuntime) -> bool
Returns whether the motion is active.
Sourcepub fn is_completed(self, runtime: &MotionRuntime) -> bool
pub fn is_completed(self, runtime: &MotionRuntime) -> bool
Returns whether the motion completed.
Sourcepub fn pause(self, runtime: &mut MotionRuntime) -> bool
pub fn pause(self, runtime: &mut MotionRuntime) -> bool
Pauses the motion if the handle is valid.
Sourcepub fn resume(self, runtime: &mut MotionRuntime) -> bool
pub fn resume(self, runtime: &mut MotionRuntime) -> bool
Resumes the motion if the handle is valid.
Sourcepub fn cancel(self, runtime: &mut MotionRuntime) -> bool
pub fn cancel(self, runtime: &mut MotionRuntime) -> bool
Cancels the motion if the handle is valid.
Sourcepub fn seek(self, progress: f32, runtime: &mut MotionRuntime) -> bool
pub fn seek(self, progress: f32, runtime: &mut MotionRuntime) -> bool
Seeks the motion to normalized progress if the handle is valid.
Sourcepub fn finish(self, runtime: &mut MotionRuntime) -> bool
pub fn finish(self, runtime: &mut MotionRuntime) -> bool
Moves the motion to completion if the handle is valid.
Sourcepub fn remove(self, runtime: &mut MotionRuntime) -> bool
pub fn remove(self, runtime: &mut MotionRuntime) -> bool
Removes the motion from the runtime.
Trait Implementations§
impl<T> Copy for Motion<T>
impl<T: Eq> Eq for Motion<T>
impl<T> StructuralPartialEq for Motion<T>
Auto Trait Implementations§
impl<T> Freeze for Motion<T>
impl<T> RefUnwindSafe for Motion<T>
impl<T> Send for Motion<T>
impl<T> Sync for Motion<T>
impl<T> Unpin for Motion<T>
impl<T> UnsafeUnpin for Motion<T>
impl<T> UnwindSafe for Motion<T>
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