Animated

Trait Animated 

Source
pub trait Animated<T, X: Time> {
    // Required methods
    fn get(&self, time: X) -> T;
    fn is_finished(&self, time: X) -> bool;

    // Provided methods
    fn map<R, F: Fn(T) -> R>(self, map: F) -> AnimatedMap<T, X, Self, R, F>
       where Self: Sized { ... }
    fn join<T2, A2: Animated<T2, X>>(
        self,
        other: A2,
    ) -> AnimatedJoin<T, T2, X, Self, A2>
       where Self: Sized { ... }
    fn flatten<R>(self) -> AnimatedFlatten<R, X, T, Self>
       where Self: Sized,
             T: Animated<R, X> { ... }
}
Expand description

An animated value that changes over time. It’s a common trait for Animation and Inertial.

Required Methods§

Source

fn get(&self, time: X) -> T

Get the value of the animation at a specific time.

  • time - The time to get the value of the animation, usually Instant::now().
Source

fn is_finished(&self, time: X) -> bool

Check if the animation is finished at a specific time.

Provided Methods§

Source

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

fn join<T2, A2: Animated<T2, X>>( self, other: A2, ) -> AnimatedJoin<T, T2, X, Self, A2>
where Self: Sized,

Join two animated values into a single animated tuple. The resulting animation will be finished when both animations are finished.

Source

fn flatten<R>(self) -> AnimatedFlatten<R, X, T, Self>
where Self: Sized, T: Animated<R, X>,

Flatten an animated value of an animated value into a single animated value. The resulting animation will be finished when both animations are finished.

Implementations on Foreign Types§

Source§

impl<T: Clone + Copy + Default, X: Time, I: Animated<T, X>, const S: usize> Animated<[T; S], X> for [I; S]

Source§

fn get(&self, time: X) -> [T; S]

Source§

fn is_finished(&self, time: X) -> bool

Source§

impl<V1, V2, T1, T2, X: Time> Animated<(V1, V2), X> for (T1, T2)
where T1: Animated<V1, X>, T2: Animated<V2, X>,

Source§

fn get(&self, time: X) -> (V1, V2)

Source§

fn is_finished(&self, time: X) -> bool

Source§

impl<V1, V2, V3, T1, T2, T3, X: Time> Animated<(V1, V2, V3), X> for (T1, T2, T3)
where T1: Animated<V1, X>, T2: Animated<V2, X>, T3: Animated<V3, X>,

Source§

fn get(&self, time: X) -> (V1, V2, V3)

Source§

fn is_finished(&self, time: X) -> bool

Source§

impl<V1, V2, V3, V4, T1, T2, T3, T4, X: Time> Animated<(V1, V2, V3, V4), X> for (T1, T2, T3, T4)
where T1: Animated<V1, X>, T2: Animated<V2, X>, T3: Animated<V3, X>, T4: Animated<V4, X>,

Source§

fn get(&self, time: X) -> (V1, V2, V3, V4)

Source§

fn is_finished(&self, time: X) -> bool

Source§

impl<V, T, X: Time> Animated<(V,), X> for (T,)
where T: Animated<V, X>,

Source§

fn get(&self, time: X) -> (V,)

Source§

fn is_finished(&self, time: X) -> bool

Source§

impl<X: Time> Animated<(), X> for ()

Source§

fn get(&self, _time: X)

Source§

fn is_finished(&self, _time: X) -> bool

Implementors§

Source§

impl<I, X: Time, T: Keyframes<I, X>> Animated<I, X> for Animation<I, X, T>

Source§

impl<Item: Mix + Clone + PartialEq, X: Time> Animated<Item, X> for Inertial<Item, X>

Source§

impl<T: Stationary, X: Time> Animated<T, X> for T