pub enum Animation {
Default,
Linear(Duration),
EaseIn(Duration),
EaseOut(Duration),
EaseInOut(Duration),
Spring {
stiffness: f32,
damping: f32,
},
}Expand description
An enumeration representing different types of animations
This enum provides various animation types for UI elements or graphics:
Linear: Constant speed from start to finishEaseIn: Starts slow and acceleratesEaseOut: Starts fast and deceleratesEaseInOut: Starts and ends slowly with acceleration in the middleSpring: Physics-based movement with configurable stiffness and damping
Each animation type (except Spring) takes a Duration parameter that specifies how long the animation should take to complete.
Variants§
Default
Default animation behavior (uses system defaults)
Linear(Duration)
Linear animation with constant velocity
EaseIn(Duration)
Ease-in animation that starts slow and accelerates
EaseOut(Duration)
Ease-out animation that starts fast and decelerates
EaseInOut(Duration)
Ease-in-out animation that starts and ends slowly with acceleration in the middle
Spring
Spring animation with physics-based movement
Implementations§
Source§impl Animation
impl Animation
Sourcepub fn linear(duration: impl Into<Duration>) -> Self
pub fn linear(duration: impl Into<Duration>) -> Self
Creates a new Linear animation with the specified duration
This is an ergonomic constructor that accepts any type that can be converted into a Duration (such as u64 milliseconds, etc.)
§Examples
use waterui_core::animation::Animation;
use core::time::Duration;
let animation = Animation::linear(Duration::from_millis(300)); // 300ms
let animation = Animation::linear(Duration::from_secs(1)); // 1 secondSourcepub fn ease_in(duration: impl Into<Duration>) -> Self
pub fn ease_in(duration: impl Into<Duration>) -> Self
Creates a new ease-in animation with the specified duration
This is an ergonomic constructor that accepts any type that can be converted into a Duration (such as u64 milliseconds, etc.)
§Examples
use waterui_core::animation::Animation;
use core::time::Duration;
let animation = Animation::ease_in(Duration::from_millis(300)); // 300ms
let animation = Animation::ease_in(Duration::from_secs(1)); // 1 secondSourcepub fn ease_out(duration: impl Into<Duration>) -> Self
pub fn ease_out(duration: impl Into<Duration>) -> Self
Creates a new ease-out animation with the specified duration
This is an ergonomic constructor that accepts any type that can be converted into a Duration (such as u64 milliseconds, etc.)
§Examples
use waterui_core::animation::Animation;
use core::time::Duration;
let animation = Animation::ease_out(Duration::from_millis(300)); // 300ms
let animation = Animation::ease_out(Duration::from_secs(1)); // 1 secondSourcepub fn ease_in_out(duration: impl Into<Duration>) -> Self
pub fn ease_in_out(duration: impl Into<Duration>) -> Self
Creates a new ease-in-out animation with the specified duration
This is an ergonomic constructor that accepts any type that can be converted into a Duration (such as u64 milliseconds, etc.)
§Examples
use waterui_core::animation::Animation;
use core::time::Duration;
let animation = Animation::ease_in_out(Duration::from_millis(300)); // 300ms
let animation = Animation::ease_in_out(Duration::from_secs(1)); // 1 second