pub struct Animated<T> { /* private fields */ }Expand description
A value on its way to a target. It holds no clock: every call takes the time.
Redirecting is continuous. A spring restarts from the current position and velocity, which is the exact solution for a moved anchor. Tweens are additive: the new one eases in the target’s change while earlier ones finish easing out theirs, and the sum has no corner, even when a hover flickers.
Implementations§
Source§impl<T: Animatable> Animated<T>
impl<T: Animatable> Animated<T>
Sourcepub fn set_target(&mut self, target: T, transition: Transition, now: f64)
pub fn set_target(&mut self, target: T, transition: Transition, now: f64)
Sends the value to target starting at time now (seconds). Asking for
the current target again does nothing, so calling this on every build is fine.
Sourcepub fn velocity(&self, now: f64) -> [f32; 4]
pub fn velocity(&self, now: f64) -> [f32; 4]
Rate of change per second of each component at time now.
Sourcepub fn step(&mut self, now: f64) -> bool
pub fn step(&mut self, now: f64) -> bool
Forgets what has finished by time now. Returns true while still moving.
Sourcepub fn is_moving(&self) -> bool
pub fn is_moving(&self) -> bool
True while the value has not reached its target as of the last Self::step.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Animated<T>where
T: Freeze,
impl<T> RefUnwindSafe for Animated<T>where
T: RefUnwindSafe,
impl<T> Send for Animated<T>where
T: Send,
impl<T> Sync for Animated<T>where
T: Sync,
impl<T> Unpin for Animated<T>where
T: Unpin,
impl<T> UnsafeUnpin for Animated<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Animated<T>where
T: UnwindSafe,
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