Skip to content

Write HTML. Render video. Built for agents.

8.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      #mk-pg-root {\n        /* ---- mk tokens: override in the host to re-skin the family ---- */\n        --mk-font: \"Inter\", -apple-system, sans-serif;\n        --mk-ink-dim: #6e6e73;\n        --mk-paper: #ffffff;\n        --mk-blob-1: #ff7ac8;\n        --mk-blob-2: #45d6c8;\n        --mk-accent-dark: #7d5cff;\n        --mk-blob-1-soft: #ffd3ec;\n        --mk-blob-2-soft: #d9fff8;\n        --mk-accent-dark-soft: #cabdff;\n        --mk-well-warm: #ffb86b;\n        --mk-well-warm-soft: #ffe3c2;\n        --mk-well-sky: #5cb8ff;\n        --mk-well-sky-soft: #cfe9ff;\n        --mk-well-rose: #ff8f8f;\n        --mk-well-rose-soft: #ffd6d6;\n        --mk-well-num: rgba(255, 255, 255, 0.9);\n        --mk-radius-card: 40px;\n        --mk-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);\n\n        position: relative;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: transparent; /* pair with mk-background beneath for the gradient backdrop */\n      }\n      .mk-pg-cell {\n        position: absolute;\n        border-radius: var(--mk-radius-card);\n        overflow: hidden;\n        background: var(--mk-paper);\n        box-shadow: var(--mk-shadow);\n      }\n      .mk-pg-media {\n        position: absolute;\n        inset: 0;\n        width: 100%;\n        height: 100%;\n        object-fit: cover;\n      }\n      /* empty drop-zone well: soft gradient + index numeral */\n      .mk-pg-well {\n        position: absolute;\n        inset: 0;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n      }\n      .mk-pg-well-num {\n        font-family: var(--mk-font);\n        font-weight: 600;\n        font-size: 88px;\n        letter-spacing: -0.02em;\n        color: var(--mk-well-num);\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"mk-pg-root\"\n      data-composition-id=\"mk-placeholder-grid\"\n      data-start=\"0\"\n      data-duration=\"8\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <div id=\"mk-pg-grid\"></div>\n      <div\n        id=\"mk-pg-drv\"\n        class=\"clip\"\n        data-start=\"0\"\n        data-duration=\"8\"\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 (inspector-style CONFIG) ---- */\n        var CONFIG = {\n          // no scheme param — scheme-agnostic; re-skin via the --mk-* tokens\n          layout: \"1+2\", // \"2up\" | \"3up\" | \"4up\" | \"3x2\" | \"1+2\" (hero left + two stacked)\n          margin: 120, // outer margin, px\n          gap: 40, // px between cells\n          radius: 40, // cell corner radius (rounded-edge look)\n          // One entry per cell (in layout order). src: image path, or null for a\n          // styled drop-zone well. insideScale: media scale inside the mask —\n          // an \"inside scale\" convention (1 = cover-fit).\n          cells: [\n            { src: null, insideScale: 1 },\n            { src: null, insideScale: 1 },\n            { src: null, insideScale: 1 },\n          ],\n          kenBurns: true, // slow media settle inside the mask\n          stagger: 0.15, // \"box, box, box\" entrance\n          animationIn: true,\n          animationOut: true,\n        };\n\n        /* decorative fills for empty wells (cycled) */\n        var WELL_FILLS = [\n          \"linear-gradient(135deg, var(--mk-blob-1) 0%, var(--mk-blob-1-soft) 100%)\",\n          \"linear-gradient(135deg, var(--mk-blob-2) 0%, var(--mk-blob-2-soft) 100%)\",\n          \"linear-gradient(135deg, var(--mk-accent-dark) 0%, var(--mk-accent-dark-soft) 100%)\",\n          \"linear-gradient(135deg, var(--mk-well-warm) 0%, var(--mk-well-warm-soft) 100%)\",\n          \"linear-gradient(135deg, var(--mk-well-sky) 0%, var(--mk-well-sky-soft) 100%)\",\n          \"linear-gradient(135deg, var(--mk-well-rose) 0%, var(--mk-well-rose-soft) 100%)\",\n        ];\n\n        var W = 1920,\n          H = 1080,\n          DUR = 8;\n\n        function rects(layout, m, g) {\n          var iw = W - 2 * m,\n            ih = H - 2 * m;\n          function grid(cols, rows) {\n            var cw = (iw - (cols - 1) * g) / cols,\n              ch = (ih - (rows - 1) * g) / rows,\n              out = [];\n            for (var r = 0; r < rows; r++)\n              for (var c = 0; c < cols; c++)\n                out.push({ x: m + c * (cw + g), y: m + r * (ch + g), w: cw, h: ch });\n            return out;\n          }\n          if (layout === \"2up\") return grid(2, 1);\n          if (layout === \"3up\") return grid(3, 1);\n          if (layout === \"4up\") return grid(2, 2);\n          if (layout === \"3x2\") return grid(3, 2);\n          /* \"1+2\": hero left (58%), two stacked right */\n          var w1 = Math.round((iw - g) * 0.58),\n            w2 = iw - g - w1,\n            h2 = (ih - g) / 2;\n          return [\n            { x: m, y: m, w: w1, h: ih },\n            { x: m + w1 + g, y: m, w: w2, h: h2 },\n            { x: m + w1 + g, y: m + h2 + g, w: w2, h: h2 },\n          ];\n        }\n\n        var root = document.getElementById(\"mk-pg-root\");\n        var grid = document.getElementById(\"mk-pg-grid\");\n        var R = rects(CONFIG.layout, CONFIG.margin, CONFIG.gap);\n\n        var cells = [],\n          medias = [];\n        R.forEach(function (r, i) {\n          var conf = CONFIG.cells[i] || {};\n          var cell = document.createElement(\"div\");\n          cell.id = \"mk-pg-cell-\" + i;\n          cell.className = \"mk-pg-cell\";\n          cell.style.left = r.x + \"px\";\n          cell.style.top = r.y + \"px\";\n          cell.style.width = r.w + \"px\";\n          cell.style.height = r.h + \"px\";\n          cell.style.borderRadius = CONFIG.radius + \"px\";\n\n          var inner;\n          if (conf.src) {\n            inner = document.createElement(\"img\");\n            inner.className = \"mk-pg-media\";\n            inner.src = conf.src;\n          } else {\n            inner = document.createElement(\"div\");\n            inner.className = \"mk-pg-well\";\n            inner.style.background = WELL_FILLS[i % WELL_FILLS.length];\n            var num = document.createElement(\"span\");\n            num.className = \"mk-pg-well-num\";\n            num.textContent = String(i + 1);\n            inner.appendChild(num);\n          }\n          inner.id = \"mk-pg-inner-\" + i;\n          inner.setAttribute(\"data-layout-allow-overflow\", \"\"); // ken-burns scales past the mask by design\n          cell.appendChild(inner);\n          grid.appendChild(cell);\n          cells.push(cell);\n          medias.push(inner);\n\n          gsap.set(inner, { scale: conf.insideScale || 1 });\n        });\n\n        var tl = gsap.timeline({ paused: true });\n\n        cells.forEach(function (cell, i) {\n          var t0 = (CONFIG.animationIn ? 0.3 : 0) + i * CONFIG.stagger;\n\n          if (CONFIG.animationIn) {\n            gsap.set(cell, { opacity: 0, scale: 0.92, y: 28 });\n            tl.to(cell, { opacity: 1, scale: 1, y: 0, duration: 0.65, ease: \"power3.out\" }, t0);\n          }\n\n          if (CONFIG.kenBurns) {\n            var base = (CONFIG.cells[i] && CONFIG.cells[i].insideScale) || 1;\n            tl.fromTo(\n              medias[i],\n              { scale: base * 1.06 },\n              { scale: base, duration: DUR - t0 - 0.6, ease: \"sine.out\" },\n              t0,\n            );\n          }\n        });\n\n        /* exit + hard kill */\n        if (CONFIG.animationOut) {\n          tl.to(grid, { opacity: 0, y: -20, duration: 0.4, ease: \"power2.in\" }, DUR - 0.5);\n        }\n        tl.set(root, { visibility: \"hidden\" }, DUR - 0.02);\n\n        window.__timelines[\"mk-placeholder-grid\"] = tl;\n      })();\n    </script>\n  </body>\n</html>\n"}