pub struct Transition<T, F, Progress = f32> {
    pub start: T,
    pub end: T,
    pub progress: Progress,
    pub progress_mapper: F,
}
Expand description

A convenience structure for storing a progression from one value to another.

Fields

start: T

The value when progress gets close to 0.

end: T

The value when progress gets close to 1.

progress: Progress

Expected to be between 0 and 1.

progress_mapper: F

Functor that maps the current progress value to a LERP factor.

Implementations

Creates a new Transition from start and end values and progress_mapper, setting progress to zero.

Creates a new Transition from start, end, progress_mapper and progress values.

Converts this into a Range, dropping the progress and progress_mapper values.

Gets the transition’s current state, clamping progress to [0;1].

Gets the transition’s current state using the progress value as-is.

Gets the transition’s current state, clamping progress to [0;1].

Gets the transition’s current state using the progress value as-is.

Gets the transition’s current state, clamping progress to [0;1].

Gets the transition’s current state using the progress value as-is.

Gets the transition’s current state, clamping progress to [0;1].

Gets the transition’s current state using the progress value as-is.

Creates a new LinearTransition from start and end values, setting progress to zero.

Creates a new LinearTransition from start, end and progress values.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.