Skip to content

Write HTML. Render video. Built for agents.

12.1 KB
Raw Blame
{"html":"<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=1920\" />\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      * {\n        margin: 0;\n        padding: 0;\n        box-sizing: border-box;\n      }\n      body {\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: #000;\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n      }\n      .scene {\n        position: absolute;\n        top: 0;\n        left: 0;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n      }\n      .scene-inner {\n        width: 100%;\n        height: 100%;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        flex-direction: column;\n      }\n      .info-bar {\n        position: absolute;\n        bottom: 0;\n        left: 0;\n        right: 0;\n        z-index: 100;\n        background: rgba(0, 0, 0, 0.88);\n        padding: 24px 60px;\n        display: flex;\n        align-items: center;\n        gap: 40px;\n        opacity: 0;\n      }\n      .info-num {\n        font-size: 14px;\n        font-weight: 700;\n        color: #e07a5f;\n        letter-spacing: 0.1em;\n      }\n      .info-name {\n        font-size: 20px;\n        font-weight: 700;\n        color: #fff;\n      }\n      .info-desc {\n        font-size: 14px;\n        color: rgba(255, 255, 255, 0.5);\n      }\n      #title-card {\n        position: absolute;\n        top: 0;\n        left: 0;\n        width: 1920px;\n        height: 1080px;\n        background: #0d1b2a;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        flex-direction: column;\n        z-index: 50;\n      }\n      #outro-card {\n        position: absolute;\n        top: 0;\n        left: 0;\n        width: 1920px;\n        height: 1080px;\n        background: #0d1b2a;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        flex-direction: column;\n        z-index: 50;\n        opacity: 0;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      data-composition-id=\"main\"\n      data-start=\"0\"\n      data-duration=\"14\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <!-- Title Card -->\n      <div id=\"title-card\">\n        <div\n          id=\"title-label\"\n          style=\"\n            font-size: 14px;\n            font-weight: 700;\n            color: #e07a5f;\n            letter-spacing: 0.2em;\n            text-transform: uppercase;\n            opacity: 0;\n          \"\n        >\n          TRANSITION CATALOG\n        </div>\n        <div\n          id=\"title-main\"\n          style=\"font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0\"\n        >\n          Destruction Transitions\n        </div>\n        <div\n          id=\"title-count\"\n          style=\"\n            font-size: 24px;\n            font-weight: 400;\n            color: rgba(255, 255, 255, 0.4);\n            margin-top: 12px;\n            opacity: 0;\n          \"\n        >\n          1 transition\n        </div>\n      </div>\n\n      <!-- Scene A -->\n      <div id=\"scene1\" class=\"scene\" style=\"z-index: 1\">\n        <div class=\"scene-inner\" id=\"s1\" style=\"background: #1b263b\">\n          <div style=\"font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)\">\n            ONE\n          </div>\n          <div\n            style=\"\n              font-size: 32px;\n              font-weight: 700;\n              color: #778da9;\n              letter-spacing: 0.15em;\n              margin-top: -20px;\n            \"\n          >\n            SCENE A\n          </div>\n        </div>\n      </div>\n\n      <!-- Scene B -->\n      <div id=\"scene2\" class=\"scene\" style=\"z-index: 2; opacity: 0\">\n        <div class=\"scene-inner\" id=\"s2\" style=\"background: #e07a5f\">\n          <div style=\"font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)\">\n            TWO\n          </div>\n          <div\n            style=\"\n              font-size: 32px;\n              font-weight: 700;\n              color: #fff;\n              letter-spacing: 0.15em;\n              margin-top: -20px;\n            \"\n          >\n            SCENE B\n          </div>\n        </div>\n      </div>\n\n      <!-- Burn Canvas -->\n      <canvas\n        id=\"burn-canvas\"\n        width=\"1920\"\n        height=\"1080\"\n        style=\"position: absolute; inset: 0; z-index: 40; pointer-events: none\"\n      ></canvas>\n\n      <!-- Info Bar -->\n      <div id=\"info-1\" class=\"info-bar\">\n        <div class=\"info-num\">01</div>\n        <div class=\"info-name\">Page Burn</div>\n        <div class=\"info-desc\">Use a page burn destruction transition</div>\n      </div>\n\n      <!-- Outro Card -->\n      <div id=\"outro-card\">\n        <div\n          id=\"outro-label\"\n          style=\"\n            font-size: 14px;\n            font-weight: 700;\n            color: #e07a5f;\n            letter-spacing: 0.2em;\n            text-transform: uppercase;\n            opacity: 0;\n          \"\n        >\n          DESTRUCTION TRANSITIONS\n        </div>\n        <div\n          id=\"outro-main\"\n          style=\"font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0\"\n        >\n          1 Transition\n        </div>\n      </div>\n    </div>\n\n    <script>\n      (function () {\n        var tl = gsap.timeline({ paused: true });\n        var t = 0;\n\n        // === TITLE CARD (3s) ===\n        tl.to(\"#title-label\", { opacity: 1, y: 0, duration: 0.4, ease: \"power2.out\" }, t + 0.3);\n        tl.fromTo(\n          \"#title-main\",\n          { opacity: 0, y: 20 },\n          { opacity: 1, y: 0, duration: 0.5, ease: \"power2.out\" },\n          t + 0.6,\n        );\n        tl.fromTo(\n          \"#title-count\",\n          { opacity: 0 },\n          { opacity: 1, duration: 0.4, ease: \"power2.out\" },\n          t + 1.0,\n        );\n        tl.to(\"#title-card\", { opacity: 0, duration: 0.4, ease: \"power2.inOut\" }, t + 2.4);\n        t += 3;\n\n        // === TRANSITION 1: Page Burn (8s total: 2s build, 3s burn, 3s settle) ===\n        tl.set(\n          \"#scene1\",\n          {\n            opacity: 1,\n            x: 0,\n            y: 0,\n            scale: 1,\n            rotation: 0,\n            filter: \"none\",\n            clipPath: \"none\",\n            zIndex: 1,\n          },\n          t,\n        );\n        tl.set(\n          \"#scene2\",\n          {\n            opacity: 0,\n            x: 0,\n            y: 0,\n            scale: 1,\n            rotation: 0,\n            filter: \"none\",\n            clipPath: \"none\",\n            zIndex: 2,\n          },\n          t,\n        );\n        tl.set(\"#s1\", { opacity: 1, x: 0, y: 0, scale: 1, rotation: 0, filter: \"none\" }, t);\n        tl.set(\"#s2\", { opacity: 1, x: 0, y: 0, scale: 1, rotation: 0, filter: \"none\" }, t);\n\n        // Show info bar\n        tl.to(\"#info-1\", { opacity: 1, duration: 0.3 }, t + 0.2);\n\n        // Burn transition starts at t+2\n        var T = t + 2;\n\n        var burnCanvas = document.getElementById(\"burn-canvas\");\n        var burnCtx = burnCanvas.getContext(\"2d\");\n        var burnState = { progress: 0 };\n\n        function noise(x) {\n          var ix = Math.floor(x),\n            fx = x - ix;\n          var a = Math.sin(ix * 127.1 + 311.7) * 43758.5453;\n          var b = Math.sin((ix + 1) * 127.1 + 311.7) * 43758.5453;\n          var t2 = fx * fx * (3 - 2 * fx);\n          return a - Math.floor(a) + (b - Math.floor(b) - (a - Math.floor(a))) * t2;\n        }\n\n        function drawBurn(progress) {\n          burnCtx.clearRect(0, 0, 1920, 1080);\n          if (progress <= 0 || progress >= 1) return;\n\n          var maxR = 1400;\n          var cx = 960,\n            cy = 540;\n\n          // Draw fire edge glow\n          burnCtx.beginPath();\n          var steps = 60;\n          for (var i = 0; i <= steps; i++) {\n            var angle = (i / steps) * Math.PI * 2;\n            var baseR = progress * maxR;\n            var r =\n              baseR + noise(angle * 3 + progress * 4) * 80 + noise(angle * 8 + progress * 9) * 30;\n            var px = cx + Math.cos(angle) * r;\n            var py = cy + Math.sin(angle) * r;\n            if (i === 0) burnCtx.moveTo(px, py);\n            else burnCtx.lineTo(px, py);\n          }\n          burnCtx.closePath();\n\n          // Orange/red edge glow\n          var grad = burnCtx.createRadialGradient(\n            cx,\n            cy,\n            progress * maxR * 0.8,\n            cx,\n            cy,\n            progress * maxR * 1.1,\n          );\n          grad.addColorStop(0, \"rgba(0,0,0,0)\");\n          grad.addColorStop(0.7, \"rgba(255,100,0,0.6)\");\n          grad.addColorStop(0.9, \"rgba(255,50,0,0.8)\");\n          grad.addColorStop(1, \"rgba(200,30,0,0.4)\");\n          burnCtx.fillStyle = grad;\n          burnCtx.fill();\n\n          // Inner ember particles\n          var particleCount = Math.floor(progress * 40);\n          for (var p = 0; p < particleCount; p++) {\n            var pAngle = noise(p * 0.7 + progress * 2) * Math.PI * 2;\n            var pDist = progress * maxR * (0.85 + noise(p * 1.3 + progress * 5) * 0.15);\n            var ex = cx + Math.cos(pAngle) * pDist;\n            var ey = cy + Math.sin(pAngle) * pDist;\n            var pSize = 2 + noise(p * 2.1) * 4;\n            burnCtx.beginPath();\n            burnCtx.arc(ex, ey, pSize, 0, Math.PI * 2);\n            burnCtx.fillStyle =\n              \"rgba(255,\" +\n              Math.floor(80 + noise(p * 3) * 120) +\n              \",0,\" +\n              (0.4 + noise(p * 1.7) * 0.4) +\n              \")\";\n            burnCtx.fill();\n          }\n        }\n\n        // Animate burn progress over 3 seconds\n        tl.to(\n          burnState,\n          {\n            progress: 1,\n            duration: 3.0,\n            ease: \"power1.in\",\n            onUpdate: function () {\n              var p = burnState.progress;\n              drawBurn(p);\n              var scene1El = document.getElementById(\"scene1\");\n              if (p <= 0) {\n                scene1El.style.clipPath = \"none\";\n              } else if (p < 1) {\n                // Shrink scene1 with circular clip from center\n                var radius = Math.max(0, 75 - p * 80);\n                scene1El.style.clipPath = \"circle(\" + radius + \"% at 50% 50%)\";\n              } else {\n                scene1El.style.clipPath = \"circle(0% at 50% 50%)\";\n              }\n            },\n          },\n          T,\n        );\n\n        // Scene 2 fades in from behind as burn progresses\n        tl.set(\"#scene2\", { opacity: 1 }, T + 0.5);\n        tl.fromTo(\n          \"#s2\",\n          { opacity: 0 },\n          { opacity: 1, duration: 2.0, ease: \"power1.out\" },\n          T + 0.5,\n        );\n\n        // Clean up after burn completes\n        tl.set(\"#scene1\", { opacity: 0, clipPath: \"none\" }, T + 3.0);\n        tl.call(\n          function () {\n            burnCtx.clearRect(0, 0, 1920, 1080);\n          },\n          null,\n          T + 3.0,\n        );\n\n        // Settle time (hold scene B)\n        t = T + 3.0 + 2.0;\n        tl.to(\"#info-1\", { opacity: 0, duration: 0.2 }, t);\n        t += 0.5;\n\n        // === OUTRO (3s) ===\n        tl.set(\"#scene1\", { opacity: 0 }, t);\n        tl.set(\"#scene2\", { opacity: 0 }, t);\n        tl.to(\"#outro-card\", { opacity: 1, duration: 0.4, ease: \"power2.inOut\" }, t);\n        tl.to(\"#outro-label\", { opacity: 1, duration: 0.4, ease: \"power2.out\" }, t + 0.3);\n        tl.fromTo(\n          \"#outro-main\",\n          { opacity: 0, y: 20 },\n          { opacity: 1, y: 0, duration: 0.5, ease: \"power2.out\" },\n          t + 0.6,\n        );\n        tl.to(\"#outro-card\", { opacity: 0, duration: 0.4, ease: \"power2.inOut\" }, t + 2.4);\n\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"main\"] = tl;\n      })();\n    </script>\n  </body>\n</html>\n"}