ALL DEMOS

Spring
drag ×4

A bouncing ball can be seeked, so all four can share one clock. A drag cannot. Instead every pane gets the same gesture, and only the way it springs home is its own. Two of these take stiffness and damping straight off you. The other two make you solve the physics yourself and hand over the finished curve.

010 kB · NATIVECSSSpring solved up front, baked into a linear() curve
0230 kB gz · 3.13GSAPCustomEase running a solved spring curve
0320 kB gz · v11MotionReal solver, stiffness and damping passed straight through
0413 kB gz · v4Anime.jscreateSpring() used as the easing function

Drag anywhere on the fields. All four follow together.

0, 0 PX

spring.css
/* No spring in CSS, so the curve is solved in JS
   and pasted in as sampled points. */
.ball {
  transition: translate 620ms
    linear(0, 0.0512, 0.1905, 0.3789, 0.5722,
           0.7371, 0.8567, 0.9312, 0.9706, 1);
}

/* Released: just go home, the curve does the rest. */
.ball.released {
  translate: 0px 0px;
}

Ratings

Onboarding
Ergonomics
Iteration
Debugging

What I like

linear() finally makes real spring curves possible in plain CSS, and once the curve exists the compositor runs it without touching the main thread.

What I don't

There is no spring primitive, so you solve the physics yourself and paste in a list of sampled points. Every change to stiffness or damping means regenerating the whole curve.

How it's built

Spring solved up front, baked into a linear() curve

Loading engines…