unit_value
Normalized unit-domain values.
Enums
UnitValue
A scalar value in a normalized unit domain.
UnitValue accepts both unitless numbers and percents. It is useful for
properties whose authoring domain is "part of a whole", such as path drawing
progress where 0.5 and 50% describe the same position.
Variants
Unitless(Numeric)
Unitless normalized value, where 0.5 means halfway through the domain.
Percent(Numeric)
Percent value, where 50% means halfway through the domain.
Implementations
to_clamped_unit_float
pub fn to_clamped_unit_float(&self) -> f64
Returns to_unit_float() clamped into the closed unit interval.
to_unit_float
pub fn to_unit_float(&self) -> f64
Returns the wrapped value as a normalized unitless float.
UnitValue::Unitless(0.5) returns 0.5, and
UnitValue::Percent(50) returns 0.5.