Sequin Wall
A wall of thousands of tiny two-sided sequins. At rest it is a fine matrix of silver rings, each rocking gently on a drifting field so the wall shimmers in soft patches of light. Every sequin is a real spring: brush down across the wall and the sequins under your cursor flip over with a little overshoot, revealing an iridescent back of cobalt, violet and ember with a metallic highlight that slides as they settle; brush up and they flip back, just like sequin fabric. The light follows your cursor and the sequins beneath it lift toward you, a click sends a ring through the wall that flips everything it passes, scrolling ripples the whole surface, and on load the sequins turn in from edge-on in a diagonal wave. Brushed sequins heal back on their own, or stay for good.
Tweak
LIVELIVEColour
Wall
Motion
Interactive
Brush to flip, light follows the cursor, click for a flip ring
Usage
Follows your tweaks.
import { SequinWall } from "@/components/inreact/sequin-wall";
export function Hero() {
return (
<SequinWall
className="h-screen w-full"
>
{/* optional: your hero content, drawn above the wall */}
</SequinWall>
);
}Install with the CLI
npx shadcn@latest add https://inreact.vercel.app/r/sequin-wall.jsonOr copy the source
Install the dependencies, then save this as components/inreact/sequin-wall.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);
/**
* Sequin Wall: a wall of thousands of tiny two-sided sequins.
*
* At rest it is a fine matrix of silver rings, each catching a slow, drifting
* light so the wall shimmers in soft patches. Every sequin is a real spring:
* brush across the wall and the sequins under your cursor flip over, showing
* an iridescent back (cobalt, violet, ember) with a moving metallic highlight.
* Brush down to flip them, brush up to flip them back, just like sequin fabric.
* The light follows your cursor. A click sends a ring through the wall that
* flips everything it passes, scrolling ripples the whole wall, and on load
* the sequins turn in from edge-on in a wave. Painted sequins heal back on
* their own after `heal` seconds (0 keeps your drawing).
*
* <SequinWall className="h-screen w-full">
* <YourHero />
* </SequinWall>
*
* Each sequin's angle is simulated in JS (an underdamped spring), uploaded as a
* float texture, and drawn by one WebGL2 shader (anti-aliased discs with real
* lighting), then a bloom at 1/4 and 1/16 size. GSAP drives the cursor, intro
* and scroll. Pauses off-screen; reduced motion shows a still frame; a CSS
* gradient without WebGL2.
*/
export interface SequinWallProps {
/** Colour of the silver ring faces. */
ring?: string;
/** The three colours of the iridescent backs. */
colors?: [string, string, string];
/** Background colour. */
background?: string;
/** Sequin size in px (scaled down on small screens). */
size?: number;
/** Seconds before brushed sequins flip back. 0 keeps them. */
heal?: number;
/** Speed of the idle shimmer. */
speed?: number;
/** Strength of the bloom on highlights. */
glow?: number;
/** Brush, light, click and scroll response. */
interactive?: boolean;
/** Scroll container if the page does not scroll the window. */
scroller?: Element | null;
/** Foreground content, drawn above the wall. */
children?: ReactNode;
className?: string;
}
const PI = Math.PI;
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 vec2 uRes, uOff, uGrid, uMouse, uLight; // css px
uniform float uDpr, uTime, uCs, uScale, uHover, uLightZ;
uniform vec3 uRing, uA, uB, uC, uBg;
uniform highp sampler2D uState;
in vec2 vUv;
out vec4 o;
float h21(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
float noise(vec2 p) {
vec2 i = floor(p), f = fract(p);
f = f * f * (3.0 - 2.0 * f);
return mix(mix(h21(i), h21(i + vec2(1, 0)), f.x), mix(h21(i + vec2(0, 1)), h21(i + vec2(1, 1)), f.x), f.y);
}
vec3 pal(float t) {
t = fract(t) * 3.0;
vec3 c = mix(uA, uB, smoothstep(0.0, 1.0, t));
c = mix(c, uC, smoothstep(1.0, 2.0, t));
return mix(c, uA, smoothstep(2.0, 3.0, t));
}
void main() {
vec2 p = vec2(gl_FragCoord.x, uRes.y * uDpr - gl_FragCoord.y) / uDpr;
vec2 g = (p - uOff) / uCs;
vec2 cell = floor(g);
vec2 f = (fract(g) - 0.5) * uCs;
vec3 col = uBg;
if (cell.x >= 0.0 && cell.y >= 0.0 && cell.x < uGrid.x && cell.y < uGrid.y) {
float a = texelFetch(uState, ivec2(cell), 0).r;
vec2 cc = (cell + 0.5) * uCs + uOff;
// idle: every sequin rocks a little on a slow, drifting field, and a soft swell rolls through
float n1 = noise(cell * 0.11 + vec2(uTime * 0.09, -uTime * 0.06));
float n2 = noise(cell * 0.05 + vec2(-uTime * 0.035, uTime * 0.02) + 7.3);
float sw = sin((cc.x * 0.55 + cc.y) / max(uRes.y, 1.0) * 4.0 - uTime * 0.7);
float tilt = (n1 - 0.5) * 0.95 + pow(max(sw, 0.0), 8.0) * 0.55;
// the cursor lifts the sequins beneath it
vec2 dm = cc - uMouse;
float R = 110.0 * uScale;
tilt += exp(-dot(dm, dm) / (R * R)) * uHover * 0.55;
float A = a + tilt;
float ca = cos(A), sa = sin(A);
// the disc, foreshortened as it turns about its horizontal axis
float rad = uCs * 0.42;
vec2 q = vec2(f.x, f.y / max(abs(ca), 0.035));
float d = length(q) - rad;
float aa = max(fwidth(d), 0.6 / uDpr);
float cov = clamp(0.5 - d / aa, 0.0, 1.0);
float vis = smoothstep(0.03, 0.2, abs(ca));
vec3 L = normalize(vec3(uLight - cc, uLightZ));
vec3 H = normalize(L + vec3(0.0, 0.0, 1.0));
if (ca > 0.0) {
// silver ring face
vec3 n = vec3(0.0, -sa, ca);
float th = uCs * 0.07;
float ring = clamp(0.5 - (abs(d + th) - th) / aa, 0.0, 1.0);
float lam = max(dot(n, L), 0.0);
float sp = pow(max(dot(n, H), 0.0), 70.0);
float lum = (0.1 + 0.9 * lam * lam) * mix(0.28, 1.0, n2);
col += uRing * (ring * (lum * 0.9 + sp * 1.5) + cov * 0.03 * lum) * vis;
} else {
// iridescent back: a shallow metal dish with a moving highlight
vec3 n = vec3(0.0, sa, -ca);
n.xy += (q / rad) * vec2(0.32, 0.32 * abs(ca));
n = normalize(n);
float hue = cell.x * 0.013 + cell.y * 0.019 + A * 0.16 + dot(n.xy, vec2(0.35, 0.25)) + uTime * 0.015;
vec3 base = pal(hue);
float lam = max(dot(n, L), 0.0);
float sp = pow(max(dot(n, H), 0.0), 34.0);
vec3 c = base * (0.16 + 0.8 * lam) + mix(base, vec3(1.0), 0.55) * sp * 1.7;
c *= 1.0 - 0.38 * smoothstep(0.55, 1.0, length(q) / rad);
col = mix(col, c, cov * vis);
}
}
col += (h21(gl_FragCoord.xy + fract(uTime) * 91.0) - 0.5) / 255.0;
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.62, 1.15, l), 1.0);
}`;
const COMPOSITE = `#version 300 es
precision mediump float;
uniform sampler2D uScene, uBloom, uWide; uniform float uGlow, uTime; in vec2 vUv; out vec4 o;
float h(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
void main() {
vec3 sc = texture(uScene, vUv).rgb;
vec3 bl = texture(uBloom, vUv).rgb * 0.6 + texture(uWide, vUv).rgb * 0.4;
vec3 x = sc + bl * uGlow;
vec3 col = x / (1.0 + max(x - 0.8, 0.0) * 1.2);
col += (h(gl_FragCoord.xy + fract(uTime * 7.0) * 91.0) - 0.5) / 255.0;
o = vec4(min(col, vec3(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];
}
const DEFAULT_COLORS: [string, string, string] = ["#2b5cff", "#b46bff", "#ff6a3d"];
export function SequinWall({
ring = "#ecebe6",
colors = DEFAULT_COLORS,
background = "#050505",
size = 15,
heal = 5,
speed = 1,
glow = 0.7,
interactive = true,
scroller,
children,
className,
}: SequinWallProps) {
const hostRef = useRef<HTMLDivElement>(null);
const [c1, c2, c3] = colors;
const props = useRef({ ring, c1, c2, c3, background, heal, speed, glow, interactive });
const redraw = useRef<(() => void) | null>(null);
useEffect(() => {
props.current = { ring, c1, c2, c3, background, heal, speed, glow, interactive };
redraw.current?.();
}, [ring, c1, c2, c3, background, heal, speed, glow, interactive]);
const sizeRef = useRef(size);
const setSize = useRef<(() => void) | null>(null);
useEffect(() => {
sizeRef.current = size;
setSize.current?.();
}, [size]);
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.background = `radial-gradient(120% 90% at 30% 0%, ${p.c1}33, transparent 60%), radial-gradient(90% 80% at 90% 100%, ${p.c3}26, transparent 60%), ${p.background}`;
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, [
"uRes", "uOff", "uGrid", "uMouse", "uLight", "uDpr", "uTime", "uCs", "uScale", "uHover", "uLightZ",
"uRing", "uA", "uB", "uC", "uBg", "uState",
]);
const UB = uni(blurProg, ["uTex", "uStep"]);
const UR = uni(brightProg, ["uTex"]);
const UC = uni(compProg, ["uScene", "uBloom", "uWide", "uGlow", "uTime"]);
const vao = gl.createVertexArray();
gl.bindVertexArray(vao);
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
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);
// ---- render targets ----
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 sequins: one spring per cell, simulated here, uploaded as a float texture ----
const stateTex = gl.createTexture()!;
let cols = 1, rows = 1, cs = 15, scale = 1, ox = 0, oy = 0;
let ang = new Float32Array(1), vel = new Float32Array(1), tgt = new Float32Array(1);
let touch = new Float32Array(1), jit = new Float32Array(1), stag = new Float32Array(1);
const t0 = performance.now();
const clock = () => (still ? 14 : (performance.now() - t0) / 1000);
const s = { intro: still ? 1 : 0, mx: -9999, my: -9999, hover: 0, lx: 0, ly: 0, scroll: 0, shake: 0 };
const uploadState = () => {
gl.bindTexture(gl.TEXTURE_2D, stateTex);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, cols, rows, gl.RED, gl.FLOAT, ang);
};
const layout = () => {
scale = Math.max(0.68, Math.min(1, w / 1100));
cs = Math.max(6, sizeRef.current) * scale;
cols = Math.ceil(w / cs) + 1;
rows = Math.ceil(h / cs) + 1;
ox = (w - cols * cs) / 2;
oy = (h - rows * cs) / 2;
const n = cols * rows;
ang = new Float32Array(n);
vel = new Float32Array(n);
tgt = new Float32Array(n);
touch = new Float32Array(n).fill(-1e6);
jit = new Float32Array(n);
stag = new Float32Array(n);
const done = s.intro >= 1;
for (let i = 0; i < n; i++) {
const cx = i % cols, cy = Math.floor(i / cols);
const r = Math.random();
// healing sweeps down from the top with a little scatter
jit[i] = (cy / rows) * 1.1 + r * 0.9;
// the intro turns in diagonally from the top-left
stag[i] = ((cx / cols) * 0.55 + (cy / rows) * 0.45) * 1.2 + r * 0.18;
ang[i] = done ? 0 : PI / 2;
}
gl.bindTexture(gl.TEXTURE_2D, stateTex);
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.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R32F, cols, rows, 0, gl.RED, gl.FLOAT, ang);
};
let w = 1, h = 1, dpr = 1;
const resize = () => {
dpr = Math.min(window.devicePixelRatio || 1, 1.75);
const nw = Math.max(1, host.clientWidth), nh = Math.max(1, host.clientHeight);
const changed = nw !== w || nh !== h;
w = nw;
h = nh;
canvas.width = Math.round(w * dpr);
canvas.height = Math.round(h * dpr);
const sw = canvas.width, sh = canvas.height;
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 (changed) layout();
};
resize();
// ---- physics: an underdamped spring per sequin, so flips overshoot and settle ----
const K = 115, DAMP = 8;
const step = (dt: number, now: number) => {
const P = props.current;
const rel = s.intro * 1.6;
const n = cols * rows;
const sub = Math.max(1, Math.ceil(dt / (1 / 90)));
const h1 = dt / sub;
const shake = s.shake;
for (let i = 0; i < n; i++) {
if (stag[i] > rel) {
ang[i] = PI / 2;
vel[i] = 0;
continue;
}
if (P.heal > 0 && tgt[i] !== 0 && now - touch[i] > P.heal + jit[i]) tgt[i] = 0;
if (shake > 0.001) {
const cy = Math.floor(i / cols);
vel[i] += shake * Math.sin(cy * 0.42 - now * 9 + (i % cols) * 0.05) * 38 * dt;
}
const goal = tgt[i] * PI;
let a = ang[i], v = vel[i];
for (let k = 0; k < sub; k++) {
v += ((goal - a) * K - v * DAMP) * h1;
a += v * h1;
}
ang[i] = a;
vel[i] = v;
}
};
// a brush stroke: sequins along the segment flip with the stroke's direction
const brush = (x0: number, y0: number, x1: number, y1: number, vx: number, vy: number, now: number) => {
const spd = Math.hypot(vx, vy);
if (spd < 60) return;
const dir = vy + vx * 0.35 > 0 ? 1 : 0;
const R = 46 * scale;
const minx = Math.max(0, Math.floor((Math.min(x0, x1) - R - ox) / cs));
const maxx = Math.min(cols - 1, Math.floor((Math.max(x0, x1) + R - ox) / cs));
const miny = Math.max(0, Math.floor((Math.min(y0, y1) - R - oy) / cs));
const maxy = Math.min(rows - 1, Math.floor((Math.max(y0, y1) + R - oy) / cs));
const dx = x1 - x0, dy = y1 - y0;
const L2 = Math.max(1e-6, dx * dx + dy * dy);
const kick = Math.min(1, spd / 1400);
for (let cy = miny; cy <= maxy; cy++)
for (let cx = minx; cx <= maxx; cx++) {
const px = ox + (cx + 0.5) * cs, py = oy + (cy + 0.5) * cs;
const t = Math.max(0, Math.min(1, ((px - x0) * dx + (py - y0) * dy) / L2));
const ex = px - (x0 + dx * t), ey = py - (y0 + dy * t);
const d = Math.sqrt(ex * ex + ey * ey);
if (d > R) continue;
const wgt = 1 - d / R;
const i = cy * cols + cx;
if (wgt > 0.18) {
if (tgt[i] !== dir) vel[i] += (dir ? 1 : -1) * (4 + 10 * kick) * wgt;
tgt[i] = dir;
touch[i] = now;
} else vel[i] += (Math.random() - 0.5) * 6 * kick;
}
};
// a ring that flips every sequin it passes, then fades into a wobble
const waves: { x: number; y: number; t: number; r: number }[] = [];
const runWaves = (now: number) => {
for (let k = waves.length - 1; k >= 0; k--) {
const wv = waves[k];
const front = (now - wv.t) * 760 * scale;
const inner = wv.r, outer = front;
wv.r = front;
const flipR = 300 * scale, maxR = Math.hypot(w, h);
if (inner > maxR) {
waves.splice(k, 1);
continue;
}
const minx = Math.max(0, Math.floor((wv.x - outer - ox) / cs));
const maxx = Math.min(cols - 1, Math.floor((wv.x + outer - ox) / cs));
const miny = Math.max(0, Math.floor((wv.y - outer - oy) / cs));
const maxy = Math.min(rows - 1, Math.floor((wv.y + outer - oy) / cs));
for (let cy = miny; cy <= maxy; cy++)
for (let cx = minx; cx <= maxx; cx++) {
const px = ox + (cx + 0.5) * cs - wv.x, py = oy + (cy + 0.5) * cs - wv.y;
const d = Math.sqrt(px * px + py * py);
if (d < inner || d >= outer) continue;
const i = cy * cols + cx;
// a ragged edge, so the flipped patch reads as fabric, not a stamped circle
if (d < flipR * (0.72 + 0.28 * jit[i] / 2)) {
tgt[i] = 1 - tgt[i];
touch[i] = now;
vel[i] += (tgt[i] ? 1 : -1) * 6;
} else vel[i] += 7 * Math.exp(-(d - flipR) / (260 * scale));
}
}
};
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;
const X = T;
const now = clock();
uploadState();
// the light drifts slowly across the top; hovering pulls it to the cursor
const idleX = w * (0.35 + Math.sin(now * 0.13 * p.speed) * 0.3);
const idleY = -h * 0.25 + s.scroll * h * 0.5;
const lx = idleX + (s.mx - idleX) * s.hover;
const ly = idleY + (s.my - idleY) * s.hover;
gl.bindFramebuffer(gl.FRAMEBUFFER, X.scene.fb);
gl.viewport(0, 0, X.scene.w, X.scene.h);
gl.useProgram(sceneProg);
gl.uniform2f(US.uRes, w, h);
gl.uniform2f(US.uOff, ox, oy);
gl.uniform2f(US.uGrid, cols, rows);
gl.uniform2f(US.uMouse, s.mx, s.my);
gl.uniform2f(US.uLight, lx, ly);
gl.uniform1f(US.uDpr, dpr);
gl.uniform1f(US.uTime, now * p.speed);
gl.uniform1f(US.uCs, cs);
gl.uniform1f(US.uScale, scale);
gl.uniform1f(US.uHover, s.hover);
gl.uniform1f(US.uLightZ, (260 - 120 * s.hover) * scale);
gl.uniform3fv(US.uRing, rgb(p.ring));
gl.uniform3fv(US.uA, rgb(p.c1));
gl.uniform3fv(US.uB, rgb(p.c2));
gl.uniform3fv(US.uC, rgb(p.c3));
gl.uniform3fv(US.uBg, rgb(p.background));
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, stateTex);
gl.uniform1i(US.uState, 0);
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, p.glow);
gl.uniform1f(UC.uTime, now);
drawQuad();
gl.activeTexture(gl.TEXTURE0);
};
setSize.current = () => {
layout();
draw();
};
const ro = new ResizeObserver(() => {
resize();
draw();
});
ro.observe(host);
if (still) {
draw();
redraw.current = draw;
return () => {
redraw.current = null;
setSize.current = null;
ro.disconnect();
freeTargets();
gl.deleteTexture(stateTex);
canvas.remove();
gl.getExtension("WEBGL_lose_context")?.loseContext();
};
}
// ---- on load: the sequins turn in from edge-on in a diagonal wave ----
const intro = gsap.to(s, { intro: 1, duration: 2.2, ease: "power1.inOut", delay: 0.1 });
// ---- cursor: the light follows it, the sequins under it lift, strokes flip them ----
const mxTo = gsap.quickTo(s, "mx", { duration: 0.25, ease: "power3" });
const myTo = gsap.quickTo(s, "my", { duration: 0.25, ease: "power3" });
const hoverTo = gsap.quickTo(s, "hover", { duration: 0.7, ease: "power2.inOut" });
let last: { x: number; y: number; t: number } | null = null;
const local = (e: PointerEvent) => {
const r = host.getBoundingClientRect();
return { x: e.clientX - r.left, y: e.clientY - r.top };
};
const move = (e: PointerEvent) => {
if (!props.current.interactive) return;
const p = local(e);
const now = clock();
if (!last) gsap.set(s, { mx: p.x, my: p.y });
mxTo(p.x);
myTo(p.y);
hoverTo(1);
if (last && s.intro > 0.5) {
const dt = Math.max(1 / 240, now - last.t);
brush(last.x, last.y, p.x, p.y, (p.x - last.x) / dt, (p.y - last.y) / dt, now);
}
last = { x: p.x, y: p.y, t: now };
};
const leave = () => {
last = null;
hoverTo(0);
};
// ---- click: a ring that flips everything it passes ----
const down = (e: PointerEvent) => {
if (!props.current.interactive) return;
const p = local(e);
waves.push({ x: p.x, y: p.y, t: clock(), r: 0 });
if (waves.length > 4) waves.shift();
};
host.addEventListener("pointermove", move);
host.addEventListener("pointerleave", leave);
host.addEventListener("pointerdown", down);
// ---- scroll: the light sinks with the page and scroll speed ripples the wall ----
const scrollTo = gsap.quickTo(s, "scroll", { duration: 0.9, ease: "power3" });
const st = ScrollTrigger.create({
trigger: host,
scroller: scroller ?? undefined,
start: "top bottom",
end: "bottom top",
onUpdate: (self) => {
scrollTo(self.progress);
if (!props.current.interactive) return;
const v = Math.min(1, Math.abs(self.getVelocity()) / 2600);
if (v > s.shake) gsap.to(s, { shake: v, duration: 0.2, ease: "power2.out", overwrite: "auto", onComplete: () => void gsap.to(s, { shake: 0, duration: 1.2, ease: "power2.out" }) });
},
});
// ---- loop, only while on screen ----
let visible = true;
let prev = performance.now();
const loop = () => {
const t = performance.now();
const dt = Math.min(0.05, (t - prev) / 1000);
prev = t;
if (!visible) return;
const now = clock();
runWaves(now);
step(dt, now);
draw();
};
const io = new IntersectionObserver(([en]) => {
visible = en.isIntersecting;
prev = performance.now();
});
io.observe(host);
gsap.ticker.add(loop);
redraw.current = null;
return () => {
gsap.ticker.remove(loop);
intro.kill();
st.kill();
io.disconnect();
ro.disconnect();
host.removeEventListener("pointermove", move);
host.removeEventListener("pointerleave", leave);
host.removeEventListener("pointerdown", down);
gsap.killTweensOf(s);
setSize.current = null;
freeTargets();
gl.deleteTexture(stateTex);
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 SequinWall;
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
11 propsringstringColour of the silver ring faces.default "#ecebe6"default "#ecebe6"colors[string, string, string]The three colours of the iridescent backs.default ["#2b5cff", "#b46bff", "#ff6a3d"]default ["#2b5cff", "#b46bff", "#ff6a3d"]backgroundstringBackground colour.default "#050505"default "#050505"sizenumberSequin size in px (scaled down on small screens).default 15default 15healnumberSeconds before brushed sequins flip back. 0 keeps them.default 5default 5speednumberSpeed of the idle shimmer.default 1default 1glownumberStrength of the bloom on highlights.default 0.7default 0.7interactivebooleanBrush, light, click and scroll response.default truedefault truescrollerElement | nullScroll container, if the page does not scroll the window.childrenReactNodeForeground content, drawn above the wall.classNamestringSize it, e.g. h-screen w-full.