Skip to content

Write HTML. Render video. Built for agents.

11.7 KB
Raw Blame
{"html":"<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=1920, height=1080\" />\n    <title>Shared Axis Z - Demo</title>\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      * {\n        box-sizing: border-box;\n      }\n      html,\n      body {\n        margin: 0;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n      }\n      #demo {\n        width: 1920px;\n        height: 1080px;\n        display: grid;\n        place-items: center;\n        background: #f4f4f5;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      /* ponytail: demo-frame is not a GSAP target — CSS transform is safe */\n      .demo-frame {\n        position: relative;\n        width: 720px;\n        height: 480px;\n        transform: scale(1.6);\n      }\n      /* Shared container that clips both panels */\n      .axis-z-stage {\n        position: relative;\n        width: 720px;\n        height: 480px;\n        border-radius: 16px;\n        overflow: hidden;\n        box-shadow:\n          0 32px 80px rgba(0, 0, 0, 0.12),\n          0 2px 8px rgba(0, 0, 0, 0.06);\n        border: 1px solid #e4e4e7;\n        background: #ffffff;\n      }\n      /* Outgoing panel (zooms out + fades) */\n      .axis-z-outgoing {\n        position: absolute;\n        inset: 0;\n        display: flex;\n        flex-direction: column;\n        align-items: center;\n        justify-content: center;\n        gap: 14px;\n        background: #ffffff;\n        will-change: transform, opacity;\n      }\n      .axis-z-outgoing-icon {\n        width: 52px;\n        height: 52px;\n        border-radius: 12px;\n        background: #18181b;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n      }\n      .axis-z-outgoing-icon svg {\n        width: 26px;\n        height: 26px;\n        fill: none;\n        stroke: #ffffff;\n        stroke-width: 2;\n        stroke-linecap: round;\n        stroke-linejoin: round;\n      }\n      .axis-z-outgoing-title {\n        font-size: 18px;\n        font-weight: 600;\n        color: #18181b;\n        letter-spacing: -0.02em;\n      }\n      .axis-z-outgoing-subtitle {\n        font-size: 13px;\n        font-weight: 400;\n        color: #71717a;\n      }\n      .axis-z-outgoing-row {\n        display: flex;\n        gap: 8px;\n        margin-top: 4px;\n      }\n      .axis-z-chip {\n        padding: 5px 12px;\n        border-radius: 999px;\n        background: #f4f4f5;\n        border: 1px solid #e4e4e7;\n        font-size: 12px;\n        font-weight: 500;\n        color: #52525b;\n      }\n      /* Incoming panel (the component output — zooms in from small) */\n      .axis-z-incoming {\n        position: absolute;\n        inset: 0;\n        display: flex;\n        flex-direction: column;\n        padding: 40px;\n        gap: 24px;\n        background: #ffffff;\n        will-change: transform, opacity;\n      }\n      .axis-z-incoming-header {\n        display: flex;\n        flex-direction: column;\n        gap: 6px;\n      }\n      .axis-z-incoming-eyebrow {\n        font-size: 11px;\n        font-weight: 600;\n        letter-spacing: 0.08em;\n        text-transform: uppercase;\n        color: #71717a;\n      }\n      /* GSAP animates .hf-catalog-shared-axis-z span — must keep class + span structure */\n      .hf-catalog-shared-axis-z {\n        display: inline-flex;\n        gap: 10px;\n        font-size: 36px;\n        font-weight: 800;\n        letter-spacing: -0.04em;\n        line-height: 1;\n        color: #18181b;\n      }\n      .hf-catalog-shared-axis-z span {\n        display: inline-block;\n        transform: translate(var(--hf-word-x, 0px), var(--hf-word-y, 0px))\n          scale(var(--hf-word-scale, 1));\n        filter: blur(var(--hf-word-blur, 0px));\n        will-change: transform, filter, opacity;\n      }\n      .axis-z-incoming-meta {\n        font-size: 13px;\n        color: #71717a;\n        font-weight: 400;\n        line-height: 1.5;\n        max-width: 400px;\n      }\n      .axis-z-incoming-stats {\n        display: flex;\n        gap: 16px;\n        margin-top: auto;\n      }\n      .axis-z-stat {\n        display: flex;\n        flex-direction: column;\n        gap: 3px;\n        padding: 16px 20px;\n        background: #fafafa;\n        border: 1px solid #e4e4e7;\n        border-radius: 10px;\n        flex: 1;\n      }\n      .axis-z-stat-value {\n        font-size: 22px;\n        font-weight: 700;\n        color: #18181b;\n        letter-spacing: -0.03em;\n      }\n      .axis-z-stat-label {\n        font-size: 11px;\n        font-weight: 500;\n        color: #71717a;\n        text-transform: uppercase;\n        letter-spacing: 0.06em;\n      }\n      .axis-z-divider {\n        width: 100%;\n        height: 1px;\n        background: #e4e4e7;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"shared-axis-z-demo\"\n      data-start=\"0\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n      data-duration=\"5\"\n    >\n      <div class=\"demo-frame\">\n        <div class=\"axis-z-stage\">\n          <!-- Outgoing view: zooms out + fades as incoming arrives -->\n          <div class=\"axis-z-outgoing\">\n            <div class=\"axis-z-outgoing-icon\">\n              <svg viewBox=\"0 0 24 24\">\n                <rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\" />\n                <rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\" />\n                <rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\" />\n                <rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\" />\n              </svg>\n            </div>\n            <div class=\"axis-z-outgoing-title\">Overview</div>\n            <div class=\"axis-z-outgoing-subtitle\">Select a context to zoom in</div>\n            <div class=\"axis-z-outgoing-row\">\n              <div class=\"axis-z-chip\">Analytics</div>\n              <div class=\"axis-z-chip\">Reports</div>\n              <div class=\"axis-z-chip\">Settings</div>\n            </div>\n          </div>\n\n          <!-- Incoming view: zooms in from center (shared-axis-Z) -->\n          <div class=\"axis-z-incoming\">\n            <div class=\"axis-z-incoming-header\">\n              <div class=\"axis-z-incoming-eyebrow\">Analytics</div>\n              <div\n                class=\"hf-catalog-shared-axis-z\"\n                data-composition-variables='[\n    { \"id\": \"direction\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Direction\", \"description\": \"Which way the words travel along the z axis: in swells up from small, out settles down from large.\", \"default\": \"in\", \"options\": [{ \"value\": \"in\", \"label\": \"In\" }, { \"value\": \"out\", \"label\": \"Out\" }] },\n    { \"id\": \"depth\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Depth\", \"description\": \"Scales how far the words start from their final size, so the push covers a shorter or longer run in the same time.\", \"default\": \"standard\", \"options\": [{ \"value\": \"shallow\", \"label\": \"Shallow\" }, { \"value\": \"standard\", \"label\": \"Standard\" }, { \"value\": \"deep\", \"label\": \"Deep\" }] },\n    { \"id\": \"tone\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tone\", \"description\": \"Word colour: ink for light frames, paper for dark ones, accent rides --brand.\", \"default\": \"ink\", \"options\": [{ \"value\": \"ink\", \"label\": \"Ink\" }, { \"value\": \"paper\", \"label\": \"Paper\" }, { \"value\": \"accent\", \"label\": \"Accent\" }] }\n  ]'\n              >\n                <span>Zoom</span><span>context</span>\n              </div>\n              <div class=\"axis-z-incoming-meta\">\n                Drill into any metric with a shared-axis Z transition — the new view scales in from\n                the tap point.\n              </div>\n            </div>\n            <div class=\"axis-z-divider\"></div>\n            <div class=\"axis-z-incoming-stats\">\n              <div class=\"axis-z-stat\">\n                <div class=\"axis-z-stat-value\">24.8k</div>\n                <div class=\"axis-z-stat-label\">Sessions</div>\n              </div>\n              <div class=\"axis-z-stat\">\n                <div class=\"axis-z-stat-value\">3.4s</div>\n                <div class=\"axis-z-stat-label\">Avg. time</div>\n              </div>\n              <div class=\"axis-z-stat\">\n                <div class=\"axis-z-stat-value\">91%</div>\n                <div class=\"axis-z-stat-label\">Retention</div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n      <script>\n        (function () {\n          \"use strict\";\n\n          var vars =\n            window.__hyperframes && window.__hyperframes.getVariables\n              ? window.__hyperframes.getVariables()\n              : {};\n\n          // Unrecognised overrides return to their declared defaults.\n          var signs = { in: 1, out: -1 };\n          var reaches = { shallow: 0.5, standard: 1, deep: 1.85 };\n          var tones = {\n            ink: \"#18181b\",\n            paper: \"#fafafa\",\n            accent: \"var(--brand, #34d399)\",\n          };\n\n          function pick(table, value, fallback) {\n            return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;\n          }\n\n          var sign = signs[pick(signs, vars.direction, \"in\")];\n          var reach = reaches[pick(reaches, vars.depth, \"standard\")];\n          var tone = tones[pick(tones, vars.tone, \"ink\")];\n\n          var roots = document.querySelectorAll(\".hf-catalog-shared-axis-z\");\n          for (var i = 0; i < roots.length; i += 1) {\n            roots[i].style.setProperty(\"--hf-word-depth\", String(sign * reach));\n            roots[i].style.setProperty(\"--hf-word-color\", tone);\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        const startTime = 0.5;\n\n        // Outgoing panel: zoom out + fade (shared-axis Z departure)\n        tl.fromTo(\n          \".axis-z-outgoing\",\n          { opacity: 1, scale: 1 },\n          { opacity: 0, scale: 1.18, duration: 0.4, ease: \"power2.in\" },\n          startTime,\n        );\n\n        // Incoming panel: zoom in from small + fade (shared-axis Z arrival)\n        tl.fromTo(\n          \".axis-z-incoming\",\n          { opacity: 0, scale: 0.82 },\n          { opacity: 1, scale: 1, duration: 0.45, ease: \"expo.out\" },\n          startTime + 0.05,\n        );\n\n        // Word-by-word reveal on the title\n        tl.fromTo(\n          \".hf-catalog-shared-axis-z span\",\n          { opacity: 0, \"--hf-word-scale\": 0.72 },\n          {\n            opacity: 1,\n            \"--hf-word-scale\": 1,\n            duration: 0.34,\n            stagger: 0.06,\n            ease: \"back.out(1.8)\",\n          },\n          startTime + 0.28,\n        );\n\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"shared-axis-z-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-catalog-shared-axis-z {\n        color: var(--hf-word-color, #18181b);\n        font-family: Inter, system-ui, sans-serif;\n        font-weight: 900;\n        letter-spacing: -0.04em;\n      }\n      .hf-catalog-shared-axis-z {\n        display: inline-flex;\n        gap: 12px;\n        font-size: 56px;\n        line-height: 1;\n      }\n      .hf-catalog-shared-axis-z span {\n        display: inline-block;\n        transform: translate(var(--hf-word-x, 0px), var(--hf-word-y, 0px))\n          scale(calc(1 + (var(--hf-word-scale, 1) - 1) * var(--hf-word-depth, 1)));\n        filter: blur(var(--hf-word-blur, 0px));\n        will-change: transform, filter, opacity;\n      }\n    </style>\n  </body>\n</html>\n"}