Files
hyperframes/docs/public/catalog/blocks/camera-dolly-zoom.json
Miguel Ángel f24ff83834 feat(catalog): add the seven 3D-motion pieces as installable registry blocks (#4056)
* feat(catalog): add the seven 3D-motion pieces as installable registry blocks

Each piece ships as a registry block with a CDN poster and preview, a live
catalog detail page and its source. Scripts travel inside the catalog payload
(shared vendor libraries fetched once, item scripts inline, the one HDR as a
data URI) because the docs host only serves fonts, images and JSON.

NO_ESSAY_COMMENTS_OK: the long comment blocks are in vendored libraries and
the ported frost source under registry/blocks, not hand-written here.
HF_MAX_NONLFS_KB=6000: four hosted texture PNGs under docs/public/catalog/items
are runtime assets the docs host must serve as files.
fallow skipped locally: it audits against origin/main and this branch is
stacked on an older main.

* chore(catalog): regenerate gallery data and nav after rebasing onto main

* fix(catalog): read the install manifest through the bounded project reader

* fix(catalog): a script the inliner missed fails the payload instead of shipping a dead URL

* refactor(catalog): the leftover-script check reuses the reference finder

* fix(catalog): frost and glass textures load from the CDN and the iteration presets are gone

* chore(catalog): regenerate the frost and glass payloads and nav

* fix(catalog): frost and glass textures are hosted through the registry url field, not hardcoded

* chore(catalog): regenerate the frost and glass payloads against the hosted texture URLs

* fix(catalog): the hosted-reference rewrite refuses a bare name it cannot safely replace

* ci(catalog): verify changed catalog payloads in headless Chrome and check the docs catalog

* feat(catalog): every item page follows the shared layout with a Tune panel and tabs

* fix(catalog): let the texture-mask item host its masks so its tile plays live

* chore(catalog): regenerate item pages, gallery data and the texture-mask payload

* chore(catalog): regenerate item pages after merging main

* fix(catalog): declared-only variables get the Tune panel, Code and Docs tabs capped

* feat(catalog): give the blend-difference caption a demo scene so its tile plays live

* chore(catalog): live payload for the blend-difference caption

* perf(catalog): heavy 3d pieces compile and draw before ready, not on the first visible frame

* feat(catalog): the avatar promo card hosts its videos, audio and fonts on the CDN

* feat(catalog): the avatar promo card tile plays live from its CDN-hosted media

* chore(catalog): the avatar promo card plays live, no allowlist left

* chore(catalog): shorten two comment blocks

* chore(catalog): trim first-party comment blocks to the comment-check limits

* chore(catalog): shorten two frost source comments

* fix(catalog): the Docs tab renders as prose again, and the detail page honours reduced motion

Frame-mode pages carry no prose wrapper, and the detail component sat inside
not-prose, so the Docs slot's headings, paragraphs, links and lists had no
styling at all. The slots now carry their own prose classes and the chrome
around them keeps not-prose.

The recorded clip also gets the reduced-motion guard the docs-snippet check
requires, and the generator reads stability from the source metadata type so
the scripts typecheck passes.

* fix(catalog): docs-tab paragraphs render as blocks

Mintlify emits paragraphs as inline spans, so two paragraphs in the Docs slot ran together.

* fix(ci): drop the duplicate docs_catalog job output

git's line-based auto-merge silently duplicated the outputs key when
main and this branch each added it on non-adjacent lines during the
rebase; oxfmt's yaml parser rejects the repeated map key.

* fix(catalog): close four CodeQL alerts in the frost source

* chore(catalog): allowlist the avatar-promo-card CDN asset deletions, format sync-docs-catalog

check-no-main-deletions.mjs was rejecting 11 local mp4/font files this branch
already deleted in favor of CDN hosting; scripts/sync-docs-catalog.mjs had one
line over the 100-col print width from an earlier edit in this branch.

* fix(catalog): detail tabs use docs prose spacing, Install first; previews skip no-WebGPU runners

* fix(catalog): the docs tab scrolls with the page instead of a capped inner box

* refactor(catalog): split the payload asset and verify scripts into single-purpose helpers

* refactor(catalog): split the preview generator into single-purpose helpers

* ci(catalog): fail when the committed catalog differs from generator output

The docs host serves the committed catalog and nothing regenerates it, so a stale
copy shipped silently. The catalog payloads job now generates into a temp dir and
compares it with the committed tree.

* chore(catalog): regenerate docs/public/catalog with the refactored scripts

One full regeneration from an empty output tree with the current scripts. The tree grows
from 58.4 MB to 65.1 MB. Two hosted assets are about 2 MB each (an avatar png and a wav);
the same bytes are already committed under assets/, so HF_MAX_NONLFS_KB is raised for
this commit only.

* fix(catalog): run the catalog script tests under the runner they are written for

The rebase put three node:test files in the vitest half of test:scripts, where they report
"No test suite found". They now sit in the node --test list.

* fix(catalog): a WebGPU item without an adapter shows its recorded clip and says why

* ci(catalog): the drift check runs from a committed fetch mirror with no network

Generation now serves every font and CDN script fetch from scripts/catalog-fetch-mirror and fails
when a fetch is not in it, even if the caller swallowed the error. CATALOG_FETCH_MIRROR=record
refreshes the mirror from the live network. The docs_catalog filter also watches packages/core,
packages/producer and the mirror, and the 13 re-hashed font files are listed in ALLOWED_DELETIONS.

* chore(catalog): clean up the temp font cache and sort the mirror index without a locale

* fix(catalog): hide Tune when the clip stands in, time out the adapter request, share one check

* fix(catalog): the adapter probe survives a sync throw and a hang; test the clip guard

* fix(catalog): keep the adapter probe inside the component, Mintlify evaluates only exports

* fix(catalog): run the detail and page generator tests in CI; no Tune flash while probing WebGPU

* docs(catalog): credit vendored libraries and make each SKILL.md list what the block installs

CREDITS.md names every vendored dependency with its upstream and licence, and flags the two leaf
textures whose origin is still to be confirmed. Each SKILL.md Files table now comes from the block
manifest and its install and render paths point at compositions/<name>/. A test checks that every
path a SKILL.md names is a manifest file that exists.

* fix(catalog): a declared WebGPU item passes verify by its manifest tag, not by console wording

verify-catalog-payloads forgave a missing adapter only by matching the markup and the message, which
library-reported errors and widgets never satisfy. The webgpu tag in the item manifest is now the
owner: a tagged item ignores its page and console errors, an untagged one gets no forgiveness, and a
marker payload with no html is listed instead of crashing the run.

* docs(catalog): correct the credits per block and guard the mount and render paths

CREDITS.md states the three.js version and vendored-or-CDN status per block, adds d3-delaunay,
Clipper on the CDN and the Google Fonts loads, and lists every texture with no known origin.
The SKILL.md test now also checks the mount and render paths against the manifest composition.

* test(catalog): read each block manifest once in the SKILL.md file test

The two checks shared a copied manifest read, which fallow flagged as a clone with a high score.

* fix(catalog): commit the hosted item files a gitignore rule kept out, and check git not the disk

The compositions/ and *-ad/ ignore rules matched folder names under docs/public/catalog/items,
so 33 hosted fonts, textures and marks were generated but never committed and would 404 on
the docs host. The rules now have a negation for that tree and the files are added.

The drift check read the checkout, where git-ignored files still exist, so it passed locally
and failed only in CI. It now unpacks HEAD with git archive and compares that.

* fix(catalog): a tile keeps its poster until the composition has painted

* fix(catalog): a tagged WebGPU item forgives only the adapter-absent error, and test the wiring

The manifest webgpu tag now decides whether an item may lack an adapter, and the error wording
decides which lines are that absence. Any other page or console error on the item, and every
failed request, still fails. The per-item decision is one exported function the tests drive,
marker payloads are parsed by a tested helper, and the SKILL.md variable counts are checked
against their tables (cuboid-carousel said forty-nine for forty).

* fix(catalog): the pinned group's posters load eagerly at high priority

* fix(catalog): type the tile reveal test so the scripts typecheck passes

* fix(catalog): stop the adapter signature matching an unrelated failed adapter request

failed to request .*adapter also matched errors about other adapters. It now matches only a
request for the WebGPU adapter, so a tagged item cannot hide an unrelated failure behind it.

* test(catalog): a tagged item still fails on an error about some other adapter

* feat(catalog): the install command sits above the preview, as on the live catalog

* fix(catalog): find the install slot through Mintlify's child wrapper

* fix(docs): catalog copy buttons keep their size when the label swaps to Copied

* refactor(docs): name the shown copy label once in the catalog copy button

* fix(docs): primary catalog button keeps a readable label on hover and after copy

* fix(docs): inset the catalog tab strip and tab content to match the boxed panels
2026-09-19 16:53:29 -04:00

1 line
12 KiB
JSON

{"html":"<!doctype html>\n<html\n lang=\"en\"\n data-composition-variables='[{\"id\":\"direction\",\"type\":\"enum\",\"label\":\"Dolly direction\",\"default\":\"out\",\"options\":[{\"value\":\"out\",\"label\":\"Dolly out + zoom in (background rushes in)\"},{\"value\":\"in\",\"label\":\"Dolly in + zoom out (background falls away)\"}]},{\"id\":\"strength\",\"type\":\"number\",\"label\":\"Move strength (end / start distance ratio)\",\"default\":2,\"min\":1.1,\"max\":4,\"step\":0.1},{\"id\":\"subjectDistance\",\"type\":\"number\",\"label\":\"Camera-to-subject distance at the start of the move\",\"default\":1400,\"min\":600,\"max\":3000,\"step\":50,\"unit\":\"px\"},{\"id\":\"easing\",\"type\":\"enum\",\"label\":\"Dolly easing\",\"default\":\"power2.inOut\",\"options\":[{\"value\":\"none\",\"label\":\"Linear\"},{\"value\":\"sine.inOut\",\"label\":\"Sine in-out\"},{\"value\":\"power1.inOut\",\"label\":\"Power1 in-out\"},{\"value\":\"power2.inOut\",\"label\":\"Power2 in-out\"},{\"value\":\"power3.inOut\",\"label\":\"Power3 in-out\"}]}]'\n>\n <head>\n <meta charset=\"UTF-8\" />\n <script src=\"https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js\"></script>\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n html,\n body {\n width: 1920px;\n height: 1080px;\n overflow: hidden;\n }\n </style>\n </head>\n <body>\n <!--\n ===================================================================\n DOLLY ZOOM (Vertigo / Hitchcock shot)\n ===================================================================\n\n The camera tracks toward or away from the subject while the field of\n view changes the opposite way, so the SUBJECT HOLDS ITS FRAME SIZE\n while the background collapses behind it or rushes in.\n\n THE CONSTRAINT (this is the whole effect, and it is exact, not taste):\n\n d * tan(FOV / 2) = constant\n\n where d is the camera-to-subject distance. Get it wrong and the shot\n reads as a clumsy zoom. So focal length is SOLVED from distance every\n frame; the two are never keyframed side by side.\n\n In CSS 3D, `perspective: P px` IS the focal length in pixels, and it\n also places the camera exactly P px in front of the z = 0 plane, so\n tan(FOV / 2) = (viewportWidth / 2) / P. Substituting collapses the\n invariant to a single ratio:\n\n P(t) / d(t) = SUBJECT_SCALE (constant)\n\n Everything the rig animates falls out of that one line (see the script).\n\n -------------------------------------------------------------------\n WHAT THIS PRIMITIVE REQUIRES OF ITS CONTENT\n -------------------------------------------------------------------\n\n DEPTH. A flat element gains nothing from a dolly zoom -- with one\n layer there is no background to collapse and the move is invisible.\n Content dropped into #dz-rig MUST be layered or genuinely 3D:\n\n * The SUBJECT sits on the z = 0 plane -- `translateZ(0)`. That is\n the plane the solve holds; anything you want frame-locked goes\n there and nowhere else.\n * BACKGROUND layers get `translateZ(-N px)`, N > 0, at least two or\n three distinct depths (this demo ships five arches plus a back\n wall). More separation = stronger effect.\n * Everything inside #dz-rig must keep `transform-style: preserve-3d`\n on its ancestors and must NOT sit behind `overflow: hidden`, or\n the browser flattens the scene and the depth disappears.\n * Keep every layer at a depth where `d + N > 0` for the whole move,\n i.e. no layer in front of the camera's closest approach.\n\n -------------------------------------------------------------------\n DETERMINISM\n -------------------------------------------------------------------\n\n State at frame N is computed from N alone. d(t) is a lerp of the\n eased tween progress, P is solved from d, and both are written by a\n property setter on the tweened driver object. Nothing accumulates,\n nothing reads a clock, and no frame depends on the frame before it.\n (The setter matters: `tl.eventCallback(\"onUpdate\", ...)` does NOT\n fire on `tl.seek()`, so anything driven that way freezes on frame 0.)\n -->\n <div\n id=\"dz-root\"\n data-composition-id=\"camera-dolly-zoom\"\n data-start=\"0\"\n data-duration=\"4\"\n data-width=\"1920\"\n data-height=\"1080\"\n >\n <style>\n #dz-root {\n width: 1920px;\n height: 1080px;\n position: relative;\n overflow: hidden;\n background: #0b1020;\n font-family: Inter, sans-serif;\n }\n\n /* The camera. `perspective` is the focal length and is solved from\n the dolly distance every frame -- see the script. */\n #dz-stage {\n position: absolute;\n inset: 0;\n perspective-origin: 50% 50%;\n }\n\n /* The rig root. Carries the camera's z offset so the subject plane\n always sits exactly `d` in front of the camera. */\n #dz-rig {\n position: absolute;\n inset: 0;\n transform-style: preserve-3d;\n }\n\n /* --- authored depth layers ------------------------------------ */\n\n .dz-arch {\n position: absolute;\n left: -140px;\n top: -80px;\n width: 2200px;\n height: 1240px;\n border: 16px solid #465280;\n border-radius: 8px;\n transform-style: preserve-3d;\n }\n\n #dz-backwall {\n position: absolute;\n left: -3040px;\n top: -1710px;\n width: 8000px;\n height: 4500px;\n background: #10162c;\n transform-style: preserve-3d;\n }\n\n /* Bright doorway on the back wall -- the layer whose on-screen size\n changes while the subject's does not. */\n #dz-portal {\n position: absolute;\n left: 3300px;\n top: 1850px;\n width: 1400px;\n height: 1500px;\n background: #cfe4ff;\n }\n\n /* --- the subject: z = 0, the plane the solve holds ------------- */\n\n #dz-subject {\n position: absolute;\n left: 840px;\n top: 300px;\n width: 240px;\n height: 620px;\n transform-style: preserve-3d;\n }\n .dz-fig-head {\n width: 120px;\n height: 120px;\n margin: 0 auto;\n border-radius: 50%;\n background: #f2b134;\n }\n .dz-fig-body {\n width: 240px;\n height: 470px;\n margin-top: 30px;\n border-radius: 120px 120px 10px 10px;\n background: #f2b134;\n }\n\n /* --- flat overlay (outside the 3D rig) ------------------------- */\n\n .dz-label {\n position: absolute;\n left: 64px;\n bottom: 56px;\n padding: 14px 22px;\n border-radius: 8px;\n background: #0b1020;\n color: #e9eeff;\n font-size: 26px;\n letter-spacing: 0.14em;\n text-transform: uppercase;\n }\n </style>\n\n <div id=\"dz-stage\" class=\"clip\" data-start=\"0\" data-duration=\"4\" data-track-index=\"0\">\n <div id=\"dz-rig\">\n <div id=\"dz-backwall\" data-layout-allow-overflow style=\"transform: translateZ(-3200px)\">\n <div id=\"dz-portal\"></div>\n </div>\n\n <div\n class=\"dz-arch\"\n data-layout-allow-overflow\n style=\"transform: translateZ(-2360px); border-color: #384166\"\n ></div>\n <div\n class=\"dz-arch\"\n data-layout-allow-overflow\n style=\"transform: translateZ(-1720px); border-color: #465280\"\n ></div>\n <div\n class=\"dz-arch\"\n data-layout-allow-overflow\n style=\"transform: translateZ(-1120px); border-color: #57669c\"\n ></div>\n <div\n class=\"dz-arch\"\n data-layout-allow-overflow\n style=\"transform: translateZ(-560px); border-color: #6b7cb8\"\n ></div>\n <div\n class=\"dz-arch\"\n data-layout-allow-overflow\n style=\"transform: translateZ(0px); border-color: #8194d4\"\n ></div>\n\n <div id=\"dz-subject\" style=\"transform: translateZ(0px)\">\n <div class=\"dz-fig-head\"></div>\n <div class=\"dz-fig-body\"></div>\n </div>\n </div>\n </div>\n\n <div class=\"dz-label\">Dolly zoom &middot; d &times; tan(fov/2) = const</div>\n </div>\n\n <script>\n window.__timelines = window.__timelines || {};\n\n (function () {\n var DEFAULTS = {\n direction: \"out\",\n strength: 2,\n subjectDistance: 1400,\n easing: \"power2.inOut\",\n };\n var declared =\n window.__hyperframes && window.__hyperframes.getVariables\n ? window.__hyperframes.getVariables()\n : {};\n var vars = Object.assign({}, DEFAULTS, declared);\n\n function clamp(value, lo, hi, fallback) {\n var n = Number(value);\n if (!isFinite(n)) return fallback;\n return Math.min(hi, Math.max(lo, n));\n }\n function oneOf(value, allowed, fallback) {\n return allowed.indexOf(String(value)) >= 0 ? String(value) : fallback;\n }\n\n var direction = oneOf(vars.direction, [\"in\", \"out\"], DEFAULTS.direction);\n var strength = clamp(vars.strength, 1.1, 4, DEFAULTS.strength);\n var ease = oneOf(\n vars.easing,\n [\"none\", \"sine.inOut\", \"power1.inOut\", \"power2.inOut\", \"power3.inOut\"],\n DEFAULTS.easing,\n );\n\n // d0 = camera-to-subject distance at the start of the move (px).\n // d1 = distance at the end. \"out\" pulls the camera back and zooms in;\n // \"in\" pushes the camera forward and zooms out.\n var d0 = clamp(vars.subjectDistance, 600, 3000, DEFAULTS.subjectDistance);\n var d1 = direction === \"in\" ? d0 / strength : d0 * strength;\n\n // ---- the solve --------------------------------------------------\n // Subject size is fixed iff d * tan(FOV/2) = const. With CSS 3D,\n // tan(FOV/2) = (width/2) / perspective, so that invariant is exactly\n // perspective / distance = SUBJECT_SCALE. Focal length is therefore\n // derived from the dolly, never animated alongside it.\n var SUBJECT_SCALE = 1; // subject renders 1:1 => its plane is z = 0\n\n var stage = document.getElementById(\"dz-stage\");\n var rig = document.getElementById(\"dz-rig\");\n\n function applyCamera(u) {\n var d = d0 + (d1 - d0) * u; // dolly -- pure function of u\n var P = SUBJECT_SCALE * d; // focal length solved from d\n var camZ = P - d; // put the subject plane at camera distance d\n stage.style.perspective = P + \"px\";\n rig.style.transform = \"translateZ(\" + camZ + \"px)\";\n }\n\n // GSAP suppresses timeline-level onUpdate during seek(), so the camera\n // is driven by a property setter on the tweened object instead: that\n // fires on every render, seeks included.\n var camera = {\n _u: 0,\n get u() {\n return this._u;\n },\n set u(value) {\n this._u = value;\n applyCamera(value);\n },\n };\n\n applyCamera(0);\n\n var tl = gsap.timeline({ paused: true });\n tl.to(camera, { u: 1, duration: 4, ease: ease }, 0);\n window.__timelines[\"camera-dolly-zoom\"] = tl;\n })();\n </script>\n </body>\n</html>\n"}