Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
Add Type Fossil typography animation
kapishdima35a8dac6bd92
diff --git a/config/site.ts b/config/site.tsindex 6115bbbb..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",diff --git a/content/docs/typography/index.mdx b/content/docs/typography/index.mdxindex 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<ComponentCardGriditems={[+ {+ 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.jsonindex 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.mdxnew file mode 100644index 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-type-fossil-design.md b/docs/plans/2026-09-08-type-fossil-design.mdnew file mode 100644index 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/elements/type-fossil.json b/registry-artifacts/elements/type-fossil.jsonnew file mode 100644index 00000000..4ebf7ce3--- /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 <>\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 </>\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.jsonindex 8f07b871..f32d6aba 100644--- a/registry-artifacts/registry.json+++ b/registry-artifacts/registry.json@@ -2221,6 +2221,20 @@],"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",diff --git a/registry-artifacts/type-fossil.json b/registry-artifacts/type-fossil.jsonnew file mode 100644index 00000000..206f8528--- /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 <>\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 </>\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__.tsxindex 99e236e2..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) => ({diff --git a/registry/__manifest__.ts b/registry/__manifest__.tsindex 7d07c41e..164432cf 100644--- a/registry/__manifest__.ts+++ b/registry/__manifest__.ts@@ -4337,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/registry.json b/registry/remocn/registry.jsonindex 2183de7c..e92550b9 100644--- a/registry/remocn/registry.json+++ b/registry/remocn/registry.json@@ -2220,6 +2220,20 @@"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.tsnew file mode 100644index 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.tsnew file mode 100644index 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.tsxnew file mode 100644index 00000000..01daab88--- /dev/null+++ b/registry/remocn/type-fossil/index.tsx@@ -0,0 +1,243 @@+"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>+ );+}