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§
Sourcefn get(&self, offset: X::Duration) -> T
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.
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 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, StayKeyframes<T, X>>
fn stay( self, duration: X::Duration, ) -> SequentialKeyframes<T, X, Self, StayKeyframes<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 poly_to(
self,
points: impl IntoIterator<Item = T>,
duration: X::Duration,
easing: Easing,
) -> SequentialKeyframes<T, X, Self, PolyKeyframes<T, X>>
fn poly_to( self, points: impl IntoIterator<Item = T>, duration: X::Duration, easing: Easing, ) -> SequentialKeyframes<T, X, Self, PolyKeyframes<T, X>>
Create an animation that follows the given polynomial curve with easing.
Sourcefn function<F: Fn(X::Duration) -> T>(
self,
function: F,
duration: X::Duration,
) -> SequentialKeyframes<T, X, Self, FunctionKeyframes<T, X, F>>where
Self: Sized,
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.
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 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.
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 apply_easing(self, easing: Easing) -> ApplyEasingKeyframes<T, X, Self>where
Self: Sized,
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.
Sourcefn then<S: Keyframes<T, X>>(
self,
other: S,
) -> SequentialKeyframes<T, X, Self, S>where
Self: Sized,
fn then<S: Keyframes<T, X>>(
self,
other: S,
) -> SequentialKeyframes<T, X, Self, S>where
Self: Sized,
Concatenate two keyframes set.
Sourcefn slice(
self,
start_offset: X::Duration,
end_offset: X::Duration,
) -> SliceKeyframes<T, X, Self>where
Self: Sized,
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.