Modus UI

Drift Lines

Web (React)

Thousands of fine strokes drifting along a simplex-noise current, drawn in your theme's inks.

A canvas of particles tracing a 3D simplex-noise current, each leaving a fading stroke and parting gently around the pointer. The strokes are five inks on the theme's primary hue laid over the theme background, so it reads as pen work on paper in light mode and as light trails in dark mode, following the palette picker. It fills its positioned parent, pauses when off screen and renders a settled frame when the user prefers reduced motion.

Modus / Drift Lines

Installation

CLI

npx @modus-ui/cli add drift-lines

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/drift-lines.tsx.
  3. Paste the code.

Usage

tsx
import { DriftLines } from "@/components/ui/drift-lines";

export default function Example() {
  return (
    <div className="relative h-[500px] w-full overflow-hidden">
      <DriftLines />
      <div className="relative z-10 p-8">
        <h1>Content over the background</h1>
      </div>
    </div>
  );
}

Props

PropTypeDefaultDescription
speednumber1Animation speed multiplier.
sizenumber1Stroke width multiplier.
lengthnumber1Noise scale; higher values give longer, smoother curves.
densitynumber1Particle count multiplier (2500 at 1).
opacitynumber1Canvas opacity.
huenumber0Hue rotation in degrees.
saturationnumber1Saturation multiplier.
brightnessnumber1Brightness multiplier.
colorsstring[]theme inksPalette mapped across the noise field.
backgroundColorstringtheme backgroundBackground and trail fade colour.

Comments

  • No comments yet.