Skip to content

Write HTML. Render video. Built for agents.

11.7 KB
Raw Blame
{"html":"<!doctype html>\n<!-- Demo plate for the catalog preview. Identical to hw-pipeline.html except the\n     root background, which is opaque here so the transparent overlay reads.\n     Not installed by `hyperframes add` - registry-item.json lists hw-pipeline.html only. -->\n<html lang=\"en\">\n  <head><base href=\"/public/catalog/items/hw-pipeline/\">\n    <meta charset=\"utf-8\" />\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      @font-face {\n        font-family: \"Caveat\";\n        src: url(\"/public/catalog/assets/891951df5e8b5b0f.woff2\") format(\"woff2\");\n        font-weight: 700;\n        font-display: block;\n      }\n      *,\n      *::before,\n      *::after {\n        margin: 0;\n        padding: 0;\n        box-sizing: border-box;\n      }\n      body {\n        background: #17161a;\n        overflow: hidden;\n      }\n      #hw-pl-root {\n        --hw-font-print: \"Caveat\", cursive;\n        --hw-font-script: \"Caveat\", cursive;\n        --hw-ink: #f4f2ec;\n        /* Warm marker accent, matching hw-frame / hw-title / hw-underline. The\n           previous #6d6dff read as a default UI blue against the family's ink. */\n        --hw-accent: #ffb020;\n\n        position: relative;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: transparent; /* overlays footage or boards */\n        font-family: var(--hw-font-print, \"Caveat\", cursive);\n      }\n      #hw-pl-svg {\n        position: absolute;\n        inset: 0;\n        width: 100%;\n        height: 100%;\n        overflow: visible;\n      }\n      #hw-pl-svg path {\n        fill: none;\n        stroke-linecap: round;\n        stroke-linejoin: round;\n      }\n      .hw-pl-box {\n        stroke: var(--hw-ink);\n        stroke-width: 6;\n      }\n      .hw-pl-conn {\n        stroke: var(--hw-accent);\n        stroke-width: 5;\n      }\n      .hw-pl-label {\n        position: absolute;\n        text-align: center;\n        font-weight: 700;\n        color: var(--hw-ink);\n        white-space: nowrap;\n        opacity: 0;\n        text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"hw-pl-root\"\n      data-composition-id=\"hw-pipeline\"\n      data-start=\"0\"\n      data-duration=\"7\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <svg id=\"hw-pl-svg\" viewBox=\"0 0 1920 1080\"></svg>\n      <div id=\"hw-pl-labels\"></div>\n      <div\n        id=\"hw-pl-drv\"\n        class=\"clip\"\n        data-start=\"0\"\n        data-duration=\"7\"\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           A flowchart \"pipeline\": wobbled boxes joined by curved\n           connectors, drawing on in sequence, all boiling. */\n        var CONFIG = {\n          nodes: [{ label: \"Idea\" }, { label: \"Record\" }, { label: \"Shine!\" }],\n          boxW: 320,\n          boxH: 170,\n          gap: 190, // px between boxes\n          y: 455, // top of the row; x centers automatically\n          fontSize: 56,\n          seed: 11,\n          boil: { enabled: true, amp: 1.6, rot: 0.4, frameDrop: 3 },\n          animationOut: true,\n        };\n\n        var DUR = 7;\n        function clamp(v, lo, hi) {\n          return Math.min(hi, Math.max(lo, v));\n        }\n        var OUT = clamp(DUR * 0.06, 0.25, 0.6);\n\n        /* hw family runtime */\n        window.hwOnUpdate = function (tl, fn) {\n          if (!tl.__hwRenders) {\n            tl.__hwRenders = [];\n            tl.eventCallback(\"onUpdate\", function () {\n              for (var i = 0; i < tl.__hwRenders.length; i++) tl.__hwRenders[i]();\n            });\n          }\n          tl.__hwRenders.push(fn);\n          fn();\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        window.hwBoil = function (tl, target, opts) {\n          opts = opts || {};\n          var amp = opts.amp !== undefined ? opts.amp : 1.6;\n          var rot = opts.rot !== undefined ? opts.rot : 0.5;\n          var fps = opts.fps || 30;\n          var drop = opts.frameDrop || 3;\n          var seed = opts.seed || 1;\n          var els = gsap.utils.toArray(target);\n          window.hwOnUpdate(tl, function () {\n            var step = Math.floor((tl.time() * fps) / drop);\n            for (var i = 0; i < els.length; i++) {\n              gsap.set(els[i], {\n                x: window.hwHash(step * 3 + i * 97, seed) * amp,\n                y: window.hwHash(step * 3 + 1 + i * 97, seed) * amp,\n                rotation: (opts.baseRot || 0) + window.hwHash(step * 3 + 2 + i * 97, seed) * rot,\n              });\n            }\n          });\n        };\n        window.hwWobbleRect = function (w, h, r, seed, amp) {\n          amp = amp === undefined ? 3.5 : amp;\n          function wob(n) {\n            return window.hwHash(n, seed) * amp;\n          }\n          var d = \"M \" + (r + wob(1)) + \" \" + wob(2);\n          d += \" L \" + (w / 2 + wob(3)) + \" \" + wob(4);\n          d += \" L \" + (w - r + wob(5)) + \" \" + wob(6);\n          d += \" Q \" + (w + wob(7)) + \" \" + wob(8) + \" \" + (w + wob(9)) + \" \" + (r + wob(10));\n          d += \" L \" + (w + wob(11)) + \" \" + (h / 2 + wob(12));\n          d += \" L \" + (w + wob(13)) + \" \" + (h - r + wob(14));\n          d +=\n            \" Q \" +\n            (w + wob(15)) +\n            \" \" +\n            (h + wob(16)) +\n            \" \" +\n            (w - r + wob(17)) +\n            \" \" +\n            (h + wob(18));\n          d += \" L \" + (w / 2 + wob(19)) + \" \" + (h + wob(20));\n          d += \" L \" + (r + wob(21)) + \" \" + (h + wob(22));\n          d += \" Q \" + wob(23) + \" \" + (h + wob(24)) + \" \" + wob(25) + \" \" + (h - r + wob(26));\n          d += \" L \" + wob(27) + \" \" + (h / 2 + wob(28));\n          d += \" L \" + wob(29) + \" \" + (r + wob(30));\n          d += \" Q \" + wob(31) + \" \" + wob(32) + \" \" + (r + wob(33)) + \" \" + wob(34);\n          return d;\n        };\n\n        var NS = \"http://www.w3.org/2000/svg\";\n        var svg = document.getElementById(\"hw-pl-svg\");\n        var labels = document.getElementById(\"hw-pl-labels\");\n        var n = CONFIG.nodes.length;\n        var totalW = n * CONFIG.boxW + (n - 1) * CONFIG.gap;\n        var x0 = (1920 - totalW) / 2;\n\n        var boxes = [],\n          conns = [],\n          labelEls = [];\n        CONFIG.nodes.forEach(function (node, i) {\n          var bx = x0 + i * (CONFIG.boxW + CONFIG.gap);\n          /* outer g owns the translate (GSAP transforms REPLACE the SVG\n             transform attribute — never boil the element that carries it);\n             inner g is the boil target */\n          var gOuter = document.createElementNS(NS, \"g\");\n          gOuter.setAttribute(\"transform\", \"translate(\" + bx + \" \" + CONFIG.y + \")\");\n          var g = document.createElementNS(NS, \"g\");\n          g.setAttribute(\"id\", \"hw-pl-box-g-\" + i);\n          gOuter.appendChild(g);\n          var p = document.createElementNS(NS, \"path\");\n          p.setAttribute(\"class\", \"hw-pl-box\");\n          p.setAttribute(\"id\", \"hw-pl-box-\" + i);\n          p.setAttribute(\"d\", window.hwWobbleRect(CONFIG.boxW, CONFIG.boxH, 24, CONFIG.seed + i));\n          g.appendChild(p);\n          svg.appendChild(gOuter);\n          boxes.push(p);\n\n          var label = document.createElement(\"div\");\n          label.className = \"hw-pl-label\";\n          label.id = \"hw-pl-label-\" + i;\n          label.textContent = node.label;\n          label.style.left = bx + \"px\";\n          label.style.top = CONFIG.y + CONFIG.boxH / 2 - CONFIG.fontSize * 0.62 + \"px\";\n          label.style.width = CONFIG.boxW + \"px\";\n          label.style.fontSize = CONFIG.fontSize + \"px\";\n          labels.appendChild(label);\n          labelEls.push(label);\n\n          if (i < n - 1) {\n            var cx = bx + CONFIG.boxW,\n              cy = CONFIG.y + CONFIG.boxH / 2;\n            var ex = cx + CONFIG.gap,\n              ey = cy;\n            var c = document.createElementNS(NS, \"path\");\n            c.setAttribute(\"class\", \"hw-pl-conn\");\n            c.setAttribute(\"id\", \"hw-pl-conn-\" + i);\n            var sx = cx + 10,\n              tx = ex - 10;\n            var qx = cx + CONFIG.gap / 2 + window.hwHash(i * 9 + 2, CONFIG.seed) * 16,\n              qy = cy - 46 - window.hwHash(i * 9 + 3, CONFIG.seed) * 12;\n            /* Barbs follow the curve's incoming tangent. A quadratic's tangent\n               at its end is (end - control); barbs fixed to horizontal left the\n               head detached from a curve that arrives descending. Symmetric\n               length and angle, so it reads as one arrowhead. */\n            var ang = Math.atan2(ey - qy, tx - qx) + Math.PI;\n            var BARB = 26,\n              SPREAD = 0.42;\n            var b1x = tx + BARB * Math.cos(ang - SPREAD),\n              b1y = ey + BARB * Math.sin(ang - SPREAD);\n            var b2x = tx + BARB * Math.cos(ang + SPREAD),\n              b2y = ey + BARB * Math.sin(ang + SPREAD);\n            c.setAttribute(\n              \"d\",\n              \"M \" +\n                sx +\n                \" \" +\n                cy +\n                \" Q \" +\n                qx +\n                \" \" +\n                qy +\n                \" \" +\n                tx +\n                \" \" +\n                ey +\n                \" M \" +\n                tx +\n                \" \" +\n                ey +\n                \" L \" +\n                b1x +\n                \" \" +\n                b1y +\n                \" M \" +\n                tx +\n                \" \" +\n                ey +\n                \" L \" +\n                b2x +\n                \" \" +\n                b2y,\n            );\n            svg.appendChild(c);\n            conns.push(c);\n          }\n        });\n\n        var tl = gsap.timeline({ paused: true });\n\n        /* sequence: box draws -> label -> connector -> next box... */\n        var t = 0.3;\n        CONFIG.nodes.forEach(function (_, i) {\n          var p = boxes[i];\n          var len = p.getTotalLength();\n          gsap.set(p, { strokeDasharray: len, strokeDashoffset: len });\n          tl.to(p, { strokeDashoffset: 0, duration: 0.65, ease: \"power2.inOut\" }, t);\n          tl.to(labelEls[i], { opacity: 1, duration: 0.35, ease: \"power2.out\" }, t + 0.45);\n          t += 0.7;\n          if (i < conns.length) {\n            var c = conns[i];\n            var cl = c.getTotalLength();\n            gsap.set(c, { strokeDasharray: cl, strokeDashoffset: cl });\n            tl.to(c, { strokeDashoffset: 0, duration: 0.45, ease: \"power2.inOut\" }, t);\n            t += 0.5;\n          }\n        });\n\n        if (CONFIG.boil.enabled) {\n          var targets = boxes.map(function (_, i) {\n            return \"#hw-pl-box-g-\" + i;\n          });\n          window.hwBoil(tl, targets.concat([\".hw-pl-conn\", \".hw-pl-label\"]), {\n            amp: CONFIG.boil.amp,\n            rot: CONFIG.boil.rot,\n            frameDrop: CONFIG.boil.frameDrop,\n            seed: CONFIG.seed,\n          });\n        }\n\n        if (CONFIG.animationOut) {\n          tl.to([svg, labels], { opacity: 0, duration: OUT, ease: \"power2.in\" }, DUR - OUT - 0.05);\n        }\n        tl.set(\"#hw-pl-root\", { visibility: \"hidden\" }, DUR - 0.02);\n\n        window.__timelines[\"hw-pipeline\"] = tl;\n      })();\n    </script>\n  </body>\n</html>\n"}