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§
Provided Methods§
sourcefn is_finished(&self, offset: X::Duration) -> bool
fn is_finished(&self, offset: X::Duration) -> bool
Check if the animation is finished at the given offset.
sourcefn is_infinite(&self) -> bool
fn is_infinite(&self) -> bool
Check if the animation is infinite.
sourcefn start_value(&self) -> T
fn start_value(&self) -> T
Get the value of the animation at the start.
sourcefn end_value(&self) -> T
fn end_value(&self) -> T
Get the value of the animation at the end. If the animation is infinite, it will panic.
sourcefn stay(
self,
duration: X::Duration,
) -> SequentialKeyframes<T, X, Self, NoneKeyframes<T, X>>
fn stay( self, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, NoneKeyframes<T, X>>
Create an animation that stays at the end value for the given duration.
sourcefn go_to(
self,
target: T,
duration: X::Duration,
) -> SequentialKeyframes<T, X, Self, LinearKeyframes<T, X>>
fn go_to( self, target: T, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, LinearKeyframes<T, X>>
Create an animation that linearly interpolates between the end value and the target value.
sourcefn ease_to(
self,
target: T,
duration: X::Duration,
easing: Easing,
) -> SequentialKeyframes<T, X, Self, EasingKeyframes<T, X>>
fn ease_to( self, target: T, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, EasingKeyframes<T, X>>
Create an animation that eases between the end value and the target value.
sourcefn repeat(self) -> RepeatKeyframes<T, X, Self>where
Self: Sized,
fn repeat(self) -> RepeatKeyframes<T, X, Self>where
Self: Sized,
Create an animation that repeats the given keyframes indefinitely.
sourcefn repeat_n(self, n: f32) -> RepeatNKeyframes<T, X, Self>where
Self: Sized,
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.
sourcefn scale(self, scale: f32) -> ScaleKeyframes<T, X, Self>where
Self: Sized,
fn scale(self, scale: f32) -> ScaleKeyframes<T, X, Self>where
Self: Sized,
Scale the time of the animation by the given factor.
sourcefn scale_to(self, new_duration: X::Duration) -> ScaleKeyframes<T, X, Self>where
Self: Sized,
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.
sourcefn map<F: Fn(T) -> T>(self, map: F) -> MapKeyframes<T, X, Self, F>where
Self: Sized,
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.