pub struct EasingTime(/* private fields */);Expand description
Easing function input.
An easing function converts this time into a EasingStep factor.
The time is always in the [0..=1] range, factors are clamped to this range on creation.
Implementations§
Source§impl EasingTime
impl EasingTime
Sourcepub fn new(factor: Factor) -> Self
pub fn new(factor: Factor) -> Self
New from Factor.
The factor is clamped to the [0..=1] range.
Sourcepub fn elapsed(
duration: Duration,
elapsed: Duration,
time_scale: Factor,
) -> Self
pub fn elapsed( duration: Duration, elapsed: Duration, time_scale: Factor, ) -> Self
New easing time from total duration, elapsed time and time_scale.
If elapsed >= duration the time is 1.
Sourcepub fn pct(self) -> FactorPercent
pub fn pct(self) -> FactorPercent
Get the time as a FactorPercent.
Sourcepub fn seg<T: Into<EasingTime> + Clone>(
self,
segment_range: impl RangeBounds<T>,
) -> Option<EasingTime>
pub fn seg<T: Into<EasingTime> + Clone>( self, segment_range: impl RangeBounds<T>, ) -> Option<EasingTime>
If the time is within segment_range returns it normalized for the segment range, with segment start at 0 and end at 1.
Trait Implementations§
Source§impl Add for EasingTime
impl Add for EasingTime
Source§impl AddAssign for EasingTime
impl AddAssign for EasingTime
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Clone for EasingTime
impl Clone for EasingTime
Source§fn clone(&self) -> EasingTime
fn clone(&self) -> EasingTime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EasingTime
impl Debug for EasingTime
Source§impl From<Factor> for EasingTime
impl From<Factor> for EasingTime
Source§impl From<FactorPercent> for EasingTime
impl From<FactorPercent> for EasingTime
Source§fn from(factor: FactorPercent) -> Self
fn from(factor: FactorPercent) -> Self
Converts to this type from the input type.
Source§impl Hash for EasingTime
impl Hash for EasingTime
Source§impl IntoVar<EasingTime> for Factor
impl IntoVar<EasingTime> for Factor
fn into_var(self) -> Var<EasingTime>
Source§impl IntoVar<EasingTime> for FactorPercent
impl IntoVar<EasingTime> for FactorPercent
fn into_var(self) -> Var<EasingTime>
Source§impl PartialEq for EasingTime
impl PartialEq for EasingTime
Source§impl PartialOrd for EasingTime
impl PartialOrd for EasingTime
Source§impl Sub for EasingTime
impl Sub for EasingTime
Source§impl SubAssign for EasingTime
impl SubAssign for EasingTime
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for EasingTime
impl IntoValue<EasingTime> for Factor
impl IntoValue<EasingTime> for FactorPercent
impl StructuralPartialEq for EasingTime
Auto Trait Implementations§
impl Freeze for EasingTime
impl RefUnwindSafe for EasingTime
impl Send for EasingTime
impl Sync for EasingTime
impl Unpin for EasingTime
impl UnwindSafe for EasingTime
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Clone the value.
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
Swap value with
other if both are of the same type.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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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