Skip to content

Write HTML. Render video. Built for agents.

7.0 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>Strikethrough Replace - 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: #f7f7f8;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .demo-frame {\n        display: grid;\n        place-items: center;\n        min-width: 900px;\n        min-height: 500px;\n        padding: 64px;\n        /* ponytail: scale non-GSAP wrapper; GSAP targets are children */\n        transform: scale(2.8);\n      }\n      .hf-catalog-strikethrough-replace {\n        color: #18181b;\n        font-family: Inter, system-ui, sans-serif;\n        font-weight: 900;\n        letter-spacing: -0.04em;\n      }\n      .hf-catalog-strikethrough-replace {\n        position: relative;\n        display: inline-grid;\n        grid-auto-flow: column;\n        gap: 18px;\n        align-items: center;\n        font-size: 58px;\n      }\n      .hf-catalog-strikethrough-replace i {\n        position: absolute;\n        left: 0;\n        width: 48%;\n        height: 6px;\n        border-radius: 999px;\n        background: #ef4444;\n        transform: scaleX(var(--hf-strike-progress, 1));\n        transform-origin: left center;\n      }\n      .hf-catalog-strikethrough-replace strong {\n        opacity: var(--hf-replace-opacity, 1);\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"strikethrough-replace-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-strikethrough-replace\"\n          data-composition-variables='[\n    { \"id\": \"origin\", \"type\": \"enum\", \"role\": \"motion\", \"label\": \"Origin\", \"description\": \"Edge the strike grows out of as the timeline runs its scale from 0 to 1.\", \"default\": \"left\", \"options\": [{ \"value\": \"left\", \"label\": \"Left\" }, { \"value\": \"center\", \"label\": \"Center\" }, { \"value\": \"right\", \"label\": \"Right\" }] },\n    { \"id\": \"thickness\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Thickness\", \"description\": \"Height of the strike line, from a hairline rule to a heavy bar.\", \"default\": \"standard\", \"options\": [{ \"value\": \"thin\", \"label\": \"Thin\" }, { \"value\": \"standard\", \"label\": \"Standard\" }, { \"value\": \"thick\", \"label\": \"Thick\" }] },\n    { \"id\": \"tint\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tint\", \"description\": \"Strike colour. Blue and violet ride --accent and --accent-2.\", \"default\": \"red\", \"options\": [{ \"value\": \"red\", \"label\": \"Red\" }, { \"value\": \"amber\", \"label\": \"Amber\" }, { \"value\": \"blue\", \"label\": \"Blue\" }, { \"value\": \"violet\", \"label\": \"Violet\" }] },\n    { \"id\": \"tone\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Tone\", \"description\": \"Colour of both words: ink for light frames, paper for dark ones.\", \"default\": \"ink\", \"options\": [{ \"value\": \"ink\", \"label\": \"Ink\" }, { \"value\": \"paper\", \"label\": \"Paper\" }] }\n  ]'\n        >\n          <span>Slow</span><i></i><strong>Fast</strong>\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 origins = { left: \"left center\", center: \"center\", right: \"right center\" };\n          var thicknesses = { thin: \"3px\", standard: \"6px\", thick: \"10px\" };\n          var tints = {\n            red: \"#ef4444\",\n            amber: \"#f59e0b\",\n            blue: \"var(--accent, #38bdf8)\",\n            violet: \"var(--accent-2, #a78bfa)\",\n          };\n          var tones = { ink: \"#18181b\", paper: \"#fafafa\" };\n\n          function pick(table, value, fallback) {\n            return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;\n          }\n\n          var origin = origins[pick(origins, vars.origin, \"left\")];\n          var thickness = thicknesses[pick(thicknesses, vars.thickness, \"standard\")];\n          var tint = tints[pick(tints, vars.tint, \"red\")];\n          var tone = tones[pick(tones, vars.tone, \"ink\")];\n\n          var roots = document.querySelectorAll(\".hf-catalog-strikethrough-replace\");\n          for (var i = 0; i < roots.length; i += 1) {\n            roots[i].style.setProperty(\"--hf-strike-origin\", origin);\n            roots[i].style.setProperty(\"--hf-strike-thickness\", thickness);\n            roots[i].style.setProperty(\"--hf-strike-color\", tint);\n            roots[i].style.setProperty(\"--hf-strike-text-color\", tone);\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        const startTime = 0.5;\n        tl.fromTo(\n          \".hf-catalog-strikethrough-replace i\",\n          { \"--hf-strike-progress\": 0 },\n          { \"--hf-strike-progress\": 1, duration: 0.28, ease: \"power2.out\" },\n          startTime,\n        );\n        tl.fromTo(\n          \".hf-catalog-strikethrough-replace strong\",\n          { \"--hf-replace-opacity\": 0, y: 14 },\n          { \"--hf-replace-opacity\": 1, y: 0, duration: 0.3, ease: \"power2.out\" },\n          startTime + 0.24,\n        );\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"strikethrough-replace-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-catalog-strikethrough-replace {\n        color: var(--hf-strike-text-color, #18181b);\n        font-family: Inter, system-ui, sans-serif;\n        font-weight: 900;\n        letter-spacing: -0.04em;\n      }\n      .hf-catalog-strikethrough-replace {\n        position: relative;\n        display: inline-grid;\n        grid-auto-flow: column;\n        gap: 18px;\n        align-items: center;\n        font-size: 58px;\n      }\n      .hf-catalog-strikethrough-replace i {\n        position: absolute;\n        left: 0;\n        width: 48%;\n        height: var(--hf-strike-thickness, 6px);\n        border-radius: 999px;\n        background: var(--hf-strike-color, #ef4444);\n        transform: scaleX(var(--hf-strike-progress, 1));\n        transform-origin: var(--hf-strike-origin, left center);\n      }\n      .hf-catalog-strikethrough-replace strong {\n        opacity: var(--hf-replace-opacity, 1);\n      }\n    </style>\n  </body>\n</html>\n"}