OPUS/UI

Navigation

Fluid

hot

Real-time Navier–Stokes ink on the GPU: semi-Lagrangian advection, vorticity confinement, a 20-iteration Jacobi pressure solve and dye with fake lighting. Drag to stir, click to burst, or leave it to paint itself.

webgl2simulationpointerclick5 files · 726 locdeps: clsx, tailwind-merge

Installation

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

npx shadcn@latest add https://opusui.131199999.xyz/r/fluid.json

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

node ../tailwind_component/opus55/scripts/add.mjs fluid

Usage

import { Fluid } from "@/components/opus/backgrounds/fluid";

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

Examples

Behind a hero

Text sits on top — the fluid still reacts because the pointer is tracked on window.

Navier–Stokes · WebGL2

Stir the page.

Drag anywhere. Click for a burst. The text uses mix-blend-difference so it stays legible over any colour.

API

PropTypeDefaultDescription
colorsstring[]—Dye palette cycled per stroke. Pass [] for a rainbow.
backgroundstring"#04040a"Colour under the dye.
curlnumber28Vorticity confinement — how swirly the flow is.
dissipationnumber0.9How fast the dye fades.
viscositynumber0.25How fast motion dies down.
radius / forcenumber0.22 / 1Splat size and strength.
shadingbooleantrueFake lighting from the dye gradient.
autoplaybooleantrueAmbient splats while nobody interacts.
simResolution / dyeResolutionnumber128 / 720Grid sizes (short side). Lower for weak GPUs.
interactive / className / children——As for every OPUS background.

Notes

  • A real GPU simulation: ping-pong framebuffers in half-float textures (WebGL2 + EXT_color_buffer_float/half_float).
  • Pauses off-screen / in hidden tabs. Falls back to a static gradient without WebGL2.
  • prefers-reduced-motion: reduce disables the automatic motion; only your own input moves it.

Command palette