Skip to content

Write HTML. Render video. Built for agents.

6.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>RGB Glitch Text - 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: #09090b;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .demo-frame {\n        display: grid;\n        place-items: center;\n        gap: 32px;\n        padding: 64px;\n        zoom: 0.28;\n      }\n      /* ponytail: scale-up via font-size — GSAP only touches CSS vars, not transform */\n      .hf-catalog-rgb-glitch-text {\n        color: #fafafa;\n        font-family: Inter, system-ui, sans-serif;\n        font-weight: 900;\n        letter-spacing: -0.04em;\n      }\n      .hf-catalog-rgb-glitch-text {\n        position: relative;\n        width: 1120px;\n        height: 200px;\n        font-size: 192px;\n        line-height: 1;\n      }\n      .hf-catalog-rgb-glitch-text span,\n      .hf-catalog-rgb-glitch-text strong {\n        position: absolute;\n        inset: 0;\n      }\n      .hf-catalog-rgb-glitch-text span:first-child {\n        color: #ef4444;\n        mix-blend-mode: screen;\n        transform: translateX(var(--hf-glitch-red, 0px));\n      }\n      .hf-catalog-rgb-glitch-text span:nth-child(2) {\n        color: #22d3ee;\n        mix-blend-mode: screen;\n        transform: translateX(var(--hf-glitch-blue, 0px));\n      }\n      .hf-catalog-rgb-glitch-text strong {\n        color: #fafafa;\n      }\n      .demo-label {\n        font-size: 24px;\n        font-weight: 500;\n        color: #52525b;\n        letter-spacing: 0.12em;\n        text-transform: uppercase;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"rgb-glitch-text-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\n          class=\"hf-catalog-rgb-glitch-text\"\n          data-composition-variables='[\n    { \"id\": \"text\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Text\", \"description\": \"The word shown on all three stacked copies.\", \"default\": \"GLITCH\", \"maxLength\": 24 },\n    { \"id\": \"intensity\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Intensity\", \"description\": \"Scales the red and cyan offsets the timeline drives, so the split reads as a hairline or a hard tear.\", \"default\": \"standard\", \"options\": [{ \"value\": \"subtle\", \"label\": \"Subtle\" }, { \"value\": \"standard\", \"label\": \"Standard\" }, { \"value\": \"extreme\", \"label\": \"Extreme\" }] },\n    { \"id\": \"tone\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tone\", \"description\": \"Colour of the solid copy the two ghosts split away from: 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>GLITCH</span><span>GLITCH</span><strong>GLITCH</strong>\n        </div>\n        <div class=\"demo-label\">RGB Glitch Text</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 reaches = { subtle: 0.5, standard: 1, extreme: 2.25 };\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 reach = reaches[pick(reaches, vars.intensity, \"standard\")];\n          var tone = tones[pick(tones, vars.tone, \"ink\")];\n          var text =\n            typeof vars.text === \"string\" && vars.text.trim() !== \"\" ? vars.text.trim() : \"GLITCH\";\n\n          var roots = document.querySelectorAll(\".hf-catalog-rgb-glitch-text\");\n          for (var i = 0; i < roots.length; i += 1) {\n            roots[i].style.setProperty(\"--hf-glitch-reach\", String(reach));\n            roots[i].style.setProperty(\"--hf-glitch-ink\", tone);\n            var copies = roots[i].querySelectorAll(\"span, strong\");\n            for (var j = 0; j < copies.length; j += 1) {\n              copies[j].textContent = text;\n            }\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        const startTime = 0.5;\n        tl.to(\".hf-catalog-rgb-glitch-text\", { opacity: 1, duration: 0.01 }, startTime);\n        tl.to(\n          \".hf-catalog-rgb-glitch-text\",\n          {\n            \"--hf-glitch-red\": \"-20px\",\n            \"--hf-glitch-blue\": \"20px\",\n            duration: 0.06,\n            repeat: 5,\n            yoyo: true,\n            ease: \"steps(1)\",\n          },\n          startTime + 0.1,\n        );\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"rgb-glitch-text-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-catalog-rgb-glitch-text {\n        color: var(--hf-glitch-ink, #18181b);\n        font-family: Inter, system-ui, sans-serif;\n        font-weight: 900;\n        letter-spacing: -0.04em;\n      }\n      .hf-catalog-rgb-glitch-text {\n        position: relative;\n        width: 420px;\n        height: 82px;\n        font-size: 72px;\n        line-height: 1;\n      }\n      .hf-catalog-rgb-glitch-text span,\n      .hf-catalog-rgb-glitch-text strong {\n        position: absolute;\n        inset: 0;\n      }\n      .hf-catalog-rgb-glitch-text span:first-child {\n        color: #ef4444;\n        transform: translateX(calc(var(--hf-glitch-red, 0px) * var(--hf-glitch-reach, 1)));\n      }\n      .hf-catalog-rgb-glitch-text span:nth-child(2) {\n        color: #22d3ee;\n        transform: translateX(calc(var(--hf-glitch-blue, 0px) * var(--hf-glitch-reach, 1)));\n      }\n      .hf-catalog-rgb-glitch-text strong {\n        color: var(--hf-glitch-ink, #18181b);\n      }\n    </style>\n  </body>\n</html>\n"}