Interaction Lab

Features

  • Gray-Scott reaction–diffusion that only grows inside a mask
  • Three masks: an app-icon squircle, the letters Aa and a toggle switch
  • Click or press Enter to regrow the pattern in the next shape
  • Moving the pointer seeds chemical inside the mask; a blue disc marks it and pulses on each new shape
  • Footer shows the current shape and how much of it is covered

API reference

<GrownToShape /> from components/aiforui/grown-to-shape.tsx

PropTypeDefaultDescription
shape"squircle" | "letters" | "toggle""squircle"Shape the pattern starts in. Click or Enter cycles through all three.
feednumber0.037Feed rate F.
killnumber0.06Kill rate k.
speednumber8Simulation steps per frame after the fast start.

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)Press and release without moving counts as a tap and regrows the next shape.
EnterRegrows the pattern in the next shape.
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 pattern grows only while you interact; it finishes growing synchronously on mount so it is never blank.
  • 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.