Struct EffectiveMotion
pub struct EffectiveMotion { /* private fields */ }Expand description
The motion a widget may play: the Motion tokens with the person’s
reduced-motion setting applied. Read through crate::Theme::motion;
it is the one place reduced motion is decided, so every widget and the
shell’s chrome follow the same rule (HIG §9.7, design-language “Motion”):
- Movement — a slide, a scale, a spring, a snap, an overshoot — lands at
once (
Self::movementis zero,Self::movesis false). - A change of what is shown may still cross-fade, at most
fast(Self::fade): opacity carries the change without anything moving. - A looping indicator (spinner, busy arc, sweeping bar) stands still
(
Self::loopsis false); progress and status keep updating.
Reduced motion never stops the frame pump: a widget that settles asks for no frames, and one that still has a fade or new content to show gets them.
Implementations§
§impl EffectiveMotion
impl EffectiveMotion
pub const fn new(tokens: Motion, reduced: bool) -> EffectiveMotion
pub const fn reduced(self) -> bool
pub const fn reduced(self) -> bool
Whether movement is off: the person asked for reduced motion, or
the theme holds still (Motion::still).
pub const fn loops(self) -> bool
pub const fn loops(self) -> bool
Whether a looping indicator animates; under reduced motion it draws its resting mark.
pub fn movement(self, nominal: Duration) -> Duration
pub fn movement(self, nominal: Duration) -> Duration
How long a movement lasts: nominal, or nothing under reduced motion.
pub fn fade(self, nominal: Duration) -> Duration
pub fn fade(self, nominal: Duration) -> Duration
How long a cross-fade lasts: nominal, or at most fast under
reduced motion, where it stands in for the movement it replaces.
pub fn replacement_fade(self) -> Duration
pub fn replacement_fade(self) -> Duration
The cross-fade that replaces a spatial transition under reduced
motion: fast, or nothing when motion is on (the movement itself
shows the change).
pub const fn tokens(self) -> Motion
pub const fn tokens(self) -> Motion
The tokens themselves, for values reduced motion does not change (springs a gesture tracks with, gesture tuning).
pub const fn with_tokens(self, tokens: Motion) -> EffectiveMotion
pub const fn with_tokens(self, tokens: Motion) -> EffectiveMotion
These tokens instead, with the person’s reduced-motion setting kept: how a component
paces its own motion (crate::motion::Feel).
Trait Implementations§
§impl Clone for EffectiveMotion
impl Clone for EffectiveMotion
§fn clone(&self) -> EffectiveMotion
fn clone(&self) -> EffectiveMotion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for EffectiveMotion
impl Debug for EffectiveMotion
§impl Default for EffectiveMotion
impl Default for EffectiveMotion
§fn default() -> EffectiveMotion
fn default() -> EffectiveMotion
The default tokens with motion on: what a surface uses before it has been drawn with a theme.
§impl PartialEq for EffectiveMotion
impl PartialEq for EffectiveMotion
impl Copy for EffectiveMotion
impl StructuralPartialEq for EffectiveMotion
Auto Trait Implementations§
impl Freeze for EffectiveMotion
impl RefUnwindSafe for EffectiveMotion
impl Send for EffectiveMotion
impl Sync for EffectiveMotion
impl Unpin for EffectiveMotion
impl UnsafeUnpin for EffectiveMotion
impl UnwindSafe for EffectiveMotion
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more