Skip to content

Write HTML. Render video. Built for agents.

6.6 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>Inline Highlight - 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: #f5f5f4;\n        color: #18181b;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .copy {\n        width: 1200px;\n        font-size: 88px;\n        line-height: 1.14;\n        font-weight: 800;\n        letter-spacing: -0.025em;\n        text-align: left;\n      }\n      .hf-inline-highlight {\n        --hf-highlight-scale: 0;\n        --hf-highlight-color: #facc15;\n        position: relative;\n        display: inline;\n        isolation: isolate;\n      }\n      .hf-inline-highlight::after {\n        content: \"\";\n        position: absolute;\n        left: -0.05em;\n        right: -0.05em;\n        bottom: 0.06em;\n        height: 0.35em;\n        background: var(--hf-highlight-color);\n        border-radius: 3px;\n        transform: scaleX(var(--hf-highlight-scale));\n        transform-origin: left center;\n        z-index: -1;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"inline-highlight-demo\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n      data-duration=\"4\"\n      data-composition-variables='[\n    { \"id\": \"tint\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tint\", \"description\": \"Marker colour. Green, blue and violet ride --brand, --accent and --accent-2.\", \"default\": \"yellow\", \"options\": [{ \"value\": \"yellow\", \"label\": \"Yellow\" }, { \"value\": \"green\", \"label\": \"Green\" }, { \"value\": \"blue\", \"label\": \"Blue\" }, { \"value\": \"violet\", \"label\": \"Violet\" }] },\n    { \"id\": \"thickness\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Thickness\", \"description\": \"Height of the marker band behind the text, as a share of the font size.\", \"default\": \"standard\", \"options\": [{ \"value\": \"thin\", \"label\": \"Thin\" }, { \"value\": \"standard\", \"label\": \"Standard\" }, { \"value\": \"thick\", \"label\": \"Thick\" }] },\n    { \"id\": \"origin\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Origin\", \"description\": \"Edge the marker grows out of as the scale variable runs from 0 to 1.\", \"default\": \"left\", \"options\": [{ \"value\": \"left\", \"label\": \"Left\" }, { \"value\": \"right\", \"label\": \"Right\" }, { \"value\": \"center\", \"label\": \"Center\" }] }\n  ]'\n    >\n      <div class=\"copy\">\n        Turn the important words into\n        <span class=\"hf-inline-highlight\">animated emphasis</span> without rebuilding the scene.\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          function pick(table, value, fallback) {\n            return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;\n          }\n\n          var tints = {\n            yellow: \"#fff06a\",\n            green: \"var(--brand, #34d399)\",\n            blue: \"var(--accent, #38bdf8)\",\n            violet: \"var(--accent-2, #a78bfa)\",\n          };\n          var heights = { thin: \"0.22em\", standard: \"0.38em\", thick: \"0.62em\" };\n          var origins = { left: \"left center\", right: \"right center\", center: \"center\" };\n\n          var root = document.documentElement;\n          root.style.setProperty(\"--hf-highlight-color\", tints[pick(tints, vars.tint, \"yellow\")]);\n          root.style.setProperty(\n            \"--hf-highlight-height\",\n            heights[pick(heights, vars.thickness, \"standard\")],\n          );\n          root.style.setProperty(\n            \"--hf-highlight-origin\",\n            origins[pick(origins, vars.origin, \"left\")],\n          );\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        tl.from(\".copy\", { opacity: 0, y: 24, duration: 0.55, ease: \"power3.out\" }, 0.3);\n        tl.to(\n          \".hf-inline-highlight\",\n          { \"--hf-highlight-scale\": 1, duration: 0.6, ease: \"power2.out\" },\n          0.95,\n        );\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"inline-highlight-demo\"] = tl;\n      </script>\n    </div>\n    <style\n      data-composition-variables='[\n    { \"id\": \"tint\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tint\", \"description\": \"Marker colour. Green, blue and violet ride --brand, --accent and --accent-2.\", \"default\": \"yellow\", \"options\": [{ \"value\": \"yellow\", \"label\": \"Yellow\" }, { \"value\": \"green\", \"label\": \"Green\" }, { \"value\": \"blue\", \"label\": \"Blue\" }, { \"value\": \"violet\", \"label\": \"Violet\" }] },\n    { \"id\": \"thickness\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Thickness\", \"description\": \"Height of the marker band behind the text, as a share of the font size.\", \"default\": \"standard\", \"options\": [{ \"value\": \"thin\", \"label\": \"Thin\" }, { \"value\": \"standard\", \"label\": \"Standard\" }, { \"value\": \"thick\", \"label\": \"Thick\" }] },\n    { \"id\": \"origin\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Origin\", \"description\": \"Edge the marker grows out of as the scale variable runs from 0 to 1.\", \"default\": \"left\", \"options\": [{ \"value\": \"left\", \"label\": \"Left\" }, { \"value\": \"right\", \"label\": \"Right\" }, { \"value\": \"center\", \"label\": \"Center\" }] }\n  ]'\n    >\n      .hf-inline-highlight {\n        --hf-highlight-scale: 0;\n        position: relative;\n        display: inline;\n        z-index: 0;\n      }\n      .hf-inline-highlight::after {\n        content: \"\";\n        position: absolute;\n        left: -0.08em;\n        right: -0.08em;\n        bottom: 0.05em;\n        height: var(--hf-highlight-height, 0.38em);\n        background: var(--hf-highlight-color, #fff06a);\n        transform: scaleX(var(--hf-highlight-scale));\n        transform-origin: var(--hf-highlight-origin, left center);\n        z-index: -1;\n      }\n    </style>\n  </body>\n</html>\n"}