Skip to content

AbubakrChan/product-launch-motion / legacy

product-launch-motion-v1

Verified

Legacy v1 (voiceover-led, GSAP + HyperFrames). Use when making, directing or rescuing a product launch video, promo, teaser, demo reel, sizzle, feature-announcement film or animated product explainer built from code — and when an existing one looks basic, reads as a slideshow, has reveals that miss the voiceover, an invisible cursor, an inaudible sound effect, a clipped or too-quiet mix, or every video coming out looking the same. Covers SaaS, apps, hardware, e-commerce, dev tools, services. Keywords include motion design, storyboard, voiceover sync, kinetic typography, GSAP, HyperFrames, Remotion, film grain, LUFS, ffmpeg.

FileKindSize
CASE-STUDY.mdmarkdown12.8 KB
SKILL.mdskill md17.4 KB
assets/BRIEF.mdmarkdown3.0 KB
assets/STORYBOARD.mdmarkdown2.7 KB
assets/cues.example.jsonconfig3.2 KB
assets/film.example.jsonconfig3.4 KB
assets/frame-skeleton.htmlother17.3 KB
evals/BASELINE.mdmarkdown7.5 KB
evals/evals.jsonconfig5.3 KB
film-preview.webpbinary975.7 KB
references/01-renderer-contract.mdmarkdown14.8 KB
references/02-story-and-truth.mdmarkdown20.7 KB
references/03-word-locked-sync.mdmarkdown9.2 KB
references/04-motion-grammar.mdmarkdown19.6 KB
references/05-camera-3d-cursor.mdmarkdown12.4 KB
references/06-look-and-grade.mdmarkdown18.3 KB
references/07-sound-and-master.mdmarkdown10.3 KB
references/08-qa-and-direction.mdmarkdown11.7 KB
references/09-shot-catalog.mdmarkdown38.9 KB
references/10-traps.mdmarkdown14.6 KB
references/11-creative-direction.mdmarkdown17.4 KB
references/12-deliverables.mdmarkdown7.1 KB
scripts/assemble.mjsexecutablescript9.3 KB
scripts/level-sfx.mjsexecutablescript8.5 KB
scripts/master.shexecutablescript3.8 KB
scripts/transitions.mjsexecutablescript7.2 KB
scripts/verify-cue.shexecutablescript3.4 KB
scripts/wire-audio.mjsexecutablescript5.3 KB
scripts/wire-grade.mjsexecutablescript9.7 KB
scripts/word-timings.mjsexecutablescript4.6 KB
still-1.jpgbinary16.9 KB

scripts/wire-audio.mjs

View on GitHub
#!/usr/bin/env node
// wire-audio.mjs — mount a music bed and a table of SFX cues into an assembled film.
//
// Why this exists: cue times are authored FRAME-RELATIVE ("0.27s into the prompt shot"),
// because that is the only way they survive a re-order or a re-cut upstream. They have to
// be resolved against each frame's real start time, which is only known after the index
// has been assembled and transitions injected. So this runs late, reads the real starts
// out of the assembled index, and writes absolute times.
//
// Idempotent: it strips the block it wrote last time before writing a new one, so it is
// always safe to re-run — which you must, after every re-assemble, because the index is
// generated and your block is not in the generator.
//
// usage:
//   node scripts/wire-audio.mjs [--index index.html] [--cues audio/cues.json] [--dry]

import { readFileSync, writeFileSync, existsSync } from "node:fs";

const argv = process.argv.slice(2);
// `--help` prints the header comment above. One source of truth for the usage text, and it
// exits 0 — a --help that exits non-zero breaks every Makefile and CI job that wraps it.
if (argv.includes("--help") || argv.includes("-h")) {
  const doc = [];
  for (const line of readFileSync(new URL(import.meta.url), "utf8").split("\n").slice(1)) {
    if (!line.startsWith("//")) break;
    doc.push(line.replace(/^\/\/ ?/, ""));
  }
  console.log(doc.join("\n").trim());
  process.exit(0);
}

const flag = (name, fallback) => {
  const i = argv.indexOf(`--${name}`);
  return i === -1 ? fallback : argv[i + 1];
};
const INDEX = flag("index", "index.html");
const CUES = flag("cues", "audio/cues.json");
const dry = argv.includes("--dry");

const MARK_OPEN = "<!-- wire-audio:start -->";
const MARK_CLOSE = "<!-- wire-audio:end -->";
const TRACK_MUSIC = 900;
const TRACK_SFX_BASE = 910;

if (!existsSync(CUES)) {
  console.error(`no cue table at ${CUES} — copy assets/cues.example.json and edit it`);
  process.exit(1);
}

/** @type {{bed?:{src:string,volume:number}, sfxDir?:string, cues:Record<string,Array<object>>}} */
const config = JSON.parse(readFileSync(CUES, "utf8"));
const sfxDir = config.sfxDir ?? "audio/sfx";

let html = readFileSync(INDEX, "utf8");

// strip a previous run's block
html = html.replace(new RegExp(`\\n?[ \\t]*${MARK_OPEN}[\\s\\S]*?${MARK_CLOSE}`, "g"), "");

// Frame wrappers: any element carrying data-composition-src for a frame file. Their
// data-start/data-duration are the post-transition truth.
const frames = [];
for (const m of html.matchAll(
  /<div\b[^>]*data-composition-src="[^"]*?\/([^"/]+)\.html"[^>]*>/g,
)) {
  const tag = m[0];
  const id = m[1];
  const start = Number(tag.match(/data-start="([\d.]+)"/)?.[1] ?? NaN);
  const dur = Number(tag.match(/data-duration="([\d.]+)"/)?.[1] ?? NaN);
  if (!Number.isFinite(start) || !Number.isFinite(dur)) {
    throw new Error(`frame ${id}: missing data-start/data-duration on its index wrapper`);
  }
  frames.push({ id, start, dur });
}
if (frames.length === 0) {
  throw new Error(`no frame wrappers found in ${INDEX} — assemble the index first`);
}

const total = Math.max(...frames.map((f) => f.start + f.dur));
const lines = [`    ${MARK_OPEN}`];

if (config.bed?.src) {
  lines.push(`    <!-- music bed -->`);
  lines.push(
    `    <audio id="bed" class="clip" src="${config.bed.src}" data-start="0"` +
      ` data-duration="${total.toFixed(3)}" data-track-index="${TRACK_MUSIC}"` +
      ` data-volume="${config.bed.volume ?? 0.1}"></audio>`,
  );
}

lines.push(`    <!-- SFX: frame-relative cues resolved against real frame starts -->`);

let track = TRACK_SFX_BASE;
let count = 0;
const unknown = [];
const dropped = [];

for (const f of frames) {
  const cues = config.cues[f.id];
  if (!cues) {
    unknown.push(f.id);
    continue;
  }
  for (const cue of cues) {
    const { sfx, at, dur: d, vol = 0.3, word } = cue;
    const start = f.start + at;
    if (start >= total) {
      dropped.push(`${f.id}:${sfx}@${at}`);
      continue;
    }
    const dur = Math.min(d, total - start);
    // the renderer discovers media by id — an <audio> without one renders SILENT
    const id = `sfx-${f.id}-${sfx}-${String(count).padStart(2, "0")}`;
    const note = word ? ` <!-- "${word}" -->` : "";
    lines.push(
      `    <audio id="${id}" class="clip" src="${sfxDir}/${sfx}.mp3"` +
        ` data-start="${start.toFixed(3)}" data-duration="${dur.toFixed(3)}"` +
        ` data-track-index="${track++}" data-volume="${vol}"></audio>${note}`,
    );
    count++;
  }
}
lines.push(`    ${MARK_CLOSE}`);

const anchor = html.lastIndexOf("</body>");
if (anchor === -1) throw new Error(`${INDEX} has no </body>`);
const out = html.slice(0, anchor) + `\n${lines.join("\n")}\n  ` + html.slice(anchor);

console.log(
  `frames: ${frames.length} · total ${total.toFixed(3)}s · sfx cues ${count}` +
    (config.bed ? ` · bed vol ${config.bed.volume ?? 0.1}` : " · no bed"),
);
for (const f of frames) {
  console.log(`  ${f.id.padEnd(24)} start ${f.start.toFixed(3)}  dur ${f.dur.toFixed(3)}`);
}
if (unknown.length) console.log(`  (no cue entry: ${unknown.join(", ")})`);
if (dropped.length) console.log(`  (dropped, past end of film: ${dropped.join(", ")})`);

if (dry) process.exit(0);
writeFileSync(INDEX, out);
console.log(`✓ wired audio into ${INDEX}`);
console.log(`  next: verify a cue landed — ./scripts/verify-cue.sh <master.mp4> <start> <dur>`);
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall