A bouncing ball can be seeked, so all four can share one clock. A drag can't. So they share the gesture instead, and only the trip home is each library's own. Motion and Anime just take stiffness and damping. GSAP will do a real spring if I solve it first, and CSS can't do one at all, so it fakes a bounce. Drag the damping slider and see which ones answer.
Drag anywhere on the fields.Drag any ball. All four follow together.
0, 0 PX
/* CSS doesn't do springs. This is what I used instead: one line, one bounce past the target. I nudge the duration to match the real spring, but the curve stays put. Obviously CSS doesn't have a place for damping, so it doesn't apply here. */ .ball { transition: translate 767ms cubic-bezier(0.34, 1.56, 0.64, 1); } /* Released: just go home, the curve does the rest. */ .ball.released { translate: 0px 0px; }
It's one line from an easing cheat sheet, with no maths and no build step. It looks springy enough, and it only animates translate, so the browser can run it on its own thread and keep it smooth while JavaScript is busy.
It isn't really a spring. It bounces once, in a shape I picked by eye, and there's nowhere to put stiffness or damping, so the damping slider moves the other three and leaves this one alone. Real physics means solving it in JS and pasting in a hundred numbers, and nobody writes those by hand.
One overshoot ease, duration matched by eye
Loading engines…