final case class Spring(frequency: Double = ..., damping: Double = ..., deltaTime: Double = ...)
A damped-spring integrator (à la Charm's Harmonica) for physical, non-linear motion — scrolling, progress fills, layout transitions.
Unlike an Easing, a spring has no fixed duration: call step each tick with the current State and it eases toward target, overshooting or settling per frequency (stiffness) and damping (< 1 bouncy, 1 critically damped, > 1 sluggish). Integrated semi-implicitly, stable for the usual TUI tick rates.
deltaTime must be positive: a spring with a non-positive step can never advance, so the documented while !settled(...) do step(...) loop would hang. A defect in the caller, hence a construction-time throw.
The next State as the value eases one deltaTime step toward target — the integration loop is while !settled(...) do state = step(state, ...), with the position and velocity travelling together rather than as two bare doubles a caller has to keep in step by hand.
The next State as the value eases one deltaTime step toward target — the integration loop is while !settled(...) do state = step(state, ...), with the position and velocity travelling together rather than as two bare doubles a caller has to keep in step by hand.