Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: fade throught

dev_wandry5fcecfbe24c9
diff --git a/components/docs/component-example.tsx b/components/docs/component-example.tsx
new file mode 100644
index 00000000..35055f38
--- /dev/null
+++ b/components/docs/component-example.tsx
@@ -0,0 +1,38 @@
+"use client";
+
+import { Suspense } from "react";
+import { PreviewStage } from "@/lib/ui-preview-internals";
+import { examples } from "./examples";
+
+export function ComponentExample({ name }: { name: string }) {
+ const entry = examples[`${name}-example`];
+
+ if (!entry) {
+ return (
+ <div className="not-prose mb-6 rounded-lg border border-fd-border p-4 text-sm text-fd-muted-foreground">
+ Unknown example: <code>{name}</code>
+ </div>
+ );
+ }
+
+ return (
+ <Suspense
+ fallback={
+ <div className="not-prose mb-6 aspect-[1.9/1] w-full animate-pulse rounded-2xl bg-muted" />
+ }
+ >
+ <div className="not-prose mb-6">
+ <PreviewStage
+ name={`${name}-example`}
+ Component={entry.Component}
+ inputProps={{}}
+ durationInFrames={entry.durationInFrames}
+ fps={entry.fps}
+ compositionWidth={entry.width}
+ compositionHeight={entry.height}
+ previewBackdrop={entry.previewBackdrop}
+ />
+ </div>
+ </Suspense>
+ );
+}
diff --git a/components/docs/examples/fade-through-example.tsx b/components/docs/examples/fade-through-example.tsx
new file mode 100644
index 00000000..6f7aa68c
--- /dev/null
+++ b/components/docs/examples/fade-through-example.tsx
@@ -0,0 +1,44 @@
+"use client";
+
+import { Sequence } from "remotion";
+import { FadeThrough } from "@/registry/remocn/fade-through";
+
+export const FadeThroughExampleScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <FadeThrough fromText="Calm transitions." toText="Fade through content." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <FadeThrough
+ fromText="Fade through content."
+ toText="Focus shifts smoothly."
+ />
+ </Sequence>
+ </>
+);
+
+export const fadeThroughExampleCode =
+ (): string => `import { Composition, Sequence } from "remotion";
+import { FadeThrough } from "@/components/remocn/fade-through";
+
+const FadeThroughScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <FadeThrough fromText="Calm transitions." toText="Fade through content." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <FadeThrough fromText="Fade through content." toText="Focus shifts smoothly." />
+ </Sequence>
+ </>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="FadeThrough"
+ component={FadeThroughScene}
+ durationInFrames={180}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);`;
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsx
index 25a54ac2..e966d9f1 100644
--- a/components/docs/examples/index.tsx
+++ b/components/docs/examples/index.tsx
@@ -70,6 +70,14 @@ import {
resizableExampleCode,
} from "./resizable-example";
import { BlurInExampleScene, blurInExampleCode } from "./blur-in-example";
+import {
+ FadeThroughExampleScene,
+ fadeThroughExampleCode,
+} from "./fade-through-example";
+import {
+ PerWordCrossfadeExampleScene,
+ perWordCrossfadeExampleCode,
+} from "./per-word-crossfade-example";
export interface ExampleEntry {
Component: ComponentType;
@@ -355,4 +363,24 @@ export const examples: Record<string, ExampleEntry> = {
width: W,
height: H,
},
+ "fade-through-example": {
+ Component: FadeThroughExampleScene,
+ code: fadeThroughExampleCode,
+ // Two chained A→B transitions, 90 frames each.
+ durationInFrames: 180,
+ fps: FPS,
+ width: W,
+ height: H,
+ previewBackdrop: { type: "color", value: "#ffffff" },
+ },
+ "per-word-crossfade-example": {
+ Component: PerWordCrossfadeExampleScene,
+ code: perWordCrossfadeExampleCode,
+ // Two chained A→B transitions, 90 frames each.
+ durationInFrames: 180,
+ fps: FPS,
+ width: W,
+ height: H,
+ previewBackdrop: { type: "color", value: "#ffffff" },
+ },
};
diff --git a/components/docs/examples/per-word-crossfade-example.tsx b/components/docs/examples/per-word-crossfade-example.tsx
new file mode 100644
index 00000000..30e5b84a
--- /dev/null
+++ b/components/docs/examples/per-word-crossfade-example.tsx
@@ -0,0 +1,47 @@
+"use client";
+
+import { Sequence } from "remotion";
+import { PerWordCrossfade } from "@/registry/remocn/per-word-crossfade";
+
+export const PerWordCrossfadeExampleScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <PerWordCrossfade
+ fromText="Beautifully simple."
+ toText="Designed for focus."
+ />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <PerWordCrossfade
+ fromText="Designed for focus."
+ toText="Built for people."
+ />
+ </Sequence>
+ </>
+);
+
+export const perWordCrossfadeExampleCode =
+ (): string => `import { Composition, Sequence } from "remotion";
+import { PerWordCrossfade } from "@/components/remocn/per-word-crossfade";
+
+const PerWordCrossfadeScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <PerWordCrossfade fromText="Beautifully simple." toText="Designed for focus." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <PerWordCrossfade fromText="Designed for focus." toText="Built for people." />
+ </Sequence>
+ </>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="PerWordCrossfade"
+ component={PerWordCrossfadeScene}
+ durationInFrames={180}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);`;
diff --git a/content/docs/components.mdx b/content/docs/components.mdx
index 54545236..fc1a6065 100644
--- a/content/docs/components.mdx
+++ b/content/docs/components.mdx
@@ -186,6 +186,12 @@ Text effects, reveals, and kinetic type.
status: "stable",
href: "/docs/typography/per-word-crossfade",
},
+ {
+ name: "FadeThrough",
+ description: "Old text fades out as new fades in, Material-style",
+ status: "stable",
+ href: "/docs/typography/fade-through",
+ },
]}
/>
diff --git a/content/docs/typography/fade-through.mdx b/content/docs/typography/fade-through.mdx
new file mode 100644
index 00000000..347bf5ec
--- /dev/null
+++ b/content/docs/typography/fade-through.mdx
@@ -0,0 +1,122 @@
+---
+title: Fade Through
+description: Old text fades out as new fades in with a soft delay, Material-style
+---
+
+<ComponentPreview name="fade-through" />
+
+## Installation
+
+<InstallBlock name="fade-through" />
+
+## Usage
+
+```tsx
+// src/Root.tsx
+import { Composition, Sequence } from "remotion";
+import { FadeThrough } from "@/components/remocn/fade-through";
+
+const FadeThroughScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <FadeThrough fromText="Calm transitions." toText="Fade through content." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <FadeThrough fromText="Fade through content." toText="Focus shifts smoothly." />
+ </Sequence>
+ </>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="FadeThrough"
+ component={FadeThroughScene}
+ durationInFrames={180}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+Chaining two instances in back-to-back `Sequence`s walks through a full phrase chain — the second transition reuses the first's `toText` as its `fromText`, so the text flows A → B → C. The component transitions from one phrase to another with a Material-style fade-through. The old phrase fades and lifts away, then the new phrase fades up into the same slot with a soft scale and blur settle—no directional meaning, good for same-level content swaps.
+
+### Chained example
+
+This is the two-`Sequence` chain above rendered on a 180-frame timeline:
+
+<ComponentExample name="fade-through" />
+
+### With Backdrop
+
+The component renders transparent — supply the background via `Backdrop`. It ships single-theme; edit the copied file to re-theme colors.
+
+Pair with `Backdrop` to place the text inside a full-frame fill with a rounded, shadowed content frame:
+
+```tsx
+import { Composition } from "remotion";
+import { FadeThrough } from "@/components/remocn/fade-through";
+import { Backdrop } from "@/components/remocn/backdrop";
+
+const FadeThroughScene = () => (
+ <Backdrop fill={{ type: "color", value: "#ffffff" }}>
+ <FadeThrough
+ fromText="Calm transitions."
+ toText="Fade through content."
+ />
+ </Backdrop>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="FadeThrough"
+ component={FadeThroughScene}
+ durationInFrames={90}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "fromText",
+ type: "string",
+ required: true,
+ description: "The outgoing phrase, shown first then fades out.",
+ },
+ {
+ name: "toText",
+ type: "string",
+ required: true,
+ description: "The incoming phrase that fades through to replace it.",
+ },
+ {
+ name: "fontSize",
+ type: "number",
+ default: "72",
+ description: "Font size in pixels",
+ },
+ {
+ name: "fontWeight",
+ type: "number",
+ default: "600",
+ description: "CSS font-weight",
+ },
+ {
+ name: "color",
+ type: "string",
+ default: "\"#171717\"",
+ description: "Text color (any valid CSS color)",
+ },
+ {
+ name: "className",
+ type: "string",
+ description: "Optional className passed to the wrapper",
+ },
+ ]}
+/>
diff --git a/content/docs/typography/index.mdx b/content/docs/typography/index.mdx
index 16e26c81..aecb80b6 100644
--- a/content/docs/typography/index.mdx
+++ b/content/docs/typography/index.mdx
@@ -184,5 +184,11 @@ Swap one phrase for another with motion.
status: "stable",
href: "/docs/typography/per-word-crossfade",
},
+ {
+ name: "FadeThrough",
+ description: "Old text fades out as new fades in, Material-style",
+ status: "stable",
+ href: "/docs/typography/fade-through",
+ },
]}
/>
diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.json
index ea3e233a..72fca770 100644
--- a/content/docs/typography/meta.json
+++ b/content/docs/typography/meta.json
@@ -14,6 +14,7 @@
"focus-blur-resolve",
"line-by-line-slide",
"per-word-crossfade",
+ "fade-through",
"staggered-fade-up",
"mask-reveal-up",
"tracking-in",
diff --git a/content/docs/typography/per-word-crossfade.mdx b/content/docs/typography/per-word-crossfade.mdx
index 573a640b..f76fddac 100644
--- a/content/docs/typography/per-word-crossfade.mdx
+++ b/content/docs/typography/per-word-crossfade.mdx
@@ -13,21 +13,25 @@ description: One phrase fades out as the next fades in, word by word
```tsx
// src/Root.tsx
-import { Composition } from "remotion";
+import { Composition, Sequence } from "remotion";
import { PerWordCrossfade } from "@/components/remocn/per-word-crossfade";
const PerWordCrossfadeScene = () => (
- <PerWordCrossfade
- fromText="Beautifully simple."
- toText="Designed for focus."
- />
+ <>
+ <Sequence durationInFrames={90}>
+ <PerWordCrossfade fromText="Beautifully simple." toText="Designed for focus." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <PerWordCrossfade fromText="Designed for focus." toText="Built for people." />
+ </Sequence>
+ </>
);
export const RemotionRoot = () => (
<Composition
id="PerWordCrossfade"
component={PerWordCrossfadeScene}
- durationInFrames={90}
+ durationInFrames={180}
fps={30}
width={1280}
height={720}
@@ -35,7 +39,13 @@ export const RemotionRoot = () => (
);
```
-The component transitions from one phrase to another, word by word. The fromText words drift up and fade out while the toText words fade in from below, overlapping for a calm keynote-style swap.
+Chaining two instances in back-to-back `Sequence`s walks through a full phrase chain — the second transition reuses the first's `toText` as its `fromText`, so the text flows A → B → C. The component transitions from one phrase to another, word by word. The fromText words drift up and fade out while the toText words fade in from below, overlapping for a calm keynote-style swap.
+
+### Chained example
+
+This is the two-`Sequence` chain above rendered on a 180-frame timeline:
+
+<ComponentExample name="per-word-crossfade" />
### With Backdrop
diff --git a/mdx-components.tsx b/mdx-components.tsx
index c7e07c7e..2ef8781e 100644
--- a/mdx-components.tsx
+++ b/mdx-components.tsx
@@ -2,6 +2,7 @@ import defaultMdxComponents from "fumadocs-ui/mdx";
import type { MDXComponents } from "mdx/types";
import { Note, Warning } from "@/components/docs/callout";
import { ComponentCardGrid } from "@/components/docs/component-card-grid";
+import { ComponentExample } from "@/components/docs/component-example";
import { ComponentPreview } from "@/components/docs/component-preview";
import { UiComponentPreview } from "@/components/docs/ui-component-preview";
import { BlockPreview } from "@/components/docs/block-preview";
@@ -34,6 +35,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
// Custom doc widgets — registrations only, not reimplemented here.
ComponentPreview,
+ ComponentExample,
UiComponentPreview,
BlockPreview,
InstallBlock,
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 960dcd53..fb069b1a 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -29,6 +29,8 @@ import { LineByLineSlide } from "@/registry/remocn/line-by-line-slide";
import { lineByLineSlideConfig } from "@/registry/remocn/line-by-line-slide/config";
import { PerWordCrossfade } from "@/registry/remocn/per-word-crossfade";
import { perWordCrossfadeConfig } from "@/registry/remocn/per-word-crossfade/config";
+import { FadeThrough } from "@/registry/remocn/fade-through";
+import { fadeThroughConfig } from "@/registry/remocn/fade-through/config";
import { BrowserFlow } from "@/registry/remocn/browser-flow";
import { browserFlowConfig } from "@/registry/remocn/browser-flow/config";
import { ChatToPreviewLayout } from "@/registry/remocn/chat-to-preview-layout";
@@ -223,6 +225,7 @@ const registry: Record<string, RegistryEntry> = {
"focus-blur-resolve": { Component: FocusBlurResolve, config: focusBlurResolveConfig },
"line-by-line-slide": { Component: LineByLineSlide, config: lineByLineSlideConfig },
"per-word-crossfade": { Component: PerWordCrossfade, config: perWordCrossfadeConfig },
+ "fade-through": { Component: FadeThrough, config: fadeThroughConfig },
typewriter: { Component: Typewriter, config: typewriterConfig },
"inline-highlight": {
Component: InlineHighlight,
diff --git a/registry/remocn/fade-through/config.ts b/registry/remocn/fade-through/config.ts
new file mode 100644
index 00000000..ec3fa15b
--- /dev/null
+++ b/registry/remocn/fade-through/config.ts
@@ -0,0 +1,36 @@
+import {
+ type ComponentConfig,
+ FONT_WEIGHT_OPTIONS,
+ FPS,
+ H,
+ W,
+} from "@/lib/customizer-config";
+
+export const fadeThroughConfig: ComponentConfig = {
+ componentName: "FadeThrough",
+ importPath: "@/components/remocn/fade-through",
+ controls: {
+ fromText: { type: "text", default: "Calm transitions.", label: "From text" },
+ toText: { type: "text", default: "Fade through content.", label: "To text" },
+ fontSize: {
+ type: "number",
+ default: 72,
+ min: 12,
+ max: 160,
+ step: 1,
+ label: "Font size",
+ },
+ color: { type: "color", default: "#171717", label: "Color" },
+ fontWeight: {
+ type: "select",
+ default: "600",
+ options: FONT_WEIGHT_OPTIONS,
+ label: "Font weight",
+ },
+ },
+ durationInFrames: 90,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#ffffff" },
+};
diff --git a/registry/remocn/fade-through/index.tsx b/registry/remocn/fade-through/index.tsx
new file mode 100644
index 00000000..acdf5946
--- /dev/null
+++ b/registry/remocn/fade-through/index.tsx
@@ -0,0 +1,136 @@
+"use client";
+
+import { Easing, interpolate, useCurrentFrame } from "remotion";
+
+export interface FadeThroughProps {
+ fromText: string;
+ toText: string;
+ fontSize?: number;
+ color?: string;
+ fontWeight?: number;
+ speed?: number;
+ className?: string;
+}
+
+export function FadeThrough({
+ fromText,
+ toText,
+ fontSize = 72,
+ color = "#171717",
+ fontWeight = 600,
+ speed = 1,
+ className,
+}: FadeThroughProps) {
+ const frame = useCurrentFrame() * speed;
+
+ const exitDur = 8;
+ const enterDur = 13;
+ const overlapF = 1;
+ const microDelayF = 2;
+
+ const exitTotal = exitDur;
+ const newStart = Math.max(0, exitTotal - overlapF + microDelayF);
+
+ const exitEasing = Easing.bezier(0.4, 0, 1, 1);
+ const enterEasing = Easing.bezier(0.2, 0, 0, 1);
+
+ const fromOpacity = interpolate(frame, [0, exitDur], [1, 0], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: exitEasing,
+ });
+ const fromY = interpolate(frame, [0, exitDur], [0, -4], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: exitEasing,
+ });
+
+ const local = frame - newStart;
+ const toOpacity = interpolate(local, [0, enterDur], [0, 1], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: enterEasing,
+ });
+ const toY = interpolate(local, [0, enterDur], [6, 0], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: enterEasing,
+ });
+ const toScale = interpolate(local, [0, enterDur], [0.99, 1], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: enterEasing,
+ });
+ const blurVal = interpolate(local, [0, enterDur], [2, 0], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: enterEasing,
+ });
+
+ const fontStack =
+ "var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif";
+
+ return (
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ inset: 0,
+ background: "transparent",
+ }}
+ >
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <span
+ style={{
+ fontSize,
+ fontWeight,
+ color,
+ letterSpacing: "-0.03em",
+ fontFamily: fontStack,
+ display: "inline-block",
+ transformOrigin: "50% 50%",
+ opacity: fromOpacity,
+ transform: `translateY(${fromY}px)`,
+ }}
+ >
+ {fromText}
+ </span>
+ </div>
+
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <span
+ style={{
+ fontSize,
+ fontWeight,
+ color,
+ letterSpacing: "-0.03em",
+ fontFamily: fontStack,
+ display: "inline-block",
+ transformOrigin: "50% 50%",
+ opacity: toOpacity,
+ transform: `translateY(${toY}px) scale(${toScale})`,
+ filter: `blur(${blurVal}px)`,
+ }}
+ >
+ {toText}
+ </span>
+ </div>
+ </div>
+ );
+}
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index ef892354..377297cd 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -179,6 +179,22 @@
}
]
},
+ {
+ "name": "fade-through",
+ "type": "registry:component",
+ "title": "Fade Through",
+ "description": "A Material-style content transition: old fades out, new fades in with a soft delay.",
+ "dependencies": [
+ "remotion"
+ ],
+ "files": [
+ {
+ "path": "fade-through/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/fade-through.tsx"
+ }
+ ]
+ },
{
"name": "typewriter",
"type": "registry:component",