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) -> 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 for Motion<T>where
T: Eq,
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.