pub struct SpringAnimation { /* private fields */ }Expand description
Spring animation using physics simulation
Implementations§
Source§impl SpringAnimation
impl SpringAnimation
Sourcepub fn new(current: f64, target: f64, stiffness: f64, damping: f64) -> Self
pub fn new(current: f64, target: f64, stiffness: f64, damping: f64) -> Self
Create a new spring animation
current: starting valuetarget: target valuestiffness: spring stiffness (0.0 to 1.0, higher = faster)damping: damping factor (0.0 to 1.0, higher = less bounce)
Sourcepub fn current_value(&self) -> f64
pub fn current_value(&self) -> f64
Get current value
Sourcepub fn is_settled(&self) -> bool
pub fn is_settled(&self) -> bool
Check if spring has settled
Sourcepub fn set_target(&mut self, target: f64)
pub fn set_target(&mut self, target: f64)
Set new target
Sourcepub fn set_threshold(&mut self, threshold: f64)
pub fn set_threshold(&mut self, threshold: f64)
Set threshold for settlement detection
Trait Implementations§
Source§impl Clone for SpringAnimation
impl Clone for SpringAnimation
Source§fn clone(&self) -> SpringAnimation
fn clone(&self) -> SpringAnimation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SpringAnimation
impl RefUnwindSafe for SpringAnimation
impl Send for SpringAnimation
impl Sync for SpringAnimation
impl Unpin for SpringAnimation
impl UnsafeUnpin for SpringAnimation
impl UnwindSafe for SpringAnimation
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