Skip to content

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

Replace hero backdrop shader and fix header reveal (#284)

KapishDima5a5f3a7d2524
diff --git a/app/(home)/components/hero-terminal-bg.tsx b/app/(home)/components/hero-terminal-bg.tsx
index 9aea8d1a..616994f3 100644
--- a/app/(home)/components/hero-terminal-bg.tsx
+++ b/app/(home)/components/hero-terminal-bg.tsx
@@ -4,9 +4,12 @@ import dynamic from "next/dynamic";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
-const FaultyTerminal = dynamic(() => import("@/components/FaultyTerminal"), {
- ssr: false,
-});
+const RemocnShader = dynamic(
+ () => import("@/components/RemocnShader.webgl").then((m) => m.RemocnShader),
+ { ssr: false },
+);
+
+const BACKGROUND = { dark: "#090b0c", light: "#ffffff" };
const MASK =
"[mask-image:radial-gradient(ellipse_92%_68%_at_50%_58%,black_14%,transparent_84%),linear-gradient(to_bottom,transparent_4%,black_30%,black_88%,transparent_100%),radial-gradient(ellipse_44%_30%_at_50%_31%,transparent_46%,black_92%)]";
@@ -14,42 +17,20 @@ const MASK =
export function HeroTerminalBg() {
const { resolvedTheme } = useTheme();
const [mounted, setMounted] = useState(false);
- const [reduced, setReduced] = useState(false);
useEffect(() => {
setMounted(true);
- setReduced(window.matchMedia("(prefers-reduced-motion: reduce)").matches);
}, []);
if (!mounted) return null;
- const light = resolvedTheme !== "dark";
-
return (
<div
- className={`absolute inset-x-0 -top-22 h-screen [mask-composite:intersect] ${MASK}`}
+ className={`absolute inset-x-0 -top-[388px] h-[150vh] [mask-composite:intersect] ${MASK}`}
>
- <FaultyTerminal
- className="h-full w-full mix-blend-multiply dark:mix-blend-normal"
- lightMode={light}
- tint={light ? "#e879f9" : "#701a75"}
- scale={1.5}
- digitSize={1.2}
- dpr={1}
- timeScale={reduced ? 0 : 0.3}
- pause={reduced}
- scanlineIntensity={0.28}
- glitchAmount={1}
- flickerAmount={1}
- noiseAmp={1}
- chromaticAberration={0}
- dither={0}
- curvature={0.1}
- brightness={0.45}
- mouseReact={!reduced}
- mouseStrength={0.5}
- pageLoadAnimation={false}
- timeOffset={0}
+ <RemocnShader
+ theme={resolvedTheme === "dark" ? "dark" : "light"}
+ background={BACKGROUND}
/>
</div>
);
diff --git a/app/(home)/components/section-heading.tsx b/app/(home)/components/section-heading.tsx
index 56743b39..f8487fec 100644
--- a/app/(home)/components/section-heading.tsx
+++ b/app/(home)/components/section-heading.tsx
@@ -9,7 +9,6 @@ import { FadeUp } from "./fade-up";
* An optional `action` slot sits inline on the right at desktop widths.
*/
export function SectionHeading({
- eyebrow,
title,
lead,
action,
diff --git a/app/(home)/components/sections/hero.tsx b/app/(home)/components/sections/hero.tsx
index e195d8c8..66e51421 100644
--- a/app/(home)/components/sections/hero.tsx
+++ b/app/(home)/components/sections/hero.tsx
@@ -15,7 +15,6 @@ export function Hero() {
return (
<section className="relative isolate pt-8 pb-12 sm:pt-16 sm:pb-24">
<div aria-hidden className="absolute inset-0 -z-10">
- <div className="absolute inset-0 bg-grid-fade" />
<HeroTerminalBg />
</div>
@@ -34,7 +33,7 @@ export function Hero() {
</FadeUp>
<FadeUp gate="landing-intro" delay={0.12}>
- <p className="mt-4 max-w-2xl text-balance text-base leading-relaxed text-muted-foreground sm:text-lg">
+ <p className="mt-4 max-w-2xl text-balance text-base leading-relaxed text-foreground [text-shadow:0_0_10px_var(--background),0_0_20px_var(--background)] sm:text-lg">
Describe your product to your AI agent. It builds the demo video
from ready-made pieces while you watch in the browser.
</p>
diff --git a/app/(home)/components/sticky-header-shell.tsx b/app/(home)/components/sticky-header-shell.tsx
index c1131034..1bb10132 100644
--- a/app/(home)/components/sticky-header-shell.tsx
+++ b/app/(home)/components/sticky-header-shell.tsx
@@ -22,6 +22,7 @@ export function StickyHeaderShell({ children }: { children: ReactNode }) {
useEffect(() => {
let zoom: HTMLElement | null = null;
+ let run = 0;
const evaluate = () => {
const height = headerRef.current?.offsetHeight ?? HEADER_HEIGHT;
@@ -31,7 +32,7 @@ export function StickyHeaderShell({ children }: { children: ReactNode }) {
if (!zoom) {
y.set(0);
- prevPast.current = true;
+ prevPast.current = null;
return;
}
@@ -40,9 +41,13 @@ export function StickyHeaderShell({ children }: { children: ReactNode }) {
if (!first && past !== prevPast.current) {
animating.current = true;
- animate(y, past ? 0 : -height, REVEAL_SPRING).then(() => {
+ const id = ++run;
+ const settle = () => {
+ if (id !== run) return;
animating.current = false;
- });
+ schedule();
+ };
+ animate(y, past ? 0 : -height, REVEAL_SPRING).then(settle, settle);
} else if (past) {
if (first) y.set(0);
} else if (!animating.current) {
diff --git a/app/(home)/sponsors/components/sections/hero.tsx b/app/(home)/sponsors/components/sections/hero.tsx
index e80e46f3..877fa380 100644
--- a/app/(home)/sponsors/components/sections/hero.tsx
+++ b/app/(home)/sponsors/components/sections/hero.tsx
@@ -43,13 +43,12 @@ export function Hero() {
return (
<section className="relative isolate pt-20 pb-4 sm:pt-24 sm:pb-6">
<div aria-hidden className="absolute inset-0 -z-10">
- <div className="absolute inset-0 bg-grid-fade" />
<HeroTerminalBg />
</div>
<div className="section">
<div className="flex flex-col items-center text-center">
<FadeUp gate={INTRO_GATE} delay={0.06}>
- <p className="mb-3 font-mono text-xs font-medium text-muted-foreground">
+ <p className="mb-3 font-mono text-xs font-medium text-muted-foreground [text-shadow:0_0_10px_var(--background),0_0_20px_var(--background)]">
Sponsors
</p>
</FadeUp>
@@ -59,7 +58,7 @@ export function Hero() {
</h1>
</FadeUp>
<FadeUp gate={INTRO_GATE} delay={0.16}>
- <p className="mt-6 max-w-2xl text-pretty text-base leading-relaxed text-muted-foreground sm:text-lg">
+ <p className="mt-6 max-w-2xl text-pretty text-base leading-relaxed text-foreground [text-shadow:0_0_10px_var(--background),0_0_20px_var(--background)] sm:text-lg">
remocn is open-source and free. Your sponsorship helps us spend
more time building premium animations and keeping the project
alive.
diff --git a/app/api/lab/hero-shader/route.ts b/app/api/lab/hero-shader/route.ts
new file mode 100644
index 00000000..39525674
--- /dev/null
+++ b/app/api/lab/hero-shader/route.ts
@@ -0,0 +1,22 @@
+import { writeFile } from "node:fs/promises";
+import path from "node:path";
+import { type NextRequest, NextResponse } from "next/server";
+
+const TARGET = path.join(
+ process.cwd(),
+ "app",
+ "lab",
+ "hero-shader",
+ "saved.json",
+);
+
+export async function POST(request: NextRequest) {
+ if (process.env.NODE_ENV === "production") {
+ return new NextResponse("Not found", { status: 404 });
+ }
+
+ const body = await request.json();
+ await writeFile(TARGET, `${JSON.stringify(body, null, 2)}\n`, "utf8");
+
+ return NextResponse.json({ path: path.relative(process.cwd(), TARGET) });
+}
diff --git a/app/globals.css b/app/globals.css
index 507db0ea..ac30f5a5 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -274,6 +274,11 @@
);
}
+[data-rehype-pretty-code-figure] pre {
+ scrollbar-width: thin;
+ scrollbar-color: color-mix(in oklab, currentColor 25%, transparent)
+ transparent;
+}
.typeset figure.shiki {
/* biome-ignore lint/complexity/noImportantStyles: overrides shiki's own inline background/border/shadow, which outrank this class in specificity */
background-color: var(--muted) !important;
@@ -288,8 +293,7 @@
/* biome-ignore lint/complexity/noImportantStyles: see above */
background-color: transparent !important;
}
-.typeset figure.shiki pre,
-[data-rehype-pretty-code-figure] pre {
+.typeset figure.shiki pre {
scrollbar-width: thin;
scrollbar-color: color-mix(in oklab, currentColor 25%, transparent)
transparent;
@@ -309,6 +313,7 @@
[data-slot="copy-button"] {
top: calc(var(--spacing) * 1.5);
}
+/* biome-ignore lint/style/noDescendingSpecificity: rehype-pretty-code markup never carries .typeset figure.shiki, so the earlier rule cannot apply here */
[data-rehype-pretty-code-figure] pre,
[data-rehype-pretty-code-figure] code {
font-family: var(--font-mono);
@@ -358,6 +363,7 @@
width: 100%;
padding-block: calc(var(--spacing) * 0.25);
}
+/* biome-ignore lint/style/noDescendingSpecificity: sets the shiki token colour every span inherits; the earlier rule deliberately owns layout only */
[data-line] span {
color: var(--shiki-light);
}
diff --git a/app/lab/hero-shader/hero-shader-lab.tsx b/app/lab/hero-shader/hero-shader-lab.tsx
new file mode 100644
index 00000000..94ef9f54
--- /dev/null
+++ b/app/lab/hero-shader/hero-shader-lab.tsx
@@ -0,0 +1,493 @@
+"use client";
+
+import { ArrowRight } from "lucide-react";
+import dynamic from "next/dynamic";
+import { useEffect, useState } from "react";
+import { Button } from "@/components/ui/button";
+import { Label } from "@/components/ui/label";
+import {
+ NativeSelect,
+ NativeSelectOption,
+} from "@/components/ui/native-select";
+import { Slider } from "@/components/ui/slider";
+import { Switch } from "@/components/ui/switch";
+import {
+ type ControlConfig,
+ type ControlType,
+ getDefaults,
+} from "@/lib/customizer-config";
+
+const RemocnShader = dynamic(
+ () => import("@/components/RemocnShader.webgl").then((m) => m.RemocnShader),
+ { ssr: false },
+);
+
+const PANEL_WIDTH = 360;
+const BACKGROUND = { dark: "#090b0c", light: "#ffffff" };
+
+const CONTROLS: ControlConfig = {
+ theme: {
+ type: "select",
+ default: "dark",
+ options: ["dark", "light"],
+ label: "Theme",
+ },
+ maskOnly: { type: "boolean", default: false, label: "Show mask only" },
+
+ offsetTop: {
+ type: "number",
+ default: -288,
+ min: -700,
+ max: 200,
+ step: 4,
+ label: "Offset top (px)",
+ },
+ height: {
+ type: "number",
+ default: 100,
+ min: 60,
+ max: 180,
+ step: 5,
+ label: "Height (vh)",
+ },
+
+ vignette: { type: "boolean", default: true, label: "L1 vignette" },
+ vignetteW: {
+ type: "number",
+ default: 92,
+ min: 20,
+ max: 200,
+ step: 2,
+ label: "L1 width %",
+ },
+ vignetteH: {
+ type: "number",
+ default: 68,
+ min: 10,
+ max: 200,
+ step: 2,
+ label: "L1 height %",
+ },
+ vignetteX: {
+ type: "number",
+ default: 50,
+ min: 0,
+ max: 100,
+ step: 1,
+ label: "L1 center X %",
+ },
+ vignetteY: {
+ type: "number",
+ default: 58,
+ min: -50,
+ max: 150,
+ step: 1,
+ label: "L1 center Y %",
+ },
+ vignetteSolid: {
+ type: "number",
+ default: 14,
+ min: 0,
+ max: 100,
+ step: 2,
+ label: "L1 solid stop %",
+ },
+ vignetteFade: {
+ type: "number",
+ default: 84,
+ min: 0,
+ max: 100,
+ step: 2,
+ label: "L1 fade stop %",
+ },
+
+ vertical: { type: "boolean", default: true, label: "L2 vertical fade" },
+ verticalTop: {
+ type: "number",
+ default: 4,
+ min: -50,
+ max: 100,
+ step: 2,
+ label: "L2 top clear %",
+ },
+ verticalIn: {
+ type: "number",
+ default: 30,
+ min: -50,
+ max: 100,
+ step: 2,
+ label: "L2 top solid %",
+ },
+ verticalOut: {
+ type: "number",
+ default: 88,
+ min: 0,
+ max: 150,
+ step: 2,
+ label: "L2 bottom solid %",
+ },
+ verticalEnd: {
+ type: "number",
+ default: 100,
+ min: 0,
+ max: 150,
+ step: 2,
+ label: "L2 bottom clear %",
+ },
+
+ well: { type: "boolean", default: true, label: "L3 copy well" },
+ wellW: {
+ type: "number",
+ default: 44,
+ min: 0,
+ max: 150,
+ step: 2,
+ label: "L3 width %",
+ },
+ wellH: {
+ type: "number",
+ default: 30,
+ min: 0,
+ max: 150,
+ step: 2,
+ label: "L3 height %",
+ },
+ wellX: {
+ type: "number",
+ default: 50,
+ min: 0,
+ max: 100,
+ step: 1,
+ label: "L3 center X %",
+ },
+ wellY: {
+ type: "number",
+ default: 31,
+ min: -50,
+ max: 150,
+ step: 1,
+ label: "L3 center Y %",
+ },
+ wellClear: {
+ type: "number",
+ default: 46,
+ min: 0,
+ max: 100,
+ step: 2,
+ label: "L3 clear stop %",
+ },
+ wellSolid: {
+ type: "number",
+ default: 92,
+ min: 0,
+ max: 100,
+ step: 2,
+ label: "L3 solid stop %",
+ },
+};
+
+type LabValues = {
+ theme: string;
+ maskOnly: boolean;
+ offsetTop: number;
+ height: number;
+ vignette: boolean;
+ vignetteW: number;
+ vignetteH: number;
+ vignetteX: number;
+ vignetteY: number;
+ vignetteSolid: number;
+ vignetteFade: number;
+ vertical: boolean;
+ verticalTop: number;
+ verticalIn: number;
+ verticalOut: number;
+ verticalEnd: number;
+ well: boolean;
+ wellW: number;
+ wellH: number;
+ wellX: number;
+ wellY: number;
+ wellClear: number;
+ wellSolid: number;
+};
+
+function buildLayers(v: LabValues) {
+ const layers: string[] = [];
+ if (v.vignette) {
+ layers.push(
+ `radial-gradient(ellipse ${v.vignetteW}% ${v.vignetteH}% at ${v.vignetteX}% ${v.vignetteY}%, black ${v.vignetteSolid}%, transparent ${v.vignetteFade}%)`,
+ );
+ }
+ if (v.vertical) {
+ layers.push(
+ `linear-gradient(to bottom, transparent ${v.verticalTop}%, black ${v.verticalIn}%, black ${v.verticalOut}%, transparent ${v.verticalEnd}%)`,
+ );
+ }
+ if (v.well) {
+ layers.push(
+ `radial-gradient(ellipse ${v.wellW}% ${v.wellH}% at ${v.wellX}% ${v.wellY}%, transparent ${v.wellClear}%, black ${v.wellSolid}%)`,
+ );
+ }
+ return layers;
+}
+
+function buildClassName(v: LabValues) {
+ const layers = buildLayers(v);
+ const offset =
+ v.offsetTop < 0 ? `-top-[${-v.offsetTop}px]` : `top-[${v.offsetTop}px]`;
+ const parts = ["absolute", "inset-x-0", offset, `h-[${v.height}vh]`];
+ if (layers.length > 1) parts.push("[mask-composite:intersect]");
+ if (layers.length > 0) {
+ parts.push(`[mask-image:${layers.join(",").replace(/ /g, "_")}]`);
+ }
+ return parts.join(" ");
+}
+
+function Row({
+ id,
+ ctrl,
+ value,
+ onChange,
+}: {
+ id: string;
+ ctrl: ControlType;
+ value: unknown;
+ onChange: (value: unknown) => void;
+}) {
+ if (ctrl.type === "boolean") {
+ return (
+ <div className="flex items-center justify-between gap-3 py-1">
+ <Label htmlFor={id} className="text-xs text-muted-foreground">
+ {ctrl.label}
+ </Label>
+ <Switch
+ id={id}
+ checked={value as boolean}
+ onCheckedChange={(next) => onChange(next)}
+ />
+ </div>
+ );
+ }
+
+ if (ctrl.type === "select") {
+ return (
+ <div className="flex items-center justify-between gap-3 py-1">
+ <Label htmlFor={id} className="text-xs text-muted-foreground">
+ {ctrl.label}
+ </Label>
+ <NativeSelect
+ id={id}
+ value={value as string}
+ onChange={(event) => onChange(event.target.value)}
+ className="h-8 w-28 text-xs"
+ >
+ {ctrl.options.map((option) => (
+ <NativeSelectOption key={option} value={option}>
+ {option}
+ </NativeSelectOption>
+ ))}
+ </NativeSelect>
+ </div>
+ );
+ }
+
+ if (ctrl.type === "number" || ctrl.type === "number-input") {
+ return (
+ <div className="py-1">
+ <div className="mb-1.5 flex items-baseline justify-between gap-3">
+ <Label htmlFor={id} className="text-xs text-muted-foreground">
+ {ctrl.label}
+ </Label>
+ <span className="font-mono text-xs tabular-nums text-foreground">
+ {value as number}
+ </span>
+ </div>
+ <Slider
+ id={id}
+ value={value as number}
+ min={ctrl.min}
+ max={ctrl.max}
+ step={ctrl.step}
+ onValueChange={(next) =>
+ onChange(Array.isArray(next) ? next[0] : next)
+ }
+ />
+ </div>
+ );
+ }
+
+ return null;
+}
+
+const GROUP_START = new Set(["offsetTop", "vignette", "vertical", "well"]);
+
+function Panel({
+ controls,
+ values,
+ onChange,
+}: {
+ controls: ControlConfig;
+ values: Record<string, unknown>;
+ onChange: (key: string, value: unknown) => void;
+}) {
+ return (
+ <div className="flex flex-col gap-1">
+ {Object.entries(controls).map(([key, ctrl]) => (
+ <div key={key}>
+ {GROUP_START.has(key) && (
+ <div aria-hidden className="my-3 h-px bg-border" />
+ )}
+ <Row
+ id={`ctrl-${key}`}
+ ctrl={ctrl}
+ value={values[key]}
+ onChange={(value) => onChange(key, value)}
+ />
+ </div>
+ ))}
+ </div>
+ );
+}
+
+export function HeroShaderLab() {
+ const [values, setValues] = useState<Record<string, unknown>>(() =>
+ getDefaults(CONTROLS),
+ );
+ const [panel, setPanel] = useState(true);
+ const [saved, setSaved] = useState<string | null>(null);
+ const [viewport, setViewport] = useState(0);
+
+ useEffect(() => {
+ const read = () => setViewport(window.innerHeight);
+ read();
+ window.addEventListener("resize", read);
+ return () => window.removeEventListener("resize", read);
+ }, []);
+
+ const v = values as unknown as LabValues;
+ const layers = buildLayers(v);
+ const className = buildClassName(v);
+
+ const save = async () => {
+ const response = await fetch("/api/lab/hero-shader", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ savedAt: new Date().toISOString(),
+ viewportHeight: viewport,
+ values: v,
+ className,
+ maskImage: layers.join(", "),
+ }),
+ });
+ const body = (await response.json()) as { path?: string };
+ setSaved(body.path ?? "write failed");
+ };
+
+ return (
+ <div className="min-h-screen bg-background">
+ <section className="relative isolate pt-8 pb-12 sm:pt-16 sm:pb-24">
+ <div aria-hidden className="absolute inset-0 -z-10">
+ <div
+ className="absolute inset-x-0"
+ style={{
+ top: v.offsetTop,
+ height: `${v.height}vh`,
+ maskImage: layers.length ? layers.join(", ") : undefined,
+ maskComposite: layers.length > 1 ? "intersect" : undefined,
+ }}
+ >
+ {v.maskOnly ? (
+ <div className="h-full w-full bg-foreground" />
+ ) : (
+ <RemocnShader
+ theme={v.theme === "light" ? "light" : "dark"}
+ background={BACKGROUND}
+ />
+ )}
+ </div>
+ </div>
+
+ <div className="section">
+ <div className="flex flex-col items-center text-center">
+ <span className="mb-6 inline-flex items-center gap-2 rounded-full border border-border bg-card/70 px-3 py-1 text-xs text-muted-foreground">
+ Introducing SaaS Typography
+ </span>
+ <h1 className="max-w-3xl text-balance text-3xl font-semibold leading-[1.1] tracking-tight text-foreground sm:text-4xl md:text-5xl">
+ You want the video,
+ <br className="hidden sm:block" /> not the ordeal.
+ </h1>
+ <p className="mt-4 max-w-2xl text-balance text-base leading-relaxed text-foreground [text-shadow:0_0_10px_var(--background),0_0_20px_var(--background)] sm:text-lg">
+ Describe your product to your AI agent. It builds the demo video
+ from ready-made pieces while you watch in the browser.
+ </p>
+ <div className="mt-7 flex flex-col items-center gap-3 sm:flex-row">
+ <Button size="lg" className="rounded-full">
+ Make your first video
+ <ArrowRight
+ data-icon="inline-end"
+ className="size-4"
+ aria-hidden="true"
+ />
+ </Button>
+ <Button
+ variant="secondary"
+ size="lg"
+ className="rounded-full font-medium"
+ >
+ See what ships
+ </Button>
+ </div>
+ </div>
+ </div>
+
+ <div className="section mt-16">
+ <div className="aspect-video w-full rounded-2xl border border-border bg-card" />
+ </div>
+ </section>
+
+ <div className="fixed bottom-4 left-4 z-50">
+ <Button size="sm" variant="secondary" onClick={() => setPanel(!panel)}>
+ {panel ? "Hide panel" : "Show panel"}
+ </Button>
+ </div>
+
+ {panel && (
+ <div
+ className="fixed inset-y-0 right-0 z-50 overflow-y-auto border-l border-border bg-background/95 p-4 backdrop-blur"
+ style={{ width: PANEL_WIDTH }}
+ >
+ <div className="mb-4 flex items-center justify-between">
+ <Label className="text-xs text-muted-foreground">
+ Viewport {viewport}px
+ </Label>
+ <Button size="sm" onClick={save}>
+ Save
+ </Button>
+ </div>
+
+ <Panel
+ controls={CONTROLS}
+ values={values}
+ onChange={(key, value) =>
+ setValues((prev) => ({ ...prev, [key]: value }))
+ }
+ />
+
+ <div className="mt-6">
+ <Label className="text-xs text-muted-foreground">className</Label>
+ <pre className="mt-2 whitespace-pre-wrap break-all rounded-lg bg-muted p-3 text-[11px] leading-relaxed text-foreground">
+ {className}
+ </pre>
+ {saved && (
+ <p className="mt-2 font-mono text-[11px] text-muted-foreground">
+ wrote {saved}
+ </p>
+ )}
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/app/lab/hero-shader/page.tsx b/app/lab/hero-shader/page.tsx
new file mode 100644
index 00000000..49055302
--- /dev/null
+++ b/app/lab/hero-shader/page.tsx
@@ -0,0 +1,11 @@
+import type { Metadata } from "next";
+import { HeroShaderLab } from "./hero-shader-lab";
+
+export const metadata: Metadata = {
+ title: "Hero shader lab",
+ robots: { index: false, follow: false },
+};
+
+export default function Page() {
+ return <HeroShaderLab />;
+}
diff --git a/app/lab/hero-shader/saved.json b/app/lab/hero-shader/saved.json
new file mode 100644
index 00000000..89a16035
--- /dev/null
+++ b/app/lab/hero-shader/saved.json
@@ -0,0 +1,31 @@
+{
+ "savedAt": "2026-09-09T11:57:45.083Z",
+ "viewportHeight": 927,
+ "values": {
+ "theme": "dark",
+ "maskOnly": false,
+ "offsetTop": -388,
+ "height": 150,
+ "vignette": true,
+ "vignetteW": 92,
+ "vignetteH": 68,
+ "vignetteX": 50,
+ "vignetteY": 58,
+ "vignetteSolid": 14,
+ "vignetteFade": 84,
+ "vertical": true,
+ "verticalTop": 4,
+ "verticalIn": 30,
+ "verticalOut": 88,
+ "verticalEnd": 100,
+ "well": true,
+ "wellW": 44,
+ "wellH": 30,
+ "wellX": 50,
+ "wellY": 31,
+ "wellClear": 46,
+ "wellSolid": 92
+ },
+ "className": "absolute inset-x-0 -top-[388px] h-[150vh] [mask-composite:intersect] [mask-image:radial-gradient(ellipse_92%_68%_at_50%_58%,_black_14%,_transparent_84%),linear-gradient(to_bottom,_transparent_4%,_black_30%,_black_88%,_transparent_100%),radial-gradient(ellipse_44%_30%_at_50%_31%,_transparent_46%,_black_92%)]",
+ "maskImage": "radial-gradient(ellipse 92% 68% at 50% 58%, black 14%, transparent 84%), linear-gradient(to bottom, transparent 4%, black 30%, black 88%, transparent 100%), radial-gradient(ellipse 44% 30% at 50% 31%, transparent 46%, black 92%)"
+}
diff --git a/app/typeset.css b/app/typeset.css
index 8efc80bb..a2a68c6b 100644
--- a/app/typeset.css
+++ b/app/typeset.css
@@ -454,6 +454,7 @@
&:where(pre, table, blockquote, figure) {
break-inside: avoid;
}
+ /* biome-ignore lint/style/noDescendingSpecificity: print-only rule, never in the cascade with the screen rule it is compared against */
&:where(h1, h2, h3, h4) {
break-after: avoid;
}
@@ -461,6 +462,7 @@
/* Forced colors strips the code background, so give it a border. */
@media (forced-colors: active) {
+ /* biome-ignore lint/style/noDescendingSpecificity: forced-colors-only rule, never in the cascade with the rule it is compared against */
&:where(:not(pre) > code) {
border: 1px solid;
}
diff --git a/components/RemocnShader.webgl.tsx b/components/RemocnShader.webgl.tsx
new file mode 100644
index 00000000..5b1935d9
--- /dev/null
+++ b/components/RemocnShader.webgl.tsx
@@ -0,0 +1,620 @@
+/*
+ * @remocn · OpenShaders
+ * https://openshaders.com/@remocn
+ * WebGL2 · React component (TypeScript) · halftone
+ */
+
+"use client";
+
+import { type CSSProperties, useEffect, useRef } from "react";
+
+const VERTEX_SHADER = `#version 300 es
+void main() {
+ vec2 position = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
+ gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
+}
+`;
+
+const FIELD_SHADER = `#version 300 es
+precision highp float;
+
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+out vec4 fragColor;
+
+const float HUE = 0.663466752;
+const float HUE_SPREAD = 0.314346701;
+const float HUE_TRAVEL = 1.65112376;
+const float CHROMA = 0.160295546;
+const float LIGHTNESS = 0.537409723;
+const float COLOUR_CYCLE = 0.124862425;
+const float THETA = 2.12986207;
+const float SHEAR = 0.968176901;
+const float SHRINK = 0.955401778;
+const float LAYERS = 72.0;
+const float WARP_FREQ_X = 0.439311415;
+const float WARP_FREQ_Y = 2.87923527;
+const float WARP_AMP_X = 0.156202048;
+const float WARP_AMP_Y = 0.0256033838;
+const float ASPECT_X = 2.23183894;
+const float ASPECT_Y = 0.15731883;
+const float OFFSET_X = 0.375628948;
+const float OFFSET_Y = -0.017801486;
+const float TILT = 1.63293767;
+const float ZOOM = 0.93135649;
+const float CENTRE_X = -0.0956316143;
+const float CENTRE_Y = -0.520057321;
+const float GLOW_SIZE = 0.00201825937;
+const float FALLOFF = 0.352821857;
+const float VIGNETTE = 0.136085436;
+const float FLOW_SPEED = 0.391012281;
+const float FLOW_DIRECTION = 1.0;
+const float BREATH_RATE = 0.382053256;
+const float BREATH_AMOUNT = 0.0873704553;
+const float PHASE = 56.3862724;
+const float ECHO = 0.0;
+const float ECHO_SHIFT = 0.178754866;
+const float SOFTNESS = 0.00164903817;
+const float LIGHT_SWING = 0.149726808;
+
+const float TAU = 6.28318530718;
+
+vec3 oklchToLinear(float L, float C, float h) {
+ float a = C * cos(h), b = C * sin(h);
+ float l_ = L + 0.3963377774 * a + 0.2158037573 * b;
+ float m_ = L - 0.1055613458 * a - 0.0638541728 * b;
+ float s_ = L - 0.0894841775 * a - 1.2914855480 * b;
+ vec3 lms = vec3(l_, m_, s_);
+ lms = lms * lms * lms;
+ return mat3(4.0767416621, -1.2684380046, -0.0041960863,
+ -3.3077115913, 2.6097574011, -0.7034186147,
+ 0.2309699292, -0.3413193965, 1.7076147010) * lms;
+}
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+void main() {
+ vec2 R = iResolution.xy;
+ vec2 pos = (gl_FragCoord.xy - 0.5 * R) / R.y;
+ float t = iTime * FLOW_SPEED * FLOW_DIRECTION + PHASE;
+ float breath = (-sin(iTime * BREATH_RATE * 1.5) + sin(iTime * BREATH_RATE + 1.0)) * 0.25 + 0.5;
+
+ vec2 u = (pos - vec2(CENTRE_X, CENTRE_Y)) * (ZOOM - breath * BREATH_AMOUNT);
+ float ct = cos(TILT), st = sin(TILT);
+ u = mat2(ct, st, -st, ct) * u;
+
+ mat2 fold = mat2(cos(THETA), sin(THETA), -SHEAR, cos(THETA));
+
+ float hue0 = HUE * TAU;
+ float hue1 = hue0 + HUE_SPREAD * TAU;
+ vec3 color = vec3(0.0);
+
+ for (float i = 1.0; i <= 96.0; i += 1.0) {
+ if (i > LAYERS) break;
+ u.x += -sin(u.y * WARP_FREQ_X + t + i * 0.007) * WARP_AMP_X;
+ u.y += -sin(u.x * WARP_FREQ_Y - t + i * 0.02) * WARP_AMP_Y;
+ u = fold * u * SHRINK;
+
+ vec2 q = u - vec2(OFFSET_X + breath * 0.1, OFFSET_Y);
+ vec2 s = vec2(q.x * ASPECT_X, q.y * ASPECT_Y);
+ float glow = GLOW_SIZE / (dot(s, s) + SOFTNESS);
+#ifndef SKIP_ECHO
+ vec2 e = vec2((q.x - ECHO_SHIFT) * ASPECT_X, s.y);
+ glow += ECHO * GLOW_SIZE / (dot(e, e) + SOFTNESS);
+#endif
+ glow *= 0.25 + breath * 0.4;
+
+ float r = length(u);
+ float k = sin(i * COLOUR_CYCLE + t * 1.2 + r * HUE_TRAVEL) * 0.5 + 0.5;
+ vec3 tint = clamp(oklchToLinear(LIGHTNESS + LIGHT_SWING * k, CHROMA * (0.75 + 0.35 * k), mix(hue0, hue1, k)), 0.0, 1.0);
+ color += glow * tint * exp2(-r * FALLOFF);
+ }
+
+ vec3 x = max(color, 0.0);
+ color = (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
+ color = pow(clamp(color, 0.0, 1.0), vec3(0.85, 0.92, 0.98));
+
+ float edge = smoothstep(0.5, 1.6, length(pos));
+ color *= 1.0 - edge * VIGNETTE;
+
+ vec3 dark = uDarkBackground + color * (1.0 - uDarkBackground);
+ float strength = max(color.r, max(color.g, color.b));
+ vec3 light = uLightBackground * (1.0 - strength) + color * 0.96;
+ color = mix(dark, light, uLightMode);
+
+ color += (blueNoise(gl_FragCoord.xy, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+const RARITY_SHADER = `#version 300 es
+precision highp float;
+
+uniform sampler2D tScene;
+uniform vec2 iResolution;
+uniform float iTime;
+uniform float uLightMode;
+uniform vec3 uDarkBackground;
+uniform vec3 uLightBackground;
+uniform float uPixelRatio;
+out vec4 fragColor;
+
+const float uStrength = 0.797335207;
+const float uScale = 0.985214949;
+const float uSeed = 0.435611069;
+
+const float TAU = 6.28318530718;
+const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722);
+
+vec3 toInk(vec3 c) { return mix(c - uDarkBackground, uLightBackground - c, uLightMode); }
+vec3 fromInk(vec3 ink) { return mix(uDarkBackground + ink, uLightBackground - ink, uLightMode); }
+vec3 sceneInk(vec2 uv) { return toInk(texture(tScene, clamp(uv, 0.0, 1.0)).rgb); }
+
+float blueNoise(vec2 p, float frame) {
+ p += 5.588238 * mod(frame, 64.0);
+ return fract(52.9829189 * fract(0.06711056 * p.x + 0.00583715 * p.y));
+}
+
+vec3 halftone(vec2 frag) {
+ float cell = max(3.0, uScale * 3.6 * uPixelRatio);
+ float angle = 0.26 + uSeed * 0.3;
+ mat2 turn = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));
+ vec2 rotated = turn * frag;
+ vec2 grid = floor(rotated / cell);
+ vec2 centre = (grid + 0.5) * cell;
+ vec2 source = transpose(turn) * centre;
+ vec3 soft = sceneInk(frag / iResolution);
+ vec3 ink = sceneInk(source / iResolution);
+ float level = clamp(dot(ink, LUMA), 0.0, 1.0);
+ float radius = cell * sqrt(pow(level, 0.9) / 3.14159265);
+ float dist = length(rotated - centre);
+ float aa = 0.7 * uPixelRatio;
+ float dot_ = 1.0 - smoothstep(radius - aa, radius + aa, dist);
+ vec3 dots = ink * min(0.8 / max(level, 1e-3), 2.2) * dot_;
+ float presence = smoothstep(0.03, 0.16, level) * (0.3 + 0.14 * uStrength);
+ return mix(soft, dots, presence);
+}
+
+void main() {
+ vec2 frag = gl_FragCoord.xy;
+ vec3 ink = halftone(frag);
+ vec3 color = fromInk(clamp(ink, 0.0, 1.0));
+ color += (blueNoise(frag, floor(iTime * 24.0)) - 0.5) / 255.0;
+ fragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
+}
+`;
+
+export type ShaderTheme = "dark" | "light";
+
+export type ShaderOptions = {
+ theme?: ShaderTheme;
+ background?: { dark?: string; light?: string };
+ autoplay?: boolean;
+ signal?: AbortSignal;
+ onError?: (error: Error) => void;
+};
+
+export type ShaderHandle = {
+ setTheme(theme: ShaderTheme): void;
+
+ render(time: number): void;
+ destroy(): void;
+};
+
+export type RemocnShaderProps = {
+ theme?: ShaderTheme;
+ background?: { dark?: string; light?: string };
+ time?: number;
+ onError?: (error: Error) => void;
+ className?: string;
+ style?: CSSProperties;
+};
+
+export function RemocnShader({
+ theme = "dark",
+ background,
+ time,
+ onError,
+ className,
+ style,
+}: RemocnShaderProps) {
+ const canvas = useRef<HTMLCanvasElement>(null);
+ const shader = useRef<ShaderHandle | null>(null);
+ const latestTheme = useRef(theme);
+ const latestTime = useRef(time);
+ const latestOnError = useRef(onError);
+ const dark = background?.dark ?? "#090909";
+ const light = background?.light ?? "#ffffff";
+ const animated = time === undefined;
+
+ useEffect(() => {
+ latestTheme.current = theme;
+ shader.current?.setTheme(theme);
+ }, [theme]);
+
+ useEffect(() => {
+ latestTime.current = time;
+ if (time !== undefined) shader.current?.render(time);
+ }, [time]);
+
+ useEffect(() => {
+ latestOnError.current = onError;
+ }, [onError]);
+
+ useEffect(() => {
+ const element = canvas.current;
+ if (!element) return;
+ let handle: ShaderHandle | null = null;
+ const controller = new AbortController();
+ const options: ShaderOptions = {
+ theme: latestTheme.current,
+ background: { dark, light },
+ autoplay: animated,
+ signal: controller.signal,
+ onError: (error) => {
+ if (controller.signal.aborted) return;
+ if (latestOnError.current) latestOnError.current(error);
+ else console.error(error);
+ },
+ };
+ try {
+ handle = createShader(element, options);
+ shader.current = handle;
+ if (latestTime.current !== undefined) handle.render(latestTime.current);
+ } catch (error) {
+ options.onError?.(
+ error instanceof Error ? error : new Error(String(error)),
+ );
+ }
+ return () => {
+ controller.abort();
+ handle?.destroy();
+ shader.current = null;
+ };
+ }, [dark, light, animated]);
+
+ return (
+ // biome-ignore lint/a11y/noAriaHiddenOnFocusable: decorative canvas, never focused
+ <canvas
+ ref={canvas}
+ className={className}
+ style={{ display: "block", width: "100%", height: "100%", ...style }}
+ aria-hidden="true"
+ />
+ );
+}
+
+const MAX_PIXELS = 2400000;
+const THEME_EASE = 7;
+
+function parseHex(hex: string): [number, number, number] {
+ const match = /^#([0-9a-f]{6})$/i.exec(hex.trim());
+ if (!match)
+ throw new Error(`Background colours must be #rrggbb, got "${hex}".`);
+ return [0, 2, 4].map(
+ (i) => Number.parseInt(match[1].slice(i, i + 2), 16) / 255,
+ ) as [number, number, number];
+}
+
+function animate(
+ options: ShaderOptions,
+ draw: (time: number, theme: number, pixelRatio: number) => void,
+ canvas: HTMLCanvasElement,
+ release: () => void,
+ maxDimension = Infinity,
+): ShaderHandle {
+ const autoplay = options.autoplay !== false;
+ const stillness = window.matchMedia("(prefers-reduced-motion: reduce)");
+ let resolution = window.matchMedia(
+ `(resolution: ${window.devicePixelRatio || 1}dppx)`,
+ );
+ let deviceRatio = window.devicePixelRatio || 1;
+ let width = canvas.clientWidth;
+ let height = canvas.clientHeight;
+ let visible = true;
+ let disposed = false;
+ let targetTheme = options.theme === "light" ? 1 : 0;
+ let theme = targetTheme;
+ let frame = 0;
+ let elapsed = 0;
+ let lastTime = 0;
+ let previous: number | null = null;
+
+ function canDraw() {
+ return !disposed && !document.hidden && visible && width > 0 && height > 0;
+ }
+
+ function fitCanvas() {
+ const scale = Math.min(
+ deviceRatio,
+ 2,
+ Math.sqrt(MAX_PIXELS / (width * height)),
+ maxDimension / width,
+ maxDimension / height,
+ );
+ const w = Math.max(1, Math.floor(width * scale));
+ const h = Math.max(1, Math.floor(height * scale));
+ if (canvas.width !== w || canvas.height !== h) {
+ canvas.width = w;
+ canvas.height = h;
+ }
+ return w / width;
+ }
+
+ function render(time: number) {
+ if (disposed) return;
+ lastTime = time;
+ if (!canDraw()) return;
+ try {
+ draw(time, theme, fitCanvas());
+ } catch (error) {
+ destroy();
+ const failure = error instanceof Error ? error : new Error(String(error));
+ if (options.onError) options.onError(failure);
+ else console.error(failure);
+ }
+ }
+
+ function schedule() {
+ if (!frame && canDraw()) frame = requestAnimationFrame(tick);
+ }
+
+ function refresh() {
+ if (!canDraw()) {
+ cancelAnimationFrame(frame);
+ frame = 0;
+ previous = null;
+ } else schedule();
+ }
+
+ function tick(now: number) {
+ frame = 0;
+ if (!canDraw()) {
+ previous = null;
+ return;
+ }
+ const delta =
+ previous === null ? 0 : Math.min((now - previous) / 1000, 0.1);
+ previous = now;
+ if (autoplay) {
+ if (!stillness.matches) elapsed += delta;
+ theme += (targetTheme - theme) * (1 - Math.exp(-delta * THEME_EASE));
+ if (Math.abs(targetTheme - theme) < 0.002) theme = targetTheme;
+ }
+ render(autoplay ? elapsed : lastTime);
+ if (autoplay && (!stillness.matches || theme !== targetTheme)) schedule();
+ else previous = null;
+ }
+
+ function pixelRatioChanged() {
+ if (disposed) return;
+ const next = window.devicePixelRatio || 1;
+ if (deviceRatio === next) return;
+ deviceRatio = next;
+ resolution.removeEventListener("change", pixelRatioChanged);
+ resolution = window.matchMedia(`(resolution: ${next}dppx)`);
+ resolution.addEventListener("change", pixelRatioChanged);
+ refresh();
+ }
+
+ const observer = new ResizeObserver(([entry]) => {
+ if (disposed || !entry) return;
+ const next = entry.contentRect;
+ if (width === next.width && height === next.height) return;
+ width = next.width;
+ height = next.height;
+ refresh();
+ });
+ const intersection = new IntersectionObserver(([entry]) => {
+ if (disposed || !entry || visible === entry.isIntersecting) return;
+ visible = entry.isIntersecting;
+ refresh();
+ });
+
+ function destroy() {
+ if (disposed) return;
+ disposed = true;
+ cancelAnimationFrame(frame);
+ frame = 0;
+ observer.disconnect();
+ intersection.disconnect();
+ resolution.removeEventListener("change", pixelRatioChanged);
+ stillness.removeEventListener("change", refresh);
+ document.removeEventListener("visibilitychange", refresh);
+ window.removeEventListener("resize", pixelRatioChanged);
+ options.signal?.removeEventListener("abort", destroy);
+ release();
+ }
+
+ observer.observe(canvas);
+ intersection.observe(canvas);
+ resolution.addEventListener("change", pixelRatioChanged);
+ stillness.addEventListener("change", refresh);
+ document.addEventListener("visibilitychange", refresh);
+ window.addEventListener("resize", pixelRatioChanged);
+ options.signal?.addEventListener("abort", destroy, { once: true });
+ if (options.signal?.aborted) destroy();
+ else schedule();
+
+ return {
+ setTheme(next: ShaderTheme) {
+ if (disposed) return;
+ targetTheme = next === "light" ? 1 : 0;
+ if (autoplay) refresh();
+ else {
+ theme = targetTheme;
+ render(lastTime);
+ }
+ },
+ render,
+ destroy,
+ };
+}
+
+function attach(
+ gl: WebGL2RenderingContext,
+ program: WebGLProgram,
+ type: number,
+ source: string,
+) {
+ const shader = gl.createShader(type);
+ if (!shader) throw new Error("WebGL could not create a shader object.");
+ gl.shaderSource(shader, source);
+ gl.compileShader(shader);
+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
+ throw new Error(`Shader failed to compile: ${gl.getShaderInfoLog(shader)}`);
+ gl.attachShader(program, shader);
+ gl.deleteShader(shader);
+}
+
+function compile(gl: WebGL2RenderingContext, fragmentSource: string) {
+ const program = gl.createProgram();
+ attach(gl, program, gl.VERTEX_SHADER, VERTEX_SHADER);
+ attach(gl, program, gl.FRAGMENT_SHADER, fragmentSource);
+ gl.linkProgram(program);
+ if (!gl.getProgramParameter(program, gl.LINK_STATUS))
+ throw new Error(`Shader failed to link: ${gl.getProgramInfoLog(program)}`);
+ return program;
+}
+
+function uniforms(
+ gl: WebGL2RenderingContext,
+ program: WebGLProgram,
+ names: readonly string[],
+) {
+ return Object.fromEntries(
+ names.map((name) => [name, gl.getUniformLocation(program, name)]),
+ );
+}
+
+export function createShader(
+ canvas: HTMLCanvasElement,
+ options: ShaderOptions = {},
+): ShaderHandle {
+ const gl = canvas.getContext("webgl2", {
+ alpha: false,
+ antialias: false,
+ depth: false,
+ stencil: false,
+ });
+ if (!gl) throw new Error("WebGL2 is not available in this browser.");
+ const dark = parseHex(options.background?.dark ?? "#090909");
+ const light = parseHex(options.background?.light ?? "#ffffff");
+
+ const field = compile(gl, FIELD_SHADER);
+ const fieldUniforms = uniforms(gl, field, [
+ "iResolution",
+ "iTime",
+ "uLightMode",
+ "uDarkBackground",
+ "uLightBackground",
+ ]);
+ const post = compile(gl, RARITY_SHADER);
+ const postUniforms = uniforms(gl, post, [
+ "tScene",
+ "iResolution",
+ "iTime",
+ "uLightMode",
+ "uDarkBackground",
+ "uLightBackground",
+ "uPixelRatio",
+ ]);
+ const framebuffer = gl.createFramebuffer();
+ const scene = gl.createTexture();
+ gl.bindTexture(gl.TEXTURE_2D, scene);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+ let sceneWidth = 0;
+ let sceneHeight = 0;
+
+ const setFrame = (
+ locations: Record<string, WebGLUniformLocation | null>,
+ time: number,
+ theme: number,
+ ) => {
+ gl.uniform2f(locations.iResolution, canvas.width, canvas.height);
+ gl.uniform1f(locations.iTime, time);
+ gl.uniform1f(locations.uLightMode, theme);
+ gl.uniform3fv(locations.uDarkBackground, dark);
+ gl.uniform3fv(locations.uLightBackground, light);
+ };
+
+ return animate(
+ options,
+ (time, theme, pixelRatio) => {
+ const { width, height } = canvas;
+ gl.viewport(0, 0, width, height);
+ if (sceneWidth !== width || sceneHeight !== height) {
+ sceneWidth = width;
+ sceneHeight = height;
+ gl.bindTexture(gl.TEXTURE_2D, scene);
+ gl.texImage2D(
+ gl.TEXTURE_2D,
+ 0,
+ gl.RGBA,
+ width,
+ height,
+ 0,
+ gl.RGBA,
+ gl.UNSIGNED_BYTE,
+ null,
+ );
+ gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+ gl.framebufferTexture2D(
+ gl.FRAMEBUFFER,
+ gl.COLOR_ATTACHMENT0,
+ gl.TEXTURE_2D,
+ scene,
+ 0,
+ );
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+ }
+ const drawThemed = (mode: number) => {
+ gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+ // biome-ignore lint/correctness/useHookAtTopLevel: WebGL API call, not a React hook
+ gl.useProgram(field);
+ setFrame(fieldUniforms, time, mode);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+
+ // biome-ignore lint/correctness/useHookAtTopLevel: WebGL API call, not a React hook
+ gl.useProgram(post);
+ setFrame(postUniforms, time, mode);
+ gl.uniform1f(postUniforms.uPixelRatio, pixelRatio);
+ gl.activeTexture(gl.TEXTURE0);
+ gl.bindTexture(gl.TEXTURE_2D, scene);
+ gl.uniform1i(postUniforms.tScene, 0);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ };
+ if (theme <= 0 || theme >= 1) {
+ drawThemed(theme);
+ return;
+ }
+ drawThemed(0);
+ gl.enable(gl.BLEND);
+ gl.blendColor(0, 0, 0, theme);
+ gl.blendFunc(gl.CONSTANT_ALPHA, gl.ONE_MINUS_CONSTANT_ALPHA);
+ drawThemed(1);
+ gl.disable(gl.BLEND);
+ },
+ canvas,
+ () => {
+ gl.deleteProgram(field);
+ gl.deleteProgram(post);
+ gl.deleteFramebuffer(framebuffer);
+ gl.deleteTexture(scene);
+ },
+ Math.min(
+ gl.getParameter(gl.MAX_TEXTURE_SIZE),
+ gl.getParameter(gl.MAX_RENDERBUFFER_SIZE),
+ ),
+ );
+}
diff --git a/config/site.ts b/config/site.ts
index a960998a..968304d6 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -65,6 +65,7 @@ export const NAV_LINKS: NavLink[] = [
*/
export const NEW_BADGE_PATHS = new Set<string>([
"/docs/layout/stage",
+ "/docs/typography/type-fossil",
"/docs/typography/caret-swap",
"/docs/typography/centered-word-build",
"/docs/typography/fog-rise",
@@ -80,6 +81,7 @@ export const NEW_BADGE_PATHS = new Set<string>([
"/docs/typography/word-push",
"/docs/typography/word-stream",
"/docs/typography/zoom-words",
+ "/docs/effects/cursor-gravity",
"/docs/effects/radial-burst",
"/docs/ui-blocks/search-reveal",
]);
diff --git a/content/docs/effects/cursor-gravity.mdx b/content/docs/effects/cursor-gravity.mdx
new file mode 100644
index 00000000..dde9afb0
--- /dev/null
+++ b/content/docs/effects/cursor-gravity.mdx
@@ -0,0 +1,87 @@
+---
+title: Cursor Gravity
+description: A rounded triangular cursor tugs a button out of the screen edge with pulsed elastic resistance
+component: cursor-gravity
+vibe: playful
+length: 151
+useWhen:
+ - "An empty scene should reveal a call to action through a physical pulling gesture."
+ - "A button needs to feel extracted from beyond the frame with tension, recoil, and release."
+avoidWhen:
+ - "A cursor must accurately demonstrate an existing interface — use simulated-cursor."
+ - "Two complete scenes need to swap — this reveals one element rather than replacing the whole frame."
+---
+
+<ComponentPreview name="cursor-gravity" />
+
+<InstallBlock name="cursor-gravity" />
+
+## Usage
+
+An empty scene. A soft triangular cursor arrives from below, approaches the
+right edge and catches a hidden button. Two quick tugs pull its leading edge
+into view, pause under load, and recoil. The button's back remains outside the
+frame, stretching the surface into a narrow neck. A final pull frees the whole
+button, which settles at center as the cursor exits below.
+
+```tsx
+import { CursorGravity } from "@/components/remocn/cursor-gravity";
+
+export const Scene = () => <CursorGravity label="Create something" />;
+```
+
+`Tension` controls the recoil and surface deformation. The cursor’s rear bows backward under each tug while its tip stays at the
+attachment point, then springs back as the effort releases. The pulse is in the
+movement itself: a fast pull, a short hold, a small release, then a stronger
+pull. All motion is frame-driven, including the spring and cursor shape.
+
+## Custom content
+
+The button has a 300 × 88 reference-pixel content slot. Supply `children` to
+replace its label and arrow with your own content. The surrounding surface is
+still the elastic button; text remains unstretched as it travels with the
+material. Use compact content that fits the slot.
+
+```tsx
+<CursorGravity color="#e8ef9b" backgroundColor="#201426" tension={1.2}>
+ <span style={{ fontSize: 26 }}>Start creating ↗</span>
+</CursorGravity>
+```
+
+The composition's actual right edge is always the extraction boundary,
+including in portrait and square renders. Element sizes scale with the smaller
+of `width / 1280` and `height / 720`. A transparent background lets the button
+appear over an existing scene.
+
+## Timing
+
+Reference frames at 30 fps and `speed={1}`:
+
+| Frames | Motion |
+| --- | --- |
+| 0–10 | Empty scene |
+| 10–39 | Triangular cursor enters from below |
+| 39–48 | Cursor approaches and catches the right edge |
+| 48–70 | First tug, hold, and recoil |
+| 70–94 | Stronger second tug, hold, and recoil |
+| 94–132 | Final pull; the trailing edge releases and springs inward |
+| 132–151 | Button settles; cursor finishes exiting below |
+| 151–180 | Centered button holds |
+
+`cursorGravityLength` is 151, when the reveal and cursor exit have finished.
+`getCursorGravityDuration({ speed })` includes the final hold and returns
+frames at 30 fps. Multiply by `fps / 30` and round up for another frame rate.
+Playback duration in seconds is consistent across frame rates. The final
+button stays in place after the sequence ends.
+
+<PropsTable title="Props" rows={[
+ { name: "children", type: "ReactNode", description: "Replace the label and arrow; fits a 300 × 88 content slot" },
+ { name: "label", type: "string", default: '"Create something"', description: "Default button label; long text truncates; ignored with children" },
+ { name: "tension", type: "number", default: "1", description: "Elastic neck deformation and recoil, clamped to 0–1.5" },
+ { name: "cursorColor", type: "string", default: '"#fffaf0"', description: "Rounded triangular cursor and short attachment thread" },
+ { name: "color", type: "string", default: '"#fffaf0"', description: "Elastic button surface" },
+ { name: "textColor", type: "string", default: '"#32153c"', description: "Button label and arrow" },
+ { name: "backgroundColor", type: "string", default: '"#a800b7"', description: "Full-frame background; accepts transparent" },
+ { name: "speed", type: "number", default: "1", description: "Time multiplier; zero or negative freezes the empty initial frame" },
+ { name: "className", type: "string", description: "Class on the full-frame root" },
+]} />
diff --git a/content/docs/effects/index.mdx b/content/docs/effects/index.mdx
index 83d698f6..7b24a194 100644
--- a/content/docs/effects/index.mdx
+++ b/content/docs/effects/index.mdx
@@ -7,6 +7,12 @@ Drop-in effect overlays you compose on top of any scene — fire them on a frame
<ComponentCardGrid
items={[
+ {
+ name: "Cursor Gravity",
+ description: "A soft triangular cursor extracts a hidden button from the screen edge with elastic tugs",
+ status: "stable",
+ href: "/docs/effects/cursor-gravity",
+ },
{
name: "Radial Burst",
description: "A sculptural intro — twisting ribbons fold into a tilted ring and sweep outward with contour echoes",
diff --git a/content/docs/effects/meta.json b/content/docs/effects/meta.json
index 39c9f6c6..0d73f2ca 100644
--- a/content/docs/effects/meta.json
+++ b/content/docs/effects/meta.json
@@ -3,6 +3,7 @@
"defaultOpen": true,
"pages": [
"index",
+ "cursor-gravity",
"radial-burst",
"tv-power-off",
"confetti",
diff --git a/content/docs/typography/index.mdx b/content/docs/typography/index.mdx
index bc7b6dcf..955bdc68 100644
--- a/content/docs/typography/index.mdx
+++ b/content/docs/typography/index.mdx
@@ -9,6 +9,12 @@ Every way text can move, fade, glitch, or stretch across the screen. From quiet
<ComponentCardGrid
items={[
+ {
+ name: "Type Fossil",
+ description: "Readable revisions with fine contour layers that compress into one clean typographic imprint",
+ status: "stable",
+ href: "/docs/typography/type-fossil",
+ },
{
name: "SoftBlurIn",
description: "Per-character fade-in with a gentle blur and upward motion",
diff --git a/content/docs/typography/meta.json b/content/docs/typography/meta.json
index 4342bb32..941f4c4d 100644
--- a/content/docs/typography/meta.json
+++ b/content/docs/typography/meta.json
@@ -3,6 +3,7 @@
"defaultOpen": true,
"pages": [
"index",
+ "type-fossil",
"soft-blur-in",
"per-character-rise",
"bottom-up-letters",
diff --git a/content/docs/typography/type-fossil.mdx b/content/docs/typography/type-fossil.mdx
new file mode 100644
index 00000000..d85c400d
--- /dev/null
+++ b/content/docs/typography/type-fossil.mdx
@@ -0,0 +1,95 @@
+---
+title: Type Fossil
+description: A readable word carries layers of fine contours, revises itself, then compresses into a clean typographic imprint
+component: type-fossil
+vibe: premium
+length: 174
+useWhen:
+ - "A creative process should move from earlier wording to a finished idea."
+ - "A title needs a sculptural contour effect that resolves into clean typography."
+avoidWhen:
+ - "Letters must morph individually between phrases — use kinetic-morph-text."
+ - "Long paragraphs need to be read; this composition is built for words and short phrases."
+---
+
+<ComponentPreview name="type-fossil" />
+
+<InstallBlock name="type-fossil" />
+
+## Usage
+
+A solid word sits in front of fine offset contours, forming a typographic slice.
+Earlier versions replace one another with a clean wipe. Every contour carries
+the same wording as the foreground. After the last revision, the slice's depth
+compresses, the lettering straightens, and a crisp final imprint remains.
+
+```tsx
+import { TypeFossil } from "@/components/remocn/type-fossil";
+
+export const Scene = () => <TypeFossil />;
+```
+
+All shapes render in one SVG with bounded parallel offsets. The foreground
+stays opaque. During a revision, complementary clipping regions replace the
+old text with the new text without a transparent crossfade. No assets, shaders,
+font downloads, or simulation state are required.
+
+## Your revisions
+
+`text` is the final copy. Separate `drafts` with `|` or newlines; up to twelve
+non-empty drafts are used. Each revision receives a full beat, and the preview
+automatically adjusts its duration. Empty drafts animate just the final word's
+contours. Empty final text leaves only the background.
+
+```tsx
+<TypeFossil
+ text="Clarity"
+ drafts="What if | Less | Closer"
+ layers={20}
+ depth={110}
+ color="#fffaf0"
+ accentColor="#e8ef9b"
+ backgroundColor="#32153c"
+/>
+```
+
+`layers` sets contour density. `depth` sets the slice's total thickness, which
+remains bounded when the layer count changes. Long copy conservatively shrinks
+to fit without stretching glyphs. A centered 1280 × 720 SVG scales into other
+aspect ratios; portrait leaves extra space above and below.
+
+## Timing
+
+Default sequence at 30 fps and `speed={1}`:
+
+| Frames | Motion |
+| --- | --- |
+| 0–16 | Contour thickness opens up behind the first word |
+| 20–28 | Idea → Maybe |
+| 38–46 | Maybe → Try |
+| 56–64 | Try → Almost |
+| 74–82 | Almost → Again |
+| 92–100 | Again → Closer |
+| 110–118 | Closer → Form |
+| 126–174 | Contours compress and lettering straightens |
+| 174–208 | Finished word holds |
+
+Revisions start every 18 reference frames (0.6 seconds at 30 fps), with an
+8-frame wipe. Each additional draft adds 18 frames. `typeFossilLength` is the
+last moving frame at default props. Use `getTypeFossilDuration({ drafts, speed })`
+for the actual duration including the 34-frame final hold. It returns frames
+at 30 fps; multiply by `fps / 30` and round up for another frame rate.
+
+<PropsTable title="Props" rows={[
+ { name: "text", type: "string", default: '"Form"', description: "Final word or short phrase" },
+ { name: "drafts", type: "string", default: '"Idea | Maybe | Try | Almost | Again | Closer"', description: "Earlier versions separated by | or newlines; up to twelve" },
+ { name: "layers", type: "number", default: "16", description: "Contour count, rounded and clamped to 4–24" },
+ { name: "depth", type: "number", default: "100", description: "Slice thickness, clamped to 50–150 reference units" },
+ { name: "fontSize", type: "number", default: "220", description: "Maximum font size; copy shrinks to fit" },
+ { name: "fontWeight", type: "number | string", default: "600", description: "Font weight from 100 to 900" },
+ { name: "color", type: "string", default: '"#302b26"', description: "Solid foreground lettering" },
+ { name: "accentColor", type: "string", default: '"#a800b7"', description: "Contours" },
+ { name: "backgroundColor", type: "string", default: '"#eeeae2"', description: "Stage background; accepts transparent" },
+ { name: "speed", type: "number", default: "1", description: "Playback multiplier; zero or negative freezes the initial pose" },
+ { name: "className", type: "string", description: "Class on the full-frame root" },
+]} />
diff --git a/docs/plans/2026-09-08-cursor-gravity-design.md b/docs/plans/2026-09-08-cursor-gravity-design.md
new file mode 100644
index 00000000..e3c282bf
--- /dev/null
+++ b/docs/plans/2026-09-08-cursor-gravity-design.md
@@ -0,0 +1,21 @@
+# Cursor Gravity
+
+The user approved implementing the eight creative concepts in order, one per
+review cycle. First: cursor-gravity. Do not start layout-domino until the user
+accepts this result and says to continue. Remaining order: type-fossil,
+screen-loom, time-echo, negative-space-reveal, perspective-secret,
+interface-pressure.
+
+Revised direction from user review: start with an empty scene. A rounded
+triangular cursor enters from outside the frame, approaches the screen edge,
+and extracts a hidden button. The action should read as an entrance transition.
+Two pulsed tugs, each with a hold and recoil, stretch the leading edge while the
+back remains offscreen. A final pull frees the button, which settles in the
+center; the cursor exits. No orbit or collection of visible tiles.
+
+Six seconds at 30 fps. Use the actual composition edge for the extraction on
+all aspect ratios. An SVG surface deforms into a narrow neck; lettering keeps
+its shape. Expose label or custom content, tension, palette and speed. Verify
+empty opening, offscreen back during the tugs, continuity, arbitrary seeking,
+final hold and cursor exit. Render the revised sequence for review before
+proceeding to another component.
diff --git a/docs/plans/2026-09-08-type-fossil-design.md b/docs/plans/2026-09-08-type-fossil-design.md
new file mode 100644
index 00000000..ea1336c8
--- /dev/null
+++ b/docs/plans/2026-09-08-type-fossil-design.md
@@ -0,0 +1,23 @@
+# Type Fossil
+
+User selected type-fossil after approving cursor-gravity. Wait for review of
+this component before committing or starting another one.
+
+Revised after the user said the first version looked broken. Avoid overlapping
+different transparent words, oversized camera fly-throughs, and near-plane
+layer disappearance. Use a bounded typographic slice: an opaque, readable word
+in front, fine contours of the same word behind it. Earlier versions replace
+one another with complementary SVG wipes. After the final word arrives,
+compress the depth and straighten the type into one flat imprint.
+
+Preserve warm paper, charcoal and purple contours. Expose copy, up to twelve
+drafts, density, thickness, typography, palette and speed. Give
+every revision 18 reference frames with an 8-frame wipe and derive preview duration from draft
+count. All geometry stays in one SVG and scales with its viewBox.
+
+Validate draft order, no double exposure during wipes, bounded geometry,
+continuous collapse, deterministic seeking and the final hold. Render the
+revision for user review and update docs, registry and controls together.
+
+Latest review: remove the revision counter and progress marks entirely. Use six
+default drafts followed by the final word, and double the switching cadence.
diff --git a/registry-artifacts/cursor-gravity.json b/registry-artifacts/cursor-gravity.json
new file mode 100644
index 00000000..8dab63b4
--- /dev/null
+++ b/registry-artifacts/cursor-gravity.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "cursor-gravity",
+ "title": "Cursor Gravity",
+ "description": "A rounded triangular cursor tugs a button out of the screen edge with pulsed elastic resistance.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/cursor-gravity/index.tsx",
+ "content": "\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Easing, useCurrentFrame, useVideoConfig } from \"remotion\";\n\nexport interface CursorGravityProps {\n /** Custom content in a 300 × 88 reference-pixel slot. */\n children?: ReactNode;\n label?: string;\n /** Strength of the elastic neck and recoil, 0–1.5. */\n tension?: number;\n cursorColor?: string;\n color?: string;\n textColor?: string;\n backgroundColor?: string;\n speed?: number;\n className?: string;\n}\n\nexport const cursorGravityLength = 151;\nconst DURATION = 180;\nconst finite = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\nconst clamp = (value: number) => Math.max(0, Math.min(1, value));\nconst mix = (a: number, b: number, p: number) => a + (b - a) * p;\nconst progress = (frame: number, start: number, end: number) =>\n clamp((frame - start) / (end - start));\nconst ease = Easing.bezier(0.65, 0, 0.35, 1);\nconst pullEase = Easing.bezier(0.12, 0.8, 0.22, 1);\n\n/** Complete transition plus a one-second hold, in frames at 30 fps. */\nexport function getCursorGravityDuration({\n speed = 1,\n}: Pick<CursorGravityProps, \"speed\"> = {}) {\n const rate = Math.max(0, finite(speed, 1));\n return rate === 0 ? 1 : Math.max(1, Math.ceil(DURATION / rate));\n}\n\n/** A pull advances sharply, pauses under load, then recoils before the next tug. */\nfunction pullDistance(t: number, strength: number) {\n const keys = [\n [48, 0],\n [59, 116],\n [64, 116],\n [70, 116 - 30 * strength],\n [83, 292],\n [87, 292],\n [94, 292 - 42 * strength],\n [112, 772],\n ];\n if (t <= keys[0][0]) return 0;\n for (let i = 1; i < keys.length; i++) {\n const [start, a] = keys[i - 1];\n const [end, b] = keys[i];\n if (t <= end)\n return mix(a, b, (b > a ? pullEase : ease)(progress(t, start, end)));\n }\n return 772;\n}\n\n/** Pure, resolution-aware pose. The right edge is the real composition boundary. */\nexport function getCursorGravityState(\n frame: number,\n {\n width = 1280,\n height = 720,\n tension = 1,\n }: { width?: number; height?: number; tension?: number } = {},\n) {\n const w = Math.max(1, finite(width, 1280));\n const h = Math.max(1, finite(height, 720));\n const unit = Math.min(w / 1280, h / 720);\n const t = Math.max(0, finite(frame, 0));\n const strength = Math.max(0, Math.min(1.5, finite(tension, 1)));\n const centerY = h * 0.5;\n const finalLeft = w / 2 - 150 * unit;\n const finalRight = w / 2 + 150 * unit;\n const edgeTip = w - 24 * unit;\n const distance = pullDistance(t, strength) / 772;\n const extraction = distance * (edgeTip - (finalLeft - 14 * unit));\n // The back of the button resists the first two tugs beyond the frame edge.\n const releaseTime = progress(t, 94, 132);\n // Closed-form damped spring stays continuous at fractional frames too.\n const springRelease =\n 1 -\n Math.exp(-7 * releaseTime) *\n (Math.cos(10 * releaseTime) + 0.7 * Math.sin(10 * releaseTime));\n const release = mix(springRelease, 1, ease(progress(t, 122, 132)));\n const front = mix(w + 12 * unit, finalLeft, distance);\n const right = mix(w + 312 * unit - distance * 70 * unit, finalRight, release);\n const buttonWidth = Math.max(220 * unit, right - front);\n const strain = clamp((buttonWidth / (300 * unit) - 1) / 1.3) * strength;\n const wobble =\n t < 112\n ? 0\n : Math.sin((t - 112) * 0.48) *\n Math.exp(-(t - 112) * 0.14) *\n 5 *\n unit *\n strength *\n (1 - progress(t, 132, 140));\n const y = centerY + wobble;\n const entry = ease(progress(t, 10, 39));\n const approach = ease(progress(t, 39, 48));\n const leave = ease(progress(t, 127, 151));\n const holdTip = mix(w * 0.28, edgeTip - 80 * unit, entry);\n const pullTip = edgeTip - extraction;\n const cursorX =\n t < 48 ? mix(holdTip, edgeTip, approach) : mix(pullTip, w * 0.25, leave);\n const cursorY =\n t < 39\n ? mix(h + 110 * unit, centerY + 70 * unit, entry)\n : t < 48\n ? mix(centerY + 70 * unit, centerY, approach)\n : mix(centerY, h + 110 * unit, leave);\n // Triangle points toward the edge while pulling; turns toward its exit afterward.\n const cursorAngle = t < 48 ? mix(-32, 0, approach) : mix(0, 115, leave);\n const effortPulse = (\n start: number,\n peak: number,\n hold: number,\n end: number,\n ) => ease(progress(t, start, peak)) * (1 - ease(progress(t, hold, end)));\n const cursorEffort =\n strength *\n (0.8 * effortPulse(48, 58, 64, 70) +\n effortPulse(70, 81, 87, 94) +\n 1.15 * effortPulse(94, 100, 104, 118));\n return {\n frame: t,\n unit,\n front,\n right: front + buttonWidth,\n buttonWidth,\n centerY: y,\n strain,\n neckHeight: 88 * unit * (1 - 0.58 * strain),\n bodyHeight: 88 * unit * (1 - 0.17 * strain),\n cursorX,\n cursorY,\n cursorAngle,\n cursorEffort,\n attached: t >= 48 && t <= 121,\n tetherOpacity: progress(t, 46, 49) * (1 - progress(t, 115, 122)),\n };\n}\n\n/** The tip stays fixed; the rear bows backward as each tug builds effort. */\nexport function getGravityCursorPath(effort: number) {\n const load = Math.max(0, Math.min(1.725, finite(effort, 0)));\n const shoulder = -62 - 30 * load;\n const rear = -70 - 40 * load;\n const halfHeight = 26 - 4 * load;\n return `M -5 -4 Q 3 0 -5 4\n C -24 ${11.333 - load * 3} ${shoulder + 19} ${halfHeight - 7.333} ${shoulder} ${halfHeight}\n Q ${rear} ${halfHeight + 4} ${rear} ${halfHeight - 6}\n C ${rear} 4 ${rear - 18 * load} 8 ${rear - 18 * load} 0\n C ${rear - 18 * load} -8 ${rear} -4 ${rear} ${-halfHeight + 6}\n Q ${rear} ${-halfHeight - 4} ${shoulder} ${-halfHeight}\n C ${shoulder + 19} ${-halfHeight + 7.333} -24 ${-11.333 + load * 3} -5 -4 Z`;\n}\n\n/** Rounded rectangle with a narrow leading edge: the pull deforms the surface. */\nexport function getGravityButtonPath(\n state: ReturnType<typeof getCursorGravityState>,\n) {\n const { buttonWidth: w, neckHeight, bodyHeight, unit } = state;\n const a = neckHeight / 2;\n const b = bodyHeight / 2;\n const r = Math.min(25 * unit, a * 0.9);\n const backRadius = 25 * unit;\n return `M ${r} ${-a}\n C ${w * 0.35} ${-a} ${w * 0.35} ${-b} ${w - backRadius} ${-b}\n Q ${w} ${-b} ${w} ${-b + backRadius}\n L ${w} ${b - backRadius} Q ${w} ${b} ${w - backRadius} ${b}\n C ${w * 0.35} ${b} ${w * 0.35} ${a} ${r} ${a}\n Q 0 ${a} 0 ${a - r} L 0 ${-a + r} Q 0 ${-a} ${r} ${-a} Z`;\n}\n\nexport function CursorGravity({\n children,\n label = \"Create something\",\n tension = 1,\n cursorColor = \"#fffaf0\",\n color = \"#fffaf0\",\n textColor = \"#32153c\",\n backgroundColor = \"#a800b7\",\n speed = 1,\n className,\n}: CursorGravityProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const t = frame * (30 / fps) * Math.max(0, finite(speed, 1));\n const state = getCursorGravityState(t, { width, height, tension });\n const { unit } = state;\n // Content travels with the material, without stretching the lettering.\n const contentUnit = unit * Math.min(1, state.buttonWidth / (300 * unit));\n const contentX = state.front + state.buttonWidth - 150 * contentUnit;\n return (\n <div\n className={className}\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n backgroundColor,\n fontFamily: \"Arial, sans-serif\",\n }}\n >\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n aria-hidden=\"true\"\n style={{ position: \"absolute\", inset: 0 }}\n >\n <path\n d={getGravityButtonPath(state)}\n transform={`translate(${state.front} ${state.centerY})`}\n fill={color}\n />\n <path\n d={`M ${state.cursorX + 2 * unit} ${state.cursorY} Q ${mix(state.cursorX, state.front, 0.5)} ${state.centerY} ${state.front + 2 * unit} ${state.centerY}`}\n fill=\"none\"\n stroke={cursorColor}\n strokeWidth={2 * unit}\n strokeLinecap=\"round\"\n opacity={state.tetherOpacity}\n />\n </svg>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: 300,\n height: 88,\n translate: `${contentX - 150 * contentUnit}px ${state.centerY - 44 * contentUnit}px`,\n scale: contentUnit,\n transformOrigin: \"top left\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 20,\n color: textColor,\n fontWeight: 600,\n fontSize: 23,\n }}\n >\n {children ?? (\n <>\n <span\n style={{\n maxWidth: 220,\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n }}\n >\n {label}\n </span>\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n d=\"M5 12H19M13 6L19 12L13 18\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </>\n )}\n </div>\n <svg\n width={190 * unit}\n height={70 * unit}\n viewBox=\"-180 -35 190 70\"\n role=\"img\"\n aria-label=\"Rounded triangular cursor\"\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n translate: `${state.cursorX - 180 * unit}px ${state.cursorY - 35 * unit}px`,\n transform: `rotate(${state.cursorAngle}deg)`,\n transformOrigin: `${180 * unit}px ${35 * unit}px`,\n }}\n >\n <path d={getGravityCursorPath(state.cursorEffort)} fill={cursorColor} />\n </svg>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/cursor-gravity.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/elements/cursor-gravity.json b/registry-artifacts/elements/cursor-gravity.json
new file mode 100644
index 00000000..02b11500
--- /dev/null
+++ b/registry-artifacts/elements/cursor-gravity.json
@@ -0,0 +1,14 @@
+{
+ "type": "remotion-element",
+ "version": 1,
+ "element": {
+ "dependencies": [],
+ "dimensions": null,
+ "displayName": "Cursor Gravity",
+ "durationInFrames": 151,
+ "installationMode": "component-owned-sequence",
+ "slug": "cursor-gravity",
+ "sourceCode": "import { forwardRef, useImperativeHandle, useRef, type ComponentProps, type ReactNode } from \"react\";\nimport { Easing, Interactive, Sequence, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\ninterface CursorGravityProps {\n /** Custom content in a 300 × 88 reference-pixel slot. */\n children?: ReactNode;\n label?: string;\n /** Strength of the elastic neck and recoil, 0–1.5. */\n tension?: number;\n cursorColor?: string;\n color?: string;\n textColor?: string;\n backgroundColor?: string;\n speed?: number;\n className?: string;\n}\n\nconst cursorGravityLength = 151;\nconst DURATION = 180;\nconst finite = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\nconst clamp = (value: number) => Math.max(0, Math.min(1, value));\nconst mix = (a: number, b: number, p: number) => a + (b - a) * p;\nconst progress = (frame: number, start: number, end: number) =>\n clamp((frame - start) / (end - start));\nconst ease = Easing.bezier(0.65, 0, 0.35, 1);\nconst pullEase = Easing.bezier(0.12, 0.8, 0.22, 1);\n\n/** Complete transition plus a one-second hold, in frames at 30 fps. */\nfunction getCursorGravityDuration({\n speed = 1,\n}: Pick<CursorGravityProps, \"speed\"> = {}) {\n const rate = Math.max(0, finite(speed, 1));\n return rate === 0 ? 1 : Math.max(1, Math.ceil(DURATION / rate));\n}\n\n/** A pull advances sharply, pauses under load, then recoils before the next tug. */\nfunction pullDistance(t: number, strength: number) {\n const keys = [\n [48, 0],\n [59, 116],\n [64, 116],\n [70, 116 - 30 * strength],\n [83, 292],\n [87, 292],\n [94, 292 - 42 * strength],\n [112, 772],\n ];\n if (t <= keys[0][0]) return 0;\n for (let i = 1; i < keys.length; i++) {\n const [start, a] = keys[i - 1];\n const [end, b] = keys[i];\n if (t <= end)\n return mix(a, b, (b > a ? pullEase : ease)(progress(t, start, end)));\n }\n return 772;\n}\n\n/** Pure, resolution-aware pose. The right edge is the real composition boundary. */\nfunction getCursorGravityState(\n frame: number,\n {\n width = 1280,\n height = 720,\n tension = 1,\n }: { width?: number; height?: number; tension?: number } = {},\n) {\n const w = Math.max(1, finite(width, 1280));\n const h = Math.max(1, finite(height, 720));\n const unit = Math.min(w / 1280, h / 720);\n const t = Math.max(0, finite(frame, 0));\n const strength = Math.max(0, Math.min(1.5, finite(tension, 1)));\n const centerY = h * 0.5;\n const finalLeft = w / 2 - 150 * unit;\n const finalRight = w / 2 + 150 * unit;\n const edgeTip = w - 24 * unit;\n const distance = pullDistance(t, strength) / 772;\n const extraction = distance * (edgeTip - (finalLeft - 14 * unit));\n // The back of the button resists the first two tugs beyond the frame edge.\n const releaseTime = progress(t, 94, 132);\n // Closed-form damped spring stays continuous at fractional frames too.\n const springRelease =\n 1 -\n Math.exp(-7 * releaseTime) *\n (Math.cos(10 * releaseTime) + 0.7 * Math.sin(10 * releaseTime));\n const release = mix(springRelease, 1, ease(progress(t, 122, 132)));\n const front = mix(w + 12 * unit, finalLeft, distance);\n const right = mix(w + 312 * unit - distance * 70 * unit, finalRight, release);\n const buttonWidth = Math.max(220 * unit, right - front);\n const strain = clamp((buttonWidth / (300 * unit) - 1) / 1.3) * strength;\n const wobble =\n t < 112\n ? 0\n : Math.sin((t - 112) * 0.48) *\n Math.exp(-(t - 112) * 0.14) *\n 5 *\n unit *\n strength *\n (1 - progress(t, 132, 140));\n const y = centerY + wobble;\n const entry = ease(progress(t, 10, 39));\n const approach = ease(progress(t, 39, 48));\n const leave = ease(progress(t, 127, 151));\n const holdTip = mix(w * 0.28, edgeTip - 80 * unit, entry);\n const pullTip = edgeTip - extraction;\n const cursorX =\n t < 48 ? mix(holdTip, edgeTip, approach) : mix(pullTip, w * 0.25, leave);\n const cursorY =\n t < 39\n ? mix(h + 110 * unit, centerY + 70 * unit, entry)\n : t < 48\n ? mix(centerY + 70 * unit, centerY, approach)\n : mix(centerY, h + 110 * unit, leave);\n // Triangle points toward the edge while pulling; turns toward its exit afterward.\n const cursorAngle = t < 48 ? mix(-32, 0, approach) : mix(0, 115, leave);\n const effortPulse = (\n start: number,\n peak: number,\n hold: number,\n end: number,\n ) => ease(progress(t, start, peak)) * (1 - ease(progress(t, hold, end)));\n const cursorEffort =\n strength *\n (0.8 * effortPulse(48, 58, 64, 70) +\n effortPulse(70, 81, 87, 94) +\n 1.15 * effortPulse(94, 100, 104, 118));\n return {\n frame: t,\n unit,\n front,\n right: front + buttonWidth,\n buttonWidth,\n centerY: y,\n strain,\n neckHeight: 88 * unit * (1 - 0.58 * strain),\n bodyHeight: 88 * unit * (1 - 0.17 * strain),\n cursorX,\n cursorY,\n cursorAngle,\n cursorEffort,\n attached: t >= 48 && t <= 121,\n tetherOpacity: progress(t, 46, 49) * (1 - progress(t, 115, 122)),\n };\n}\n\n/** The tip stays fixed; the rear bows backward as each tug builds effort. */\nfunction getGravityCursorPath(effort: number) {\n const load = Math.max(0, Math.min(1.725, finite(effort, 0)));\n const shoulder = -62 - 30 * load;\n const rear = -70 - 40 * load;\n const halfHeight = 26 - 4 * load;\n return `M -5 -4 Q 3 0 -5 4\n C -24 ${11.333 - load * 3} ${shoulder + 19} ${halfHeight - 7.333} ${shoulder} ${halfHeight}\n Q ${rear} ${halfHeight + 4} ${rear} ${halfHeight - 6}\n C ${rear} 4 ${rear - 18 * load} 8 ${rear - 18 * load} 0\n C ${rear - 18 * load} -8 ${rear} -4 ${rear} ${-halfHeight + 6}\n Q ${rear} ${-halfHeight - 4} ${shoulder} ${-halfHeight}\n C ${shoulder + 19} ${-halfHeight + 7.333} -24 ${-11.333 + load * 3} -5 -4 Z`;\n}\n\n/** Rounded rectangle with a narrow leading edge: the pull deforms the surface. */\nfunction getGravityButtonPath(\n state: ReturnType<typeof getCursorGravityState>,\n) {\n const { buttonWidth: w, neckHeight, bodyHeight, unit } = state;\n const a = neckHeight / 2;\n const b = bodyHeight / 2;\n const r = Math.min(25 * unit, a * 0.9);\n const backRadius = 25 * unit;\n return `M ${r} ${-a}\n C ${w * 0.35} ${-a} ${w * 0.35} ${-b} ${w - backRadius} ${-b}\n Q ${w} ${-b} ${w} ${-b + backRadius}\n L ${w} ${b - backRadius} Q ${w} ${b} ${w - backRadius} ${b}\n C ${w * 0.35} ${b} ${w * 0.35} ${a} ${r} ${a}\n Q 0 ${a} 0 ${a - r} L 0 ${-a + r} Q 0 ${-a} ${r} ${-a} Z`;\n}\n\nfunction CursorGravityBase({\n children,\n label = \"Create something\",\n tension = 1,\n cursorColor = \"#fffaf0\",\n color = \"#fffaf0\",\n textColor = \"#32153c\",\n backgroundColor = \"#a800b7\",\n speed = 1,\n className,\n}: CursorGravityProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const t = frame * (30 / fps) * Math.max(0, finite(speed, 1));\n const state = getCursorGravityState(t, { width, height, tension });\n const { unit } = state;\n // Content travels with the material, without stretching the lettering.\n const contentUnit = unit * Math.min(1, state.buttonWidth / (300 * unit));\n const contentX = state.front + state.buttonWidth - 150 * contentUnit;\n return (\n <div\n className={className}\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n backgroundColor,\n fontFamily: \"Arial, sans-serif\",\n }}\n >\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n aria-hidden=\"true\"\n style={{ position: \"absolute\", inset: 0 }}\n >\n <path\n d={getGravityButtonPath(state)}\n transform={`translate(${state.front} ${state.centerY})`}\n fill={color}\n />\n <path\n d={`M ${state.cursorX + 2 * unit} ${state.cursorY} Q ${mix(state.cursorX, state.front, 0.5)} ${state.centerY} ${state.front + 2 * unit} ${state.centerY}`}\n fill=\"none\"\n stroke={cursorColor}\n strokeWidth={2 * unit}\n strokeLinecap=\"round\"\n opacity={state.tetherOpacity}\n />\n </svg>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: 300,\n height: 88,\n translate: `${contentX - 150 * contentUnit}px ${state.centerY - 44 * contentUnit}px`,\n scale: contentUnit,\n transformOrigin: \"top left\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 20,\n color: textColor,\n fontWeight: 600,\n fontSize: 23,\n }}\n >\n {children ?? (\n <>\n <span\n style={{\n maxWidth: 220,\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n }}\n >\n {label}\n </span>\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n d=\"M5 12H19M13 6L19 12L13 18\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </>\n )}\n </div>\n <svg\n width={190 * unit}\n height={70 * unit}\n viewBox=\"-180 -35 190 70\"\n role=\"img\"\n aria-label=\"Rounded triangular cursor\"\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n translate: `${state.cursorX - 180 * unit}px ${state.cursorY - 35 * unit}px`,\n transform: `rotate(${state.cursorAngle}deg)`,\n transformOrigin: `${180 * unit}px ${35 * unit}px`,\n }}\n >\n <path d={getGravityCursorPath(state.cursorEffort)} fill={cursorColor} />\n </svg>\n </div>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n label: {\n type: \"text-content\",\n default: \"Create something\",\n description: \"Button label\",\n },\n tension: {\n type: \"number\",\n default: 1,\n min: 0,\n max: 1.5,\n step: 0.1,\n description: \"Pull tension\",\n hiddenFromList: false,\n },\n cursorColor: {\n type: \"color\",\n default: \"#fffaf0\",\n description: \"Cursor\",\n },\n color: {\n type: \"color\",\n default: \"#fffaf0\",\n description: \"Button\",\n },\n textColor: {\n type: \"color\",\n default: \"#32153c\",\n description: \"Button text\",\n },\n backgroundColor: {\n type: \"color\",\n default: \"#a800b7\",\n description: \"Background\",\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"label\",\"tension\",\"cursorColor\",\"color\",\"textColor\",\"backgroundColor\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n label: \"Create something\",\n tension: 1,\n cursorColor: \"#fffaf0\",\n color: \"#fffaf0\",\n textColor: \"#32153c\",\n backgroundColor: \"#a800b7\",\n speed: 1,\n};\n\ntype CursorGravityElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof CursorGravityBase>;\n\nconst CursorGravityInner = forwardRef<\n HTMLDivElement,\n CursorGravityElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<CursorGravity>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <CursorGravityBase\n {...(componentProps as unknown as ComponentProps<typeof CursorGravityBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const CursorGravity = Interactive.withSchema({\n Component: CursorGravityInner,\n componentName: \"<CursorGravity>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n"
+ },
+ "durationInFrames": 151
+}
diff --git a/registry-artifacts/elements/type-fossil.json b/registry-artifacts/elements/type-fossil.json
new file mode 100644
index 00000000..0dcc062d
--- /dev/null
+++ b/registry-artifacts/elements/type-fossil.json
@@ -0,0 +1,14 @@
+{
+ "type": "remotion-element",
+ "version": 1,
+ "element": {
+ "dependencies": [],
+ "dimensions": null,
+ "displayName": "Type Fossil",
+ "durationInFrames": 174,
+ "installationMode": "component-owned-sequence",
+ "slug": "type-fossil",
+ "sourceCode": "import { forwardRef, useId, useImperativeHandle, useRef, type ComponentProps } from \"react\";\nimport { Easing, Interactive, Sequence, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\ninterface TypeFossilProps {\n text?: string;\n /** Earlier versions, separated by | or newlines. Up to twelve drafts. */\n drafts?: string;\n layers?: number;\n /** Thickness of the typographic slice, in reference pixels. */\n depth?: number;\n fontSize?: number;\n fontWeight?: number | string;\n color?: string;\n accentColor?: string;\n backgroundColor?: string;\n speed?: number;\n className?: string;\n}\n\nconst typeFossilLength = 174;\nconst typeFossilDefaultDrafts =\n \"Idea | Maybe | Try | Almost | Again | Closer\";\nconst finite = (n: number, fallback: number) =>\n Number.isFinite(n) ? n : fallback;\nconst clamp = (n: number) => Math.min(1, Math.max(0, n));\nconst mix = (a: number, b: number, p: number) => a + (b - a) * p;\nconst progress = (t: number, a: number, b: number) => clamp((t - a) / (b - a));\nconst ease = Easing.bezier(0.65, 0, 0.3, 1);\nconst out = Easing.bezier(0.16, 1, 0.3, 1);\n\nfunction parseFossilDrafts(drafts: string) {\n return drafts\n .split(/[|\\n\\r]+/)\n .map((value) => value.trim().replace(/\\s+/g, \" \"))\n .filter(Boolean)\n .slice(0, 12);\n}\n\nfunction timing(draftCount: number) {\n const count = Math.round(Math.max(0, Math.min(12, finite(draftCount, 6))));\n const collapseStart = count === 0 ? 16 : 20 + (count - 1) * 18 + 16;\n return { draftCount: count, collapseStart, settle: collapseStart + 48 };\n}\n\nfunction getTypeFossilDuration({\n drafts = typeFossilDefaultDrafts,\n speed = 1,\n}: Pick<TypeFossilProps, \"drafts\" | \"speed\"> = {}) {\n const rate = Math.max(0, finite(speed, 1));\n const { settle } = timing(parseFossilDrafts(drafts).length);\n return rate === 0 ? 1 : Math.max(1, Math.ceil((settle + 34) / rate));\n}\n\n/** One readable revision at a time, followed by a single compression into print. */\nfunction getTypeFossilState(\n frame: number,\n {\n layers = 16,\n depth = 100,\n draftCount = 6,\n }: Pick<TypeFossilProps, \"layers\" | \"depth\"> & { draftCount?: number } = {},\n) {\n const t = Math.max(0, finite(frame, 0));\n const count = Math.round(Math.max(4, Math.min(24, finite(layers, 16))));\n const thickness = Math.max(50, Math.min(150, finite(depth, 100)));\n const schedule = timing(draftCount);\n const collapse = ease(progress(t, schedule.collapseStart, schedule.settle));\n const open = mix(0.55, 1, out(progress(t, 0, 16)));\n const spread = open * (1 - collapse);\n let from = 0;\n let to = 0;\n let change = 0;\n for (let revision = 0; revision < schedule.draftCount; revision++) {\n const start = 20 + revision * 18;\n if (t < start) break;\n if (t >= start + 8) {\n from = revision + 1;\n to = from;\n change = 0;\n } else {\n from = revision;\n to = revision + 1;\n change = ease(progress(t, start, start + 8));\n break;\n }\n }\n return {\n frame: t,\n count,\n thickness,\n from,\n to,\n change,\n draftCount: schedule.draftCount,\n settle: schedule.settle,\n collapse,\n spread,\n spanX: thickness * 1.35 * spread,\n spanY: -thickness * 0.68 * spread,\n skew: -10 * (1 - collapse),\n ghostOpacity: 1 - ease(progress(t, schedule.settle - 18, schedule.settle)),\n };\n}\n\n/** Bounded parallel contours, no perspective division or near-plane disappearance. */\nfunction getFossilLayerPose(\n state: ReturnType<typeof getTypeFossilState>,\n index: number,\n) {\n const i = Math.round(\n Math.max(0, Math.min(state.count - 1, finite(index, 0))),\n );\n const fraction = i / (state.count - 1);\n return {\n x: 640 + state.spanX / 2 - state.spanX * fraction,\n y: 360 + state.spanY / 2 - state.spanY * fraction,\n opacity: i === 0 ? 1 : state.ghostOpacity,\n skew: state.skew,\n fraction,\n };\n}\n\nfunction fitSize(text: string, fontSize: number) {\n const widthUnits = Array.from(text).reduce(\n (sum, char) =>\n sum +\n (/\\s/.test(char)\n ? 0.35\n : /[ilI.,'!:;]/.test(char)\n ? 0.4\n : /[MW@ЖШЩЮ]/.test(char)\n ? 1\n : 0.8),\n 0,\n );\n return Math.min(fontSize, 720 / Math.max(1, widthUnits));\n}\n\nfunction TypeFossilBase({\n text = \"Form\",\n drafts = typeFossilDefaultDrafts,\n layers = 16,\n depth = 100,\n fontSize = 220,\n fontWeight = 600,\n color = \"#302b26\",\n accentColor = \"#a800b7\",\n backgroundColor = \"#eeeae2\",\n speed = 1,\n className,\n}: TypeFossilProps) {\n const id = useId().replace(/:/g, \"\");\n const frame = useCurrentFrame();\n const { fps } = useVideoConfig();\n const finalText = text.trim().replace(/\\s+/g, \" \");\n const revisions = [...parseFossilDrafts(drafts), finalText];\n const state = getTypeFossilState(\n ((frame * 30) / fps) * Math.max(0, finite(speed, 1)),\n { layers, depth, draftCount: revisions.length - 1 },\n );\n const size = Math.max(24, Math.min(300, finite(fontSize, 220)));\n const weight = Math.max(100, Math.min(900, finite(Number(fontWeight), 600)));\n const wipeX = mix(-100, 1380, state.change);\n const renderSlice = (copy: string) => {\n const font = fitSize(copy, size);\n return Array.from({ length: state.count }, (_, order) => {\n const index = state.count - 1 - order;\n const pose = getFossilLayerPose(state, index);\n return (\n <text\n key={index}\n x=\"0\"\n y={font * 0.35}\n textAnchor=\"middle\"\n fontSize={font}\n fontWeight={weight}\n transform={`translate(${pose.x} ${pose.y}) skewX(${pose.skew})`}\n fill={index === 0 ? color : \"none\"}\n stroke={index === 0 ? \"none\" : accentColor}\n strokeWidth={index === 0 ? 0 : 0.75}\n strokeOpacity={0.18 + (1 - pose.fraction) * 0.38}\n opacity={pose.opacity}\n paintOrder=\"stroke fill\"\n >\n {copy}\n </text>\n );\n });\n };\n return (\n <div\n className={className}\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n backgroundColor,\n fontFamily: \"Arial, Helvetica, sans-serif\",\n }}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 1280 720\"\n preserveAspectRatio=\"xMidYMid meet\"\n role=\"img\"\n aria-label={finalText || \"Empty type fossil\"}\n >\n <defs>\n <clipPath id={`${id}-old`}>\n <rect\n x={wipeX}\n y=\"-100\"\n width={1480 - (wipeX + 100)}\n height=\"920\"\n />\n </clipPath>\n <clipPath id={`${id}-new`}>\n <rect x=\"-100\" y=\"-100\" width={wipeX + 100} height=\"920\" />\n </clipPath>\n </defs>\n {finalText ? (\n state.from === state.to ? (\n renderSlice(revisions[state.from])\n ) : (\n <>\n <g clipPath={`url(#${id}-old)`}>\n {renderSlice(revisions[state.from])}\n </g>\n <g clipPath={`url(#${id}-new)`}>\n {renderSlice(revisions[state.to])}\n </g>\n </>\n )\n ) : null}\n </svg>\n </div>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n text: {\n type: \"text-content\",\n default: \"Form\",\n description: \"Final word\",\n },\n drafts: {\n type: \"text-content\",\n default: \"Idea | Maybe | Try | Almost | Again | Closer\",\n description: \"Drafts (separate with |)\",\n },\n layers: {\n type: \"number\",\n default: 16,\n min: 4,\n max: 24,\n step: 1,\n description: \"Contour layers\",\n hiddenFromList: false,\n },\n depth: {\n type: \"number\",\n default: 100,\n min: 50,\n max: 150,\n step: 5,\n description: \"Slice depth\",\n hiddenFromList: false,\n },\n fontSize: {\n type: \"number\",\n default: 220,\n min: 24,\n max: 300,\n step: 1,\n description: \"Font size\",\n hiddenFromList: false,\n },\n fontWeight: {\n type: \"enum\",\n default: \"600\",\n variants: {\n \"400\": {},\n \"500\": {},\n \"600\": {},\n \"700\": {},\n },\n description: \"Font weight\",\n },\n color: {\n type: \"color\",\n default: \"#302b26\",\n description: \"Ink\",\n },\n accentColor: {\n type: \"color\",\n default: \"#a800b7\",\n description: \"Contours\",\n },\n backgroundColor: {\n type: \"color\",\n default: \"#eeeae2\",\n description: \"Background\",\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"text\",\"drafts\",\"layers\",\"depth\",\"fontSize\",\"fontWeight\",\"color\",\"accentColor\",\"backgroundColor\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n text: \"Form\",\n drafts: \"Idea | Maybe | Try | Almost | Again | Closer\",\n layers: 16,\n depth: 100,\n fontSize: 220,\n fontWeight: \"600\",\n color: \"#302b26\",\n accentColor: \"#a800b7\",\n backgroundColor: \"#eeeae2\",\n speed: 1,\n};\n\ntype TypeFossilElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof TypeFossilBase>;\n\nconst TypeFossilInner = forwardRef<\n HTMLDivElement,\n TypeFossilElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<TypeFossil>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <TypeFossilBase\n {...(componentProps as unknown as ComponentProps<typeof TypeFossilBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const TypeFossil = Interactive.withSchema({\n Component: TypeFossilInner,\n componentName: \"<TypeFossil>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n"
+ },
+ "durationInFrames": 174
+}
diff --git a/registry-artifacts/registry.json b/registry-artifacts/registry.json
index 385a2fed..76341fc6 100644
--- a/registry-artifacts/registry.json
+++ b/registry-artifacts/registry.json
@@ -2207,6 +2207,34 @@
],
"type": "registry:component"
},
+ {
+ "name": "cursor-gravity",
+ "title": "Cursor Gravity",
+ "description": "A rounded triangular cursor tugs a button out of the screen edge with pulsed elastic resistance.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/cursor-gravity/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/cursor-gravity.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
+ {
+ "name": "type-fossil",
+ "title": "Type Fossil",
+ "description": "A readable word carries layers of fine contours, revises itself, then compresses into a clean typographic imprint.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/type-fossil/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/type-fossil.tsx"
+ }
+ ],
+ "type": "registry:component"
+ },
{
"name": "remocn-ui",
"title": "remocn UI Core",
@@ -2555,6 +2583,26 @@
],
"type": "registry:component"
},
+ {
+ "name": "select-menu",
+ "title": "UI Select Menu",
+ "description": "A vertical option list where exactly one row is highlighted; the highlight bar and left accent slide smoothly between rows. Fully controlled via selectedIndex/state or useSelectMenuTransition.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/remocn-ui"],
+ "files": [
+ {
+ "path": "registry/remocn-ui/select-menu/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/select-menu.tsx"
+ },
+ {
+ "path": "registry/remocn-ui/select-menu/use-select-menu-transition.ts",
+ "type": "registry:component",
+ "target": "components/remocn/use-select-menu-transition.ts"
+ }
+ ],
+ "type": "registry:component"
+ },
{
"name": "dropdown-menu-item",
"title": "UI Dropdown Menu Item",
diff --git a/registry-artifacts/select-menu.json b/registry-artifacts/select-menu.json
new file mode 100644
index 00000000..7c00725a
--- /dev/null
+++ b/registry-artifacts/select-menu.json
@@ -0,0 +1,23 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "select-menu",
+ "title": "UI Select Menu",
+ "description": "A vertical option list where exactly one row is highlighted; the highlight bar and left accent slide smoothly between rows. Fully controlled via selectedIndex/state or useSelectMenuTransition.",
+ "dependencies": ["remotion"],
+ "registryDependencies": ["@remocn/remocn-ui"],
+ "files": [
+ {
+ "path": "registry/remocn-ui/select-menu/index.tsx",
+ "content": "\"use client\";\n\nimport { mixOklch, type RemocnTheme, useRemocnTheme } from \"@/lib/remocn-ui\";\n\nexport type SelectMenuState = string;\n\nexport type SelectMenuVariant = \"soft\" | \"solid\";\n\nexport interface SelectMenuProps {\n options?: string[];\n selectedIndex?: number;\n state?: SelectMenuState;\n style?: SelectMenuStyle;\n variant?: SelectMenuVariant;\n align?: \"start\" | \"center\" | \"end\";\n theme?: Partial<RemocnTheme>;\n className?: string;\n}\n\nconst WIDTH = 300;\nconst PAD = 4;\nconst ROW_HEIGHT = 44;\nconst ROW_GAP = 6;\nconst ACCENT_BAR = 3;\nconst LABEL_L_PAD = 18;\nconst CHECK_SIZE = 18;\nconst PRESS_DIP = 0.03;\nconst PRESS_TINT = 0.05;\n\nfunction justify(align: \"start\" | \"center\" | \"end\"): string {\n return align === \"start\"\n ? \"flex-start\"\n : align === \"end\"\n ? \"flex-end\"\n : \"center\";\n}\n\nfunction clamp01(t: number): number {\n return Math.max(0, Math.min(1, t));\n}\n\nconst DEFAULT_OPTIONS: string[] = [\"New Game\", \"Continue\", \"Settings\", \"Quit\"];\n\nexport interface SelectMenuStyle {\n indicatorOffset: number;\n press: number;\n selectProgress: number;\n}\n\nexport interface SelectMenuStyleContext {\n options: string[];\n variant: SelectMenuVariant;\n highlightBg: string;\n highlightFg: string;\n accent: string;\n inactiveFg: string;\n border: string;\n radius: number;\n foreground: string;\n}\n\nexport function selectMenuStyleContext(\n options: string[],\n variant: SelectMenuVariant,\n theme: RemocnTheme,\n): SelectMenuStyleContext {\n const soft = variant === \"soft\";\n return {\n options,\n variant,\n highlightBg: soft ? theme.accent : theme.primary,\n highlightFg: soft ? theme.foreground : theme.primaryForeground,\n accent: soft ? theme.primary : theme.primaryForeground,\n inactiveFg: theme.mutedForeground,\n border: theme.border,\n radius: theme.radius,\n foreground: theme.foreground,\n };\n}\n\nexport function selectMenuStyle(\n selectedIndex: number,\n ctx: SelectMenuStyleContext,\n): SelectMenuStyle {\n return {\n indicatorOffset: Math.max(\n 0,\n Math.min(ctx.options.length - 1, selectedIndex),\n ),\n press: 0,\n selectProgress: 1,\n };\n}\n\nexport function SelectMenu({\n options = DEFAULT_OPTIONS,\n selectedIndex,\n state,\n style,\n variant = \"soft\",\n align = \"center\",\n theme: themeOverride,\n className,\n}: SelectMenuProps) {\n const theme = useRemocnTheme(themeOverride, \"light\");\n const ctx = selectMenuStyleContext(options, variant, theme);\n\n const snapIndex =\n selectedIndex !== undefined\n ? selectedIndex\n : state !== undefined\n ? options.indexOf(state)\n : 0;\n const v = style ?? selectMenuStyle(snapIndex, ctx);\n\n const pressDepth = clamp01(v.press ?? 0);\n const selectProgress = clamp01(v.selectProgress ?? 0);\n\n const listHeight =\n PAD * 2 + options.length * ROW_HEIGHT + (options.length - 1) * ROW_GAP;\n const step = ROW_HEIGHT + ROW_GAP;\n\n const highlightTop = PAD + v.indicatorOffset * step;\n const highlightInset = PAD;\n\n const isSoft = ctx.variant === \"soft\";\n const highlightBackground = mixOklch(\n ctx.highlightBg,\n ctx.foreground,\n PRESS_TINT * pressDepth,\n );\n\n return (\n <div\n className={className}\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: justify(align),\n background: \"transparent\",\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n }}\n >\n <div\n style={{\n position: \"relative\",\n width: WIDTH,\n height: listHeight,\n boxSizing: \"border-box\",\n }}\n >\n {/* Outer track — an outline panel for the soft product look. */}\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: ctx.radius,\n border: isSoft ? `1px solid ${ctx.border}` : \"none\",\n }}\n />\n {/* Sliding highlight: background + left accent bar */}\n <div\n style={{\n position: \"absolute\",\n top: highlightTop,\n left: highlightInset,\n width: WIDTH - highlightInset * 2,\n height: ROW_HEIGHT,\n boxSizing: \"border-box\",\n borderRadius: Math.max(2, ctx.radius - 2),\n background: highlightBackground,\n border: isSoft ? `1px solid ${ctx.border}` : \"none\",\n overflow: \"hidden\",\n }}\n >\n {/* Left accent bar */}\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n bottom: 0,\n width: ACCENT_BAR,\n background: ctx.accent,\n }}\n />\n </div>\n\n {/* Rows */}\n {options.map((option, i) => {\n const proximity = Math.max(0, 1 - Math.abs(i - v.indicatorOffset));\n const onRow = proximity >= 0.65 ? 1 : 0;\n const scale = 1 - PRESS_DIP * pressDepth * proximity;\n const proxGate = clamp01((proximity - 0.85) / 0.15);\n const checkOpacity = selectProgress * proxGate;\n return (\n <div\n key={option}\n style={{\n position: \"absolute\",\n top: PAD + i * step,\n left: highlightInset,\n width: WIDTH - highlightInset * 2,\n height: ROW_HEIGHT,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n paddingLeft: LABEL_L_PAD,\n paddingRight: 12,\n boxSizing: \"border-box\",\n transform: `scale(${scale})`,\n transformOrigin: \"center\",\n }}\n >\n <span\n style={{\n fontSize: 15,\n fontWeight: onRow ? 600 : 500,\n letterSpacing: \"0.01em\",\n color: mixOklch(ctx.inactiveFg, ctx.highlightFg, proximity),\n }}\n >\n {option}\n </span>\n <svg\n width={CHECK_SIZE}\n height={CHECK_SIZE}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden\n style={{ flexShrink: 0, opacity: checkOpacity }}\n >\n <path\n d=\"M5 12.5l4.5 4.5L19 7\"\n stroke={ctx.highlightFg}\n strokeWidth=\"2.4\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/select-menu.tsx"
+ },
+ {
+ "path": "registry/remocn-ui/select-menu/use-select-menu-transition.ts",
+ "content": "\"use client\";\n\nimport { useCurrentFrame } from \"remotion\";\nimport {\n type SelectMenuState,\n type SelectMenuStyle,\n type SelectMenuVariant,\n selectMenuStyle,\n selectMenuStyleContext,\n} from \"@/components/remocn/select-menu\";\nimport {\n clamp01,\n easings,\n type RemocnTheme,\n type Step,\n useRemocnTheme,\n useStateTransition,\n} from \"@/lib/remocn-ui\";\n\nconst DEFAULT_OPTIONS = [\"New Game\", \"Continue\", \"Settings\", \"Quit\"];\n\nexport const DEFAULT_DURATION = 14;\nexport const DEFAULT_DECAY_DURATION = 8;\nexport const PRESS_PORTION = 0.4;\n\nexport function tweenSelectMenuStyle(\n a: SelectMenuStyle,\n b: SelectMenuStyle,\n t: number,\n): SelectMenuStyle {\n return {\n indicatorOffset:\n a.indicatorOffset + (b.indicatorOffset - a.indicatorOffset) * t,\n press: a.press + (b.press - a.press) * t,\n selectProgress:\n a.selectProgress + (b.selectProgress - a.selectProgress) * t,\n };\n}\n\nexport interface SelectMenuClickOptions {\n hold?: number;\n decayDuration?: number;\n}\n\nexport function computeSelectMenuClick(\n frame: number,\n clickAt: number,\n clickDuration = DEFAULT_DURATION,\n opts: SelectMenuClickOptions = {},\n): Pick<SelectMenuStyle, \"press\" | \"selectProgress\"> {\n const t = frame - clickAt;\n const dur = Math.max(1, clickDuration);\n const pressEnd = dur * PRESS_PORTION;\n\n const press =\n t <= 0 || t >= dur\n ? 0\n : t < pressEnd\n ? clamp01(t / pressEnd)\n : clamp01(1 - (t - pressEnd) / Math.max(1, dur - pressEnd));\n\n const riseStart = pressEnd;\n const rise = clamp01((t - riseStart) / Math.max(1, dur - riseStart));\n\n let selectProgress = rise;\n if (opts.hold !== undefined) {\n const decayStart = dur + opts.hold;\n const decay = clamp01(\n (t - decayStart) /\n Math.max(1, opts.decayDuration ?? DEFAULT_DECAY_DURATION),\n );\n selectProgress = clamp01(rise - decay);\n }\n\n return { press, selectProgress };\n}\n\nexport interface SelectMenuTransitionOptions extends SelectMenuClickOptions {\n options?: string[];\n variant?: SelectMenuVariant;\n theme?: Partial<RemocnTheme>;\n mode?: \"light\" | \"dark\";\n speed?: number;\n defaultDuration?: number;\n clickAt?: number;\n clickDuration?: number;\n}\n\nexport function useSelectMenuTransition(\n steps: Step<SelectMenuState>[],\n opts: SelectMenuTransitionOptions = {},\n): SelectMenuStyle {\n const {\n options = DEFAULT_OPTIONS,\n variant = \"soft\",\n theme: themeOverride,\n mode,\n speed = 1,\n defaultDuration = DEFAULT_DURATION,\n clickAt,\n clickDuration = DEFAULT_DURATION,\n hold,\n decayDuration,\n } = opts;\n const theme = useRemocnTheme(themeOverride, mode);\n const ctx = selectMenuStyleContext(options, variant, theme);\n const { from, to, progress } = useStateTransition(\n steps,\n options[0] ?? \"\",\n speed,\n defaultDuration,\n );\n const t = easings.out(progress);\n const style = tweenSelectMenuStyle(\n selectMenuStyle(options.indexOf(from), ctx),\n selectMenuStyle(options.indexOf(to), ctx),\n t,\n );\n\n const frame = useCurrentFrame() * speed;\n const click =\n clickAt === undefined\n ? { press: 0, selectProgress: 0 }\n : computeSelectMenuClick(frame, clickAt, clickDuration, {\n hold,\n decayDuration,\n });\n\n return { ...style, ...click };\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/use-select-menu-transition.ts"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry-artifacts/type-fossil.json b/registry-artifacts/type-fossil.json
new file mode 100644
index 00000000..9e6e6c23
--- /dev/null
+++ b/registry-artifacts/type-fossil.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "type-fossil",
+ "title": "Type Fossil",
+ "description": "A readable word carries layers of fine contours, revises itself, then compresses into a clean typographic imprint.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "registry/remocn/type-fossil/index.tsx",
+ "content": "\"use client\";\n\nimport { useId } from \"react\";\nimport { Easing, useCurrentFrame, useVideoConfig } from \"remotion\";\n\nexport interface TypeFossilProps {\n text?: string;\n /** Earlier versions, separated by | or newlines. Up to twelve drafts. */\n drafts?: string;\n layers?: number;\n /** Thickness of the typographic slice, in reference pixels. */\n depth?: number;\n fontSize?: number;\n fontWeight?: number | string;\n color?: string;\n accentColor?: string;\n backgroundColor?: string;\n speed?: number;\n className?: string;\n}\n\nexport const typeFossilLength = 174;\nexport const typeFossilDefaultDrafts =\n \"Idea | Maybe | Try | Almost | Again | Closer\";\nconst finite = (n: number, fallback: number) =>\n Number.isFinite(n) ? n : fallback;\nconst clamp = (n: number) => Math.min(1, Math.max(0, n));\nconst mix = (a: number, b: number, p: number) => a + (b - a) * p;\nconst progress = (t: number, a: number, b: number) => clamp((t - a) / (b - a));\nconst ease = Easing.bezier(0.65, 0, 0.3, 1);\nconst out = Easing.bezier(0.16, 1, 0.3, 1);\n\nexport function parseFossilDrafts(drafts: string) {\n return drafts\n .split(/[|\\n\\r]+/)\n .map((value) => value.trim().replace(/\\s+/g, \" \"))\n .filter(Boolean)\n .slice(0, 12);\n}\n\nfunction timing(draftCount: number) {\n const count = Math.round(Math.max(0, Math.min(12, finite(draftCount, 6))));\n const collapseStart = count === 0 ? 16 : 20 + (count - 1) * 18 + 16;\n return { draftCount: count, collapseStart, settle: collapseStart + 48 };\n}\n\nexport function getTypeFossilDuration({\n drafts = typeFossilDefaultDrafts,\n speed = 1,\n}: Pick<TypeFossilProps, \"drafts\" | \"speed\"> = {}) {\n const rate = Math.max(0, finite(speed, 1));\n const { settle } = timing(parseFossilDrafts(drafts).length);\n return rate === 0 ? 1 : Math.max(1, Math.ceil((settle + 34) / rate));\n}\n\n/** One readable revision at a time, followed by a single compression into print. */\nexport function getTypeFossilState(\n frame: number,\n {\n layers = 16,\n depth = 100,\n draftCount = 6,\n }: Pick<TypeFossilProps, \"layers\" | \"depth\"> & { draftCount?: number } = {},\n) {\n const t = Math.max(0, finite(frame, 0));\n const count = Math.round(Math.max(4, Math.min(24, finite(layers, 16))));\n const thickness = Math.max(50, Math.min(150, finite(depth, 100)));\n const schedule = timing(draftCount);\n const collapse = ease(progress(t, schedule.collapseStart, schedule.settle));\n const open = mix(0.55, 1, out(progress(t, 0, 16)));\n const spread = open * (1 - collapse);\n let from = 0;\n let to = 0;\n let change = 0;\n for (let revision = 0; revision < schedule.draftCount; revision++) {\n const start = 20 + revision * 18;\n if (t < start) break;\n if (t >= start + 8) {\n from = revision + 1;\n to = from;\n change = 0;\n } else {\n from = revision;\n to = revision + 1;\n change = ease(progress(t, start, start + 8));\n break;\n }\n }\n return {\n frame: t,\n count,\n thickness,\n from,\n to,\n change,\n draftCount: schedule.draftCount,\n settle: schedule.settle,\n collapse,\n spread,\n spanX: thickness * 1.35 * spread,\n spanY: -thickness * 0.68 * spread,\n skew: -10 * (1 - collapse),\n ghostOpacity: 1 - ease(progress(t, schedule.settle - 18, schedule.settle)),\n };\n}\n\n/** Bounded parallel contours, no perspective division or near-plane disappearance. */\nexport function getFossilLayerPose(\n state: ReturnType<typeof getTypeFossilState>,\n index: number,\n) {\n const i = Math.round(\n Math.max(0, Math.min(state.count - 1, finite(index, 0))),\n );\n const fraction = i / (state.count - 1);\n return {\n x: 640 + state.spanX / 2 - state.spanX * fraction,\n y: 360 + state.spanY / 2 - state.spanY * fraction,\n opacity: i === 0 ? 1 : state.ghostOpacity,\n skew: state.skew,\n fraction,\n };\n}\n\nfunction fitSize(text: string, fontSize: number) {\n const widthUnits = Array.from(text).reduce(\n (sum, char) =>\n sum +\n (/\\s/.test(char)\n ? 0.35\n : /[ilI.,'!:;]/.test(char)\n ? 0.4\n : /[MW@ЖШЩЮ]/.test(char)\n ? 1\n : 0.8),\n 0,\n );\n return Math.min(fontSize, 720 / Math.max(1, widthUnits));\n}\n\nexport function TypeFossil({\n text = \"Form\",\n drafts = typeFossilDefaultDrafts,\n layers = 16,\n depth = 100,\n fontSize = 220,\n fontWeight = 600,\n color = \"#302b26\",\n accentColor = \"#a800b7\",\n backgroundColor = \"#eeeae2\",\n speed = 1,\n className,\n}: TypeFossilProps) {\n const id = useId().replace(/:/g, \"\");\n const frame = useCurrentFrame();\n const { fps } = useVideoConfig();\n const finalText = text.trim().replace(/\\s+/g, \" \");\n const revisions = [...parseFossilDrafts(drafts), finalText];\n const state = getTypeFossilState(\n ((frame * 30) / fps) * Math.max(0, finite(speed, 1)),\n { layers, depth, draftCount: revisions.length - 1 },\n );\n const size = Math.max(24, Math.min(300, finite(fontSize, 220)));\n const weight = Math.max(100, Math.min(900, finite(Number(fontWeight), 600)));\n const wipeX = mix(-100, 1380, state.change);\n const renderSlice = (copy: string) => {\n const font = fitSize(copy, size);\n return Array.from({ length: state.count }, (_, order) => {\n const index = state.count - 1 - order;\n const pose = getFossilLayerPose(state, index);\n return (\n <text\n key={index}\n x=\"0\"\n y={font * 0.35}\n textAnchor=\"middle\"\n fontSize={font}\n fontWeight={weight}\n transform={`translate(${pose.x} ${pose.y}) skewX(${pose.skew})`}\n fill={index === 0 ? color : \"none\"}\n stroke={index === 0 ? \"none\" : accentColor}\n strokeWidth={index === 0 ? 0 : 0.75}\n strokeOpacity={0.18 + (1 - pose.fraction) * 0.38}\n opacity={pose.opacity}\n paintOrder=\"stroke fill\"\n >\n {copy}\n </text>\n );\n });\n };\n return (\n <div\n className={className}\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n backgroundColor,\n fontFamily: \"Arial, Helvetica, sans-serif\",\n }}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 1280 720\"\n preserveAspectRatio=\"xMidYMid meet\"\n role=\"img\"\n aria-label={finalText || \"Empty type fossil\"}\n >\n <defs>\n <clipPath id={`${id}-old`}>\n <rect\n x={wipeX}\n y=\"-100\"\n width={1480 - (wipeX + 100)}\n height=\"920\"\n />\n </clipPath>\n <clipPath id={`${id}-new`}>\n <rect x=\"-100\" y=\"-100\" width={wipeX + 100} height=\"920\" />\n </clipPath>\n </defs>\n {finalText ? (\n state.from === state.to ? (\n renderSlice(revisions[state.from])\n ) : (\n <>\n <g clipPath={`url(#${id}-old)`}>\n {renderSlice(revisions[state.from])}\n </g>\n <g clipPath={`url(#${id}-new)`}>\n {renderSlice(revisions[state.to])}\n </g>\n </>\n )\n ) : null}\n </svg>\n </div>\n );\n}\n",
+ "type": "registry:component",
+ "target": "components/remocn/type-fossil.tsx"
+ }
+ ],
+ "type": "registry:component"
+}
diff --git a/registry/__index__.tsx b/registry/__index__.tsx
index 752513b1..6015ffc0 100644
--- a/registry/__index__.tsx
+++ b/registry/__index__.tsx
@@ -22,6 +22,16 @@ const registry: Record<string, RegistryEntry> = {
(m) => m.searchRevealConfig,
),
},
+ "type-fossil": {
+ load: () =>
+ import("@/registry/remocn/type-fossil").then((m) => ({
+ default: m.TypeFossil,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/type-fossil/config").then(
+ (m) => m.typeFossilConfig,
+ ),
+ },
"soft-blur-in": {
load: () =>
import("@/registry/remocn/soft-blur-in").then((m) => ({
@@ -2246,6 +2256,16 @@ const registry: Record<string, RegistryEntry> = {
(m) => m.xFollowersOverviewConfig,
),
},
+ "cursor-gravity": {
+ load: () =>
+ import("@/registry/remocn/cursor-gravity").then((m) => ({
+ default: m.CursorGravity,
+ })),
+ loadConfig: () =>
+ import("@/registry/remocn/cursor-gravity/config").then(
+ (m) => m.cursorGravityConfig,
+ ),
+ },
"radial-burst": {
load: () =>
import("@/registry/remocn/radial-burst").then((m) => ({
diff --git a/registry/__manifest__.ts b/registry/__manifest__.ts
index e95adb1f..164432cf 100644
--- a/registry/__manifest__.ts
+++ b/registry/__manifest__.ts
@@ -565,6 +565,21 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
speed: 1,
},
},
+ "cursor-gravity": {
+ durationInFrames: 180,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ defaults: {
+ label: "Create something",
+ tension: 1,
+ cursorColor: "#fffaf0",
+ color: "#fffaf0",
+ textColor: "#32153c",
+ backgroundColor: "#a800b7",
+ speed: 1,
+ },
+ },
dialog: {
durationInFrames: 120,
fps: 30,
@@ -4322,6 +4337,24 @@ export const previewManifest: Record<string, PreviewManifestEntry> = {
speed: 1,
},
},
+ "type-fossil": {
+ durationInFrames: 208,
+ fps: 30,
+ compositionWidth: 1280,
+ compositionHeight: 720,
+ defaults: {
+ text: "Form",
+ drafts: "Idea | Maybe | Try | Almost | Again | Closer",
+ layers: 16,
+ depth: 100,
+ fontSize: 220,
+ fontWeight: "600",
+ color: "#302b26",
+ accentColor: "#a800b7",
+ backgroundColor: "#eeeae2",
+ speed: 1,
+ },
+ },
"typed-split-wipe": {
durationInFrames: 75,
fps: 30,
diff --git a/registry/remocn-ui/select-menu/index.tsx b/registry/remocn-ui/select-menu/index.tsx
index bb6e00a2..db54230f 100644
--- a/registry/remocn-ui/select-menu/index.tsx
+++ b/registry/remocn-ui/select-menu/index.tsx
@@ -191,7 +191,6 @@ export function SelectMenu({
{/* Rows */}
{options.map((option, i) => {
-
const proximity = Math.max(0, 1 - Math.abs(i - v.indicatorOffset));
const onRow = proximity >= 0.65 ? 1 : 0;
const scale = 1 - PRESS_DIP * pressDepth * proximity;
diff --git a/registry/remocn/cursor-gravity/__tests__/cursor-gravity.test.ts b/registry/remocn/cursor-gravity/__tests__/cursor-gravity.test.ts
new file mode 100644
index 00000000..f848ebff
--- /dev/null
+++ b/registry/remocn/cursor-gravity/__tests__/cursor-gravity.test.ts
@@ -0,0 +1,121 @@
+import { describe, expect, test } from "bun:test";
+import {
+ cursorGravityLength,
+ getCursorGravityDuration,
+ getCursorGravityState,
+ getGravityButtonPath,
+ getGravityCursorPath,
+} from "..";
+
+describe("cursor gravity extraction", () => {
+ test("starts with the cursor and entire button outside the real viewport", () => {
+ for (const [width, height] of [
+ [1280, 720],
+ [720, 1280],
+ [1080, 1080],
+ ]) {
+ for (const frame of [0, 5, 10]) {
+ const pose = getCursorGravityState(frame, { width, height });
+ expect(pose.front).toBeGreaterThan(width);
+ expect(pose.cursorY - 70 * pose.unit).toBeGreaterThan(height);
+ expect(pose.tetherOpacity).toBe(0);
+ }
+ }
+ });
+ test("first two tugs advance, hold and recoil while the back stays hidden", () => {
+ for (const [pull, hold, recoil] of [
+ [59, 64, 70],
+ [83, 87, 94],
+ ]) {
+ const a = getCursorGravityState(pull);
+ const b = getCursorGravityState(hold);
+ const c = getCursorGravityState(recoil);
+ expect(b.front).toBe(a.front);
+ expect(c.front).toBeGreaterThan(a.front);
+ expect(a.right).toBeGreaterThan(1280);
+ expect(a.strain).toBeGreaterThan(0);
+ expect(a.neckHeight).toBeLessThan(a.bodyHeight);
+ }
+ });
+ test("button settles at center and cursor exits for the final hold", () => {
+ for (const [width, height] of [
+ [1280, 720],
+ [720, 1280],
+ [1080, 1080],
+ ]) {
+ const pose = getCursorGravityState(cursorGravityLength, {
+ width,
+ height,
+ });
+ expect((pose.front + pose.right) / 2).toBeCloseTo(width / 2, 5);
+ expect(pose.buttonWidth).toBeCloseTo(300 * pose.unit, 5);
+ expect(pose.strain).toBe(0);
+ expect(pose.cursorY - 70 * pose.unit).toBeGreaterThan(height);
+ expect(pose.tetherOpacity).toBe(0);
+ const late = getCursorGravityState(1000, { width, height });
+ expect(late.front).toBe(pose.front);
+ expect(late.right).toBe(pose.right);
+ expect(late.centerY).toBe(pose.centerY);
+ }
+ });
+ test("phase boundaries stay continuous and seeking does not change the result", () => {
+ for (const t of [
+ 10, 39, 48, 59, 64, 70, 83, 87, 94, 112, 127, 132, 140, 151,
+ ]) {
+ const a = getCursorGravityState(t - 0.0001);
+ const b = getCursorGravityState(t + 0.0001);
+ for (const key of [
+ "front",
+ "right",
+ "centerY",
+ "cursorX",
+ "cursorY",
+ "cursorAngle",
+ ] as const) {
+ expect(Math.abs(a[key] - b[key])).toBeLessThan(0.05);
+ }
+ const expected = getCursorGravityState(t);
+ getCursorGravityState(200);
+ getCursorGravityState(0);
+ expect(getCursorGravityState(t)).toEqual(expected);
+ }
+ });
+ test("geometry stays finite at supported tensions and proportions", () => {
+ for (const tension of [0, 1, 1.5, Number.NaN]) {
+ for (let frame = 0; frame <= 180; frame++) {
+ const pose = getCursorGravityState(frame, { tension });
+ expect(getGravityButtonPath(pose)).not.toMatch(/NaN|Infinity/);
+ expect(pose.neckHeight).toBeGreaterThan(0);
+ expect(pose.buttonWidth).toBeGreaterThan(0);
+ }
+ }
+ });
+ test("cursor rear loads on each tug and relaxes without moving its tip", () => {
+ for (const peak of [58, 81, 100]) {
+ const pose = getCursorGravityState(peak);
+ expect(pose.cursorEffort).toBeGreaterThan(0.7);
+ expect(getGravityCursorPath(pose.cursorEffort)).toStartWith(
+ "M -5 -4 Q 3 0 -5 4",
+ );
+ expect(getCursorGravityState(peak, { tension: 0 }).cursorEffort).toBe(0);
+ }
+ for (const rest of [0, 48, 70, 94, 118, 180]) {
+ expect(getCursorGravityState(rest).cursorEffort).toBe(0);
+ }
+ for (const t of [48, 58, 64, 70, 81, 87, 94, 100, 104, 118]) {
+ expect(
+ Math.abs(
+ getCursorGravityState(t - 0.0001).cursorEffort -
+ getCursorGravityState(t + 0.0001).cursorEffort,
+ ),
+ ).toBeLessThan(0.001);
+ }
+ });
+ test("speed scales the transition and final hold", () => {
+ expect(getCursorGravityDuration()).toBe(180);
+ expect(getCursorGravityDuration({ speed: 0.5 })).toBe(360);
+ expect(getCursorGravityDuration({ speed: 2 })).toBe(90);
+ expect(getCursorGravityDuration({ speed: 0 })).toBe(1);
+ expect(getCursorGravityDuration({ speed: Number.NaN })).toBe(180);
+ });
+});
diff --git a/registry/remocn/cursor-gravity/config.ts b/registry/remocn/cursor-gravity/config.ts
new file mode 100644
index 00000000..937a52f0
--- /dev/null
+++ b/registry/remocn/cursor-gravity/config.ts
@@ -0,0 +1,40 @@
+import { type ComponentConfig, FPS, H, W } from "@/lib/customizer-config";
+import { getCursorGravityDuration } from ".";
+
+export const cursorGravityConfig: ComponentConfig = {
+ componentName: "CursorGravity",
+ importPath: "@/components/remocn/cursor-gravity",
+ controls: {
+ label: {
+ type: "text-content",
+ default: "Create something",
+ description: "Button label",
+ },
+ tension: {
+ type: "number",
+ default: 1,
+ min: 0,
+ max: 1.5,
+ step: 0.1,
+ description: "Pull tension",
+ hiddenFromList: false,
+ },
+ cursorColor: { type: "color", default: "#fffaf0", description: "Cursor" },
+ color: { type: "color", default: "#fffaf0", description: "Button" },
+ textColor: {
+ type: "color",
+ default: "#32153c",
+ description: "Button text",
+ },
+ backgroundColor: {
+ type: "color",
+ default: "#a800b7",
+ description: "Background",
+ },
+ },
+ durationInFrames: 180,
+ getDurationInFrames: (values) => getCursorGravityDuration(values),
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+};
diff --git a/registry/remocn/cursor-gravity/index.tsx b/registry/remocn/cursor-gravity/index.tsx
new file mode 100644
index 00000000..bc2379a4
--- /dev/null
+++ b/registry/remocn/cursor-gravity/index.tsx
@@ -0,0 +1,294 @@
+"use client";
+
+import type { ReactNode } from "react";
+import { Easing, useCurrentFrame, useVideoConfig } from "remotion";
+
+export interface CursorGravityProps {
+ /** Custom content in a 300 × 88 reference-pixel slot. */
+ children?: ReactNode;
+ label?: string;
+ /** Strength of the elastic neck and recoil, 0–1.5. */
+ tension?: number;
+ cursorColor?: string;
+ color?: string;
+ textColor?: string;
+ backgroundColor?: string;
+ speed?: number;
+ className?: string;
+}
+
+export const cursorGravityLength = 151;
+const DURATION = 180;
+const finite = (value: number, fallback: number) =>
+ Number.isFinite(value) ? value : fallback;
+const clamp = (value: number) => Math.max(0, Math.min(1, value));
+const mix = (a: number, b: number, p: number) => a + (b - a) * p;
+const progress = (frame: number, start: number, end: number) =>
+ clamp((frame - start) / (end - start));
+const ease = Easing.bezier(0.65, 0, 0.35, 1);
+const pullEase = Easing.bezier(0.12, 0.8, 0.22, 1);
+
+/** Complete transition plus a one-second hold, in frames at 30 fps. */
+export function getCursorGravityDuration({
+ speed = 1,
+}: Pick<CursorGravityProps, "speed"> = {}) {
+ const rate = Math.max(0, finite(speed, 1));
+ return rate === 0 ? 1 : Math.max(1, Math.ceil(DURATION / rate));
+}
+
+/** A pull advances sharply, pauses under load, then recoils before the next tug. */
+function pullDistance(t: number, strength: number) {
+ const keys = [
+ [48, 0],
+ [59, 116],
+ [64, 116],
+ [70, 116 - 30 * strength],
+ [83, 292],
+ [87, 292],
+ [94, 292 - 42 * strength],
+ [112, 772],
+ ];
+ if (t <= keys[0][0]) return 0;
+ for (let i = 1; i < keys.length; i++) {
+ const [start, a] = keys[i - 1];
+ const [end, b] = keys[i];
+ if (t <= end)
+ return mix(a, b, (b > a ? pullEase : ease)(progress(t, start, end)));
+ }
+ return 772;
+}
+
+/** Pure, resolution-aware pose. The right edge is the real composition boundary. */
+export function getCursorGravityState(
+ frame: number,
+ {
+ width = 1280,
+ height = 720,
+ tension = 1,
+ }: { width?: number; height?: number; tension?: number } = {},
+) {
+ const w = Math.max(1, finite(width, 1280));
+ const h = Math.max(1, finite(height, 720));
+ const unit = Math.min(w / 1280, h / 720);
+ const t = Math.max(0, finite(frame, 0));
+ const strength = Math.max(0, Math.min(1.5, finite(tension, 1)));
+ const centerY = h * 0.5;
+ const finalLeft = w / 2 - 150 * unit;
+ const finalRight = w / 2 + 150 * unit;
+ const edgeTip = w - 24 * unit;
+ const distance = pullDistance(t, strength) / 772;
+ const extraction = distance * (edgeTip - (finalLeft - 14 * unit));
+ // The back of the button resists the first two tugs beyond the frame edge.
+ const releaseTime = progress(t, 94, 132);
+ // Closed-form damped spring stays continuous at fractional frames too.
+ const springRelease =
+ 1 -
+ Math.exp(-7 * releaseTime) *
+ (Math.cos(10 * releaseTime) + 0.7 * Math.sin(10 * releaseTime));
+ const release = mix(springRelease, 1, ease(progress(t, 122, 132)));
+ const front = mix(w + 12 * unit, finalLeft, distance);
+ const right = mix(w + 312 * unit - distance * 70 * unit, finalRight, release);
+ const buttonWidth = Math.max(220 * unit, right - front);
+ const strain = clamp((buttonWidth / (300 * unit) - 1) / 1.3) * strength;
+ const wobble =
+ t < 112
+ ? 0
+ : Math.sin((t - 112) * 0.48) *
+ Math.exp(-(t - 112) * 0.14) *
+ 5 *
+ unit *
+ strength *
+ (1 - progress(t, 132, 140));
+ const y = centerY + wobble;
+ const entry = ease(progress(t, 10, 39));
+ const approach = ease(progress(t, 39, 48));
+ const leave = ease(progress(t, 127, 151));
+ const holdTip = mix(w * 0.28, edgeTip - 80 * unit, entry);
+ const pullTip = edgeTip - extraction;
+ const cursorX =
+ t < 48 ? mix(holdTip, edgeTip, approach) : mix(pullTip, w * 0.25, leave);
+ const cursorY =
+ t < 39
+ ? mix(h + 110 * unit, centerY + 70 * unit, entry)
+ : t < 48
+ ? mix(centerY + 70 * unit, centerY, approach)
+ : mix(centerY, h + 110 * unit, leave);
+ // Triangle points toward the edge while pulling; turns toward its exit afterward.
+ const cursorAngle = t < 48 ? mix(-32, 0, approach) : mix(0, 115, leave);
+ const effortPulse = (
+ start: number,
+ peak: number,
+ hold: number,
+ end: number,
+ ) => ease(progress(t, start, peak)) * (1 - ease(progress(t, hold, end)));
+ const cursorEffort =
+ strength *
+ (0.8 * effortPulse(48, 58, 64, 70) +
+ effortPulse(70, 81, 87, 94) +
+ 1.15 * effortPulse(94, 100, 104, 118));
+ return {
+ frame: t,
+ unit,
+ front,
+ right: front + buttonWidth,
+ buttonWidth,
+ centerY: y,
+ strain,
+ neckHeight: 88 * unit * (1 - 0.58 * strain),
+ bodyHeight: 88 * unit * (1 - 0.17 * strain),
+ cursorX,
+ cursorY,
+ cursorAngle,
+ cursorEffort,
+ attached: t >= 48 && t <= 121,
+ tetherOpacity: progress(t, 46, 49) * (1 - progress(t, 115, 122)),
+ };
+}
+
+/** The tip stays fixed; the rear bows backward as each tug builds effort. */
+export function getGravityCursorPath(effort: number) {
+ const load = Math.max(0, Math.min(1.725, finite(effort, 0)));
+ const shoulder = -62 - 30 * load;
+ const rear = -70 - 40 * load;
+ const halfHeight = 26 - 4 * load;
+ return `M -5 -4 Q 3 0 -5 4
+ C -24 ${11.333 - load * 3} ${shoulder + 19} ${halfHeight - 7.333} ${shoulder} ${halfHeight}
+ Q ${rear} ${halfHeight + 4} ${rear} ${halfHeight - 6}
+ C ${rear} 4 ${rear - 18 * load} 8 ${rear - 18 * load} 0
+ C ${rear - 18 * load} -8 ${rear} -4 ${rear} ${-halfHeight + 6}
+ Q ${rear} ${-halfHeight - 4} ${shoulder} ${-halfHeight}
+ C ${shoulder + 19} ${-halfHeight + 7.333} -24 ${-11.333 + load * 3} -5 -4 Z`;
+}
+
+/** Rounded rectangle with a narrow leading edge: the pull deforms the surface. */
+export function getGravityButtonPath(
+ state: ReturnType<typeof getCursorGravityState>,
+) {
+ const { buttonWidth: w, neckHeight, bodyHeight, unit } = state;
+ const a = neckHeight / 2;
+ const b = bodyHeight / 2;
+ const r = Math.min(25 * unit, a * 0.9);
+ const backRadius = 25 * unit;
+ return `M ${r} ${-a}
+ C ${w * 0.35} ${-a} ${w * 0.35} ${-b} ${w - backRadius} ${-b}
+ Q ${w} ${-b} ${w} ${-b + backRadius}
+ L ${w} ${b - backRadius} Q ${w} ${b} ${w - backRadius} ${b}
+ C ${w * 0.35} ${b} ${w * 0.35} ${a} ${r} ${a}
+ Q 0 ${a} 0 ${a - r} L 0 ${-a + r} Q 0 ${-a} ${r} ${-a} Z`;
+}
+
+export function CursorGravity({
+ children,
+ label = "Create something",
+ tension = 1,
+ cursorColor = "#fffaf0",
+ color = "#fffaf0",
+ textColor = "#32153c",
+ backgroundColor = "#a800b7",
+ speed = 1,
+ className,
+}: CursorGravityProps) {
+ const frame = useCurrentFrame();
+ const { width, height, fps } = useVideoConfig();
+ const t = frame * (30 / fps) * Math.max(0, finite(speed, 1));
+ const state = getCursorGravityState(t, { width, height, tension });
+ const { unit } = state;
+ // Content travels with the material, without stretching the lettering.
+ const contentUnit = unit * Math.min(1, state.buttonWidth / (300 * unit));
+ const contentX = state.front + state.buttonWidth - 150 * contentUnit;
+ return (
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ inset: 0,
+ overflow: "hidden",
+ backgroundColor,
+ fontFamily: "Arial, sans-serif",
+ }}
+ >
+ <svg
+ width={width}
+ height={height}
+ viewBox={`0 0 ${width} ${height}`}
+ aria-hidden="true"
+ style={{ position: "absolute", inset: 0 }}
+ >
+ <path
+ d={getGravityButtonPath(state)}
+ transform={`translate(${state.front} ${state.centerY})`}
+ fill={color}
+ />
+ <path
+ d={`M ${state.cursorX + 2 * unit} ${state.cursorY} Q ${mix(state.cursorX, state.front, 0.5)} ${state.centerY} ${state.front + 2 * unit} ${state.centerY}`}
+ fill="none"
+ stroke={cursorColor}
+ strokeWidth={2 * unit}
+ strokeLinecap="round"
+ opacity={state.tetherOpacity}
+ />
+ </svg>
+ <div
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ width: 300,
+ height: 88,
+ translate: `${contentX - 150 * contentUnit}px ${state.centerY - 44 * contentUnit}px`,
+ scale: contentUnit,
+ transformOrigin: "top left",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ gap: 20,
+ color: textColor,
+ fontWeight: 600,
+ fontSize: 23,
+ }}
+ >
+ {children ?? (
+ <>
+ <span
+ style={{
+ maxWidth: 220,
+ overflow: "hidden",
+ whiteSpace: "nowrap",
+ textOverflow: "ellipsis",
+ }}
+ >
+ {label}
+ </span>
+ <svg width="22" height="22" viewBox="0 0 24 24" aria-hidden="true">
+ <path
+ d="M5 12H19M13 6L19 12L13 18"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </>
+ )}
+ </div>
+ <svg
+ width={190 * unit}
+ height={70 * unit}
+ viewBox="-180 -35 190 70"
+ role="img"
+ aria-label="Rounded triangular cursor"
+ style={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ translate: `${state.cursorX - 180 * unit}px ${state.cursorY - 35 * unit}px`,
+ transform: `rotate(${state.cursorAngle}deg)`,
+ transformOrigin: `${180 * unit}px ${35 * unit}px`,
+ }}
+ >
+ <path d={getGravityCursorPath(state.cursorEffort)} fill={cursorColor} />
+ </svg>
+ </div>
+ );
+}
diff --git a/registry/remocn/registry.json b/registry/remocn/registry.json
index c19ed3cb..e92550b9 100644
--- a/registry/remocn/registry.json
+++ b/registry/remocn/registry.json
@@ -2206,6 +2206,34 @@
"target": "components/remocn/search-reveal.tsx"
}
]
+ },
+ {
+ "name": "cursor-gravity",
+ "type": "registry:component",
+ "title": "Cursor Gravity",
+ "description": "A rounded triangular cursor tugs a button out of the screen edge with pulsed elastic resistance.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "cursor-gravity/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/cursor-gravity.tsx"
+ }
+ ]
+ },
+ {
+ "name": "type-fossil",
+ "type": "registry:component",
+ "title": "Type Fossil",
+ "description": "A readable word carries layers of fine contours, revises itself, then compresses into a clean typographic imprint.",
+ "dependencies": ["remotion"],
+ "files": [
+ {
+ "path": "type-fossil/index.tsx",
+ "type": "registry:component",
+ "target": "components/remocn/type-fossil.tsx"
+ }
+ ]
}
]
}
diff --git a/registry/remocn/type-fossil/__tests__/type-fossil.test.ts b/registry/remocn/type-fossil/__tests__/type-fossil.test.ts
new file mode 100644
index 00000000..c3e56202
--- /dev/null
+++ b/registry/remocn/type-fossil/__tests__/type-fossil.test.ts
@@ -0,0 +1,90 @@
+import { describe, expect, test } from "bun:test";
+import {
+ getFossilLayerPose,
+ getTypeFossilDuration,
+ getTypeFossilState,
+ parseFossilDrafts,
+ typeFossilLength,
+} from "..";
+
+describe("type fossil slice", () => {
+ test("revisions advance sequentially with opaque foreground lettering", () => {
+ for (const [frame, revision] of [
+ [0, 0],
+ [28, 1],
+ [46, 2],
+ [64, 3],
+ ]) {
+ const state = getTypeFossilState(frame);
+ expect(state.from).toBe(revision);
+ expect(state.to).toBe(revision);
+ expect(getFossilLayerPose(state, 0).opacity).toBe(1);
+ }
+ const wipe = getTypeFossilState(24);
+ expect(wipe.from).toBe(0);
+ expect(wipe.to).toBe(1);
+ expect(wipe.change).toBeGreaterThan(0);
+ expect(wipe.change).toBeLessThan(1);
+ });
+ test("all contours converge into the same held final word", () => {
+ const state = getTypeFossilState(typeFossilLength);
+ expect(state.from).toBe(6);
+ expect(state.collapse).toBe(1);
+ for (let i = 0; i < state.count; i++) {
+ const pose = getFossilLayerPose(state, i);
+ expect(pose.x).toBe(640);
+ expect(pose.y).toBe(360);
+ expect(pose.skew).toBeCloseTo(0);
+ expect(pose.opacity).toBe(i === 0 ? 1 : 0);
+ expect(pose).toEqual(getFossilLayerPose(getTypeFossilState(1000), i));
+ }
+ });
+ test("geometry stays bounded across count, thickness and timeline extremes", () => {
+ for (const layers of [4, 16, 24, Number.NaN])
+ for (const depth of [50, 150, Number.NaN]) {
+ for (let frame = 0; frame <= 210; frame += 3) {
+ const state = getTypeFossilState(frame, { layers, depth });
+ for (let i = 0; i < state.count; i++) {
+ const pose = getFossilLayerPose(state, i);
+ expect(Object.values(pose).every(Number.isFinite)).toBe(true);
+ expect(pose.x).toBeGreaterThan(530);
+ expect(pose.x).toBeLessThan(750);
+ expect(pose.y).toBeGreaterThan(300);
+ expect(pose.y).toBeLessThan(420);
+ }
+ }
+ }
+ });
+ test("each draft gets a full beat and custom duration retains the final hold", () => {
+ for (let draftCount = 0; draftCount <= 12; draftCount++) {
+ const drafts = Array.from(
+ { length: draftCount },
+ (_, i) => `Draft ${i}`,
+ ).join("|");
+ const duration = getTypeFossilDuration({ drafts });
+ const state = getTypeFossilState(duration - 1, { draftCount });
+ expect(state.from).toBe(draftCount);
+ expect(state.collapse).toBe(1);
+ expect(duration - state.settle).toBe(34);
+ }
+ expect(getTypeFossilDuration()).toBe(208);
+ expect(getTypeFossilDuration({ speed: 0.5 })).toBe(416);
+ expect(getTypeFossilDuration({ speed: 0 })).toBe(1);
+ expect(parseFossilDrafts("Maybe | \n Почти\n\nAgain")).toEqual([
+ "Maybe",
+ "Почти",
+ "Again",
+ ]);
+ expect(parseFossilDrafts("a|b|c|d|e|f|g|h|i|j|k|l|m")).toHaveLength(12);
+ });
+ test("arbitrary seeking and stage boundaries preserve position continuity", () => {
+ for (const frame of [0, 16, 20, 28, 38, 46, 110, 118, 126, 156, 174]) {
+ const expected = getTypeFossilState(frame);
+ getTypeFossilState(200);
+ expect(getTypeFossilState(frame)).toEqual(expected);
+ const a = getFossilLayerPose(getTypeFossilState(frame - 0.0001), 0);
+ const b = getFossilLayerPose(getTypeFossilState(frame + 0.0001), 0);
+ expect(Math.hypot(a.x - b.x, a.y - b.y)).toBeLessThan(0.01);
+ }
+ });
+});
diff --git a/registry/remocn/type-fossil/config.ts b/registry/remocn/type-fossil/config.ts
new file mode 100644
index 00000000..257d7e92
--- /dev/null
+++ b/registry/remocn/type-fossil/config.ts
@@ -0,0 +1,70 @@
+import {
+ type ComponentConfig,
+ enumVariants,
+ FONT_WEIGHT_OPTIONS,
+ FPS,
+ H,
+ W,
+} from "@/lib/customizer-config";
+import { getTypeFossilDuration, typeFossilDefaultDrafts } from ".";
+export const typeFossilConfig: ComponentConfig = {
+ componentName: "TypeFossil",
+ importPath: "@/components/remocn/type-fossil",
+ controls: {
+ text: { type: "text-content", default: "Form", description: "Final word" },
+ drafts: {
+ type: "text-content",
+ default: typeFossilDefaultDrafts,
+ description: "Drafts (separate with |)",
+ },
+ layers: {
+ type: "number",
+ default: 16,
+ min: 4,
+ max: 24,
+ step: 1,
+ description: "Contour layers",
+ hiddenFromList: false,
+ },
+ depth: {
+ type: "number",
+ default: 100,
+ min: 50,
+ max: 150,
+ step: 5,
+ description: "Slice depth",
+ hiddenFromList: false,
+ },
+ fontSize: {
+ type: "number",
+ default: 220,
+ min: 24,
+ max: 300,
+ step: 1,
+ description: "Font size",
+ hiddenFromList: false,
+ },
+ fontWeight: {
+ type: "enum",
+ default: "600",
+ variants: enumVariants(FONT_WEIGHT_OPTIONS),
+ description: "Font weight",
+ },
+ color: { type: "color", default: "#302b26", description: "Ink" },
+ accentColor: {
+ type: "color",
+ default: "#a800b7",
+ description: "Contours",
+ },
+ backgroundColor: {
+ type: "color",
+ default: "#eeeae2",
+ description: "Background",
+ },
+ },
+ durationInFrames: getTypeFossilDuration(),
+ getDurationInFrames: (values) => getTypeFossilDuration(values),
+ fps: FPS,
+ compositionWidth: W,
+ compositionHeight: H,
+};
diff --git a/registry/remocn/type-fossil/index.tsx b/registry/remocn/type-fossil/index.tsx
new file mode 100644
index 00000000..67404c0f
--- /dev/null
+++ b/registry/remocn/type-fossil/index.tsx
@@ -0,0 +1,241 @@
+"use client";
+
+import { useId } from "react";
+import { Easing, useCurrentFrame, useVideoConfig } from "remotion";
+
+export interface TypeFossilProps {
+ text?: string;
+ /** Earlier versions, separated by | or newlines. Up to twelve drafts. */
+ drafts?: string;
+ layers?: number;
+ /** Thickness of the typographic slice, in reference pixels. */
+ depth?: number;
+ fontSize?: number;
+ fontWeight?: number | string;
+ color?: string;
+ accentColor?: string;
+ backgroundColor?: string;
+ speed?: number;
+ className?: string;
+}
+
+export const typeFossilLength = 174;
+export const typeFossilDefaultDrafts =
+ "Idea | Maybe | Try | Almost | Again | Closer";
+const finite = (n: number, fallback: number) =>
+ Number.isFinite(n) ? n : fallback;
+const clamp = (n: number) => Math.min(1, Math.max(0, n));
+const mix = (a: number, b: number, p: number) => a + (b - a) * p;
+const progress = (t: number, a: number, b: number) => clamp((t - a) / (b - a));
+const ease = Easing.bezier(0.65, 0, 0.3, 1);
+const out = Easing.bezier(0.16, 1, 0.3, 1);
+
+export function parseFossilDrafts(drafts: string) {
+ return drafts
+ .split(/[|\n\r]+/)
+ .map((value) => value.trim().replace(/\s+/g, " "))
+ .filter(Boolean)
+ .slice(0, 12);
+}
+
+function timing(draftCount: number) {
+ const count = Math.round(Math.max(0, Math.min(12, finite(draftCount, 6))));
+ const collapseStart = count === 0 ? 16 : 20 + (count - 1) * 18 + 16;
+ return { draftCount: count, collapseStart, settle: collapseStart + 48 };
+}
+
+export function getTypeFossilDuration({
+ drafts = typeFossilDefaultDrafts,
+ speed = 1,
+}: Pick<TypeFossilProps, "drafts" | "speed"> = {}) {
+ const rate = Math.max(0, finite(speed, 1));
+ const { settle } = timing(parseFossilDrafts(drafts).length);
+ return rate === 0 ? 1 : Math.max(1, Math.ceil((settle + 34) / rate));
+}
+
+/** One readable revision at a time, followed by a single compression into print. */
+export function getTypeFossilState(
+ frame: number,
+ {
+ layers = 16,
+ depth = 100,
+ draftCount = 6,
+ }: Pick<TypeFossilProps, "layers" | "depth"> & { draftCount?: number } = {},
+) {
+ const t = Math.max(0, finite(frame, 0));
+ const count = Math.round(Math.max(4, Math.min(24, finite(layers, 16))));
+ const thickness = Math.max(50, Math.min(150, finite(depth, 100)));
+ const schedule = timing(draftCount);
+ const collapse = ease(progress(t, schedule.collapseStart, schedule.settle));
+ const open = mix(0.55, 1, out(progress(t, 0, 16)));
+ const spread = open * (1 - collapse);
+ let from = 0;
+ let to = 0;
+ let change = 0;
+ for (let revision = 0; revision < schedule.draftCount; revision++) {
+ const start = 20 + revision * 18;
+ if (t < start) break;
+ if (t >= start + 8) {
+ from = revision + 1;
+ to = from;
+ change = 0;
+ } else {
+ from = revision;
+ to = revision + 1;
+ change = ease(progress(t, start, start + 8));
+ break;
+ }
+ }
+ return {
+ frame: t,
+ count,
+ thickness,
+ from,
+ to,
+ change,
+ draftCount: schedule.draftCount,
+ settle: schedule.settle,
+ collapse,
+ spread,
+ spanX: thickness * 1.35 * spread,
+ spanY: -thickness * 0.68 * spread,
+ skew: -10 * (1 - collapse),
+ ghostOpacity: 1 - ease(progress(t, schedule.settle - 18, schedule.settle)),
+ };
+}
+
+/** Bounded parallel contours, no perspective division or near-plane disappearance. */
+export function getFossilLayerPose(
+ state: ReturnType<typeof getTypeFossilState>,
+ index: number,
+) {
+ const i = Math.round(
+ Math.max(0, Math.min(state.count - 1, finite(index, 0))),
+ );
+ const fraction = i / (state.count - 1);
+ return {
+ x: 640 + state.spanX / 2 - state.spanX * fraction,
+ y: 360 + state.spanY / 2 - state.spanY * fraction,
+ opacity: i === 0 ? 1 : state.ghostOpacity,
+ skew: state.skew,
+ fraction,
+ };
+}
+
+function fitSize(text: string, fontSize: number) {
+ const widthUnits = Array.from(text).reduce(
+ (sum, char) =>
+ sum +
+ (/\s/.test(char)
+ ? 0.35
+ : /[ilI.,'!:;]/.test(char)
+ ? 0.4
+ : /[MW@ЖШЩЮ]/.test(char)
+ ? 1
+ : 0.8),
+ 0,
+ );
+ return Math.min(fontSize, 720 / Math.max(1, widthUnits));
+}
+
+export function TypeFossil({
+ text = "Form",
+ drafts = typeFossilDefaultDrafts,
+ layers = 16,
+ depth = 100,
+ fontSize = 220,
+ fontWeight = 600,
+ color = "#302b26",
+ accentColor = "#a800b7",
+ backgroundColor = "#eeeae2",
+ speed = 1,
+ className,
+}: TypeFossilProps) {
+ const id = useId().replace(/:/g, "");
+ const frame = useCurrentFrame();
+ const { fps } = useVideoConfig();
+ const finalText = text.trim().replace(/\s+/g, " ");
+ const revisions = [...parseFossilDrafts(drafts), finalText];
+ const state = getTypeFossilState(
+ ((frame * 30) / fps) * Math.max(0, finite(speed, 1)),
+ { layers, depth, draftCount: revisions.length - 1 },
+ );
+ const size = Math.max(24, Math.min(300, finite(fontSize, 220)));
+ const weight = Math.max(100, Math.min(900, finite(Number(fontWeight), 600)));
+ const wipeX = mix(-100, 1380, state.change);
+ const renderSlice = (copy: string) => {
+ const font = fitSize(copy, size);
+ return Array.from({ length: state.count }, (_, order) => {
+ const index = state.count - 1 - order;
+ const pose = getFossilLayerPose(state, index);
+ return (
+ <text
+ key={index}
+ x="0"
+ y={font * 0.35}
+ textAnchor="middle"
+ fontSize={font}
+ fontWeight={weight}
+ transform={`translate(${pose.x} ${pose.y}) skewX(${pose.skew})`}
+ fill={index === 0 ? color : "none"}
+ stroke={index === 0 ? "none" : accentColor}
+ strokeWidth={index === 0 ? 0 : 0.75}
+ strokeOpacity={0.18 + (1 - pose.fraction) * 0.38}
+ opacity={pose.opacity}
+ paintOrder="stroke fill"
+ >
+ {copy}
+ </text>
+ );
+ });
+ };
+ return (
+ <div
+ className={className}
+ style={{
+ position: "absolute",
+ inset: 0,
+ overflow: "hidden",
+ backgroundColor,
+ fontFamily: "Arial, Helvetica, sans-serif",
+ }}
+ >
+ <svg
+ width="100%"
+ height="100%"
+ viewBox="0 0 1280 720"
+ preserveAspectRatio="xMidYMid meet"
+ role="img"
+ aria-label={finalText || "Empty type fossil"}
+ >
+ <defs>
+ <clipPath id={`${id}-old`}>
+ <rect
+ x={wipeX}
+ y="-100"
+ width={1480 - (wipeX + 100)}
+ height="920"
+ />
+ </clipPath>
+ <clipPath id={`${id}-new`}>
+ <rect x="-100" y="-100" width={wipeX + 100} height="920" />
+ </clipPath>
+ </defs>
+ {finalText ? (
+ state.from === state.to ? (
+ renderSlice(revisions[state.from])
+ ) : (
+ <>
+ <g clipPath={`url(#${id}-old)`}>
+ {renderSlice(revisions[state.from])}
+ </g>
+ <g clipPath={`url(#${id}-new)`}>
+ {renderSlice(revisions[state.to])}
+ </g>
+ </>
+ )
+ ) : null}
+ </svg>
+ </div>
+ );
+}
diff --git a/scripts/codemod-controls.mts b/scripts/codemod-controls.mts
index a2a4defd..ea7cbaf9 100644
--- a/scripts/codemod-controls.mts
+++ b/scripts/codemod-controls.mts
@@ -68,7 +68,7 @@ function serialize(value: unknown, indent: string): string {
}
const entries = Object.entries(value as Record<string, unknown>);
if (entries.length === 0) return "{}";
- const inner = indent + " ";
+ const inner = `${indent} `;
const lines = entries.map(([k, v]) => {
const key = IDENT.test(k) ? k : JSON.stringify(k);
return `${inner}${key}: ${serialize(v, inner)},`;