Shifting Swarm
Web (React)
A swarm of serif glyphs filling one SVG mark that turns into another on click.
Two marks sharing a swarm of italic serif glyphs in your theme's ink, paired by angle so the change reads as a turn. It rests on the ring and turns into the spark. Click to switch, hover to push the glyphs aside. It fills its positioned parent, re-reads the theme when the mode or palette changes, pauses when off screen and renders a still frame when the user prefers reduced motion.
Installation
CLI
npx @modus-ui/cli add shifting-swarmManual
- Copy the code from the component tab.
- Create a file at
components/ui/shifting-swarm.tsx. - Paste the code.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
fromPath | string | "M12 2a10 10 0 1 1 0 20a10 10 0 1 1 0-20Zm0 5a5 5 0 1 0 0 10a5 5 0 1 0 0-10Z" | SVG path data (24×24 viewBox) of the resting mark. |
toPath | string | "M12 0C12.9 7 17 11.1 24 12C17 12.9 12.9 17 12 24C11.1 17 7 12.9 0 12C7 11.1 11.1 7 12 0Z" | SVG path data (24×24 viewBox) it morphs into. |
scale | number | 1 | Scales the drawing (clamped 0.65–1.5). |
opacity | number | 1 | Overall opacity (clamped 0.1–1). |
hue | number | 0 | Hue rotation in degrees (clamped -180–180). |
saturation | number | 1 | Saturation multiplier (clamped 0–2). |
brightness | number | 1 | Brightness multiplier (clamped 0.4–1.8). |
inkColor | string | Theme ramp (--muted-foreground → --primary) | Colour of the type, any CSS colour. |
backgroundColor | string | hsl(var(--background)) | Ground colour, any CSS colour. |
Comments