pub struct Sequence { /* private fields */ }Expand description
Sequential timeline that chains multiple animation segments.
Use Sequence::then to append segments. Sampling automatically advances
through each segment as ticks increase.
§Example
use slt::anim::{ease_in_cubic, ease_out_quad, LoopMode, Sequence};
let mut seq = Sequence::new()
.then(0.0, 100.0, 30, ease_out_quad)
.then(100.0, 50.0, 20, ease_in_cubic)
.loop_mode(LoopMode::Repeat);
seq.reset(0);
let _ = seq.value(25);Implementations§
Source§impl Sequence
impl Sequence
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty sequence.
Defaults to LoopMode::Once. Add segments with Sequence::then
and call Sequence::reset before sampling.
Sourcepub fn then(
self,
from: f64,
to: f64,
duration_ticks: u64,
easing: fn(f64) -> f64,
) -> Self
pub fn then( self, from: f64, to: f64, duration_ticks: u64, easing: fn(f64) -> f64, ) -> Self
Append a segment from from to to over duration_ticks ticks.
Sourcepub fn loop_mode(self, mode: LoopMode) -> Self
pub fn loop_mode(self, mode: LoopMode) -> Self
Set loop behavior used after the first full pass.
Sourcepub fn on_complete(self, f: impl FnMut() + 'static) -> Self
pub fn on_complete(self, f: impl FnMut() + 'static) -> Self
Register a callback that runs once when the sequence completes.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Returns true if the sequence finished in LoopMode::Once.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sequence
impl !RefUnwindSafe for Sequence
impl !Send for Sequence
impl !Sync for Sequence
impl Unpin for Sequence
impl UnsafeUnpin for Sequence
impl !UnwindSafe for Sequence
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