Skip to content

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

feat: kinetic-warp

kapishdimae7c5a18c7ed1
diff --git a/content/docs/typography/kinetic-warp.mdx b/content/docs/typography/kinetic-warp.mdx
new file mode 100644
index 00000000..4a1acc47
--- /dev/null
+++ b/content/docs/typography/kinetic-warp.mdx
@@ -0,0 +1,208 @@
+---
+title: Kinetic Warp
+description: A coarse mesh warp bends a whole word in staccato beats, one axis moving per keyframe
+component: kinetic-warp
+vibe: playful
+length: 100
+useWhen:
+ - "A short, heavy display word needs a bold kinetic-typography moment where the whole word bends and snaps instead of individual letters animating."
+ - "You want a rhythmic, beat-synced distortion — the mesh stops dead at every keyframe, so each pose lands like a drum hit (tune `keyframeStride` to the tempo)."
+ - "The type is a huge condensed display font filling the frame — the warp reads best when the word owns the canvas."
+avoidWhen:
+ - "You need a text entrance — the word is fully visible from frame 0 and only distorts; use `tracking-in` or `soft-blur-in` for reveals."
+ - "The text is long or small — the mesh bends quarters of the frame, so a paragraph turns to mush; use `per-character-rise` for body-size text motion."
+ - "The vibe is corrupted or digital rather than elastic — use `rgb-glitch-text` for a glitch read."
+---
+
+<ComponentPreview name="kinetic-warp" />
+
+## Installation
+
+<InstallBlock name="kinetic-warp" />
+
+## Usage
+
+```tsx
+// src/Root.tsx
+import { Composition } from "remotion";
+import { KineticWarp } from "@/components/remocn/kinetic-warp";
+
+const KineticWarpScene = () => (
+ <KineticWarp
+ text={"REM\nOCN"}
+ fontFamily="Passion One"
+ fontUrl="https://fonts.googleapis.com/css2?family=Passion+One:wght@700&display=block"
+ />
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="KineticWarp"
+ component={KineticWarpScene}
+ durationInFrames={120}
+ fps={30}
+ width={1920}
+ height={1080}
+ />
+);
+```
+
+The component renders to a canvas, so the font must actually be loaded before the text is drawn — pass `fontUrl` for any webfont and the render is held (via `delayRender`) until it lands.
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "text",
+ type: "string",
+ default: "\"REM\\nOCN\"",
+ description: "The text to warp. Split lines with `\\n`",
+ },
+ {
+ name: "textColor",
+ type: "string",
+ default: "\"#FFFFFF\"",
+ description: "Fill color of the type",
+ },
+ {
+ name: "fontFamily",
+ type: "string",
+ default: "\"sans-serif\"",
+ description: "Font family drawn to the canvas",
+ },
+ {
+ name: "fontUrl",
+ type: "string",
+ default: "\"\"",
+ description: "Stylesheet URL for the webfont. Empty string skips loading and uses a local font",
+ },
+ {
+ name: "fontWeight",
+ type: "number",
+ default: "700",
+ description: "CSS font-weight",
+ },
+ {
+ name: "fontSize",
+ type: "number",
+ default: "107.1",
+ description: "Layer-space font size, before `layerScale`",
+ },
+ {
+ name: "leading",
+ type: "number",
+ default: "70",
+ description: "Layer-space baseline-to-baseline distance, before `layerScale`",
+ },
+ {
+ name: "tracking",
+ type: "number",
+ default: "-21",
+ description: "Tracking in 1/1000 em",
+ },
+ {
+ name: "layerScale",
+ type: "number",
+ default: "480",
+ description: "Percent scale applied to the type after layout",
+ },
+ {
+ name: "positionX",
+ type: "number",
+ default: "960",
+ description: "Horizontal center of the text block in comp pixels",
+ },
+ {
+ name: "positionY",
+ type: "number",
+ default: "540",
+ description: "Vertical center of the text block in comp pixels",
+ },
+ {
+ name: "compWidth",
+ type: "number",
+ default: "1920",
+ description: "Canvas width in pixels",
+ },
+ {
+ name: "compHeight",
+ type: "number",
+ default: "1080",
+ description: "Canvas height in pixels",
+ },
+ {
+ name: "meshRows",
+ type: "number",
+ default: "2",
+ description: "Mesh cells vertically — the coarseness is the effect",
+ },
+ {
+ name: "meshColumns",
+ type: "number",
+ default: "4",
+ description: "Mesh cells horizontally",
+ },
+ {
+ name: "colRestX",
+ type: "number",
+ default: "960",
+ description: "Rest position of the moving column line",
+ },
+ {
+ name: "colRightX",
+ type: "number",
+ default: "1255",
+ description: "Column position at keyframes 2 and 3",
+ },
+ {
+ name: "colLeftX",
+ type: "number",
+ default: "678",
+ description: "Column position at keyframes 4 and 5",
+ },
+ {
+ name: "rowRestY",
+ type: "number",
+ default: "540",
+ description: "Rest position of the moving row line",
+ },
+ {
+ name: "rowDownY",
+ type: "number",
+ default: "850",
+ description: "Row position at keyframes 3 and 4",
+ },
+ {
+ name: "rowUpY",
+ type: "number",
+ default: "387",
+ description: "Row position at keyframe 5",
+ },
+ {
+ name: "keyframeStride",
+ type: "number",
+ default: "20",
+ description: "Frames between the six keyframes — motion ends at `5 * keyframeStride`",
+ },
+ {
+ name: "easingBezier",
+ type: "[number, number, number, number]",
+ default: "[0.3, 0.74, 0.09, 1]",
+ description: "Cubic bezier applied between keyframes",
+ },
+ {
+ name: "resampleStep",
+ type: "number",
+ default: "4",
+ description: "Destination pixels per resampled strip — lower is smoother and slower",
+ },
+ {
+ name: "className",
+ type: "string",
+ description: "Optional className passed to the wrapper",
+ },
+ ]}
+/>
+
+Inspired by [How to Make Kinetic Warp Text Animation in After Effects](https://www.youtube.com/watch?v=IvTXbHLtod4) by P A N T E R.
diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.json
index 3fae67a6..6b492e86 100644
--- a/content/docs/typography/meta.json
+++ b/content/docs/typography/meta.json
@@ -20,6 +20,7 @@
"strikethrough-replace",
"short-slide-right",
"kinetic-center-build",
+ "kinetic-warp",
"short-slide-down",
"staggered-fade-up",
"mask-reveal-up",
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 29a3f258..23355209 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -308,6 +308,16 @@ const registry: Record<string, RegistryEntry> = {
(m) => m.matrixDecodeConfig,
),
},
+ "kinetic-warp": {
+ load: () =>
+ import("@/registry/remocn/kinetic-warp").then((m) => ({
+ default: m.KineticWarp,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/kinetic-warp/config").then(
+ (m) => m.kineticWarpConfig,
+ ),
+ },
"rgb-glitch-text": {
load: () =>
import("@/registry/remocn/rgb-glitch-text").then((m) => ({
diff --git a/registry/remocn/kinetic-warp/config.ts b/registry/remocn/kinetic-warp/config.ts
new file mode 100644
index 00000000..b6184c85
--- /dev/null
+++ b/registry/remocn/kinetic-warp/config.ts
@@ -0,0 +1,57 @@
+import {
+ type ComponentConfig,
+ FONT_WEIGHT_OPTIONS,
+ FPS,
+ H,
+ W,
+} from "@/lib/customizer-config";
+
+export const kineticWarpConfig: ComponentConfig = {
+ componentName: "KineticWarp",
+ importPath: "@/components/remocn/kinetic-warp",
+ controls: {
+ text: { type: "text", default: "REM\nOCN", label: "Text" },
+ textColor: { type: "color", default: "#FFFFFF", label: "Color" },
+ fontFamily: { type: "text", default: "Passion One", label: "Font family" },
+ fontUrl: {
+ type: "text",
+ default:
+ "https://fonts.googleapis.com/css2?family=Passion+One:wght@400;700;900&display=block",
+ label: "Font URL",
+ },
+ fontWeight: {
+ type: "select",
+ default: "700",
+ options: FONT_WEIGHT_OPTIONS,
+ label: "Font weight",
+ },
+ fontSize: {
+ type: "number",
+ default: 107.1,
+ min: 40,
+ max: 200,
+ step: 0.1,
+ label: "Font size",
+ },
+ layerScale: {
+ type: "number",
+ default: 480,
+ min: 100,
+ max: 800,
+ step: 10,
+ label: "Layer scale (%)",
+ },
+ keyframeStride: {
+ type: "number",
+ default: 20,
+ min: 5,
+ max: 40,
+ step: 1,
+ label: "Keyframe stride",
+ },
+ },
+ durationInFrames: 120,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+};
diff --git a/registry/remocn/kinetic-warp/index.tsx b/registry/remocn/kinetic-warp/index.tsx
new file mode 100644
index 00000000..d448838a
--- /dev/null
+++ b/registry/remocn/kinetic-warp/index.tsx
@@ -0,0 +1,286 @@
+"use client";
+
+import { useEffect, useMemo, useRef, useState } from "react";
+import {
+ continueRender,
+ delayRender,
+ Easing,
+ interpolate,
+ useCurrentFrame,
+} from "remotion";
+
+export interface KineticWarpProps {
+ className?: string;
+ compWidth?: number;
+ compHeight?: number;
+ textColor?: string;
+ text?: string;
+ fontFamily?: string;
+ fontUrl?: string;
+ fontWeight?: number;
+ fontSize?: number;
+ leading?: number;
+ tracking?: number;
+ layerScale?: number;
+ positionX?: number;
+ positionY?: number;
+ meshRows?: number;
+ meshColumns?: number;
+ colRestX?: number;
+ colRightX?: number;
+ colLeftX?: number;
+ rowRestY?: number;
+ rowDownY?: number;
+ rowUpY?: number;
+ keyframeStride?: number;
+ easingBezier?: [number, number, number, number];
+ resampleStep?: number;
+}
+
+function monotoneSpline(xs: number[], ys: number[]): (x: number) => number {
+ const n = xs.length;
+ const dx: number[] = [];
+ const secant: number[] = [];
+ for (let i = 0; i < n - 1; i++) {
+ dx.push(xs[i + 1] - xs[i]);
+ secant.push((ys[i + 1] - ys[i]) / (xs[i + 1] - xs[i]));
+ }
+
+ const m: number[] = new Array(n);
+ m[0] = secant[0];
+ m[n - 1] = secant[n - 2];
+ for (let i = 1; i < n - 1; i++) {
+ m[i] = secant[i - 1] * secant[i] <= 0 ? 0 : (secant[i - 1] + secant[i]) / 2;
+ }
+
+ for (let i = 0; i < n - 1; i++) {
+ if (secant[i] === 0) {
+ m[i] = 0;
+ m[i + 1] = 0;
+ continue;
+ }
+ const a = m[i] / secant[i];
+ const b = m[i + 1] / secant[i];
+ const s = a * a + b * b;
+ if (s > 9) {
+ const t = 3 / Math.sqrt(s);
+ m[i] = t * a * secant[i];
+ m[i + 1] = t * b * secant[i];
+ }
+ }
+
+ return (x: number) => {
+ if (x <= xs[0]) return ys[0] + m[0] * (x - xs[0]);
+ if (x >= xs[n - 1]) return ys[n - 1] + m[n - 1] * (x - xs[n - 1]);
+ let i = n - 2;
+ while (i > 0 && x < xs[i]) i--;
+ const h = dx[i];
+ const t = (x - xs[i]) / h;
+ const t2 = t * t;
+ const t3 = t2 * t;
+ return (
+ (2 * t3 - 3 * t2 + 1) * ys[i] +
+ (t3 - 2 * t2 + t) * h * m[i] +
+ (-2 * t3 + 3 * t2) * ys[i + 1] +
+ (t3 - t2) * h * m[i + 1]
+ );
+ };
+}
+
+export function KineticWarp({
+ className,
+ compWidth = 1920,
+ compHeight = 1080,
+ textColor = "#FFFFFF",
+ text = "REM\nOCN",
+ fontFamily = "sans-serif",
+ fontUrl = "",
+ fontWeight = 700,
+ fontSize = 107.1,
+ leading = 70,
+ tracking = -21,
+ layerScale = 480,
+ positionX = 960,
+ positionY = 540,
+ meshRows = 2,
+ meshColumns = 4,
+ colRestX = 960,
+ colRightX = 1255,
+ colLeftX = 678,
+ rowRestY = 540,
+ rowDownY = 850,
+ rowUpY = 387,
+ keyframeStride = 20,
+ easingBezier = [0.3, 0.74, 0.09, 1],
+ resampleStep = 4,
+}: KineticWarpProps) {
+ const frame = useCurrentFrame();
+ const canvasRef = useRef<HTMLCanvasElement | null>(null);
+ const [fontReady, setFontReady] = useState(false);
+
+ const scale = layerScale / 100;
+ const pxSize = fontSize * scale;
+ const pxLeading = leading * scale;
+ const pxTracking = (tracking / 1000) * pxSize;
+
+ useEffect(() => {
+ const handle = delayRender("kinetic-warp: loading font");
+ let cancelled = false;
+ const done = () => {
+ if (!cancelled) setFontReady(true);
+ continueRender(handle);
+ };
+ if (typeof document === "undefined" || !document.fonts) {
+ done();
+ return;
+ }
+ document.fonts
+ .load(`${fontWeight} ${pxSize}px "${fontFamily}"`)
+ .then(done, done);
+ return () => {
+ cancelled = true;
+ };
+ }, [fontFamily, fontWeight, pxSize]);
+
+ const source = useMemo(() => {
+ if (!fontReady || typeof document === "undefined") return null;
+ const canvas = document.createElement("canvas");
+ canvas.width = compWidth;
+ canvas.height = compHeight;
+ const ctx = canvas.getContext("2d");
+ if (!ctx) return null;
+
+ ctx.font = `${fontWeight} ${pxSize}px "${fontFamily}", sans-serif`;
+ ctx.letterSpacing = `${pxTracking}px`;
+ ctx.fillStyle = textColor;
+ ctx.textAlign = "left";
+ ctx.textBaseline = "alphabetic";
+
+ const lines = text.split("\n");
+ const metrics = lines.map((line) => ctx.measureText(line));
+
+ const ascent = metrics[0].actualBoundingBoxAscent;
+ const descent = metrics[metrics.length - 1].actualBoundingBoxDescent;
+ const span = (lines.length - 1) * pxLeading;
+ const firstBaseline = positionY - (span - ascent + descent) / 2;
+
+ lines.forEach((line, i) => {
+ const m = metrics[i];
+ const x =
+ positionX - (m.actualBoundingBoxRight - m.actualBoundingBoxLeft) / 2;
+ ctx.fillText(line, x, firstBaseline + i * pxLeading);
+ });
+
+ return canvas;
+ }, [
+ compWidth,
+ compHeight,
+ text,
+ fontFamily,
+ fontWeight,
+ pxSize,
+ pxLeading,
+ pxTracking,
+ textColor,
+ positionX,
+ positionY,
+ fontReady,
+ ]);
+
+ const scratch = useMemo(() => {
+ if (typeof document === "undefined") return null;
+ const canvas = document.createElement("canvas");
+ canvas.width = compWidth;
+ canvas.height = compHeight;
+ return canvas;
+ }, [compWidth, compHeight]);
+
+ const easing = Easing.bezier(...easingBezier);
+ const stops = [0, 1, 2, 3, 4, 5].map((i) => i * keyframeStride);
+ const clamp = {
+ extrapolateLeft: "clamp",
+ extrapolateRight: "clamp",
+ easing,
+ } as const;
+
+ const colX = interpolate(
+ frame,
+ stops,
+ [colRestX, colRightX, colRightX, colLeftX, colLeftX, colRestX],
+ clamp,
+ );
+ const rowY = interpolate(
+ frame,
+ stops,
+ [rowRestY, rowRestY, rowDownY, rowDownY, rowUpY, rowRestY],
+ clamp,
+ );
+
+ useEffect(() => {
+ const canvas = canvasRef.current;
+ if (!canvas || !source || !scratch) return;
+ const out = canvas.getContext("2d");
+ const mid = scratch.getContext("2d");
+ if (!out || !mid) return;
+
+ const xs = Array.from(
+ { length: meshColumns + 1 },
+ (_, i) => (i * compWidth) / meshColumns,
+ );
+ const ys = Array.from(
+ { length: meshRows + 1 },
+ (_, i) => (i * compHeight) / meshRows,
+ );
+ const xd = xs.slice();
+ const yd = ys.slice();
+ xd[Math.round(meshColumns / 2)] = colX;
+ yd[Math.round(meshRows / 2)] = rowY;
+
+ const gx = monotoneSpline(xd, xs);
+ const gy = monotoneSpline(yd, ys);
+
+ mid.clearRect(0, 0, compWidth, compHeight);
+ out.clearRect(0, 0, compWidth, compHeight);
+
+ for (let d0 = 0; d0 < compWidth; d0 += resampleStep) {
+ const d1 = Math.min(d0 + resampleStep, compWidth);
+ const s0 = gx(d0);
+ const sw = gx(d1) - s0;
+ if (sw <= 0) continue;
+ mid.drawImage(source, s0, 0, sw, compHeight, d0, 0, d1 - d0, compHeight);
+ }
+
+ for (let d0 = 0; d0 < compHeight; d0 += resampleStep) {
+ const d1 = Math.min(d0 + resampleStep, compHeight);
+ const s0 = gy(d0);
+ const sh = gy(d1) - s0;
+ if (sh <= 0) continue;
+ out.drawImage(scratch, 0, s0, compWidth, sh, 0, d0, compWidth, d1 - d0);
+ }
+ }, [
+ source,
+ scratch,
+ colX,
+ rowY,
+ compWidth,
+ compHeight,
+ meshRows,
+ meshColumns,
+ resampleStep,
+ ]);
+
+ return (
+ <div
+ className={className}
+ style={{ position: "absolute", inset: 0, overflow: "hidden" }}
+ >
+ {fontUrl ? <link rel="stylesheet" href={fontUrl} /> : null}
+ <canvas
+ ref={canvasRef}
+ width={compWidth}
+ height={compHeight}
+ style={{ width: "100%", height: "100%", display: "block" }}
+ />
+ </div>
+ );
+}
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index 67faa938..80ad87fc 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -213,6 +213,20 @@
}
]
},
+ {
+ "name": "kinetic-warp",
+ "type": "registry:component",
+ "title": "Kinetic Warp",
+ "description": "A coarse mesh warp bends a whole word in staccato beats, one axis per keyframe.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "kinetic-warp/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/kinetic-warp.tsx"
+ }
+ ]
+ },
{
"name": "kinetic-center-build",
"type": "registry:component",