Struct veloren_voxygen_anim::vek::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§
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§fn eq(&self, other: &Transition<T, F, Progress>) -> bool
fn eq(&self, other: &Transition<T, F, Progress>) -> bool
self
and other
values to be equal, and is used
by ==
.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> 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<C, M> ConvertSaveload<M> for C
impl<C, M> ConvertSaveload<M> for C
§type Error = Infallible
type Error = Infallible
§fn convert_into<F>(
&self,
_: F,
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F,
) -> Result<C, <C as ConvertSaveload<M>>::Error>
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<Context> SubContext<Context> for Context
impl<Context> SubContext<Context> for Context
fn sub_context(self) -> Context
§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
§fn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default
and panics on an error case.