Text Fade Replace
Cross-fade between two strings on the same line without layout shift
Installation
$ pnpm dlx shadcn@latest add @remocn/text-fade-replaceUsage
// src/Root.tsx
import { Composition } from "remotion";
import { TextFadeReplace } from "@/components/remocn/text-fade-replace";
const TextFadeReplaceScene = () => (
<TextFadeReplace from="Before" to="After" fontSize={72} />
);
export const RemotionRoot = () => (
<Composition
id="TextFadeReplace"
component={TextFadeReplaceScene}
durationInFrames={90}
fps={30}
width={1280}
height={720}
/>
);Props
| Prop | Type | Default | Description |
|---|---|---|---|
fromrequired | string | — | Initial text shown at the start of the composition |
torequired | string | — | Replacement text shown at the end of the composition |
fontSize | number | 48 | Font size in pixels |
fontWeight | number | 600 | CSS font-weight |
color | string | "#171717" | Text color for both strings |
className | string | — | Optional className passed to both spans |
Variant: Strikethrough Replace
A companion primitive that animates a strikethrough line growing left-to-right across the from text, then cross-fades to the to text. Useful for "old way / new way" comparisons.
Installation
$ pnpm dlx shadcn@latest add @remocn/strikethrough-replaceUsage
import { StrikethroughReplace } from "@/components/remocn/strikethrough-replace";
<StrikethroughReplace
from="Slow setup"
to="Instant setup"
lineColor="#ff5e3a"
fontSize={72}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
fromrequired | string | — | Original text that gets struck through |
torequired | string | — | Replacement text that fades in |
lineColor | string | "#ff5e3a" | Color of the strikethrough bar |
fontSize | number | 48 | Font size in pixels |
fontWeight | number | 600 | CSS font-weight |
color | string | "#171717" | Text color for both strings |
className | string | — | Optional className passed to the underlying spans |
Three phases
The animation runs in three phases tied to durationInFrames: draw the strike line (0-40%), cross-fade to the new text (40-60%), then hold (60-100%).