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> Motion<T>where
T: Animatable,
impl<T> Motion<T>where
T: Animatable,
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 for Motion<T>where
T: Eq,
impl<T> MotionEventTarget 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.