OPUS/UI

Navigation

Flow Field

new

Thousands of particles riding the curl of a Perlin field — divergence-free, so streams never clump — leaving silky colour trails. The pointer is a vortex every stream bends around.

canvasparticlescurl-noisepointer5 files · 424 locdeps: clsx, tailwind-merge

Installation

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

npx shadcn@latest add https://opusui.131199999.xyz/r/flow-field.json

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

node ../tailwind_component/opus55/scripts/add.mjs flow-field

Usage

import { FlowField } from "@/components/opus/backgrounds/flow-field";

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

API

PropTypeDefaultDescription
colorsstring[]—Gradient sampled by each particle’s heading.
countnumber1800Particles (max 6000).
scalenumber1.4Noise zoom.
trailnumber0.93Trail persistence (0.8–0.995).
weightnumber1.1Stroke width (px).
interactivebooleantrueReact to the pointer (tracked on window).
classNamestring—Wrapper classes — `absolute inset-0` to fill a relative parent.
childrenReactNode—Optional content rendered above the canvas.

Notes

  • Canvas 2D with a device-pixel-ratio aware backing store (capped at 2×).
  • The animation loop stops off-screen and in hidden tabs; resize re-seeds the scene.
  • prefers-reduced-motion: reduce draws a single static frame.

Command palette