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.

10.9 KB
Raw Blame
<template id="v08-caption-sync-template">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
  <div
    data-composition-id="v08-caption-sync"
    data-start="0"
    data-duration="7"
    data-width="1920"
    data-height="1080"
  >
    <div class="v08-root">
      <div class="v08-grid"></div>

      <div class="v08-kicker" id="v08-kicker">TRANSCRIBE. SYNC. SHIP.</div>

      <!-- Left: Waveform mock -->
      <div class="v08-wave" id="v08-wave">
        <div class="v08-wave-label">narration.wav</div>
        <div class="v08-wave-bars" id="v08-wave-bars"></div>
        <div class="v08-wave-playhead" id="v08-wave-playhead"></div>
      </div>

      <!-- Right: JSON transcript panel -->
      <div class="v08-json" id="v08-json">
        <div class="v08-json-label">transcript.json</div>
        <div class="v08-json-body" id="v08-json-body"><span class="v08-json-brace">[</span></div>
      </div>

      <!-- Center: Caption display -->
      <div class="v08-caption" id="v08-caption">
        <span class="v08-word" data-idx="0">Video</span>
        <span class="v08-word" data-idx="1">editing</span>
        <span class="v08-word" data-idx="2">used</span>
        <span class="v08-word" data-idx="3">to</span>
        <span class="v08-word" data-idx="4">take</span>
        <span class="v08-word v08-word-emph" data-idx="5">hours.</span>
        <br/>
        <span class="v08-word" data-idx="6">Now</span>
        <span class="v08-word" data-idx="7">it</span>
        <span class="v08-word" data-idx="8">takes</span>
        <span class="v08-word v08-word-emph" data-idx="9">one</span>
        <span class="v08-word v08-word-emph" data-idx="10">prompt.</span>
      </div>
    </div>

    <style>
      [data-composition-id="v08-caption-sync"] {
        position: absolute;
        inset: 0;
        overflow: hidden;
      }
      [data-composition-id="v08-caption-sync"] .v08-root {
        position: absolute;
        inset: 0;
        background: radial-gradient(ellipse 80% 70% at 50% 50%, #0f2033 0%, #07121c 65%, #030812 100%);
      }
      [data-composition-id="v08-caption-sync"] .v08-grid {
        position: absolute;
        inset: 0;
        background-image:
          linear-gradient(rgba(55,189,248,0.04) 1px, transparent 1px),
          linear-gradient(90deg, rgba(55,189,248,0.04) 1px, transparent 1px);
        background-size: 80px 80px;
      }
      [data-composition-id="v08-caption-sync"] .v08-kicker {
        position: absolute;
        top: 70px;
        left: 50%;
        transform: translateX(-50%);
        font-family: "Roboto Mono", monospace;
        font-weight: 700;
        font-size: 26px;
        letter-spacing: 0.38em;
        color: #37bdf8;
        opacity: 0;
      }
      [data-composition-id="v08-caption-sync"] .v08-wave {
        position: absolute;
        bottom: 120px;
        left: 80px;
        width: 520px;
        background: rgba(13,32,49,0.7);
        border: 1px solid rgba(55,189,248,0.25);
        border-radius: 12px;
        padding: 24px 22px 28px;
        opacity: 0;
      }
      [data-composition-id="v08-caption-sync"] .v08-wave-label {
        font-family: "Roboto Mono", monospace;
        font-weight: 500;
        font-size: 18px;
        letter-spacing: 0.22em;
        color: #96a2b6;
        margin-bottom: 18px;
      }
      [data-composition-id="v08-caption-sync"] .v08-wave-bars {
        display: flex;
        align-items: center;
        gap: 3px;
        height: 88px;
        position: relative;
      }
      [data-composition-id="v08-caption-sync"] .v08-wave-bar {
        flex: 1;
        background: #37bdf8;
        border-radius: 2px;
        opacity: 0.45;
      }
      [data-composition-id="v08-caption-sync"] .v08-wave-playhead {
        position: absolute;
        top: 60px;
        bottom: 28px;
        left: 22px;
        width: 3px;
        background: #f09025;
        box-shadow: 0 0 12px #f09025;
        opacity: 0;
      }
      [data-composition-id="v08-caption-sync"] .v08-json {
        position: absolute;
        bottom: 120px;
        right: 80px;
        width: 520px;
        background: rgba(13,32,49,0.7);
        border: 1px solid rgba(55,189,248,0.25);
        border-radius: 12px;
        padding: 24px 22px;
        max-height: 420px;
        overflow: hidden;
        opacity: 0;
      }
      [data-composition-id="v08-caption-sync"] .v08-json-label {
        font-family: "Roboto Mono", monospace;
        font-weight: 500;
        font-size: 18px;
        letter-spacing: 0.22em;
        color: #96a2b6;
        margin-bottom: 14px;
      }
      [data-composition-id="v08-caption-sync"] .v08-json-body {
        font-family: "Roboto Mono", monospace;
        font-size: 15px;
        line-height: 1.45;
        color: #8cd0ff;
        white-space: pre-wrap;
      }
      [data-composition-id="v08-caption-sync"] .v08-json-brace { color: #f09025; }
      [data-composition-id="v08-caption-sync"] .v08-json-entry { opacity: 0; }
      [data-composition-id="v08-caption-sync"] .v08-json-key { color: #c6613f; }
      [data-composition-id="v08-caption-sync"] .v08-json-num { color: #f09025; }
      [data-composition-id="v08-caption-sync"] .v08-json-str { color: #8cd0ff; }

      [data-composition-id="v08-caption-sync"] .v08-caption {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -60%);
        width: 1400px;
        text-align: center;
        font-family: "Montserrat", sans-serif;
        font-weight: 900;
        font-size: 96px;
        line-height: 1.15;
        letter-spacing: -0.01em;
      }
      [data-composition-id="v08-caption-sync"] .v08-word {
        display: inline-block;
        margin: 0 10px;
        color: #4a5568;
        opacity: 0.5;
        transition: none;
      }
      [data-composition-id="v08-caption-sync"] .v08-word.active {
        color: #f09025;
        opacity: 1;
        text-shadow: 0 0 30px rgba(240,144,37,0.6);
        transform: scale(1.04);
      }
      [data-composition-id="v08-caption-sync"] .v08-word.past {
        color: #f5f7fa;
        opacity: 0.95;
      }
      [data-composition-id="v08-caption-sync"] .v08-word-emph.active {
        font-size: 108px;
      }
    </style>

    <script>
      (function () {
        window.__timelines = window.__timelines || {};
        const tl = gsap.timeline({ paused: true });
        const root = '[data-composition-id="v08-caption-sync"]';

        // Word timings (scripted to match natural reading at ~2.5wps)
        // t_on, t_off in seconds from beat start (after 0.5s preamble)
        const words = [
          { idx: 0, t: 0.8, off: 1.15 },   // Video
          { idx: 1, t: 1.15, off: 1.5 },   // editing
          { idx: 2, t: 1.5, off: 1.7 },    // used
          { idx: 3, t: 1.7, off: 1.85 },   // to
          { idx: 4, t: 1.85, off: 2.1 },   // take
          { idx: 5, t: 2.1, off: 2.85 },   // hours.
          { idx: 6, t: 3.3, off: 3.65 },   // Now
          { idx: 7, t: 3.65, off: 3.8 },   // it
          { idx: 8, t: 3.8, off: 4.1 },    // takes
          { idx: 9, t: 4.1, off: 4.5 },    // one
          { idx: 10, t: 4.5, off: 5.4 },   // prompt.
        ];
        const wordTexts = ["Video","editing","used","to","take","hours","Now","it","takes","one","prompt"];

        // Waveform bars (seeded pseudorandom)
        const barsEl = document.getElementById("v08-wave-bars");
        function seed(i) { return Math.abs(Math.sin(i * 12.9898) * 43758.5453) % 1; }
        const BARS = 72;
        for (let i = 0; i < BARS; i++) {
          const b = document.createElement("div");
          b.className = "v08-wave-bar";
          const h = 10 + seed(i) * 70;
          b.style.height = h + "px";
          b.style.opacity = (0.35 + seed(i + 100) * 0.5).toFixed(2);
          barsEl.appendChild(b);
        }

        // Kicker + panels 0 - 0.6
        tl.to(`${root} .v08-kicker`, { opacity: 1, duration: 0.4 }, 0.1);
        tl.fromTo(`${root} .v08-wave`, { opacity: 0, x: -40 }, { opacity: 1, x: 0, duration: 0.5, ease: "power3.out" }, 0.25);
        tl.fromTo(`${root} .v08-json`, { opacity: 0, x: 40 }, { opacity: 1, x: 0, duration: 0.5, ease: "power3.out" }, 0.25);

        // Playhead visible 0.6
        tl.to(`${root} .v08-wave-playhead`, { opacity: 1, duration: 0.15 }, 0.6);

        // Playhead sweeps across waveform 0.7 - 5.5
        tl.fromTo(`${root} .v08-wave-playhead`, { left: "22px" }, { left: "calc(100% - 25px)", duration: 4.8, ease: "none" }, 0.7);

        // Waveform bar "activity" — bars near playhead flare
        const bars = barsEl.querySelectorAll(".v08-wave-bar");
        bars.forEach((bar, i) => {
          const trig = 0.7 + (i / BARS) * 4.8;
          tl.to(bar, { opacity: 1, duration: 0.06 }, trig);
          tl.to(bar, { opacity: 0.5, duration: 0.4 }, trig + 0.1);
        });

        // Word karaoke: toggle class "active" on trigger, "past" after
        const rootSel = '[data-composition-id="v08-caption-sync"]';
        words.forEach((w, i) => {
          const idxVal = w.idx;
          tl.call(function () {
            document.querySelectorAll('[data-composition-id="v08-caption-sync"] .v08-word.active').forEach((e) => {
              e.classList.remove("active");
              e.classList.add("past");
            });
            const el = document.querySelector('[data-composition-id="v08-caption-sync"] .v08-word[data-idx="' + idxVal + '"]');
            if (el) el.classList.add("active");
          }, null, w.t);
        });
        // Final: last word stays highlighted, then fade class
        tl.call(function () {
          document.querySelectorAll('[data-composition-id="v08-caption-sync"] .v08-word.active').forEach((e) => {
            e.classList.remove("active");
            e.classList.add("past");
          });
        }, null, words[words.length - 1].off);

        // JSON entries type in as words trigger
        const body = document.getElementById("v08-json-body");
        function addEntry(w, txt) {
          const div = document.createElement("div");
          div.className = "v08-json-entry";
          div.innerHTML = `  { <span class="v08-json-key">"w"</span>: <span class="v08-json-str">"${txt}"</span>, <span class="v08-json-key">"s"</span>: <span class="v08-json-num">${w.t.toFixed(2)}</span>, <span class="v08-json-key">"e"</span>: <span class="v08-json-num">${w.off.toFixed(2)}</span> },`;
          body.appendChild(div);
          // Scroll to bottom if overflows
          body.scrollTop = body.scrollHeight;
          gsap.fromTo(div, { opacity: 0, x: 10 }, { opacity: 1, x: 0, duration: 0.25, ease: "power2.out" });
        }
        words.forEach((w, i) => {
          tl.call(() => addEntry(w, wordTexts[i]), null, w.t);
        });

        // Subtle zoom-in emphasis on caption block
        tl.fromTo(`${root} .v08-caption`, { opacity: 0 }, { opacity: 1, duration: 0.4 }, 0.4);

        // Hold + exit
        tl.to(`${root} .v08-caption`, { scale: 1.02, duration: 0.5, ease: "power2.out" }, 5.6);

        window.__timelines["v08-caption-sync"] = tl;
      })();
    </script>
  </div>
</template>