Skip to content

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

4.5 KB
Raw Blame
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Node Network</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; overflow: hidden;
    font-family: "Inter", system-ui, Arial, sans-serif;
    background:
      radial-gradient(900px 700px at 50% 50%, #0b1722 0%, #060a10 70%);
  }
  /* grid */
  #grid {
    position: absolute; inset: -2px;
    background-image:
      linear-gradient(rgba(90,150,210,0.10) 1px, transparent 1px),
      linear-gradient(90deg, rgba(90,150,210,0.10) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(closest-side at 50% 50%, #000 60%, transparent 100%);
    -webkit-mask-image: radial-gradient(closest-side at 50% 50%, #000 60%, transparent 100%);
  }
  #scene { position: absolute; inset: 0; }
  svg.links { position: absolute; inset: 0; width: 100%; height: 100%; }
  .link { stroke: #3aa0ff; stroke-width: 3; opacity: 0.5; filter: drop-shadow(0 0 6px rgba(58,160,255,0.8)); }
  .hub {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    width: 190px; height: 190px; border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #6fc0ff, #1c7fe0 70%);
    box-shadow: 0 0 70px rgba(40,150,255,0.9), inset 0 2px 8px rgba(255,255,255,0.5);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; letter-spacing: 0.14em; font-size: 30px;
    will-change: transform;
  }
  .node {
    position: absolute; width: 92px; height: 92px; border-radius: 50%;
    background: linear-gradient(180deg, #20262e, #11151b);
    border: 1px solid rgba(120,180,240,0.4);
    box-shadow: 0 0 26px rgba(40,130,220,0.5);
    display: flex; align-items: center; justify-content: center;
    transform: translate(-50%,-50%); will-change: transform, opacity;
  }
  .node svg { width: 48px; height: 48px; stroke: #bfe2ff; fill: none; stroke-width: 1.6; }
</style>
</head>
<body>
  <div id="root" data-composition-id="root" data-start="0" data-duration="6" data-track-index="0" data-width="1920" data-height="1080">
    <div id="grid" class="clip" data-start="0" data-duration="6" data-track-index="0"></div>
    <div id="scene" class="clip" data-start="0" data-duration="6" data-track-index="1">
      <svg class="links" id="links" viewBox="0 0 1920 1080" preserveAspectRatio="none"></svg>
      <div class="hub" id="hub">COUNCIL</div>
    </div>
  </div>
  <script>
    const cx = 960, cy = 540, R = 320, N = 6;
    const scene = document.getElementById("scene");
    const links = document.getElementById("links");
    const nodes = [];
    for (let i = 0; i < N; i++) {
      const a = (-90 + i * (360 / N)) * Math.PI / 180;
      const x = cx + R * Math.cos(a), y = cy + R * Math.sin(a);
      const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
      line.setAttribute("x1", cx); line.setAttribute("y1", cy);
      line.setAttribute("x2", x); line.setAttribute("y2", y);
      line.setAttribute("class", "link");
      links.appendChild(line);
      const node = document.createElement("div");
      node.className = "node";
      node.style.left = x + "px"; node.style.top = y + "px";
      node.innerHTML = '<svg viewBox="0 0 24 24"><rect x="5" y="8" width="14" height="10" rx="3"/><circle cx="9" cy="13" r="1.3" fill="#bfe2ff"/><circle cx="15" cy="13" r="1.3" fill="#bfe2ff"/><path d="M12 4v4"/></svg>';
      scene.appendChild(node);
      nodes.push({ node, line });
    }

    const tl = gsap.timeline({ paused: true });
    tl.from("#grid", { opacity: 0, scale: 1.1, duration: 1.0, ease: "power2.out" }, 0);
    tl.from("#hub", { scale: 0, opacity: 0, duration: 0.8, ease: "back.out(1.7)" }, 0.3);
    nodes.forEach((o, i) => {
      gsap.set(o.line, { drawSVG: undefined });
      tl.from(o.node, { scale: 0, opacity: 0, duration: 0.6, ease: "back.out(1.8)" }, 0.7 + i * 0.12);
      tl.from(o.line, { opacity: 0, duration: 0.5 }, 0.7 + i * 0.12);
    });
    // pulse the hub + slow orbit drift
    tl.to("#hub", { scale: 1.06, duration: 0.9, ease: "sine.inOut", yoyo: true, repeat: 2 }, 1.6);
    tl.to(".link", { opacity: 0.85, duration: 0.52, stagger: 0.05, yoyo: true, repeat: 2, ease: "sine.inOut" }, 1.8);

    window.__timelines = window.__timelines || {};
    window.__timelines["root"] = tl;
    if (location.hash === "#play") { tl.play(); }
  </script>
</body>
</html>