Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
---
title: Block Swap
description: "A solid block wipes over each line and the next line replaces it, ending with a highlighted word on a pill."
component: block-swap
vibe: clean
length: 120
useWhen:
- "A beat that rewrites one statement into another, such as a problem line replaced by the answer."
- "A two-step message where the final line needs one word called out on a gradient pill."
avoidWhen:
- "You only have a single line to reveal - use `mask-reveal-up`."
- "You want the old text struck out and replaced in place - use `strikethrough-replace`."
- "You need a soft crossfade between lines rather than a block wipe - use `per-word-crossfade`."
askedAs:
- "solid block wipes line replaced"
- "problem line replaced by answer"
- "I want a coloured block to cover each line and the next line to take its place"
- "rewrite a statement into a better one with a pill highlight at end"
- "two step message from problem to solution text"
- "block slides across the text and new text appears with a highlighted word"
---
<ComponentPreview name="block-swap" />
<InstallBlock name="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={150}
fps={30}
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`.
<PropsTable title="Props"
rows={[
{
name: "lines",
type: "string[]",
default: "DEFAULT_LINES",
description: "Sentences shown in order; each one overwrites the previous",
},
{
name: "highlight",
type: "string",
default: "\"launch\"",
description: "Word in the last line that lands on the gradient pill",
},
{
name: "accent",
type: "string",
default: "\"#3B5BFD\"",
description: "Accent color (any valid CSS color)",
},
{
name: "background",
type: "string",
description: "Overrides the theme's stage color",
},
{
name: "speed",
type: "number",
default: "1",
description: "Playback speed multiplier",
},
{
name: "theme",
type: "\"dark\" | \"light\"",
default: "\"dark\"",
description: "Ships light and dark palettes",
},
]}
/>