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: TThe value when progress gets close to 0.
end: TThe value when progress gets close to 1.
progress: ProgressExpected to be between 0 and 1.
progress_mapper: FFunctor that maps the current progress value to a LERP factor.
Implementations§
Source§impl<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,
) -> Transition<T, F, Progress>where
Progress: Zero,
pub fn with_mapper(
start: T,
end: T,
progress_mapper: F,
) -> Transition<T, F, Progress>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,
) -> Transition<T, F, Progress>
pub fn with_mapper_and_progress( start: T, end: T, progress_mapper: F, progress: Progress, ) -> Transition<T, F, Progress>
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.
Source§impl<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
pub fn into_current(self) -> T
Gets the transition’s current state, clamping progress to [0;1].
Sourcepub fn into_current_unclamped(self) -> Twhere
T: Lerp<Progress, Output = T>,
pub fn into_current_unclamped(self) -> Twhere
T: Lerp<Progress, Output = T>,
Gets the transition’s current state using the progress value as-is.
Sourcepub fn into_current_precise(self) -> T
pub fn into_current_precise(self) -> T
Gets the transition’s current state, clamping progress to [0;1].
Sourcepub fn into_current_unclamped_precise(self) -> Twhere
T: Lerp<Progress, Output = T>,
pub fn into_current_unclamped_precise(self) -> Twhere
T: Lerp<Progress, Output = T>,
Gets the transition’s current state using the progress value as-is.
Sourcepub fn current<'a>(&'a self) -> T
pub fn current<'a>(&'a self) -> T
Gets the transition’s current state, clamping progress to [0;1].
Sourcepub fn current_unclamped<'a>(&'a self) -> T
pub fn current_unclamped<'a>(&'a self) -> T
Gets the transition’s current state using the progress value as-is.
Sourcepub fn current_precise<'a>(&'a self) -> T
pub fn current_precise<'a>(&'a self) -> T
Gets the transition’s current state, clamping progress to [0;1].
Sourcepub fn current_unclamped_precise<'a>(&'a self) -> T
pub fn current_unclamped_precise<'a>(&'a self) -> T
Gets the transition’s current state using the progress value as-is.
Source§impl<T, Progress> Transition<T, IdentityProgressMapper, Progress>
impl<T, Progress> Transition<T, IdentityProgressMapper, Progress>
Sourcepub fn new(start: T, end: T) -> Transition<T, IdentityProgressMapper, Progress>where
Progress: Zero,
pub fn new(start: T, end: T) -> Transition<T, IdentityProgressMapper, Progress>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,
) -> Transition<T, IdentityProgressMapper, Progress>
pub fn with_progress( start: T, end: T, progress: Progress, ) -> Transition<T, IdentityProgressMapper, Progress>
Creates a new LinearTransition from start, end and progress values.
Trait Implementations§
Source§impl<T, F, Progress> Clone for Transition<T, F, Progress>
impl<T, F, Progress> Clone for Transition<T, F, Progress>
Source§fn clone(&self) -> Transition<T, F, Progress>
fn clone(&self) -> Transition<T, F, Progress>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T, F, Progress> Debug for Transition<T, F, Progress>
impl<T, F, Progress> Debug for Transition<T, F, Progress>
Source§impl<T, F, Progress> Default for Transition<T, F, Progress>
impl<T, F, Progress> Default for Transition<T, F, Progress>
Source§fn default() -> Transition<T, F, Progress>
fn default() -> Transition<T, F, Progress>
Source§impl<'de, T, F, Progress> Deserialize<'de> for Transition<T, F, Progress>
impl<'de, T, F, Progress> Deserialize<'de> for Transition<T, F, Progress>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transition<T, F, Progress>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transition<T, F, Progress>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<T, F, Progress> From<Range<T>> for Transition<T, F, Progress>
impl<T, F, Progress> From<Range<T>> for Transition<T, F, Progress>
Source§fn from(r: Range<T>) -> Transition<T, F, Progress>
fn from(r: Range<T>) -> Transition<T, F, Progress>
Source§impl<T, F, Progress> Hash for Transition<T, F, Progress>
impl<T, F, Progress> Hash for Transition<T, F, Progress>
Source§impl<T, F, Progress> PartialEq for Transition<T, F, Progress>
impl<T, F, Progress> PartialEq for Transition<T, F, Progress>
Source§impl<T, F, Progress> Serialize for Transition<T, F, Progress>
impl<T, F, Progress> Serialize for Transition<T, F, Progress>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<T, F, Progress> Copy for Transition<T, F, Progress>
impl<T, F, Progress> Eq for Transition<T, F, Progress>
impl<T, F, Progress> StructuralPartialEq for Transition<T, F, Progress>
Auto Trait Implementations§
impl<T, F, Progress> Freeze for Transition<T, F, Progress>
impl<T, F, Progress> RefUnwindSafe for Transition<T, F, Progress>
impl<T, F, Progress> Send for Transition<T, F, Progress>
impl<T, F, Progress> Sync for Transition<T, F, Progress>
impl<T, F, Progress> Unpin for Transition<T, F, Progress>
impl<T, F, Progress> UnsafeUnpin for Transition<T, F, Progress>
impl<T, F, Progress> UnwindSafe for Transition<T, F, Progress>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.