Trait glissade::Transition
source · pub trait Transition<T: Clone + Debug + Sized>: Sized {
Show 17 methods
// Required methods
fn get(&self, offset: Duration) -> T;
fn duration(&self) -> Duration;
// Provided methods
fn is_finished(&self, offset: Duration) -> bool { ... }
fn is_infinite(&self) -> bool { ... }
fn start_value(&self) -> T { ... }
fn end_value(&self) -> T { ... }
fn stay(
self,
duration: Duration,
) -> SequentialTransition<T, Self, NoneTransition<T>>
where Self: Sized,
T: TransitionItem { ... }
fn go_to(
self,
target: T,
duration: Duration,
) -> SequentialTransition<T, Self, LinearTransition<T>>
where Self: Sized,
T: TransitionItem { ... }
fn ease_to(
self,
target: T,
duration: Duration,
easing: Easing,
) -> SequentialTransition<T, Self, EasingTransition<T>>
where Self: Sized,
T: TransitionItem { ... }
fn repeat(self) -> RepeatTransition<T, Self>
where Self: Sized { ... }
fn repeat_n(self, n: f32) -> RepeatNTransition<T, Self>
where Self: Sized { ... }
fn reverse(self) -> ReverseTransition<T, Self>
where Self: Sized { ... }
fn scale(self, scale: f32) -> ScaleTransition<T, Self>
where Self: Sized { ... }
fn scale_to(self, new_duration: Duration) -> ScaleTransition<T, Self>
where Self: Sized { ... }
fn map<F: Fn(T) -> T>(self, map: F) -> MapTransition<T, Self, F>
where Self: Sized { ... }
fn concat<S: Transition<T>>(
self,
other: S,
) -> SequentialTransition<T, Self, S>
where Self: Sized { ... }
fn run(self, start_time: SystemTime) -> Animation<T, Self> { ... }
}Expand description
A transition of a value over time. It works like an animation template.
A good point to start building transition is the transition function.
Required Methods§
Provided Methods§
sourcefn is_finished(&self, offset: Duration) -> bool
fn is_finished(&self, offset: Duration) -> bool
Check if the transition is finished at the given offset.
sourcefn is_infinite(&self) -> bool
fn is_infinite(&self) -> bool
Check if the transition is infinite.
sourcefn start_value(&self) -> T
fn start_value(&self) -> T
Get the value of the transition at the start.
sourcefn end_value(&self) -> T
fn end_value(&self) -> T
Get the value of the transition at the end. If the transition is infinite, it will panic.
sourcefn stay(
self,
duration: Duration,
) -> SequentialTransition<T, Self, NoneTransition<T>>where
Self: Sized,
T: TransitionItem,
fn stay(
self,
duration: Duration,
) -> SequentialTransition<T, Self, NoneTransition<T>>where
Self: Sized,
T: TransitionItem,
Create a transition that stays at the end value for the given duration.
sourcefn go_to(
self,
target: T,
duration: Duration,
) -> SequentialTransition<T, Self, LinearTransition<T>>where
Self: Sized,
T: TransitionItem,
fn go_to(
self,
target: T,
duration: Duration,
) -> SequentialTransition<T, Self, LinearTransition<T>>where
Self: Sized,
T: TransitionItem,
Create a transition that linearly interpolates between the end value and the target value.
sourcefn ease_to(
self,
target: T,
duration: Duration,
easing: Easing,
) -> SequentialTransition<T, Self, EasingTransition<T>>where
Self: Sized,
T: TransitionItem,
fn ease_to(
self,
target: T,
duration: Duration,
easing: Easing,
) -> SequentialTransition<T, Self, EasingTransition<T>>where
Self: Sized,
T: TransitionItem,
Create a transition that eases between the end value and the target value.
sourcefn repeat(self) -> RepeatTransition<T, Self>where
Self: Sized,
fn repeat(self) -> RepeatTransition<T, Self>where
Self: Sized,
Create a transition that repeats the given transition indefinitely.
sourcefn repeat_n(self, n: f32) -> RepeatNTransition<T, Self>where
Self: Sized,
fn repeat_n(self, n: f32) -> RepeatNTransition<T, Self>where
Self: Sized,
Create a transition that repeats the given transition n times.
sourcefn reverse(self) -> ReverseTransition<T, Self>where
Self: Sized,
fn reverse(self) -> ReverseTransition<T, Self>where
Self: Sized,
Create a transition that reverses the given transition.
sourcefn scale(self, scale: f32) -> ScaleTransition<T, Self>where
Self: Sized,
fn scale(self, scale: f32) -> ScaleTransition<T, Self>where
Self: Sized,
Scale the time of the transition by the given factor.
sourcefn scale_to(self, new_duration: Duration) -> ScaleTransition<T, Self>where
Self: Sized,
fn scale_to(self, new_duration: Duration) -> ScaleTransition<T, Self>where
Self: Sized,
Scale the time of the transition to the given duration.
sourcefn map<F: Fn(T) -> T>(self, map: F) -> MapTransition<T, Self, F>where
Self: Sized,
fn map<F: Fn(T) -> T>(self, map: F) -> MapTransition<T, Self, F>where
Self: Sized,
Similar to Vec::map, creates a transition that applies the given function to the value at each point in time.
sourcefn concat<S: Transition<T>>(self, other: S) -> SequentialTransition<T, Self, S>where
Self: Sized,
fn concat<S: Transition<T>>(self, other: S) -> SequentialTransition<T, Self, S>where
Self: Sized,
Concatenate two transitions.
sourcefn run(self, start_time: SystemTime) -> Animation<T, Self>
fn run(self, start_time: SystemTime) -> Animation<T, Self>
Run the transition at a specific time.
start_time- The time to start the transition, usuallySystemTime::now().