Skip to content

Write HTML. Render video. Built for agents.

12.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>Distortion Transitions</title>\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        background: #000;\n        overflow: hidden;\n      }\n\n      .scene {\n        position: absolute;\n        inset: 0;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n      }\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\n      #scene1 .scene-inner {\n        background: #1b263b;\n      }\n      #scene2 .scene-inner {\n        background: #e07a5f;\n      }\n\n      .scene-num {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n        font-size: 200px;\n        font-weight: 900;\n        color: rgba(255, 255, 255, 0.08);\n        line-height: 1;\n      }\n      .scene-label {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n        font-size: 48px;\n        font-weight: 600;\n        color: rgba(255, 255, 255, 0.25);\n        letter-spacing: 12px;\n        text-transform: uppercase;\n        margin-top: 10px;\n      }\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: 28px 60px;\n        opacity: 0;\n        display: flex;\n        align-items: center;\n        justify-content: space-between;\n      }\n      .info-bar .info-name {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n        font-size: 32px;\n        font-weight: 700;\n        color: #fff;\n      }\n      .info-bar .info-cat {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n        font-size: 18px;\n        font-weight: 500;\n        color: rgba(255, 255, 255, 0.4);\n        letter-spacing: 4px;\n        text-transform: uppercase;\n      }\n\n      /* Title / Outro */\n      #title-card,\n      #outro-card {\n        position: absolute;\n        inset: 0;\n        z-index: 200;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        flex-direction: column;\n        background: #0d1117;\n        opacity: 0;\n      }\n      .card-title {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n        font-size: 72px;\n        font-weight: 800;\n        color: #fff;\n      }\n      .card-sub {\n        font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;\n        font-size: 28px;\n        font-weight: 400;\n        color: rgba(255, 255, 255, 0.4);\n        margin-top: 16px;\n        letter-spacing: 6px;\n        text-transform: uppercase;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"main\"\n      data-composition-id=\"main\"\n      data-start=\"0\"\n      data-duration=\"21\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n      style=\"position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #000\"\n    >\n      <!-- Title Card -->\n      <div id=\"title-card\">\n        <div class=\"card-title\">Distortion Transitions</div>\n        <div class=\"card-sub\">Glitch &bull; Chromatic &bull; Ripple</div>\n      </div>\n\n      <!-- Scene A -->\n      <div id=\"scene1\" class=\"scene\" style=\"opacity: 0\">\n        <div id=\"s1\" class=\"scene-inner\">\n          <div class=\"scene-num\">ONE</div>\n          <div class=\"scene-label\">Scene A</div>\n        </div>\n      </div>\n\n      <!-- Scene B -->\n      <div id=\"scene2\" class=\"scene\" style=\"opacity: 0\">\n        <div id=\"s2\" class=\"scene-inner\">\n          <div class=\"scene-num\">TWO</div>\n          <div class=\"scene-label\">Scene B</div>\n        </div>\n      </div>\n\n      <!-- RGB channel overlays for glitch/chromatic -->\n      <div\n        id=\"glitch-r\"\n        style=\"\n          position: absolute;\n          inset: 0;\n          z-index: 30;\n          opacity: 0;\n          pointer-events: none;\n          mix-blend-mode: screen;\n        \"\n      >\n        <div\n          class=\"scene-inner\"\n          style=\"\n            background: rgba(229, 56, 59, 0.35);\n            width: 100%;\n            height: 100%;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            flex-direction: column;\n          \"\n        >\n          <div style=\"font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)\">\n            ONE\n          </div>\n        </div>\n      </div>\n      <div\n        id=\"glitch-b\"\n        style=\"\n          position: absolute;\n          inset: 0;\n          z-index: 30;\n          opacity: 0;\n          pointer-events: none;\n          mix-blend-mode: screen;\n        \"\n      >\n        <div\n          class=\"scene-inner\"\n          style=\"\n            background: rgba(72, 191, 227, 0.35);\n            width: 100%;\n            height: 100%;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            flex-direction: column;\n          \"\n        >\n          <div style=\"font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)\">\n            ONE\n          </div>\n        </div>\n      </div>\n\n      <!-- Info Bars -->\n      <div id=\"info1\" class=\"info-bar\">\n        <div class=\"info-name\">Glitch</div>\n        <div class=\"info-cat\">Distortion</div>\n      </div>\n      <div id=\"info2\" class=\"info-bar\">\n        <div class=\"info-name\">Chromatic Aberration</div>\n        <div class=\"info-cat\">Distortion</div>\n      </div>\n      <div id=\"info3\" class=\"info-bar\">\n        <div class=\"info-name\">Ripple</div>\n        <div class=\"info-cat\">Distortion</div>\n      </div>\n\n      <!-- Outro Card -->\n      <div id=\"outro-card\">\n        <div class=\"card-title\">Distortion Transitions</div>\n        <div class=\"card-sub\">End</div>\n      </div>\n    </div>\n\n    <script>\n      (function () {\n        var tl = gsap.timeline({ defaults: { ease: \"none\" } });\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"main\"] = tl;\n\n        function resetScenes() {\n          tl.set(\"#scene1\", { opacity: 1 });\n          tl.set(\"#scene2\", { opacity: 0 });\n          tl.set(\"#s1\", { x: 0, y: 0, scale: 1, filter: \"blur(0px)\", opacity: 1 });\n          tl.set(\"#s2\", { x: 0, y: 0, scale: 1, filter: \"blur(0px)\", opacity: 1 });\n          tl.set(\"#glitch-r\", { opacity: 0, x: 0, y: 0 });\n          tl.set(\"#glitch-b\", { opacity: 0, x: 0, y: 0 });\n        }\n\n        // ===== TITLE CARD (0–3s) =====\n        tl.set(\"#title-card\", { opacity: 1 }, 0);\n        tl.fromTo(\n          \".card-title\",\n          { y: 30, opacity: 0 },\n          { y: 0, opacity: 1, duration: 0.6, ease: \"power2.out\" },\n          0.4,\n        );\n        tl.fromTo(\n          \".card-sub\",\n          { y: 20, opacity: 0 },\n          { y: 0, opacity: 1, duration: 0.5, ease: \"power2.out\" },\n          0.8,\n        );\n        tl.to(\"#title-card\", { opacity: 0, duration: 0.4, ease: \"power2.in\" }, 2.6);\n\n        // ===== DEMO 1: Glitch (3–8s) =====\n        var T;\n\n        // Reset & show scene A\n        tl.call(function () {}, [], 3);\n        resetScenes();\n\n        // Show info bar\n        tl.to(\"#info1\", { opacity: 1, duration: 0.3, ease: \"power2.out\" }, 3);\n\n        // Hold 1.5s, transition at T=4.5\n        T = 4.5;\n\n        // Glitch transition\n        tl.set(\"#glitch-r\", { opacity: 1, x: 40, y: -8 }, T);\n        tl.set(\"#glitch-b\", { opacity: 1, x: -30, y: 12 }, T);\n        tl.set(\"#s1\", { x: -15 }, T);\n\n        tl.set(\"#glitch-r\", { x: -30, y: 15 }, T + 0.03);\n        tl.set(\"#glitch-b\", { x: 50, y: -10 }, T + 0.03);\n        tl.set(\"#s1\", { x: 20 }, T + 0.03);\n\n        tl.set(\"#glitch-r\", { x: 60, y: -20 }, T + 0.06);\n        tl.set(\"#glitch-b\", { x: -40, y: 8 }, T + 0.06);\n        tl.set(\"#s1\", { x: -25 }, T + 0.06);\n\n        tl.set(\"#glitch-r\", { x: -20, y: 5 }, T + 0.09);\n        tl.set(\"#glitch-b\", { x: 35, y: -15 }, T + 0.09);\n\n        // Swap at T + 0.12\n        tl.set(\"#scene1\", { opacity: 0 }, T + 0.12);\n        tl.set(\"#scene2\", { opacity: 1 }, T + 0.12);\n\n        // Clear\n        tl.set(\"#glitch-r\", { opacity: 0, x: 0, y: 0 }, T + 0.15);\n        tl.set(\"#glitch-b\", { opacity: 0, x: 0, y: 0 }, T + 0.15);\n        tl.set(\"#s1\", { x: 0 }, T + 0.15);\n\n        // Hold 1.0s, hide info, gap 0.5s\n        tl.to(\"#info1\", { opacity: 0, duration: 0.3, ease: \"power2.in\" }, 7.0);\n\n        // ===== DEMO 2: Chromatic Aberration (8–13s) =====\n        tl.call(function () {}, [], 8);\n        resetScenes();\n\n        tl.to(\"#info2\", { opacity: 1, duration: 0.3, ease: \"power2.out\" }, 8);\n\n        T = 9.5;\n\n        // Chromatic aberration transition\n        tl.set(\"#glitch-r\", { opacity: 0.6, x: 0 }, T);\n        tl.set(\"#glitch-b\", { opacity: 0.6, x: 0 }, T);\n        tl.to(\"#glitch-r\", { x: -80, opacity: 0.8, duration: 0.3, ease: \"power2.in\" }, T);\n        tl.to(\"#glitch-b\", { x: 80, opacity: 0.8, duration: 0.3, ease: \"power2.in\" }, T);\n\n        // Swap\n        tl.set(\"#scene1\", { opacity: 0 }, T + 0.3);\n        tl.set(\"#scene2\", { opacity: 1 }, T + 0.3);\n\n        // Converge back\n        tl.to(\"#glitch-r\", { x: 0, opacity: 0, duration: 0.3, ease: \"power2.out\" }, T + 0.3);\n        tl.to(\"#glitch-b\", { x: 0, opacity: 0, duration: 0.3, ease: \"power2.out\" }, T + 0.3);\n\n        tl.to(\"#info2\", { opacity: 0, duration: 0.3, ease: \"power2.in\" }, 12.0);\n\n        // ===== DEMO 3: Ripple (13–18s) =====\n        tl.call(function () {}, [], 13);\n        resetScenes();\n\n        tl.to(\"#info3\", { opacity: 1, duration: 0.3, ease: \"power2.out\" }, 13);\n\n        T = 14.5;\n\n        // Ripple distortion transition\n        tl.to(\"#s1\", { x: 30, scale: 1.02, duration: 0.04, ease: \"none\" }, T);\n        tl.to(\n          \"#s1\",\n          { x: -25, scale: 0.98, filter: \"blur(4px)\", duration: 0.04, ease: \"none\" },\n          T + 0.04,\n        );\n        tl.to(\n          \"#s1\",\n          { x: 20, scale: 1.01, filter: \"blur(6px)\", duration: 0.04, ease: \"none\" },\n          T + 0.08,\n        );\n        tl.to(\n          \"#s1\",\n          { x: -15, scale: 0.99, filter: \"blur(8px)\", duration: 0.04, ease: \"none\" },\n          T + 0.12,\n        );\n        tl.to(\n          \"#s1\",\n          { x: 10, opacity: 0, filter: \"blur(10px)\", duration: 0.04, ease: \"none\" },\n          T + 0.16,\n        );\n        tl.set(\"#scene2\", { opacity: 1 }, T + 0.16);\n        tl.fromTo(\n          \"#s2\",\n          { x: -15, scale: 1.02, filter: \"blur(8px)\" },\n          { x: 0, scale: 1, filter: \"blur(0px)\", duration: 0.2, ease: \"power2.out\" },\n          T + 0.2,\n        );\n\n        tl.to(\"#info3\", { opacity: 0, duration: 0.3, ease: \"power2.in\" }, 17.0);\n\n        // ===== OUTRO (18–21s) =====\n        tl.set(\"#scene1\", { opacity: 0 }, 18);\n        tl.set(\"#scene2\", { opacity: 0 }, 18);\n        tl.set(\"#outro-card\", { opacity: 1 }, 18);\n        tl.fromTo(\n          \"#outro-card .card-title\",\n          { y: 30, opacity: 0 },\n          { y: 0, opacity: 1, duration: 0.6, ease: \"power2.out\" },\n          18.3,\n        );\n        tl.fromTo(\n          \"#outro-card .card-sub\",\n          { y: 20, opacity: 0 },\n          { y: 0, opacity: 1, duration: 0.5, ease: \"power2.out\" },\n          18.7,\n        );\n        tl.to(\"#outro-card\", { opacity: 0, duration: 0.4, ease: \"power2.in\" }, 20.5);\n      })();\n    </script>\n  </body>\n</html>\n"}