Sigil Grid
A wall of tiny LED panels. Every tile is a 7 by 7 matrix of round LEDs drawing a mirrored pixel sigil in soft grey, and the sigils keep rewriting themselves dot by dot, each new dot flashing as it lands, while now and then a tile wakes up and lights in cobalt, violet or coral before fading back to sleep. Every tile sits on a spring and tilts in real perspective to face your cursor, like a field of sunflowers following a light, waking up and rewriting faster as it turns. A click sends a shockwave that knocks the tiles back on their springs, lights them up and reboots every sigil it passes, scrolling sweeps a wobble down the wall, and on load the panels boot up from the centre outward.
Tweak
LIVELIVEColour
Grid
Motion
Interactive
Tiles tilt to face the cursor, click for a shockwave
Usage
Follows your tweaks.
import { SigilGrid } from "@/components/inreact/sigil-grid";
export function Hero() {
return (
<SigilGrid
className="h-screen w-full"
>
{/* optional: your hero content, drawn above the grid */}
</SigilGrid>
);
}Install with the CLI
npx shadcn@latest add https://inreact.vercel.app/r/sigil-grid.jsonOr copy the source
Install the dependencies, then save this as components/inreact/sigil-grid.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);
/**
* Sigil Grid: a wall of tiny LED panels, each showing a symmetric pixel sigil.
*
* Every tile is a 7 x 7 matrix of round LEDs drawing a mirrored glyph in soft
* grey. Sigils rewrite themselves dot by dot in a cascade, and now and then a
* tile wakes up and lights in colour (cobalt, violet, coral by default) before
* fading back to sleep.
*
* It reacts: every tile sits on a spring and tilts in 3D to face your cursor,
* like a field of sunflowers following a light. The tiles near it wake up,
* brighten and rewrite faster. A click sends a shockwave that knocks the tiles
* back on their springs, lights them up and reboots every sigil it passes.
* Scrolling sweeps a wobble down the wall and stirs the sigils. On load the
* panels boot up from the centre outward.
*
* <SigilGrid className="h-screen w-full">
* <YourHero />
* </SigilGrid>
*
* Tile springs, energy and sigil morphs are simulated in JS and uploaded each
* frame as a float texture; one WebGL2 shader draws every LED (anti-aliased,
* with perspective for the tilt), then a bloom at 1/4 and 1/16 size. GSAP
* drives cursor, intro and scroll. Pauses off-screen; reduced motion shows a
* still frame; a CSS gradient without WebGL2.
*/
export interface SigilGridProps {
/** Colour of the resting LEDs. */
color?: string;
/** The three colours awake tiles light up in. */
colors?: [string, string, string];
/** Background colour. */
background?: string;
/** Tile size in px (scaled down on small screens). */
size?: number;
/** How often idle tiles wake up and rewrite, 0 to 1. */
activity?: number;
/** Speed of the morphs. */
speed?: number;
/** Strength of the bloom on lit tiles. */
glow?: number;
/** Tilt toward the cursor, click shockwave, scroll response. */
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 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; // css px; grid offset; tiles
uniform float uDpr, uTime, uCell;
uniform vec3 uColor, uA, uB, uC, uBg;
uniform highp sampler2D uState; // tilt x, tilt y, energy, morph (epoch + progress)
in vec2 vUv;
out vec4 o;
const float N = 7.0;
float h21(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
vec3 pal(float t) {
t = fract(t) * 3.0;
return t < 1.0 ? mix(uA, uB, t) : t < 2.0 ? mix(uB, uC, t - 1.0) : mix(uC, uA, t - 2.0);
}
// a mirrored sigil: 4 random columns reflected to 7; epoch < 0 is a blank panel
// integer hash (pcg3d): no visible correlation between neighbouring tiles or epochs
float hu(uvec3 v) {
v = v * 1664525u + 1013904223u;
v.x += v.y * v.z; v.y += v.z * v.x; v.z += v.x * v.y;
v ^= v >> 16u;
v.x += v.y * v.z; v.y += v.z * v.x; v.z += v.x * v.y;
return float(v.x) / 4294967295.0;
}
float bit(vec2 tile, float epoch, vec2 d) {
if (epoch < 0.0) return 0.0;
float x = d.x < 3.5 ? d.x : 6.0 - d.x;
uint e = uint(epoch);
uvec2 t = uvec2(tile);
float fill = mix(0.36, 0.62, hu(uvec3(t.x, t.y, e * 977u + 13u)));
return step(1.0 - fill, hu(uvec3(t.x * 7u + uint(x), t.y * 7u + uint(d.y), e * 31u + 5u)));
}
void main() {
vec2 p = vec2(gl_FragCoord.x, uRes.y * uDpr - gl_FragCoord.y) / uDpr;
vec2 g = (p - uOff) / uCell;
vec2 tile = floor(g);
vec3 col = uBg;
if (tile.x >= 0.0 && tile.y >= 0.0 && tile.x < uGrid.x && tile.y < uGrid.y) {
vec4 st = texelFetch(uState, ivec2(tile), 0);
vec2 tl = st.xy;
float energy = st.z;
float ep = floor(st.w), pr = fract(st.w);
vec2 q = (fract(g) - 0.5) * uCell;
// undo the tilt: perspective (the side facing away recedes) and foreshortening
float z = -dot(tl, q);
vec2 u = q / (1.0 + z / (uCell * 2.4));
float tl2 = dot(tl, tl);
if (tl2 > 1e-6) {
vec2 dir = tl * inversesqrt(tl2);
float along = dot(u, dir);
u += dir * along * (1.0 / cos(min(sqrt(tl2), 1.2)) - 1.0);
}
float S = uCell * 0.84;
float pitch = S / N;
vec2 dg = (u + S * 0.5) / pitch;
vec2 d = floor(dg);
if (d.x >= 0.0 && d.y >= 0.0 && d.x < N && d.y < N) {
// the new sigil writes in dot by dot, top-left to bottom-right
float delay = (d.y * N + d.x) / (N * N) * 0.6;
float k = smoothstep(delay, delay + 0.4, pr);
float on = mix(bit(tile, ep - 1.0, d), bit(tile, ep, d), k);
// the dot being written flashes as it lands
float flash = (1.0 - abs(k * 2.0 - 1.0)) * 0.9;
vec2 c = (dg - d - 0.5) * pitch;
float rad = pitch * 0.34;
float dist = length(c) - rad;
float al = clamp(0.5 - dist / (1.1 / uDpr), 0.0, 1.0);
// LEDs are a touch brighter in the centre, like a lens over each one
float lens = 1.0 - 0.35 * smoothstep(0.0, rad, length(c));
// lit tiles take a colour from where they sit, slowly drifting
vec3 hue = pal(tile.x * 0.035 + tile.y * 0.05 + uTime * 0.02 + h21(tile) * 0.25);
float tw = 0.92 + 0.08 * sin(uTime * 3.0 + h21(tile + d) * 40.0);
vec3 rest = uColor * 0.36 * tw;
vec3 lit = mix(uColor, hue, smoothstep(0.0, 0.6, energy)) * (0.36 + energy * 1.25);
vec3 led = mix(rest, lit, smoothstep(0.0, 1.0, energy)) * (on + flash * on) + uColor * 0.045 * (1.0 - on);
// a tile facing you catches a little more light
led *= 1.0 + sqrt(tl2) * 0.35;
col += led * lens * al;
}
}
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.55, 1.1, 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", "#a46bff", "#ff6a4d"];
export function SigilGrid({
color = "#c9ccd4",
colors = DEFAULT_COLORS,
background = "#050505",
size = 48,
activity = 0.5,
speed = 1,
glow = 0.8,
interactive = true,
scroller,
children,
className,
}: SigilGridProps) {
const hostRef = useRef<HTMLDivElement>(null);
const [c1, c2, c3] = colors;
const props = useRef({ color, c1, c2, c3, background, activity, speed, glow, interactive });
const redraw = useRef<(() => void) | null>(null);
useEffect(() => {
props.current = { color, c1, c2, c3, background, activity, speed, glow, interactive };
redraw.current?.();
}, [color, c1, c2, c3, background, activity, 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(80% 70% at 30% 20%, ${p.c1}22, transparent 60%), radial-gradient(70% 60% at 80% 90%, ${p.c3}1c, 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", "uDpr", "uTime", "uCell", "uColor", "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);
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;
};
// ---- tiles: tilt springs, energy and sigil morphs, packed into an RGBA float texture ----
const stateTex = gl.createTexture()!;
let cols = 1, rows = 1, cell = 48, scale = 1, ox = 0, oy = 0;
let tx = new Float32Array(1), ty = new Float32Array(1), vx = new Float32Array(1), vy = new Float32Array(1);
let energy = new Float32Array(1), wake = new Float32Array(1), epoch = new Float32Array(1), prog = new Float32Array(1);
let timer = new Float32Array(1), boot = new Float32Array(1);
let buf = new Float32Array(4);
const s = { intro: still ? 1 : 0, mx: -9999, my: -9999, hover: 0, sweep: 0, sweepY: -1 };
const layout = () => {
scale = Math.max(0.72, Math.min(1, w / 1100));
cell = Math.max(20, sizeRef.current) * scale;
cols = Math.ceil(w / cell) + 1;
rows = Math.ceil(h / cell) + 1;
ox = (w - cols * cell) / 2;
oy = (h - rows * cell) / 2;
const n = cols * rows;
tx = new Float32Array(n);
ty = new Float32Array(n);
vx = new Float32Array(n);
vy = new Float32Array(n);
energy = new Float32Array(n);
wake = new Float32Array(n);
epoch = new Float32Array(n);
prog = new Float32Array(n);
timer = new Float32Array(n);
boot = new Float32Array(n);
buf = new Float32Array(n * 4);
const done = s.intro >= 1;
for (let i = 0; i < n; i++) {
const cx = i % cols, cy = Math.floor(i / cols);
const dx = (cx + 0.5) / cols - 0.5, dy = ((cy + 0.5) / rows - 0.5) * (rows / cols);
// boot order: from the centre outward, with a little scatter
boot[i] = Math.hypot(dx, dy) * 1.5 + Math.random() * 0.18;
epoch[i] = done ? 1 + Math.floor(Math.random() * 999) : 0;
prog[i] = done ? 1 : 0;
timer[i] = 2 + Math.random() * 10;
}
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);
pack();
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, cols, rows, 0, gl.RGBA, gl.FLOAT, buf);
};
// epoch < 1 is blank; morph progress rides in the fraction
const pack = () => {
for (let i = 0, n = cols * rows; i < n; i++) {
buf[i * 4] = tx[i];
buf[i * 4 + 1] = ty[i];
buf[i * 4 + 2] = Math.max(energy[i], wake[i]);
buf[i * 4 + 3] = epoch[i] - 1 + Math.min(prog[i], 0.999);
}
};
const morph = (i: number) => {
if (prog[i] < 0.5 && epoch[i] > 0) return; // mid-write: let it finish
epoch[i] += 1;
prog[i] = 0;
};
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();
const t0 = performance.now();
const clock = () => (still ? 20 : (performance.now() - t0) / 1000);
const waves: { x: number; y: number; t: number; r: number }[] = [];
// ---- simulation ----
const K = 70, DAMP = 7.5;
const step = (dt: number, now: number) => {
const P = props.current;
const act = Math.max(0, Math.min(1, P.activity));
const n = cols * rows;
const R = 230 * scale;
const inv = 1 / (R * R);
const morphRate = 1.5 * P.speed;
const rel = s.intro * 1.7;
// waves: tiles the ring passes this frame get a kick, light up and reboot
for (let k = waves.length - 1; k >= 0; k--) {
const wv = waves[k];
const front = (now - wv.t) * 820 * scale;
const inner = wv.r;
wv.r = front;
if (inner > Math.hypot(w, h)) {
waves.splice(k, 1);
continue;
}
const minx = Math.max(0, Math.floor((wv.x - front - ox) / cell)), maxx = Math.min(cols - 1, Math.floor((wv.x + front - ox) / cell));
const miny = Math.max(0, Math.floor((wv.y - front - oy) / cell)), maxy = Math.min(rows - 1, Math.floor((wv.y + front - oy) / cell));
for (let cy = miny; cy <= maxy; cy++)
for (let cx = minx; cx <= maxx; cx++) {
const px = ox + (cx + 0.5) * cell - wv.x, py = oy + (cy + 0.5) * cell - wv.y;
const d = Math.sqrt(px * px + py * py);
if (d < inner || d >= front) continue;
const i = cy * cols + cx;
const fall = Math.exp(-d / (520 * scale));
const nx = px / Math.max(d, 1), ny = py / Math.max(d, 1);
// knocked back: the near edge tips away from the blast
vx[i] -= nx * 9 * fall;
vy[i] -= ny * 9 * fall;
energy[i] = Math.max(energy[i], 0.35 + 0.75 * fall);
morph(i);
}
}
const sweepOn = s.sweep > 0.01;
const sweepRow = s.sweepY * rows;
for (let i = 0; i < n; i++) {
const cx = i % cols, cy = Math.floor(i / cols);
// boot-up
if (epoch[i] === 0) {
if (boot[i] < rel) {
epoch[i] = 1 + Math.floor(Math.random() * 999);
prog[i] = 0;
energy[i] = 0.5;
} else continue;
}
const px = ox + (cx + 0.5) * cell, py = oy + (cy + 0.5) * cell;
const dx = s.mx - px, dy = s.my - py;
const f = Math.exp(-(dx * dx + dy * dy) * inv) * s.hover;
// tilt to face the cursor
let gx = 0, gy = 0;
if (f > 0.002) {
const d = Math.sqrt(dx * dx + dy * dy) + 1;
gx = (dx / d) * 0.55 * f;
gy = (dy / d) * 0.55 * f;
energy[i] = Math.max(energy[i], f * 0.9);
}
if (sweepOn) {
const band = Math.exp(-((cy - sweepRow) ** 2) / 6) * s.sweep;
if (band > 0.05) {
vy[i] += band * 30 * dt * Math.sin(cx * 0.6 + now * 4);
if (Math.random() < band * dt * 6) morph(i);
}
}
vx[i] += ((gx - tx[i]) * K - vx[i] * DAMP) * dt;
vy[i] += ((gy - ty[i]) * K - vy[i] * DAMP) * dt;
tx[i] += vx[i] * dt;
ty[i] += vy[i] * dt;
const lim = 0.9;
if (tx[i] > lim) tx[i] = lim; else if (tx[i] < -lim) tx[i] = -lim;
if (ty[i] > lim) ty[i] = lim; else if (ty[i] < -lim) ty[i] = -lim;
// energy fades; idle tiles wake now and then
energy[i] = Math.max(0, energy[i] - dt * 0.45);
wake[i] = Math.max(0, wake[i] - dt * 0.18);
timer[i] -= dt * P.speed * (1 + f * 8) * (0.3 + act * 1.4);
if (timer[i] <= 0) {
timer[i] = 4 + Math.random() * 12;
morph(i);
if (Math.random() < act * 0.18) wake[i] = 0.8 + Math.random() * 0.4;
}
if (prog[i] < 1) prog[i] = Math.min(1, prog[i] + dt * morphRate * (1 + f));
}
};
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();
pack();
gl.bindTexture(gl.TEXTURE_2D, stateTex);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, cols, rows, gl.RGBA, gl.FLOAT, buf);
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.uniform1f(US.uDpr, dpr);
gl.uniform1f(US.uTime, now);
gl.uniform1f(US.uCell, cell);
gl.uniform3fv(US.uColor, rgb(p.color));
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) {
// a still frame: a few tiles awake
for (let i = 0; i < cols * rows; i++) if (Math.random() < 0.08) wake[i] = 0.9;
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 panels boot up from the centre outward ----
const intro = gsap.to(s, { intro: 1, duration: 2, ease: "power1.inOut", delay: 0.1 });
// ---- cursor: tiles turn to face it, wake up and rewrite ----
const mxTo = gsap.quickTo(s, "mx", { duration: 0.35, ease: "power3" });
const myTo = gsap.quickTo(s, "my", { duration: 0.35, ease: "power3" });
const hoverTo = gsap.quickTo(s, "hover", { duration: 0.6, ease: "power2.inOut" });
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 (!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 shockwave that knocks the tiles back and reboots their sigils ----
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: a wobble sweeps down the wall with the page, stirring the sigils ----
const st = ScrollTrigger.create({
trigger: host,
scroller: scroller ?? undefined,
start: "top bottom",
end: "bottom top",
onUpdate: (self) => {
if (!props.current.interactive) return;
s.sweepY = self.progress * 1.4 - 0.2;
const v = Math.min(1, Math.abs(self.getVelocity()) / 2200);
if (v > s.sweep) gsap.to(s, { sweep: v, duration: 0.2, ease: "power2.out", overwrite: "auto", onComplete: () => void gsap.to(s, { sweep: 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.033, (t - prev) / 1000);
prev = t;
if (!visible) return;
step(dt, clock());
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 SigilGrid;
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 propscolorstringColour of the resting LEDs.default "#c9ccd4"default "#c9ccd4"colors[string, string, string]The three colours awake tiles light up in.default ["#2b5cff", "#a46bff", "#ff6a4d"]default ["#2b5cff", "#a46bff", "#ff6a4d"]backgroundstringBackground colour.default "#050505"default "#050505"sizenumberTile size in px (scaled down on small screens).default 48default 48activitynumberHow often idle tiles wake up and rewrite, 0 to 1.default 0.5default 0.5speednumberSpeed of the morphs.default 1default 1glownumberStrength of the bloom on lit tiles.default 0.8default 0.8interactivebooleanTilt toward the cursor, click shockwave and scroll response.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.