Skip to content

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

feat: shared axis y

dev_wandry29379bf99816
diff --git a/components/docs/examples/index.tsx b/components/docs/examples/index.tsx
index e966d9f1..55d22a0e 100644
--- a/components/docs/examples/index.tsx
+++ b/components/docs/examples/index.tsx
@@ -74,6 +74,10 @@ import {
FadeThroughExampleScene,
fadeThroughExampleCode,
} from "./fade-through-example";
+import {
+ SharedAxisYExampleScene,
+ sharedAxisYExampleCode,
+} from "./shared-axis-y-example";
import {
PerWordCrossfadeExampleScene,
perWordCrossfadeExampleCode,
@@ -373,6 +377,16 @@ export const examples: Record<string, ExampleEntry> = {
height: H,
previewBackdrop: { type: "color", value: "#ffffff" },
},
+ "shared-axis-y-example": {
+ Component: SharedAxisYExampleScene,
+ code: sharedAxisYExampleCode,
+ // 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,
diff --git a/components/docs/examples/shared-axis-y-example.tsx b/components/docs/examples/shared-axis-y-example.tsx
new file mode 100644
index 00000000..fd4700b8
--- /dev/null
+++ b/components/docs/examples/shared-axis-y-example.tsx
@@ -0,0 +1,44 @@
+"use client";
+
+import { Sequence } from "remotion";
+import { SharedAxisY } from "@/registry/remocn/shared-axis-y";
+
+export const SharedAxisYExampleScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <SharedAxisY fromText="Layered navigation." toText="Hierarchy made clear." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <SharedAxisY
+ fromText="Hierarchy made clear."
+ toText="Depth with restraint."
+ />
+ </Sequence>
+ </>
+);
+
+export const sharedAxisYExampleCode =
+ (): string => `import { Composition, Sequence } from "remotion";
+import { SharedAxisY } from "@/components/remocn/shared-axis-y";
+
+const SharedAxisYScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <SharedAxisY fromText="Layered navigation." toText="Hierarchy made clear." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <SharedAxisY fromText="Hierarchy made clear." toText="Depth with restraint." />
+ </Sequence>
+ </>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="SharedAxisY"
+ component={SharedAxisYScene}
+ durationInFrames={180}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);`;
diff --git a/content/docs/components.mdx b/content/docs/components.mdx
index fc1a6065..e8bb9009 100644
--- a/content/docs/components.mdx
+++ b/content/docs/components.mdx
@@ -192,6 +192,12 @@ Text effects, reveals, and kinetic type.
status: "stable",
href: "/docs/typography/fade-through",
},
+ {
+ name: "SharedAxisY",
+ description: "Per-word hard-cut staircase for sharp editorial swaps",
+ status: "stable",
+ href: "/docs/typography/shared-axis-y",
+ },
]}
/>
diff --git a/content/docs/typography/index.mdx b/content/docs/typography/index.mdx
index aecb80b6..3d9de113 100644
--- a/content/docs/typography/index.mdx
+++ b/content/docs/typography/index.mdx
@@ -190,5 +190,11 @@ Swap one phrase for another with motion.
status: "stable",
href: "/docs/typography/fade-through",
},
+ {
+ name: "SharedAxisY",
+ description: "Per-word hard-cut staircase for sharp editorial swaps",
+ status: "stable",
+ href: "/docs/typography/shared-axis-y",
+ },
]}
/>
diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.json
index 72fca770..fab949b0 100644
--- a/content/docs/typography/meta.json
+++ b/content/docs/typography/meta.json
@@ -15,6 +15,7 @@
"line-by-line-slide",
"per-word-crossfade",
"fade-through",
+ "shared-axis-y",
"staggered-fade-up",
"mask-reveal-up",
"tracking-in",
diff --git a/content/docs/typography/shared-axis-y.mdx b/content/docs/typography/shared-axis-y.mdx
new file mode 100644
index 00000000..e6b1086f
--- /dev/null
+++ b/content/docs/typography/shared-axis-y.mdx
@@ -0,0 +1,122 @@
+---
+title: Shared Axis Y
+description: Per-word hard-cut staircase transition for sharp editorial phrase swaps
+---
+
+<ComponentPreview name="shared-axis-y" />
+
+## Installation
+
+<InstallBlock name="shared-axis-y" />
+
+## Usage
+
+```tsx
+// src/Root.tsx
+import { Composition, Sequence } from "remotion";
+import { SharedAxisY } from "@/components/remocn/shared-axis-y";
+
+const SharedAxisYScene = () => (
+ <>
+ <Sequence durationInFrames={90}>
+ <SharedAxisY fromText="Layered navigation." toText="Hierarchy made clear." />
+ </Sequence>
+ <Sequence from={90} durationInFrames={90}>
+ <SharedAxisY fromText="Hierarchy made clear." toText="Depth with restraint." />
+ </Sequence>
+ </>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="SharedAxisY"
+ component={SharedAxisYScene}
+ durationInFrames={180}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+Each word in the outgoing phrase snaps off in a hard cut, then the incoming phrase's words snap on in a staircase pattern—no fade or motion, just a sharp editorial 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.
+
+### Chained example
+
+This is the two-`Sequence` chain above rendered on a 180-frame timeline:
+
+<ComponentExample name="shared-axis-y" />
+
+### 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 { SharedAxisY } from "@/components/remocn/shared-axis-y";
+import { Backdrop } from "@/components/remocn/backdrop";
+
+const SharedAxisYScene = () => (
+ <Backdrop fill={{ type: "color", value: "#ffffff" }}>
+ <SharedAxisY
+ fromText="Layered navigation."
+ toText="Hierarchy made clear."
+ />
+ </Backdrop>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="SharedAxisY"
+ component={SharedAxisYScene}
+ durationInFrames={90}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "fromText",
+ type: "string",
+ required: true,
+ description: "The outgoing phrase, shown first then hard-cuts off word by word.",
+ },
+ {
+ name: "toText",
+ type: "string",
+ required: true,
+ description: "The incoming phrase that snaps in word by word.",
+ },
+ {
+ 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/registry/__index__.tsx b/registry/__index__.tsx
index fb069b1a..0d024d57 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -31,6 +31,8 @@ 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 { SharedAxisY } from "@/registry/remocn/shared-axis-y";
+import { sharedAxisYConfig } from "@/registry/remocn/shared-axis-y/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";
@@ -226,6 +228,7 @@ const registry: Record<string, RegistryEntry> = {
"line-by-line-slide": { Component: LineByLineSlide, config: lineByLineSlideConfig },
"per-word-crossfade": { Component: PerWordCrossfade, config: perWordCrossfadeConfig },
"fade-through": { Component: FadeThrough, config: fadeThroughConfig },
+ "shared-axis-y": { Component: SharedAxisY, config: sharedAxisYConfig },
typewriter: { Component: Typewriter, config: typewriterConfig },
"inline-highlight": {
Component: InlineHighlight,
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index 377297cd..3a7295b5 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -195,6 +195,22 @@
}
]
},
+ {
+ "name": "shared-axis-y",
+ "type": "registry:component",
+ "title": "Shared Axis Y",
+ "description": "Per-word hard-cut transition with staircase timing for sharp editorial swaps.",
+ "dependencies": [
+ "remotion"
+ ],
+ "files": [
+ {
+ "path": "shared-axis-y/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/shared-axis-y.tsx"
+ }
+ ]
+ },
{
"name": "typewriter",
"type": "registry:component",
diff --git a/registry/remocn/shared-axis-y/config.ts b/registry/remocn/shared-axis-y/config.ts
new file mode 100644
index 00000000..b61dab4f
--- /dev/null
+++ b/registry/remocn/shared-axis-y/config.ts
@@ -0,0 +1,36 @@
+import {
+ type ComponentConfig,
+ FONT_WEIGHT_OPTIONS,
+ FPS,
+ H,
+ W,
+} from "@/lib/customizer-config";
+
+export const sharedAxisYConfig: ComponentConfig = {
+ componentName: "SharedAxisY",
+ importPath: "@/components/remocn/shared-axis-y",
+ controls: {
+ fromText: { type: "text", default: "Layered navigation.", label: "From text" },
+ toText: { type: "text", default: "Hierarchy made clear.", 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/shared-axis-y/index.tsx b/registry/remocn/shared-axis-y/index.tsx
new file mode 100644
index 00000000..256f23bc
--- /dev/null
+++ b/registry/remocn/shared-axis-y/index.tsx
@@ -0,0 +1,134 @@
+"use client";
+
+import { Easing, interpolate, useCurrentFrame } from "remotion";
+
+export interface SharedAxisYProps {
+ fromText: string;
+ toText: string;
+ fontSize?: number;
+ color?: string;
+ fontWeight?: number;
+ speed?: number;
+ className?: string;
+}
+
+export function SharedAxisY({
+ fromText,
+ toText,
+ fontSize = 72,
+ color = "#171717",
+ fontWeight = 600,
+ speed = 1,
+ className,
+}: SharedAxisYProps) {
+ const frame = useCurrentFrame() * speed;
+
+ const fromWords = fromText.split(" ");
+ const toWords = toText.split(" ");
+
+ const enterDur = 5;
+ const exitDur = 4;
+ const enterStagger = 2;
+ const exitStagger = 2;
+ const overlapF = 0;
+ const microDelayF = 1;
+
+ const exitTotal = exitDur + (fromWords.length - 1) * exitStagger;
+ const newStart = Math.max(0, exitTotal - overlapF + microDelayF);
+
+ 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,
+ }}
+ >
+ {fromWords.map((word, i) => {
+ const local = frame - i * exitStagger;
+ const opacity = interpolate(local, [0, exitDur], [1, 0], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: Easing.step1,
+ });
+ return (
+ <span
+ key={i}
+ style={{
+ display: "inline-block",
+ marginRight: "0.25em",
+ opacity,
+ }}
+ >
+ {word}
+ </span>
+ );
+ })}
+ </span>
+ </div>
+
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <span
+ style={{
+ fontSize,
+ fontWeight,
+ color,
+ letterSpacing: "-0.03em",
+ fontFamily: fontStack,
+ }}
+ >
+ {toWords.map((word, j) => {
+ const local = frame - newStart - j * enterStagger;
+ const opacity = interpolate(local, [0, enterDur], [0, 1], {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing: Easing.step1,
+ });
+ return (
+ <span
+ key={j}
+ style={{
+ display: "inline-block",
+ marginRight: "0.25em",
+ opacity,
+ }}
+ >
+ {word}
+ </span>
+ );
+ })}
+ </span>
+ </div>
+ </div>
+ );
+}