Keyframes

Trait Keyframes 

Source
pub trait Keyframes<T, X: Time> {
Show 21 methods // Required methods fn get(&self, offset: X::Duration) -> T; fn duration(&self) -> X::Duration; fn is_finite(&self) -> bool; // Provided methods fn is_finished(&self, offset: X::Duration) -> bool { ... } fn start_value(&self) -> T { ... } fn end_value(&self) -> T { ... } fn stay( self, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, StayKeyframes<T, X>> where T: Clone, Self: Sized { ... } fn go_to( self, target: T, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, LinearKeyframes<T, X>> where T: Mix + Clone, Self: Sized { ... } fn ease_to( self, target: T, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, EasingKeyframes<T, X>> where T: Mix + Clone, Self: Sized { ... } fn poly_to( self, points: impl IntoIterator<Item = T>, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, PolyKeyframes<T, X>> where Self: Sized, T: Mix + Clone + Distance { ... } fn function<F: Fn(X::Duration) -> T>( self, function: F, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, FunctionKeyframes<T, X, F>> where Self: Sized { ... } fn repeat(self) -> RepeatKeyframes<T, X, Self> where Self: Sized { ... } fn repeat_n(self, n: f32) -> RepeatNKeyframes<T, X, Self> where Self: Sized { ... } fn reverse(self) -> ReverseKeyframes<T, X, Self> where Self: Sized { ... } fn scale(self, scale: f32) -> ScaleKeyframes<T, X, Self> where Self: Sized { ... } fn scale_to(self, new_duration: X::Duration) -> ScaleKeyframes<T, X, Self> where Self: Sized { ... } fn apply_easing(self, easing: Easing) -> ApplyEasingKeyframes<T, X, Self> where Self: Sized { ... } fn then<S: Keyframes<T, X>>( self, other: S, ) -> SequentialKeyframes<T, X, Self, S> where Self: Sized { ... } fn slice( self, start_offset: X::Duration, end_offset: X::Duration, ) -> SliceKeyframes<T, X, Self> where Self: Sized { ... } fn map<R, F>(self, f: F) -> MapKeyframes<T, R, X, Self, F> where F: Fn(T) -> R, Self: Sized { ... } fn run(self, start_time: X) -> Animation<T, X, Self> where Self: Sized { ... }
}
Expand description

A transition of a value over time. It works like an animation template, or set of keyframes.

Required Methods§

Source

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

Get the value at a specific time offset from the start. If the offset is greater than the duration, the value at the end of the animation is returned.

Source

fn duration(&self) -> X::Duration

Get the duration of the animation. If the animation is infinite, it will panic.

Source

fn is_finite(&self) -> bool

Check if the animation is finite.

Provided Methods§

Source

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

Check if the animation is finished at the given offset.

Source

fn start_value(&self) -> T

Get the value of the animation at the start.

Source

fn end_value(&self) -> T

Get the value of the animation at the end. If the animation is infinite, it will panic.

Source

fn stay( self, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, StayKeyframes<T, X>>
where T: Clone, Self: Sized,

Create an animation that stays at the end value for the given duration.

Source

fn go_to( self, target: T, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, LinearKeyframes<T, X>>
where T: Mix + Clone, Self: Sized,

Create an animation that linearly interpolates between the end value and the target value.

Source

fn ease_to( self, target: T, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, EasingKeyframes<T, X>>
where T: Mix + Clone, Self: Sized,

Create an animation that eases between the end value and the target value.

Source

fn poly_to( self, points: impl IntoIterator<Item = T>, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, PolyKeyframes<T, X>>
where Self: Sized, T: Mix + Clone + Distance,

Create an animation that follows the given polynomial curve with easing.

Source

fn function<F: Fn(X::Duration) -> T>( self, function: F, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, FunctionKeyframes<T, X, F>>
where Self: Sized,

Follows the given function.

Source

fn repeat(self) -> RepeatKeyframes<T, X, Self>
where Self: Sized,

Create an animation that repeats the given keyframes indefinitely.

Source

fn repeat_n(self, n: f32) -> RepeatNKeyframes<T, X, Self>
where Self: Sized,

Create an animation that repeats the given keyframes n times.

  • n - The number of times to repeat the keyframes. It can be not integer, and repeat the keyframes partially.
Source

fn reverse(self) -> ReverseKeyframes<T, X, Self>
where Self: Sized,

Inverse keyframes order.

Source

fn scale(self, scale: f32) -> ScaleKeyframes<T, X, Self>
where Self: Sized,

Scale the time of the animation by the given factor.

Source

fn scale_to(self, new_duration: X::Duration) -> ScaleKeyframes<T, X, Self>
where Self: Sized,

Scale the time of the animation to the given duration.

Source

fn apply_easing(self, easing: Easing) -> ApplyEasingKeyframes<T, X, Self>
where Self: Sized,

Apply easing to the keyframes. It can be useful to apply easing to slices of keyframes to go along a path segment with easing.

Source

fn then<S: Keyframes<T, X>>( self, other: S, ) -> SequentialKeyframes<T, X, Self, S>
where Self: Sized,

Concatenate two keyframes set.

Source

fn slice( self, start_offset: X::Duration, end_offset: X::Duration, ) -> SliceKeyframes<T, X, Self>
where Self: Sized,

Get a slice of the keyframes from the start to the end.

Source

fn map<R, F>(self, f: F) -> MapKeyframes<T, R, X, Self, F>
where F: Fn(T) -> R, Self: Sized,

Source

fn run(self, start_time: X) -> Animation<T, X, Self>
where Self: Sized,

Run keyframes at a specific time.

  • start_time - The time to start the transition, usually Instant::now().

Implementations on Foreign Types§

Source§

impl<X, T1, T2, K1, K2> Keyframes<(T1, T2), X> for (K1, K2)
where X: Time, K1: Keyframes<T1, X>, K2: Keyframes<T2, X>,

Source§

fn get(&self, offset: X::Duration) -> (T1, T2)

Source§

fn duration(&self) -> X::Duration

Source§

fn is_finite(&self) -> bool

Source§

impl<X, T1, T2, T3, K1, K2, K3> Keyframes<(T1, T2, T3), X> for (K1, K2, K3)
where X: Time, K1: Keyframes<T1, X>, K2: Keyframes<T2, X>, K3: Keyframes<T3, X>,

Source§

fn get(&self, offset: X::Duration) -> (T1, T2, T3)

Source§

fn duration(&self) -> X::Duration

Source§

fn is_finite(&self) -> bool

Source§

impl<X, T1, T2, T3, T4, K1, K2, K3, K4> Keyframes<(T1, T2, T3, T4), X> for (K1, K2, K3, K4)
where X: Time, K1: Keyframes<T1, X>, K2: Keyframes<T2, X>, K3: Keyframes<T3, X>, K4: Keyframes<T4, X>,

Source§

fn get(&self, offset: X::Duration) -> (T1, T2, T3, T4)

Source§

fn duration(&self) -> X::Duration

Source§

fn is_finite(&self) -> bool

Source§

impl<X, T, K> Keyframes<(T,), X> for (K,)
where X: Time, K: Keyframes<T, X>,

Source§

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

Source§

fn duration(&self) -> X::Duration

Source§

fn is_finite(&self) -> bool

Implementors§