pub struct TweenSequence<T: Lerp + Clone + Debug> {
pub steps: Vec<SequenceStep<T>>,
pub elapsed: f32,
pub looping: bool,
pub duration: f32,
pub done: bool,
/* private fields */
}Expand description
A sequence of tweens played one after another with optional overlap.
The sequence tracks its own clock and drives one step at a time. The current value is the output of the currently active step.
Fields§
§steps: Vec<SequenceStep<T>>§elapsed: f32§looping: bool§duration: f32§done: boolImplementations§
Source§impl<T: Lerp + Clone + Debug> TweenSequence<T>
impl<T: Lerp + Clone + Debug> TweenSequence<T>
Sourcepub fn new(steps: Vec<(Tween<T>, f32)>, default_val: T, looping: bool) -> Self
pub fn new(steps: Vec<(Tween<T>, f32)>, default_val: T, looping: bool) -> Self
Build a sequence from a list of (tween, overlap) pairs.
Sourcepub fn tick(&mut self, dt: f32) -> T
pub fn tick(&mut self, dt: f32) -> T
Advance the sequence by dt and return the current interpolated value.
Sourcepub fn current_value(&self) -> T
pub fn current_value(&self) -> T
Current value based on elapsed time, without advancing.
pub fn reset(&mut self)
pub fn progress(&self) -> f32
Auto Trait Implementations§
impl<T> Freeze for TweenSequence<T>where
T: Freeze,
impl<T> RefUnwindSafe for TweenSequence<T>where
T: RefUnwindSafe,
impl<T> Send for TweenSequence<T>where
T: Send,
impl<T> Sync for TweenSequence<T>where
T: Sync,
impl<T> Unpin for TweenSequence<T>where
T: Unpin,
impl<T> UnsafeUnpin for TweenSequence<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TweenSequence<T>where
T: UnwindSafe,
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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.