Groove Bloom
A hypnotic bloom of fine raised grooves. Hundreds of slim grooves wind around a dark heart and bend outward into slow, breathing petals, like a carved surface or a ripple frozen mid-bloom. Every groove is shaded as a real raised ridge, catching a glossy highlight along its crest and falling into a dark valley beside it, with deep violet running through the bloom and an accent colour pooling between the petals. The cursor is a gravity lens that bends the grooves around it while the heart leans toward you and the light rakes the ridges from your direction. A click sends a pulse rolling outward through the rings, scrolling twists the petals into a spiral, and on load the rings unfurl out of the centre. Every motion runs on soft springs.
Tweak
LIVELIVEColour
Bloom
Motion
Interactive
Bend the grooves with the cursor, click for a pulse
Usage
Follows your tweaks.
import { GrooveBloom } from "@/components/inreact/groove-bloom";
export function Hero() {
return (
<GrooveBloom
className="h-screen w-full"
>
{/* optional: your hero content, drawn above the bloom */}
</GrooveBloom>
);
}Install with the CLI
npx shadcn@latest add https://inreact.vercel.app/r/groove-bloom.jsonOr copy the source
Install the dependencies, then save this as components/inreact/groove-bloom.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);
/**
* Groove Bloom: a hypnotic bloom of fine raised grooves.
*
* Hundreds of slim grooves wind around a dark heart and bend outward into
* slow, breathing petals, like a carved surface or a ripple frozen mid-bloom.
* Every groove is shaded as a real raised ridge, so each one catches a glossy
* highlight along its crest and falls into a dark valley beside it; deep violet
* runs through the bloom with an accent colour pooling between the petals.
*
* It reacts: the cursor is a gravity lens that bends the grooves around it,
* the bloom's heart leans toward you and the light rakes the ridges from your
* direction. A click sends a pulse rolling outward through the rings,
* scrolling twists the petals into a spiral, and on load the rings unfurl out
* of the centre. Every motion runs on soft springs.
*
* <GrooveBloom className="h-screen w-full">
* <YourHero />
* </GrooveBloom>
*
* WebGL2: one shader builds a warped radial field (lobes, twist, noise, the
* cursor's lens, click pulses), draws its contour lines as lit ridges with a
* normal from the field's exact slope, then a bloom at 1/4 and 1/16 size.
* Adaptive resolution keeps 60fps. Pauses off-screen; reduced motion shows a
* still frame; a CSS gradient without WebGL2.
*/
export interface GrooveBloomProps {
/** Main colour of the grooves. */
color?: string;
/** Accent colour pooling between the petals. */
accent?: string;
/** Colour of the highlights on the ridges. */
highlight?: string;
/** Background colour (the deepest valleys and the heart). */
background?: string;
/** Number of petals. */
petals?: number;
/** How many grooves, roughly, from the heart to the edge. */
density?: number;
/** Speed of the breathing. */
speed?: number;
/** Strength of the bloom on the highlights. */
glow?: number;
/** Cursor lens and light, click pulse, scroll twist. */
interactive?: boolean;
/** Scroll container if the page does not scroll the window. */
scroller?: Element | null;
/** Foreground content, drawn above the bloom. */
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 vec2 uRes, uMouse, uCenter; // css px, top-left origin
uniform float uDpr, uTime, uHover, uIntro, uTwist, uPetals, uDensity, uFlash;
uniform vec3 uColor, uAccent, uHi, uBg;
uniform vec4 uWave[${MAXW}];
in vec2 vUv;
out vec4 o;
float h21(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); }
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);
}
float S; // px per unit of the field
// the bloom's own coordinates, gently warped; every part of the shading uses these,
// so the heart, the glow and the grooves always share one centre
vec2 warpQ(vec2 p) {
vec2 q = (p - uCenter) / S;
float fade = smoothstep(0.0, 0.25, length(q));
return q + (vec2(noise(q * 1.1 + uTime * 0.018), noise(q * 1.1 + 7.3 - uTime * 0.015)) - 0.5) * 0.24 * fade;
}
// the big petals: whole numbers of waves around the circle, so there is never a seam
float petalsAt(float a, float r) {
return sin(a * uPetals + r * (1.3 + uTwist * 3.0) + uTime * 0.07)
+ 0.4 * sin(a * (floor(uPetals * 0.5) + 1.0) - r * 1.2 - uTime * 0.05 + 1.3);
}
// the petals as a raised surface: broad folds that catch light and shadow
float macroAt(vec2 q) {
float r = length(q);
return 0.15 * petalsAt(atan(q.y, q.x), r) * smoothstep(0.0, 0.45, r);
}
// the field whose contour lines are the grooves
float field(vec2 p) {
vec2 q = warpQ(p);
float r = length(q);
float a = atan(q.y, q.x);
float f = r + macroAt(q);
// every groove ripples along its length in smooth waves
f += 0.03 * sin(a * uPetals * 2.0 - r * 7.0 + uTime * 0.09 + 0.7 * sin(a * 2.0 + r * 3.0)) * smoothstep(0.06, 0.35, r);
// the cursor is a soft gravity lens: grooves bow in around it
vec2 dm = (p - uMouse) / S;
f -= 0.055 * exp(-dot(dm, dm) / 0.14) * uHover;
// click pulses roll outward through the rings
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 > 3.5) continue;
float rr = length((p - W.xy) / S);
float fr = rr - age * 0.55;
f += 0.03 * sin(fr * 12.0) * exp(-fr * fr / 0.02) * exp(-age * 1.0) * W.w;
}
return f;
}
void main() {
vec2 p = vec2(gl_FragCoord.x, uRes.y * uDpr - gl_FragCoord.y) / uDpr;
S = min(uRes.x, uRes.y) * 0.62;
float e = 1.0 / uDpr;
float f = field(p);
vec2 g = vec2(field(p + vec2(e, 0.0)) - f, field(p + vec2(0.0, e)) - f) / e;
float gl = length(g);
vec2 gdir = gl > 1e-7 ? g / gl : vec2(0.0);
vec2 q = warpQ(p);
float r = length(q);
float a = atan(q.y, q.x);
// the broad folds of the petals, as a surface slope (in field units per px)
vec2 qx = warpQ(p + vec2(e, 0.0)), qy = warpQ(p + vec2(0.0, e));
float m0 = macroAt(q);
vec2 mg = vec2(macroAt(qx) - m0, macroAt(qy) - m0) / e * S;
// grooves at about the same spacing in pixels on every screen; on load they unfurl from the heart
float N = uDensity * (S / 430.0) * mix(0.3, 1.0, uIntro);
float v = f * N;
// band-limited ridges: contrast falls smoothly with how many grooves fit in one pixel (no shimmer),
// and the grooves melt into the glowing heart instead of shrinking into tiny rings
float wpx = gl * N / uDpr;
float keep = clamp(1.0 - wpx * 1.6, 0.0, 1.0);
keep *= keep * smoothstep(0.03, 0.16, r);
float c = cos(v * 6.2831853);
float sn = sin(v * 6.2831853);
float hgt = 0.5 - 0.5 * c * keep;
vec2 slope = gdir * sn * 3.14159 * keep * 0.85 + mg * 0.9;
vec3 n = normalize(vec3(-slope, 1.0));
// lighting: a soft key from the upper left, a cool rim from below right, the cursor as a lamp
vec3 Lk = normalize(vec3(-0.55, -0.6, 0.6));
vec3 Lr = normalize(vec3(0.6, 0.55, 0.45));
vec3 Lm = normalize(vec3((uMouse - p) / S, 0.55));
vec3 V = vec3(0.0, 0.0, 1.0);
float lamK = max(dot(n, Lk), 0.0);
float lamR = max(dot(n, Lr), 0.0);
float near = exp(-dot((p - uMouse) / S, (p - uMouse) / S) / 0.35) * uHover;
// highlights wide enough to stay smooth along each crest (narrow ones break into dots)
float specK = pow(max(dot(n, normalize(Lk + V)), 0.0), 18.0);
float specM = pow(max(dot(n, normalize(Lm + V)), 0.0), 22.0) * near;
// colour: violet through the bloom, the accent pooling in the folds between petals
float pet = petalsAt(a, r);
float acc = smoothstep(0.2, -0.8, pet) * smoothstep(0.1, 0.45, r) * smoothstep(0.25, 0.75, noise(q * 1.6 + 4.0));
vec3 base = mix(uColor, uAccent, acc * 0.8);
// deep valleys between grooves, like the reference: near black
float ao = mix(0.05, 1.0, pow(hgt, 1.1));
vec3 col = base * (0.16 + 1.25 * lamK + 0.4 * lamR) * ao;
col += uHi * (specK * 0.85 + specM * 0.8) * (0.3 + 0.7 * hgt) * mix(0.5, 1.0, keep);
// the heart: a soft lavender glow with fine tangled filaments, around a small dark well
float fil = 0.5 + 0.5 * sin(a * 5.0 + r * 40.0 + noise(q * 18.0 + uTime * 0.05) * 6.0);
fil = pow(fil, 6.0) * smoothstep(0.22, 0.05, r);
col += mix(uColor, uHi, 0.3) * exp(-r * r / 0.012) * 0.5;
col += mix(uColor, uHi, 0.6) * fil * 0.28;
col *= smoothstep(0.006, 0.03, r);
col += uHi * uFlash * 0.1 * hgt;
col = max(col, uBg);
col += (h21(gl_FragCoord.xy) - 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.6, 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.1);
col += (h(gl_FragCoord.xy) - 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];
}
export function GrooveBloom({
color = "#6a5cff",
accent = "#7ee8ff",
highlight = "#f1e6ff",
background = "#04040c",
petals = 7,
density = 30,
speed = 1,
glow = 0.6,
interactive = true,
scroller,
children,
className,
}: GrooveBloomProps) {
const hostRef = useRef<HTMLDivElement>(null);
const props = useRef({ color, accent, highlight, background, petals, density, speed, glow, interactive });
const redraw = useRef<(() => void) | null>(null);
useEffect(() => {
props.current = { color, accent, highlight, background, petals, density, speed, glow, interactive };
redraw.current?.();
}, [color, accent, highlight, background, petals, density, speed, 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.background = `repeating-radial-gradient(circle at 50% 50%, ${p.color}55 0 3px, ${p.background} 3px 9px), ${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", "uMouse", "uCenter", "uDpr", "uTime", "uHover", "uIntro", "uTwist", "uPetals", "uDensity", "uFlash",
"uColor", "uAccent", "uHi", "uBg", "uWave",
]);
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;
};
let w = 1, h = 1, dpr = 1, rs = 1;
const resize = () => {
dpr = Math.min(window.devicePixelRatio || 1, 1.5);
w = Math.max(1, host.clientWidth);
h = Math.max(1, host.clientHeight);
canvas.width = Math.round(w * dpr);
canvas.height = Math.round(h * dpr);
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)),
};
};
resize();
const s = { intro: still ? 1 : 0, mx: -9999, my: -9999, hover: 0, cx: 0, cy: 0, twist: 0, flash: 0 };
s.cx = w / 2;
s.cy = h / 2;
let flow = still ? 6 : 0;
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;
const X = T;
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.uMouse, s.mx, s.my);
gl.uniform2f(US.uCenter, s.cx, s.cy);
gl.uniform1f(US.uDpr, dpr * (X.scene.w / canvas.width));
gl.uniform1f(US.uTime, flow);
gl.uniform1f(US.uHover, s.hover);
gl.uniform1f(US.uIntro, s.intro);
gl.uniform1f(US.uTwist, s.twist);
gl.uniform1f(US.uPetals, Math.max(2, Math.round(p.petals)));
gl.uniform1f(US.uDensity, Math.max(8, p.density));
gl.uniform1f(US.uFlash, s.flash);
gl.uniform3fv(US.uColor, rgb(p.color));
gl.uniform3fv(US.uAccent, rgb(p.accent));
gl.uniform3fv(US.uHi, rgb(p.highlight));
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));
gl.uniform1f(UC.uTime, flow);
drawQuad();
gl.activeTexture(gl.TEXTURE0);
};
const ro = new ResizeObserver(() => {
resize();
if (!s.hover) {
s.cx = w / 2;
s.cy = h / 2;
}
draw();
});
ro.observe(host);
if (still) {
draw();
redraw.current = draw;
return () => {
redraw.current = null;
ro.disconnect();
freeTargets();
canvas.remove();
gl.getExtension("WEBGL_lose_context")?.loseContext();
};
}
// ---- on load: the rings unfurl out of the heart ----
const intro = gsap.to(s, { intro: 1, duration: 2.8, ease: "expo.out", delay: 0.1 });
// ---- cursor: a lens that bends the grooves; the heart leans toward you ----
const mxTo = gsap.quickTo(s, "mx", { duration: 0.6, ease: "power3" });
const myTo = gsap.quickTo(s, "my", { duration: 0.6, ease: "power3" });
const cxTo = gsap.quickTo(s, "cx", { duration: 1.8, ease: "power3" });
const cyTo = gsap.quickTo(s, "cy", { duration: 1.8, ease: "power3" });
const hoverTo = gsap.quickTo(s, "hover", { duration: 0.9, ease: "sine.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);
cxTo(w / 2 + (p.x - w / 2) * 0.18);
cyTo(h / 2 + (p.y - h / 2) * 0.18);
hoverTo(1);
};
const leave = () => {
first = true;
hoverTo(0);
cxTo(w / 2);
cyTo(h / 2);
};
// ---- click: a pulse rolling out through the rings ----
const down = (e: PointerEvent) => {
if (!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();
gsap.killTweensOf(s, "flash");
gsap.timeline().to(s, { flash: 1, duration: 0.3, ease: "sine.out" }).to(s, { flash: 0, duration: 1.3, ease: "sine.inOut" });
};
host.addEventListener("pointermove", move);
host.addEventListener("pointerleave", leave);
host.addEventListener("pointerdown", down);
// ---- scroll: the petals twist into a spiral ----
const twistTo = gsap.quickTo(s, "twist", { duration: 1.4, ease: "power3" });
const st = ScrollTrigger.create({
trigger: host,
scroller: scroller ?? undefined,
start: "top bottom",
end: "bottom top",
onUpdate: (self) => {
if (props.current.interactive) twistTo((self.progress - 0.5) * 1.6);
},
});
// ---- loop ----
let visible = true;
let prev = performance.now();
let slow = 0, lastScale = performance.now();
const loop = () => {
const t = performance.now();
const dt = Math.min(0.05, (t - prev) / 1000);
prev = t;
if (!visible) return;
slow = slow * 0.95 + (dt > 0.0175 ? 0.05 : 0);
if (t - lastScale > 1200) {
if (slow > 0.5 && rs === 1) {
rs = 0.8;
lastScale = t;
resize();
}
}
flow += dt * props.current.speed;
for (let i = waves.length - 1; i >= 0; i--) if (flow - waves[i].t > 3.1) waves.splice(i, 1);
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);
freeTargets();
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 GrooveBloom;
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 propscolorstringMain colour of the grooves.default "#6a5cff"default "#6a5cff"accentstringAccent colour pooling between the petals.default "#7ee8ff"default "#7ee8ff"highlightstringColour of the highlights on the ridges.default "#f1e6ff"default "#f1e6ff"backgroundstringBackground colour (the deepest valleys and the heart).default "#04040c"default "#04040c"petalsnumberNumber of petals.default 7default 7densitynumberHow many grooves, roughly, from the heart to the edge.default 30default 30speednumberSpeed of the breathing.default 1default 1glownumberStrength of the bloom on the highlights.default 0.6default 0.6interactivebooleanCursor lens and light, click pulse, scroll twist.default truedefault truescrollerElement | nullScroll container, if the page does not scroll the window.childrenReactNodeForeground content, drawn above the bloom.classNamestringSize it, e.g. h-screen w-full.