Skip to content

Herk Edit Kit by Nate Herk: edit videos, reels, and YouTube Shorts with Codex or Claude Code. 15 skills, transcript-driven cuts, storytelling, 406 motion-graphics cards, and HyperFrames templates.

4.5 KB
Raw Blame
<!--
  Ambient golden-spiral layer — sits faintly behind every section.
  Left-zone golden rectangle with recursive subdivision + quarter-arc spiral.
  Breathing opacity yoyo (sine.inOut) so it never freezes.
-->

<script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>

<div
  id="ambient-root"
  data-composition-id="ambient-spiral"
  data-start="0"
  data-duration="37.67"
  data-width="1920"
  data-height="1080"
  style="position: absolute; inset: 0; pointer-events: none;"
>
  <style>
    [data-composition-id="ambient-spiral"] .amb-wrap {
      position: absolute;
      left: 60px;
      top: 80px;
      width: 580px;
      height: 920px;
      opacity: 0;
      filter: drop-shadow(0 0 24px rgba(55, 189, 248, 0.25));
    }
    [data-composition-id="ambient-spiral"] .amb-wrap svg {
      width: 100%;
      height: 100%;
      display: block;
    }
    [data-composition-id="ambient-spiral"] .amb-rect-stroke {
      stroke: rgba(55, 189, 248, 0.55);
      stroke-width: 1.2;
      fill: none;
    }
    [data-composition-id="ambient-spiral"] .amb-spiral {
      stroke: rgba(55, 189, 248, 0.75);
      stroke-width: 1.6;
      fill: none;
      stroke-linecap: round;
    }
  </style>

  <div class="amb-wrap">
    <!-- Golden rectangle (580 x 920, ratio ~1:1.586). Rendered in its own 580x920 viewBox.
         Subdivisions: classic φ cascade from the larger axis (920). Squares land on the
         left side so the spiral reads as a recognizable Fibonacci curl. -->
    <svg viewBox="0 0 580 920" preserveAspectRatio="none">
      <!-- Outer golden-ish rectangle -->
      <rect class="amb-rect-stroke" x="1" y="1" width="578" height="918"/>

      <!-- Subdivision lines (from largest square cascade).
           Square A: 580 x 580 at top  (biggest square, occupies y 0..580).
           Remaining strip: 580 x 340 below.
           Square B inside strip: 340 x 340 at left (x 0..340, y 580..920).
           Remaining: 240 x 340 at right (x 340..580, y 580..920).
           Square C: 240 x 240 at bottom of that (x 340..580, y 680..920).
           Remaining: 240 x 100 at top of that (x 340..580, y 580..680).
           Square D: 100 x 100 at right (x 480..580, y 580..680).
           Keep going one more for texture. -->
      <line class="amb-rect-stroke" x1="0" y1="580" x2="580" y2="580"/>
      <line class="amb-rect-stroke" x1="340" y1="580" x2="340" y2="920"/>
      <line class="amb-rect-stroke" x1="340" y1="680" x2="580" y2="680"/>
      <line class="amb-rect-stroke" x1="480" y1="580" x2="480" y2="680"/>

      <!-- Spiral quarter-arcs per square. Arc from one corner to the orthogonal corner. -->
      <!-- Square A: center at (580, 580) [bottom-right of square], radius 580, from (580, 0) sweeping to (0, 580) -->
      <path class="amb-spiral" d="M 580 0 A 580 580 0 0 0 0 580"/>
      <!-- Square B: center (340, 580), radius 340, from (0, 580) sweeping to (340, 920) -->
      <path class="amb-spiral" d="M 0 580 A 340 340 0 0 0 340 920"/>
      <!-- Square C: center (340, 680), radius 240, from (340, 920) sweeping to (580, 680) -->
      <path class="amb-spiral" d="M 340 920 A 240 240 0 0 0 580 680"/>
      <!-- Square D: center (480, 680), radius 100, from (580, 680) sweeping to (480, 580) -->
      <path class="amb-spiral" d="M 580 680 A 100 100 0 0 0 480 580"/>
    </svg>
  </div>

  <script>
    (function () {
      window.__timelines = window.__timelines || {};
      const tl = gsap.timeline({ paused: true });

      const wrap = document.querySelector('[data-composition-id="ambient-spiral"] .amb-wrap');

      // Fade in slow over first 2s.
      tl.fromTo(
        wrap,
        { opacity: 0 },
        { opacity: 0.14, duration: 2.2, ease: "power2.out" },
        0
      );

      // Breathing yoyo — sine.inOut 3.8s, bounded repeat count.
      // Window: 2.2s (fade-in end) → 34.94s (outro bump). Available = 32.74s.
      // Math.floor(32.74 / 3.8) - 1 = 7 → 8 total plays × 3.8s = 30.4s (fits).
      tl.to(wrap, {
        opacity: 0.10,
        duration: 3.8,
        ease: "sine.inOut",
        yoyo: true,
        repeat: 7,
      }, 2.2);

      // Outro: bump the ambient up a notch when section 06 starts so the spiral is the hero.
      // Section 06 on master = 34.94. Ambient local time is master time (start=0, duration=full).
      tl.to(wrap, { opacity: 0.85, duration: 0.5, ease: "power2.out" }, 34.94);

      // Anchor — Law 11
      tl.to({}, { duration: 37.67 }, 0);

      window.__timelines["ambient-spiral"] = tl;
    })();
  </script>
</div>