vaweGitHub

Springsreact-spring

react-spring gentle

Its stiffness is lower than default (120 against 170) and its damping is about half (14 against 26). Stiffness 120, damping 14 and mass 1 give a damping ratio of 0.639, so the spring is underdamped. It settles to within 0.1% in 0.945 s. It passes the end value by up to 7.4% at 0.373 s and crosses it 2 times.

Demo

Progress against time. The time axis runs 0 to 0.945 s, the settle time.0100.51progress50%90%
Dashed: a straight line. The dot and the line move with the box on the right.
react-spring gentle
linear

Both boxes take 0.945 s. This is real time.

Your system asks for reduced motion, so nothing plays. The chart shows the whole move.

Code

A spring has no fixed duration, so the CSS takes the settle time (945 ms) and a linear() string that follows the spring.

css linear()
transition: translate 945ms linear(0, 0.0079, 0.0299, 0.0635, 0.1064, 0.1566, 0.2121, 0.2712, 0.3326, 0.395, 0.4571, 0.5181, 0.5773, 0.634, 0.6876, 0.7379, 0.7846, 0.8275, 0.8665, 0.9016, 0.9329, 0.9604, 0.9844, 1.0049, 1.0222, 1.0366, 1.0482, 1.0573, 1.0641, 1.0689, 1.0719, 1.0733, 1.0734, 1.0724, 1.0704, 1.0676, 1.0642, 1.0603, 1.0561, 1.0516, 1.0471, 1.0425, 1.038, 1.0335, 1.0292, 1.0252, 1.0213, 1.0177, 1.0144, 1.0114, 1.0087, 1.0062, 1.004, 1.0021, 1.0005, 0.9991, 0.9979, 0.9969, 0.9961, 0.9955, 0.9951, 0.9948, 0.9947, 0.9946, 0.9946, 0.9947, 0.9949, 0.9951, 0.9954, 0.9957, 0.996, 0.9963, 0.9967, 0.997, 0.9974, 0.9977, 0.998, 0.9983, 0.9985, 0.9988, 1);
web animations api
el.animate({ translate: ['0 0', '240px 0'] }, { duration: 945, easing: 'linear(0, 0.0079, 0.0299, 0.0635, 0.1064, 0.1566, 0.2121, 0.2712, 0.3326, 0.395, 0.4571, 0.5181, 0.5773, 0.634, 0.6876, 0.7379, 0.7846, 0.8275, 0.8665, 0.9016, 0.9329, 0.9604, 0.9844, 1.0049, 1.0222, 1.0366, 1.0482, 1.0573, 1.0641, 1.0689, 1.0719, 1.0733, 1.0734, 1.0724, 1.0704, 1.0676, 1.0642, 1.0603, 1.0561, 1.0516, 1.0471, 1.0425, 1.038, 1.0335, 1.0292, 1.0252, 1.0213, 1.0177, 1.0144, 1.0114, 1.0087, 1.0062, 1.004, 1.0021, 1.0005, 0.9991, 0.9979, 0.9969, 0.9961, 0.9955, 0.9951, 0.9948, 0.9947, 0.9946, 0.9946, 0.9947, 0.9949, 0.9951, 0.9954, 0.9957, 0.996, 0.9963, 0.9967, 0.997, 0.9974, 0.9977, 0.998, 0.9983, 0.9985, 0.9988, 1)', fill: 'both' });
vawe
import { spring, springDuration, springLinear } from '../../core/motion/springs.js';

const k = 120, d = 14;

// per-frame code (window.seek, vawe.onFrame): t is seconds since the move starts
const x = 240 * spring(t, k, d);

// CSS and Web Animations: 945 ms, the linear() string above
el.animate(
  { translate: ['0 0', '240px 0'] },
  { duration: springDuration(k, d) * 1000, easing: springLinear(k, d), fill: 'both' },
);

Numbers

Stiffness
120k, with mass 1
Damping
14d, with mass 1
Damping ratio
0.639underdamped
Settle time
0.945 swithin 0.1% of the end
Overshoot
7.4%peak at 0.373 s
Crosses the end
2times
50% of travel
0.127 s13% of the settle time
90% of travel
0.224 s24% of the settle time
Natural frequency
10.95 rad/ssqrt(k)
Ring period
0.746 sone swing of the overshoot
Peak speed
4.99xtimes the average speed
linear() points
81within 0.19% of travel

Computed with spring() and springDuration() from core/motion/springs.js. The settle time is the last moment the spring is more than 0.1% away from the end value; a library stops its own spring by its own rest thresholds, so its clock can run shorter.

Source of the numbers

react-spring@react-spring/core 10.1.2
config.gentle = { tension: 120, friction: 14 }packages/core/src/constants.ts, const config

Conversion: Stiffness is tension and damping is friction, with mass 1 (the default). The physics loop in the same package, acceleration = (-tension x displacement - friction x velocity) / mass, is the spring that spring() in springs.js solves.

The four closest curves in this set, by the average gap between the two springs over their first seconds. A gap of 0.01 is invisible; 0.1 is a different feel.

More springs