Skip to content

Write HTML. Render video. Built for agents.

10.4 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      #yt-lcd-root {\n        /* ---- yt tokens: override in the host to re-skin the family ---- */\n        --yt-font: \"Inter\", -apple-system, sans-serif;\n        --yt-paper: #e9e9e6;\n        --yt-paper-dark: #1c1c1e;\n        --yt-ink: #1d1d1f;\n        --yt-ink-dark: #e8e8e4;\n        --yt-cyan: #35c8d9;\n        --yt-prism-r: #ff2a4d;\n        --yt-prism-b: #2a7fff;\n        --yt-scanline-alpha: 0.05;\n        --yt-scanline-gap: 3px;\n        --yt-grid-size: 28px;\n        --yt-grid-alpha: 0.06;\n        --yt-grain-alpha: 0.08;\n\n        position: relative;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n        background: var(--yt-paper);\n        font-family: var(--yt-font);\n      }\n      #yt-lcd-root.yt-dark {\n        background: var(--yt-paper-dark);\n      }\n      /* the LCD surface: scanlines + optional pixel grid + static grain */\n      #yt-lcd-scan {\n        position: absolute;\n        inset: -20px;\n        background: repeating-linear-gradient(\n          0deg,\n          rgba(0, 0, 0, var(--yt-scanline-alpha)) 0 1px,\n          transparent 1px var(--yt-scanline-gap)\n        );\n      }\n      .yt-dark #yt-lcd-scan {\n        background: repeating-linear-gradient(\n          0deg,\n          rgba(255, 255, 255, calc(var(--yt-scanline-alpha) * 1.4)) 0 1px,\n          transparent 1px var(--yt-scanline-gap)\n        );\n      }\n      #yt-lcd-grid {\n        position: absolute;\n        inset: 0;\n        background:\n          repeating-linear-gradient(\n            0deg,\n            rgba(0, 0, 0, var(--yt-grid-alpha)) 0 1px,\n            transparent 1px var(--yt-grid-size)\n          ),\n          repeating-linear-gradient(\n            90deg,\n            rgba(0, 0, 0, var(--yt-grid-alpha)) 0 1px,\n            transparent 1px var(--yt-grid-size)\n          );\n      }\n      .yt-dark #yt-lcd-grid {\n        background:\n          repeating-linear-gradient(\n            0deg,\n            rgba(255, 255, 255, var(--yt-grid-alpha)) 0 1px,\n            transparent 1px var(--yt-grid-size)\n          ),\n          repeating-linear-gradient(\n            90deg,\n            rgba(255, 255, 255, var(--yt-grid-alpha)) 0 1px,\n            transparent 1px var(--yt-grid-size)\n          );\n      }\n      #yt-lcd-grain {\n        position: absolute;\n        inset: 0;\n        opacity: var(--yt-grain-alpha);\n        background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E\");\n      }\n      /* the display text: prism copies behind the main fill, optional bow */\n      #yt-lcd-bow {\n        position: absolute;\n        inset: 0;\n        display: flex;\n        flex-direction: column;\n        align-items: center;\n        justify-content: center;\n        gap: 26px;\n      }\n      .yt-lcd-line {\n        position: relative;\n        font-weight: 700;\n        line-height: 1;\n        letter-spacing: -0.02em;\n        white-space: nowrap;\n      }\n      .yt-lcd-copy {\n        position: absolute;\n        inset: 0;\n      }\n      .yt-lcd-copy.r {\n        color: var(--yt-prism-r);\n      }\n      .yt-lcd-copy.b {\n        color: var(--yt-prism-b);\n      }\n      .yt-lcd-main {\n        position: relative;\n      }\n      #yt-lcd-sub {\n        font-weight: 500;\n        letter-spacing: 0.14em;\n        text-transform: uppercase;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"yt-lcd-root\"\n      data-composition-id=\"yt-lcd-background\"\n      data-start=\"0\"\n      data-duration=\"10\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <div id=\"yt-lcd-scan\" data-layout-allow-overflow></div>\n      <div id=\"yt-lcd-grid\"></div>\n      <div id=\"yt-lcd-grain\"></div>\n      <div id=\"yt-lcd-bow\"></div>\n      <div\n        id=\"yt-lcd-drv\"\n        class=\"clip\"\n        data-start=\"0\"\n        data-duration=\"10\"\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          scheme: \"light\", // \"light\" | \"dark\" (light/dark toggle)\n          title: \"yt-lcd\",\n          subtitle: \"background 01\",\n          fontSize: 230,\n          subSize: 34,\n          color: null, // null = scheme ink (AA). Cyan \"#35c8d9\" is dark-scheme only: 1.66:1 on light paper fails AA\n          blur: 2.2, // resting text blur px (blur amount)\n          prism: { enabled: true, offset: 3 }, // chromatic fringe (chromatic fringe)\n          bow: { enabled: true, deg: 7 }, // perspective bow (safe CRT-bow variant)\n          grid: { enabled: true }, // pixel grid (pixel grid)\n          scanDrift: true, // slow scanline scroll for life\n          animationIn: true,\n          animationOut: true,\n        };\n\n        var DUR = 10;\n        /* the yt- family improvement: in/out durations auto-scale to block\n           length (animations adjust to the layer length) */\n        function clamp(v, lo, hi) {\n          return Math.min(hi, Math.max(lo, v));\n        }\n        var IN = clamp(DUR * 0.08, 0.3, 0.8);\n        var OUT = clamp(DUR * 0.06, 0.25, 0.6);\n\n        var root = document.getElementById(\"yt-lcd-root\");\n        var bow = document.getElementById(\"yt-lcd-bow\");\n        var grid = document.getElementById(\"yt-lcd-grid\");\n        var scan = document.getElementById(\"yt-lcd-scan\");\n\n        if (CONFIG.scheme === \"dark\") root.classList.add(\"yt-dark\");\n        if (!CONFIG.grid.enabled) grid.style.display = \"none\";\n\n        var mainColor =\n          CONFIG.color || (CONFIG.scheme === \"dark\" ? \"var(--yt-ink-dark)\" : \"var(--yt-ink)\");\n\n        /* build a line: prism copies behind + main fill */\n        function buildLine(text, size, idBase, prismOn) {\n          var line = document.createElement(\"div\");\n          line.className = \"yt-lcd-line\";\n          line.style.fontSize = size + \"px\";\n          [\"r\", \"b\"].forEach(function (ch) {\n            if (!CONFIG.prism.enabled || !prismOn) return;\n            var c = document.createElement(\"div\");\n            c.className = \"yt-lcd-copy \" + ch;\n            c.id = idBase + \"-\" + ch;\n            c.textContent = text;\n            line.appendChild(c);\n          });\n          var main = document.createElement(\"div\");\n          main.className = \"yt-lcd-main\";\n          main.id = idBase + \"-main\";\n          main.textContent = text;\n          main.style.color = mainColor;\n          line.appendChild(main);\n          return line;\n        }\n\n        var titleLine = buildLine(CONFIG.title, CONFIG.fontSize, \"yt-lcd-t\", true);\n        bow.appendChild(titleLine);\n        if (CONFIG.subtitle) {\n          var sub = buildLine(\n            CONFIG.subtitle,\n            CONFIG.subSize,\n            \"yt-lcd-s\",\n            false,\n          ); /* fringe is title-only */\n          sub.id = \"yt-lcd-sub\";\n          bow.appendChild(sub);\n        }\n        if (CONFIG.bow.enabled) {\n          bow.style.transform = \"perspective(950px) rotateX(\" + CONFIG.bow.deg + \"deg)\";\n        }\n\n        var O = CONFIG.prism.offset;\n        var tl = gsap.timeline({ paused: true });\n\n        /* entrance: board fades, text focuses in from heavy blur while the\n           prism fringe settles from wide to resting offset */\n        if (CONFIG.animationIn) {\n          tl.from(root, { opacity: 0, duration: IN, ease: \"power2.out\" }, 0);\n          gsap.set(bow, { opacity: 0, filter: \"blur(16px)\" });\n          tl.to(bow, { opacity: 1, duration: IN * 1.4, ease: \"power2.out\" }, IN * 0.4);\n          tl.to(\n            bow,\n            { filter: \"blur(\" + CONFIG.blur + \"px)\", duration: IN * 2.2, ease: \"power2.out\" },\n            IN * 0.4,\n          );\n          if (CONFIG.prism.enabled) {\n            gsap.set(\".yt-lcd-copy.r\", { x: -O * 4, opacity: 0.5 });\n            gsap.set(\".yt-lcd-copy.b\", { x: O * 4, opacity: 0.5 });\n            tl.to(\n              \".yt-lcd-copy.r\",\n              { x: -O, opacity: 0.85, duration: IN * 2.2, ease: \"power2.out\" },\n              IN * 0.4,\n            );\n            tl.to(\n              \".yt-lcd-copy.b\",\n              { x: O, opacity: 0.85, duration: IN * 2.2, ease: \"power2.out\" },\n              IN * 0.4,\n            );\n          }\n        } else {\n          gsap.set(bow, { filter: \"blur(\" + CONFIG.blur + \"px)\" });\n          if (CONFIG.prism.enabled) {\n            gsap.set(\".yt-lcd-copy.r\", { x: -O, opacity: 0.85 });\n            gsap.set(\".yt-lcd-copy.b\", { x: O, opacity: 0.85 });\n          }\n        }\n\n        /* ambient: slow scanline drift + a breath of prism wobble */\n        if (CONFIG.scanDrift) {\n          tl.to(\n            scan,\n            {\n              y: 14,\n              duration: 3.1,\n              ease: \"sine.inOut\",\n              yoyo: true,\n              repeat: Math.max(1, Math.floor((DUR - 1) / 3.1) - 0),\n            },\n            0.5,\n          );\n        }\n        if (CONFIG.prism.enabled) {\n          tl.to(\n            \".yt-lcd-copy.r\",\n            { x: -O - 1.2, duration: 2.4, ease: \"sine.inOut\", yoyo: true, repeat: 2 },\n            2.0,\n          );\n          tl.to(\n            \".yt-lcd-copy.b\",\n            { x: O + 1.2, duration: 2.4, ease: \"sine.inOut\", yoyo: true, repeat: 2 },\n            2.0,\n          );\n        }\n\n        /* exit + hard kill */\n        if (CONFIG.animationOut) {\n          tl.to(root, { opacity: 0, duration: OUT, ease: \"power2.in\" }, DUR - OUT - 0.05);\n        }\n        tl.set(root, { visibility: \"hidden\" }, DUR - 0.02);\n\n        window.__timelines[\"yt-lcd-background\"] = tl;\n      })();\n    </script>\n  </body>\n</html>\n"}