CrazyGLCrazyGLHomeExploreGitHubBrowse heroesLoading hero…← Back to gallery@crazygl/text-swap-animation

Text Swap Animation

Phrases swap with a clean two-layer flip — old rises and fades, new rises in from below. The cleanest possible rotator.

ReactFont#swap#transition#typography

Usage

import TextSwapAnimation from '@crazygl/hero-text-swap-animation';

export default function Page() {
  return (
    <TextSwapAnimation
      phrases={'Design intentional.\nShip ruthlessly.\nIterate forever.'}
      holdMs={1800}
      transitMs={480}
      textColor="#ffffff"
      fontSize={88}
    />
  );
}

Customise

  • Contentphrases (one line per phrase), holdMs (dwell time), transitMs (swap duration).
  • TypetextColor, fontSize, maxWidth, textAlign, lineHeight, letterSpacing, headingFontFamily, headingFontWeight.
  • BackdroptransparentBackground, bgColor.

Best for

  • SaaS / landing headlines that cycle a value proposition.
  • Portfolio or agency intros that rotate a few taglines.
  • Anywhere you want a minimal, distraction-free animated headline.
01 · Install the package

One command, zero config.

npm install @crazygl/hero-text-swap-animation
02 · Render the component

Import once, drop it in.

The component takes the same props you see in the live customizer on the right — every default ships poster-quality.

hero.tsx
import TextSwapAnimation from '@crazygl/hero-text-swap-animation';

export default function Landing() {
  return (
    <TextSwapAnimation />
  );
}
03 · Use it in a page

SSR-safe by default.

The wrapper renders static HTML on the server and only initialises the canvas after hydration, so search engines see your copy.

page.tsx
// app/page.tsx — works in SSR-first frameworks (Next, Remix, Astro, etc.)
'use client';

import TextSwapAnimation from '@crazygl/hero-text-swap-animation';

export default function Page() {
  return (
    <section>
      <TextSwapAnimation
        heading="Say hi."
        subheading="Your new hero."
      />
      <article>
        <h2>Welcome</h2>
        <p>Your content keeps its own voice below the hero.</p>
      </article>
    </section>
  );
}
You might also like

Similar heroes

Letter Morph

Heading where each letter cross-fades and morphs through the next phrase — letters that match stay, letters that don't blur-swap.

Text Rotation

A static prefix with a vertical slot-machine rotator behind it — each word slides up, settles, and the next one rises into place.

Gradient Text

Heading filled with a slowly drifting multi-stop linear gradient — three configurable colours, customizable angle, optional animation.

Text Scrambler

Heading that scrambles into glyph soup and resolves left-to-right into the target phrase — a hacker-decode reveal that rotates through several phrases.

Rotating Text Pro

Slot machine with a 3D flip in X — the rotating word flips over a horizontal axis like a split-flap board.

Text Hover Reveal

Each item shows a default heading; on hover the heading scrolls up and a secondary line scrolls in from below — list-of-services interaction.
Live customizer

Text Swap Animation

Hold (ms)1800msTransition (ms)480msText colourFont size88pxMax width540pxWrap phrases at this width. Smaller values force the text onto multiple lines; the slot height grows to fit the tallest phrase.AlignmentLine height1.1Letter spacing-0.02emFontWeight700Transparent backgroundBackground
CrazyGL · crazygl.comProgrammable hero sections for real websites.