spring
Simulates a damped spring going from 0 to 1, the curve behind “spring” transitions of
design tools, and computes how long it takes to settle.
The motion is solved exactly (under-, critically or over-damped), not by stepping a
simulation, so at can be called at any time, in any order.
Available since v3.1.5
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | SpringOptions | Mass, stiffness, damping, initial velocity — see SpringOptions |
Returns
Section titled “Returns”Spring — A Spring
Examples
Section titled “Examples”A bouncy transition
Section titled “A bouncy transition”The duration comes from the physics: play it for durationMs.
Drive a frame loop
Section titled “Drive a frame loop”at() takes the elapsed time in milliseconds.
Related Types
Section titled “Related Types”Spring
Section titled “Spring”A spring animation from 0 to 1, created by spring.
SpringOptions
Section titled “SpringOptions”Physical parameters of a spring, as design tools (Figma, Framer, …) expose them.
