Interaction Lab

Features

  • Three draggable numbers in code define the spring
  • Spring, damper and mass diagram; drag the mass and let go to ring it
  • Unit step response from 0 to 1.6s with a settle marker
  • Tap to replay the step; the mass follows the curve
  • Damping ratio ζ, settle time and overshoot in the footer

API reference

<Spring /> from components/aiforui/spring.tsx

PropTypeDefaultDescription
stiffnessnumber180Spring constant k, 20–1000.
dampingnumber8Damping c, 0–60.
massnumber1Mass m, 0.1–4.

Keyboard interactions

TabFocuses the exhibit. Blue corner brackets show it has focus.
← → ↑ ↓Moves the blue probe 12px. It stands in for the pointer.
Shift + arrowsMoves the probe 48px.
Space (hold)With the probe on a number, hold Space and press ← → to change it. On the mass, hold Space and press ↑ ↓ to pull it, then let go.
EnterReplays the step response.
EscapeLets go and hides the probe.

Accessibility

  • The tile is a focusable role="group" with aria-roledescription "interactive demo" and a label that says what it shows and how to drive it.
  • The canvas and the SVG overlay are aria-hidden. A polite live region reads the live stats about 0.7s after keyboard input settles.
  • With prefers-reduced-motion, frames only run while the pointer is inside or for about 3 seconds after input, so the step plays only after you interact.
  • The animation loop pauses while the tile is offscreen or the tab is hidden.
  • Focus is shown with corner brackets on :focus-visible only, so mouse clicks do not leave a ring.

Sound & haptics

Silent. It plays no sound and triggers no haptics.

Files

Written from scratch for sher.md and inspired by the Interaction Lab on aiforui.dev. It is an original build: it contains none of aiforui.dev's code, styles, assets or sounds, and its text is our own.