pub struct Spring<T>where
T: Float,{
pub from_value: T,
pub to_value: T,
pub stiffness: T,
pub damping: T,
pub mass: T,
pub initial_velocity: T,
pub allows_overdamping: bool,
pub overshoot_clamping: bool,
}Expand description
This is a spring whose oscillation and velocity we can efficiently approximate.
Fields§
§from_value: TStarting value of the animation.
to_value: TEnding value of the animation.
stiffness: TThe spring stiffness coefficient.
damping: TDefines how the spring’s motion should be damped due to the forces of friction.
mass: TThe mass of the object attached to the end of the spring.
initial_velocity: TThe initial velocity (in units/ms) of the object attached to the spring.
allows_overdamping: boolWhether or not the spring allows “overdamping” (a damping ratio > 1).
overshoot_clamping: boolFalse when overshooting is allowed, true when it is not.
Trait Implementations§
Source§impl<T> Curve for Spring<T>where
T: Float,
impl<T> Curve for Spring<T>where
T: Float,
Source§fn approximate(&self, time: f32) -> Approximation<T>
fn approximate(&self, time: f32) -> Approximation<T>
This function approximates a spring’s oscillation and velocity at the given timestamp.
impl<T> Copy for Spring<T>
Auto Trait Implementations§
impl<T> Freeze for Spring<T>where
T: Freeze,
impl<T> RefUnwindSafe for Spring<T>where
T: RefUnwindSafe,
impl<T> Send for Spring<T>where
T: Send,
impl<T> Sync for Spring<T>where
T: Sync,
impl<T> Unpin for Spring<T>where
T: Unpin,
impl<T> UnwindSafe for Spring<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