compatSpring

Equivalent of Transition.SPRING_WITH_OVERSHOOT, the default Transition animator. Keeps the existing motion of code moving off Transition; prefer spring for new code.

See also


fun <T> compatSpring(tension: Double, friction: Double): FiniteAnimationSpec<T>

Equivalent of Transition.springWithConfig(tension, friction). Keeps the existing motion of code moving off Transition; prefer spring for new code.

Both engines solve the same unit-mass oscillator, x'' = -tension * x - friction * x', so the mapping to stiffness and damping ratio is exact. The motion is equivalent within tolerance rather than bit-identical: this runs the closed-form solver instead of the fixed-step integrator behind Transition, and settles on slightly different thresholds.

Under a dropped frame the two differ. Transition advances its spring by at most 64ms per frame, so after a long frame it falls behind real time; this spec evaluates the full elapsed time. A stateless spec cannot reproduce that cap, since it depends on how frames were spaced.

friction must be positive: with no damping the spring never settles, which a finite spec cannot express.