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.
Add motion-showreel skill for beat-cut brand showreels
Nate Herk2930cb8ecee7
diff --git a/.agents/skills/motion-showreel/SKILL.md b/.agents/skills/motion-showreel/SKILL.mdnew file mode 100644index 0000000..c966f6b--- /dev/null+++ b/.agents/skills/motion-showreel/SKILL.md@@ -0,0 +1,190 @@+---+name: motion-showreel+description: Design and build a 10-30 second motion-design showreel or brand reel in the style of Nate's Opus 5.5 "CLAUDE / MOTION REEL": one brand motif transformed through labeled craft chapters, a persistent HUD, cuts locked to a 120-130 BPM grid, a sub-second flurry, and a held logo lockup that answers the opening. Use when asked for a showreel, sizzle reel, brand reel, motion reel, "a reel like the Opus one", "show off motion design for <brand>", a 15-second brand film cut to music, or to study why a reference reel works and rebuild that energy for another brand.+---++# Motion Showreel++A showreel promises that every frame was a decision. This skill turns that into a+repeatable build: pick one motif, push it through six or seven craft chapters that+each look nothing alike, cut on the beat, and end on the motif.++The style source is [the reference breakdown](references/reference-breakdown.md), a+measured second-by-second analysis of the reel this skill was built from. Read it first.+Techniques per chapter live in [the chapter library](references/chapter-library.md).++## The grammar++1. **One motif, transformed.** Pick the brand's most reduced element (a dot, a play+ triangle, a letter, a logo corner). It opens the reel, turns into each chapter's+ material, and closes the reel as punctuation in the lockup. Nearly every+ transition turns the current object into the next one. Hard cuts are reserved+ for the flurry.+2. **Labeled craft chapters.** Six or seven, each named in the HUD by the discipline+ it demonstrates (`01 · SQUASH & STRETCH`). Use the brand's own words when it has+ them (YouTube has "chapters" and an "end screen").+3. **Show the work.** Every chapter gets one tool overlay: a physics readout, a+ selection box with a cursor, a parameter panel, a bezier graph, or a brand-native+ equivalent (a search bar, a counter, a settings menu).+4. **Persistent HUD.** Corner crop marks, a title line top left, a spec line top+ right (`1920×1080 · 60P · 129 BPM`, blinking dot), timecode bottom left, a+ progress ruler with chapter gaps bottom center, and the chapter label bottom+ right. Mono caps, tracking 0.2em, about 16px. It flips ink/paper with the+ background. Start from [the HUD template](templates/hud.html).+5. **Ink, paper, one accent, and one held-back color.** The held-back color only+ appears in the climax flurry. Every chapter change flips value (dark/light) or+ saturation (neutral/full-bleed accent).+6. **Cut on the beat, animate on the off-beats.** 120-130 BPM. Every hard cut,+ flash, and invert lands within 2 frames of a grid line. One pre-drop gap (music+ ducked for half a beat) comes before the midpoint hit.+7. **Accelerate, then hold.** For 15s at about 129 BPM (32 beats): physics intro 4+ beats, type chapter 8 beats with an internal invert, three 4-beat chapters (drop+ in the middle), a flurry of about 6 cuts in 4 beats (one beat each, then half+ beats), then about 4 beats of lockup. Roughly 75% development, 13% flurry, and+ 12% resolve.+8. **Density breathes.** One object, then a wall of type, a grid of 100, thousands+ of particles, one hero object, the flurry, and one word again.+9. **Three type voices.** A heavy display face for statements, a contrasting accent+ voice (an italic serif, or the brand's UI face), and wide-tracked mono for the+ machine layer. Type also works as texture: repeated into wallpaper, banded, and+ inverted.+10. **Physical finish.** Squash and stretch, motion blur on fast moves, bloom on+ light-on-dark, slight chromatic fringe, grain, vignette, and a dot grid on dark+ frames. It should look photographed, not exported.+11. **Bookend.** The lockup resolves from noise, a rule draws, the subtitles type on+ with a block cursor, the motif lands as the final punctuation with a squash, and+ a quiet tagline arrives last.++## Workflow++Run the scripts from the kit root. They need Node 22+ and FFmpeg with ffprobe.++### 1. Study the reference (when one is given)++```sh+node .agents/skills/motion-showreel/scripts/analyze-reference.mjs path/to/reference.mp4 video-projects/my-reel/qa/reference --fps 6 --bpm 128+```++Read every contact sheet, then `report.txt` (cuts, luminance rhythm, RMS, onsets,+and cut offsets from the beat). Write the timeline down in the shape of the+reference breakdown.++### 2. Brand intake: `BRAND.md`++Collect exact colors (from the current logo file, not a blog), typography (the+proprietary face plus the closest free substitute), official logo SVGs, signature UI+and objects, and 3-5 verified facts with dates for kinetic type. Gather real+imagery the user owns or can use. Pick the motif and the held-back climax color.+Only use brand marks the user has the right to use for the intended purpose.++### 3. Chapter map: `STORYBOARD.md`++Create the project with `npm run new-video -- my-reel`, then fill in+[the storyboard template](templates/storyboard.md). For each chapter, record the+discipline label, the brand-native object, the tool overlay, the in-transform, the+out-transform, the value (dark/paper/accent), and the SFX. Before building:++- Freeze any frame in your head: does it read as the brand with the HUD covered?+- Does every transition transform the object, except the flurry cuts?+- Does the value flip at every chapter change?++### 4. Music and the beat grid++Read `docs/TOOLS-AND-API-KEYS.md` first. Music can be the user's own licensed track+or generated. Generation is a paid call, so confirm before running it:++```sh+node .agents/skills/motion-showreel/scripts/kie.mjs music --title "Reel" --style "punchy electronic showreel, instrumental, 128 bpm, starts instantly, riser into a big drop" --out video-projects/my-reel/assets/audio+node .agents/skills/motion-showreel/scripts/music-grid.mjs video-projects/my-reel/assets/audio/take-0.mp3 --bpm 128 --beats+```++`music-grid` prints the period, the **kick-band phase** (use it), and per-bar and+per-beat energy. The full-band phase can lock onto off-beat hats and put every+splice half a beat late; the script warns when the two disagree. In the per-beat+low-band column, find the riser, the drop (a jump of 10+ dB), the break, and the+return. Then splice 32 beats: intro and build (16, ending on the drop's downbeat),+drop (8), break (4, under the flurry), and the return hit plus a tail:++```sh+node .agents/skills/motion-showreel/scripts/splice-music.mjs take-0.mp3 --period 0.4644 --phase 0.085 --segments "4-28,48-56.7" --length 15 --gap 16 --out music-bed.wav+node .agents/skills/motion-showreel/scripts/music-grid.mjs music-bed.wav --bpm 129+node .agents/skills/motion-showreel/scripts/beatgrid.mjs --period 0.4644 --length 15 --chapters "01 Physics:4, 02 Type:8, 03 Grid:4, 04 Drop:4, 05 Lookdev:4, Flurry:4, 07 End:rest"+```++The re-measured bed's kick phase should be within about 25 ms of 0. Put the+measured BPM in the HUD (129, not 128). `beatgrid` prints the frame sheet for+`STORYBOARD.md`.++### 5. SFX and the mix++Generate a kit (paid, confirm first) with `scripts/sfx.mjs` (pops, clicks,+whooshes, glitch, ticks, shimmer, sub boom, final hit, and brand-native sounds), or+use the user's own library. Place cues on the beat sheet in an `events.json` and+premix:++```sh+node .agents/skills/motion-showreel/scripts/mix.mjs --bed music-bed.wav --events events.json --out master.wav+```++Use `master.wav` as the composition's single `<audio>` track. It targets -14 LUFS+and -1.2 dBTP.++### 6. Assets++- **Hero lookdev object.** Run `kie.mjs image --ref <logo.png>` (Seedream+ image-to-image keeps the silhouette), then `kie.mjs video --image <still>` for a+ 5s Kling camera move. Both are paid calls. Kling returns 24fps: speed it up and+ re-encode at 60fps all-intra (the command is in the header of `kie.mjs`).+- **Fonts.** Download them into the project's `assets/fonts/` and use `@font-face`.+ Never rely on system fonts.++### 7. Build (HyperFrames)++Load `hyperframes` and `gsap` before writing HTML. Read `MOTION_PHILOSOPHY.md`+(showreel pacing is its fast sizzle mode) and `video-storytelling` for+persistent-world camera moves. Build one `index.html` with one paused GSAP timeline.+Chapters are timed `.clip` layers, and the HUD sits on top.++- Every time comes from the beat sheet: `const B = (n) => n * PERIOD`.+- Put a **per-frame driver** on the timeline and make it a pure function of time:+ `tl.fromTo(drv, {t:0}, {t:END, duration:END, ease:'none', onUpdate:() => frame(drv.t)}, 0)`.+ Draw canvas effects (particles, noise, big grids) there from seeded values, never+ from `Math.random()` at draw time. Drive the HUD from the same function.+- Tween only transforms and opacity. Never tween `left/top/width/height`. To morph+ a dot into a tile, draw the final tile and scale it down into a circle+ (`border-radius: 128px / 72px` on a 256x144 tile), then tween back to scale 1.+- A property animated by several tweens across the reel (a shared flash layer)+ can stick on a backward seek. Compute it in the per-frame driver instead, and+ do the same for class swaps like an invert.+- Measure layout (`getBoundingClientRect`) once, at the top of the build, before+ any `immediateRender` tween applies a transform. Never measure inside `onUpdate`.+- `<video data-start>` must not sit inside a timed `.clip`. Put videos in an+ untimed wrapper, which you can still scale for push-ins.+- Staggered phases must finish before their cut: latest completion = start + max+ delay + duration. Check it on paper, then in a render strip.+- `background-clip: text` renders invisible in capture. Use solid fills and+ `text-shadow` for bloom.++### 8. Verify before calling it done++- `npx hyperframes lint`, then Studio preview, then a draft render (`hyperframes-cli`).+- Run `analyze-reference.mjs` on your own render with `--bpm` and `--phase`: cut+ offsets must be within about 35 ms of a beat or half beat, luminance must+ alternate by chapter, and the audio must show the pre-drop dip.+- Extract 10-frame strips across every transition and look at them. Snapshots+ miss stuck or ghost layers:+ `ffmpeg -i render.mp4 -vf "select='between(n\,440\,449)',scale=384:-1,tile=layout=5x2" -frames:v 1 -fps_mode passthrough strip.png`+- Brand test: pick 6 random frames. Each must read as the brand with the HUD covered.+- Loudness is about -14 LUFS. HyperFrames re-encodes audio slightly quieter, so+ remux `master.wav` into the render (see the header of `mix.mjs`).+- Save the evidence in `VERIFY.md`.++## Example brief++The skill's first test was a 15s YouTube reel: the red scrubber dot bounces on a+progress bar, scrubs into a laser, types "broadcast yourself" into a rebuilt search+bar, becomes eight dots, then a feed of real thumbnails, and bursts from a like button+into particles that spell a verified stat. It becomes a lacquer play button and a+Silver Creator Award, runs a flurry of Subscribe, Shorts, LIVE, Skip, and "+10+seconds", and lands as the play icon in the logo. Use it as a model for mapping+chapters to a brand's native objects, not as a template to copy.diff --git a/.agents/skills/motion-showreel/references/chapter-library.md b/.agents/skills/motion-showreel/references/chapter-library.mdnew file mode 100644index 0000000..df305ff--- /dev/null+++ b/.agents/skills/motion-showreel/references/chapter-library.md@@ -0,0 +1,45 @@+# Chapter library++Each entry covers the technique, how the reference used it, how to build it seek-safe in HyperFrames (GSAP on one paused timeline), and brand swaps. Pick 5-7 and chain them so each one's out-transform is the next one's in-transform.++## Physics: squash and stretch+- **Reference:** a red dot falls onto a tick ruler and bounces three times, with a ground ellipse and a POS/SCL/VEL readout on a leader line.+- **Build:** hand-key the bounce from the beat sheet (a contact on each beat). Fall uses `power2.in`, rise uses `power2.out`. On contact, set `scaleX 1.35 / scaleY 0.7` for 2-3 frames, then `elastic.out(1, 0.5)` back. While falling fast, stretch to `scaleY 1.3`. Compute the readout text in an `onUpdate` from the dot's current `y` and velocity (the difference from the previous frame), formatted to one decimal.+- **Out-transform:** the dot accelerates sideways into a laser line (`scaleX` to 200, `height` 4px, glow), which blooms to a full-frame flash (a white layer at opacity 1 for 2 frames), then becomes the paper of the next chapter.+- **Swaps:** a video scrubber dot on a progress bar (YouTube), a cursor dot (a SaaS app), a drop of liquid (a drink brand), a pin (maps).++## Kinetic type+- **Reference:** letters drop in out of order with overshoot and motion blur. A red selection box with W/H/SX numbers and a cursor drags the word bigger. A red italic serif aside plays against heavy grotesk caps. The key word repeats into outline wallpaper, which turns diagonal with red bands, then the frame inverts.+- **Build:** split words into `<span>`s. Stagger `y: -120 -> 0` with `back.out(2)`, 1-frame offsets in a shuffled order. Fake motion blur by tweening `filter: blur(6px) -> 0` together with a `scaleY` stretch. For the selection box, an absolutely positioned div with 8 handle squares follows the word's box (read the width once after `document.fonts.ready`) and a cursor SVG moves along. For wallpaper, generate 12 rows of the word with `-webkit-text-stroke` (outline). Rotate the container -12deg, slide alternate rows in opposite directions, and fill 2 rows with the accent. For the invert, one `tl.set` swaps a background layer and the text colors on the beat.+- **Swaps:** a search bar that types the phrase (YouTube, Google), a chat input (AI products), a price tag, a headline from the brand's first slogan.++## Letters to dots to grid (shape language)+- **Reference:** letters of DECISION become red dots one by one, the dots line up in a row of 8, and the row becomes a full-frame grid. A red wave ripples, circles morph to squares, then crosses, then triangles, and the camera tilts and pushes in.+- **Build:** a grid of divs (for example 16x9) with `border-radius`. The wave is a function of time and distance from an origin: in `onUpdate`, for each cell, `phase = t*speed - dist`, then set its scale, color mix, and radius from `phase`. That is seek-safe because it is a pure function of `t`. Shape morphs are `border-radius` 50% to 8% and a `clip-path` polygon. The camera is a parent with `perspective` and `rotateX`/`rotateZ`.+- **Swaps:** a 16:9 thumbnail grid (YouTube) with real images fading into cells, app icons, product SKUs, a pixel mosaic of the logo.++## Particle system+- **Reference:** a lens iris flashes on the midpoint drop, particles burst in red, white, and blue on navy, swirl, and condense into a ring.+- **Build:** one `<canvas>` of 2,000-4,000 particles. Precompute seeded start positions and targets (any shape: a ring, a logo from sampled pixels of an image, a number). Draw every particle from `lerp(start, target, ease(clamp((t - t0)/d - delay_i)))` plus a curl offset `sin(i*1.7 + t*3)*amp*(1 - progress)`. Redraw in a proxy tween's `onUpdate` so the frame is a pure function of `tl.time()`. Use additive blending (`globalCompositeOperation = 'lighter'`) for glow.+- **Out-transform:** particles condense into the silhouette of the next chapter's hero object, then the real object crossfades in within 2-3 frames of a flash.+- **Swaps:** a like-button burst (social), confetti of product colors, data points, stars.++## Lookdev / hero object+- **Reference:** an iridescent chrome torus SDF-morphs into blobs and a cube, with a parameter readout (SDF, SMOOTH UNION, MORPH, IOR, ROUGH), and pushes into the lens.+- **Build:** a generated photoreal still (seedream i2i from the logo) plus a Kling camera move, sped up about 3x and re-encoded at 60fps all-intra. For a second material, cut or crossfade to another material of the same object (lacquer to chrome, silver to gold). Put a readout on a leader line with numbers that count up in `onUpdate`. The out push is `scale 1 -> 3` plus `blur 0 -> 20px` over the last half beat, with a hard cut on the beat.+- **Swaps:** a creator award plaque (YouTube), a bottle or can, a device, a logo sculpture.++## Easing graph+- **Reference:** a cubic-bezier(0.83, 0, 0.17, 1) curve on paper, with a ball riding it and leaving onion-skin ghosts.+- **Build:** an SVG path with `stroke-dasharray` draw-on. The ball position comes from evaluating the bezier at `ease(t)`, and the ghosts are 8 copies at earlier times with falling opacity.+- **Swaps:** a growth curve of a brand metric, a playback-speed curve.++## Flurry (4 beats, about 6 cuts)+- **Reference:** Easing, then Op Art (stripes plus target), Glitch ("REEL" RGB split), Isometric blocks, Symmetry (kaleidoscope), and pixel noise, cut on beats and then half beats, introducing the held-back blue.+- **Build:** each cut is a full-bleed layer shown by `tl.set` on its grid time with one internal move (a spin, slide, scale pop, or stutter). Glitch uses 3 copies of the text (red, cyan, and white) offset by a few px with `mix-blend-mode: screen`, plus 4-6 horizontal slices (`clip-path: inset()`) jittered on alternating frames. Noise is a canvas of big pixels in brand colors, seeded per frame.+- **Swaps:** each flurry frame is one brand signature UI moment at full bleed (YouTube: Subscribe click, a Shorts swipe, a LIVE badge, Skip Ad, a double-tap +10s, a 4K/HD badge).++## Lockup (end card)+- **Reference:** the wordmark resolves from noise with bloom, a rule draws beneath it, two mono subtitles type on with a red block cursor, the motif lands as the period with a squash and a ground ellipse, and the tagline fades in last at low opacity.+- **Build:** the noise canvas fades as the wordmark's `filter: blur(20px) -> 0` and `opacity` rise over 12 frames, and bloom is a `text-shadow` or `drop-shadow`. The rule is `scaleX 0 -> 1` from the left. For typing, reveal characters with a `steps()` tween on a width mask, or `tl.set` per character, and a blinking block via `tl.set` toggles every 16 frames. The motif fall reuses the physics chapter's contact keys.+- **Swaps:** the motif becomes the logo's own element (a scrubber dot becomes the play button, a dot becomes the i's tittle, a drop becomes the O).diff --git a/.agents/skills/motion-showreel/references/reference-breakdown.md b/.agents/skills/motion-showreel/references/reference-breakdown.mdnew file mode 100644index 0000000..013fd99--- /dev/null+++ b/.agents/skills/motion-showreel/references/reference-breakdown.md@@ -0,0 +1,50 @@+# Reference breakdown: the Opus 5.5 "CLAUDE / MOTION REEL"++Source: a 15-second motion reel made by Opus 5.5 for Nate Herk (September 2026). 1920x1080, 60fps, 15.06s, 900 frames. Analyzed with `scripts/analyze-reference.mjs` (6fps contact sheets, per-frame luminance difference, audio RMS, and onsets).++## Measured facts++- **Tempo:** 128 BPM (beat = 0.469s). Onsets at 2.39, 2.86, 3.32, 4.25, 4.71, 5.20, 5.67, 6.13 ... are exactly one beat apart. Grid anchor about 0.51s.+- **Hard cuts land on beats:** 1.77 (flash), 4.23 (invert), 7.50 (iris flash), 11.25, 11.73, 12.20, 12.43 (half beat), 12.67, 12.93 (half beat), 13.13. Every one is within 2 frames of a grid line.+- **Pre-drop dip:** audio falls from about -12 dB to -25 dB at 7.25s, then the iris flash hits at 7.50s. One gap, one hit, at the midpoint.+- **Luminance rhythm (mean 0-255, every 0.5s):** 11, 11, 14, 219, 212, 224, 190, 65, 48, 14, 17, 97, 98, 71, 22, 22, 21, 54, 46, 37, 223, 95, 109, 40, 22, 31, 32. Dark, paper, dark, saturated, navy, paper, saturated flurry, black. Chapter changes flip value.+- **Audio level:** music bed at about -12 dB RMS the whole way. No voiceover. Fade out in the last 0.25s.++## Timeline++| Time | HUD label | What happens | Out-transition |+|---|---|---|---|+| 0.00-1.78 | 01 Squash & Stretch | One red dot drops onto a tick ruler and bounces. It stretches on the fall and squashes on contact, and a ground ellipse ripples. A leader line carries a live readout (POS, SCL, VEL). | The dot smears into a horizontal red laser, the laser blooms to white, and the white becomes the paper of the next chapter. |+| 1.78-4.23 | 02 Kinetic Type | "EVERY" letters drop in with bounce and overshoot. "FRAME" gets a red design-tool selection box (W 929, H 282, SX 100.0%) and a cursor that drags it bigger. "is a" arrives in red italic serif. "DECISION" letters land out of order with motion blur, then the word repeats into outline wallpaper. | The wallpaper rotates into diagonal bands, some bands fill red, and the whole frame inverts to black on a beat. |+| 4.23-5.30 | (02 continued) | White "DECISION" glows on black. Its letters turn into red dots one at a time. | Dots become a row of 8. |+| 5.30-7.40 | 03 Shape Language | The row of dots becomes a full-frame grid. A red wave ripples through it, circles morph to squares, squares to crosses, crosses to triangles, and the camera tilts and pushes into the grid. | The grid tunnels into a lens iris. |+| 7.40-9.30 | 04 Particle Systems | An iris ring flashes (the drop), a burst of red, white, and blue particles swirls on navy, and then it condenses into a thin ring. | The particle ring solidifies into a chrome torus. |+| 9.30-11.25 | 05 Lookdev / SDF | An iridescent chrome torus tilts, then SDF-smooth-unions into blobs, then a cube. A readout tracks it (SDF, SMOOTH UNION, MORPH 0.000 to 1.994, IOR 1.40, ROUGH 0.02). | The cube pushes into the lens. Hard cut. |+| 11.25-11.73 | 06 Easing | A cubic-bezier(0.83, 0, 0.17, 1) graph on paper. A red ball rides the curve and leaves onion-skin ghosts. | Cut on the beat. |+| 11.73-12.20 | Op Art | Red and black diagonal stripes behind a blue-and-white striped target. | Cut. |+| 12.20-12.43 | Glitch | "REEL" in white on electric blue with RGB split and slice displacement. | Cut on the half beat. |+| 12.43-12.67 | Isometric | Blue and white isometric block field on red. | Cut. |+| 12.67-12.93 | Symmetry | A kaleidoscope of red and blue circles and white triangles around a ring. | Black-to-blue wipe. |+| 12.93-13.13 | (noise) | Red, blue, and white pixel noise fills the frame. | The noise resolves into the wordmark. |+| 13.13-15.06 | 07 Fin | "CLAUDE" resolves from noise with bloom. A rule draws under it. "MOTION DESIGN" and "SHOWREEL 2026" type on with a red block cursor. The red dot falls in as the period with a squash and a ground ellipse. The tagline "EVERY FRAME WRITTEN IN CODE" fades in last, dim. | Hold, then fade. |++## Persistent HUD (every frame)++- Corner crop marks, 30px arms, inset about 36px.+- Top left: `CLAUDE / MOTION REEL`. Top right: `● 1920×1080 · 60P · 128 BPM`. The dot blinks like a REC light.+- Bottom left: `TC 00:00:02:36` running timecode. Bottom center: a tick ruler that fills as a progress bar. Bottom right: `02 · KINETIC TYPE` (the reel uses a dash between number and name).+- Mono, all caps, tracking about 0.2em, about 16px, 85% white on dark or 85% ink on paper. The HUD flips color with the background.+- A faint dot grid covers the dark frames.++## Why it works++1. **One protagonist, transformed.** The red dot is a ball, then a laser, then letters, dots, a grid, particles, a ring, a torus, and a cube, and at the end it is the period. Nearly every transition turns the current object into the next one. The viewer never has to reorient, so 15 seconds feel like one continuous thought.+2. **The reel narrates its own craft.** Chapter labels name the discipline on screen. Tool overlays (the physics readout, the selection box with a cursor, SDF parameters, a bezier graph) show the work behind the frame. It reads as a designer's reel, not an ad.+3. **A small palette, with one color held back.** Ink, paper, and one red carry the first 11 seconds. Electric blue appears only in the climax flurry, so the new color feels like the drop.+4. **Value flips on the beat.** Chapter changes swap dark and light or neutral and saturated. The flash, invert, and iris cuts are the punches, and they all land on grid lines.+5. **An accelerating cut curve with a held ending.** Chapter lengths run 1.8s, 3.5s (with an internal invert), 2.1s, 1.9s, 1.9s. Then six cuts come in 1.9s at one beat and half-beat spacing, and a 1.9s lockup lets the eye rest. That is roughly 75% development, 13% flurry, and 12% resolve.+6. **Density breathes.** One dot, then one word, then a wall of words, a grid of 100, thousands of particles, one object, the flurry, and one word again. Few and many alternate.+7. **Three type voices.** Heavy grotesk caps for statements, red italic serif for the human aside, and wide-tracked mono for the machine layer. Type also works as image: repeated into wallpaper, banded, and inverted.+8. **Physical finish.** Squash and stretch, motion blur on fast letters, bloom on white-on-black, slight chromatic fringing, grain, vignette, and a lens iris. It feels shot, not exported.+9. **Scale jumps.** Macro dot, full-frame pattern, cosmic particle field, object close-up, and a push through the object into the next cut. The camera move becomes the edit.+10. **A bookend.** The first object returns as the final punctuation, and the tagline arrives last at low opacity. The ending answers the opening.diff --git a/.agents/skills/motion-showreel/scripts/analyze-reference.mjs b/.agents/skills/motion-showreel/scripts/analyze-reference.mjsnew file mode 100644index 0000000..870c640--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/analyze-reference.mjs@@ -0,0 +1,79 @@+#!/usr/bin/env node+// Break a reference reel (or your own render) into numbers you can design against.+//+// Usage: node analyze-reference.mjs <video> <out-dir> [--fps 6] [--bpm 128] [--phase 0]+//+// Writes to <out-dir>:+// sheet_NN.png contact sheets, 4x4 tiles, --fps tiles per second. Tile i of sheet k+// is at (k*16 + i) / fps seconds; report.txt lists each sheet's range.+// report.txt hard cuts, luminance every 0.5s, audio RMS every 0.25s, onsets, and+// (with --bpm) how far each cut sits from the nearest beat and half beat.+// Needs ffmpeg and ffprobe on PATH (a full build with the fps, scale, and tile filters).+import { spawnSync } from 'node:child_process';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';++const args = process.argv.slice(2);+const opt = (name, def) => { const i = args.indexOf(`--${name}`); return i >= 0 ? Number(args[i + 1]) : def; };+const [video, out] = args.filter((a, i) => !a.startsWith('--') && !(i > 0 && args[i - 1].startsWith('--')));+if (!video || !out) { console.error('Usage: node analyze-reference.mjs <video> <out-dir> [--fps 6] [--bpm 128] [--phase 0]'); process.exit(1); }+const FPS = opt('fps', 6), BPM = opt('bpm', 0), PHASE = opt('phase', 0);+mkdirSync(out, { recursive: true });++const run = (cmd, a, opts = {}) => {+ const r = spawnSync(cmd, a, { maxBuffer: 1 << 30, ...opts });+ if (r.status !== 0) throw new Error(`${cmd} failed: ${String(r.stderr).slice(0, 400)}`);+ return r.stdout;+};++// contact sheets+run('ffmpeg', ['-v', 'error', '-y', '-i', video, '-vf', `fps=${FPS},scale=480:270,tile=layout=4x4`, join(out, 'sheet_%02d.png')]);++// per-frame luminance and hard cuts at native fps+const rate = String(run('ffprobe', ['-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=r_frame_rate', '-of', 'csv=p=0', video])).trim();+const [num, den] = rate.split('/').map(Number);+const vfps = num / (den || 1);+const W = 64, H = 36, F = W * H;+const gray = run('ffmpeg', ['-v', 'error', '-i', video, '-vf', `scale=${W}:${H},format=gray`, '-f', 'rawvideo', '-']);+const n = Math.floor(gray.length / F);+const lum = [], diff = [];+for (let f = 0; f < n; f++) {+ let s = 0, d = 0;+ for (let i = 0; i < F; i++) { const v = gray[f * F + i]; s += v; if (f) d += Math.abs(v - gray[(f - 1) * F + i]); }+ lum.push(s / F); if (f) diff.push(d / F);+}+const cuts = [];+diff.forEach((d, i) => { if (d > 40 && (i === 0 || diff[i - 1] < 40)) cuts.push((i + 1) / vfps); });++const lines = [`frames ${n} at ${vfps} fps = ${(n / vfps).toFixed(2)}s`];+const sheets = Math.ceil((n / vfps) * FPS / 16);+for (let k = 0; k < sheets; k++) lines.push(`sheet_${String(k + 1).padStart(2, '0')}.png ${(k * 16 / FPS).toFixed(2)}s - ${Math.min(n / vfps, (k * 16 + 15) / FPS).toFixed(2)}s`);+lines.push('hard cuts (s): ' + cuts.map(c => c.toFixed(3)).join(' '));+const lumRow = []; for (let f = 0; f < n; f += Math.round(vfps / 2)) lumRow.push(lum[f].toFixed(0));+lines.push('luminance every 0.5s: ' + lumRow.join(' '));++// audio RMS and onsets+const pcm = spawnSync('ffmpeg', ['-v', 'error', '-i', video, '-ac', '1', '-ar', '22050', '-f', 's16le', '-'], { maxBuffer: 1 << 30 });+if (pcm.status === 0 && pcm.stdout.length > 0) {+ const x = new Int16Array(pcm.stdout.buffer, pcm.stdout.byteOffset, pcm.stdout.length >> 1);+ const SR = 22050, HOP = 512, e = [];+ for (let i = 0; i + HOP < x.length; i += HOP) { let s = 0; for (let j = 0; j < HOP; j++) { const v = x[i + j] / 32768; s += v * v; } e.push(Math.sqrt(s / HOP)); }+ const db = v => (20 * Math.log10(v + 1e-9)).toFixed(0);+ const rms = []; for (let t = 0; t < x.length / SR - 0.05; t += 0.25) rms.push(db(e[Math.floor(t * SR / HOP)] ?? 0));+ lines.push('RMS dB every 0.25s: ' + rms.join(' '));+ const on = e.slice(1).map((v, i) => Math.max(0, v - e[i]));+ const mean = on.reduce((a, b) => a + b, 0) / on.length;+ const sd = Math.sqrt(on.reduce((a, b) => a + (b - mean) ** 2, 0) / on.length);+ const pk = [];+ for (let p = 1; p < on.length - 1; p++) if (on[p] > mean + 2.5 * sd && on[p] >= on[p - 1] && on[p] >= on[p + 1]) pk.push(((p + 1) * HOP / SR).toFixed(2));+ lines.push('onsets (s): ' + pk.join(' '));+} else lines.push('no audio stream');++if (BPM) {+ const P = 60 / BPM;+ const off = (c, q) => ((((c - PHASE + q / 2) % q) + q) % q) - q / 2;+ lines.push(`cut offset from nearest beat (ms, beat ${P.toFixed(4)}s, phase ${PHASE}): ` + cuts.map(c => `${off(c, P) >= 0 ? '+' : ''}${(off(c, P) * 1000).toFixed(0)}`).join(' '));+ lines.push('cut offset from nearest half beat (ms): ' + cuts.map(c => `${off(c, P / 2) >= 0 ? '+' : ''}${(off(c, P / 2) * 1000).toFixed(0)}`).join(' '));+}+writeFileSync(join(out, 'report.txt'), lines.join('\n') + '\n');+console.log(lines.join('\n'));diff --git a/.agents/skills/motion-showreel/scripts/beatgrid.mjs b/.agents/skills/motion-showreel/scripts/beatgrid.mjsnew file mode 100644index 0000000..31258a4--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/beatgrid.mjs@@ -0,0 +1,39 @@+#!/usr/bin/env node+// Lay chapters on a beat grid and print the cut sheet (seconds and frames).+//+// Usage:+// node beatgrid.mjs --period 0.4644 --fps 60 --length 15 \+// --chapters "01 Physics:4, 02 Kinetic Type:8, 03 Grid:4, 04 Drop:4, 05 Lookdev:4, Flurry:4, 07 Fin:rest"+//+// A chapter length is in beats; "rest" fills to --length. Inside a chapter whose name+// starts with "Flurry", cuts are listed one per beat, then one per half beat.+// The default split matches the reference reel: about 75% development, 13% flurry,+// 12% resolve. Paste the output into STORYBOARD.md; in GSAP, t = frame / fps.+const args = process.argv.slice(2);+const get = (name) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : undefined; };+const bpm = Number(get('bpm') ?? 0), period = Number(get('period') ?? 0);+const fps = Number(get('fps') ?? 60), length = Number(get('length') ?? 15), chapters = get('chapters');+if (!chapters || !(period || bpm)) {+ console.error('Usage: node beatgrid.mjs (--period <s> | --bpm <n>) [--fps 60] [--length 15] --chapters "Name:beats, ..., Name:rest"');+ process.exit(1);+}+const P = period || 60 / bpm;+const fr = (t) => Math.round(t * fps);+const pad = (s, w) => String(s).padStart(w);+console.log(`beat ${P.toFixed(4)}s (${(60 / P).toFixed(2)} BPM), ${fps} fps, beat = ${(P * fps).toFixed(2)} frames\n`);+console.log(`${'chapter'.padEnd(24)} ${pad('beats', 11)} ${pad('start s', 8)} ${pad('end s', 8)} ${pad('frames', 11)}`);+let b = 0;+for (const part of chapters.split(',').map((c) => c.trim()).filter(Boolean)) {+ const k = part.lastIndexOf(':');+ const name = part.slice(0, k).trim(), n = part.slice(k + 1).trim();+ const t0 = b * P;+ const nb = n === 'rest' ? length / P - b : Number(n);+ const t1 = n === 'rest' ? length : (b + nb) * P;+ console.log(`${name.padEnd(24)} ${pad(`${b.toFixed(1)}-${(b + nb).toFixed(1)}`, 11)} ${pad(t0.toFixed(3), 8)} ${pad(t1.toFixed(3), 8)} ${pad(`${fr(t0)}-${fr(t1)}`, 11)}`);+ if (name.toLowerCase().startsWith('flurry')) {+ // one beat per cut, then half beats: the cut rate accelerates into the lockup+ for (let s = 0; s < nb - 1e-6; s += s < nb / 2 ? 1 : 0.5) console.log(`${' cut'.padEnd(24)} ${pad((b + s).toFixed(1), 11)} ${pad(((b + s) * P).toFixed(3), 8)} ${pad('', 8)} ${pad(fr((b + s) * P), 11)}`);+ }+ b += nb;+}+console.log(`\ntotal ${length.toFixed(2)}s = ${fr(length)} frames`);diff --git a/.agents/skills/motion-showreel/scripts/kie.mjs b/.agents/skills/motion-showreel/scripts/kie.mjsnew file mode 100644index 0000000..854fed3--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/kie.mjs@@ -0,0 +1,103 @@+#!/usr/bin/env node+// Minimal Kie.ai client for showreel assets: instrumental music (Suno), hero stills+// (Seedream image-to-image from your logo), and camera moves (Kling image-to-video).+// Every command is a PAID call on your own Kie.ai credits. Confirm with the user first.+//+// node kie.mjs credit+// node kie.mjs music --title "Broadcast" --style "punchy electronic showreel, 128 bpm, big drop" --out assets/audio+// node kie.mjs image --ref logo.png --prompt "photoreal 3D sculpture of this exact icon..." --out assets/img/hero.png+// node kie.mjs video --image assets/img/hero.png --prompt "slow orbit, object stays rigid..." --out assets/video/hero-raw.mp4+//+// Reads KIE_API_KEY from the environment or the workspace .env. API docs: https://docs.kie.ai/+// Kling returns 24fps. Speed it up and re-encode all-intra for seek-safe rendering, e.g.+// ffmpeg -i hero-raw.mp4 -an -vf "setpts=PTS/3,fps=60" -c:v libx264 -crf 16 -g 1 -keyint_min 1 -bf 0 -pix_fmt yuv420p hero-60.mp4+import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';+import { dirname, resolve, basename, join, extname } from 'node:path';+import { fileURLToPath } from 'node:url';++function loadKey() {+ if (process.env.KIE_API_KEY) return process.env.KIE_API_KEY;+ let dir = dirname(fileURLToPath(import.meta.url));+ for (let i = 0; i < 8; i++, dir = dirname(dir)) {+ const f = join(dir, '.env');+ if (existsSync(f)) {+ const m = readFileSync(f, 'utf8').match(/^\s*KIE_API_KEY\s*=\s*"?([^"\r\n]+)"?/m);+ if (m) return m[1].trim();+ }+ }+ throw new Error('KIE_API_KEY is not set. Add it to .env (see docs/TOOLS-AND-API-KEYS.md).');+}+const KEY = loadKey();+const H = { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' };+const MIME = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.mp3': 'audio/mpeg' };++export async function upload(file) {+ const b64 = readFileSync(file).toString('base64');+ const r = await fetch('https://kieai.redpandaai.co/api/file-base64-upload', {+ method: 'POST', headers: H,+ body: JSON.stringify({ base64Data: `data:${MIME[extname(file).toLowerCase()] ?? 'application/octet-stream'};base64,${b64}`, uploadPath: 'motion-showreel', fileName: basename(file) }),+ });+ const j = await r.json();+ if (!j.data?.downloadUrl) throw new Error('upload failed: ' + JSON.stringify(j).slice(0, 300));+ return j.data.downloadUrl;+}+export async function create(model, input) {+ const r = await fetch('https://api.kie.ai/api/v1/jobs/createTask', { method: 'POST', headers: H, body: JSON.stringify({ model, input }) });+ const j = await r.json();+ if (j.code !== 200) throw new Error(`create ${model} failed: ` + JSON.stringify(j).slice(0, 300));+ return j.data.taskId;+}+export async function poll(taskId, every = 8000, max = 1_800_000) {+ const t0 = Date.now();+ while (Date.now() - t0 < max) {+ const j = await (await fetch(`https://api.kie.ai/api/v1/jobs/recordInfo?taskId=${taskId}`, { headers: H })).json();+ if (j.data?.state === 'success') return JSON.parse(j.data.resultJson);+ if (j.data?.state === 'fail') throw new Error('task failed: ' + JSON.stringify(j.data).slice(0, 300));+ await new Promise((res) => setTimeout(res, every));+ }+ throw new Error('timeout waiting for ' + taskId);+}+export async function download(url, out) {+ mkdirSync(dirname(resolve(out)), { recursive: true });+ const r = await fetch(url);+ writeFileSync(out, Buffer.from(await r.arrayBuffer()));+ return out;+}++const [cmd, ...rest] = process.argv.slice(2);+const get = (name) => { const i = rest.indexOf(`--${name}`); return i >= 0 ? rest[i + 1] : undefined; };+const isMain = process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url);+if (isMain) {+ try {+ if (cmd === 'credit') {+ console.log(await (await fetch('https://api.kie.ai/api/v1/chat/credit', { headers: H })).json());+ } else if (cmd === 'music') {+ const id = await create('ai-music-api/generate', {+ custom_mode: true, instrumental: true, model: 'V6', title: get('title') ?? 'Showreel', prompt: '',+ style: get('style') ?? 'punchy modern electronic motion-design showreel, instrumental, 128 bpm, starts instantly, riser into a big drop, clean modern mix, no vocals',+ negative_tags: get('negative') ?? 'vocals, singing, lyrics, choir, lo-fi, sad, acoustic, orchestral',+ });+ console.log('task', id);+ const r = await poll(id, 10000);+ const out = get('out') ?? '.';+ const urls = [...new Set(JSON.stringify(r).match(/https?:[^"]+?\.(?:mp3|wav)/g) ?? [])].filter((u) => !u.includes('/stream/'));+ let i = 0; for (const u of urls) console.log('saved', await download(u, join(out, `take-${i++}.mp3`)));+ } else if (cmd === 'image') {+ const ref = get('ref');+ const input = { prompt: get('prompt'), aspect_ratio: get('aspect') ?? '16:9', quality: 'high', output_format: 'png' };+ if (ref) input.image_urls = [await upload(ref)];+ const id = await create(ref ? 'seedream/5-pro-image-to-image' : 'seedream/5-pro-text-to-image', input);+ console.log('task', id);+ const r = await poll(id, 6000);+ console.log('saved', await download(r.resultUrls[0], get('out') ?? 'still.png'));+ } else if (cmd === 'video') {+ const id = await create('kling/v3-turbo-image-to-video', { prompt: get('prompt'), image_urls: [await upload(get('image'))], duration: get('duration') ?? '5', resolution: '1080p' });+ console.log('task', id);+ const r = await poll(id, 10000);+ console.log('saved', await download(r.resultUrls[0], get('out') ?? 'clip-raw.mp4'));+ } else {+ console.error('Commands: credit | music | image | video (see the header of this file)');+ process.exitCode = 1;+ }+ } catch (e) { console.error(e.message); process.exitCode = 1; }+}diff --git a/.agents/skills/motion-showreel/scripts/mix.mjs b/.agents/skills/motion-showreel/scripts/mix.mjsnew file mode 100644index 0000000..10de6e2--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/mix.mjs@@ -0,0 +1,42 @@+#!/usr/bin/env node+// Premix the music bed and beat-placed SFX into one master wav with ffmpeg.+//+// Usage: node mix.mjs --bed music-bed.wav --events events.json --out master.wav [--length 15] [--lufs -14] [--bed-gain 0.9]+// events.json: [{ "t": 0.4644, "file": "assets/audio/sfx/dot_pop.mp3", "gain": 0.5, "max": 0.5 }, ...]+// t seconds (compute from the beat sheet: beat * period)+// gain linear gain on the cue as generated (start around 0.2-0.6; hero hits up to 0.9)+// max optional: trim a long cue to this many seconds, with a 40 ms fade+// Two-pass loudnorm to --lufs (default -14 LUFS, -1.2 dBTP). Place the result as the single+// <audio> track of the composition. HyperFrames re-encodes audio slightly quieter; after+// rendering, remux the master: ffmpeg -i render.mp4 -i master.wav -map 0:v -map 1:a -c:v copy -c:a aac -b:a 256k -shortest final.mp4+import { spawnSync } from 'node:child_process';+import { readFileSync } from 'node:fs';++const args = process.argv.slice(2);+const get = (n, d) => { const i = args.indexOf(`--${n}`); return i >= 0 ? args[i + 1] : d; };+const bed = get('bed'), eventsFile = get('events'), out = get('out', 'master.wav');+const LEN = Number(get('length', 15)), LUFS = Number(get('lufs', -14)), BED = Number(get('bed-gain', 0.9));+if (!bed || !eventsFile) { console.error('Usage: node mix.mjs --bed bed.wav --events events.json --out master.wav'); process.exit(1); }+const events = JSON.parse(readFileSync(eventsFile, 'utf8'));++const inputs = ['-i', bed], parts = [`[0:a]aresample=48000,volume=${BED}[b]`], labels = ['[b]'];+events.forEach((e, i) => {+ inputs.push('-i', e.file);+ const trim = e.max ? `atrim=0:${e.max},afade=t=out:st=${Math.max(0, e.max - 0.04)}:d=0.04,` : '';+ const ms = Math.round(e.t * 1000);+ parts.push(`[${i + 1}:a]aresample=48000,aformat=channel_layouts=stereo,${trim}volume=${e.gain},adelay=${ms}|${ms}[e${i}]`);+ labels.push(`[e${i}]`);+});+parts.push(`${labels.join('')}amix=inputs=${labels.length}:normalize=0:duration=first,atrim=0:${LEN}[m]`);+const graph = parts.join(';');+const ff = (tail, extra) => spawnSync('ffmpeg', ['-hide_banner', ...inputs, '-filter_complex', graph + tail, ...extra], { encoding: 'utf8', maxBuffer: 1 << 26 });++// pass 1: measure+const m = ff(`;[m]loudnorm=I=${LUFS}:TP=-1.2:LRA=11:print_format=json[o]`, ['-map', '[o]', '-f', 'null', '-']);+if (m.status !== 0) { console.error(m.stderr.slice(-800)); process.exit(1); }+const js = JSON.parse(m.stderr.slice(m.stderr.lastIndexOf('{'), m.stderr.lastIndexOf('}') + 1));+// pass 2: normalize linearly, then a safety limiter+const af = `loudnorm=I=${LUFS}:TP=-1.2:LRA=11:measured_I=${js.input_i}:measured_TP=${js.input_tp}:measured_LRA=${js.input_lra}:measured_thresh=${js.input_thresh}:offset=${js.target_offset}:linear=true,alimiter=limit=0.87:level=false,aresample=48000`;+const r = ff(`;[m]${af}[o]`, ['-v', 'error', '-y', '-map', '[o]', '-t', String(LEN), '-c:a', 'pcm_s24le', out]);+if (r.status !== 0) { console.error(r.stderr.slice(-800)); process.exit(1); }+console.log(`${out}: bed + ${events.length} cues, input ${js.input_i} LUFS -> ${LUFS} LUFS`);diff --git a/.agents/skills/motion-showreel/scripts/music-grid.mjs b/.agents/skills/motion-showreel/scripts/music-grid.mjsnew file mode 100644index 0000000..3187fca--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/music-grid.mjs@@ -0,0 +1,80 @@+#!/usr/bin/env node+// Measure a music take's true beat grid and energy map so it can be spliced onto a cut grid.+//+// Usage: node music-grid.mjs <take.mp3> [--bpm 128] [--beats] [--json grid.json]+//+// Beat trackers drift on generated music, so this autocorrelates an onset envelope near+// the target BPM and refines the period with a fold sweep. The phase (downbeat offset) is+// folded from the KICK band (ffmpeg lowpass at 120 Hz). The full-band fold can lock onto+// off-beat hi-hats and put every splice half a beat late; both are printed so you can see it.+// Prints one row per bar (RMS dB, low-band dB, onset density); --beats adds one row per beat.+// Use the rows to find the intro, the riser, the drop, the break, and a clean return hit.+// Needs ffmpeg on PATH.+import { spawnSync } from 'node:child_process';+import { writeFileSync } from 'node:fs';++const args = process.argv.slice(2);+const get = (name) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : undefined; };+const file = args[0];+if (!file || file.startsWith('--')) { console.error('Usage: node music-grid.mjs <take.mp3> [--bpm 128] [--beats] [--json grid.json]'); process.exit(1); }+const BPM = Number(get('bpm') ?? 128), SR = 22050;++function decode(filter) {+ const a = ['-v', 'error', '-i', file, '-ac', '1', '-ar', String(SR)];+ if (filter) a.push('-af', filter);+ const r = spawnSync('ffmpeg', [...a, '-f', 's16le', '-'], { maxBuffer: 1 << 30 });+ if (r.status !== 0) throw new Error('ffmpeg failed: ' + String(r.stderr).slice(0, 300));+ const s = new Int16Array(r.stdout.buffer, r.stdout.byteOffset, r.stdout.length >> 1);+ return Float32Array.from(s, (v) => v / 32768);+}+const energy = (x, hop, win) => {+ const e = [];+ for (let i = 0; i + win < x.length; i += hop) { let s = 0; for (let j = 0; j < win; j++) s += x[i + j] * x[i + j]; e.push(s / win); }+ return e;+};+const onset = (e) => e.map((v, i) => (i ? Math.max(0, Math.log(v + 1e-10) - Math.log(e[i - 1] + 1e-10)) : 0));++const full = decode(), low = decode('lowpass=f=120,lowpass=f=120');+// Long windows (46 ms) give a smooth envelope for the period and the energy tables.+// Short windows (12 ms) give the phase; frame i covers [i*hop, i*hop + win) and an attack+// registers when it enters the window's END, so fold times are shifted by the window length.+const HOP = 256, WIN = 1024, fps = SR / HOP, dur = full.length / SR;+const eF = energy(full, HOP, WIN), eL = energy(low, HOP, WIN), oF = onset(eF);+const SHOP = 64, SWIN = 256, sfps = SR / SHOP;+const oFs = onset(energy(full, SHOP, SWIN)), oLs = onset(energy(low, SHOP, SWIN));++// period: autocorrelation peak within +-6% of the target, refined by fold strength+const mean = oF.reduce((a, b) => a + b, 0) / oF.length, c = oF.map((v) => v - mean);+const lo = Math.floor((fps * 60) / (BPM * 1.06)), hi = Math.ceil((fps * 60) / (BPM * 0.94));+let lag = lo, best = -Infinity;+for (let L = lo; L <= hi; L++) { let s = 0; for (let i = 0; i + L < c.length; i++) s += c[i] * c[i + L]; if (s > best) { best = s; lag = L; } }+const fold = (o, P, bins, rate = fps, lead = WIN / SR) => {+ const b = new Float64Array(bins);+ o.forEach((v, i) => { b[Math.floor(((((i / rate + lead) % P) + P) % P / P) * bins) % bins] += v; });+ let k = 0; for (let i = 1; i < bins; i++) if (b[i] > b[k]) k = i;+ const avg = b.reduce((x, y) => x + y, 0) / bins;+ return { strength: b[k], phase: ((k + 0.5) / bins) * P, contrast: b[k] / avg };+};+let P = lag / fps, top = -Infinity;+for (let k = 0; k <= 80; k++) { const p = (lag / fps) * (0.99 + (0.02 * k) / 80); const f = fold(oF, p, 64, fps, 0); if (f.strength > top) { top = f.strength; P = p; } }+const fullPh = fold(oFs, P, 96, sfps, SWIN / SR), kick = fold(oLs, P, 96, sfps, SWIN / SR);+const PH = kick.phase;+console.log(`period ${P.toFixed(4)}s bpm ${(60 / P).toFixed(2)} duration ${dur.toFixed(2)}s`);+console.log(`kick-band phase ${PH.toFixed(3)}s (contrast ${kick.contrast.toFixed(1)}) full-band phase ${fullPh.phase.toFixed(3)}s -> use the kick phase`);+const gap = Math.abs(((fullPh.phase - PH + P / 2) % P + P) % P - P / 2);+if (gap > P / 4) console.log('warning: the full-band phase sits about half a beat from the kick; hats dominate the full band');++const db = (v) => 10 * Math.log10(v + 1e-12);+const span = (e, t0, t1) => { const a = Math.floor(t0 * fps), b = Math.max(a + 1, Math.floor(t1 * fps)); let s = 0; for (let i = a; i < b && i < e.length; i++) s += e[i]; return s / (b - a); };+const rows = [];+for (let b = 0; PH + (b + 1) * 4 * P <= dur; b++) {+ const t0 = PH + b * 4 * P, t1 = t0 + 4 * P;+ const r = { bar: b, beat: b * 4, t: +t0.toFixed(3), rms_db: +db(span(eF, t0, t1)).toFixed(1), low_db: +db(span(eL, t0, t1)).toFixed(1), onset: +span(oF, t0, t1).toFixed(3) };+ rows.push(r);+ console.log(`bar ${String(b).padStart(3)} beat ${String(b * 4).padStart(3)} t ${t0.toFixed(2).padStart(7)} rms ${r.rms_db.toFixed(1).padStart(6)} low ${r.low_db.toFixed(1).padStart(6)} onset ${r.onset.toFixed(2)} ` + '#'.repeat(Math.max(0, Math.round(r.rms_db + 40))));+}+const beats = [];+for (let n = 0; PH + (n + 1) * P <= dur; n++) { const t0 = PH + n * P; beats.push({ beat: n, t: +t0.toFixed(3), low_db: +db(span(eL, t0, t0 + P)).toFixed(1) }); }+if (args.includes('--beats')) for (const r of beats) console.log(`beat ${String(r.beat).padStart(3)} t ${r.t.toFixed(2).padStart(7)} low ${r.low_db.toFixed(1).padStart(6)} ` + '#'.repeat(Math.max(0, Math.round(r.low_db + 60))));+const json = get('json');+if (json) writeFileSync(json, JSON.stringify({ period: P, phase: PH, fullBandPhase: fullPh.phase, bars: rows, beats }, null, 1));diff --git a/.agents/skills/motion-showreel/scripts/sfx.mjs b/.agents/skills/motion-showreel/scripts/sfx.mjsnew file mode 100644index 0000000..69d2c7b--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/sfx.mjs@@ -0,0 +1,38 @@+#!/usr/bin/env node+// Generate an SFX kit with ElevenLabs sound generation. PAID calls: confirm with the user first.+//+// Usage: node sfx.mjs kit.json assets/audio/sfx+// kit.json: { "dot_pop": ["tiny rubbery bouncy ball pop, clean digital", 0.5], ... }+// Durations must be 0.5-30 seconds. Existing files are skipped, so reruns are free.+// A good showreel kit: dot_pop, click, whoosh, whoosh_big, laser, sub_boom, glitch, ticks,+// shimmer, tape_stop, final_hit, plus brand-native sounds (typing, a notification bell, a like pop).+// Reads ELEVENLABS_API_KEY from the environment or the workspace .env.+import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';++function loadKey() {+ if (process.env.ELEVENLABS_API_KEY) return process.env.ELEVENLABS_API_KEY;+ let dir = dirname(fileURLToPath(import.meta.url));+ for (let i = 0; i < 8; i++, dir = dirname(dir)) {+ const f = join(dir, '.env');+ if (existsSync(f)) { const m = readFileSync(f, 'utf8').match(/^\s*ELEVENLABS_API_KEY\s*=\s*"?([^"\r\n]+)"?/m); if (m) return m[1].trim(); }+ }+ throw new Error('ELEVENLABS_API_KEY is not set. Add it to .env (see docs/TOOLS-AND-API-KEYS.md).');+}+const [kitFile, outDir] = process.argv.slice(2);+if (!kitFile || !outDir) { console.error('Usage: node sfx.mjs kit.json <out-dir>'); process.exit(1); }+const kit = JSON.parse(readFileSync(kitFile, 'utf8'));+const key = loadKey();+mkdirSync(outDir, { recursive: true });+await Promise.all(Object.entries(kit).map(async ([name, [text, seconds]]) => {+ const out = join(outDir, `${name}.mp3`);+ if (existsSync(out)) return console.log(name, 'exists');+ const r = await fetch('https://api.elevenlabs.io/v1/sound-generation', {+ method: 'POST', headers: { 'xi-api-key': key, 'Content-Type': 'application/json' },+ body: JSON.stringify({ text, duration_seconds: Math.max(0.5, seconds), prompt_influence: 0.6 }),+ });+ if (!r.ok) { console.log(name, 'ERROR', r.status, (await r.text()).slice(0, 200)); process.exitCode = 1; return; }+ writeFileSync(out, Buffer.from(await r.arrayBuffer()));+ console.log(name, 'saved');+}));diff --git a/.agents/skills/motion-showreel/scripts/splice-music.mjs b/.agents/skills/motion-showreel/scripts/splice-music.mjsnew file mode 100644index 0000000..acf60ed--- /dev/null+++ b/.agents/skills/motion-showreel/scripts/splice-music.mjs@@ -0,0 +1,38 @@+#!/usr/bin/env node+// Splice a music take onto the cut grid, beat-accurate, with ffmpeg.+//+// Usage:+// node splice-music.mjs <take.mp3> --period 0.4644 --phase 0.073 \+// --segments "4-28,48-56.7" --length 15 --gap 16 --fade 0.9 --out assets/audio/music-bed.wav+//+// --period/--phase from music-grid.mjs (use the KICK-band phase)+// --segments source beat ranges, played in order. Output beat 0 = the first segment's start.+// Typical 15s reel at ~129 BPM: intro + build (16 beats) ending on the drop's+// downbeat, drop (8), break (4, under the flurry), then the return hit + tail.+// --gap N duck the half beat before OUTPUT beat N to -16 dB (the pre-drop gap)+// --fade S fade the last S seconds+// Every cut lands 12 ms before a grid point so the transient survives, joined by a 12 ms+// crossfade; each segment but the last is extended by the crossfade so beats stay on the grid.+// Re-measure the result with music-grid.mjs: its kick phase should be close to 0.+import { spawnSync } from 'node:child_process';++const args = process.argv.slice(2);+const get = (n, d) => { const i = args.indexOf(`--${n}`); return i >= 0 ? args[i + 1] : d; };+const take = args[0];+const P = Number(get('period')), PH = Number(get('phase', 0)), LEN = Number(get('length', 15));+const segs = String(get('segments', '')).split(',').filter(Boolean).map((s) => s.split('-').map(Number));+const gap = get('gap') !== undefined ? Number(get('gap')) : null, fade = Number(get('fade', 0.9)), out = get('out', 'music-bed.wav');+if (!take || !P || !segs.length) { console.error('Usage: node splice-music.mjs <take> --period <s> --phase <s> --segments "a-b,c-d" [--length 15] [--gap 16] [--fade 0.9] [--out bed.wav]'); process.exit(1); }++const PRE = 0.012, XF = 0.012;+const t = (beat) => Math.max(0, PH + beat * P - PRE);+const parts = segs.map(([a, b], i) => `[0:a]asetpts=PTS-STARTPTS,atrim=start=${t(a).toFixed(5)}:end=${(t(b) + (i < segs.length - 1 ? XF : 0)).toFixed(5)},asetpts=PTS-STARTPTS[s${i}]`);+let chain = '[s0]';+for (let i = 1; i < segs.length; i++) { parts.push(`${chain}[s${i}]acrossfade=d=${XF}:c1=qsin:c2=qsin[x${i}]`); chain = `[x${i}]`; }+const post = [`apad=whole_dur=${LEN}`, `atrim=0:${LEN}`];+if (gap !== null) { const g0 = (gap - 0.5) * P, g1 = gap * P - 0.004; post.push(`volume=0.158:enable='between(t,${g0.toFixed(4)},${g1.toFixed(4)})'`); }+if (fade > 0) post.push(`afade=t=out:st=${(LEN - fade).toFixed(3)}:d=${fade}`);+parts.push(`${chain}${post.join(',')}[out]`);+const r = spawnSync('ffmpeg', ['-v', 'error', '-y', '-i', take, '-filter_complex', parts.join(';'), '-map', '[out]', '-ar', '48000', '-ac', '2', '-c:a', 'pcm_s24le', out], { encoding: 'utf8' });+if (r.status !== 0) { console.error(r.stderr); process.exit(1); }+console.log(`${out}: ${segs.map(([a, b]) => `src beats ${a}-${b}`).join(' + ')}, ${LEN}s${gap !== null ? `, gap before beat ${gap} (${(gap * P).toFixed(3)}s)` : ''}`);diff --git a/.agents/skills/motion-showreel/templates/hud.html b/.agents/skills/motion-showreel/templates/hud.htmlnew file mode 100644index 0000000..0ec9fb8--- /dev/null+++ b/.agents/skills/motion-showreel/templates/hud.html@@ -0,0 +1,80 @@+<!--+ motion-showreel HUD layer. Paste the <style> block into the composition's <style>,+ the #hud markup as the LAST child of #root (above flash/vignette/grain), and call+ hudFrame(t) from the per-frame driver (a pure function of t, so it is seek-safe).++ Swap per brand:+ --hud-acc brand accent (the motif color)+ .hud-tl brand mark + "BRAND / MOTION REEL"+ .hud-tr spec line: resolution, fps, measured BPM (use the real measured value)+ #ptime use the brand's own time format if it has one (YouTube: "0:02 / 0:15"),+ otherwise "TC 00:00:02:36"+ CH chapter labels, in the brand's language where possible+ SEGB chapter boundaries in beats -> gaps in the progress bar+ paperRanges time ranges where the background is light, so the HUD flips to ink+-->+<style>+ #hud { position: absolute; inset: 0; z-index: 95; color: rgba(241, 241, 241, 0.88); --hud-acc: #ff0033; }+ #hud.paper { color: rgba(15, 15, 15, 0.85); }+ #hud .mono { font-family: "Roboto Mono", monospace; font-weight: 500; text-transform: uppercase; letter-spacing: 0.2em; }+ .cm { position: absolute; width: 30px; height: 30px; border-color: currentColor; border-style: solid; border-width: 0; }+ .cm.tl { left: 36px; top: 36px; border-left-width: 2px; border-top-width: 2px; }+ .cm.tr { right: 36px; top: 36px; border-right-width: 2px; border-top-width: 2px; }+ .cm.bl { left: 36px; bottom: 36px; border-left-width: 2px; border-bottom-width: 2px; }+ .cm.br { right: 36px; bottom: 36px; border-right-width: 2px; border-bottom-width: 2px; }+ .hud-tl, .hud-tr { position: absolute; top: 62px; font-size: 16px; line-height: 24px; white-space: pre; }+ .hud-tl { left: 72px; }+ .hud-tr { right: 72px; }+ #rec { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--hud-acc); margin-right: 12px; vertical-align: 1px; }+ #ptime { position: absolute; left: 72px; top: 996px; font-size: 22px; font-weight: 500; }+ #hbar { position: absolute; left: 640px; top: 1006px; width: 640px; height: 5px; }+ .hseg { position: absolute; top: 0; height: 5px; background: rgba(255, 255, 255, 0.26); overflow: hidden; }+ #hud.paper .hseg { background: rgba(15, 15, 15, 0.16); }+ .hseg .buf { position: absolute; left: 0; top: 0; height: 100%; background: rgba(255, 255, 255, 0.28); }+ #hud.paper .hseg .buf { background: rgba(15, 15, 15, 0.14); }+ .hseg .pl { position: absolute; left: 0; top: 0; height: 100%; background: var(--hud-acc); }+ #hdot { position: absolute; top: 2.5px; left: 0; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%; background: var(--hud-acc); }+ .hud-br { position: absolute; right: 72px; top: 996px; font-size: 16px; line-height: 24px; white-space: pre; }+</style>++<div id="hud">+ <i class="cm tl"></i><i class="cm tr"></i><i class="cm bl"></i><i class="cm br"></i>+ <div class="hud-tl mono">BRAND / MOTION REEL</div>+ <div class="hud-tr mono"><i id="rec"></i>1920×1080 · 60P · 128 BPM</div>+ <div id="ptime" class="mono">TC 00:00:00:00</div>+ <div id="hbar"><i id="hdot"></i></div>+ <div class="hud-br mono"><span id="chlab">01 · PHYSICS</span></div>+</div>++<script>+ // Call once after fonts are ready; returns hudFrame(t) for the per-frame driver.+ function makeHud({ P, END = 15, FPS = 60, CH, SEGB, paperRanges = [], timeFormat = "tc" }) {+ const $ = (s) => document.querySelector(s);+ const h = (n) => { const x = Math.sin(n * 127.1 + 311.7) * 43758.5453; return x - Math.floor(x); };+ const clamp = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x));+ const pad = (n) => String(n).padStart(2, "0");+ const GLY = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#/";+ const hbar = $("#hbar"), hud = $("#hud"), rec = $("#rec"), ptime = $("#ptime"), hdot = $("#hdot"), chlab = $("#chlab");+ const segs = [];+ for (let i = 0; i < SEGB.length - 1; i++) {+ const x0 = ((SEGB[i] * P) / END) * 640 + (i ? 2 : 0), x1 = Math.min(640, ((SEGB[i + 1] * P) / END) * 640) - (i < SEGB.length - 2 ? 2 : 0);+ const s = document.createElement("div"); s.className = "hseg"; s.style.left = x0 + "px"; s.style.width = x1 - x0 + "px";+ s.innerHTML = '<i class="buf"></i><i class="pl"></i>'; hbar.insertBefore(s, hdot);+ segs.push({ pl: s.querySelector(".pl"), buf: s.querySelector(".buf"), x0, w: x1 - x0 });+ }+ return function hudFrame(t) {+ const fr = Math.round(t * FPS), f = t / END;+ ptime.textContent = timeFormat === "yt" ? `0:${pad(Math.min(END, Math.floor(t + 1e-4)))} / 0:${pad(END)}` : `TC 00:00:${pad(Math.floor(fr / FPS))}:${pad(fr % FPS)}`;+ segs.forEach((s) => { const x = f * 640 - s.x0; s.pl.style.width = clamp(x, 0, s.w) + "px"; s.buf.style.width = clamp(x + 70, 0, s.w) + "px"; });+ hdot.style.left = f * 640 + "px";+ hud.classList.toggle("paper", paperRanges.some(([a, b]) => t >= a && t < b));+ rec.style.opacity = (t / P) % 1 < 0.5 ? 1 : 0.25; // blinks on the beat+ let c = CH[0]; for (const e of CH) if (t >= e[0] - 1e-4) c = e;+ const since = t - c[0];+ if (since < 0.16 && c[0] > 0) { // scramble-in for 0.16s on every chapter change+ const n = Math.floor((since / 0.16) * c[1].length);+ chlab.textContent = c[1].split("").map((ch, i) => (i < n || ch === " " || ch === "·" ? ch : GLY[Math.floor(h(fr * 13 + i) * GLY.length)])).join("");+ } else chlab.textContent = c[1];+ };+ }+</script>diff --git a/.agents/skills/motion-showreel/templates/storyboard.md b/.agents/skills/motion-showreel/templates/storyboard.mdnew file mode 100644index 0000000..8433629--- /dev/null+++ b/.agents/skills/motion-showreel/templates/storyboard.md@@ -0,0 +1,20 @@+# Storyboard: <Brand> Showreel <length>s++Grid: <period>s beats (<bpm> BPM measured), <fps>fps. `B(n) = n * <period>`. Frame sheet: `qa/beatsheet.txt` (from `scripts/beatgrid.mjs`).+Motif: <the brand's most reduced element>. Held-back climax color: <color, flurry only>.++| Beats | Time | HUD label | Value | Frame | Tool overlay | In-transform | Out-transform | SFX |+|---|---|---|---|---|---|---|---|---|+| 0-4 | | 01 · <physics> | ink | the motif enters and obeys physics | live readout | (opening) | motif becomes <laser / line / flash> | pops on contacts |+| 4-12 | | 02 · <type> | paper, invert at B10 | brand phrase as kinetic type, 3 type voices, wallpaper | brand-native input (search bar, chat box) or selection box | flash becomes paper | letters become motif copies | typing, click, invert hit |+| 12-16 | | 03 · <grid> | ink | motif copies become a grid of real brand imagery, wave, camera tilt | grid readout | dots become tiles | push into one tile; pre-drop gap | swishes, whoosh |+| 16-20 | | 04 · <particles> | ink + accent glow | the drop: burst into particles that form a verified stat | particle readout | tile becomes a burst | particles become the hero silhouette | boom, pop, ticks |+| 20-24 | | 05 · <lookdev> | ink | photoreal hero object, two materials | material readout, counter | silhouette becomes the object | push through the lens, hard cut | shimmer, whoosh |+| 24-28 | | 06 · <flurry> | alternating, held-back color arrives | 5-6 signature UI moments, 1 beat then half beats | each moment's own UI | hard cuts | noise | clicks, glitch, tape stop |+| 28-end | | 07 · <end> | ink | logo resolves, rule draws, subtitles type, the motif lands as the logo's own element, tagline last | typing cursor | noise resolves | hold | final hit, pop |++Checks before building:+- [ ] Freeze any frame: it reads as the brand without the HUD.+- [ ] Every transition transforms the object (except flurry cuts).+- [ ] Value flips at every chapter change.+- [ ] Every fact on screen is verified and dated in BRAND.md.diff --git a/.claude/skills/motion-showreel/SKILL.md b/.claude/skills/motion-showreel/SKILL.mdnew file mode 100644index 0000000..b77cb7e--- /dev/null+++ b/.claude/skills/motion-showreel/SKILL.md@@ -0,0 +1,190 @@+---+name: motion-showreel+description: Design and build a 10-30 second motion-design showreel or brand reel in the style of Nate's Opus 5.5 "CLAUDE / MOTION REEL": one brand motif transformed through labeled craft chapters, a persistent HUD, cuts locked to a 120-130 BPM grid, a sub-second flurry, and a held logo lockup that answers the opening. Use when asked for a showreel, sizzle reel, brand reel, motion reel, "a reel like the Opus one", "show off motion design for <brand>", a 15-second brand film cut to music, or to study why a reference reel works and rebuild that energy for another brand.+---++# Motion Showreel++A showreel promises that every frame was a decision. This skill turns that into a+repeatable build: pick one motif, push it through six or seven craft chapters that+each look nothing alike, cut on the beat, and end on the motif.++The style source is [the reference breakdown](references/reference-breakdown.md), a+measured second-by-second analysis of the reel this skill was built from. Read it first.+Techniques per chapter live in [the chapter library](references/chapter-library.md).++## The grammar++1. **One motif, transformed.** Pick the brand's most reduced element (a dot, a play+ triangle, a letter, a logo corner). It opens the reel, turns into each chapter's+ material, and closes the reel as punctuation in the lockup. Nearly every+ transition turns the current object into the next one. Hard cuts are reserved+ for the flurry.+2. **Labeled craft chapters.** Six or seven, each named in the HUD by the discipline+ it demonstrates (`01 · SQUASH & STRETCH`). Use the brand's own words when it has+ them (YouTube has "chapters" and an "end screen").+3. **Show the work.** Every chapter gets one tool overlay: a physics readout, a+ selection box with a cursor, a parameter panel, a bezier graph, or a brand-native+ equivalent (a search bar, a counter, a settings menu).+4. **Persistent HUD.** Corner crop marks, a title line top left, a spec line top+ right (`1920×1080 · 60P · 129 BPM`, blinking dot), timecode bottom left, a+ progress ruler with chapter gaps bottom center, and the chapter label bottom+ right. Mono caps, tracking 0.2em, about 16px. It flips ink/paper with the+ background. Start from [the HUD template](templates/hud.html).+5. **Ink, paper, one accent, and one held-back color.** The held-back color only+ appears in the climax flurry. Every chapter change flips value (dark/light) or+ saturation (neutral/full-bleed accent).+6. **Cut on the beat, animate on the off-beats.** 120-130 BPM. Every hard cut,+ flash, and invert lands within 2 frames of a grid line. One pre-drop gap (music+ ducked for half a beat) comes before the midpoint hit.+7. **Accelerate, then hold.** For 15s at about 129 BPM (32 beats): physics intro 4+ beats, type chapter 8 beats with an internal invert, three 4-beat chapters (drop+ in the middle), a flurry of about 6 cuts in 4 beats (one beat each, then half+ beats), then about 4 beats of lockup. Roughly 75% development, 13% flurry, and+ 12% resolve.+8. **Density breathes.** One object, then a wall of type, a grid of 100, thousands+ of particles, one hero object, the flurry, and one word again.+9. **Three type voices.** A heavy display face for statements, a contrasting accent+ voice (an italic serif, or the brand's UI face), and wide-tracked mono for the+ machine layer. Type also works as texture: repeated into wallpaper, banded, and+ inverted.+10. **Physical finish.** Squash and stretch, motion blur on fast moves, bloom on+ light-on-dark, slight chromatic fringe, grain, vignette, and a dot grid on dark+ frames. It should look photographed, not exported.+11. **Bookend.** The lockup resolves from noise, a rule draws, the subtitles type on+ with a block cursor, the motif lands as the final punctuation with a squash, and+ a quiet tagline arrives last.++## Workflow++Run the scripts from the kit root. They need Node 22+ and FFmpeg with ffprobe.++### 1. Study the reference (when one is given)++```sh+node .claude/skills/motion-showreel/scripts/analyze-reference.mjs path/to/reference.mp4 video-projects/my-reel/qa/reference --fps 6 --bpm 128+```++Read every contact sheet, then `report.txt` (cuts, luminance rhythm, RMS, onsets,+and cut offsets from the beat). Write the timeline down in the shape of the+reference breakdown.++### 2. Brand intake: `BRAND.md`++Collect exact colors (from the current logo file, not a blog), typography (the+proprietary face plus the closest free substitute), official logo SVGs, signature UI+and objects, and 3-5 verified facts with dates for kinetic type. Gather real+imagery the user owns or can use. Pick the motif and the held-back climax color.+Only use brand marks the user has the right to use for the intended purpose.++### 3. Chapter map: `STORYBOARD.md`++Create the project with `npm run new-video -- my-reel`, then fill in+[the storyboard template](templates/storyboard.md). For each chapter, record the+discipline label, the brand-native object, the tool overlay, the in-transform, the+out-transform, the value (dark/paper/accent), and the SFX. Before building:++- Freeze any frame in your head: does it read as the brand with the HUD covered?+- Does every transition transform the object, except the flurry cuts?+- Does the value flip at every chapter change?++### 4. Music and the beat grid++Read `docs/TOOLS-AND-API-KEYS.md` first. Music can be the user's own licensed track+or generated. Generation is a paid call, so confirm before running it:++```sh+node .claude/skills/motion-showreel/scripts/kie.mjs music --title "Reel" --style "punchy electronic showreel, instrumental, 128 bpm, starts instantly, riser into a big drop" --out video-projects/my-reel/assets/audio+node .claude/skills/motion-showreel/scripts/music-grid.mjs video-projects/my-reel/assets/audio/take-0.mp3 --bpm 128 --beats+```++`music-grid` prints the period, the **kick-band phase** (use it), and per-bar and+per-beat energy. The full-band phase can lock onto off-beat hats and put every+splice half a beat late; the script warns when the two disagree. In the per-beat+low-band column, find the riser, the drop (a jump of 10+ dB), the break, and the+return. Then splice 32 beats: intro and build (16, ending on the drop's downbeat),+drop (8), break (4, under the flurry), and the return hit plus a tail:++```sh+node .claude/skills/motion-showreel/scripts/splice-music.mjs take-0.mp3 --period 0.4644 --phase 0.085 --segments "4-28,48-56.7" --length 15 --gap 16 --out music-bed.wav+node .claude/skills/motion-showreel/scripts/music-grid.mjs music-bed.wav --bpm 129+node .claude/skills/motion-showreel/scripts/beatgrid.mjs --period 0.4644 --length 15 --chapters "01 Physics:4, 02 Type:8, 03 Grid:4, 04 Drop:4, 05 Lookdev:4, Flurry:4, 07 End:rest"+```++The re-measured bed's kick phase should be within about 25 ms of 0. Put the+measured BPM in the HUD (129, not 128). `beatgrid` prints the frame sheet for+`STORYBOARD.md`.++### 5. SFX and the mix++Generate a kit (paid, confirm first) with `scripts/sfx.mjs` (pops, clicks,+whooshes, glitch, ticks, shimmer, sub boom, final hit, and brand-native sounds), or+use the user's own library. Place cues on the beat sheet in an `events.json` and+premix:++```sh+node .claude/skills/motion-showreel/scripts/mix.mjs --bed music-bed.wav --events events.json --out master.wav+```++Use `master.wav` as the composition's single `<audio>` track. It targets -14 LUFS+and -1.2 dBTP.++### 6. Assets++- **Hero lookdev object.** Run `kie.mjs image --ref <logo.png>` (Seedream+ image-to-image keeps the silhouette), then `kie.mjs video --image <still>` for a+ 5s Kling camera move. Both are paid calls. Kling returns 24fps: speed it up and+ re-encode at 60fps all-intra (the command is in the header of `kie.mjs`).+- **Fonts.** Download them into the project's `assets/fonts/` and use `@font-face`.+ Never rely on system fonts.++### 7. Build (HyperFrames)++Load `hyperframes` and `gsap` before writing HTML. Read `MOTION_PHILOSOPHY.md`+(showreel pacing is its fast sizzle mode) and `video-storytelling` for+persistent-world camera moves. Build one `index.html` with one paused GSAP timeline.+Chapters are timed `.clip` layers, and the HUD sits on top.++- Every time comes from the beat sheet: `const B = (n) => n * PERIOD`.+- Put a **per-frame driver** on the timeline and make it a pure function of time:+ `tl.fromTo(drv, {t:0}, {t:END, duration:END, ease:'none', onUpdate:() => frame(drv.t)}, 0)`.+ Draw canvas effects (particles, noise, big grids) there from seeded values, never+ from `Math.random()` at draw time. Drive the HUD from the same function.+- Tween only transforms and opacity. Never tween `left/top/width/height`. To morph+ a dot into a tile, draw the final tile and scale it down into a circle+ (`border-radius: 128px / 72px` on a 256x144 tile), then tween back to scale 1.+- A property animated by several tweens across the reel (a shared flash layer)+ can stick on a backward seek. Compute it in the per-frame driver instead, and+ do the same for class swaps like an invert.+- Measure layout (`getBoundingClientRect`) once, at the top of the build, before+ any `immediateRender` tween applies a transform. Never measure inside `onUpdate`.+- `<video data-start>` must not sit inside a timed `.clip`. Put videos in an+ untimed wrapper, which you can still scale for push-ins.+- Staggered phases must finish before their cut: latest completion = start + max+ delay + duration. Check it on paper, then in a render strip.+- `background-clip: text` renders invisible in capture. Use solid fills and+ `text-shadow` for bloom.++### 8. Verify before calling it done++- `npx hyperframes lint`, then Studio preview, then a draft render (`hyperframes-cli`).+- Run `analyze-reference.mjs` on your own render with `--bpm` and `--phase`: cut+ offsets must be within about 35 ms of a beat or half beat, luminance must+ alternate by chapter, and the audio must show the pre-drop dip.+- Extract 10-frame strips across every transition and look at them. Snapshots+ miss stuck or ghost layers:+ `ffmpeg -i render.mp4 -vf "select='between(n\,440\,449)',scale=384:-1,tile=layout=5x2" -frames:v 1 -fps_mode passthrough strip.png`+- Brand test: pick 6 random frames. Each must read as the brand with the HUD covered.+- Loudness is about -14 LUFS. HyperFrames re-encodes audio slightly quieter, so+ remux `master.wav` into the render (see the header of `mix.mjs`).+- Save the evidence in `VERIFY.md`.++## Example brief++The skill's first test was a 15s YouTube reel: the red scrubber dot bounces on a+progress bar, scrubs into a laser, types "broadcast yourself" into a rebuilt search+bar, becomes eight dots, then a feed of real thumbnails, and bursts from a like button+into particles that spell a verified stat. It becomes a lacquer play button and a+Silver Creator Award, runs a flurry of Subscribe, Shorts, LIVE, Skip, and "+10+seconds", and lands as the play icon in the logo. Use it as a model for mapping+chapters to a brand's native objects, not as a template to copy.diff --git a/.claude/skills/motion-showreel/references/chapter-library.md b/.claude/skills/motion-showreel/references/chapter-library.mdnew file mode 100644index 0000000..df305ff--- /dev/null+++ b/.claude/skills/motion-showreel/references/chapter-library.md@@ -0,0 +1,45 @@+# Chapter library++Each entry covers the technique, how the reference used it, how to build it seek-safe in HyperFrames (GSAP on one paused timeline), and brand swaps. Pick 5-7 and chain them so each one's out-transform is the next one's in-transform.++## Physics: squash and stretch+- **Reference:** a red dot falls onto a tick ruler and bounces three times, with a ground ellipse and a POS/SCL/VEL readout on a leader line.+- **Build:** hand-key the bounce from the beat sheet (a contact on each beat). Fall uses `power2.in`, rise uses `power2.out`. On contact, set `scaleX 1.35 / scaleY 0.7` for 2-3 frames, then `elastic.out(1, 0.5)` back. While falling fast, stretch to `scaleY 1.3`. Compute the readout text in an `onUpdate` from the dot's current `y` and velocity (the difference from the previous frame), formatted to one decimal.+- **Out-transform:** the dot accelerates sideways into a laser line (`scaleX` to 200, `height` 4px, glow), which blooms to a full-frame flash (a white layer at opacity 1 for 2 frames), then becomes the paper of the next chapter.+- **Swaps:** a video scrubber dot on a progress bar (YouTube), a cursor dot (a SaaS app), a drop of liquid (a drink brand), a pin (maps).++## Kinetic type+- **Reference:** letters drop in out of order with overshoot and motion blur. A red selection box with W/H/SX numbers and a cursor drags the word bigger. A red italic serif aside plays against heavy grotesk caps. The key word repeats into outline wallpaper, which turns diagonal with red bands, then the frame inverts.+- **Build:** split words into `<span>`s. Stagger `y: -120 -> 0` with `back.out(2)`, 1-frame offsets in a shuffled order. Fake motion blur by tweening `filter: blur(6px) -> 0` together with a `scaleY` stretch. For the selection box, an absolutely positioned div with 8 handle squares follows the word's box (read the width once after `document.fonts.ready`) and a cursor SVG moves along. For wallpaper, generate 12 rows of the word with `-webkit-text-stroke` (outline). Rotate the container -12deg, slide alternate rows in opposite directions, and fill 2 rows with the accent. For the invert, one `tl.set` swaps a background layer and the text colors on the beat.+- **Swaps:** a search bar that types the phrase (YouTube, Google), a chat input (AI products), a price tag, a headline from the brand's first slogan.++## Letters to dots to grid (shape language)+- **Reference:** letters of DECISION become red dots one by one, the dots line up in a row of 8, and the row becomes a full-frame grid. A red wave ripples, circles morph to squares, then crosses, then triangles, and the camera tilts and pushes in.+- **Build:** a grid of divs (for example 16x9) with `border-radius`. The wave is a function of time and distance from an origin: in `onUpdate`, for each cell, `phase = t*speed - dist`, then set its scale, color mix, and radius from `phase`. That is seek-safe because it is a pure function of `t`. Shape morphs are `border-radius` 50% to 8% and a `clip-path` polygon. The camera is a parent with `perspective` and `rotateX`/`rotateZ`.+- **Swaps:** a 16:9 thumbnail grid (YouTube) with real images fading into cells, app icons, product SKUs, a pixel mosaic of the logo.++## Particle system+- **Reference:** a lens iris flashes on the midpoint drop, particles burst in red, white, and blue on navy, swirl, and condense into a ring.+- **Build:** one `<canvas>` of 2,000-4,000 particles. Precompute seeded start positions and targets (any shape: a ring, a logo from sampled pixels of an image, a number). Draw every particle from `lerp(start, target, ease(clamp((t - t0)/d - delay_i)))` plus a curl offset `sin(i*1.7 + t*3)*amp*(1 - progress)`. Redraw in a proxy tween's `onUpdate` so the frame is a pure function of `tl.time()`. Use additive blending (`globalCompositeOperation = 'lighter'`) for glow.+- **Out-transform:** particles condense into the silhouette of the next chapter's hero object, then the real object crossfades in within 2-3 frames of a flash.+- **Swaps:** a like-button burst (social), confetti of product colors, data points, stars.++## Lookdev / hero object+- **Reference:** an iridescent chrome torus SDF-morphs into blobs and a cube, with a parameter readout (SDF, SMOOTH UNION, MORPH, IOR, ROUGH), and pushes into the lens.+- **Build:** a generated photoreal still (seedream i2i from the logo) plus a Kling camera move, sped up about 3x and re-encoded at 60fps all-intra. For a second material, cut or crossfade to another material of the same object (lacquer to chrome, silver to gold). Put a readout on a leader line with numbers that count up in `onUpdate`. The out push is `scale 1 -> 3` plus `blur 0 -> 20px` over the last half beat, with a hard cut on the beat.+- **Swaps:** a creator award plaque (YouTube), a bottle or can, a device, a logo sculpture.++## Easing graph+- **Reference:** a cubic-bezier(0.83, 0, 0.17, 1) curve on paper, with a ball riding it and leaving onion-skin ghosts.+- **Build:** an SVG path with `stroke-dasharray` draw-on. The ball position comes from evaluating the bezier at `ease(t)`, and the ghosts are 8 copies at earlier times with falling opacity.+- **Swaps:** a growth curve of a brand metric, a playback-speed curve.++## Flurry (4 beats, about 6 cuts)+- **Reference:** Easing, then Op Art (stripes plus target), Glitch ("REEL" RGB split), Isometric blocks, Symmetry (kaleidoscope), and pixel noise, cut on beats and then half beats, introducing the held-back blue.+- **Build:** each cut is a full-bleed layer shown by `tl.set` on its grid time with one internal move (a spin, slide, scale pop, or stutter). Glitch uses 3 copies of the text (red, cyan, and white) offset by a few px with `mix-blend-mode: screen`, plus 4-6 horizontal slices (`clip-path: inset()`) jittered on alternating frames. Noise is a canvas of big pixels in brand colors, seeded per frame.+- **Swaps:** each flurry frame is one brand signature UI moment at full bleed (YouTube: Subscribe click, a Shorts swipe, a LIVE badge, Skip Ad, a double-tap +10s, a 4K/HD badge).++## Lockup (end card)+- **Reference:** the wordmark resolves from noise with bloom, a rule draws beneath it, two mono subtitles type on with a red block cursor, the motif lands as the period with a squash and a ground ellipse, and the tagline fades in last at low opacity.+- **Build:** the noise canvas fades as the wordmark's `filter: blur(20px) -> 0` and `opacity` rise over 12 frames, and bloom is a `text-shadow` or `drop-shadow`. The rule is `scaleX 0 -> 1` from the left. For typing, reveal characters with a `steps()` tween on a width mask, or `tl.set` per character, and a blinking block via `tl.set` toggles every 16 frames. The motif fall reuses the physics chapter's contact keys.+- **Swaps:** the motif becomes the logo's own element (a scrubber dot becomes the play button, a dot becomes the i's tittle, a drop becomes the O).diff --git a/.claude/skills/motion-showreel/references/reference-breakdown.md b/.claude/skills/motion-showreel/references/reference-breakdown.mdnew file mode 100644index 0000000..013fd99--- /dev/null+++ b/.claude/skills/motion-showreel/references/reference-breakdown.md@@ -0,0 +1,50 @@+# Reference breakdown: the Opus 5.5 "CLAUDE / MOTION REEL"++Source: a 15-second motion reel made by Opus 5.5 for Nate Herk (September 2026). 1920x1080, 60fps, 15.06s, 900 frames. Analyzed with `scripts/analyze-reference.mjs` (6fps contact sheets, per-frame luminance difference, audio RMS, and onsets).++## Measured facts++- **Tempo:** 128 BPM (beat = 0.469s). Onsets at 2.39, 2.86, 3.32, 4.25, 4.71, 5.20, 5.67, 6.13 ... are exactly one beat apart. Grid anchor about 0.51s.+- **Hard cuts land on beats:** 1.77 (flash), 4.23 (invert), 7.50 (iris flash), 11.25, 11.73, 12.20, 12.43 (half beat), 12.67, 12.93 (half beat), 13.13. Every one is within 2 frames of a grid line.+- **Pre-drop dip:** audio falls from about -12 dB to -25 dB at 7.25s, then the iris flash hits at 7.50s. One gap, one hit, at the midpoint.+- **Luminance rhythm (mean 0-255, every 0.5s):** 11, 11, 14, 219, 212, 224, 190, 65, 48, 14, 17, 97, 98, 71, 22, 22, 21, 54, 46, 37, 223, 95, 109, 40, 22, 31, 32. Dark, paper, dark, saturated, navy, paper, saturated flurry, black. Chapter changes flip value.+- **Audio level:** music bed at about -12 dB RMS the whole way. No voiceover. Fade out in the last 0.25s.++## Timeline++| Time | HUD label | What happens | Out-transition |+|---|---|---|---|+| 0.00-1.78 | 01 Squash & Stretch | One red dot drops onto a tick ruler and bounces. It stretches on the fall and squashes on contact, and a ground ellipse ripples. A leader line carries a live readout (POS, SCL, VEL). | The dot smears into a horizontal red laser, the laser blooms to white, and the white becomes the paper of the next chapter. |+| 1.78-4.23 | 02 Kinetic Type | "EVERY" letters drop in with bounce and overshoot. "FRAME" gets a red design-tool selection box (W 929, H 282, SX 100.0%) and a cursor that drags it bigger. "is a" arrives in red italic serif. "DECISION" letters land out of order with motion blur, then the word repeats into outline wallpaper. | The wallpaper rotates into diagonal bands, some bands fill red, and the whole frame inverts to black on a beat. |+| 4.23-5.30 | (02 continued) | White "DECISION" glows on black. Its letters turn into red dots one at a time. | Dots become a row of 8. |+| 5.30-7.40 | 03 Shape Language | The row of dots becomes a full-frame grid. A red wave ripples through it, circles morph to squares, squares to crosses, crosses to triangles, and the camera tilts and pushes into the grid. | The grid tunnels into a lens iris. |+| 7.40-9.30 | 04 Particle Systems | An iris ring flashes (the drop), a burst of red, white, and blue particles swirls on navy, and then it condenses into a thin ring. | The particle ring solidifies into a chrome torus. |+| 9.30-11.25 | 05 Lookdev / SDF | An iridescent chrome torus tilts, then SDF-smooth-unions into blobs, then a cube. A readout tracks it (SDF, SMOOTH UNION, MORPH 0.000 to 1.994, IOR 1.40, ROUGH 0.02). | The cube pushes into the lens. Hard cut. |+| 11.25-11.73 | 06 Easing | A cubic-bezier(0.83, 0, 0.17, 1) graph on paper. A red ball rides the curve and leaves onion-skin ghosts. | Cut on the beat. |+| 11.73-12.20 | Op Art | Red and black diagonal stripes behind a blue-and-white striped target. | Cut. |+| 12.20-12.43 | Glitch | "REEL" in white on electric blue with RGB split and slice displacement. | Cut on the half beat. |+| 12.43-12.67 | Isometric | Blue and white isometric block field on red. | Cut. |+| 12.67-12.93 | Symmetry | A kaleidoscope of red and blue circles and white triangles around a ring. | Black-to-blue wipe. |+| 12.93-13.13 | (noise) | Red, blue, and white pixel noise fills the frame. | The noise resolves into the wordmark. |+| 13.13-15.06 | 07 Fin | "CLAUDE" resolves from noise with bloom. A rule draws under it. "MOTION DESIGN" and "SHOWREEL 2026" type on with a red block cursor. The red dot falls in as the period with a squash and a ground ellipse. The tagline "EVERY FRAME WRITTEN IN CODE" fades in last, dim. | Hold, then fade. |++## Persistent HUD (every frame)++- Corner crop marks, 30px arms, inset about 36px.+- Top left: `CLAUDE / MOTION REEL`. Top right: `● 1920×1080 · 60P · 128 BPM`. The dot blinks like a REC light.+- Bottom left: `TC 00:00:02:36` running timecode. Bottom center: a tick ruler that fills as a progress bar. Bottom right: `02 · KINETIC TYPE` (the reel uses a dash between number and name).+- Mono, all caps, tracking about 0.2em, about 16px, 85% white on dark or 85% ink on paper. The HUD flips color with the background.+- A faint dot grid covers the dark frames.++## Why it works++1. **One protagonist, transformed.** The red dot is a ball, then a laser, then letters, dots, a grid, particles, a ring, a torus, and a cube, and at the end it is the period. Nearly every transition turns the current object into the next one. The viewer never has to reorient, so 15 seconds feel like one continuous thought.+2. **The reel narrates its own craft.** Chapter labels name the discipline on screen. Tool overlays (the physics readout, the selection box with a cursor, SDF parameters, a bezier graph) show the work behind the frame. It reads as a designer's reel, not an ad.+3. **A small palette, with one color held back.** Ink, paper, and one red carry the first 11 seconds. Electric blue appears only in the climax flurry, so the new color feels like the drop.+4. **Value flips on the beat.** Chapter changes swap dark and light or neutral and saturated. The flash, invert, and iris cuts are the punches, and they all land on grid lines.+5. **An accelerating cut curve with a held ending.** Chapter lengths run 1.8s, 3.5s (with an internal invert), 2.1s, 1.9s, 1.9s. Then six cuts come in 1.9s at one beat and half-beat spacing, and a 1.9s lockup lets the eye rest. That is roughly 75% development, 13% flurry, and 12% resolve.+6. **Density breathes.** One dot, then one word, then a wall of words, a grid of 100, thousands of particles, one object, the flurry, and one word again. Few and many alternate.+7. **Three type voices.** Heavy grotesk caps for statements, red italic serif for the human aside, and wide-tracked mono for the machine layer. Type also works as image: repeated into wallpaper, banded, and inverted.+8. **Physical finish.** Squash and stretch, motion blur on fast letters, bloom on white-on-black, slight chromatic fringing, grain, vignette, and a lens iris. It feels shot, not exported.+9. **Scale jumps.** Macro dot, full-frame pattern, cosmic particle field, object close-up, and a push through the object into the next cut. The camera move becomes the edit.+10. **A bookend.** The first object returns as the final punctuation, and the tagline arrives last at low opacity. The ending answers the opening.diff --git a/.claude/skills/motion-showreel/scripts/analyze-reference.mjs b/.claude/skills/motion-showreel/scripts/analyze-reference.mjsnew file mode 100644index 0000000..870c640--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/analyze-reference.mjs@@ -0,0 +1,79 @@+#!/usr/bin/env node+// Break a reference reel (or your own render) into numbers you can design against.+//+// Usage: node analyze-reference.mjs <video> <out-dir> [--fps 6] [--bpm 128] [--phase 0]+//+// Writes to <out-dir>:+// sheet_NN.png contact sheets, 4x4 tiles, --fps tiles per second. Tile i of sheet k+// is at (k*16 + i) / fps seconds; report.txt lists each sheet's range.+// report.txt hard cuts, luminance every 0.5s, audio RMS every 0.25s, onsets, and+// (with --bpm) how far each cut sits from the nearest beat and half beat.+// Needs ffmpeg and ffprobe on PATH (a full build with the fps, scale, and tile filters).+import { spawnSync } from 'node:child_process';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';++const args = process.argv.slice(2);+const opt = (name, def) => { const i = args.indexOf(`--${name}`); return i >= 0 ? Number(args[i + 1]) : def; };+const [video, out] = args.filter((a, i) => !a.startsWith('--') && !(i > 0 && args[i - 1].startsWith('--')));+if (!video || !out) { console.error('Usage: node analyze-reference.mjs <video> <out-dir> [--fps 6] [--bpm 128] [--phase 0]'); process.exit(1); }+const FPS = opt('fps', 6), BPM = opt('bpm', 0), PHASE = opt('phase', 0);+mkdirSync(out, { recursive: true });++const run = (cmd, a, opts = {}) => {+ const r = spawnSync(cmd, a, { maxBuffer: 1 << 30, ...opts });+ if (r.status !== 0) throw new Error(`${cmd} failed: ${String(r.stderr).slice(0, 400)}`);+ return r.stdout;+};++// contact sheets+run('ffmpeg', ['-v', 'error', '-y', '-i', video, '-vf', `fps=${FPS},scale=480:270,tile=layout=4x4`, join(out, 'sheet_%02d.png')]);++// per-frame luminance and hard cuts at native fps+const rate = String(run('ffprobe', ['-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=r_frame_rate', '-of', 'csv=p=0', video])).trim();+const [num, den] = rate.split('/').map(Number);+const vfps = num / (den || 1);+const W = 64, H = 36, F = W * H;+const gray = run('ffmpeg', ['-v', 'error', '-i', video, '-vf', `scale=${W}:${H},format=gray`, '-f', 'rawvideo', '-']);+const n = Math.floor(gray.length / F);+const lum = [], diff = [];+for (let f = 0; f < n; f++) {+ let s = 0, d = 0;+ for (let i = 0; i < F; i++) { const v = gray[f * F + i]; s += v; if (f) d += Math.abs(v - gray[(f - 1) * F + i]); }+ lum.push(s / F); if (f) diff.push(d / F);+}+const cuts = [];+diff.forEach((d, i) => { if (d > 40 && (i === 0 || diff[i - 1] < 40)) cuts.push((i + 1) / vfps); });++const lines = [`frames ${n} at ${vfps} fps = ${(n / vfps).toFixed(2)}s`];+const sheets = Math.ceil((n / vfps) * FPS / 16);+for (let k = 0; k < sheets; k++) lines.push(`sheet_${String(k + 1).padStart(2, '0')}.png ${(k * 16 / FPS).toFixed(2)}s - ${Math.min(n / vfps, (k * 16 + 15) / FPS).toFixed(2)}s`);+lines.push('hard cuts (s): ' + cuts.map(c => c.toFixed(3)).join(' '));+const lumRow = []; for (let f = 0; f < n; f += Math.round(vfps / 2)) lumRow.push(lum[f].toFixed(0));+lines.push('luminance every 0.5s: ' + lumRow.join(' '));++// audio RMS and onsets+const pcm = spawnSync('ffmpeg', ['-v', 'error', '-i', video, '-ac', '1', '-ar', '22050', '-f', 's16le', '-'], { maxBuffer: 1 << 30 });+if (pcm.status === 0 && pcm.stdout.length > 0) {+ const x = new Int16Array(pcm.stdout.buffer, pcm.stdout.byteOffset, pcm.stdout.length >> 1);+ const SR = 22050, HOP = 512, e = [];+ for (let i = 0; i + HOP < x.length; i += HOP) { let s = 0; for (let j = 0; j < HOP; j++) { const v = x[i + j] / 32768; s += v * v; } e.push(Math.sqrt(s / HOP)); }+ const db = v => (20 * Math.log10(v + 1e-9)).toFixed(0);+ const rms = []; for (let t = 0; t < x.length / SR - 0.05; t += 0.25) rms.push(db(e[Math.floor(t * SR / HOP)] ?? 0));+ lines.push('RMS dB every 0.25s: ' + rms.join(' '));+ const on = e.slice(1).map((v, i) => Math.max(0, v - e[i]));+ const mean = on.reduce((a, b) => a + b, 0) / on.length;+ const sd = Math.sqrt(on.reduce((a, b) => a + (b - mean) ** 2, 0) / on.length);+ const pk = [];+ for (let p = 1; p < on.length - 1; p++) if (on[p] > mean + 2.5 * sd && on[p] >= on[p - 1] && on[p] >= on[p + 1]) pk.push(((p + 1) * HOP / SR).toFixed(2));+ lines.push('onsets (s): ' + pk.join(' '));+} else lines.push('no audio stream');++if (BPM) {+ const P = 60 / BPM;+ const off = (c, q) => ((((c - PHASE + q / 2) % q) + q) % q) - q / 2;+ lines.push(`cut offset from nearest beat (ms, beat ${P.toFixed(4)}s, phase ${PHASE}): ` + cuts.map(c => `${off(c, P) >= 0 ? '+' : ''}${(off(c, P) * 1000).toFixed(0)}`).join(' '));+ lines.push('cut offset from nearest half beat (ms): ' + cuts.map(c => `${off(c, P / 2) >= 0 ? '+' : ''}${(off(c, P / 2) * 1000).toFixed(0)}`).join(' '));+}+writeFileSync(join(out, 'report.txt'), lines.join('\n') + '\n');+console.log(lines.join('\n'));diff --git a/.claude/skills/motion-showreel/scripts/beatgrid.mjs b/.claude/skills/motion-showreel/scripts/beatgrid.mjsnew file mode 100644index 0000000..31258a4--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/beatgrid.mjs@@ -0,0 +1,39 @@+#!/usr/bin/env node+// Lay chapters on a beat grid and print the cut sheet (seconds and frames).+//+// Usage:+// node beatgrid.mjs --period 0.4644 --fps 60 --length 15 \+// --chapters "01 Physics:4, 02 Kinetic Type:8, 03 Grid:4, 04 Drop:4, 05 Lookdev:4, Flurry:4, 07 Fin:rest"+//+// A chapter length is in beats; "rest" fills to --length. Inside a chapter whose name+// starts with "Flurry", cuts are listed one per beat, then one per half beat.+// The default split matches the reference reel: about 75% development, 13% flurry,+// 12% resolve. Paste the output into STORYBOARD.md; in GSAP, t = frame / fps.+const args = process.argv.slice(2);+const get = (name) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : undefined; };+const bpm = Number(get('bpm') ?? 0), period = Number(get('period') ?? 0);+const fps = Number(get('fps') ?? 60), length = Number(get('length') ?? 15), chapters = get('chapters');+if (!chapters || !(period || bpm)) {+ console.error('Usage: node beatgrid.mjs (--period <s> | --bpm <n>) [--fps 60] [--length 15] --chapters "Name:beats, ..., Name:rest"');+ process.exit(1);+}+const P = period || 60 / bpm;+const fr = (t) => Math.round(t * fps);+const pad = (s, w) => String(s).padStart(w);+console.log(`beat ${P.toFixed(4)}s (${(60 / P).toFixed(2)} BPM), ${fps} fps, beat = ${(P * fps).toFixed(2)} frames\n`);+console.log(`${'chapter'.padEnd(24)} ${pad('beats', 11)} ${pad('start s', 8)} ${pad('end s', 8)} ${pad('frames', 11)}`);+let b = 0;+for (const part of chapters.split(',').map((c) => c.trim()).filter(Boolean)) {+ const k = part.lastIndexOf(':');+ const name = part.slice(0, k).trim(), n = part.slice(k + 1).trim();+ const t0 = b * P;+ const nb = n === 'rest' ? length / P - b : Number(n);+ const t1 = n === 'rest' ? length : (b + nb) * P;+ console.log(`${name.padEnd(24)} ${pad(`${b.toFixed(1)}-${(b + nb).toFixed(1)}`, 11)} ${pad(t0.toFixed(3), 8)} ${pad(t1.toFixed(3), 8)} ${pad(`${fr(t0)}-${fr(t1)}`, 11)}`);+ if (name.toLowerCase().startsWith('flurry')) {+ // one beat per cut, then half beats: the cut rate accelerates into the lockup+ for (let s = 0; s < nb - 1e-6; s += s < nb / 2 ? 1 : 0.5) console.log(`${' cut'.padEnd(24)} ${pad((b + s).toFixed(1), 11)} ${pad(((b + s) * P).toFixed(3), 8)} ${pad('', 8)} ${pad(fr((b + s) * P), 11)}`);+ }+ b += nb;+}+console.log(`\ntotal ${length.toFixed(2)}s = ${fr(length)} frames`);diff --git a/.claude/skills/motion-showreel/scripts/kie.mjs b/.claude/skills/motion-showreel/scripts/kie.mjsnew file mode 100644index 0000000..854fed3--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/kie.mjs@@ -0,0 +1,103 @@+#!/usr/bin/env node+// Minimal Kie.ai client for showreel assets: instrumental music (Suno), hero stills+// (Seedream image-to-image from your logo), and camera moves (Kling image-to-video).+// Every command is a PAID call on your own Kie.ai credits. Confirm with the user first.+//+// node kie.mjs credit+// node kie.mjs music --title "Broadcast" --style "punchy electronic showreel, 128 bpm, big drop" --out assets/audio+// node kie.mjs image --ref logo.png --prompt "photoreal 3D sculpture of this exact icon..." --out assets/img/hero.png+// node kie.mjs video --image assets/img/hero.png --prompt "slow orbit, object stays rigid..." --out assets/video/hero-raw.mp4+//+// Reads KIE_API_KEY from the environment or the workspace .env. API docs: https://docs.kie.ai/+// Kling returns 24fps. Speed it up and re-encode all-intra for seek-safe rendering, e.g.+// ffmpeg -i hero-raw.mp4 -an -vf "setpts=PTS/3,fps=60" -c:v libx264 -crf 16 -g 1 -keyint_min 1 -bf 0 -pix_fmt yuv420p hero-60.mp4+import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';+import { dirname, resolve, basename, join, extname } from 'node:path';+import { fileURLToPath } from 'node:url';++function loadKey() {+ if (process.env.KIE_API_KEY) return process.env.KIE_API_KEY;+ let dir = dirname(fileURLToPath(import.meta.url));+ for (let i = 0; i < 8; i++, dir = dirname(dir)) {+ const f = join(dir, '.env');+ if (existsSync(f)) {+ const m = readFileSync(f, 'utf8').match(/^\s*KIE_API_KEY\s*=\s*"?([^"\r\n]+)"?/m);+ if (m) return m[1].trim();+ }+ }+ throw new Error('KIE_API_KEY is not set. Add it to .env (see docs/TOOLS-AND-API-KEYS.md).');+}+const KEY = loadKey();+const H = { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' };+const MIME = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.mp3': 'audio/mpeg' };++export async function upload(file) {+ const b64 = readFileSync(file).toString('base64');+ const r = await fetch('https://kieai.redpandaai.co/api/file-base64-upload', {+ method: 'POST', headers: H,+ body: JSON.stringify({ base64Data: `data:${MIME[extname(file).toLowerCase()] ?? 'application/octet-stream'};base64,${b64}`, uploadPath: 'motion-showreel', fileName: basename(file) }),+ });+ const j = await r.json();+ if (!j.data?.downloadUrl) throw new Error('upload failed: ' + JSON.stringify(j).slice(0, 300));+ return j.data.downloadUrl;+}+export async function create(model, input) {+ const r = await fetch('https://api.kie.ai/api/v1/jobs/createTask', { method: 'POST', headers: H, body: JSON.stringify({ model, input }) });+ const j = await r.json();+ if (j.code !== 200) throw new Error(`create ${model} failed: ` + JSON.stringify(j).slice(0, 300));+ return j.data.taskId;+}+export async function poll(taskId, every = 8000, max = 1_800_000) {+ const t0 = Date.now();+ while (Date.now() - t0 < max) {+ const j = await (await fetch(`https://api.kie.ai/api/v1/jobs/recordInfo?taskId=${taskId}`, { headers: H })).json();+ if (j.data?.state === 'success') return JSON.parse(j.data.resultJson);+ if (j.data?.state === 'fail') throw new Error('task failed: ' + JSON.stringify(j.data).slice(0, 300));+ await new Promise((res) => setTimeout(res, every));+ }+ throw new Error('timeout waiting for ' + taskId);+}+export async function download(url, out) {+ mkdirSync(dirname(resolve(out)), { recursive: true });+ const r = await fetch(url);+ writeFileSync(out, Buffer.from(await r.arrayBuffer()));+ return out;+}++const [cmd, ...rest] = process.argv.slice(2);+const get = (name) => { const i = rest.indexOf(`--${name}`); return i >= 0 ? rest[i + 1] : undefined; };+const isMain = process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url);+if (isMain) {+ try {+ if (cmd === 'credit') {+ console.log(await (await fetch('https://api.kie.ai/api/v1/chat/credit', { headers: H })).json());+ } else if (cmd === 'music') {+ const id = await create('ai-music-api/generate', {+ custom_mode: true, instrumental: true, model: 'V6', title: get('title') ?? 'Showreel', prompt: '',+ style: get('style') ?? 'punchy modern electronic motion-design showreel, instrumental, 128 bpm, starts instantly, riser into a big drop, clean modern mix, no vocals',+ negative_tags: get('negative') ?? 'vocals, singing, lyrics, choir, lo-fi, sad, acoustic, orchestral',+ });+ console.log('task', id);+ const r = await poll(id, 10000);+ const out = get('out') ?? '.';+ const urls = [...new Set(JSON.stringify(r).match(/https?:[^"]+?\.(?:mp3|wav)/g) ?? [])].filter((u) => !u.includes('/stream/'));+ let i = 0; for (const u of urls) console.log('saved', await download(u, join(out, `take-${i++}.mp3`)));+ } else if (cmd === 'image') {+ const ref = get('ref');+ const input = { prompt: get('prompt'), aspect_ratio: get('aspect') ?? '16:9', quality: 'high', output_format: 'png' };+ if (ref) input.image_urls = [await upload(ref)];+ const id = await create(ref ? 'seedream/5-pro-image-to-image' : 'seedream/5-pro-text-to-image', input);+ console.log('task', id);+ const r = await poll(id, 6000);+ console.log('saved', await download(r.resultUrls[0], get('out') ?? 'still.png'));+ } else if (cmd === 'video') {+ const id = await create('kling/v3-turbo-image-to-video', { prompt: get('prompt'), image_urls: [await upload(get('image'))], duration: get('duration') ?? '5', resolution: '1080p' });+ console.log('task', id);+ const r = await poll(id, 10000);+ console.log('saved', await download(r.resultUrls[0], get('out') ?? 'clip-raw.mp4'));+ } else {+ console.error('Commands: credit | music | image | video (see the header of this file)');+ process.exitCode = 1;+ }+ } catch (e) { console.error(e.message); process.exitCode = 1; }+}diff --git a/.claude/skills/motion-showreel/scripts/mix.mjs b/.claude/skills/motion-showreel/scripts/mix.mjsnew file mode 100644index 0000000..10de6e2--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/mix.mjs@@ -0,0 +1,42 @@+#!/usr/bin/env node+// Premix the music bed and beat-placed SFX into one master wav with ffmpeg.+//+// Usage: node mix.mjs --bed music-bed.wav --events events.json --out master.wav [--length 15] [--lufs -14] [--bed-gain 0.9]+// events.json: [{ "t": 0.4644, "file": "assets/audio/sfx/dot_pop.mp3", "gain": 0.5, "max": 0.5 }, ...]+// t seconds (compute from the beat sheet: beat * period)+// gain linear gain on the cue as generated (start around 0.2-0.6; hero hits up to 0.9)+// max optional: trim a long cue to this many seconds, with a 40 ms fade+// Two-pass loudnorm to --lufs (default -14 LUFS, -1.2 dBTP). Place the result as the single+// <audio> track of the composition. HyperFrames re-encodes audio slightly quieter; after+// rendering, remux the master: ffmpeg -i render.mp4 -i master.wav -map 0:v -map 1:a -c:v copy -c:a aac -b:a 256k -shortest final.mp4+import { spawnSync } from 'node:child_process';+import { readFileSync } from 'node:fs';++const args = process.argv.slice(2);+const get = (n, d) => { const i = args.indexOf(`--${n}`); return i >= 0 ? args[i + 1] : d; };+const bed = get('bed'), eventsFile = get('events'), out = get('out', 'master.wav');+const LEN = Number(get('length', 15)), LUFS = Number(get('lufs', -14)), BED = Number(get('bed-gain', 0.9));+if (!bed || !eventsFile) { console.error('Usage: node mix.mjs --bed bed.wav --events events.json --out master.wav'); process.exit(1); }+const events = JSON.parse(readFileSync(eventsFile, 'utf8'));++const inputs = ['-i', bed], parts = [`[0:a]aresample=48000,volume=${BED}[b]`], labels = ['[b]'];+events.forEach((e, i) => {+ inputs.push('-i', e.file);+ const trim = e.max ? `atrim=0:${e.max},afade=t=out:st=${Math.max(0, e.max - 0.04)}:d=0.04,` : '';+ const ms = Math.round(e.t * 1000);+ parts.push(`[${i + 1}:a]aresample=48000,aformat=channel_layouts=stereo,${trim}volume=${e.gain},adelay=${ms}|${ms}[e${i}]`);+ labels.push(`[e${i}]`);+});+parts.push(`${labels.join('')}amix=inputs=${labels.length}:normalize=0:duration=first,atrim=0:${LEN}[m]`);+const graph = parts.join(';');+const ff = (tail, extra) => spawnSync('ffmpeg', ['-hide_banner', ...inputs, '-filter_complex', graph + tail, ...extra], { encoding: 'utf8', maxBuffer: 1 << 26 });++// pass 1: measure+const m = ff(`;[m]loudnorm=I=${LUFS}:TP=-1.2:LRA=11:print_format=json[o]`, ['-map', '[o]', '-f', 'null', '-']);+if (m.status !== 0) { console.error(m.stderr.slice(-800)); process.exit(1); }+const js = JSON.parse(m.stderr.slice(m.stderr.lastIndexOf('{'), m.stderr.lastIndexOf('}') + 1));+// pass 2: normalize linearly, then a safety limiter+const af = `loudnorm=I=${LUFS}:TP=-1.2:LRA=11:measured_I=${js.input_i}:measured_TP=${js.input_tp}:measured_LRA=${js.input_lra}:measured_thresh=${js.input_thresh}:offset=${js.target_offset}:linear=true,alimiter=limit=0.87:level=false,aresample=48000`;+const r = ff(`;[m]${af}[o]`, ['-v', 'error', '-y', '-map', '[o]', '-t', String(LEN), '-c:a', 'pcm_s24le', out]);+if (r.status !== 0) { console.error(r.stderr.slice(-800)); process.exit(1); }+console.log(`${out}: bed + ${events.length} cues, input ${js.input_i} LUFS -> ${LUFS} LUFS`);diff --git a/.claude/skills/motion-showreel/scripts/music-grid.mjs b/.claude/skills/motion-showreel/scripts/music-grid.mjsnew file mode 100644index 0000000..3187fca--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/music-grid.mjs@@ -0,0 +1,80 @@+#!/usr/bin/env node+// Measure a music take's true beat grid and energy map so it can be spliced onto a cut grid.+//+// Usage: node music-grid.mjs <take.mp3> [--bpm 128] [--beats] [--json grid.json]+//+// Beat trackers drift on generated music, so this autocorrelates an onset envelope near+// the target BPM and refines the period with a fold sweep. The phase (downbeat offset) is+// folded from the KICK band (ffmpeg lowpass at 120 Hz). The full-band fold can lock onto+// off-beat hi-hats and put every splice half a beat late; both are printed so you can see it.+// Prints one row per bar (RMS dB, low-band dB, onset density); --beats adds one row per beat.+// Use the rows to find the intro, the riser, the drop, the break, and a clean return hit.+// Needs ffmpeg on PATH.+import { spawnSync } from 'node:child_process';+import { writeFileSync } from 'node:fs';++const args = process.argv.slice(2);+const get = (name) => { const i = args.indexOf(`--${name}`); return i >= 0 ? args[i + 1] : undefined; };+const file = args[0];+if (!file || file.startsWith('--')) { console.error('Usage: node music-grid.mjs <take.mp3> [--bpm 128] [--beats] [--json grid.json]'); process.exit(1); }+const BPM = Number(get('bpm') ?? 128), SR = 22050;++function decode(filter) {+ const a = ['-v', 'error', '-i', file, '-ac', '1', '-ar', String(SR)];+ if (filter) a.push('-af', filter);+ const r = spawnSync('ffmpeg', [...a, '-f', 's16le', '-'], { maxBuffer: 1 << 30 });+ if (r.status !== 0) throw new Error('ffmpeg failed: ' + String(r.stderr).slice(0, 300));+ const s = new Int16Array(r.stdout.buffer, r.stdout.byteOffset, r.stdout.length >> 1);+ return Float32Array.from(s, (v) => v / 32768);+}+const energy = (x, hop, win) => {+ const e = [];+ for (let i = 0; i + win < x.length; i += hop) { let s = 0; for (let j = 0; j < win; j++) s += x[i + j] * x[i + j]; e.push(s / win); }+ return e;+};+const onset = (e) => e.map((v, i) => (i ? Math.max(0, Math.log(v + 1e-10) - Math.log(e[i - 1] + 1e-10)) : 0));++const full = decode(), low = decode('lowpass=f=120,lowpass=f=120');+// Long windows (46 ms) give a smooth envelope for the period and the energy tables.+// Short windows (12 ms) give the phase; frame i covers [i*hop, i*hop + win) and an attack+// registers when it enters the window's END, so fold times are shifted by the window length.+const HOP = 256, WIN = 1024, fps = SR / HOP, dur = full.length / SR;+const eF = energy(full, HOP, WIN), eL = energy(low, HOP, WIN), oF = onset(eF);+const SHOP = 64, SWIN = 256, sfps = SR / SHOP;+const oFs = onset(energy(full, SHOP, SWIN)), oLs = onset(energy(low, SHOP, SWIN));++// period: autocorrelation peak within +-6% of the target, refined by fold strength+const mean = oF.reduce((a, b) => a + b, 0) / oF.length, c = oF.map((v) => v - mean);+const lo = Math.floor((fps * 60) / (BPM * 1.06)), hi = Math.ceil((fps * 60) / (BPM * 0.94));+let lag = lo, best = -Infinity;+for (let L = lo; L <= hi; L++) { let s = 0; for (let i = 0; i + L < c.length; i++) s += c[i] * c[i + L]; if (s > best) { best = s; lag = L; } }+const fold = (o, P, bins, rate = fps, lead = WIN / SR) => {+ const b = new Float64Array(bins);+ o.forEach((v, i) => { b[Math.floor(((((i / rate + lead) % P) + P) % P / P) * bins) % bins] += v; });+ let k = 0; for (let i = 1; i < bins; i++) if (b[i] > b[k]) k = i;+ const avg = b.reduce((x, y) => x + y, 0) / bins;+ return { strength: b[k], phase: ((k + 0.5) / bins) * P, contrast: b[k] / avg };+};+let P = lag / fps, top = -Infinity;+for (let k = 0; k <= 80; k++) { const p = (lag / fps) * (0.99 + (0.02 * k) / 80); const f = fold(oF, p, 64, fps, 0); if (f.strength > top) { top = f.strength; P = p; } }+const fullPh = fold(oFs, P, 96, sfps, SWIN / SR), kick = fold(oLs, P, 96, sfps, SWIN / SR);+const PH = kick.phase;+console.log(`period ${P.toFixed(4)}s bpm ${(60 / P).toFixed(2)} duration ${dur.toFixed(2)}s`);+console.log(`kick-band phase ${PH.toFixed(3)}s (contrast ${kick.contrast.toFixed(1)}) full-band phase ${fullPh.phase.toFixed(3)}s -> use the kick phase`);+const gap = Math.abs(((fullPh.phase - PH + P / 2) % P + P) % P - P / 2);+if (gap > P / 4) console.log('warning: the full-band phase sits about half a beat from the kick; hats dominate the full band');++const db = (v) => 10 * Math.log10(v + 1e-12);+const span = (e, t0, t1) => { const a = Math.floor(t0 * fps), b = Math.max(a + 1, Math.floor(t1 * fps)); let s = 0; for (let i = a; i < b && i < e.length; i++) s += e[i]; return s / (b - a); };+const rows = [];+for (let b = 0; PH + (b + 1) * 4 * P <= dur; b++) {+ const t0 = PH + b * 4 * P, t1 = t0 + 4 * P;+ const r = { bar: b, beat: b * 4, t: +t0.toFixed(3), rms_db: +db(span(eF, t0, t1)).toFixed(1), low_db: +db(span(eL, t0, t1)).toFixed(1), onset: +span(oF, t0, t1).toFixed(3) };+ rows.push(r);+ console.log(`bar ${String(b).padStart(3)} beat ${String(b * 4).padStart(3)} t ${t0.toFixed(2).padStart(7)} rms ${r.rms_db.toFixed(1).padStart(6)} low ${r.low_db.toFixed(1).padStart(6)} onset ${r.onset.toFixed(2)} ` + '#'.repeat(Math.max(0, Math.round(r.rms_db + 40))));+}+const beats = [];+for (let n = 0; PH + (n + 1) * P <= dur; n++) { const t0 = PH + n * P; beats.push({ beat: n, t: +t0.toFixed(3), low_db: +db(span(eL, t0, t0 + P)).toFixed(1) }); }+if (args.includes('--beats')) for (const r of beats) console.log(`beat ${String(r.beat).padStart(3)} t ${r.t.toFixed(2).padStart(7)} low ${r.low_db.toFixed(1).padStart(6)} ` + '#'.repeat(Math.max(0, Math.round(r.low_db + 60))));+const json = get('json');+if (json) writeFileSync(json, JSON.stringify({ period: P, phase: PH, fullBandPhase: fullPh.phase, bars: rows, beats }, null, 1));diff --git a/.claude/skills/motion-showreel/scripts/sfx.mjs b/.claude/skills/motion-showreel/scripts/sfx.mjsnew file mode 100644index 0000000..69d2c7b--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/sfx.mjs@@ -0,0 +1,38 @@+#!/usr/bin/env node+// Generate an SFX kit with ElevenLabs sound generation. PAID calls: confirm with the user first.+//+// Usage: node sfx.mjs kit.json assets/audio/sfx+// kit.json: { "dot_pop": ["tiny rubbery bouncy ball pop, clean digital", 0.5], ... }+// Durations must be 0.5-30 seconds. Existing files are skipped, so reruns are free.+// A good showreel kit: dot_pop, click, whoosh, whoosh_big, laser, sub_boom, glitch, ticks,+// shimmer, tape_stop, final_hit, plus brand-native sounds (typing, a notification bell, a like pop).+// Reads ELEVENLABS_API_KEY from the environment or the workspace .env.+import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';++function loadKey() {+ if (process.env.ELEVENLABS_API_KEY) return process.env.ELEVENLABS_API_KEY;+ let dir = dirname(fileURLToPath(import.meta.url));+ for (let i = 0; i < 8; i++, dir = dirname(dir)) {+ const f = join(dir, '.env');+ if (existsSync(f)) { const m = readFileSync(f, 'utf8').match(/^\s*ELEVENLABS_API_KEY\s*=\s*"?([^"\r\n]+)"?/m); if (m) return m[1].trim(); }+ }+ throw new Error('ELEVENLABS_API_KEY is not set. Add it to .env (see docs/TOOLS-AND-API-KEYS.md).');+}+const [kitFile, outDir] = process.argv.slice(2);+if (!kitFile || !outDir) { console.error('Usage: node sfx.mjs kit.json <out-dir>'); process.exit(1); }+const kit = JSON.parse(readFileSync(kitFile, 'utf8'));+const key = loadKey();+mkdirSync(outDir, { recursive: true });+await Promise.all(Object.entries(kit).map(async ([name, [text, seconds]]) => {+ const out = join(outDir, `${name}.mp3`);+ if (existsSync(out)) return console.log(name, 'exists');+ const r = await fetch('https://api.elevenlabs.io/v1/sound-generation', {+ method: 'POST', headers: { 'xi-api-key': key, 'Content-Type': 'application/json' },+ body: JSON.stringify({ text, duration_seconds: Math.max(0.5, seconds), prompt_influence: 0.6 }),+ });+ if (!r.ok) { console.log(name, 'ERROR', r.status, (await r.text()).slice(0, 200)); process.exitCode = 1; return; }+ writeFileSync(out, Buffer.from(await r.arrayBuffer()));+ console.log(name, 'saved');+}));diff --git a/.claude/skills/motion-showreel/scripts/splice-music.mjs b/.claude/skills/motion-showreel/scripts/splice-music.mjsnew file mode 100644index 0000000..acf60ed--- /dev/null+++ b/.claude/skills/motion-showreel/scripts/splice-music.mjs@@ -0,0 +1,38 @@+#!/usr/bin/env node+// Splice a music take onto the cut grid, beat-accurate, with ffmpeg.+//+// Usage:+// node splice-music.mjs <take.mp3> --period 0.4644 --phase 0.073 \+// --segments "4-28,48-56.7" --length 15 --gap 16 --fade 0.9 --out assets/audio/music-bed.wav+//+// --period/--phase from music-grid.mjs (use the KICK-band phase)+// --segments source beat ranges, played in order. Output beat 0 = the first segment's start.+// Typical 15s reel at ~129 BPM: intro + build (16 beats) ending on the drop's+// downbeat, drop (8), break (4, under the flurry), then the return hit + tail.+// --gap N duck the half beat before OUTPUT beat N to -16 dB (the pre-drop gap)+// --fade S fade the last S seconds+// Every cut lands 12 ms before a grid point so the transient survives, joined by a 12 ms+// crossfade; each segment but the last is extended by the crossfade so beats stay on the grid.+// Re-measure the result with music-grid.mjs: its kick phase should be close to 0.+import { spawnSync } from 'node:child_process';++const args = process.argv.slice(2);+const get = (n, d) => { const i = args.indexOf(`--${n}`); return i >= 0 ? args[i + 1] : d; };+const take = args[0];+const P = Number(get('period')), PH = Number(get('phase', 0)), LEN = Number(get('length', 15));+const segs = String(get('segments', '')).split(',').filter(Boolean).map((s) => s.split('-').map(Number));+const gap = get('gap') !== undefined ? Number(get('gap')) : null, fade = Number(get('fade', 0.9)), out = get('out', 'music-bed.wav');+if (!take || !P || !segs.length) { console.error('Usage: node splice-music.mjs <take> --period <s> --phase <s> --segments "a-b,c-d" [--length 15] [--gap 16] [--fade 0.9] [--out bed.wav]'); process.exit(1); }++const PRE = 0.012, XF = 0.012;+const t = (beat) => Math.max(0, PH + beat * P - PRE);+const parts = segs.map(([a, b], i) => `[0:a]asetpts=PTS-STARTPTS,atrim=start=${t(a).toFixed(5)}:end=${(t(b) + (i < segs.length - 1 ? XF : 0)).toFixed(5)},asetpts=PTS-STARTPTS[s${i}]`);+let chain = '[s0]';+for (let i = 1; i < segs.length; i++) { parts.push(`${chain}[s${i}]acrossfade=d=${XF}:c1=qsin:c2=qsin[x${i}]`); chain = `[x${i}]`; }+const post = [`apad=whole_dur=${LEN}`, `atrim=0:${LEN}`];+if (gap !== null) { const g0 = (gap - 0.5) * P, g1 = gap * P - 0.004; post.push(`volume=0.158:enable='between(t,${g0.toFixed(4)},${g1.toFixed(4)})'`); }+if (fade > 0) post.push(`afade=t=out:st=${(LEN - fade).toFixed(3)}:d=${fade}`);+parts.push(`${chain}${post.join(',')}[out]`);+const r = spawnSync('ffmpeg', ['-v', 'error', '-y', '-i', take, '-filter_complex', parts.join(';'), '-map', '[out]', '-ar', '48000', '-ac', '2', '-c:a', 'pcm_s24le', out], { encoding: 'utf8' });+if (r.status !== 0) { console.error(r.stderr); process.exit(1); }+console.log(`${out}: ${segs.map(([a, b]) => `src beats ${a}-${b}`).join(' + ')}, ${LEN}s${gap !== null ? `, gap before beat ${gap} (${(gap * P).toFixed(3)}s)` : ''}`);diff --git a/.claude/skills/motion-showreel/templates/hud.html b/.claude/skills/motion-showreel/templates/hud.htmlnew file mode 100644index 0000000..0ec9fb8--- /dev/null+++ b/.claude/skills/motion-showreel/templates/hud.html@@ -0,0 +1,80 @@+<!--+ motion-showreel HUD layer. Paste the <style> block into the composition's <style>,+ the #hud markup as the LAST child of #root (above flash/vignette/grain), and call+ hudFrame(t) from the per-frame driver (a pure function of t, so it is seek-safe).++ Swap per brand:+ --hud-acc brand accent (the motif color)+ .hud-tl brand mark + "BRAND / MOTION REEL"+ .hud-tr spec line: resolution, fps, measured BPM (use the real measured value)+ #ptime use the brand's own time format if it has one (YouTube: "0:02 / 0:15"),+ otherwise "TC 00:00:02:36"+ CH chapter labels, in the brand's language where possible+ SEGB chapter boundaries in beats -> gaps in the progress bar+ paperRanges time ranges where the background is light, so the HUD flips to ink+-->+<style>+ #hud { position: absolute; inset: 0; z-index: 95; color: rgba(241, 241, 241, 0.88); --hud-acc: #ff0033; }+ #hud.paper { color: rgba(15, 15, 15, 0.85); }+ #hud .mono { font-family: "Roboto Mono", monospace; font-weight: 500; text-transform: uppercase; letter-spacing: 0.2em; }+ .cm { position: absolute; width: 30px; height: 30px; border-color: currentColor; border-style: solid; border-width: 0; }+ .cm.tl { left: 36px; top: 36px; border-left-width: 2px; border-top-width: 2px; }+ .cm.tr { right: 36px; top: 36px; border-right-width: 2px; border-top-width: 2px; }+ .cm.bl { left: 36px; bottom: 36px; border-left-width: 2px; border-bottom-width: 2px; }+ .cm.br { right: 36px; bottom: 36px; border-right-width: 2px; border-bottom-width: 2px; }+ .hud-tl, .hud-tr { position: absolute; top: 62px; font-size: 16px; line-height: 24px; white-space: pre; }+ .hud-tl { left: 72px; }+ .hud-tr { right: 72px; }+ #rec { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--hud-acc); margin-right: 12px; vertical-align: 1px; }+ #ptime { position: absolute; left: 72px; top: 996px; font-size: 22px; font-weight: 500; }+ #hbar { position: absolute; left: 640px; top: 1006px; width: 640px; height: 5px; }+ .hseg { position: absolute; top: 0; height: 5px; background: rgba(255, 255, 255, 0.26); overflow: hidden; }+ #hud.paper .hseg { background: rgba(15, 15, 15, 0.16); }+ .hseg .buf { position: absolute; left: 0; top: 0; height: 100%; background: rgba(255, 255, 255, 0.28); }+ #hud.paper .hseg .buf { background: rgba(15, 15, 15, 0.14); }+ .hseg .pl { position: absolute; left: 0; top: 0; height: 100%; background: var(--hud-acc); }+ #hdot { position: absolute; top: 2.5px; left: 0; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%; background: var(--hud-acc); }+ .hud-br { position: absolute; right: 72px; top: 996px; font-size: 16px; line-height: 24px; white-space: pre; }+</style>++<div id="hud">+ <i class="cm tl"></i><i class="cm tr"></i><i class="cm bl"></i><i class="cm br"></i>+ <div class="hud-tl mono">BRAND / MOTION REEL</div>+ <div class="hud-tr mono"><i id="rec"></i>1920×1080 · 60P · 128 BPM</div>+ <div id="ptime" class="mono">TC 00:00:00:00</div>+ <div id="hbar"><i id="hdot"></i></div>+ <div class="hud-br mono"><span id="chlab">01 · PHYSICS</span></div>+</div>++<script>+ // Call once after fonts are ready; returns hudFrame(t) for the per-frame driver.+ function makeHud({ P, END = 15, FPS = 60, CH, SEGB, paperRanges = [], timeFormat = "tc" }) {+ const $ = (s) => document.querySelector(s);+ const h = (n) => { const x = Math.sin(n * 127.1 + 311.7) * 43758.5453; return x - Math.floor(x); };+ const clamp = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x));+ const pad = (n) => String(n).padStart(2, "0");+ const GLY = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#/";+ const hbar = $("#hbar"), hud = $("#hud"), rec = $("#rec"), ptime = $("#ptime"), hdot = $("#hdot"), chlab = $("#chlab");+ const segs = [];+ for (let i = 0; i < SEGB.length - 1; i++) {+ const x0 = ((SEGB[i] * P) / END) * 640 + (i ? 2 : 0), x1 = Math.min(640, ((SEGB[i + 1] * P) / END) * 640) - (i < SEGB.length - 2 ? 2 : 0);+ const s = document.createElement("div"); s.className = "hseg"; s.style.left = x0 + "px"; s.style.width = x1 - x0 + "px";+ s.innerHTML = '<i class="buf"></i><i class="pl"></i>'; hbar.insertBefore(s, hdot);+ segs.push({ pl: s.querySelector(".pl"), buf: s.querySelector(".buf"), x0, w: x1 - x0 });+ }+ return function hudFrame(t) {+ const fr = Math.round(t * FPS), f = t / END;+ ptime.textContent = timeFormat === "yt" ? `0:${pad(Math.min(END, Math.floor(t + 1e-4)))} / 0:${pad(END)}` : `TC 00:00:${pad(Math.floor(fr / FPS))}:${pad(fr % FPS)}`;+ segs.forEach((s) => { const x = f * 640 - s.x0; s.pl.style.width = clamp(x, 0, s.w) + "px"; s.buf.style.width = clamp(x + 70, 0, s.w) + "px"; });+ hdot.style.left = f * 640 + "px";+ hud.classList.toggle("paper", paperRanges.some(([a, b]) => t >= a && t < b));+ rec.style.opacity = (t / P) % 1 < 0.5 ? 1 : 0.25; // blinks on the beat+ let c = CH[0]; for (const e of CH) if (t >= e[0] - 1e-4) c = e;+ const since = t - c[0];+ if (since < 0.16 && c[0] > 0) { // scramble-in for 0.16s on every chapter change+ const n = Math.floor((since / 0.16) * c[1].length);+ chlab.textContent = c[1].split("").map((ch, i) => (i < n || ch === " " || ch === "·" ? ch : GLY[Math.floor(h(fr * 13 + i) * GLY.length)])).join("");+ } else chlab.textContent = c[1];+ };+ }+</script>diff --git a/.claude/skills/motion-showreel/templates/storyboard.md b/.claude/skills/motion-showreel/templates/storyboard.mdnew file mode 100644index 0000000..8433629--- /dev/null+++ b/.claude/skills/motion-showreel/templates/storyboard.md@@ -0,0 +1,20 @@+# Storyboard: <Brand> Showreel <length>s++Grid: <period>s beats (<bpm> BPM measured), <fps>fps. `B(n) = n * <period>`. Frame sheet: `qa/beatsheet.txt` (from `scripts/beatgrid.mjs`).+Motif: <the brand's most reduced element>. Held-back climax color: <color, flurry only>.++| Beats | Time | HUD label | Value | Frame | Tool overlay | In-transform | Out-transform | SFX |+|---|---|---|---|---|---|---|---|---|+| 0-4 | | 01 · <physics> | ink | the motif enters and obeys physics | live readout | (opening) | motif becomes <laser / line / flash> | pops on contacts |+| 4-12 | | 02 · <type> | paper, invert at B10 | brand phrase as kinetic type, 3 type voices, wallpaper | brand-native input (search bar, chat box) or selection box | flash becomes paper | letters become motif copies | typing, click, invert hit |+| 12-16 | | 03 · <grid> | ink | motif copies become a grid of real brand imagery, wave, camera tilt | grid readout | dots become tiles | push into one tile; pre-drop gap | swishes, whoosh |+| 16-20 | | 04 · <particles> | ink + accent glow | the drop: burst into particles that form a verified stat | particle readout | tile becomes a burst | particles become the hero silhouette | boom, pop, ticks |+| 20-24 | | 05 · <lookdev> | ink | photoreal hero object, two materials | material readout, counter | silhouette becomes the object | push through the lens, hard cut | shimmer, whoosh |+| 24-28 | | 06 · <flurry> | alternating, held-back color arrives | 5-6 signature UI moments, 1 beat then half beats | each moment's own UI | hard cuts | noise | clicks, glitch, tape stop |+| 28-end | | 07 · <end> | ink | logo resolves, rule draws, subtitles type, the motif lands as the logo's own element, tagline last | typing cursor | noise resolves | hold | final hit, pop |++Checks before building:+- [ ] Freeze any frame: it reads as the brand without the HUD.+- [ ] Every transition transforms the object (except flurry cuts).+- [ ] Value flips at every chapter change.+- [ ] Every fact on screen is verified and dated in BRAND.md.diff --git a/AGENTS.md b/AGENTS.mdindex 8c7ce7c..c242c78 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -21,6 +21,7 @@ For one stage, load the matching local skill:| Need | Skill || --- | --- || Reels, Shorts, and short advertisements | `short-form-edit` |+| Motion-design showreels and brand reels cut to music | `motion-showreel` || Existing May Shorts example maintenance | `short-form-video` || New motion-graphics video from a brief | `make-a-video` || Website-inspired compositions | `website-to-hyperframes` |diff --git a/CLAUDE.md b/CLAUDE.mdindex 8c7ce7c..c242c78 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -21,6 +21,7 @@ For one stage, load the matching local skill:| Need | Skill || --- | --- || Reels, Shorts, and short advertisements | `short-form-edit` |+| Motion-design showreels and brand reels cut to music | `motion-showreel` || Existing May Shorts example maintenance | `short-form-video` || New motion-graphics video from a brief | `make-a-video` || Website-inspired compositions | `website-to-hyperframes` |diff --git a/README.md b/README.mdindex 7c48778..540dc7a 100644--- a/README.md+++ b/README.md@@ -22,7 +22,7 @@ https://github.com/user-attachments/assets/4ad48761-d14c-407a-9dec-1b76a9afb04a## What's included-- **14 skills**, mirrored for both assistants, with their helper scripts and references.+- **15 skills**, mirrored for both assistants, with their helper scripts and references.- **406 draft motion-graphics cards** across two styles, with manifests, CSS tokens, and editable slots.- **Two scene templates:** dark graph paper and a left glass popout.- Transcription, silence cutting, mistake detection, reviewed cut rendering,@@ -107,6 +107,18 @@ mapping, scene coverage, and footage reuse. It is an agent-guided workflow;review the actual motion and audio before publishing.[Short-form walkthrough and validation commands](docs/SHORT-FORM.md).+## Make a motion-design showreel++> Use motion-showreel to make a 15-second showreel for [brand]. Study my reference+> reel at [local path] if I give one. Pick one motif that transforms through every+> chapter, cut on the music's beat grid, and end on the logo. Show me the storyboard+> and beat sheet before building, and confirm before any paid music or asset generation.++Codex: `$motion-showreel`. Claude Code: `/motion-showreel`.+The skill includes a measured breakdown of the reel it was built from, a chapter+technique library, a HUD template, and Node tools to analyze a reference video,+measure a music take's beat grid, splice it onto the cut grid, and premix sound effects.+## Existing examples and migrationThis is the main student-kit repository. The newer video-pipeline kit has beendiff --git a/docs/PROMPTS.md b/docs/PROMPTS.mdindex f71781b..e49192a 100644--- a/docs/PROMPTS.md+++ b/docs/PROMPTS.md@@ -17,6 +17,10 @@ the speaker readable. Follow the project's DESIGN.md.**Verify:** Inspect the actual rendered MP4, its transition frames, and its audiojoins. Fix visible defects and write VERIFY.md with evidence and limitations.+**Showreel:** Use motion-showreel to build a 15-second showreel for [brand] from+[music or reference]. Measure the beat grid first, map six or seven chapters to the+brand's own objects, and show me the storyboard and beat sheet before building.+## A reel with a clear payoff> Use short-form-edit to create a 9:16 reel from [local recording]. Explore threediff --git a/docs/TOOLS-AND-API-KEYS.md b/docs/TOOLS-AND-API-KEYS.mdindex c8f6e62..1b4b684 100644--- a/docs/TOOLS-AND-API-KEYS.md+++ b/docs/TOOLS-AND-API-KEYS.md@@ -90,8 +90,10 @@ Nate uses [Kie.ai](https://kie.ai/) for generated video and image assets. Settask status, and credits.The short-form skill describes a Kie workflow; the kit does **not** bundle a-universal Kie generation script or connected account. Ask the assistant to configure-your selected model using current documentation. Adding a key alone does not+universal Kie generation script or connected account. The `motion-showreel` skill+includes a small client (`scripts/kie.mjs`) for its three showreel assets: Suno+instrumental music, Seedream stills from a logo reference, and Kling camera moves.+Ask the assistant to configure your selected model using current documentation. Adding a key alone does notcreate an integration. Model inputs, formats, availability, and credit costs vary.Prepare the proposed assets and expected cost before paid work that you have not@@ -116,6 +118,9 @@ These are workflow options, not a claim that every example used them:needs its own key and the same transcript normalization checks.- **Older integration examples:** ClickUp or OpenAI access is needed only whenyour selected project actually calls those services.+- **Sound effects:** `motion-showreel` can generate an SFX kit with ElevenLabs+ sound generation (`scripts/sfx.mjs`). It uses `ELEVENLABS_API_KEY`; the key needs+ sound-effects access as well as `speech_to_text`. Your own SFX library works too.- **Helper runtimes:** some optional scripts require Python. Playwright isincluded for relevant browser workflows; browser binaries may need installation.