Skip to content

Write HTML. Render video. Built for agents.

2.0 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=1920, height=1080">
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
  <style>
    html,
    body {
      margin: 0;
      width: 1920px;
      height: 1080px;
      overflow: hidden;
      background: #c9cfdc;
      font-family: sans-serif;
    }

    #main {
      position: relative;
      width: 1920px;
      height: 1080px;
      overflow: hidden;
      background: #c9cfdc;
    }

    .clip {
      position: absolute;
      inset: 0;
    }

    #word {
      position: absolute;
      left: 0;
      top: 380px;
      width: 1920px;
      text-align: center;
      font-size: 240px;
      line-height: 1;
      font-weight: 900;
      color: #06081a;
    }

    #bar {
      position: absolute;
      left: 0;
      top: 0;
      width: 260px;
      height: 1080px;
      background: #d8ff4a;
      opacity: 0;
    }
  </style>
</head>
<body>
  <div
    id="main"
    data-composition-id="gsap-redraw-start-and-overlap"
    data-width="1920"
    data-height="1080"
    data-start="0"
    data-duration="2.5"
  >
    <div id="scene" class="clip" data-start="0" data-duration="2.5">
      <div id="word">DRIFT</div>
      <div id="bar"></div>
    </div>
  </div>

  <script>
    window.__timelines = window.__timelines || {};

    var tl = gsap.timeline({ paused: true });
    // A slow drift with a short move inside it: after the move ends at 1.3 s the drift resumes, as in playback.
    tl.to("#word", { y: 200, duration: 2.5, ease: "none" }, 0);
    tl.to("#word", { y: -250, duration: 0.5, ease: "none" }, 0.8);
    // Starts 0.7 ms before frame 45 (1.5 s); only the from-vars make the bar visible.
    tl.fromTo(
      "#bar",
      { x: -260, opacity: 1 },
      { x: 1980, duration: 0.4, ease: "none", immediateRender: false },
      1.4993
    );
    tl.set("#bar", { opacity: 0 }, 1.95);

    window.__timelines["gsap-redraw-start-and-overlap"] = tl;
  </script>
</body>
</html>