Skip to content

Spring field

A grid of dots, each a spring, pushed or pulled by the pointer through a smooth falloff. Stiffness and damping ratio are sliders; a pure function turns the ratio into a damping coefficient and names the regime (underdamped, critically damped, overdamped). On release the demo measures how far the most displaced dot swings past rest and how long the whole field takes to settle, and shows the closed-form overshoot prediction beside it. Arrow keys move a probe when the field is focused. With reduced motion the dots go straight to their target. The simulation is a fixed-step integrator, and the prediction assumes a spring released from rest, which a moving pointer does not quite do.

  • Spring Physics
  • Canvas 2D
  • requestAnimationFrame
  • prefers-reduced-motion

spring-field

starting

Damping coefficient c = 10.4 for k = 220, m = 1. Every dot is its own spring.

Usage

Drop it in

import
import { SpringFieldPanel } from "@/app/lib/components/spring-field";

Accessibility

Works with

Cursor
Reacts to where the pointer is, not just whether it's over the element.
Touch
Follows your finger while it's down, then settles a moment after you lift.
Keyboard
Focus lights it up the way the cursor does. Every action has a key.
Reduced motion
Nothing moves or springs. Colour still answers, without drifting.