Magnet Letters

A magnet pulls a wrong word into line, then repels it, and the right word drops in. A free, MIT-licensed Remotion text animation.

Installation
$ pnpm dlx shadcn@latest add @remocn/magnet-letters

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { MagnetLetters } from "@/components/remocn/magnet-letters";
 
const MagnetLettersScene = () => (
  <MagnetLetters before="Ship " wrongWord="someday" word="today" after="." />
);
 
export const RemotionRoot = () => (
  <Composition
    id="MagnetLetters"
    component={MagnetLettersScene}
    durationInFrames={510}
    fps={60}
    width={1280}
    height={720}
  />
);

A sentence settles in, a horseshoe magnet sweeps across the wrong word and lines its scattered letters up, then repels it off the line. The sentence reflows and the right word drops in letter by letter before the magnet leaves. Pass before, word, after and wrongWord. It takes a theme prop and ships light and dark.

Props13

PropTypeDefault
before
string"Launch "

Text before the word that gets swapped. Keep the trailing space.

word
string"videos"

The right word. It drops in once the wrong one is repelled.

after
string", in code."

Text after the swapped word.

wrongWord
string"slides"

The wrong word the magnet pulls into line first, then repels.

stagger
number4

Frames between letters of the right word dropping in.

accent
string"#3B5BFD"

Magnet body, landing ticks and the right word.

ink
string—

Text color; overrides the theme ink.

background
string—

Background fill; pass "transparent" to drop it.

fontFamily
string"Figtree"

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

theme
"dark" | "light""dark"

Light or dark ground; the component ships both.

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 for the whole timeline.

  • beforestring

    Text before the word that gets swapped. Keep the trailing space.

    Default"Launch "

  • wordstring

    The right word. It drops in once the wrong one is repelled.

    Default"videos"

  • afterstring

    Text after the swapped word.

    Default", in code."

  • wrongWordstring

    The wrong word the magnet pulls into line first, then repels.

    Default"slides"

  • staggernumber

    Frames between letters of the right word dropping in.

    Default4

  • accentstring

    Magnet body, landing ticks and the right word.

    Default"#3B5BFD"

  • inkstring

    Text color; overrides the theme ink.

  • backgroundstring

    Background fill; pass "transparent" to drop it.

  • fontFamilystring

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

    Default"Figtree"

  • theme"dark" | "light"

    Light or dark ground; the component ships both.

    Default"dark"

  • 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 for the whole timeline.

    Default1