Turnabout
A sentence turns around into its reverse: the shared words lift, travel to their new places and land as the reversed line, ending on an accent-colored phrase. A free, MIT-licensed Remotion text animation.
In Remotion, Turnabout flips one sentence into its mirror image word by word, for example effort for the tool turning into effort from the tool, and ends on an accent-colored phrase. Use it for a positioning beat that reverses the framing.
$ pnpm dlx shadcn@latest add @remocn/turnaboutHow to turn words around into a reversed sentence
A positioning line whose words turn around into the reverse sentence, for example You work for the video. becoming The video works for you., is one component. You don't need @remotion/layout-utils or a FLIP library:
npx shadcn@latest add @remocn/turnabout- Pass
before,afterandhighlight. The two lines should reuse most of the same words. - The first line rises in word by word. In the turn, every word the lines share lifts into a lane, travels to its place in the second line and drops back; new words rise in, and the
highlightphrase lights up in theaccentcolor. - Word positions are measured on a canvas before the first frame (held with
delayRender), and words move only bytransform, so nothing reflows. - Font: DM Sans through
@remotion/google-fonts, or your own withfontFamily.
If the two lines share no words, use Layout Swap.
Good to know
- Length: 106 frames of motion at 30 fps (212 at 60 fps) with the default props. That is the minimum for its
Sequence; add your own hold on top. The Usage example below is a 60 fps composition, so the numbers it hands to Remotion (durationInFrames,Sequencelengths) are doubled. The component's own props counted in frames stay in 30 fps frames at any frame rate, see Frame rate. - Installs:
remotion,@remotion/google-fontsfrom npm, plus the remocn helpersglide,frame-rate,timeline. The shadcn CLI copies the source into your project. - Font: loads DM Sans itself through
@remotion/google-fonts. PassfontFamilyto use your own face, and load that font in your project.
Usage
// src/Root.tsx
import { Composition } from "remotion";
import { Turnabout } from "@/components/remocn/turnabout";
const TurnaboutScene = () => (
<Turnabout before="You work for the video." after="The video works for you." highlight="you." />
);
export const RemotionRoot = () => (
<Composition
id="Turnabout"
component={TurnaboutScene}
durationInFrames={300}
fps={60}
width={1280}
height={720}
/>
);The before sentence enters word by word, then turns into the after sentence while shared words travel to their new spots. The highlight phrase in after lights up in the accent color. It ships in light and dark through the theme prop.
Props13
| Prop | Type | Default |
|---|---|---|
| before | string"You work for the video." Opening sentence. | |
| after | string"The video works for you." Sentence it turns into. | |
| highlight | string"you." Phrase inside `after` lit in the accent color. | |
| stagger | number3 Frames between words of the first line rising in. | |
| fontWeight | number500 Weight of the lines. | |
| accent | string— 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"DM Sans" 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. | |
- beforestring
Opening sentence.
Default
"You work for the video." - afterstring
Sentence it turns into.
Default
"The video works for you." - highlightstring
Phrase inside `after` lit in the accent color.
Default
"you." - staggernumber
Frames between words of the first line rising in.
Default
3 - fontWeightnumber
Weight of the lines.
Default
500 - accentstring
Accent color override; falls back to the theme accent.
- 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
"DM Sans" - 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"
Common questions
How do I animate a sentence flipping into its mirror image word by word in Remotion?
Install Turnabout with npx shadcn@latest add @remocn/turnabout and render <Turnabout before="You work for the video." after="The video works for you." highlight="you." />. The shared words travel to their new places and the highlight lights up in the accent color. Budget at least 106 frames at 30 fps (212 at 60 fps), plus a hold.
Is it a 3D rotateY flip or a TransitionSeries?
Neither. It is one scene: the words lift, slide to their new positions and drop back, all with transform. Use @remotion/transitions when you cut between two different scenes.
What should the two sentences look like?
Both lines should reuse most of the same words, like effort for the tool and effort from the tool. If they share no words, use Layout Swap; if only one word changes, use Pinned Word.
How do I set my brand color and font?
Pass accent for the highlight phrase and fontFamily for the copy, and load that font in your project.
Related effects
- Layout Swap: two unrelated lines replace each other.
- Pinned Word: one word changes inside a fixed sentence.
- Word Insert: an edit-style change with inserted words.
- They Are You: third-person lines flip They to You.