pub struct Tween { /* private fields */ }Expand description
A manager for a tween on a single f32 value.
Implementations§
Source§impl Tween
impl Tween
Sourcepub fn new(
easer: fn(f32, f32, f32, f32) -> f32,
start_value: f32,
end_value: f32,
duration: f32,
) -> Tween
pub fn new( easer: fn(f32, f32, f32, f32) -> f32, start_value: f32, end_value: f32, duration: f32, ) -> Tween
Creates a new Tween given the easing function, value bounds, and duration.
Sourcepub fn has_completed(&self) -> bool
pub fn has_completed(&self) -> bool
Returns true if the tween has completed.
Sourcepub fn apply(&mut self, time_advance: f32) -> f32
pub fn apply(&mut self, time_advance: f32) -> f32
Returns the new value after applying the tween, advancing time by time_advance.
Sourcepub fn reverse(&mut self)
pub fn reverse(&mut self)
Reverses the tween, adjusting the current time position such that it will retrace its steps so far.
Sourcepub fn current_time(&self) -> f32
pub fn current_time(&self) -> f32
Returns the current time position of the tween.
Sourcepub fn start_value(&self) -> f32
pub fn start_value(&self) -> f32
Returns the starting value of the 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 UnsafeUnpin 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