Trait glissade::Keyframes

source ·
pub trait Keyframes<T: Clone + Sized, X: Time>: Sized {
Show 18 methods // Required methods fn get(&self, offset: X::Duration) -> T; fn duration(&self) -> X::Duration; // Provided methods fn is_finished(&self, offset: X::Duration) -> bool { ... } fn is_infinite(&self) -> bool { ... } fn is_finite(&self) -> bool { ... } fn start_value(&self) -> T { ... } fn end_value(&self) -> T { ... } fn stay( self, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, NoneKeyframes<T, X>> where Self: Sized, T: Mix + Clone + PartialEq { ... } fn go_to( self, target: T, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, LinearKeyframes<T, X>> where Self: Sized, T: Mix + Clone + PartialEq { ... } fn ease_to( self, target: T, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, EasingKeyframes<T, X>> where Self: Sized, T: Mix + Clone + PartialEq { ... } 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 map<F: Fn(T) -> T>(self, map: F) -> MapKeyframes<T, X, Self, F> where Self: Sized { ... } fn then<S: Keyframes<T, X>>( self, other: S, ) -> SequentialKeyframes<T, X, Self, S> where Self: Sized { ... } fn run(self, start_time: X) -> Animation<T, X, Self> { ... }
}
Expand description

A transition of a value over time. It works like an animation template, or set of keyframes. A good point to start building Animation is the keyframes function.

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.

Provided Methods§

source

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

Check if the animation is finished at the given offset.

source

fn is_infinite(&self) -> bool

Check if the animation is infinite.

source

fn is_finite(&self) -> bool

Check if the animation is finite.

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, NoneKeyframes<T, X>>
where Self: Sized, T: Mix + Clone + PartialEq,

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 Self: Sized, T: Mix + Clone + PartialEq,

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 Self: Sized, T: Mix + Clone + PartialEq,

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

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 a 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 map<F: Fn(T) -> T>(self, map: F) -> MapKeyframes<T, X, Self, F>
where Self: Sized,

Similar to Vec::map, creates an animation that applies the given function to the value at each point in time.

source

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

Concatenate two keyframes set.

source

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

Run keyframes at a specific time.

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

Object Safety§

This trait is not object safe.

Implementors§