pub enum Class {
Spatial,
Scale,
Opacity,
Color,
Gesture,
Other,
}Expand description
The kind of a moving value. It sets how close counts as settled and what reduced motion does. Effect classes (opacity, colour) never overshoot: their samples stay between the start and the target.
Variants§
Spatial
Positions and sizes in points.
Scale
A scale factor around 1.
Opacity
An alpha 0..=1. An effect: never overshoots.
Color
Colour lanes (OKLab). An effect: never overshoots.
Gesture
A value under the user’s hand (a drag or fling): reduced motion leaves it alone.
Other
Anything else (a progress number…).
Implementations§
Source§impl Class
impl Class
Sourcepub fn eps(self, pixels_per_point: f32) -> Eps
pub fn eps(self, pixels_per_point: f32) -> Eps
Settle thresholds for this class on a display with pixels_per_point (NaN is 1, clamped
to 0.25..=16). Spatial and gesture values settle within a quarter of a physical pixel.
Sourcepub const fn is_effect(self) -> bool
pub const fn is_effect(self) -> bool
Whether this class is an effect (opacity, colour) that must not overshoot.
Sourcepub const fn reduce(self, curve: Curve) -> Curve
pub const fn reduce(self, curve: Curve) -> Curve
The curve to use instead of curve under reduced motion: spatial, scale and other values
jump; opacity and colour take a short fade (crate::tokens::REDUCED_FADE); a gesture
keeps its curve (the user’s own hand is never slowed or removed).