Flank Roll Swap
Word swap around a photo for Remotion: two words on either side of an image in the middle of a line roll letter by letter into new words, like a studio name to out now.
In Remotion, Flank Roll Swap puts two words on either side of a photo in the middle of a line and rolls them letter by letter into new words, like swapping a studio name for "Out now". Use it for a release announcement around a hero image.
$ pnpm dlx shadcn@latest add @remocn/flank-roll-swapHow to build this in Remotion
You don't need fitText, TransitionSeries or a hand-built letter roll. Install the component and pass both pairs and your images:
npx shadcn@latest add @remocn/flank-roll-swapThe card, the side words and each letter roll are scheduled in timeline.ts; letters roll with interpolate() and Easing, the card pops with spring(), and images are drawn with Remotion's Img. Word widths are measured on a canvas before the first frame, held with delayRender. The ground is a live gradients.sh shader (GshGround).
Good to know
- Length: 88 frames of motion at 30 fps (176 at 60 fps) with the default props. The demo plays 126 frames, which adds a hold after the swap. The Usage example below is a 60 fps composition, so the numbers it hands to Remotion are doubled, see Frame rate.
- Installs:
remotion,@remotion/google-fontsfrom npm, plus the remocn helpersgsh,glide,frame-rate,timeline. The shadcn CLI copies the source into your project. - Font: loads Hanken Grotesk itself through
@remotion/google-fonts. PassfontFamilyto use your own face, and load that font in your project. - A single image works: the pictures cycle with
images[cut % images.length], so one image just stays in place while the words roll.
Usage
// src/Root.tsx
import { Composition } from "remotion";
import { FlankRollSwap } from "@/components/remocn/flank-roll-swap";
const FlankRollSwapScene = () => (
<FlankRollSwap from={["Remocn", "Studio"]} to={["Out now", "on remocn.dev"]} accentWord="remocn.dev" images={["/photos/hero.jpg"]} />
);
export const RemotionRoot = () => (
<Composition
id="FlankRollSwap"
component={FlankRollSwapScene}
durationInFrames={252}
fps={60}
width={1280}
height={720}
/>
);A two-part line sits on either side of an image, then each side rolls letter by letter into the to pair while the pictures cycle. The default photos use staticFile(...) paths that only exist in the Remocn repo, so pass your own URLs in images.
The ground is a live gradients.sh shader (GshGround), installed with the component as @remocn/gsh. Pick another look with the ground preset prop. It ships in light and dark through the theme prop.
Props16
| Prop | Type | Default |
|---|---|---|
| from | [string, string]["Remocn", "Studio"] Left and right words shown first. | |
| to | [string, string]["Out now", "on remocn.dev"] Left and right words they roll into. | |
| accentWord | string"remocn.dev" Word in `to` tinted with the accent color. | |
| images | string[]— Image URLs cycled in the middle; defaults to repo-only files. | |
| swapAt | number48 Frame the left words start to roll; the right side follows 6 frames later. | |
| stagger | number1.2 Frames between letters as a word rolls. | |
| accent | string— Accent color override; falls back to the theme accent. | |
| ink | string— Text color override; falls back to the theme ink. | |
| background | string— Solid fill in place of the gradient ground; pass "transparent" to drop it. | |
| fontFamily | string"Hanken Grotesk" Typeface for the copy. Hanken Grotesk loads by default; load any other face 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. | |
| ground | GshPresetId— Gradient ground preset id for the backdrop. | |
| groundParams | Partial<GradientParams>— Partial gradient parameters that tweak the chosen ground preset. | |
- from[string, string]
Left and right words shown first.
Default
["Remocn", "Studio"] - to[string, string]
Left and right words they roll into.
Default
["Out now", "on remocn.dev"] - accentWordstring
Word in `to` tinted with the accent color.
Default
"remocn.dev" - imagesstring[]
Image URLs cycled in the middle; defaults to repo-only files.
- swapAtnumber
Frame the left words start to roll; the right side follows 6 frames later.
Default
48 - staggernumber
Frames between letters as a word rolls.
Default
1.2 - accentstring
Accent color override; falls back to the theme accent.
- inkstring
Text color override; falls back to the theme ink.
- backgroundstring
Solid fill in place of the gradient ground; pass "transparent" to drop it.
- fontFamilystring
Typeface for the copy. Hanken Grotesk loads by default; load any other face in your project first.
Default
"Hanken Grotesk" - 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" - groundGshPresetId
Gradient ground preset id for the backdrop.
- groundParamsPartial<GradientParams>
Partial gradient parameters that tweak the chosen ground preset.
Common questions
How do I make two words on either side of a photo roll into new words in Remotion?
Install Flank Roll Swap with npx shadcn@latest add @remocn/flank-roll-swap, pass from and to as two-word pairs and your image URLs in images. Each side rolls letter by letter into its new word.
Can I use one image?
Yes. With one image the photo stays the same through the swap.
Why don't the default photos show in my project?
They are staticFile() paths that only exist in the Remocn repo. Pass your own URLs in images.
Related effects
- Width Lock: a plain text swap with no images.
- Photo Fill Type: a bold word opens onto a photo.
- Layout Swap: a headline grows line by line.
- Word Gap Media: a video or image slides into a gap in a sentence.