pub struct Stagger { /* private fields */ }Expand description
Configuration for staggering multiple animations.
§Examples
use eazy_tweener::{Stagger, StaggerFrom};
// Each animation starts 0.1s after the previous
let stagger = Stagger::each(0.1);
// Stagger from center outward
let stagger = Stagger::each(0.1).from(StaggerFrom::Center);
// Apply easing to the stagger distribution
let stagger = Stagger::each(0.1).ease(eazy_core::Easing::OutQuadratic);Implementations§
Source§impl Stagger
impl Stagger
Sourcepub fn each(delay: f32) -> Stagger
pub fn each(delay: f32) -> Stagger
Create a stagger with the given delay between each animation.
Sourcepub fn total(duration: f32) -> Stagger
pub fn total(duration: f32) -> Stagger
Create a stagger that distributes animations across a total duration.
The delay between each animation is calculated as total / (count - 1).
Sourcepub fn from(self, from: StaggerFrom) -> Stagger
pub fn from(self, from: StaggerFrom) -> Stagger
Set the stagger direction.
Sourcepub fn ease(self, easing: Easing) -> Stagger
pub fn ease(self, easing: Easing) -> Stagger
Apply an easing function to the stagger distribution.
This affects how the delays are distributed, not the animations themselves.
Sourcepub fn total_stagger_duration(&self, count: usize) -> f32
pub fn total_stagger_duration(&self, count: usize) -> f32
Get the total stagger duration for a collection.
This is the delay of the last animation to start.
Sourcepub fn each_delay(&self) -> f32
pub fn each_delay(&self) -> f32
Get the each delay value.
Sourcepub fn direction(&self) -> StaggerFrom
pub fn direction(&self) -> StaggerFrom
Get the stagger direction.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stagger
impl RefUnwindSafe for Stagger
impl Send for Stagger
impl Sync for Stagger
impl Unpin for Stagger
impl UnsafeUnpin for Stagger
impl UnwindSafe for Stagger
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
Mutably borrows from an owned value. Read more