pub struct ThemeMotion {
pub duration_instant: f32,
pub duration_fast: f32,
pub duration_normal: f32,
pub duration_slow: f32,
pub duration_slower: f32,
pub easing_standard: Easing,
pub easing_emphasized: Easing,
pub easing_decelerate: Easing,
pub easing_accelerate: Easing,
}Expand description
Motion design tokens: a shared vocabulary of animation durations and easing curves so widgets and applications animate consistently.
Durations are expressed in seconds (matching the delta supplied by
crate::animation::AnimatedValue::tick and the time/delta fields of
WakeEvent::AnimationFrame). Easing curves are built from the
Easing enum and are Copy, keeping DefaultTheme Copy.
The duration ladder follows the Mesh design language: 70ms micro feedback, 140ms small state changes, 220ms medium surfaces (popovers, dialogs) and 340ms large transitions (drawers, sheets, page changes).
Fields§
§duration_instant: f32No animation: state changes apply immediately (0.0s).
duration_fast: f32Micro feedback such as hover tint / press state changes (0.07s).
duration_normal: f32Small state changes: toggles, fades, tooltips (0.14s).
duration_slow: f32Medium surfaces: popovers, dialogs, expanding panels (0.22s).
duration_slower: f32Large transitions: drawers, sheets, page changes (0.34s).
easing_standard: EasingThe standard easing curve: gentle acceleration, firm deceleration. Use for the majority of UI transitions.
easing_emphasized: EasingA more expressive curve for prominent, attention-drawing motion.
easing_decelerate: EasingDecelerate curve: enters quickly, settles softly. Good for elements entering the screen.
easing_accelerate: EasingAccelerate curve: starts softly, exits quickly. Good for elements leaving the screen.
Implementations§
Source§impl ThemeMotion
impl ThemeMotion
Sourcepub const fn standard() -> ThemeMotion
pub const fn standard() -> ThemeMotion
The standard motion tokens shared by every built-in theme.
pub fn hover_duration(&self) -> f64
pub fn press_duration(&self) -> f64
pub fn focus_duration(&self) -> f64
pub fn toggle_duration(&self) -> f64
pub fn entrance_duration(&self) -> f64
pub fn tab_switch_duration(&self) -> f64
pub const fn hover_easing(&self) -> Easing
pub const fn press_easing(&self) -> Easing
pub const fn focus_easing(&self) -> Easing
pub const fn toggle_easing(&self) -> Easing
pub const fn entrance_easing(&self) -> Easing
pub const fn tab_switch_easing(&self) -> Easing
Sourcepub fn hover_spec(&self) -> AnimationSpec
pub fn hover_spec(&self) -> AnimationSpec
Hover feedback as an AnimationSpec. Like every spec below, widgets
apply the app’s motion policy when they start the transition.
pub fn press_spec(&self) -> AnimationSpec
pub fn focus_spec(&self) -> AnimationSpec
pub fn toggle_spec(&self) -> AnimationSpec
pub fn entrance_spec(&self) -> AnimationSpec
pub fn tab_switch_spec(&self) -> AnimationSpec
Sourcepub fn exit_spec(&self) -> AnimationSpec
pub fn exit_spec(&self) -> AnimationSpec
Content leaving: as quick as an entrance, accelerating away.
Sourcepub fn layout_spec(&self) -> AnimationSpec
pub fn layout_spec(&self) -> AnimationSpec
Content gliding to a new place after its layout changes, such as a reordered list item.
Trait Implementations§
Source§impl Clone for ThemeMotion
impl Clone for ThemeMotion
Source§fn clone(&self) -> ThemeMotion
fn clone(&self) -> ThemeMotion
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 ThemeMotion
Source§impl Debug for ThemeMotion
impl Debug for ThemeMotion
Source§impl Default for ThemeMotion
impl Default for ThemeMotion
Source§fn default() -> ThemeMotion
fn default() -> ThemeMotion
Source§impl PartialEq for ThemeMotion
impl PartialEq for ThemeMotion
impl StructuralPartialEq for ThemeMotion
Auto Trait Implementations§
impl Forget for ThemeMotion
impl Freeze for ThemeMotion
impl Move for ThemeMotion
impl RefUnwindSafe for ThemeMotion
impl Send for ThemeMotion
impl Sync for ThemeMotion
impl Unpin for ThemeMotion
impl UnsafeUnpin for ThemeMotion
impl UnwindSafe for ThemeMotion
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.