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.

5.1 KB
Raw Blame
<template id="beat-3-karaoke-template">
  <div
    data-composition-id="beat-3-karaoke"
    data-start="0"
    data-duration="2.70"
    data-width="1920"
    data-height="1080"
  >
    <!-- Caption pill, bottom-center. Words are individual spans so we can
         flip the "active" class at each word's onset to produce karaoke fill. -->
    <div class="b3-pill">
      <div class="b3-tag">CC</div>
      <div class="b3-line">
        <!-- Word onsets (master time → local time; beat starts at master 5.94):
             or 5.94→0.00 · whether 6.30→0.36 · that's 6.40→0.46 ·
             subtitles 6.76→0.82 · down 7.02→1.08 · at 7.28→1.34 ·
             the 7.42→1.48 · bottom 7.70→1.76 · like 7.88→1.94 ·
             right 8.04→2.10 · here 8.30→2.36 -->
        <span class="w" data-at="0.00">or</span>
        <span class="w" data-at="0.36">whether</span>
        <span class="w" data-at="0.46">that's</span>
        <span class="w" data-at="0.82">subtitles</span>
        <span class="w" data-at="1.08">down</span>
        <span class="w" data-at="1.34">at</span>
        <span class="w" data-at="1.48">the</span>
        <span class="w" data-at="1.76">bottom,</span>
        <span class="w" data-at="1.94">like</span>
        <span class="w" data-at="2.10">right</span>
        <span class="w" data-at="2.36">here.</span>
      </div>
    </div>

    <style>
      [data-composition-id="beat-3-karaoke"] {
        position: absolute;
        inset: 0;
        overflow: hidden;
        font-family: "Inter", sans-serif;
      }
      [data-composition-id="beat-3-karaoke"] .b3-pill {
        position: absolute;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        gap: 20px;
        padding: 20px 40px 20px 24px;
        background: rgba(10, 12, 20, 0.72);
        backdrop-filter: blur(16px) saturate(1.2);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 22px;
        box-shadow:
          0 30px 80px rgba(0, 0, 0, 0.55),
          0 0 0 1px rgba(255, 255, 255, 0.04) inset;
        max-width: 1820px;
      }
      [data-composition-id="beat-3-karaoke"] .b3-tag {
        font-family: "JetBrains Mono", monospace;
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 0.18em;
        padding: 6px 12px;
        border-radius: 8px;
        background: rgba(217, 119, 87, 0.14);
        color: #d97757;
        border: 1px solid rgba(217, 119, 87, 0.35);
      }
      [data-composition-id="beat-3-karaoke"] .b3-line {
        display: flex;
        flex-wrap: nowrap;
        gap: 14px;
        font-size: 44px;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: rgba(255, 255, 255, 0.55);
      }
      [data-composition-id="beat-3-karaoke"] .b3-line .w {
        transition: none; /* tweens drive it */
        opacity: 0.55;
        transform-origin: 50% 80%;
      }
      [data-composition-id="beat-3-karaoke"] .b3-line .w.active {
        opacity: 1;
        color: #fff;
        text-shadow:
          0 0 16px rgba(217, 119, 87, 0.9),
          0 0 34px rgba(217, 119, 87, 0.45);
      }
    </style>

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>
    <script>
      (() => {
        window.__timelines = window.__timelines || {};
        const tl = gsap.timeline({ paused: true });
        const root = '[data-composition-id="beat-3-karaoke"]';
        const words = Array.from(document.querySelectorAll(
          `[data-composition-id="beat-3-karaoke"] .b3-line .w`
        ));

        // Pill entrance — slides up from below at local 0.00, cubic ease-out.
        tl.from(`[data-composition-id="beat-3-karaoke"] .b3-pill`,
          { y: 60, opacity: 0, duration: 0.45, ease: "power3.out" }, 0);
        tl.from(`[data-composition-id="beat-3-karaoke"] .b3-tag`,
          { scale: 0.6, opacity: 0, duration: 0.35, ease: "back.out(2)" }, 0.10);

        // Word stagger-in as a baseline (words appear slightly before each is
        // activated — reads as "text arriving, then getting spoken").
        words.forEach((w) => {
          const at = parseFloat(w.getAttribute("data-at"));
          tl.from(w,
            { y: 14, opacity: 0, duration: 0.22, ease: "power2.out" },
            Math.max(0.15, at - 0.08));
          // Flip the active class ON at the word's onset, using a pop.
          tl.add(() => w.classList.add("active"), at);
          tl.fromTo(w,
            { scale: 1.0 },
            { scale: 1.08, duration: 0.10, ease: "power2.out", yoyo: true,
              repeat: 1 },
            at);
          // Deactivate ~0.45s later so earlier words dim back to 55% opacity.
          tl.add(() => w.classList.remove("active"), at + 0.45);
        });

        // The last word ("here") keeps glow until the beat ends.
        tl.add(() => words[words.length - 1].classList.add("active"), 2.36);

        // No exit tweens — root composition moves on at master 8.64.

        tl.to({}, { duration: 2.70 }, 0);
        window.__timelines["beat-3-karaoke"] = tl;
      })();
    </script>
  </div>
</template>