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.
Installation
CLI
npx @modus-ui/cli add grain-swellManual
- Install
three. - Copy the code from the component tab.
- Create a file at
components/ui/grain-swell.tsx. - Paste the code.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "ripple" | "swell" | "ripple" | Which dot renderer to show. |
speed | number | 1 | Animation speed multiplier. |
size | number | 1 | Point size multiplier (swell). |
length | number | 1 | Wave frequency multiplier (swell). |
density | number | 1 | Point density (swell). |
opacity | number | 1 | Canvas opacity (swell). |
hue | number | 0 | Hue rotation in degrees. |
saturation | number | 1 | Saturation multiplier. |
brightness | number | 1 | Brightness multiplier. |
colors | string[] | Theme inks per variant | Ink colours: ground, body and crest for swell; top and bottom for ripple. |
backgroundColor | string | hsl(var(--background)) | Colour behind the dots, any CSS colour. |
Comments