Skip to content

Play a finished motion-graphics ad in sync with the rough drafts it grew from, and export the breakdown as MP4.

3.8 KB
Raw Blame
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CTA Button Click</title>
<script src="../_vendor/gsap.min.js"></script>
<style>
  html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: transparent; }
  #root {
    position: relative; width: 1920px; height: 1080px; background: transparent;
    overflow: hidden; font-family: "Inter", -apple-system, "SF Pro Display", system-ui, Arial, sans-serif;
  }
  #wrap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
  /* focus ring that pulses on click */
  #ring {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 560px; height: 300px; border-radius: 40px;
    border: 1.5px solid rgba(255,255,255,0.14); box-shadow: 0 0 60px rgba(190,190,210,0.10) inset;
  }
  /* glossy obsidian CTA pill */
  #btn {
    position: relative; padding: 34px 86px; border-radius: 999px; cursor: pointer;
    background: linear-gradient(180deg, #2b2b2e 0%, #161618 46%, #0a0a0b 100%);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 2px 1px rgba(255,255,255,0.24), inset 0 -3px 6px rgba(0,0,0,0.85),
                0 0 70px rgba(200,200,220,0.18), 0 28px 55px rgba(0,0,0,0.55);
    will-change: transform; overflow: hidden;
  }
  #btn span {
    font-size: 52px; font-weight: 700; letter-spacing: -0.01em;
    background: linear-gradient(180deg, #ffffff 0%, #cfcfcf 45%, #9a9a9a 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  /* click ripple */
  #ripple {
    position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; border-radius: 50%;
    transform: translate(-50%, -50%) scale(0); background: rgba(255,255,255,0.18); pointer-events: none;
  }
  /* cursor */
  #cur { position: absolute; left: 0; top: 0; width: 44px; height: 44px; transform: translate(1180px, 760px); will-change: transform; z-index: 5; }
  #cur svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6)); }
</style>
</head>
<body>
  <div id="root" data-composition-id="root" data-start="0" data-duration="4" data-track-index="0" data-width="1920" data-height="1080">
    <div id="wrap" class="clip" data-start="0" data-duration="4" data-track-index="0">
      <div id="ring"></div>
      <div id="btn"><span>Publish</span><div id="ripple"></div></div>
    </div>
    <div id="cur" class="clip" data-start="0" data-duration="4" data-track-index="1">
      <svg viewBox="0 0 24 24"><path d="M4 2 4 20 9 15 12.5 22 15 21 11.5 14 18 14 Z" fill="#fff" stroke="#0a0a0a" stroke-width="0.7" stroke-linejoin="round"/></svg>
    </div>
  </div>
  <script>
    const tl = gsap.timeline({ paused: true });
    // button + ring settle in
    tl.from("#btn", { y: 40, opacity: 0, scale: 0.95, duration: 0.7, ease: "expo.out" }, 0.1);
    tl.from("#ring", { opacity: 0, scale: 0.9, duration: 0.7, ease: "expo.out" }, 0.2);
    // cursor glides to the button
    tl.to("#cur", { x: 980, y: 545, duration: 0.9, ease: "power3.inOut" }, 0.9);
    // press: button dips, ring pulses, ripple expands
    tl.to("#btn", { scale: 0.94, duration: 0.12, ease: "power2.in" }, 1.85);
    tl.to("#btn", { scale: 1, duration: 0.35, ease: "back.out(2.2)" }, 1.97);
    tl.fromTo("#ripple", { scale: 0, opacity: 0.5 }, { scale: 14, opacity: 0, duration: 0.7, ease: "power2.out" }, 1.9);
    tl.fromTo("#ring", { boxShadow: "0 0 60px rgba(190,190,210,0.10) inset" },
                       { boxShadow: "0 0 90px rgba(220,220,240,0.35) inset, 0 0 40px rgba(220,220,240,0.25)", duration: 0.3, yoyo: true, repeat: 1 }, 1.9);
    window.__timelines = window.__timelines || {};
    window.__timelines["root"] = tl;
    if (location.hash === "#play") { tl.repeat(-1).repeatDelay(0.9).play(); }
  </script>
</body>
</html>