OPUS/UI

Navigation

Mesh Gradient

hot

A Stripe-style liquid gradient: four colour centres orbit on Lissajous paths, blended in linear light through a two-stage domain warp. The pointer is a soft gravity well that drags the colours toward it.

webglpointergradientgrain6 files · 635 locdeps: clsx, tailwind-merge

Installation

With the shadcn CLI, pointing at this platform’s registry:

npx shadcn@latest add https://opusui.131199999.xyz/r/mesh-gradient.json

Or offline, straight from your opus55 checkout (copies every file it needs):

node ../tailwind_component/opus55/scripts/add.mjs mesh-gradient

Usage

import { MeshGradient } from "@/components/opus/backgrounds/mesh-gradient";

<MeshGradient colors={["#7c5cff", "#ff5ea8", "#22d3ee", "#0b1026"]} className="absolute inset-0" />

API

PropTypeDefaultDescription
colors[string, string, string, string]—Four hex colours; the last one tends to fill the edges.
warpnumber1Domain-warp strength — 0 calm, 2 liquid.
grainnumber0.06Animated film grain (0–0.2).
pullnumber1Strength of the pointer’s gravity well.
speednumber1Time multiplier. 0 freezes the animation; the pointer stays live.
interactivebooleantrueReact to the pointer (tracked on window, so overlaid content never blocks it).
classNamestring—Classes for the wrapper. Use `absolute inset-0` to fill a relative parent.
childrenReactNode—Optional content rendered above the canvas.

Notes

  • Renders with WebGL2 into a single full-screen triangle — no three.js, no textures, no dependencies.
  • Pauses automatically when scrolled off-screen or when the tab is hidden; resumes on return.
  • prefers-reduced-motion: reduce renders one still frame and ignores the pointer.
  • A CSS gradient fallback paints instantly and stays if WebGL2 is unavailable.

Command palette