pub struct Animation<T>{ /* private fields */ }
Expand description
The animation of some particular state.
It tracks state changes and allows projecting interpolated values through time.
Implementations§
Source§impl<T> Animation<T>
impl<T> Animation<T>
Sourcepub fn easing(self, easing: Easing) -> Self
pub fn easing(self, easing: Easing) -> Self
Sets the Easing
function of the Animation
.
See the Easing Functions Cheat Sheet for details!
Sourcepub fn very_quick(self) -> Self
pub fn very_quick(self) -> Self
Sets the duration of the Animation
to 100ms.
Sourcepub fn duration(self, duration: Duration) -> Self
pub fn duration(self, duration: Duration) -> Self
Sets the duration of the Animation
to the given value.
Sourcepub fn repeat(self, repetitions: u32) -> Self
pub fn repeat(self, repetitions: u32) -> Self
Makes the Animation
repeat a given amount of times.
Providing 1 repetition plays the animation twice in total.
Sourcepub fn repeat_forever(self) -> Self
pub fn repeat_forever(self) -> Self
Makes the Animation
repeat forever.
Sourcepub fn auto_reverse(self) -> Self
pub fn auto_reverse(self) -> Self
Makes the Animation
automatically reverse when repeating.
Sourcepub fn go(self, new_state: T, at: Instant) -> Self
pub fn go(self, new_state: T, at: Instant) -> Self
Transitions the Animation
from its current state to the given new state
at the given time.
Sourcepub fn go_mut(&mut self, new_state: T, at: Instant)
pub fn go_mut(&mut self, new_state: T, at: Instant)
Transitions the Animation
from its current state to the given new state
at the given time, by reference.
Sourcepub fn is_animating(&self, at: Instant) -> bool
pub fn is_animating(&self, at: Instant) -> bool
Sourcepub fn interpolate_with<I>(&self, f: impl Fn(T) -> I, at: Instant) -> Iwhere
I: Interpolable,
pub fn interpolate_with<I>(&self, f: impl Fn(T) -> I, at: Instant) -> Iwhere
I: Interpolable,
Projects the Animation
into an interpolated value at the given Instant
; using the
closure provided to calculate the different keyframes of interpolated values.
If the Animation
state is a bool
, you can use the simpler interpolate
method.