Layout Swap
Headlines swap by shifting layout, each new line growing out of the one before. A free, MIT-licensed Remotion text animation.
$ pnpm dlx shadcn@latest add @remocn/layout-swapUsage
// src/Root.tsx
import { Composition } from "remotion";
import { LayoutSwap } from "@/components/remocn/layout-swap";
const LayoutSwapScene = () => (
<LayoutSwap headlines={["Animations.", "Animations, transitions, backgrounds."]} highlight="backgrounds." align="left" />
);
export const RemotionRoot = () => (
<Composition
id="LayoutSwap"
component={LayoutSwapScene}
durationInFrames={340}
fps={60}
width={1280}
height={720}
/>
);Each headline in headlines replaces the last by sliding its shared words into the new layout, and the highlight phrase lands in the accent color. Pass headlines and tune hold and move for pacing. It ships in light and dark through the theme prop.
Props14
| Prop | Type | Default |
|---|---|---|
| headlines | string[]— Headlines in order; each builds on the previous. | |
| highlight | string"ready to install." Phrase in the last headline lit in the accent color. | |
| align | "center" | "left""center" Text alignment of the headline block. | |
| hold | number28 Frames each headline holds before moving. | |
| move | number28 Frames the layout shift between headlines takes. | |
| fontWeight | number500 Weight of the headlines. | |
| accent | string"#3B5BFD" Accent color override; falls back to the theme accent. | |
| ink | string— Text color; overrides the theme ink. | |
| background | string— Background color override; falls back to the theme background. | |
| fontFamily | string"Inter Tight" Typeface for the copy. Load the font in your project first. | |
| 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. | |
| theme | "dark" | "light""dark" Ships light and dark; picks the palette. | |
- headlinesstring[]
Headlines in order; each builds on the previous.
- highlightstring
Phrase in the last headline lit in the accent color.
Default
"ready to install." - align"center" | "left"
Text alignment of the headline block.
Default
"center" - holdnumber
Frames each headline holds before moving.
Default
28 - movenumber
Frames the layout shift between headlines takes.
Default
28 - fontWeightnumber
Weight of the headlines.
Default
500 - accentstring
Accent color override; falls back to the theme accent.
Default
"#3B5BFD" - inkstring
Text color; overrides the theme ink.
- backgroundstring
Background color override; falls back to the theme background.
- fontFamilystring
Typeface for the copy. Load the font in your project first.
Default
"Inter Tight" - scalenumber
Size of the foreground around the frame's center; the background stays put.
Default
1 - delaynumber
Frames to hold the first frame before anything moves.
Default
0 - speednumber
Playback speed multiplier for the whole timeline.
Default
1 - theme"dark" | "light"
Ships light and dark; picks the palette.
Default
"dark"