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
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.