Skip to main content

spring_step

Function spring_step 

Source
pub fn spring_step(
    progress: f32,
    velocity: f32,
    target: f32,
    dt: f32,
    stiffness: f32,
    damping: f32,
) -> (f32, f32, bool)
Expand description

One damped-spring step (semi-implicit Euler) driving progress towards target, primed by velocity. stiffness/damping set the stiffness and the damping (≈ 2·√stiffness = critical damping, no overshoot). Returns (progress, velocity, at_rest).

A general-purpose motion helper: used by screen transitions and by gestures (a settle primed by the finger’s velocity).