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,
) -> Result<(), MotionError>
pub fn transition_to( self, target: T, runtime: &mut MotionRuntime, ) -> Result<(), MotionError>
Transitions this motion toward target.
Sourcepub fn transition_to_tracked(
self,
target: T,
runtime: &mut MotionRuntime,
) -> Result<PlaybackId, MotionError>
pub fn transition_to_tracked( self, target: T, runtime: &mut MotionRuntime, ) -> Result<PlaybackId, MotionError>
Transitions this motion and returns the new playback ID.
Sourcepub fn play<P, Kind>(
self,
playback: P,
runtime: &mut MotionRuntime,
) -> Result<(), MotionError>where
P: IntoMotionAnimation<T, Kind>,
pub fn play<P, Kind>(
self,
playback: P,
runtime: &mut MotionRuntime,
) -> Result<(), MotionError>where
P: IntoMotionAnimation<T, Kind>,
Replaces this motion’s current animation.
Sourcepub fn play_tracked<P, Kind>(
self,
playback: P,
runtime: &mut MotionRuntime,
) -> Result<PlaybackId, MotionError>where
P: IntoMotionAnimation<T, Kind>,
pub fn play_tracked<P, Kind>(
self,
playback: P,
runtime: &mut MotionRuntime,
) -> Result<PlaybackId, MotionError>where
P: IntoMotionAnimation<T, Kind>,
Replaces this motion’s current animation and returns its playback ID.
Sourcepub fn value(self, runtime: &MotionRuntime) -> Result<T, MotionError>
pub fn value(self, runtime: &MotionRuntime) -> Result<T, MotionError>
Clones and returns the current value.
Sourcepub fn value_ref(self, runtime: &MotionRuntime) -> Result<&T, MotionError>
pub fn value_ref(self, runtime: &MotionRuntime) -> Result<&T, MotionError>
Borrows the current value.
Sourcepub fn state(
self,
runtime: &MotionRuntime,
) -> Result<AnimationState, MotionError>
pub fn state( self, runtime: &MotionRuntime, ) -> Result<AnimationState, MotionError>
Returns the current lifecycle state.
Sourcepub fn playback(
self,
runtime: &MotionRuntime,
) -> Result<PlaybackId, MotionError>
pub fn playback( self, runtime: &MotionRuntime, ) -> Result<PlaybackId, MotionError>
Returns the ID of this motion’s current playback.
Sourcepub fn is_active(self, runtime: &MotionRuntime) -> Result<bool, MotionError>
pub fn is_active(self, runtime: &MotionRuntime) -> Result<bool, MotionError>
Returns whether the motion is active.
Sourcepub fn is_completed(self, runtime: &MotionRuntime) -> Result<bool, MotionError>
pub fn is_completed(self, runtime: &MotionRuntime) -> Result<bool, MotionError>
Returns whether the motion completed.
Sourcepub fn pause(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
pub fn pause(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
Pauses the motion.
Sourcepub fn resume(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
pub fn resume(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
Resumes the motion.
Sourcepub fn cancel(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
pub fn cancel(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
Cancels the motion.
Sourcepub fn seek(
self,
progress: f32,
runtime: &mut MotionRuntime,
) -> Result<(), MotionError>
pub fn seek( self, progress: f32, runtime: &mut MotionRuntime, ) -> Result<(), MotionError>
Seeks the motion to normalized progress.
Sourcepub fn finish(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
pub fn finish(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
Moves the motion to completion.
Sourcepub fn remove(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
pub fn remove(self, runtime: &mut MotionRuntime) -> Result<(), MotionError>
Removes the motion from the runtime.
Trait Implementations§
impl<T> Copy for Motion<T>
impl<T: Eq> Eq for Motion<T>
impl<T> MotionEventTarget for Motion<T>
impl<T: PartialEq> 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