Modus UI

Grain Swell

Web (React)

A flowing field resolved through a dot screen, inked in your theme on the page ground.

A flowing field resolved through a dot matrix, inked from theme tokens: ripple draws a soft two-tone dot screen, swell a Three.js point field rising from ground to crest. Light mode sets ink dots on paper, dark mode lifts them off the dark ground. It fills its positioned parent, re-reads the theme when the mode or palette changes, pauses when off screen and stays still when the user prefers reduced motion.

Modus / Grain Swell

Installation

CLI

npx @modus-ui/cli add grain-swell

Manual

  1. Install three.
  2. Copy the code from the component tab.
  3. Create a file at components/ui/grain-swell.tsx.
  4. Paste the code.

Usage

tsx
import { GrainSwell } from "@/components/ui/grain-swell";

export default function Example() {
  return (
    <div className="relative h-[500px] w-full overflow-hidden">
      <GrainSwell />
    </div>
  );
}

Props

PropTypeDefaultDescription
variant"ripple" | "swell""ripple"Which dot renderer to show.
speednumber1Animation speed multiplier.
sizenumber1Point size multiplier (swell).
lengthnumber1Wave frequency multiplier (swell).
densitynumber1Point density (swell).
opacitynumber1Canvas opacity (swell).
huenumber0Hue rotation in degrees.
saturationnumber1Saturation multiplier.
brightnessnumber1Brightness multiplier.
colorsstring[]Theme inks per variantInk colours: ground, body and crest for swell; top and bottom for ripple.
backgroundColorstringhsl(var(--background))Colour behind the dots, any CSS colour.

Comments

  • No comments yet.