pub struct Tween { /* private fields */ }Expand description
A one-shot eased transition from from to to over duration seconds,
optionally after a delay. Non-finite or negative timesteps count as zero;
a nonpositive duration finishes immediately.
use ferravex_play::tween::{Ease, Motion, Tween};
let mut slide = Tween::new(-40., 0., 0.4, Ease::BackOut).delayed(0.1);
assert_eq!(slide.advance(0.1, Motion::Full), -40.); // still delayed
slide.advance(0.2, Motion::Full);
assert!(slide.value() > -40. && !slide.is_finished());
slide.advance(1., Motion::Full);
assert_eq!(slide.value(), 0.);
slide.retarget(100.); // continue smoothly from the current value
assert_eq!(Tween::new(0., 5., 1., Ease::Linear).advance(0.01, Motion::Reduced), 5.);Implementations§
Trait Implementations§
impl Copy for Tween
impl StructuralPartialEq for Tween
Auto Trait Implementations§
impl Freeze for Tween
impl RefUnwindSafe for Tween
impl Send for Tween
impl Sync for Tween
impl Unpin for Tween
impl UnwindSafe for Tween
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