Free tool
Spring generator.
- Settles in
- 1.15s
- Overshoot
- 19%
- Damping ratio
- 0.46
Under-damped: it overshoots and wobbles before settling.
Motion spring
CSS linear()
<motion.div
animate={{ x: 240 }}
transition={{ type: "spring", stiffness: 170, damping: 12, mass: 1 }}
/>useSpring({
to: { x: 240 },
config: { tension: 170, friction: 12, mass: 1 },
});/* the same spring in plain CSS: no JavaScript */
.box {
transition: transform 1.15s linear(0, 0.051, 0.176, 0.344, 0.528, 0.707, 0.867, 0.997, 1.093, 1.155, 1.187, 1.194, 1.181, 1.154, 1.121, 1.085, 1.051, 1.021, 0.997, 0.979, 0.968, 0.963, 0.963, 0.966, 0.971, 0.978, 0.985, 0.991, 0.997, 1.001, 1.005, 1.006, 1.007, 1.007, 1.006, 1.005, 1.004, 1.003, 1.001, 1, 1, 0.999, 0.999, 0.999, 0.999, 0.999, 1);
}What the three numbers do
Stiffness is how hard the spring pulls towards its target: higher is snappier. Damping is friction: lower lets it overshoot and wobble, higher makes it settle without bouncing. Mass makes everything heavier and slower. react-spring calls stiffness "tension" and damping "friction"; the numbers are the same.
Springs in plain CSS
CSS's linear() easing draws a curve through many points, so it can trace a spring exactly, overshoot and all. Use it with the duration shown, and the transition will match the spring above. It works in every current browser; older ones fall back to a plain linear transition.
Questions
What's a good default spring?
For UI, stiffness around 170 to 300 with damping between 20 and 30 feels quick and settles without a visible wobble. For something playful, drop the damping to 10 to 14.
What does the damping ratio mean?
It compares the damping to what would stop the spring exactly without overshoot. Below 1 it overshoots and wobbles, at 1 it's critically damped (the quickest settle with no bounce), and above 1 it creeps in slowly.
Does CSS linear() work in all browsers?
It's supported in current Chrome, Edge, Firefox and Safari. Browsers that don't understand it ignore the easing and use the default, so the animation still runs, just without the spring.
Can I use this spring with Framer Motion?
Yes. Motion (formerly Framer Motion) takes the same stiffness, damping and mass: transition={{ type: "spring", stiffness, damping, mass }}.