pub struct MotionPolicy {
pub preference: MotionPreference,
pub time_scale: f32,
}Expand description
The motion policy in effect: the user’s MotionPreference plus a time
scale for watching transitions in slow motion while debugging.
Fields§
§preference: MotionPreference§time_scale: f32Playback speed of transitions relative to their nominal durations:
0.25 plays them at quarter speed. Values are kept at or above
MotionPolicy::MIN_TIME_SCALE.
Implementations§
Source§impl MotionPolicy
impl MotionPolicy
pub const MIN_TIME_SCALE: f32 = 0.01
pub const FULL: MotionPolicy
pub const fn new(preference: MotionPreference) -> MotionPolicy
pub const fn with_time_scale(self, time_scale: f32) -> MotionPolicy
Sourcepub fn allows_motion(self) -> bool
pub fn allows_motion(self) -> bool
Whether transitions animate at all.
Sourcepub fn allows_movement(self) -> bool
pub fn allows_movement(self) -> bool
Whether transitions may move content across the screen.
Sourcepub fn time_scale(self) -> f32
pub fn time_scale(self) -> f32
The effective time scale, kept positive.
Sourcepub fn duration(self, nominal: f64) -> f64
pub fn duration(self, nominal: f64) -> f64
How long a transition that lasts nominal seconds at full motion
should take: zero when motion is off, stretched by the time scale
otherwise.
Sourcepub fn movement_duration(self, nominal: f64) -> f64
pub fn movement_duration(self, nominal: f64) -> f64
Like MotionPolicy::duration, for a transition that moves content:
zero unless the policy allows movement.
Sourcepub fn scale_delta(self, delta: f64) -> f64
pub fn scale_delta(self, delta: f64) -> f64
Scale a frame delta for animation driven by elapsed time, such as a timeline player or a simulation, so it follows the time scale.
Sourcepub fn entrance_offset(self, progress: f32) -> f32
pub fn entrance_offset(self, progress: f32) -> f32
The share of an entrance offset (such as a popover sliding into
place) to apply at progress, from 1 when hidden to 0 when shown.
Without movement, surfaces fade in place.
Trait Implementations§
Source§impl Clone for MotionPolicy
impl Clone for MotionPolicy
Source§fn clone(&self) -> MotionPolicy
fn clone(&self) -> MotionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more