Modus UI

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.

Modus / Shifting Swarm

Installation

CLI

npx @modus-ui/cli add shifting-swarm

Manual

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

Usage

tsx
import { ShiftingSwarm } from "@/components/ui/shifting-swarm";

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

Props

PropTypeDefaultDescription
fromPathstring"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.
toPathstring"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.
scalenumber1Scales the drawing (clamped 0.65–1.5).
opacitynumber1Overall opacity (clamped 0.1–1).
huenumber0Hue rotation in degrees (clamped -180–180).
saturationnumber1Saturation multiplier (clamped 0–2).
brightnessnumber1Brightness multiplier (clamped 0.4–1.8).
inkColorstringTheme ramp (--muted-foreground → --primary)Colour of the type, any CSS colour.
backgroundColorstringhsl(var(--background))Ground colour, any CSS colour.

Comments

  • No comments yet.