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.

Installation
$ pnpm dlx shadcn@latest add @remocn/strikethrough-replace

How 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:

bash
npx shadcn@latest add @remocn/strikethrough-replace

The 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, Sequence lengths) are doubled. The component's own props counted in frames stay in 30 fps frames at any frame rate, see Frame rate.
  • Installs: remotion from npm, plus the remocn helpers glide, frame-rate, timeline. The shadcn CLI copies the source into your project.
  • Font: Geist Sans through the --font-geist-sans CSS variable, with a system sans fallback. There is no fontFamily prop: the font is set inline, so change it in the copied file; a className font does not override an inline style.
  • Strike and fade timing: besides speed, the timing prop moves or stretches each phase on its own, by the ids strike and swap, in 30 fps frames. For example timing={{ 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.

tsx
// 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.

tsx
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

PropTypeDefault
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.

    Default48

  • colorstring

    Text color (any valid CSS color).

    Default"#171717"

  • fontWeightnumber

    CSS font-weight.

    Default600

  • speednumber

    Time multiplier applied as frame × speed.

    Default1

  • 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. For an editorial correction where the struck line stays on screen and the new text fades in below it, edit the copied file in three places:

  1. Remove opacity: fromOpacity from the old text's span, so the struck line stays visible.
  2. Remove position: "absolute" from that span and add flexDirection: "column" to the inline-flex wrapper around both spans, so the new text sits under the old one.
  3. Change background: "white" on the outer div to "transparent" (or your color) to drop the white field.

For both lines marked as a change, with the edit highlighted, use Diff Swap.

Can I change the font or make the background transparent?

fontSize, fontWeight, color and lineColor are props. The font family (Geist Sans) and the white background are set inline, so change them in the copied file.

  • 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.