pub struct MotionValue<T> { /* private fields */ }Expand description
A value that animates toward its latest target on an absolute clock.
Retargeting mid-flight keeps the motion’s momentum: the new animation blends from the still-running previous one instead of restarting from a standstill, so a hover that ends halfway through its fade-in turns around smoothly rather than stopping dead.
Implementations§
Source§impl<T> MotionValue<T>where
T: Copy,
impl<T> MotionValue<T>where
T: Copy,
pub const fn new(value: T) -> MotionValue<T>
pub fn is_animating(&self) -> bool
Source§impl<T> MotionValue<T>
impl<T> MotionValue<T>
Sourcepub fn animate_to(&mut self, target: T, time: f64, spec: AnimationSpec) -> bool
pub fn animate_to(&mut self, target: T, time: f64, spec: AnimationSpec) -> bool
Start animating from the value at time toward target. Returns
whether the value is animating afterwards.
Sourcepub fn animate_to_after(
&mut self,
target: T,
time: f64,
delay: f64,
spec: AnimationSpec,
) -> bool
pub fn animate_to_after( &mut self, target: T, time: f64, delay: f64, spec: AnimationSpec, ) -> bool
Like MotionValue::animate_to, starting delay seconds after
time. Until then the value keeps doing what it was doing.
Sourcepub fn end_time(&self) -> Option<f64>
pub fn end_time(&self) -> Option<f64>
When the running animations will all have finished, or None at rest.
Sourcepub fn is_animating_at(&self, time: f64) -> bool
pub fn is_animating_at(&self, time: f64) -> bool
Whether an animation is still running at time, without dropping
finished ones.
Trait Implementations§
Source§impl<T> Clone for MotionValue<T>where
T: Clone,
impl<T> Clone for MotionValue<T>where
T: Clone,
Source§fn clone(&self) -> MotionValue<T>
fn clone(&self) -> MotionValue<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T> Copy for MotionValue<T>where
T: Copy,
Source§impl<T> Debug for MotionValue<T>where
T: Debug,
impl<T> Debug for MotionValue<T>where
T: Debug,
Source§impl<T> PartialEq for MotionValue<T>where
T: PartialEq,
impl<T> PartialEq for MotionValue<T>where
T: PartialEq,
impl<T> StructuralPartialEq for MotionValue<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Forget for MotionValue<T>
impl<T> Freeze for MotionValue<T>
impl<T> Move for MotionValue<T>
impl<T> RefUnwindSafe for MotionValue<T>
impl<T> Send for MotionValue<T>
impl<T> Sync for MotionValue<T>
impl<T> Unpin for MotionValue<T>
impl<T> UnsafeUnpin for MotionValue<T>
impl<T> UnwindSafe for MotionValue<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