pub struct Motion<T: Animatable + Send + 'static> {
pub initial: T,
pub current: T,
pub target: T,
pub velocity: T,
pub running: bool,
pub elapsed: Duration,
pub delay_elapsed: Duration,
pub current_loop: u8,
pub reverse: bool,
pub animation_state: AnimationState<T>,
pub sequence: Option<Arc<AnimationSequence<T>>>,
pub keyframe_animation: Option<Arc<KeyframeAnimation<T>>>,
/* private fields */
}Fields§
§initial: T§current: T§target: T§velocity: T§running: bool§elapsed: Duration§delay_elapsed: Duration§current_loop: u8§reverse: bool§animation_state: AnimationState<T>State machine for efficient animation dispatch
sequence: Option<Arc<AnimationSequence<T>>>Current sequence being animated (if any)
keyframe_animation: Option<Arc<KeyframeAnimation<T>>>Current keyframe animation (if any)
Implementations§
Source§impl<T: Animatable + Send + 'static> Motion<T>
impl<T: Animatable + Send + 'static> Motion<T>
pub fn new(initial: T) -> Self
pub fn animate_to(&mut self, target: T, config: AnimationConfig)
pub fn animate_sequence(&mut self, sequence: AnimationSequence<T>)
pub fn animate_keyframes(&mut self, animation: KeyframeAnimation<T>)
pub fn get_value(&self) -> T
pub fn is_running(&self) -> bool
pub fn reset(&mut self)
pub fn stop(&mut self)
pub fn delay(&mut self, duration: Duration)
Sourcepub fn get_epsilon(&self) -> f32
pub fn get_epsilon(&self) -> f32
Gets the effective epsilon threshold for this animation Uses the configured epsilon if present, otherwise falls back to the type’s default
pub fn update(&mut self, dt: f32) -> bool
Sourcepub fn config_handle(&self) -> &ConfigHandle
pub fn config_handle(&self) -> &ConfigHandle
Gets the current config handle for optimization purposes
Sourcepub fn spring_integrator_handle(&self) -> Option<&SpringIntegratorHandle>
pub fn spring_integrator_handle(&self) -> Option<&SpringIntegratorHandle>
Gets the current spring integrator handle for optimization purposes
Sourcepub fn optimization_stats(&self) -> MotionOptimizationStats
pub fn optimization_stats(&self) -> MotionOptimizationStats
Gets optimization statistics for this Motion instance
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Motion<T>where
T: Freeze,
impl<T> RefUnwindSafe for Motion<T>where
T: RefUnwindSafe,
impl<T> Send for Motion<T>where
T: Sync,
impl<T> Sync for Motion<T>where
T: Sync,
impl<T> Unpin for Motion<T>where
T: Unpin,
impl<T> UnwindSafe for Motion<T>where
T: UnwindSafe + RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.