Struct Animation
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§
§impl<T> Animation<T>
impl<T> Animation<T>
pub fn easing(self, easing: Easing) -> Animation<T>
pub fn easing(self, easing: Easing) -> Animation<T>
Sets the Easing
function of the Animation
.
See the Easing Functions Cheat Sheet for details!
pub fn very_quick(self) -> Animation<T>
pub fn very_quick(self) -> Animation<T>
Sets the duration of the Animation
to 100ms.
pub fn duration(self, duration: Duration) -> Animation<T>
pub fn duration(self, duration: Duration) -> Animation<T>
Sets the duration of the Animation
to the given value.
pub fn repeat(self, repetitions: u32) -> Animation<T>
pub fn repeat(self, repetitions: u32) -> Animation<T>
Makes the Animation
repeat a given amount of times.
Providing 1 repetition plays the animation twice in total.
pub fn repeat_forever(self) -> Animation<T>
pub fn repeat_forever(self) -> Animation<T>
Makes the Animation
repeat forever.
pub fn auto_reverse(self) -> Animation<T>
pub fn auto_reverse(self) -> Animation<T>
Makes the Animation
automatically reverse when repeating.
pub fn go(self, new_state: T) -> Animation<T>
pub fn go(self, new_state: T) -> Animation<T>
Transitions the Animation
from its current state to the given new state.
pub fn go_mut(&mut self, new_state: T)
pub fn go_mut(&mut self, new_state: T)
Transitions the Animation
from its current state to the given new state, by reference.
pub fn is_animating(&self, at: Instant) -> bool
pub fn is_animating(&self, at: Instant) -> bool
pub 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.
§impl Animation<bool>
impl Animation<bool>
pub fn interpolate<I>(&self, start: I, end: I, at: Instant) -> Iwhere
I: Interpolable + Clone,
pub fn interpolate<I>(&self, start: I, end: I, at: Instant) -> Iwhere
I: Interpolable + Clone,
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Animation<T>where
T: Freeze,
impl<T> RefUnwindSafe for Animation<T>where
T: RefUnwindSafe,
impl<T> Send for Animation<T>where
T: Send,
impl<T> Sync for Animation<T>where
T: Sync,
impl<T> Unpin for Animation<T>where
T: Unpin,
impl<T> UnwindSafe for Animation<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application
.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more