Strikethrough Replace
Problem-to-solution text swap for Remotion: a strikethrough line is drawn across the old statement, then the old words fade out and the solution fades in, like an editorial correction.
To cross out a problem statement with a drawn line and then fade in the solution, use Strikethrough Replace. It draws a strike line across the old text from left to right, then fades the old words out while the new ones fade in and rise into the same spot, like an editorial correction. Use it for a problem-to-solution beat, an old price struck out for a new one, or "old way vs. new way" copy.
$ pnpm dlx shadcn@latest add @remocn/strikethrough-replaceHow to build this in Remotion
You don't need @remotion/rough-notation, an evolvePath() SVG line or measureText() from @remotion/layout-utils to size the strike. Install the component and pass both strings:
npx shadcn@latest add @remocn/strikethrough-replaceThe strike is a bar inside the old text's own box, so it always matches the text width without measuring. Its width goes from 0% to 100% with interpolate() over the first 40% of the composition. From 40% to 60% the old text fades out while the new text fades in and rises 8 px; the rest is a hold. The phases are shares of the composition length, so a longer durationInFrames gives a slower strike.
Good to know
- Length: 120 frames of motion at 30 fps (240 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:
remotionfrom npm, plus the remocn helpersglide,frame-rate,timeline. The shadcn CLI copies the source into your project. - Font: Geist Sans through the
--font-geist-sansCSS variable, with a system sans fallback. There is nofontFamilyprop: the font is set inline, so change it in the copied file; aclassNamefont does not override an inline style. - Strike and fade timing: besides
speed, thetimingprop moves or stretches each phase on its own, by the idsstrikeandswap, in 30 fps frames. For exampletiming={{ strike: { stretch: 1.5 }, swap: { length: 12 } }}draws the line slower and shortens the crossfade. - The component paints a white background behind the text. For another color, edit the background in the copied file.
Usage
Keep from and to short. The strike reads as a deliberate edit, and a long struck-out line is
hard to parse at speed.
// src/Root.tsx
import { Composition } from "remotion";
import { StrikethroughReplace } from "@/components/remocn/strikethrough-replace";
const StrikethroughScene = () => (
<StrikethroughReplace from="Manual video editing" to="One-click export" fontSize={48} />
);
export const RemotionRoot = () => (
<Composition
id="StrikethroughReplace"
component={StrikethroughScene}
durationInFrames={240}
fps={60}
width={1280}
height={720}
/>
);The line draws across from first, then to fades in beneath it — so the composition needs room
for both phases. Under-budgeting cuts the reveal.
With Backdrop
Center it on your own scene with Backdrop. The component paints its own white background, so on a dark scene edit that color in the copied file.
import { Composition } from "remotion";
import { Backdrop } from "@/components/remocn/backdrop";
import { StrikethroughReplace } from "@/components/remocn/strikethrough-replace";
const StrikethroughScene = () => (
<Backdrop fill={{ type: "color", value: "#ffffff" }}>
<StrikethroughReplace from="$99 / month" to="$29 / month" lineColor="#ff5e3a" />
</Backdrop>
);Props9
| Prop | Type | Default |
|---|---|---|
| fromrequired | string— The old text — the line is drawn across this string. | |
| torequired | string— The replacement text, revealed beneath the struck-out line. | |
| lineColor | string"#ff5e3a" Color of the strike line. Defaults to a red-orange for maximum contrast against the text. | |
| fontSize | number48 Font size in pixels, applied to both strings. | |
| color | string"#171717" Text color (any valid CSS color). | |
| fontWeight | number600 CSS font-weight. | |
| speed | number1 Time multiplier applied as frame × speed. | |
| timing | Timing<"strike" | "swap">— Per-phase overrides: { start, length, stretch } for the strike line and the crossfade, in 30 fps frames. | |
| className | string— Optional className passed to both text spans. | |
- fromrequiredstring
The old text — the line is drawn across this string.
- torequiredstring
The replacement text, revealed beneath the struck-out line.
- lineColorstring
Color of the strike line. Defaults to a red-orange for maximum contrast against the text.
Default
"#ff5e3a" - fontSizenumber
Font size in pixels, applied to both strings.
Default
48 - colorstring
Text color (any valid CSS color).
Default
"#171717" - fontWeightnumber
CSS font-weight.
Default
600 - speednumber
Time multiplier applied as frame × speed.
Default
1 - timingTiming<"strike" | "swap">
Per-phase overrides: { start, length, stretch } for the strike line and the crossfade, in 30 fps frames.
- classNamestring
Optional className passed to both text spans.
Common questions
How do I cross out a problem statement and fade in the solution in Remotion?
Install Strikethrough Replace with npx shadcn@latest add @remocn/strikethrough-replace and render <StrikethroughReplace from="Manual video editing" to="One-click export" />. Give the composition at least 120 frames at 30 fps (240 at 60 fps) so both phases play.
Is the line hand-drawn?
No. It is a straight, rounded bar in lineColor. For a hand-drawn underline use Ink Underline; for a highlighter block use Marker Highlight.
Can the new text appear below the struck line instead of replacing it?
Not with the props. The new text takes the old text's place. To keep both visible, show the old line as a Diff Swap.
Related effects
- Diff Swap: old line marked deleted, new line added with the change highlighted.
- Typo Fix: a misspelled word corrected in place.
- Value Swap: an old price slides out for a new one with no layout shift.
- Block Swap: solid blocks wipe over words and rewrite the line.