Skip to content

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

feat: ink underline

kapishdimad3c7c45c6658
diff --git a/components/docs/examples/ink-underline-example.tsx b/components/docs/examples/ink-underline-example.tsx
new file mode 100644
index 00000000..727b7e26
--- /dev/null
+++ b/components/docs/examples/ink-underline-example.tsx
@@ -0,0 +1,84 @@
+"use client";
+
+import { AbsoluteFill } from "remotion";
+import { Handwrite, handwriteDuration } from "@/registry/remocn/handwrite";
+import { InkUnderline } from "@/registry/remocn/ink-underline";
+
+const URL_TEXT = "remocn.dev";
+
+export function InkUnderlineExampleScene({
+ width = 420,
+ color,
+ thickness,
+ durationSteps,
+ seed,
+ step,
+}: {
+ width?: number;
+ color?: string;
+ thickness?: number;
+ durationSteps?: number;
+ seed?: string;
+ step?: number;
+}) {
+ const written = handwriteDuration(URL_TEXT, { step });
+
+ return (
+ <AbsoluteFill
+ style={{
+ alignItems: "center",
+ justifyContent: "center",
+ flexDirection: "column",
+ gap: 4,
+ }}
+ >
+ <div style={{ position: "relative", width, height: 96 }}>
+ <Handwrite text={URL_TEXT} fontSize={64} step={step} />
+ </div>
+ <InkUnderline
+ width={width}
+ color={color}
+ thickness={thickness}
+ delay={written}
+ durationSteps={durationSteps}
+ seed={seed}
+ step={step}
+ />
+ </AbsoluteFill>
+ );
+}
+
+export const inkUnderlineExampleCode = (
+ values: Record<string, unknown>,
+): string => {
+ const width = (values.width as number) ?? 420;
+ const color = (values.color as string) ?? "#6f7f35";
+ const thickness = (values.thickness as number) ?? 9;
+ const durationSteps = (values.durationSteps as number) ?? 5;
+ const seed = (values.seed as string) ?? "ink";
+ const step = (values.step as number) ?? 3;
+ return `import { AbsoluteFill } from "remotion";
+import { Handwrite, handwriteDuration } from "@/components/remocn/handwrite";
+import { InkUnderline } from "@/components/remocn/ink-underline";
+
+const url = "${URL_TEXT}";
+
+export const MyScene = () => (
+ <AbsoluteFill
+ style={{ alignItems: "center", justifyContent: "center", flexDirection: "column", gap: 4 }}
+ >
+ <div style={{ position: "relative", width: ${width}, height: 96 }}>
+ <Handwrite text={url} fontSize={64} step={${step}} />
+ </div>
+ <InkUnderline
+ width={${width}}
+ color="${color}"
+ thickness={${thickness}}
+ delay={handwriteDuration(url, { step: ${step} })}
+ durationSteps={${durationSteps}}
+ seed="${seed}"
+ step={${step}}
+ />
+ </AbsoluteFill>
+);`;
+};
diff --git a/content/docs/components.mdx b/content/docs/components.mdx
index 3c8a1a0d..cf440686 100644
--- a/content/docs/components.mdx
+++ b/content/docs/components.mdx
@@ -137,6 +137,12 @@ Text effects, reveals, and kinetic type.
status: "stable",
href: "/docs/typography/marker-highlight",
},
+ {
+ name: "InkUnderline",
+ description: "A hand-dragged ink stroke that draws itself across in a few stop-motion poses",
+ status: "stable",
+ href: "/docs/typography/ink-underline",
+ },
{
name: "ShimmerSweep",
description: "Bright gradient sweeps across dim text, lighting it up",
diff --git a/content/docs/typography/ink-underline.mdx b/content/docs/typography/ink-underline.mdx
new file mode 100644
index 00000000..2f96ca50
--- /dev/null
+++ b/content/docs/typography/ink-underline.mdx
@@ -0,0 +1,111 @@
+---
+title: Ink Underline
+description: A hand-dragged ink stroke that draws itself across in a few stop-motion poses
+---
+
+<ComponentPreview name="ink-underline" />
+
+## Installation
+
+<InstallBlock name="ink-underline" />
+
+## Usage
+
+The stroke renders in normal flow — a block of `width` by `thickness + 4` — so it
+stacks under text in a flex column. Pair it with `handwrite` and start the drag
+the moment the writing finishes:
+
+```tsx
+// src/Root.tsx
+import { AbsoluteFill, Composition } from "remotion";
+import { Handwrite, handwriteDuration } from "@/components/remocn/handwrite";
+import { InkUnderline } from "@/components/remocn/ink-underline";
+
+const url = "remocn.dev";
+
+const InkUnderlineScene = () => (
+ <AbsoluteFill
+ style={{
+ background: "#f1eee7",
+ alignItems: "center",
+ justifyContent: "center",
+ flexDirection: "column",
+ gap: 4,
+ }}
+ >
+ <div style={{ position: "relative", width: 420, height: 96 }}>
+ <Handwrite text={url} fontSize={64} />
+ </div>
+ <InkUnderline width={420} delay={handwriteDuration(url)} />
+ </AbsoluteFill>
+);
+
+export const RemotionRoot = () => (
+ <Composition
+ id="InkUnderline"
+ component={InkUnderlineScene}
+ durationInFrames={60}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+);
+```
+
+`Handwrite` centres itself inside its nearest positioned ancestor, which is why
+it sits in a sized `position: relative` box here. The underline needs no such
+box — it is a block in the flow.
+
+The wobble in the stroke comes from `seed`: the same seed always draws the same
+curve, and changing it gives a different hand. `durationSteps` is how many
+stop-motion poses the drag takes, so the real length in frames is
+`durationSteps * step`.
+
+## Props
+
+<PropsTable
+ rows={[
+ {
+ name: "width",
+ type: "number",
+ required: true,
+ description: "Stroke length in pixels",
+ },
+ {
+ name: "color",
+ type: "string",
+ default: "\"#6f7f35\"",
+ description: "Ink colour (any valid CSS color)",
+ },
+ {
+ name: "thickness",
+ type: "number",
+ default: "9",
+ description: "Stroke width in pixels",
+ },
+ {
+ name: "delay",
+ type: "number",
+ default: "0",
+ description: "Frames on the local clock before the drag begins",
+ },
+ {
+ name: "durationSteps",
+ type: "number",
+ default: "5",
+ description: "Stop-motion poses the drag takes",
+ },
+ {
+ name: "seed",
+ type: "string",
+ default: "\"ink\"",
+ description: "Seed for the curve wobble — same seed, same stroke",
+ },
+ {
+ name: "step",
+ type: "number",
+ default: "3",
+ description: "Frames per stop-motion pose — the tempo control",
+ },
+ ]}
+/>
diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.json
index c35629c7..0bce43cd 100644
--- a/content/docs/typography/meta.json
+++ b/content/docs/typography/meta.json
@@ -25,6 +25,7 @@
"tracking-in",
"inline-highlight",
"marker-highlight",
+ "ink-underline",
"shimmer-sweep",
"typewriter",
"handwrite",
diff --git a/registry-artifacts/ink-underline.json b/registry-artifacts/ink-underline.json
new file mode 100644
index 00000000..cc84926b
--- /dev/null
+++ b/registry-artifacts/ink-underline.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "ink-underline",
+ "title": "Ink Underline",
+ "description": "A hand-dragged ink stroke that draws itself across in a few stop-motion poses, with a per-seed wobble.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/stop-motion"],
+ "files": [
+ {
+ "path": "registry/remocn/ink-underline/index.tsx",
+ "content": "\"use client\";\n\nimport { useCurrentFrame } from \"remotion\";\nimport { DEFAULT_STEP, hashRange, steppedRamp } from \"@/lib/remocn/stop-motion\";\n\nconst easeOutCubic = (t: number) => 1 - (1 - t) ** 3;\n\nexport interface InkUnderlineProps {\n width: number;\n color?: string;\n thickness?: number;\n delay?: number;\n durationSteps?: number;\n seed?: string;\n step?: number;\n}\n\nexport function InkUnderline({\n width,\n color = \"#6f7f35\",\n thickness = 9,\n delay = 0,\n durationSteps = 5,\n seed = \"ink\",\n step = DEFAULT_STEP,\n}: InkUnderlineProps) {\n const frame = useCurrentFrame();\n const progress = steppedRamp(frame, delay, delay + durationSteps * step, {\n ease: easeOutCubic,\n step,\n });\n const wobble = hashRange(`${seed}:w`, -1.2, 1.2);\n const height = thickness + 4;\n const mid = thickness / 2 + 2;\n\n return (\n <div\n style={{\n width,\n height,\n position: \"relative\",\n opacity: progress > 0 ? 1 : 0,\n }}\n >\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n style={{ display: \"block\", overflow: \"visible\" }}\n >\n <path\n d={`M 2 ${mid} C ${width * 0.3} ${mid + wobble}, ${width * 0.7} ${mid - wobble}, ${width - 2} ${mid + wobble * 0.6}`}\n stroke={color}\n strokeWidth={thickness}\n strokeLinecap=\"round\"\n fill=\"none\"\n pathLength={1}\n strokeDasharray={1}\n strokeDashoffset={1 - progress}\n opacity={0.82}\n />\n </svg>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/ink-underline.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.json
index 0f4e5140..80316937 100644
--- a/registry-artifacts/registry.json
+++ b/registry-artifacts/registry.json
@@ -1298,6 +1298,21 @@
],
"type": "registry:component"
},
+ {
+ "name": "ink-underline",
+ "title": "Ink Underline",
+ "description": "A hand-dragged ink stroke that draws itself across in a few stop-motion poses, with a per-seed wobble.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/stop-motion"],
+ "files": [
+ {
+ "path": "registry/remocn/ink-underline/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/ink-underline.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
{
"name": "stop-motion",
"title": "Stop Motion Clock",
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index bd2613d2..164c3cd9 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -26,6 +26,7 @@ import { grainDissolveConfig } from "@/registry/remocn/grain-dissolve/config";
import { handwriteConfig } from "@/registry/remocn/handwrite/config";
import { infiniteBentoPanConfig } from "@/registry/remocn/infinite-bento-pan/config";
import { infiniteMarqueeConfig } from "@/registry/remocn/infinite-marquee/config";
+import { inkUnderlineConfig } from "@/registry/remocn/ink-underline/config";
import { inlineHighlightConfig } from "@/registry/remocn/inline-highlight/config";
import { kineticCenterBuildConfig } from "@/registry/remocn/kinetic-center-build/config";
import { lineByLineSlideConfig } from "@/registry/remocn/line-by-line-slide/config";
@@ -417,6 +418,13 @@ const registry: Record<string, RegistryEntry> = {
})),
config: markerHighlightConfig,
},
+ "ink-underline": {
+ load: () =>
+ import("@/components/docs/examples/ink-underline-example").then((m) => ({
+ default: m.InkUnderlineExampleScene,
+ })),
+ config: inkUnderlineConfig,
+ },
"slot-machine-roll": {
load: () =>
import("@/registry/remocn/slot-machine-roll").then((m) => ({
diff --git a/registry/remocn/ink-underline/config.ts b/registry/remocn/ink-underline/config.ts
new file mode 100644
index 00000000..05f85bc4
--- /dev/null
+++ b/registry/remocn/ink-underline/config.ts
@@ -0,0 +1,49 @@
+import { inkUnderlineExampleCode } from "@/components/docs/examples/ink-underline-example";
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+
+export const inkUnderlineConfig: ComponentConfig = {
+ componentName: "InkUnderline",
+ importPath: "@/components/remocn/ink-underline",
+ controls: {
+ width: {
+ type: "number",
+ default: 420,
+ min: 100,
+ max: 800,
+ step: 10,
+ label: "Width",
+ },
+ color: { type: "color", default: "#6f7f35", label: "Ink color" },
+ thickness: {
+ type: "number",
+ default: 9,
+ min: 2,
+ max: 24,
+ step: 1,
+ label: "Thickness",
+ },
+ durationSteps: {
+ type: "number",
+ default: 5,
+ min: 2,
+ max: 10,
+ step: 1,
+ label: "Poses to draw",
+ },
+ seed: { type: "text", default: "ink", label: "Seed" },
+ step: {
+ type: "number",
+ default: 3,
+ min: 1,
+ max: 6,
+ step: 1,
+ label: "Frames / pose",
+ },
+ },
+ snippet: inkUnderlineExampleCode,
+ durationInFrames: 60,
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+ previewBackdrop: { type: "color", value: "#f1eee7" },
+};
diff --git a/registry/remocn/ink-underline/index.tsx b/registry/remocn/ink-underline/index.tsx
new file mode 100644
index 00000000..611fc0e1
--- /dev/null
+++ b/registry/remocn/ink-underline/index.tsx
@@ -0,0 +1,65 @@
+"use client";
+
+import { useCurrentFrame } from "remotion";
+import { DEFAULT_STEP, hashRange, steppedRamp } from "@/lib/remocn/stop-motion";
+
+const easeOutCubic = (t: number) => 1 - (1 - t) ** 3;
+
+export interface InkUnderlineProps {
+ width: number;
+ color?: string;
+ thickness?: number;
+ delay?: number;
+ durationSteps?: number;
+ seed?: string;
+ step?: number;
+}
+
+export function InkUnderline({
+ width,
+ color = "#6f7f35",
+ thickness = 9,
+ delay = 0,
+ durationSteps = 5,
+ seed = "ink",
+ step = DEFAULT_STEP,
+}: InkUnderlineProps) {
+ const frame = useCurrentFrame();
+ const progress = steppedRamp(frame, delay, delay + durationSteps * step, {
+ ease: easeOutCubic,
+ step,
+ });
+ const wobble = hashRange(`${seed}:w`, -1.2, 1.2);
+ const height = thickness + 4;
+ const mid = thickness / 2 + 2;
+
+ return (
+ <div
+ style={{
+ width,
+ height,
+ position: "relative",
+ opacity: progress > 0 ? 1 : 0,
+ }}
+ >
+ <svg
+ width={width}
+ height={height}
+ viewBox={`0 0 ${width} ${height}`}
+ style={{ display: "block", overflow: "visible" }}
+ >
+ <path
+ d={`M 2 ${mid} C ${width * 0.3} ${mid + wobble}, ${width * 0.7} ${mid - wobble}, ${width - 2} ${mid + wobble * 0.6}`}
+ stroke={color}
+ strokeWidth={thickness}
+ strokeLinecap="round"
+ fill="none"
+ pathLength={1}
+ strokeDasharray={1}
+ strokeDashoffset={1 - progress}
+ opacity={0.82}
+ />
+ </svg>
+ </div>
+ );
+}
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index 3453f27c..e2f71795 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -1298,6 +1298,21 @@
}
]
},
+ {
+ "name": "ink-underline",
+ "type": "registry:component",
+ "title": "Ink Underline",
+ "description": "A hand-dragged ink stroke that draws itself across in a few stop-motion poses, with a per-seed wobble.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/stop-motion"],
+ "files": [
+ {
+ "path": "ink-underline/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/ink-underline.tsx"
+ }
+ ]
+ },
{
"name": "stop-motion",
"type": "registry:lib",