Skip to content

Write HTML. Render video. Built for agents.

7.3 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>Matrix Decode - 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: scale on wrapper (not a GSAP target), zooms content ~3× for thumbnail legibility */\n      .demo-frame {\n        display: grid;\n        place-items: center;\n        gap: 32px;\n        padding: 72px 96px;\n        background: #18181b;\n        border-radius: 20px;\n        box-shadow: 0 32px 80px rgba(0, 0, 0, 0.22);\n        transform: scale(3.2);\n        transform-origin: center center;\n      }\n      .demo-label {\n        font-size: 13px;\n        font-weight: 500;\n        letter-spacing: 0.12em;\n        text-transform: uppercase;\n        color: #71717a;\n      }\n      .hf-catalog-matrix-decode {\n        display: inline-flex;\n        gap: 4px;\n        font:\n          700 52px/1 ui-monospace,\n          SFMono-Regular,\n          Menlo,\n          monospace;\n        color: #4ade80;\n        text-shadow: 0 0 24px rgba(74, 222, 128, 0.45);\n      }\n      .hf-catalog-matrix-decode span {\n        display: inline-block;\n        min-width: 0.64em;\n        opacity: var(--hf-matrix-opacity, 1);\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"matrix-decode-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=\"demo-label\">Matrix Decode</div>\n        <div\n          class=\"hf-catalog-matrix-decode\"\n          data-final=\"HYPERFRAMES\"\n          data-composition-variables='[\n    { \"id\": \"text\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Target text\", \"description\": \"Word the scramble resolves into. One scrambling cell per character, up to 32.\", \"default\": \"HYPERFRAMES\" },\n    { \"id\": \"accent\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Accent\", \"description\": \"Colour family of the cells and their glow.\", \"default\": \"green\", \"options\": [{ \"value\": \"green\", \"label\": \"Green\" }, { \"value\": \"blue\", \"label\": \"Blue\" }, { \"value\": \"violet\", \"label\": \"Violet\" }] },\n    { \"id\": \"size\", \"type\": \"number\", \"role\": \"style\", \"label\": \"Size\", \"description\": \"Type size of the cells in pixels. Cell width follows it.\", \"default\": 64, \"min\": 24, \"max\": 160, \"step\": 4, \"unit\": \"px\" },\n    { \"id\": \"glow\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Glow\", \"description\": \"Strength of the halo behind the cells, from none to a heavy bloom.\", \"default\": \"standard\", \"options\": [{ \"value\": \"none\", \"label\": \"None\" }, { \"value\": \"standard\", \"label\": \"Standard\" }, { \"value\": \"strong\", \"label\": \"Strong\" }] }\n  ]'\n        >\n          <span>0</span><span>0</span><span>0</span><span>0</span><span>0</span><span>0</span\n          ><span>0</span><span>0</span><span>0</span><span>0</span>\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          // Anything missing or invalid returns to its declared default.\n          var accents = {\n            green: { color: \"#16a34a\", rgb: \"22, 163, 74\" },\n            blue: { color: \"#2563eb\", rgb: \"37, 99, 235\" },\n            violet: { color: \"#7c3aed\", rgb: \"124, 58, 237\" },\n          };\n          var glows = {\n            none: { radius: \"0px\", alpha: \"0\" },\n            standard: { radius: \"18px\", alpha: \"0.28\" },\n            strong: { radius: \"34px\", alpha: \"0.55\" },\n          };\n\n          function pick(table, value, fallback) {\n            return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;\n          }\n\n          var text = typeof vars.text === \"string\" ? vars.text.trim().slice(0, 32) : \"\";\n          if (!text) {\n            text = \"HYPERFRAMES\";\n          }\n\n          var size =\n            typeof vars.size === \"number\" || typeof vars.size === \"string\"\n              ? Number(vars.size)\n              : NaN;\n          size = isFinite(size) && size > 0 ? Math.min(160, Math.max(24, size)) : 64;\n\n          var accent = accents[pick(accents, vars.accent, \"green\")];\n          var glow = glows[pick(glows, vars.glow, \"standard\")];\n\n          var roots = document.querySelectorAll(\".hf-catalog-matrix-decode\");\n          for (var i = 0; i < roots.length; i += 1) {\n            roots[i].style.setProperty(\"--hf-matrix-size\", size + \"px\");\n            roots[i].style.setProperty(\"--hf-matrix-color\", accent.color);\n            roots[i].style.setProperty(\"--hf-matrix-glow-rgb\", accent.rgb);\n            roots[i].style.setProperty(\"--hf-matrix-glow-radius\", glow.radius);\n            roots[i].style.setProperty(\"--hf-matrix-glow-alpha\", glow.alpha);\n            roots[i].setAttribute(\"data-final\", text);\n            while (roots[i].firstChild) {\n              roots[i].removeChild(roots[i].firstChild);\n            }\n            for (var j = 0; j < text.length; j += 1) {\n              var cell = document.createElement(\"span\");\n              cell.textContent = text.charAt(j) === \" \" ? \"\\u00a0\" : \"0\";\n              roots[i].appendChild(cell);\n            }\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        const startTime = 0.5;\n        tl.fromTo(\n          \".hf-catalog-matrix-decode span\",\n          { opacity: 0, y: 12 },\n          { opacity: 1, y: 0, duration: 0.18, stagger: 0.035, ease: \"power2.out\" },\n          startTime,\n        );\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"matrix-decode-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-catalog-matrix-decode {\n        color: #18181b;\n        font-family: Inter, system-ui, sans-serif;\n        font-weight: 900;\n        letter-spacing: -0.04em;\n      }\n      .hf-catalog-matrix-decode {\n        display: inline-flex;\n        gap: 3px;\n        font:\n          900 64px/1 ui-monospace,\n          SFMono-Regular,\n          Menlo,\n          monospace;\n        font-size: var(--hf-matrix-size, 64px);\n        color: var(--hf-matrix-color, #16a34a);\n        text-shadow: 0 0 var(--hf-matrix-glow-radius, 18px)\n          rgba(var(--hf-matrix-glow-rgb, 22, 163, 74), var(--hf-matrix-glow-alpha, 0.28));\n      }\n      .hf-catalog-matrix-decode span {\n        display: inline-block;\n        min-width: 0.64em;\n        opacity: var(--hf-matrix-opacity, 1);\n      }\n    </style>\n  </body>\n</html>\n"}