Block Swap

A solid block wipes over each line and the next line replaces it, ending with a highlighted word on a pill. A free, MIT-licensed Remotion text animation.

Installation
$ pnpm dlx shadcn@latest add @remocn/block-swap

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { BlockSwap } from "@/components/remocn/block-swap";
 
const BlockSwapScene = () => (
  <BlockSwap
    lines={["Pick the beats you need.", "Render the launch."]}
    highlight="launch"
    accent="#3B5BFD"
  />
);
 
export const RemotionRoot = () => (
  <Composition
    id="BlockSwap"
    component={BlockSwapScene}
    durationInFrames={300}
    fps={60}
    width={1280}
    height={720}
  />
);

Each word of the first line is covered by a block that morphs into the next line, then uncovers the new words. The last line keeps highlight on a gradient pill. Pass lines as an array of sentences and highlight as the word to call out; it ships light and dark through theme.

Props12

PropTypeDefault
lines
string[]DEFAULT_LINES

Sentences shown in order; each one overwrites the previous

highlight
string"launch"

Word in the last line that lands on the gradient pill

accent
string"#3B5BFD"

Accent color (any valid CSS color)

ink
string—

Text and block color; overrides the theme ink.

background
string—

Overrides the theme's stage color

fontFamily
string"Space Grotesk"

Typeface for the copy. Load the font in your project first.

hold
number14

Frames each line holds before the blocks cover it.

radius
number0.2

Corner radius of the blocks, in em of the line size.

scale
number1

Size of the foreground around the frame's center; the background stays put.

delay
number0

Frames to hold the first frame before anything moves.

speed
number1

Playback speed multiplier

theme
"dark" | "light""dark"

Ships light and dark palettes

  • linesstring[]

    Sentences shown in order; each one overwrites the previous

    DefaultDEFAULT_LINES

  • highlightstring

    Word in the last line that lands on the gradient pill

    Default"launch"

  • accentstring

    Accent color (any valid CSS color)

    Default"#3B5BFD"

  • inkstring

    Text and block color; overrides the theme ink.

  • backgroundstring

    Overrides the theme's stage color

  • fontFamilystring

    Typeface for the copy. Load the font in your project first.

    Default"Space Grotesk"

  • holdnumber

    Frames each line holds before the blocks cover it.

    Default14

  • radiusnumber

    Corner radius of the blocks, in em of the line size.

    Default0.2

  • scalenumber

    Size of the foreground around the frame's center; the background stays put.

    Default1

  • delaynumber

    Frames to hold the first frame before anything moves.

    Default0

  • speednumber

    Playback speed multiplier

    Default1

  • theme"dark" | "light"

    Ships light and dark palettes

    Default"dark"