Skip to content

Write HTML. Render video. Built for agents.

5.2 KB
Raw Blame
{"html":"<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      *,\n      *::before,\n      *::after {\n        margin: 0;\n        padding: 0;\n        box-sizing: border-box;\n      }\n      body {\n        background: transparent;\n        overflow: hidden;\n      }\n      #hw-st-root {\n        /* Warm marker accent, consistent with the rest of the hw family.\n           Override per use via CONFIG.color. */\n        --hw-accent: #ffb020;\n\n        position: relative;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: transparent;\n      }\n      #hw-st-svg {\n        position: absolute;\n        inset: 0;\n        width: 100%;\n        height: 100%;\n      }\n      #hw-st-svg path {\n        fill: none;\n        stroke: var(--hw-accent);\n        stroke-linecap: round;\n        stroke-linejoin: round;\n      }\n      /* solid backstop that guarantees full coverage at the midpoint */\n      #hw-st-solid {\n        position: absolute;\n        inset: 0;\n        background: var(--hw-accent);\n        opacity: 0;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"hw-st-root\"\n      data-composition-id=\"hw-scribble-transition\"\n      data-start=\"0\"\n      data-duration=\"2.2\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <svg id=\"hw-st-svg\" viewBox=\"0 0 1920 1080\" data-layout-allow-overflow></svg>\n      <div id=\"hw-st-solid\"></div>\n      <div\n        id=\"hw-st-drv\"\n        class=\"clip\"\n        data-start=\"0\"\n        data-duration=\"2.2\"\n        data-track-index=\"0\"\n        style=\"position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none\"\n      ></div>\n    </div>\n    <script>\n      (function () {\n        window.__timelines = window.__timelines || {};\n\n        /* ---- published parameters ----\n           Overlay-transition (the mk-clone-wall model): fat scribble strokes\n           sweep across and cover the frame, a solid backstop guarantees full\n           coverage at the midpoint (the host hard-cuts beneath, ~0.9-1.4s\n           local), then everything clears. Place spanning the host's cut. */\n        var CONFIG = {\n          color: null, // css color; null = --hw-accent (warm marker)\n          bands: 7, // horizontal scribble bands\n          strokeScale: 1.0,\n          seed: 17,\n        };\n\n        var W = 1920,\n          H = 1080,\n          DUR = 2.2;\n\n        window.hwHash = function (n, seed) {\n          var x = Math.sin(n * 127.1 + (seed || 1) * 311.7) * 43758.5453;\n          return (x - Math.floor(x)) * 2 - 1;\n        };\n\n        var root = document.getElementById(\"hw-st-root\");\n        if (CONFIG.color) root.style.setProperty(\"--hw-accent\", CONFIG.color);\n        var NS = \"http://www.w3.org/2000/svg\";\n        var svg = document.getElementById(\"hw-st-svg\");\n\n        /* fat zigzag bands, each covering a horizontal slice edge-to-edge */\n        var bandH = H / CONFIG.bands;\n        var paths = [];\n        for (var b = 0; b < CONFIG.bands; b++) {\n          var y0 = b * bandH + bandH / 2;\n          var d = \"M -80 \" + (y0 + window.hwHash(b * 17, CONFIG.seed) * 20).toFixed(1);\n          var zigs = 7;\n          for (var i = 1; i <= zigs; i++) {\n            var x = (W + 160) * (i / zigs) - 80;\n            var y =\n              y0 + (i % 2 ? -1 : 1) * bandH * 0.32 + window.hwHash(b * 17 + i, CONFIG.seed) * 16;\n            d += \" L \" + x.toFixed(1) + \" \" + y.toFixed(1);\n          }\n          var p = document.createElementNS(NS, \"path\");\n          p.setAttribute(\"d\", d);\n          p.setAttribute(\"stroke-width\", Math.ceil(bandH * 0.85 * CONFIG.strokeScale));\n          p.setAttribute(\"id\", \"hw-st-band-\" + b);\n          svg.appendChild(p);\n          paths.push(p);\n        }\n\n        var tl = gsap.timeline({ paused: true });\n\n        /* 0-0.85: bands scribble on (staggered, alternating direction) */\n        paths.forEach(function (p, i) {\n          var len = p.getTotalLength();\n          gsap.set(p, { strokeDasharray: len, strokeDashoffset: i % 2 ? -len : len });\n          tl.to(p, { strokeDashoffset: 0, duration: 0.55, ease: \"power2.in\" }, 0.04 * i);\n        });\n        /* 0.8: solid backstop snaps in beneath the finished scribble — full\n           coverage guaranteed 0.85-1.35 (the host's cut window) */\n        tl.to(\"#hw-st-solid\", { opacity: 1, duration: 0.12, ease: \"none\" }, 0.8);\n\n        /* 1.35-1.95: clear — bands scribble off the other way, backstop lifts */\n        tl.to(\"#hw-st-solid\", { opacity: 0, duration: 0.15, ease: \"none\" }, 1.42);\n        paths.forEach(function (p, i) {\n          var len = p.getTotalLength();\n          tl.to(\n            p,\n            { strokeDashoffset: i % 2 ? len : -len, duration: 0.5, ease: \"power2.out\" },\n            1.42 + 0.035 * i,\n          );\n        });\n\n        /* hard kill the moment the last band clears (learning: kill roots\n           when the final fade completes, not at DUR) */\n        tl.set(root, { visibility: \"hidden\" }, 2.17);\n\n        window.__timelines[\"hw-scribble-transition\"] = tl;\n      })();\n    </script>\n  </body>\n</html>\n"}