Skip to content

Particle Typography

Text sampled into thousands of particles that scatter from your cursor.

WebGLTypeScriptLight + AMOLED
Example.tsx
import { Typography3D } from "@/components/3d/typography";

export default function Example() {
  return (
    <div style={{ height: 320 }}>
      <Typography3D
        variant="particle"
        theme="light"
      />
    </div>
  );
}

Deps: three, @react-three/fiber, @react-three/drei, framer-motion

Installation

Install the runtime dependencies, then copy the component module (and the shared 3D core when the component uses WebGL).

terminal
npm install three @react-three/fiber @react-three/drei framer-motion

# Copy the component module
cp -r src/components/3d/typography <your-project>/src/components/3d/typography
# Copy the shared 3D core
cp -r src/components/3d/core <your-project>/src/components/3d/core

Dependencies: three, @react-three/fiber, @react-three/drei, framer-motion

Usage

Every category module exposes one typed component. Pick an implementation with variant and pass props grouped by concern.

Example.tsx
import { Typography3D } from "@/components/3d/typography";

export default function Example() {
  return (
    <div style={{ height: 320 }}>
      <Typography3D
        variant="particle"
        theme="light"
      />
    </div>
  );
}

React implementation

With every prop set explicitly. The complete, copyable source of src/components/3d/typography/index.tsx is available in the playground’s Source tab.

Example.tsx
import { Typography3D } from "@/components/3d/typography";

export default function Example() {
  return (
    <div style={{ height: 320 }}>
      <Typography3D
        variant="particle"
        theme="amoled"
        text="NEXUS"
        font="Helvetica"
        weight="bold"
        depth={0.35}
        bevel={0.02}
        color="#7777ff"
        rotation={0}
        speed={1}
        light={1}
        glow={1}
        mouse
        cameraMotion={0.3}
        transparent={false}
        quality="medium"
      />
    </div>
  );
}

Next.js implementation

WebGL needs the browser. Load the scene through next/dynamic with ssr disabled and a sized placeholder to avoid layout shift.

app/particle-typography/page.tsx
// app/particle-typography/page.tsx  (Next.js App Router)
"use client";

import dynamic from "next/dynamic";

// WebGL must never run on the server — load the scene client-side only.
const Typography3D = dynamic(
  () => import("@/components/3d/typography").then((m) => m.Typography3D),
  { ssr: false, loading: () => <div aria-busy="true" style={{ height: 320 }} /> },
);

export default function Page() {
  return (
    <main>
      <div style={{ height: 320 }}>
        <Typography3D
          variant="particle"
          theme="light"
        />
      </div>
    </main>
  );
}

TypeScript interfaces

ParticleTypography.types.ts
export type Theme = "light" | "amoled";

export interface ParticleTypographyProps {
  /** Which 3D Typography implementation to render */
  variant: "particle";
  theme: Theme;

  /* Content */
  text?: string; // default "NEXUS"

  /* Visual */
  font?: "Helvetica" | "Humanist" | "Serif" | "Mono"; // default "Helvetica"
  weight?: "regular" | "bold"; // default "bold"
  depth?: number; // 0.05–1.2, default 0.35
  bevel?: number; // 0–0.08, default 0.02
  color?: string; // default "#7777ff"

  /* Camera */
  rotation?: number; // -90–90, default 0
  cameraMotion?: number; // 0–1, default 0.3

  /* Animation */
  speed?: number; // 0–3, default 1

  /* Lighting */
  light?: number; // 0–3, default 1
  glow?: number; // 0–3, default 1

  /* Interaction */
  mouse?: boolean; // default true

  /* Rendering */
  transparent?: boolean; // default false
  quality?: "low" | "medium" | "high"; // default "medium"
}

Props reference

PropTypeDefaultGroupDescription
variant"particle"—CoreSelects the implementation.
theme"light" | "amoled"—CoreThemes surfaces, materials and lighting.
textstring"NEXUS"ContentText
font"Helvetica" | "Humanist" | "Serif" | "Mono""Helvetica"VisualFont
weight"regular" | "bold""bold"VisualFont weight
depthnumber0.35VisualExtrusion depth (0.05 – 1.2)
bevelnumber0.02VisualBevel (0 – 0.08)
colorstring (hex)"#7777ff"VisualColor
rotationnumber0CameraRotation Y (°) (-90 – 90)
speednumber1AnimationAnimation speed (0 – 3)
lightnumber1LightingLight intensity (0 – 3)
glownumber1LightingEmissive glow (0 – 3)
mousebooleantrueInteractionMouse interaction
cameraMotionnumber0.3CameraCamera movement (0 – 1)
transparentbooleanfalseRenderingTransparent background
quality"low" | "medium" | "high""medium"RenderingQuality preset

Customization

Colour props accept any hex string. Content props accept plain strings. Every value shown in the playground maps 1:1 to a prop, so you can design visually and copy the generated code. Use Share to send a pre-configured link or Export to download the configuration JSON.

Customized.tsx
import { Typography3D } from "@/components/3d/typography";

export default function Example() {
  return (
    <div style={{ height: 320 }}>
      <Typography3D
        variant="particle"
        theme="light"
        color="#ff5a36"
      />
    </div>
  );
}

Animation settings

  • speedAnimation speed · 0–3
  • mouseMouse interaction

All motion is suspended when prefers-reduced-motion is on.

Theme support

Pass theme="light" or theme="amoled". Lighting rigs, environment reflections, blending modes and canvas backgrounds change with it — AMOLED uses true #000000 with controlled emissive accents; Light uses soft studio lighting with contact shadows. Use the theme switch in the playground toolbar to preview both.

Responsive behavior

The component fills its parent, so size it with the container. Use the playground’s desktop / tablet / mobile selector to test. Canvas resolution adapts through the adaptive DPR range of the active quality preset.

Accessibility notes

  • — WebGL text is exposed through an aria-label that mirrors the string.
  • — DOM variants keep real text nodes, so selection and screen readers work.
  • — Animated morphing exposes the final word via aria-live.

Performance notes

  • — Typeface JSON is fetched once and cached; curve segments scale with quality.
  • — Particle typography samples a 2D canvas once and animates in a vertex shader.
  • — Prefer short strings — extrusion cost grows with glyph count.

Presets: LOW (DPR 1, no AA, ~35% density) · MEDIUM (DPR ≤1.5, ~70%) · HIGH (DPR ≤2, full density).