Particle Text

Loading-ring canvas particles that slowly resolve into solid letterforms.

textcanvasparticlesheadlineanimationtypographymagnetic
Particle Text component preview

Overview

Particle Text is a React and Tailwind CSS text effect that draws a headline as a cloud of dots on canvas, in Next.js or any React app, with no dependencies. Particles spin on a loading ring, then resolve into the letterforms, with optional drift and a magnetic cursor pull. The loop stops once dots settle or leave the screen, and reduced motion paints the finished word. The real string sits in a screen reader span, and as can make it a heading. Glyphs are sampled without waiting for web fonts, so bump replayKey after a custom font loads.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add canvas-text

Usage

Import CanvasText from @/components/wensity/canvas-text and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { CanvasText } from "@/components/wensity/canvas-text";
export default function Example() {
return (
<CanvasText
text="Wensity"
fontSize={72}
density={2}
scatter={64}
loadDuration={1}
morphDuration={1.4}
magnetic={0.45}
className="h-[200px]"
/>
);
}

Props

PropTypeDefaultDescription
textstring-The string to rasterize into particles.
colorstringcurrentColorParticle fill. Omit to inherit the host text color.
fontSizenumber64Font size in CSS pixels used when sampling glyphs.
particleSizenumber1.6Particle diameter in CSS pixels.
densitynumber2Sampling stride (1 = densest). Higher = fewer particles.
driftnumber0Optional idle wobble after settle, in CSS pixels. 0 keeps a locked symmetrical lattice.
scatternumber48Loading-ring radius in CSS pixels.
loadDurationnumber1Seconds spent spinning on the loading ring before morph starts.
morphDurationnumber1.4Seconds for the ring → text morph.
magneticnumber0.35Pointer warp strength. 0 disables magnetism.
magneticRadiusnumber100Radius of pointer influence in CSS pixels.
pausedboolean-Force the loop paused. When omitted, auto-pauses off-screen or when the tab is hidden.
replayKeystring | number-Bump to re-run the scatter → assemble intro.
as"p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6""div"Element to render. A heading tag keeps heading semantics; the default is announced as an image.

Featured in React hero section components.