Width Lock
A condensed line keeps a fixed width while one word swaps through a list. A free, MIT-licensed Remotion text animation.
$ pnpm dlx shadcn@latest add @remocn/width-lockUsage
// src/Root.tsx
import { Composition } from "remotion";
import { WidthLock } from "@/components/remocn/width-lock";
const WidthLockScene = () => (
<WidthLock before="Ship the" words={["trailer", "captions", "launch video"]} after="by tonight." />
);
export const RemotionRoot = () => (
<Composition
id="WidthLock"
component={WidthLockScene}
durationInFrames={340}
fps={60}
width={1280}
height={720}
/>
);The line holds a constant width while the middle word swaps through each entry in words. Pass before, words and after, and set hold for how long each word stays. It ships in light and dark through the theme prop.
Props14
| Prop | Type | Default |
|---|---|---|
| before | string"Ship the" Text before the swapping word. | |
| words | string[]— Words swapped in order. | |
| after | string"by tonight." Text after the swapping word. | |
| hold | number30 Frames each state stays on screen before the next one. | |
| fontWeight | number480 Weight of the lines on the variable weight axis. | |
| 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"Roboto Flex" 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. | |
| grain | booleantrue Film grain over the scene. | |
| speed | number1 Playback speed multiplier for the whole timeline. | |
| theme | "dark" | "light""dark" Ships light and dark; picks the palette. | |
- beforestring
Text before the swapping word.
Default
"Ship the" - wordsstring[]
Words swapped in order.
- afterstring
Text after the swapping word.
Default
"by tonight." - holdnumber
Frames each state stays on screen before the next one.
Default
30 - fontWeightnumber
Weight of the lines on the variable weight axis.
Default
480 - 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
"Roboto Flex" - 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 - grainboolean
Film grain over the scene.
Default
true - speednumber
Playback speed multiplier for the whole timeline.
Default
1 - theme"dark" | "light"
Ships light and dark; picks the palette.
Default
"dark"