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.

9.9 KB
Raw Blame
<template id="v04-audio-reactive-template">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
  <div
    data-composition-id="v04-audio-reactive"
    data-start="0"
    data-duration="8"
    data-width="1920"
    data-height="1080"
  >
    <div class="v04-root">
      <div class="v04-bg-pulse" id="v04-bg-pulse"></div>
      <div class="v04-grid" id="v04-grid"></div>

      <!-- Radial frequency ring: 72 bars arranged in a circle -->
      <div class="v04-ring" id="v04-ring"></div>

      <!-- Central waveform (svg) -->
      <svg class="v04-wave" viewBox="0 0 1920 1080" preserveAspectRatio="xMidYMid meet">
        <path id="v04-wave-path" d="" fill="none" stroke="#37bdf8" stroke-width="4" opacity="0.9"/>
        <path id="v04-wave-path-glow" d="" fill="none" stroke="#37bdf8" stroke-width="14" opacity="0.35" filter="blur(6px)"/>
      </svg>

      <!-- Center label -->
      <div class="v04-center">
        <div class="v04-kicker">BEAT SYNC ENGINE</div>
        <div class="v04-title">AUDIO-<span class="v04-hot">REACTIVE</span><br/>BY DEFAULT</div>
      </div>

      <!-- BPM readout -->
      <div class="v04-bpm">
        <div class="v04-bpm-num" id="v04-bpm-num">80</div>
        <div class="v04-bpm-lbl">BPM · LIVE</div>
      </div>

      <!-- Freq labels -->
      <div class="v04-freq v04-freq-l">BASS<br/><span>→ SCALE</span></div>
      <div class="v04-freq v04-freq-r">TREBLE<br/><span>→ GLOW</span></div>
    </div>

    <style>
      [data-composition-id="v04-audio-reactive"] {
        position: absolute;
        inset: 0;
        overflow: hidden;
      }
      [data-composition-id="v04-audio-reactive"] .v04-root {
        position: absolute;
        inset: 0;
        background: radial-gradient(ellipse 80% 70% at 50% 50%, #0a1c2e 0%, #050b13 70%, #02060c 100%);
      }
      [data-composition-id="v04-audio-reactive"] .v04-bg-pulse {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 1600px;
        height: 1600px;
        transform: translate(-50%, -50%) scale(1);
        background: radial-gradient(circle, rgba(55,189,248,0.15) 0%, transparent 50%);
        will-change: transform, opacity;
      }
      [data-composition-id="v04-audio-reactive"] .v04-grid {
        position: absolute;
        inset: -60px;
        background-image:
          linear-gradient(rgba(55,189,248,0.08) 1px, transparent 1px),
          linear-gradient(90deg, rgba(55,189,248,0.08) 1px, transparent 1px);
        background-size: 60px 60px;
        will-change: transform, opacity;
      }
      [data-composition-id="v04-audio-reactive"] .v04-ring {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 820px;
        height: 820px;
        transform: translate(-50%, -50%);
        will-change: transform;
      }
      [data-composition-id="v04-audio-reactive"] .v04-bar {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 6px;
        background: linear-gradient(180deg, #37bdf8 0%, rgba(55,189,248,0.3) 100%);
        transform-origin: 50% 0%;
        border-radius: 3px;
        will-change: transform, height;
        box-shadow: 0 0 8px rgba(55,189,248,0.5);
      }
      [data-composition-id="v04-audio-reactive"] .v04-wave {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
      }
      [data-composition-id="v04-audio-reactive"] .v04-center {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        text-align: center;
        z-index: 2;
      }
      [data-composition-id="v04-audio-reactive"] .v04-kicker {
        font-family: "Roboto Mono", monospace;
        font-weight: 500;
        font-size: 22px;
        letter-spacing: 0.42em;
        color: #37bdf8;
        margin-bottom: 20px;
        opacity: 0;
      }
      [data-composition-id="v04-audio-reactive"] .v04-title {
        font-family: "Montserrat", sans-serif;
        font-weight: 900;
        font-size: 130px;
        color: #f5f7fa;
        letter-spacing: -0.025em;
        line-height: 1;
        opacity: 0;
        text-shadow: 0 0 40px rgba(55,189,248,0.4);
      }
      [data-composition-id="v04-audio-reactive"] .v04-hot {
        color: #f09025;
        text-shadow: 0 0 40px rgba(240,144,37,0.6);
      }
      [data-composition-id="v04-audio-reactive"] .v04-bpm {
        position: absolute;
        top: 60px;
        right: 80px;
        text-align: right;
        opacity: 0;
      }
      [data-composition-id="v04-audio-reactive"] .v04-bpm-num {
        font-family: "Montserrat", sans-serif;
        font-weight: 900;
        font-size: 120px;
        line-height: 0.9;
        color: #f09025;
        text-shadow: 0 0 30px rgba(240,144,37,0.6);
      }
      [data-composition-id="v04-audio-reactive"] .v04-bpm-lbl {
        font-family: "Roboto Mono", monospace;
        font-weight: 700;
        font-size: 18px;
        letter-spacing: 0.32em;
        color: #37bdf8;
      }
      [data-composition-id="v04-audio-reactive"] .v04-freq {
        position: absolute;
        font-family: "Roboto Mono", monospace;
        font-weight: 700;
        font-size: 22px;
        color: #f5f7fa;
        letter-spacing: 0.22em;
        line-height: 1.4;
        opacity: 0;
      }
      [data-composition-id="v04-audio-reactive"] .v04-freq span {
        color: #37bdf8;
        font-weight: 500;
      }
      [data-composition-id="v04-audio-reactive"] .v04-freq-l {
        bottom: 90px;
        left: 80px;
      }
      [data-composition-id="v04-audio-reactive"] .v04-freq-r {
        bottom: 90px;
        right: 80px;
        text-align: right;
      }
    </style>

    <script>
      (function () {
        window.__timelines = window.__timelines || {};
        const tl = gsap.timeline({ paused: true });
        const root = '[data-composition-id="v04-audio-reactive"]';
        const ringEl = document.querySelector('[data-composition-id="v04-audio-reactive"] .v04-ring');

        // Seeded pseudo-random for bar heights
        const BARS = 72;
        function seed(i) { return Math.abs(Math.sin(i * 12.9898) * 43758.5453) % 1; }

        // Generate bars
        for (let i = 0; i < BARS; i++) {
          const bar = document.createElement("div");
          bar.className = "v04-bar";
          const angle = (i / BARS) * 360;
          const baseLen = 40 + seed(i) * 80;
          bar.style.transform = `translate(-50%, 0) rotate(${angle}deg) translateY(410px)`;
          bar.style.height = baseLen + "px";
          bar.dataset.base = baseLen;
          bar.dataset.angle = angle;
          ringEl.appendChild(bar);
        }
        const bars = ringEl.querySelectorAll(".v04-bar");

        // Ring enter 0 - 0.6
        tl.fromTo(`${root} .v04-ring`, { scale: 0.5, opacity: 0, rotate: -30 }, { scale: 1, opacity: 1, rotate: 0, duration: 0.7, ease: "back.out(1.2)" }, 0);

        // Center label reveal 0.4
        tl.to(`${root} .v04-kicker`, { opacity: 1, duration: 0.4 }, 0.4);
        tl.fromTo(`${root} .v04-title`, { opacity: 0, y: 30 }, { opacity: 1, y: 0, duration: 0.6, ease: "power3.out" }, 0.5);
        tl.to(`${root} .v04-bpm`, { opacity: 1, duration: 0.4 }, 0.6);
        tl.to(`${root} .v04-freq`, { opacity: 1, duration: 0.4, stagger: 0.1 }, 0.8);

        // Beat pulse loop: 80 BPM = 0.75s per beat. 8s = ~10 beats.
        // Start beats at 0.8s (after enter)
        const BEAT = 0.75;
        const START = 0.8;
        for (let b = 0; b < 10; b++) {
          const t = START + b * BEAT;

          // BG glow pulse (bass-coded)
          tl.to(`${root} .v04-bg-pulse`, { scale: 1.25, opacity: 1, duration: 0.12, ease: "power3.out" }, t);
          tl.to(`${root} .v04-bg-pulse`, { scale: 1.0, opacity: 0.7, duration: 0.5, ease: "power2.out" }, t + 0.12);

          // Grid pulse
          tl.to(`${root} .v04-grid`, { opacity: 1, duration: 0.1 }, t);
          tl.to(`${root} .v04-grid`, { opacity: 0.5, duration: 0.45 }, t + 0.12);

          // Ring rotation (continuous slow spin, accented per beat)
          tl.to(`${root} .v04-ring`, { rotate: "+=6", duration: BEAT, ease: "power1.inOut" }, t);

          // BPM number pulse
          tl.to(`${root} .v04-bpm-num`, { scale: 1.08, duration: 0.1, ease: "power2.out" }, t);
          tl.to(`${root} .v04-bpm-num`, { scale: 1.0, duration: 0.4, ease: "power2.out" }, t + 0.1);

          // Bars: each bar's height modulates with a different phase (looks "reactive")
          bars.forEach((bar, i) => {
            const base = parseFloat(bar.dataset.base);
            const mod = 0.5 + seed(i * 7 + b) * 1.6; // 0.5x - 2.1x
            const hi = base * mod;
            const lo = base * (0.7 + seed(i * 3 + b + 1) * 0.3);
            tl.to(bar, { height: hi + "px", duration: 0.12, ease: "power3.out" }, t);
            tl.to(bar, { height: lo + "px", duration: BEAT - 0.12, ease: "power2.out" }, t + 0.12);
          });
        }

        // Waveform SVG path animation
        const wavePath = document.getElementById("v04-wave-path");
        const wavePathGlow = document.getElementById("v04-wave-path-glow");
        const phaseObj = { phase: 0 };
        tl.to(phaseObj, {
          phase: Math.PI * 16,
          duration: 7.2,
          ease: "none",
          onUpdate: function () {
            const pts = [];
            const mid = 540;
            for (let x = 100; x <= 1820; x += 14) {
              const amp = 40 * Math.sin(x * 0.005 + phaseObj.phase);
              const jitter = 12 * Math.sin(x * 0.02 + phaseObj.phase * 2);
              pts.push(`${x},${mid + amp + jitter}`);
            }
            const d = "M " + pts.join(" L ");
            wavePath.setAttribute("d", d);
            wavePathGlow.setAttribute("d", d);
          },
        }, 0.6);

        // Final scale-out/fade-to-next 7.4 - 8
        tl.to(`${root} .v04-root`, { scale: 1.05, opacity: 0.85, duration: 0.5, ease: "power2.in" }, 7.5);

        window.__timelines["v04-audio-reactive"] = tl;
      })();
    </script>
  </div>
</template>