Code Diff Wipe

Reveal an "after" code snippet by wiping a "before" snippet away

Installation

$ pnpm dlx shadcn@latest add @remocn/code-diff-wipe

Usage

// src/Root.tsx
import { Composition } from "remotion";
import { CodeDiffWipe } from "@/components/remocn/code-diff-wipe";

const CodeDiffWipeScene = () => (
  <CodeDiffWipe
    before={"function get() { /* old */ }"}
    after={"const get = async () => { /* new */ }"}
  />
);

export const RemotionRoot = () => (
  <Composition
    id="CodeDiffWipe"
    component={CodeDiffWipeScene}
    durationInFrames={120}
    fps={30}
    width={1280}
    height={720}
  />
);

Props

PropTypeDefaultDescription
before
stringMulti-line code shown on top, wiped away by the animation
after
stringMulti-line code revealed underneath as the wipe progresses
language
string"tsx"Language label shown in the pane header
background
string"#0a0a0a"Editor background color
accent
string"#0ea5e9"Accent color for the wipe line, handle, and "after" label
transitionStart
number20Frame at which the wipe begins
transitionDuration
number60Number of frames the wipe takes from 0% to 100%
showHandle
booleantrueRender a circular handle on the wipe line
className
stringOptional className passed to the outer container