Skip to content

Text Reveal Animation

Per-letter masked 3D reveal with replay.

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

export default function Example() {
  return (
    <div style={{ height: 320 }}>
      <Typography3D
        variant="reveal"
        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

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="reveal"
        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="reveal"
        theme="amoled"
        text="Build beyond"
        color="#7777ff"
        speed={1}
      />
    </div>
  );
}

Next.js implementation

This component is DOM based, but it is still code-split with next/dynamic so interaction code ships only where it's used.

app/text-reveal-animation/page.tsx
// app/text-reveal-animation/page.tsx  (Next.js App Router)
"use client";

import dynamic from "next/dynamic";

// Heavy interactive code is split into its own chunk.
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="reveal"
          theme="light"
        />
      </div>
    </main>
  );
}

TypeScript interfaces

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

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

  /* Content */
  text?: string; // default "Build beyond"

  /* Visual */
  color?: string; // default "#7777ff"

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

Props reference

PropTypeDefaultGroupDescription
variant"reveal"—CoreSelects the implementation.
theme"light" | "amoled"—CoreThemes surfaces, materials and lighting.
textstring"Build beyond"ContentText
colorstring (hex)"#7777ff"VisualColor
speednumber1AnimationAnimation speed (0 – 3)

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="reveal"
        theme="light"
        color="#ff5a36"
      />
    </div>
  );
}

Animation settings

  • speedAnimation speed · 0–3

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

Theme support

Pass theme="light" or theme="amoled". Surfaces, borders, shadows and text switch via CSS variables (--bg, --card, --fg, --border, --accent). AMOLED uses true #000000. 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. Layouts use fluid widths and container-relative sizing.

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.