pub struct SpringConfig {
pub mass: f64,
pub stiffness: f64,
pub damping: f64,
}Expand description
Spring physics configuration.
Fields§
§mass: f64Mass of the object (affects inertia)
stiffness: f64Stiffness of the spring (affects speed)
damping: f64Damping coefficient (affects bounciness)
Implementations§
Source§impl SpringConfig
impl SpringConfig
Sourcepub const GENTLE: SpringConfig
pub const GENTLE: SpringConfig
Gentle spring (slow, smooth)
Sourcepub const WOBBLY: SpringConfig
pub const WOBBLY: SpringConfig
Wobbly spring (bouncy)
Sourcepub const STIFF: SpringConfig
pub const STIFF: SpringConfig
Stiff spring (fast, snappy)
Sourcepub const MOLASSES: SpringConfig
pub const MOLASSES: SpringConfig
Molasses spring (very slow)
Sourcepub const fn custom(mass: f64, stiffness: f64, damping: f64) -> SpringConfig
pub const fn custom(mass: f64, stiffness: f64, damping: f64) -> SpringConfig
Create custom spring config.
Sourcepub fn damping_ratio(&self) -> f64
pub fn damping_ratio(&self) -> f64
Calculate damping ratio.
Sourcepub fn is_underdamped(&self) -> bool
pub fn is_underdamped(&self) -> bool
Whether spring is underdamped (will oscillate).
Sourcepub fn is_critically_damped(&self) -> bool
pub fn is_critically_damped(&self) -> bool
Whether spring is critically damped (fastest without oscillation).
Sourcepub fn is_overdamped(&self) -> bool
pub fn is_overdamped(&self) -> bool
Whether spring is overdamped (slow, no oscillation).
Trait Implementations§
Source§impl Clone for SpringConfig
impl Clone for SpringConfig
Source§fn clone(&self) -> SpringConfig
fn clone(&self) -> SpringConfig
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 moreSource§impl Debug for SpringConfig
impl Debug for SpringConfig
Source§impl Default for SpringConfig
impl Default for SpringConfig
Source§fn default() -> SpringConfig
fn default() -> SpringConfig
Returns the “default value” for a type. Read more
Source§impl PartialEq for SpringConfig
impl PartialEq for SpringConfig
impl Copy for SpringConfig
impl StructuralPartialEq for SpringConfig
Auto Trait Implementations§
impl Freeze for SpringConfig
impl RefUnwindSafe for SpringConfig
impl Send for SpringConfig
impl Sync for SpringConfig
impl Unpin for SpringConfig
impl UnwindSafe for SpringConfig
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