pub struct Inertial<Item: Mix + Clone + PartialEq, X: Time> { /* private fields */ }Expand description
A value that smoothly goes to the target during a specific time.
The target can be changed at any time. No jumps will occur.
It’s expected that time is always increasing.
Every method receives current_time as a parameter to allow testing,
and has a consistent behavior during a single animation frame.
Implementations§
Source§impl<Item: Mix + Clone + PartialEq, X: Time> Inertial<Item, X>
impl<Item: Mix + Clone + PartialEq, X: Time> Inertial<Item, X>
Sourcepub fn go_to(self, target: Item, current_time: X, duration: X::Duration) -> Self
pub fn go_to(self, target: Item, current_time: X, duration: X::Duration) -> Self
Create child inertial value with a new target at a specific time.
Easing is set to default (QuadraticInOut).
target- The new target value.current_time- The time to start the transition, usuallyInstant::now().duration- The duration of the transition.
Sourcepub fn ease_to(
self,
target: Item,
current_time: X,
duration: X::Duration,
easing: Easing,
) -> Self
pub fn ease_to( self, target: Item, current_time: X, duration: X::Duration, easing: Easing, ) -> Self
Create child inertial value with a new target, easing and start time.
target- The new target value.start_time- The time to start the transition, usuallyInstant::now().duration- The duration of the transition.
Trait Implementations§
Source§impl<Item: Mix + Clone + PartialEq, X: Time> Animated<Item, X> for Inertial<Item, X>
impl<Item: Mix + Clone + PartialEq, X: Time> Animated<Item, X> for Inertial<Item, X>
Source§fn is_finished(&self, current_time: X) -> bool
fn is_finished(&self, current_time: X) -> bool
Check if the inertial value reached the target.
Source§fn get(&self, current_time: X) -> Item
fn get(&self, current_time: X) -> Item
Get the value of the animation at a specific time. Read more
Source§fn map<R, F: Fn(T) -> R>(self, map: F) -> AnimatedMap<T, X, Self, R, F>where
Self: Sized,
fn map<R, F: Fn(T) -> R>(self, map: F) -> AnimatedMap<T, X, Self, R, F>where
Self: Sized,
Map the animated value to another type.
Source§impl<Item: PartialEq + Mix + Clone + PartialEq, X: PartialEq + Time> PartialEq for Inertial<Item, X>
impl<Item: PartialEq + Mix + Clone + PartialEq, X: PartialEq + Time> PartialEq for Inertial<Item, X>
impl<Item: Mix + Clone + PartialEq, X: Time> StructuralPartialEq for Inertial<Item, X>
Auto Trait Implementations§
impl<Item, X> Freeze for Inertial<Item, X>
impl<Item, X> RefUnwindSafe for Inertial<Item, X>
impl<Item, X> Send for Inertial<Item, X>
impl<Item, X> Sync for Inertial<Item, X>
impl<Item, X> Unpin for Inertial<Item, X>
impl<Item, X> UnwindSafe for Inertial<Item, X>
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