# Integrate `Turing` from Motion Garden

You are helping me add the **Turing** component to an existing project.
Everything you need is below — full source, dependencies, props and the
behavioural contract. Read it all before writing anything.

- **Component:** Turing
- **Category:** Backgrounds
- **Summary:** Gray-Scott reaction-diffusion on the GPU. Two reagents, four terms, and coral, labyrinths and colonies that settle and stop all fall out of the arithmetic. A background that grows rather than loops, and never reaches the same frame twice.
- **Reference:** https://motion-garden.netlify.app/components/turing
- **Full catalog (for you, the agent):** https://motion-garden.netlify.app/llms.txt

## Stack this source assumes

- React 19 with the Next.js App Router (never the `pages/` directory)
- TypeScript, strict
- Tailwind CSS v4, CSS-first config (utilities are inline; no `tailwind.config` needed)

If my project differs, adapt the integration — but do not rewrite the animation math to suit a different stack. Ask me first.

## Dependencies

```bash
bun add ogl
```

## Files to create

2 files — all of them are required. Paths are as shipped; the component may live anywhere in my project, but keep every peer file at the exact path shown so the import aliases resolve.

### 1. `components/registry/turing/turing.tsx`

```tsx
"use client";

import { memo, useEffect, useRef, useState } from "react";
import { Renderer, Program, Mesh, Triangle, RenderTarget } from "ogl";
import { useAnimationLoop, type Metrics } from "@/hooks/use-animation-loop";

export type TuringSeed = "spots" | "ring" | "stripe" | "noise";
export type TuringGrid = "256" | "384" | "512" | "768";

interface TuringProps {
  feed?: number;
  kill?: number;
  diffusion?: number;
  steps?: number;
  gridSize?: TuringGrid;
  seed?: TuringSeed;
  brush?: number;
  sharpness?: number;
  colorLow?: string;
  colorHigh?: string;
  paused?: boolean;
  reducedMotion?: boolean;
  className?: string;
}

const SEED_ID: Record<string, number> = { spots: 0, ring: 1, stripe: 2, noise: 3 };

const hexToRgb01 = (hex: string): [number, number, number] => {
  const h = hex.replace("#", "");
  const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
  const n = parseInt(full, 16);
  if (Number.isNaN(n) || full.length !== 6) return [1, 1, 1];
  return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];
};

const vertex = `#version 300 es
in vec2 position;
in vec2 uv;
out vec2 vUv;
void main() {
  vUv = uv;
  gl_Position = vec4(position, 0.0, 1.0);
}`;

const HASH = `
float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.56);
  return fract(p.x * p.y);
}`;

const seedFragment = `#version 300 es
precision highp float;
in vec2 vUv;
out vec4 fragColor;
uniform float uSeed;
uniform float uJitter;
${HASH}

void main() {
  vec2 p = vUv - 0.5;
  float b = 0.0;
  if (uSeed < 0.5) {
    vec2 cell = floor(vUv * 6.0);
    vec2 g = fract(vUv * 6.0) - 0.5;
    // Each blob is jittered inside its cell. A perfect lattice grows into
    // wallpaper and stays there: the chemistry is isotropic, so it will never
    // break a symmetry the seed handed it. Asymmetry has to be planted.
    vec2 j = vec2(hash21(cell + 3.1), hash21(cell + 7.7)) - 0.5;
    b = step(length(g - j * 0.55), 0.13) * step(hash21(cell + uJitter), 0.45);
  } else if (uSeed < 1.5) {
    b = 1.0 - smoothstep(0.055, 0.075, abs(length(p) - 0.22));
  } else if (uSeed < 2.5) {
    b = 1.0 - smoothstep(0.016, 0.026, abs(p.y));
  } else {
    b = step(0.87, hash21(floor(vUv * 220.0) + uJitter));
  }
  // Canonical seeding: A drops to a half and B rises to a quarter inside the
  // blob, rather than A=1/B=1. Slamming both to one makes a*b*b spike to unity
  // in a single step, which burns the substrate out from under the colony
  // before it can spread — the blob then stabilises into a ring and sits there
  // forever, at any feed and kill you care to name. It reads exactly like a
  // frozen simulation and it is the seeding, not the chemistry.
  float mask = clamp(b, 0.0, 1.0);
  fragColor = vec4(mix(1.0, 0.5, mask), mask * 0.25, 0.0, 1.0);
}`;

const simFragment = `#version 300 es
precision highp float;
in vec2 vUv;
out vec4 fragColor;
uniform sampler2D uState;
uniform vec2  uTexel;
uniform float uFeed;
uniform float uKill;
uniform float uDa;
uniform float uDb;
uniform vec2  uPointer;
uniform float uBrush;
uniform float uBrushOn;

vec2 st(vec2 o) { return texture(uState, vUv + o * uTexel).rg; }

void main() {
  vec2 c = st(vec2(0.0));

  // Nine-point Laplacian. The five-point one is cheaper and visibly wrong here:
  // it propagates along the axes faster than along the diagonals, so every
  // colony grows square and the lattice of the grid ends up in the pattern.
  vec2 lap =
      (st(vec2(-1.0, 0.0)) + st(vec2(1.0, 0.0)) +
       st(vec2(0.0, -1.0)) + st(vec2(0.0, 1.0))) * 0.2
    + (st(vec2(-1.0, -1.0)) + st(vec2(1.0, -1.0)) +
       st(vec2(-1.0, 1.0)) + st(vec2(1.0, 1.0))) * 0.05
    - c;

  float a = c.x;
  float b = c.y;
  float reacted = a * b * b;

  float na = a + (uDa * lap.x - reacted + uFeed * (1.0 - a));
  float nb = b + (uDb * lap.y + reacted - (uKill + uFeed) * b);

  if (uBrushOn > 0.5) {
    // The grid is square, so a uv distance is a grid distance and the blob is
    // round without an aspect correction.
    float m = 1.0 - smoothstep(0.0, max(uBrush, 1e-4), length(vUv - uPointer));
    nb = mix(nb, 1.0, m * 0.85);
    na = mix(na, 0.0, m * 0.4);
  }

  fragColor = vec4(clamp(na, 0.0, 1.0), clamp(nb, 0.0, 1.0), 0.0, 1.0);
}`;

const displayFragment = `#version 300 es
precision highp float;
in vec2 vUv;
out vec4 fragColor;
uniform sampler2D uState;
uniform vec2  uResolution;
uniform vec2  uTexel;
uniform float uSharpness;
uniform vec3  uLow;
uniform vec3  uHigh;

void main() {
  float ar = uResolution.x / max(uResolution.y, 1.0);
  // Cover, not stretch. The square grid fills the container and the overflow is
  // cropped, so a colony stays circular at any aspect ratio.
  vec2 k = ar > 1.0 ? vec2(1.0, 1.0 / ar) : vec2(ar, 1.0);
  vec2 uv = (vUv - 0.5) * k + 0.5;

  float b = texture(uState, uv).g;
  float v = clamp(b * 2.8, 0.0, 1.0);

  float w = mix(0.32, 0.006, clamp(uSharpness, 0.0, 1.0));
  float m = smoothstep(0.5 - w, 0.5 + w, v);

  // Membrane. The gradient is largest exactly at the cut, so this lifts the
  // boundary the sharpness control just created rather than a second edge of
  // its own.
  float gx = texture(uState, uv + vec2(uTexel.x, 0.0)).g
           - texture(uState, uv - vec2(uTexel.x, 0.0)).g;
  float gy = texture(uState, uv + vec2(0.0, uTexel.y)).g
           - texture(uState, uv - vec2(0.0, uTexel.y)).g;
  float rim = clamp(length(vec2(gx, gy)) * 14.0, 0.0, 1.0);

  vec3 col = mix(uLow, uHigh, m);
  col += uHigh * rim * 0.25;

  fragColor = vec4(col, 1.0);
}`;

const Turing = memo(
  ({
    feed = 0.05,
    kill = 0.062,
    diffusion = 1,
    steps = 16,
    gridSize = "512",
    seed = "spots",
    brush = 26,
    sharpness = 0.5,
    colorLow = "#0a0a12",
    colorHigh = "#a855f7",
    paused = false,
    reducedMotion = false,
    className,
  }: TuringProps) => {
    const containerRef = useRef<HTMLDivElement>(null);
    const drawRef = useRef<((dt: number) => void | false) | null>(null);
    const measureRef = useRef<((m: Metrics) => void) | null>(null);
    const glRef = useRef<WebGLRenderingContext | WebGL2RenderingContext | null>(null);
    const reseedRef = useRef(true);
    const pointer = useRef({ x: 0.5, y: 0.5, on: false });

    const [fallback, setFallback] = useState(false);

    const loop = useAnimationLoop({
      target: containerRef,
      halted: paused || reducedMotion,
      dpr: "auto",
      onResize: (metrics) => measureRef.current?.(metrics),
      onFrame: ({ dt }) => (drawRef.current ? drawRef.current(dt) : false),
      gl: () => glRef.current,
    });

    const live = useRef({
      feed, kill, diffusion, steps, seed, brush, sharpness, colorLow, colorHigh,
    });
    live.current = {
      feed, kill, diffusion, steps, seed, brush, sharpness, colorLow, colorHigh,
    };

    useEffect(() => {
      const container = containerRef.current;
      if (fallback || !container) return;

      const size = Math.max(64, parseInt(gridSize, 10) || 512);

      let renderer: Renderer;
      try {
        renderer = new Renderer({
          webgl: 2,
          alpha: false,
          antialias: false,
          powerPreference: "high-performance",
          dpr: Math.min(window.devicePixelRatio || 1, 2),
        });
        const probe = renderer.gl as unknown as WebGL2RenderingContext;
        if (!probe.getExtension("EXT_color_buffer_float")) {
          throw new Error("Turing requires EXT_color_buffer_float");
        }
      } catch {
        setFallback(true);
        return;
      }

      const glc = renderer.gl;
      const gl2 = glc as unknown as WebGL2RenderingContext;
      glRef.current = gl2;

      const canvas = glc.canvas as HTMLCanvasElement;
      canvas.style.display = "block";
      canvas.style.position = "absolute";
      canvas.style.top = "0";
      canvas.style.left = "0";
      container.appendChild(canvas);

      const smooth = !!gl2.getExtension("OES_texture_float_linear");
      const filter = smooth ? gl2.LINEAR : gl2.NEAREST;
      const makeRT = () =>
        new RenderTarget(glc, {
          width: size,
          height: size,
          depth: false,
          type: gl2.FLOAT,
          format: gl2.RGBA,
          internalFormat: gl2.RGBA32F,
          minFilter: filter,
          magFilter: filter,
          wrapS: gl2.CLAMP_TO_EDGE,
          wrapT: gl2.CLAMP_TO_EDGE,
        });

      let read = makeRT();
      let write = makeRT();
      const texel = new Float32Array([1 / size, 1 / size]);

      const geometry = new Triangle(glc);

      const seedProgram = new Program(glc, {
        vertex,
        fragment: seedFragment,
        uniforms: {
          uSeed: { value: SEED_ID[seed] ?? 0 },
          uJitter: { value: 0 },
        },
      });
      const simProgram = new Program(glc, {
        vertex,
        fragment: simFragment,
        uniforms: {
          uState: { value: read.texture },
          uTexel: { value: texel },
          uFeed: { value: feed },
          uKill: { value: kill },
          uDa: { value: diffusion },
          uDb: { value: 0.5 },
          uPointer: { value: new Float32Array([0.5, 0.5]) },
          uBrush: { value: brush / size },
          uBrushOn: { value: 0 },
        },
      });
      const displayProgram = new Program(glc, {
        vertex,
        fragment: displayFragment,
        uniforms: {
          uState: { value: read.texture },
          uResolution: { value: new Float32Array([1, 1]) },
          uTexel: { value: texel },
          uSharpness: { value: sharpness },
          uLow: { value: new Float32Array(hexToRgb01(colorLow)) },
          uHigh: { value: new Float32Array(hexToRgb01(colorHigh)) },
        },
      });

      const seedMesh = new Mesh(glc, { geometry, program: seedProgram });
      const simMesh = new Mesh(glc, { geometry, program: simProgram });
      const displayMesh = new Mesh(glc, { geometry, program: displayProgram });

      const su = seedProgram.uniforms as Record<string, { value: number }>;
      const mu = simProgram.uniforms as Record<string, { value: number | Float32Array | unknown }>;
      const du = displayProgram.uniforms as Record<string, { value: number | Float32Array | unknown }>;

      let jitter = 0;

      const reseed = () => {
        const l = live.current;
        su.uSeed.value = SEED_ID[l.seed] ?? 0;
        su.uJitter.value = jitter;
        jitter = (jitter + 17.13) % 991;
        renderer.render({ scene: seedMesh, target: read });
        renderer.render({ scene: seedMesh, target: write });
      };

      const drawDisplay = () => {
        const l = live.current;
        du.uState.value = read.texture;
        du.uSharpness.value = l.sharpness;
        (du.uLow.value as Float32Array).set(hexToRgb01(l.colorLow));
        (du.uHigh.value as Float32Array).set(hexToRgb01(l.colorHigh));
        renderer.render({ scene: displayMesh });
      };

      drawRef.current = () => {
        const l = live.current;

        if (reseedRef.current) {
          reseed();
          reseedRef.current = false;
        }

        mu.uFeed.value = l.feed;
        mu.uKill.value = l.kill;
        mu.uDa.value = l.diffusion;
        mu.uBrush.value = Math.max(l.brush, 1) / size;
        mu.uBrushOn.value = pointer.current.on ? 1 : 0;
        const p = mu.uPointer.value as Float32Array;
        p[0] = pointer.current.x;
        p[1] = pointer.current.y;

        const iterations = Math.max(1, Math.round(l.steps));
        for (let i = 0; i < iterations; i++) {
          mu.uState.value = read.texture;
          renderer.render({ scene: simMesh, target: write });
          const t = read;
          read = write;
          write = t;
          mu.uBrushOn.value = 0;
        }

        drawDisplay();
      };

      measureRef.current = ({ width, height, dpr }) => {
        renderer.dpr = dpr;
        renderer.setSize(Math.max(1, Math.floor(width)), Math.max(1, Math.floor(height)));
        const res = du.uResolution.value as Float32Array;
        res[0] = glc.drawingBufferWidth;
        res[1] = glc.drawingBufferHeight;
        drawDisplay();
      };

      loop.resize();
      loop.start();

      return () => {
        drawRef.current = null;
        measureRef.current = null;
        if (container.contains(canvas)) container.removeChild(canvas);
      };
      // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [fallback, gridSize]);

    useEffect(() => {
      reseedRef.current = true;
      loop.paint();
    }, [seed, loop]);

    useEffect(() => {
      loop.paint();
    }, [feed, kill, diffusion, steps, brush, sharpness, colorLow, colorHigh, loop]);

    const track = (e: React.PointerEvent<HTMLDivElement>) => {
      if (reducedMotion) return;
      const r = e.currentTarget.getBoundingClientRect();
      if (r.width === 0 || r.height === 0) return;
      const nx = (e.clientX - r.left) / r.width;
      const ny = 1 - (e.clientY - r.top) / r.height;
      const ar = r.width / r.height;
      const kx = ar > 1 ? 1 : ar;
      const ky = ar > 1 ? 1 / ar : 1;
      pointer.current.x = (nx - 0.5) * kx + 0.5;
      pointer.current.y = (ny - 0.5) * ky + 0.5;
      pointer.current.on = true;
      loop.start();
    };
    const release = () => {
      pointer.current.on = false;
    };

    if (fallback) {
      return (
        <div
          className={className ?? "relative h-full w-full overflow-hidden"}
          style={{
            backgroundColor: colorLow,
            backgroundImage: `radial-gradient(circle at 30% 35%, ${colorHigh}55 0 12%, transparent 13%), radial-gradient(circle at 68% 62%, ${colorHigh}44 0 9%, transparent 10%), radial-gradient(circle at 48% 80%, ${colorHigh}33 0 7%, transparent 8%)`,
          }}
        />
      );
    }

    return (
      <div
        ref={containerRef}
        className={className ?? "relative h-full w-full overflow-hidden"}
        onPointerMove={track}
        onPointerLeave={release}
        onPointerCancel={release}
      />
    );
  },
);

Turing.displayName = "Turing";

export default Turing;
```

### 2. `hooks/use-animation-loop.ts` — peer hook, required

```tsx
"use client";

import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";

export interface Metrics {
  width: number;
  height: number;
  dpr: number;
  bufferWidth: number;
  bufferHeight: number;
}

export interface FrameInfo {
  now: number;
  dt: number;
  elapsed: number;
  frame: number;
}

export interface AnimationLoopHandle {
  start(): void;
  stop(): void;
  paint(): void;
  resize(): void;
  readonly running: boolean;
}

export interface AnimationLoopOptions {
  target: React.RefObject<HTMLElement | null>;
  halted?: boolean;
  dpr?: number | "auto";
  onResize?(metrics: Metrics): void;
  onFrame?(info: FrameInfo): void | false;
  paintWhenHalted?: boolean;
  resizeDebounceMs?: number;
  gl?(): WebGLRenderingContext | WebGL2RenderingContext | null | undefined;
  onDispose?(): void;
  deps?: unknown[];
}

const MAX_DT = 1 / 15;

export function useAnimationLoop(
  options: AnimationLoopOptions,
): AnimationLoopHandle {
  const opts = useRef(options);
  useLayoutEffect(() => {
    opts.current = options;
  });

  const raf = useRef<number | null>(null);
  const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
  const running = useRef(false);
  const disposed = useRef(false);
  const startedAt = useRef(0);
  const last = useRef(0);
  const frame = useRef(0);

  const measure = useCallback((): Metrics | null => {
    const el = opts.current.target.current;
    if (!el) return null;
    const rect = el.getBoundingClientRect();
    const cap = opts.current.dpr ?? "auto";
    const limit = cap === "auto" ? 2 : cap;
    const dpr = Math.min(
      typeof window === "undefined" ? 1 : window.devicePixelRatio || 1,
      limit,
    );
    return {
      width: rect.width,
      height: rect.height,
      dpr,
      bufferWidth: Math.max(1, Math.round(rect.width * dpr)),
      bufferHeight: Math.max(1, Math.round(rect.height * dpr)),
    };
  }, []);

  const tick = useCallback(function tick(now: number) {
    if (disposed.current) return;

    if (startedAt.current === 0) startedAt.current = now;
    const dt = last.current === 0 ? 0 : Math.min((now - last.current) / 1000, MAX_DT);
    last.current = now;

    const info: FrameInfo = {
      now,
      dt,
      elapsed: (now - startedAt.current) / 1000,
      frame: frame.current++,
    };

    const verdict = opts.current.onFrame?.(info);

    if (disposed.current) return;

    if (verdict === false || opts.current.halted) {
      running.current = false;
      raf.current = null;
      return;
    }
    raf.current = requestAnimationFrame(tick);
  }, []);

  const start = useCallback(() => {
    if (disposed.current || running.current) return;
    running.current = true;
    last.current = 0;
    raf.current = requestAnimationFrame(tick);
  }, [tick]);

  const stop = useCallback(() => {
    running.current = false;
    if (raf.current !== null) {
      cancelAnimationFrame(raf.current);
      raf.current = null;
    }
  }, []);

  const paint = useCallback(() => start(), [start]);

  const resize = useCallback(() => {
    const metrics = measure();
    if (!metrics) return;
    opts.current.onResize?.(metrics);
    if (opts.current.paintWhenHalted !== false) paint();
    else if (!opts.current.halted) start();
  }, [measure, paint, start]);

  const deps = options.deps ?? [];

  useEffect(() => {
    disposed.current = false;
    const el = opts.current.target.current;
    if (!el) return;

    const run = () => {
      if (disposed.current) return;
      resize();
    };

    const observer = new ResizeObserver(() => {
      const wait = opts.current.resizeDebounceMs ?? 0;
      if (wait <= 0) {
        run();
        return;
      }
      if (timer.current !== null) clearTimeout(timer.current);
      timer.current = setTimeout(() => {
        timer.current = null;
        run();
      }, wait);
    });
    observer.observe(el);

    resize();
    if (!opts.current.halted) start();

    return () => {
      disposed.current = true;
      running.current = false;
      if (raf.current !== null) {
        cancelAnimationFrame(raf.current);
        raf.current = null;
      }
      if (timer.current !== null) {
        clearTimeout(timer.current);
        timer.current = null;
      }
      observer.disconnect();
      opts.current.onDispose?.();
      const context = opts.current.gl?.();
      context?.getExtension("WEBGL_lose_context")?.loseContext();
      startedAt.current = 0;
      last.current = 0;
      frame.current = 0;
    };
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, deps);

  const halted = options.halted ?? false;
  useEffect(() => {
    if (!halted) start();
  }, [halted, start]);

  return useMemo<AnimationLoopHandle>(
    () => ({
      start,
      stop,
      paint,
      resize,
      get running() {
        return running.current;
      },
    }),
    [start, stop, paint, resize],
  );
}
```


## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `feed` | `number` | `0.05` | Rate at which fresh reagent arrives everywhere. Feed and kill together pick the creature, and these coordinates were measured rather than inherited: 0.050/0.062 keeps colonising and is the default, 0.030/0.062 settles into stable spots and then genuinely stops, 0.039/0.058 floods to a dense labyrinth, and 0.022/0.051 oscillates without ever settling. Push feed past about 0.055 at this kill and the colonies die outright — the living band is a few thousandths wide, which is why the step is this fine. Range 0.01–0.09. |
| `kill` | `number` | `0.062` | Rate at which the reacted product is removed. Pull it down and the pattern floods until it fills the plate; push it up and it starves back to nothing. The edge of the living band is a cliff rather than a slope, so this control does nothing and then does everything. Range 0.045–0.07. |
| `diffusion` | `number` | `1` | How fast the substrate spreads relative to the activator, which is held at half. One is the canonical two-to-one. Turing's result is that a perfectly uniform system develops structure the moment one reagent outruns the other; this is that ratio, and below about 0.6 there is nothing to see because nothing outruns anything. Range 0.4–1.4. |
| `steps` | `number` | `16` | Solver iterations per displayed frame, and the only reason this is watchable. The pattern needs a couple of thousand steps before it is worth looking at; at one step per frame that is most of a minute of staring at dots. Sixteen gets there in seconds and looks identical on arrival, because this is a time-scale control rather than a quality one. It is also the honest performance dial — every step is a full pass over the grid. Range 1–32. |
| `gridSize` | `"256" | "384" | "512" | "768"` | `"512"` | Resolution of the simulation grid, deliberately held apart from the canvas — a window drag resizes only the display pass, so dragging the browser never wipes a pattern that took thirty seconds to grow. Bigger is finer filigree over the same area, not more area. |
| `seed` | `"spots" | "ring" | "stripe" | "noise"` | `"spots"` | How the plate is inoculated. Each one ends up somewhere different at identical feed and kill, which is the honest demonstration that this system has no single attractor — the initial condition is a real parameter, not a formality. |
| `brush` | `number` | `26` | Radius the pointer inoculates. Measured against the grid rather than the canvas, so the blob covers the same share of the pattern on a narrow strip as on a full page. The dose is one impulse per frame regardless of how many solver steps run, so this control and the step count stay independent. Range 4–80 px. |
| `sharpness` | `number` | `0.5` | Where the palette ramp cuts the continuous field. The chemistry is smooth everywhere; coral does not look like coral until you cut it, and this is the cut. At zero you are looking at the raw concentration, which is the most informative view and the least striking one. Range 0–1. |
| `colorLow` | `string (hex)` | `"#0a0a12"` | The plate, where nothing has taken hold. |
| `colorHigh` | `string (hex)` | `"#a855f7"` | The colony. The membrane picks it up too, at a third strength, so the boundary reads as the same organism rather than as an outline drawn around it. |

## Usage

```tsx
import Turing from "@/components/registry/turing/turing";

<Turing
  feed={0.05}
  kill={0.062}
  diffusion={1}
  steps={16}
  gridSize="512"
  seed="spots"
  brush={26}
  sharpness={0.5}
  colorLow="#0a0a12"
  colorHigh="#a855f7"
/>
```

The import path matches the file path above; change it if you move the component. Every value shown is the documented default — pass only what you actually want to change. The snippet lists the tunable props only: if the component's props type in the source requires others (content, handlers, data), pass those too.

## Integration rules

- Keep the `"use client"` directive. This is a client component and will not render as a Server Component.
- It fills its parent. Give the wrapper an explicit height (or a definite grid area) — against a height-auto parent it collapses to nothing.
- It takes a `reducedMotion` prop and quiesces when true. Wire it to a `prefers-reduced-motion` listener rather than hardcoding `false`.
- It runs a free-running animation loop. Halt it when off-screen or backgrounded if you care about battery.
- The peer hook is required, not optional. Copy it to `hooks/use-animation-loop.ts` so the component's `@/hooks/use-animation-loop` import resolves.
- It owns a GPU/canvas context and releases it on unmount. Preserve the cleanup return — leaking contexts kills the tab after a few navigations.

## Your task

1. Tell me where in my project this should live and why.
2. Create the files above verbatim.
3. Wire the component into the place I point you at, with sensible props for that context.
4. Flag anything in my setup that conflicts with the stack assumptions above.

Do not restyle the component or alter the animation math unless I ask.
