pub type EasingStep = Factor;
Expand description
Easing function output.
Usually in the [0..=1] range, but can overshoot. An easing function converts a EasingTime
into this factor.
§Examples
use zng_unit::*;
use zng_var::animation::easing::{EasingStep, EasingTime};
/// Cubic animation curve.
fn cubic(time: EasingTime) -> EasingStep {
let f = time.fct();
f * f * f
}
Note that all the common easing functions are implemented in easing
.
Aliased Type§
struct EasingStep(pub f32);
Fields§
§0: f32
Implementations
Source§impl Factor
impl Factor
Sourcepub fn clamp_range(self) -> Factor
pub fn clamp_range(self) -> Factor
Clamp factor to [0.0..=1.0]
range.
Sourcepub fn clamp(self, min: impl Into<Factor>, max: impl Into<Factor>) -> Factor
pub fn clamp(self, min: impl Into<Factor>, max: impl Into<Factor>) -> Factor
Returns self
if min <= self <= max
, returns min
if self < min
or returns max
if self > max
.
Sourcepub fn pct(self) -> FactorPercent
pub fn pct(self) -> FactorPercent
Factor as percentage.
Trait Implementations
Source§impl AddAssign for Factor
impl AddAssign for Factor
Source§fn add_assign(&mut self, rhs: Factor)
fn add_assign(&mut self, rhs: Factor)
Performs the
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for Factor
impl<'de> Deserialize<'de> for Factor
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Factor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Factor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DivAssign for Factor
impl DivAssign for Factor
Source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moreSource§impl From<FactorPercent> for Factor
impl From<FactorPercent> for Factor
Source§fn from(value: FactorPercent) -> Factor
fn from(value: FactorPercent) -> Factor
Converts to this type from the input type.
Source§impl IntoVar<CornerRadius> for Factor
impl IntoVar<CornerRadius> for Factor
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<EasingTime> for Factor
impl IntoVar<EasingTime> for Factor
Source§fn into_var(self) -> <Factor as IntoVar<EasingTime>>::Var
fn into_var(self) -> <Factor as IntoVar<EasingTime>>::Var
Converts the source value into a var.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<FactorPercent> for Factor
impl IntoVar<FactorPercent> for Factor
Source§fn into_var(self) -> <Factor as IntoVar<FactorPercent>>::Var
fn into_var(self) -> <Factor as IntoVar<FactorPercent>>::Var
Converts the source value into a var.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<FactorSideOffsets> for Factor
impl IntoVar<FactorSideOffsets> for Factor
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<FontStretch> for Factor
impl IntoVar<FontStretch> for Factor
Source§fn into_var(self) -> <Factor as IntoVar<FontStretch>>::Var
fn into_var(self) -> <Factor as IntoVar<FontStretch>>::Var
Converts the source value into a var.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<GradientRadius> for Factor
impl IntoVar<GradientRadius> for Factor
Source§fn into_var(self) -> <Factor as IntoVar<GradientRadius>>::Var
fn into_var(self) -> <Factor as IntoVar<GradientRadius>>::Var
Conversion to Length::Factor
and to radius.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<GradientStop> for Factor
impl IntoVar<GradientStop> for Factor
Source§fn into_var(self) -> <Factor as IntoVar<GradientStop>>::Var
fn into_var(self) -> <Factor as IntoVar<GradientStop>>::Var
Conversion to Length::Factor
color hint.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<GridSpacing> for Factor
impl IntoVar<GridSpacing> for Factor
Source§fn into_var(self) -> <Factor as IntoVar<GridSpacing>>::Var
fn into_var(self) -> <Factor as IntoVar<GridSpacing>>::Var
Column and row equal relative length.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl IntoVar<SideOffsets> for Factor
impl IntoVar<SideOffsets> for Factor
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
Converts into
BoxedVar<T>
. Read moreSource§impl MulAssign for Factor
impl MulAssign for Factor
Source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moreSource§impl PartialOrd for Factor
impl PartialOrd for Factor
Source§impl SelectorValue for Factor
impl SelectorValue for Factor
Source§impl Serialize for Factor
impl Serialize for Factor
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,
Serialize this value into the given Serde serializer. Read more
Source§impl SubAssign for Factor
impl SubAssign for Factor
Source§fn sub_assign(&mut self, rhs: Factor)
fn sub_assign(&mut self, rhs: Factor)
Performs the
-=
operation. Read more