Spring

Apply spring physics to a target number, vector, or colour, producing smooth following and elastic motion.

What it does

Spring runs a mass-spring-damper simulation that chases the value fed into Target instead of jumping to it. It works on a Number, Vec2, Vec3 or Colour, and the Value and Velocity outputs always match the type of Target. State carries across frames: each frame the current position is nudged toward the target according to Stiffness, Damping and Mass, so the motion overshoots, settles or oscillates depending on those three. The Settled output reports when the spring has come to rest.

When to use it

ParameterTypeDefault
targetOneOf([Number, Vec2, Vec3, Color])
stiffnessNumber150
dampingNumber12
massNumber1
precisionNumber0.010
enabledBooleantrue

Gotchas

Spring is stateful, holding position and velocity between frames. If the Target value or the node's identity changes drastically, by being disconnected and rewired for example, the chase resumes from where it last was rather than jumping.

Precision sets the velocity threshold for the Settled output, not visual accuracy. A low Precision means the spring must nearly stop moving before Settled goes true, so bouncy setups with low Damping can take a while to settle.

Turning Enabled off does not pause the spring. Target passes straight through unchanged, so Value jumps immediately to match Target rather than holding its last simulated position.

Worked example

  1. Add a Spring node and wire a moving value (a position, a colour, or a Number from an expression) into Target.

  2. Raise Stiffness for a snappier chase, or lower it for a lazier follow.

  3. Raise Damping to settle out oscillation, or lower it to let the motion bounce and overshoot.

  4. Use the Value output wherever the raw target would have gone: a transform, a colour, a parameter.

  5. Wire Settled into a trigger or condition to know when the motion has come to rest.

See also

Inertia · Constrain · Transform · Numbers, signals & audio