Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
docs: simplify the Catalog overview with a section tour (#3240)
Miguel Ángel9b1232965201
diff --git a/docs/catalog/index.mdx b/docs/catalog/index.mdxindex 7d42c52931..ea72fdce98 100644--- a/docs/catalog/index.mdx+++ b/docs/catalog/index.mdx@@ -3,57 +3,67 @@ title: "Catalog"description: "Browse reusable HyperFrames scenes, transitions, captions, overlays, effects, and components."----The Catalog is a library of visuals you can add to a project instead of building each one from scratch.+import { CatalogOverviewPlayer } from "/snippets/catalog-overview-player.jsx"-Use a **block** when you want a larger scene or self-contained visual. Use a **component** when you want a smaller effect or behavior inside an existing scene.+The Catalog gives you reusable visuals you can add to a project instead of building each one from scratch.-## Start with the job+<CatalogOverviewPlayer title="A fast tour of every HyperFrames Catalog section">++```html catalog-overview-v3.html+<!doctype html>+<html>+ <head>+ <meta charset="utf-8" />+ <style>+ html, body {+ margin: 0;+ height: 100%;+ overflow: hidden;+ background: #05070b;+ }+ hyperframes-player {+ display: block;+ width: 100%;+ height: 100%;+ }+ </style>+ <script src="https://cdn.jsdelivr.net/npm/@hyperframes/[email protected]/dist/hyperframes-player.global.js"></script>+ </head>+ <body>+ <script type="module">+ const item = await fetch("/public/catalog/blocks/ai-chat-reveal.json").then((response) =>+ response.json(),+ );+ const player = document.createElement("hyperframes-player");+ player.setAttribute("srcdoc", item.html);+ player.setAttribute("controls", "");+ player.setAttribute("autoplay", "");+ player.setAttribute("muted", "");+ player.setAttribute("loop", "");+ document.body.appendChild(player);+ </script>+ </body>+</html>+```++</CatalogOverviewPlayer><CardGroup cols={2}>- <Card title="Code animations" icon="code" href="/catalog/blocks/code-typing">- Show code being typed, changed, highlighted, scrolled, or transformed.- </Card>- <Card title="Captions" icon="closed-captioning" href="/catalog/components/caption-highlight">- Keep speech readable or emphasize selected words without designing a caption system from zero.- </Card>- <Card title="Transitions" icon="arrows-left-right" href="/catalog/blocks/cinematic-zoom">- Move between scenes with a quiet cut treatment or a more expressive transition.- </Card>- <Card title="Social overlays" icon="share-nodes" href="/catalog/blocks/x-post">- Show posts, follow prompts, notifications, names, roles, and platform-inspired cards.+ <Card title="Blocks" icon="objects-column" href="/catalog/blocks/app-showcase">+ Start with a larger scene or self-contained visual.</Card>- <Card title="Data and diagrams" icon="chart-column" href="/catalog/blocks/data-chart">- Explain a number, comparison, trend, location, or geographic movement.- </Card>- <Card title="Complete scenes" icon="play" href="/catalog/blocks/app-showcase">- Start from a larger scene that already combines design, media, and animation.+ <Card title="Components" icon="puzzle-piece" href="/catalog/components/caption-kinetic-slam">+ Add a smaller effect or behavior inside an existing scene.</Card></CardGroup>-## Use an item in a real project+## Use an item1. Open an item and watch the motion preview.-2. Check that its communication job matches the scene.-3. Copy the plain-language request from the item page into your agent chat.-4. Replace the example content with real project content.-5. Match the project's type, color, spacing, and motion language.-6. Review the item inside the complete video, not only in isolation.--The terminal command and source details remain available on each item page for people who need them.--## Before you keep it--<Note>- A Catalog item is a starting point, not a finished design decision. Keep it only when it makes the scene clearer or faster to understand. Remove decorative motion that competes with the story.-</Note>--Check:+2. Copy its plain-language request into your agent chat.+3. Replace the example content, then review it inside your complete video.-- Can the viewer understand why the visual is present?-- Is the real content readable at the final size?-- Does its timing fit the scenes around it?-- Does it feel like part of this project rather than a pasted demo?-- Is a quieter alternative more effective?+The tour covers Code Animations, Captions, HTML-in-Canvas, Social Overlays, Lower Thirds, Shader Transitions, CSS Transitions, Showcases, Data, Effects, and Blocks.## Related topicsdiff --git a/docs/snippets/catalog-overview-player.jsx b/docs/snippets/catalog-overview-player.jsxnew file mode 100644index 0000000000..6866836e3f--- /dev/null+++ b/docs/snippets/catalog-overview-player.jsx@@ -0,0 +1,133 @@+export const CatalogOverviewPlayer = ({ title, children }) => {+ const [tab, setTab] = useState("preview");+ const [reduced, setReduced] = useState(+ () =>+ typeof window !== "undefined" &&+ typeof window.matchMedia === "function" &&+ window.matchMedia("(prefers-reduced-motion: reduce)").matches,+ );++ useEffect(() => {+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;++ const query = window.matchMedia("(prefers-reduced-motion: reduce)");+ const onChange = (event) => setReduced(event.matches);+ query.addEventListener("change", onChange);+ return () => query.removeEventListener("change", onChange);+ }, []);++ const localDocs =+ typeof window !== "undefined" &&+ (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");+ const catalogBase = localDocs+ ? "https://raw.githubusercontent.com/heygen-com/hyperframes/main/docs"+ : "";+ const assetBase = localDocs ? "https://hyperframes.heygen.com" : "";+ const scenes = JSON.stringify([+ {+ section: "Code Animations",+ catalog: "/public/catalog/blocks/code-particle-assemble.json",+ mediaStart: 1.7,+ },+ {+ section: "Captions",+ catalog: "/public/catalog/components/caption-camera-follow.json",+ mediaStart: 0.5,+ },+ {+ section: "HTML-in-Canvas",+ video:+ "https://static.heygen.ai/hyperframes-oss/docs/images/catalog/blocks/vfx-iphone-device.mp4",+ mediaStart: 9.25,+ },+ {+ section: "Social Overlays",+ catalog: "/public/catalog/blocks/editorial-flash-overlay.json",+ mediaStart: 0.35,+ },+ {+ section: "Lower Thirds",+ catalog: "/public/catalog/blocks/lower-third-bild.json",+ mediaStart: 0.5,+ },+ {+ section: "Shader Transitions",+ catalog: "/public/catalog/blocks/domain-warp-dissolve.json",+ mediaStart: 1.25,+ },+ {+ section: "CSS Transitions",+ catalog: "/public/catalog/blocks/transitions-grid.json",+ mediaStart: 4.3,+ },+ {+ section: "Showcases",+ catalog: "/public/catalog/blocks/ai-chat-reveal.json",+ mediaStart: 15.85,+ },+ {+ section: "Data",+ catalog: "/public/catalog/blocks/us-map-flow.json",+ mediaStart: 4,+ },+ {+ section: "Effects",+ catalog: "/public/catalog/components/parallax-unzoom.json",+ mediaStart: 1.6,+ },+ {+ section: "Blocks",+ catalog: "/public/catalog/blocks/hw-pipeline.json",+ mediaStart: 1.4,+ },+ ]).replace(/<\//g, "<\\/");+ const bootstrap = [+ "<!doctype html><html><head><meta charset='utf-8'>",+ "<style>html,body{margin:0;height:100%;overflow:hidden;background:#05070b}",+ "#stage,hyperframes-player{position:absolute;inset:0;display:block;width:100%;height:100%}",+ "#label{position:absolute;z-index:2;top:24px;left:24px;padding:10px 16px;border:1px solid rgba(255,255,255,.2);border-radius:999px;background:rgba(5,7,11,.82);color:#fff;font:700 18px/1.2 ui-sans-serif,system-ui,sans-serif;pointer-events:none}",+ "#error{position:absolute;z-index:3;inset:0;display:none;place-items:center;background:#05070b;color:#fff;font:600 18px ui-sans-serif,system-ui,sans-serif}</style>",+ '<script src="https://cdn.jsdelivr.net/npm/@hyperframes/[email protected]/dist/hyperframes-player.global.js"></' ++ "script>",+ `</head><body><div id="stage"></div><div id="label"></div><div id="error">Preview unavailable</div><script>var scenes=${scenes};var reduced=${JSON.stringify(reduced)};var catalogBase=${JSON.stringify(catalogBase)};var assetBase=${JSON.stringify(assetBase)};var current=0;var request=0;`,+ "function videoComposition(scene){return \"<!doctype html><html><head><meta charset='utf-8'><style>html,body{width:1920px;height:1080px;margin:0;overflow:hidden;background:#05070b}video{width:100%;height:100%;object-fit:cover}</style></head><body><main data-composition-id='catalog-video' data-start='0' data-duration='15' data-width='1920' data-height='1080'><video id='catalog-video-media' src='\"+scene.video+\"' data-start='0' data-duration='15' muted playsinline></video></main><script>window.__timelines=window.__timelines||{};var media=document.querySelector('video');window.__timelines['catalog-video']={duration:function(){return 15},time:function(){return media.currentTime},seek:function(t){media.currentTime=t;return this},play:function(){media.play();return this},pause:function(){media.pause();return this}};</\"+\"script></body></html>\"}",+ "async function compositionFor(scene){if(scene.catalog){var response=await fetch(catalogBase+scene.catalog);if(!response.ok)throw new Error('Catalog '+response.status);var html=(await response.json()).html;if(assetBase)html=html.replace('<head>','<head><base href=\"'+assetBase+'/\">');return html}return videoComposition(scene)}",+ "async function show(index){var token=++request;var scene=scenes[index];try{var html=await compositionFor(scene);if(token!==request)return;var player=document.createElement('hyperframes-player');player.setAttribute('srcdoc',html);player.setAttribute('controls','');player.setAttribute('muted','');player.addEventListener('ready',function(){player.seek(scene.mediaStart||0);if(!reduced)player.play()},{once:true});document.getElementById('stage').replaceChildren(player);document.getElementById('label').textContent=scene.section;document.getElementById('error').style.display='none'}catch(error){if(token===request){document.getElementById('label').textContent=scene.section;document.getElementById('error').style.display='grid'}}}",+ "show(0);if(!reduced)setInterval(function(){current=(current+1)%scenes.length;show(current)},2500);",+ "</" + "script></body></html>",+ ].join("");++ return (+ <div className="not-prose my-4">+ <div className="mb-3 inline-flex gap-1 rounded-full border border-zinc-200 bg-zinc-50 p-1 dark:border-zinc-800 dark:bg-zinc-950">+ {[+ ["preview", "Preview"],+ ["code", "HTML"],+ ].map(([id, label]) => (+ <button+ key={id}+ type="button"+ aria-pressed={tab === id}+ onClick={() => setTab(id)}+ className={`rounded-full px-3 py-1 text-xs font-medium ${+ tab === id+ ? "bg-zinc-900 text-white dark:bg-white dark:text-zinc-950"+ : "text-zinc-600 dark:text-zinc-300"+ }`}+ >+ {label}+ </button>+ ))}+ </div>++ <div hidden={tab !== "preview"}>+ <iframe+ srcDoc={bootstrap}+ className="block aspect-video w-full rounded-xl bg-zinc-950"+ title={title}+ />+ </div>+ <div hidden={tab !== "code"}>{children}</div>+ </div>+ );+};