Struct vek::transition::Transition
source · [−]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
sourceimpl<T, F, Progress> Transition<T, F, Progress>
impl<T, F, Progress> Transition<T, F, Progress>
sourcepub fn with_mapper(start: T, end: T, progress_mapper: F) -> Self where
Progress: Zero,
pub fn with_mapper(start: T, end: T, progress_mapper: F) -> Self where
Progress: Zero,
Creates a new Transition
from start
and end
values and progress_mapper
, setting progress
to zero.
sourcepub fn with_mapper_and_progress(
start: T,
end: T,
progress_mapper: F,
progress: Progress
) -> Self
pub fn with_mapper_and_progress(
start: T,
end: T,
progress_mapper: F,
progress: Progress
) -> Self
Creates a new Transition
from start
, end
, progress_mapper
and progress
values.
sourcepub fn into_range(self) -> Range<T>
pub fn into_range(self) -> Range<T>
Converts this into a Range
, dropping the progress
and progress_mapper
values.
sourceimpl<T, F, Progress> Transition<T, F, Progress> where
F: ProgressMapper<Progress>,
impl<T, F, Progress> Transition<T, F, Progress> where
F: ProgressMapper<Progress>,
sourcepub fn into_current(self) -> T where
T: Lerp<Progress, Output = T>,
Progress: Clamp + Zero + One,
pub fn into_current(self) -> T where
T: Lerp<Progress, Output = T>,
Progress: Clamp + Zero + One,
Gets the transition’s current state, clamping progress to [0;1].
sourcepub fn into_current_unclamped(self) -> T where
T: Lerp<Progress, Output = T>,
pub fn into_current_unclamped(self) -> T where
T: Lerp<Progress, Output = T>,
Gets the transition’s current state using the progress
value as-is.
sourcepub fn into_current_precise(self) -> T where
T: Lerp<Progress, Output = T>,
Progress: Clamp + Zero + One,
pub fn into_current_precise(self) -> T where
T: Lerp<Progress, Output = T>,
Progress: Clamp + Zero + One,
Gets the transition’s current state, clamping progress to [0;1].
sourcepub fn into_current_unclamped_precise(self) -> T where
T: Lerp<Progress, Output = T>,
pub fn into_current_unclamped_precise(self) -> T where
T: Lerp<Progress, Output = T>,
Gets the transition’s current state using the progress
value as-is.
sourcepub fn current<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy + Clamp + Zero + One,
pub fn current<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy + Clamp + Zero + One,
Gets the transition’s current state, clamping progress to [0;1].
sourcepub fn current_unclamped<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy,
pub fn current_unclamped<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy,
Gets the transition’s current state using the progress
value as-is.
sourcepub fn current_precise<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy + Clamp + Zero + One,
pub fn current_precise<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy + Clamp + Zero + One,
Gets the transition’s current state, clamping progress to [0;1].
sourcepub fn current_unclamped_precise<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy,
pub fn current_unclamped_precise<'a>(&'a self) -> T where
&'a T: Lerp<Progress, Output = T>,
Progress: Copy,
Gets the transition’s current state using the progress
value as-is.
sourceimpl<T, Progress> Transition<T, IdentityProgressMapper, Progress>
impl<T, Progress> Transition<T, IdentityProgressMapper, Progress>
sourcepub fn new(start: T, end: T) -> Self where
Progress: Zero,
pub fn new(start: T, end: T) -> Self where
Progress: Zero,
Creates a new LinearTransition
from start
and end
values, setting progress
to zero.
sourcepub fn with_progress(start: T, end: T, progress: Progress) -> Self
pub fn with_progress(start: T, end: T, progress: Progress) -> Self
Creates a new LinearTransition
from start
, end
and progress
values.
Trait Implementations
sourceimpl<T: Clone, F: Clone, Progress: Clone> Clone for Transition<T, F, Progress>
impl<T: Clone, F: Clone, Progress: Clone> Clone for Transition<T, F, Progress>
sourcefn clone(&self) -> Transition<T, F, Progress>
fn clone(&self) -> Transition<T, F, Progress>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'de, T, F, Progress> Deserialize<'de> for Transition<T, F, Progress> where
T: Deserialize<'de>,
F: Deserialize<'de>,
Progress: Deserialize<'de>,
impl<'de, T, F, Progress> Deserialize<'de> for Transition<T, F, Progress> where
T: Deserialize<'de>,
F: Deserialize<'de>,
Progress: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: PartialEq, F: PartialEq, Progress: PartialEq> PartialEq<Transition<T, F, Progress>> for Transition<T, F, Progress>
impl<T: PartialEq, F: PartialEq, Progress: PartialEq> PartialEq<Transition<T, F, Progress>> for Transition<T, F, Progress>
sourcefn eq(&self, other: &Transition<T, F, Progress>) -> bool
fn eq(&self, other: &Transition<T, F, Progress>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Transition<T, F, Progress>) -> bool
fn ne(&self, other: &Transition<T, F, Progress>) -> bool
This method tests for !=
.
sourceimpl<T, F, Progress> Serialize for Transition<T, F, Progress> where
T: Serialize,
F: Serialize,
Progress: Serialize,
impl<T, F, Progress> Serialize for Transition<T, F, Progress> where
T: Serialize,
F: Serialize,
Progress: Serialize,
impl<T: Copy, F: Copy, Progress: Copy> Copy for Transition<T, F, Progress>
impl<T: Eq, F: Eq, Progress: Eq> Eq for Transition<T, F, Progress>
impl<T, F, Progress> StructuralEq for Transition<T, F, Progress>
impl<T, F, Progress> StructuralPartialEq for Transition<T, F, Progress>
Auto Trait Implementations
impl<T, F, Progress> RefUnwindSafe for Transition<T, F, Progress> where
F: RefUnwindSafe,
Progress: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, F, Progress> Send for Transition<T, F, Progress> where
F: Send,
Progress: Send,
T: Send,
impl<T, F, Progress> Sync for Transition<T, F, Progress> where
F: Sync,
Progress: Sync,
T: Sync,
impl<T, F, Progress> Unpin for Transition<T, F, Progress> where
F: Unpin,
Progress: Unpin,
T: Unpin,
impl<T, F, Progress> UnwindSafe for Transition<T, F, Progress> where
F: UnwindSafe,
Progress: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more