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 moreimpl Copy for MotionPolicy
Source§impl Debug for MotionPolicy
impl Debug for MotionPolicy
Source§impl Default for MotionPolicy
impl Default for MotionPolicy
Source§fn default() -> MotionPolicy
fn default() -> MotionPolicy
Source§impl PartialEq for MotionPolicy
impl PartialEq for MotionPolicy
impl StructuralPartialEq for MotionPolicy
Auto Trait Implementations§
impl Forget for MotionPolicy
impl Freeze for MotionPolicy
impl Move for MotionPolicy
impl RefUnwindSafe for MotionPolicy
impl Send for MotionPolicy
impl Sync for MotionPolicy
impl Unpin for MotionPolicy
impl UnsafeUnpin for MotionPolicy
impl UnwindSafe for MotionPolicy
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.