Skip to content

Write HTML. Render video. Built for agents.

6.7 KB
Raw Blame
{"html":"<!doctype html>\n<!-- Demo plate for the catalog preview. Identical to yt-camera-move.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 yt-camera-move.html only. -->\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: #14161c;\n        overflow: hidden;\n      }\n      /* ---- yt-camera-move --------------------------------------------------\n         The creator-video punch-in as reusable GSAP helpers: dynamic\n         zoom + slide + 3D tilt/pan on any wrapper (a #video-wrap, a\n         sub-composition include, an image card). A talking-head recipe\n         is the default: cubic easing, ~11% zoom.\n\n         Optional: .yt-cm-defocus is an edge-blur overlay that pulses during\n         the move to sell the 3D feel — place it ABOVE the moving layer,\n         covering the same region. */\n      .yt-cm-defocus {\n        position: absolute;\n        inset: 0;\n        pointer-events: none;\n        opacity: 0;\n        backdrop-filter: blur(7px);\n        -webkit-backdrop-filter: blur(7px);\n        /* blur only the frame edges; center stays sharp */\n        -webkit-mask-image: radial-gradient(\n          ellipse 62% 58% at 50% 50%,\n          transparent 58%,\n          rgba(0, 0, 0, 0.85) 92%\n        );\n        mask-image: radial-gradient(\n          ellipse 62% 58% at 50% 50%,\n          transparent 58%,\n          rgba(0, 0, 0, 0.85) 92%\n        );\n      }\n      /* ---- self-preview stand-in \"footage\" (not part of the snippet) ---- */\n      #yt-cm-stage {\n        position: absolute;\n        inset: 0;\n        overflow: hidden;\n        background: linear-gradient(135deg, #35c8d9 0%, #2a7fff 55%, #7d5cff 100%);\n      }\n      /* Grid is the only cue that reveals the camera move on a flat gradient\n         plate; at 0.14/2px the zoom and slide were nearly imperceptible. */\n      #yt-cm-stage .yt-cm-grid {\n        position: absolute;\n        inset: -60px;\n        background:\n          repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.3) 0 3px, transparent 3px 120px),\n          repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0 3px, transparent 3px 120px);\n      }\n      #yt-cm-stage .yt-cm-label {\n        position: absolute;\n        inset: 0;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        font-family: \"Inter\", ui-sans-serif, sans-serif;\n        font-weight: 700;\n        font-size: 120px;\n        letter-spacing: -0.02em;\n        color: rgba(255, 255, 255, 0.92);\n      }\n    </style>\n  </head>\n  <body>\n    <!-- Self-preview wrapper. WIRING: copy the .yt-cm-defocus CSS (if you want\n         the edge blur), add <div class=\"yt-cm-defocus\" id=\"yt-my-defocus\"></div>\n         as a sibling ABOVE your moving layer, and copy the helpers into your\n         host script. Then drive any wrapper:\n\n           ytCameraMove(tl, \"#video-wrap\", 5.0, { zoom: 0.11, slideY: -24 });\n           ytDefocusPulse(tl, \"#yt-my-defocus\", 5.0, 1.2);\n           ytCameraReset(tl, \"#video-wrap\", 9.0);\n    -->\n    <div\n      id=\"yt-cm-root\"\n      data-composition-id=\"yt-camera-move\"\n      data-start=\"0\"\n      data-duration=\"4\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n    >\n      <div id=\"yt-cm-stage\">\n        <div class=\"yt-cm-grid\" data-layout-allow-overflow></div>\n        <div class=\"yt-cm-label\">FOOTAGE</div>\n      </div>\n      <div class=\"yt-cm-defocus\" id=\"yt-cm-defocus\"></div>\n      <div\n        id=\"yt-cm-drv\"\n        class=\"clip\"\n        data-start=\"0\"\n        data-duration=\"4\"\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        // ---- copy these helpers into the host script ----\n        // Punch-in / camera move on any wrapper. A talking-head base:\n        // zoom 0.11, cubic ease. tilt/pan are degrees (rotationX/rotationY,\n        // perspective is set for you); slideX/slideY in px; roll in degrees.\n        window.ytCameraMove = function (tl, target, at, opts) {\n          opts = opts || {};\n          var dur = opts.dur === undefined ? 1.2 : opts.dur;\n          gsap.set(target, {\n            transformPerspective: 1200,\n            transformOrigin: opts.origin || \"50% 50%\",\n          });\n          tl.to(\n            target,\n            {\n              scale: 1 + (opts.zoom === undefined ? 0.11 : opts.zoom),\n              x: opts.slideX || 0,\n              y: opts.slideY || 0,\n              rotationX: opts.tilt || 0,\n              rotationY: opts.pan || 0,\n              rotation: opts.roll || 0,\n              duration: dur,\n              ease: opts.ease || \"power2.inOut\",\n            },\n            at,\n          );\n        };\n        // Return to rest (same easing family).\n        window.ytCameraReset = function (tl, target, at, opts) {\n          opts = opts || {};\n          tl.to(\n            target,\n            {\n              scale: 1,\n              x: 0,\n              y: 0,\n              rotationX: 0,\n              rotationY: 0,\n              rotation: 0,\n              duration: opts.dur === undefined ? 1.2 : opts.dur,\n              ease: opts.ease || \"power2.inOut\",\n            },\n            at,\n          );\n        };\n        // Edge-defocus pulse synced to a move (overlay fades in then out).\n        window.ytDefocusPulse = function (tl, target, at, dur) {\n          dur = dur === undefined ? 1.2 : dur;\n          tl.to(target, { opacity: 1, duration: dur * 0.45, ease: \"power2.out\" }, at);\n          tl.to(target, { opacity: 0, duration: dur * 0.55, ease: \"power2.in\" }, at + dur * 0.45);\n        };\n\n        // Self-preview timeline (not part of the snippet you copy):\n        // punch in with a slight tilt, hold, return.\n        var tl = gsap.timeline({ paused: true });\n        window.ytCameraMove(tl, \"#yt-cm-stage\", 0.4, { zoom: 0.11, slideY: -26, tilt: 3, pan: -2 });\n        window.ytDefocusPulse(tl, \"#yt-cm-defocus\", 0.4, 1.2);\n        window.ytCameraReset(tl, \"#yt-cm-stage\", 2.5);\n        window.ytDefocusPulse(tl, \"#yt-cm-defocus\", 2.5, 1.2);\n        tl.set(\"#yt-cm-root\", { visibility: \"hidden\" }, 3.98);\n        window.__timelines[\"yt-camera-move\"] = tl;\n      })();\n    </script>\n  </body>\n</html>\n"}