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§

source

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

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

source

fn duration(&self) -> Duration

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

Provided Methods§

source

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

Check if the transition is finished at the given offset.

source

fn is_infinite(&self) -> bool

Check if the transition is infinite.

source

fn start_value(&self) -> T

Get the value of the transition at the start.

source

fn end_value(&self) -> T

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

source

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.

source

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.

source

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.

source

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

Create a transition that repeats the given transition indefinitely.

source

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

Create a transition that repeats the given transition n times.

source

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

Create a transition that reverses the given transition.

source

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

Scale the time of the transition by the given factor.

source

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

Scale the time of the transition to the given duration.

source

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.

source

fn concat<S: Transition<T>>(self, other: S) -> SequentialTransition<T, Self, S>
where Self: Sized,

Concatenate two transitions.

source

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

Run the transition at a specific time.

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

Object Safety§

This trait is not object safe.

Implementors§