Pin Field
A quiet dot grid that is really a bed of pins. At rest it is the classic fine dot grid on black, the background a product page wants. But every dot is a pin: where your hand passes, the pins rise toward you, growing and catching a cool light, and like real pin art they are held by friction, so your path stays raised as a soft relief and sinks back slowly, never bouncing. A click sends a ring of rising pins out across the bed, scrolling moves the grid with gentle parallax and rolls a wave across it, a very slow swell drifts through it at rest, and on load the dots appear from the centre outward.
Tweak
LIVELIVEGrid
Pins
Interactive
Raise the pins with the cursor, click for a ring
Usage
Follows your tweaks.
import { PinField } from "@/components/inreact/pin-field";
export function Hero() {
return (
<PinField
className="h-screen w-full"
>
{/* optional: your hero content, drawn above the grid */}
</PinField>
);
}Install with the CLI
npx shadcn@latest add https://inreact.vercel.app/r/pin-field.jsonOr copy the source
Install the dependencies, then save this as components/inreact/pin-field.tsx.
npm install gsap"use client";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { useEffect, useRef, type ReactNode } from "react";
gsap.registerPlugin(ScrollTrigger);
/**
* Pin Field: a quiet dot grid that is really a bed of pins.
*
* At rest it is the classic fine dot grid on black, the background a product
* page wants. But every dot is a pin: where your hand passes, the pins rise
* toward you, growing and catching light, and like real pin art they are held
* by friction, so your path stays raised as a soft relief and sinks back
* slowly, never bouncing.
*
* It reacts: the cursor raises the pins under it, a click sends a ring of
* rising pins out across the bed, scrolling moves the grid with gentle
* parallax and rolls a wave across it, a very slow swell drifts through it at
* rest, and on load the dots appear from the centre outward.
*
* <PinField className="h-screen w-full">
* <YourHero />
* </PinField>
*
* WebGL2: one shader draws every dot (anti-aliased, one per cell) from a small
* height field of pins simulated in JS, plus a gentle bloom on raised pins.
* Pauses off-screen; reduced motion shows a still frame; a CSS dot pattern
* without WebGL2.
*/
export interface PinFieldProps {
/** Colour of the dots at rest. */
dot?: string;
/** Colour raised pins catch. */
accent?: string;
/** Background colour. */
background?: string;
/** Distance between dots, css px. */
spacing?: number;
/** Dot size at rest, css px. */
size?: number;
/** How far the pins rise under the cursor. */
lift?: number;
/** How quickly raised pins sink back (higher = faster). */
settle?: number;
/** Strength of the bloom on raised pins. */
glow?: number;
/** Raise pins with the cursor, click ring, scroll parallax and wave. */
interactive?: boolean;
/** Scroll container if the page does not scroll the window. */
scroller?: Element | null;
/** Foreground content, drawn above the grid. */
children?: ReactNode;
className?: string;
}
const MAXW = 4;
const QUAD = `#version 300 es
in vec2 aQ; out vec2 vUv;
void main(){ vUv = aQ * 0.5 + 0.5; gl_Position = vec4(aQ, 0.0, 1.0); }`;
const SCENE = `#version 300 es
precision highp float;
uniform sampler2D uPins; // pin heights, one texel per pin (repeats)
uniform vec2 uRes, uPinsSize, uOff; // css px; uOff = grid offset (scroll parallax)
uniform float uDpr, uSp, uSize, uTime, uIntro, uSv;
uniform vec3 uDot, uAccent, uBg;
uniform vec4 uWave[${MAXW}];
in vec2 vUv;
out vec4 o;
void main() {
vec2 p = vec2(gl_FragCoord.x, uRes.y * uDpr - gl_FragCoord.y) / uDpr;
float minD = min(uRes.x, uRes.y);
vec2 c = uRes * 0.5;
vec2 g = (p - c - uOff) / uSp;
vec2 cell = floor(g + 0.5); // nearest pin
vec2 pinPos = cell * uSp + c + uOff; // its screen position at rest
// the pin's height: the hand-raised field, plus waves passing through the bed
vec2 tc = (mod(cell, uPinsSize) + 0.5) / uPinsSize;
float hgt = texture(uPins, tc).r;
// a very slow swell drifts through the bed at rest
vec2 sq = pinPos / minD;
hgt += 0.08 * (0.5 + 0.5 * sin(sq.x * 2.2 + sq.y * 1.3 - uTime * 0.35));
// scrolling rolls a wave across the rows
hgt += abs(uSv) * 0.5 * (0.5 + 0.5 * sin(sq.y * 9.0 - uTime * 5.0 * sign(uSv + 1e-4)));
// click: a ring of rising pins runs out across the bed
for (int i = 0; i < ${MAXW}; i++) {
vec4 W = uWave[i];
if (W.w <= 0.0) continue;
float age = uTime - W.z;
if (age < 0.0 || age > 2.6) continue;
float rr = length(pinPos - W.xy) / minD;
float fr = rr - age * 0.55;
hgt += exp(-fr * fr / 0.0025) * exp(-age * 1.2) * W.w * 0.9;
}
hgt = clamp(hgt, 0.0, 1.4);
// on load the dots appear from the centre outward
float rc = length(pinPos - c) / length(c);
float appear = smoothstep(uIntro * 1.3, uIntro * 1.3 - 0.25, rc);
// a raised pin comes toward you: it spreads out from the centre of view a touch, grows, and catches light
vec2 head = pinPos + (pinPos - c) * hgt * 0.012;
// sit each resting dot exactly on a device pixel so it stays a crisp point, never a smeared slit
vec2 snapped = (floor(head * uDpr) + 0.5) / uDpr;
head = mix(snapped, head, smoothstep(0.05, 0.3, hgt));
float r = uSize * (0.75 + 0.9 * hgt);
float d = length(p - head);
float aa = 0.7 / uDpr;
float core = smoothstep(r + aa, r - aa, d);
float halo = exp(-d * d / (r * r * 2.2)) * 0.35; // the soft edge of a tiny dot of light
float dotK = max(core, halo);
vec3 tint = mix(uDot, mix(uDot * 1.6, uAccent, 0.55), smoothstep(0.1, 0.9, hgt));
float bright = 0.75 + 1.6 * hgt;
vec3 col = uBg + tint * dotK * bright * appear;
o = vec4(col, 1.0);
}`;
const BLUR = `#version 300 es
precision mediump float;
uniform sampler2D uTex; uniform vec2 uStep; in vec2 vUv; out vec4 o;
void main() {
vec4 c = texture(uTex, vUv) * 0.2270;
c += (texture(uTex, vUv + uStep * 1.3846) + texture(uTex, vUv - uStep * 1.3846)) * 0.3162;
c += (texture(uTex, vUv + uStep * 3.2308) + texture(uTex, vUv - uStep * 3.2308)) * 0.0703;
o = c;
}`;
const BRIGHT = `#version 300 es
precision mediump float;
uniform sampler2D uTex; in vec2 vUv; out vec4 o;
void main() {
vec3 c = texture(uTex, vUv).rgb;
float l = max(c.r, max(c.g, c.b));
o = vec4(c * smoothstep(0.45, 0.95, l), 1.0);
}`;
const COMPOSITE = `#version 300 es
precision highp float;
uniform sampler2D uScene, uBloom, uWide;
uniform float uGlow;
in vec2 vUv; out vec4 o;
float h(vec2 p) { vec3 p3 = fract(vec3(p.xyx) * 0.1031); p3 += dot(p3, p3.yzx + 33.33); return fract((p3.x + p3.y) * p3.z); }
void main() {
vec3 sc = texture(uScene, vUv).rgb;
vec3 bl = texture(uBloom, vUv).rgb * 0.85 + texture(uWide, vUv).rgb * 0.15;
vec3 x = sc + bl * uGlow;
vec3 col = x / (1.0 + max(x - 0.85, 0.0) * 0.9);
col += (h(gl_FragCoord.xy) - 0.5) / 255.0;
o = vec4(clamp(col, 0.0, 1.0), 1.0);
}`;
const isReducedMotion = () =>
typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
function rgb(hex: string): [number, number, number] {
let h = hex.replace("#", "");
if (h.length === 3) h = h.replace(/./g, (c) => c + c);
const n = parseInt(h, 16) || 0;
return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];
}
export function PinField({
dot = "#555555",
accent = "#8fb0ff",
background = "#090909",
spacing = 13,
size = 0.9,
lift = 1,
settle = 1,
glow = 0.5,
interactive = true,
scroller,
children,
className,
}: PinFieldProps) {
const hostRef = useRef<HTMLDivElement>(null);
const props = useRef({ dot, accent, background, spacing, size, lift, settle, glow, interactive });
const redraw = useRef<(() => void) | null>(null);
useEffect(() => {
props.current = { dot, accent, background, spacing, size, lift, settle, glow, interactive };
redraw.current?.();
}, [dot, accent, background, spacing, size, lift, settle, glow, interactive]);
useEffect(() => {
const host = hostRef.current;
if (!host) return;
if (getComputedStyle(host).position === "static") host.style.position = "relative";
const still = isReducedMotion();
const canvas = document.createElement("canvas");
canvas.setAttribute("aria-hidden", "true");
canvas.style.cssText = "position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:pan-y;";
host.prepend(canvas);
const gl = canvas.getContext("webgl2", { alpha: false, antialias: false, powerPreference: "high-performance" });
if (!gl) {
const p = props.current;
host.style.backgroundImage = `radial-gradient(${p.dot} ${p.size}px, transparent ${p.size + 0.6}px)`;
host.style.backgroundSize = `${p.spacing}px ${p.spacing}px`;
host.style.backgroundPosition = "center";
canvas.remove();
return;
}
const build = (fs: string) => {
const pr = gl.createProgram()!;
for (const [type, src] of [
[gl.VERTEX_SHADER, QUAD],
[gl.FRAGMENT_SHADER, fs],
] as const) {
const sh = gl.createShader(type)!;
gl.shaderSource(sh, src);
gl.compileShader(sh);
if (!gl.getShaderParameter(sh, gl.COMPILE_STATUS)) console.error(gl.getShaderInfoLog(sh));
gl.attachShader(pr, sh);
}
gl.bindAttribLocation(pr, 0, "aQ");
gl.linkProgram(pr);
if (!gl.getProgramParameter(pr, gl.LINK_STATUS)) console.error(gl.getProgramInfoLog(pr));
return pr;
};
const sceneProg = build(SCENE);
const blurProg = build(BLUR);
const brightProg = build(BRIGHT);
const compProg = build(COMPOSITE);
const uni = (pr: WebGLProgram, names: string[]) =>
Object.fromEntries(names.map((n) => [n, gl.getUniformLocation(pr, n)])) as Record<string, WebGLUniformLocation | null>;
const US = uni(sceneProg, [
"uPins", "uRes", "uPinsSize", "uOff", "uDpr", "uSp", "uSize", "uTime", "uIntro", "uSv", "uDot", "uAccent", "uBg", "uWave",
]);
const UB = uni(blurProg, ["uTex", "uStep"]);
const UR = uni(brightProg, ["uTex"]);
const UC = uni(compProg, ["uScene", "uBloom", "uWide", "uGlow"]);
const vao = gl.createVertexArray();
gl.bindVertexArray(vao);
const vbo = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
const drawQuad = () => gl.drawArrays(gl.TRIANGLES, 0, 3);
type Target = { fb: WebGLFramebuffer; tex: WebGLTexture; w: number; h: number };
const target = (tw: number, th: number): Target => {
const tex = gl.createTexture()!;
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, tw, th, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
const fb = gl.createFramebuffer()!;
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
return { fb, tex, w: tw, h: th };
};
let T: { scene: Target; a: Target; b: Target; c: Target; d: Target } | null = null;
const freeTargets = () => {
if (!T) return;
for (const t of Object.values(T)) {
gl.deleteFramebuffer(t.fb);
gl.deleteTexture(t.tex);
}
T = null;
};
// ---- the pins: one height per pin, held by friction; the grid repeats the field as it scrolls ----
const pinTex = gl.createTexture()!;
let pw = 2, ph = 2, sp = 13;
let hgt = new Float32Array(4);
let pbytes = new Uint8Array(4);
let pinsAwake = false;
const layoutPins = () => {
sp = Math.max(4, props.current.spacing);
pw = Math.ceil(w / sp) + 4;
ph = Math.ceil(h / sp) + 4;
hgt = new Float32Array(pw * ph);
pbytes = new Uint8Array(pw * ph);
gl.bindTexture(gl.TEXTURE_2D, pinTex);
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R8, pw, ph, 0, gl.RED, gl.UNSIGNED_BYTE, pbytes);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
};
const uploadPins = () => {
for (let i = 0, n = pw * ph; i < n; i++) pbytes[i] = Math.round(Math.min(1, hgt[i] / 1.4) * 255);
gl.bindTexture(gl.TEXTURE_2D, pinTex);
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, pw, ph, gl.RED, gl.UNSIGNED_BYTE, pbytes);
};
let w = 1, h = 1, dpr = 1, rs = 1;
let pinsW = 0, pinsH = 0, pinsSp = 0;
const resize = () => {
dpr = Math.min(window.devicePixelRatio || 1, 2);
w = Math.max(1, host.clientWidth);
h = Math.max(1, host.clientHeight);
canvas.width = Math.round(w * dpr);
canvas.height = Math.round(h * dpr);
// the dots are a pixel wide: draw at full resolution so they stay crisp
const sw = Math.max(1, Math.round(canvas.width * rs)), sh = Math.max(1, Math.round(canvas.height * rs));
freeTargets();
T = {
scene: target(sw, sh),
a: target(Math.max(1, sw >> 2), Math.max(1, sh >> 2)),
b: target(Math.max(1, sw >> 2), Math.max(1, sh >> 2)),
c: target(Math.max(1, sw >> 4), Math.max(1, sh >> 4)),
d: target(Math.max(1, sw >> 4), Math.max(1, sh >> 4)),
};
if (w !== pinsW || h !== pinsH || props.current.spacing !== pinsSp) {
pinsW = w;
pinsH = h;
pinsSp = props.current.spacing;
layoutPins();
}
};
resize();
const s = { intro: still ? 1 : 0, mx: -9999, my: -9999, hover: 0, sv: 0 };
let flow = 0;
let offY = 0, offYT = 0; // scroll parallax of the grid
const waves: { x: number; y: number; t: number; s: number }[] = [];
const waveBuf = new Float32Array(MAXW * 4);
const blurPass = (src: Target, dst: Target, dx: number, dy: number) => {
gl.bindFramebuffer(gl.FRAMEBUFFER, dst.fb);
gl.viewport(0, 0, dst.w, dst.h);
gl.useProgram(blurProg);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, src.tex);
gl.uniform1i(UB.uTex, 0);
gl.uniform2f(UB.uStep, dx / src.w, dy / src.h);
drawQuad();
};
const draw = () => {
if (!T) return;
const p = props.current;
if (p.spacing !== pinsSp) {
pinsSp = p.spacing;
layoutPins();
}
const X = T;
uploadPins();
gl.bindFramebuffer(gl.FRAMEBUFFER, X.scene.fb);
gl.viewport(0, 0, X.scene.w, X.scene.h);
gl.useProgram(sceneProg);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, pinTex);
gl.uniform1i(US.uPins, 0);
gl.uniform2f(US.uRes, w, h);
gl.uniform2f(US.uPinsSize, pw, ph);
gl.uniform2f(US.uOff, 0, offY);
gl.uniform1f(US.uDpr, dpr * (X.scene.w / canvas.width));
gl.uniform1f(US.uSp, sp);
gl.uniform1f(US.uSize, Math.max(0.3, p.size));
gl.uniform1f(US.uTime, flow);
gl.uniform1f(US.uIntro, s.intro);
gl.uniform1f(US.uSv, still ? 0 : s.sv);
gl.uniform3fv(US.uDot, rgb(p.dot));
gl.uniform3fv(US.uAccent, rgb(p.accent));
gl.uniform3fv(US.uBg, rgb(p.background));
waveBuf.fill(0);
waves.forEach((v, i) => waveBuf.set([v.x, v.y, v.t, v.s], i * 4));
gl.uniform4fv(US.uWave, waveBuf);
drawQuad();
gl.bindFramebuffer(gl.FRAMEBUFFER, X.a.fb);
gl.viewport(0, 0, X.a.w, X.a.h);
gl.useProgram(brightProg);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, X.scene.tex);
gl.uniform1i(UR.uTex, 0);
drawQuad();
blurPass(X.a, X.b, 1, 0);
blurPass(X.b, X.a, 0, 1);
blurPass(X.a, X.c, 1, 0);
blurPass(X.c, X.d, 0, 1);
blurPass(X.d, X.c, 1.8, 0);
blurPass(X.c, X.d, 0, 1.8);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
gl.viewport(0, 0, canvas.width, canvas.height);
gl.useProgram(compProg);
[X.scene.tex, X.a.tex, X.d.tex].forEach((tex, i) => {
gl.activeTexture(gl.TEXTURE0 + i);
gl.bindTexture(gl.TEXTURE_2D, tex);
});
gl.uniform1i(UC.uScene, 0);
gl.uniform1i(UC.uBloom, 1);
gl.uniform1i(UC.uWide, 2);
gl.uniform1f(UC.uGlow, Math.max(0, p.glow));
drawQuad();
gl.activeTexture(gl.TEXTURE0);
};
const ro = new ResizeObserver(() => {
resize();
draw();
});
ro.observe(host);
// ---- cursor: the hand raises the pins under it ----
const mxTo = gsap.quickTo(s, "mx", { duration: 0.18, ease: "power2.out" });
const myTo = gsap.quickTo(s, "my", { duration: 0.18, ease: "power2.out" });
const hoverTo = gsap.quickTo(s, "hover", { duration: 0.3, ease: "sine.out" });
let first = true;
const local = (e: PointerEvent) => {
const r = host.getBoundingClientRect();
return { x: e.clientX - r.left, y: e.clientY - r.top };
};
const move = (e: PointerEvent) => {
if (still || !props.current.interactive) return;
const p = local(e);
if (first) {
gsap.set(s, { mx: p.x, my: p.y });
first = false;
}
mxTo(p.x);
myTo(p.y);
hoverTo(1);
};
const leave = () => {
first = true;
hoverTo(0);
};
// ---- click: a ring of rising pins runs out across the bed ----
const down = (e: PointerEvent) => {
if (still || !props.current.interactive) return;
const p = local(e);
waves.push({ x: p.x, y: p.y, t: flow, s: 1 });
if (waves.length > MAXW) waves.shift();
};
host.addEventListener("pointermove", move);
host.addEventListener("pointerleave", leave);
host.addEventListener("pointerdown", down);
// ---- scroll: the grid moves with gentle parallax, and a wave rolls across it ----
const svTo = gsap.quickTo(s, "sv", { duration: 0.5, ease: "power2.out" });
let svIdle: gsap.core.Tween | null = null;
const st = still
? null
: ScrollTrigger.create({
trigger: host,
scroller: scroller ?? undefined,
start: "top bottom",
end: "bottom top",
onUpdate: (self) => {
if (!props.current.interactive) return;
offYT = -(self.progress - 0.5) * h * 0.25;
svTo(Math.max(-1, Math.min(1, self.getVelocity() / 2500)));
svIdle?.kill();
svIdle = gsap.delayedCall(0.15, () => svTo(0));
},
});
// ---- loop ----
let visible = true;
let prev = performance.now();
let intro: gsap.core.Tween | null = null;
const tick = () => {
const t = performance.now();
const dt = Math.min(0.05, (t - prev) / 1000);
prev = t;
if (!visible) return;
const p = props.current;
flow += dt;
offY += (offYT - offY) * (1 - Math.exp(-dt * 6));
// pin art physics: pins under the hand rise quickly; everywhere else friction lets them sink slowly
const sink = Math.exp(-dt * 0.9 * Math.max(0.05, p.settle));
const rise = dt * 7;
const R = 120;
const cxs = w / 2, cys = h / 2 + offY;
const hand = s.hover > 0.01 && p.interactive;
const ci = (s.mx - cxs) / sp, cj = (s.my - cys) / sp;
const rr = R / sp;
if (pinsAwake || hand) {
let any = false;
for (let j = 0; j < ph; j++)
for (let i = 0; i < pw; i++) {
const k = j * pw + i;
let v = hgt[k] * sink;
if (hand) {
// which pin on screen this texel is nearest to the hand (the field repeats)
let gi = i - Math.round(ci), gj = j - Math.round(cj);
gi = ((gi % pw) + pw + Math.floor(pw / 2)) % pw - Math.floor(pw / 2);
gj = ((gj % ph) + ph + Math.floor(ph / 2)) % ph - Math.floor(ph / 2);
const dx = gi + Math.round(ci) - ci, dy = gj + Math.round(cj) - cj;
const d = Math.hypot(dx, dy) / rr;
if (d < 1) {
const goal = (1 - d * d) * (1 - d * d) * Math.max(0, p.lift) * s.hover;
if (goal > v) v = Math.min(goal, v + rise * (goal - v + 0.05));
}
}
hgt[k] = v < 0.002 ? 0 : v;
if (hgt[k] > 0) any = true;
}
pinsAwake = any;
}
for (let i = waves.length - 1; i >= 0; i--) if (flow - waves[i].t > 2.7) waves.splice(i, 1);
draw();
};
const io = new IntersectionObserver(([en]) => {
visible = en.isIntersecting;
prev = performance.now();
});
if (still) {
draw();
redraw.current = draw;
} else {
intro = gsap.to(s, { intro: 1, duration: 1.6, ease: "power2.out", delay: 0.05 });
io.observe(host);
gsap.ticker.add(tick);
}
return () => {
redraw.current = null;
gsap.ticker.remove(tick);
intro?.kill();
st?.kill();
svIdle?.kill();
io.disconnect();
ro.disconnect();
host.removeEventListener("pointermove", move);
host.removeEventListener("pointerleave", leave);
host.removeEventListener("pointerdown", down);
gsap.killTweensOf(s);
freeTargets();
gl.deleteTexture(pinTex);
gl.deleteProgram(sceneProg);
gl.deleteProgram(blurProg);
gl.deleteProgram(brightProg);
gl.deleteProgram(compProg);
gl.deleteBuffer(vbo);
gl.deleteVertexArray(vao);
canvas.remove();
gl.getExtension("WEBGL_lose_context")?.loseContext();
};
}, [scroller]);
return (
<div ref={hostRef} className={["isolate overflow-hidden", className].filter(Boolean).join(" ")} style={{ background }}>
{children && <div className="relative z-10 h-full">{children}</div>}
</div>
);
}
export default PinField;
One prompt, any AI agent
Paste into Claude Code, Codex, Cursor or Windsurf. It carries your tweaks and the full source, so the agent installs it exactly.
Props
12 propsdotstringColour of the dots at rest.default "#555555"default "#555555"accentstringColour raised pins catch.default "#8fb0ff"default "#8fb0ff"backgroundstringBackground colour.default "#090909"default "#090909"spacingnumberDistance between dots, css px.default 13default 13sizenumberDot size at rest, css px.default 0.9default 0.9liftnumberHow far the pins rise under the cursor.default 1default 1settlenumberHow quickly raised pins sink back (higher = faster).default 1default 1glownumberStrength of the bloom on raised pins.default 0.5default 0.5interactivebooleanRaise pins with the cursor, click ring, scroll parallax and wave.default truedefault truescrollerElement | nullScroll container, if the page does not scroll the window.childrenReactNodeForeground content, drawn above the grid.classNamestringSize it, e.g. h-screen w-full.