pub struct SpringSpec {
pub damping_ratio: f32,
pub stiffness: f32,
pub settle_progress: f32,
pub settle_velocity: f32,
}Expand description
Physical spring parameters. Duration is emergent (determined by physics), not specified.
Fields§
§damping_ratio: f32Damping ratio ζ: 0 = undamped, <1 = underdamped (overshoot), 1 = critically damped,
1 = overdamped.
stiffness: f32Stiffness k: higher = faster, snappier response.
settle_progress: f32Progress threshold for settling: when |progress - 1.0| < this, the spring is
considered visually close enough to the target and stops. Default: 0.005 (0.5%).
settle_velocity: f32Velocity threshold for settling (in progress-units/second). Default: 0.1.
Implementations§
Source§impl SpringSpec
impl SpringSpec
pub const fn new(damping_ratio: f32, stiffness: f32) -> Self
Sourcepub const fn with_settle_progress(self, threshold: f32) -> Self
pub const fn with_settle_progress(self, threshold: f32) -> Self
Set the settling threshold in progress units. Lower values = more precise settling. For example, 0.001 means the spring stops when within 0.1% of the target.
Sourcepub const fn with_settle_velocity(self, threshold: f32) -> Self
pub const fn with_settle_velocity(self, threshold: f32) -> Self
Set the velocity threshold for settling (progress-units/second).
Trait Implementations§
Source§impl Clone for SpringSpec
impl Clone for SpringSpec
Source§fn clone(&self) -> SpringSpec
fn clone(&self) -> SpringSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SpringSpec
Auto Trait Implementations§
impl Freeze for SpringSpec
impl RefUnwindSafe for SpringSpec
impl Send for SpringSpec
impl Sync for SpringSpec
impl Unpin for SpringSpec
impl UnsafeUnpin for SpringSpec
impl UnwindSafe for SpringSpec
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