hyperframes 0.5.0-alpha.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cli.js +7518 -5457
  2. package/dist/commands/contrast-audit.browser.js +2 -0
  3. package/dist/docs/compositions.md +35 -7
  4. package/dist/docs/rendering.md +4 -1
  5. package/dist/hyperframe-runtime.js +82 -32
  6. package/dist/hyperframe.manifest.json +1 -1
  7. package/dist/hyperframe.runtime.iife.js +82 -32
  8. package/dist/skills/gsap/SKILL.md +30 -1
  9. package/dist/skills/hyperframes/SKILL.md +165 -39
  10. package/dist/skills/hyperframes/house-style.md +3 -1
  11. package/dist/skills/hyperframes/patterns.md +73 -0
  12. package/dist/skills/hyperframes/references/beat-direction.md +102 -0
  13. package/dist/skills/hyperframes/references/design-picker.md +117 -0
  14. package/dist/skills/hyperframes/references/motion-principles.md +73 -0
  15. package/dist/skills/hyperframes/references/narration.md +92 -0
  16. package/dist/skills/hyperframes/references/prompt-expansion.md +68 -0
  17. package/dist/skills/hyperframes/references/techniques.md +387 -0
  18. package/dist/skills/hyperframes/references/transcript-guide.md +1 -45
  19. package/dist/skills/hyperframes/references/video-composition.md +62 -0
  20. package/dist/skills/hyperframes/scripts/contrast-report.mjs +10 -0
  21. package/dist/skills/hyperframes/templates/design-picker.html +1432 -0
  22. package/dist/skills/hyperframes/visual-styles.md +339 -107
  23. package/dist/skills/hyperframes-cli/SKILL.md +21 -27
  24. package/dist/studio/assets/hyperframes-player-CoI5h1xv.js +353 -0
  25. package/dist/studio/assets/index-BKjcNNNd.css +1 -0
  26. package/dist/studio/assets/index-CqiisJmo.js +93 -0
  27. package/dist/studio/index.html +2 -2
  28. package/dist/templates/_shared/AGENTS.md +7 -7
  29. package/dist/templates/_shared/CLAUDE.md +15 -7
  30. package/package.json +4 -2
  31. package/dist/skills/hyperframes/references/tts.md +0 -75
  32. package/dist/studio/assets/hyperframes-player-vibA20NC.js +0 -198
  33. package/dist/studio/assets/index-0Zt0t13W.css +0 -1
  34. package/dist/studio/assets/index-C9f5eif8.js +0 -105
@@ -5,6 +5,28 @@ description: GSAP animation reference for HyperFrames. Covers gsap.to(), from(),
5
5
 
6
6
  # GSAP
7
7
 
8
+ ## HyperFrames Contract
9
+
10
+ HyperFrames controls GSAP through its `gsap` runtime adapter. Create a paused timeline synchronously, register it on `window.__timelines` with the exact `data-composition-id`, and let HyperFrames seek it.
11
+
12
+ ```html
13
+ <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
14
+ <script>
15
+ window.__timelines = window.__timelines || {};
16
+ const tl = gsap.timeline({ paused: true });
17
+
18
+ tl.from(".title", { y: 48, opacity: 0, duration: 0.6, ease: "power3.out" }, 0);
19
+ tl.to(".accent", { scaleX: 1, duration: 0.5, ease: "power2.out" }, 0.25);
20
+
21
+ window.__timelines["main"] = tl; // key must equal data-composition-id on the composition root
22
+ </script>
23
+ ```
24
+
25
+ - The registry key must match the composition root's `data-composition-id`.
26
+ - Do not call `tl.play()` for render-critical motion.
27
+ - Do not build timelines inside async code, timers, or event handlers.
28
+ - Keep loops finite. HyperFrames renders finite video durations.
29
+
8
30
  ## Core Tween Methods
9
31
 
10
32
  - **gsap.to(targets, vars)** — animate from current state to `vars`. Most common.
@@ -21,7 +43,7 @@ Always use **camelCase** property names (e.g. `backgroundColor`, `rotationX`).
21
43
  - **ease** — `"power1.out"` (default), `"power3.inOut"`, `"back.out(1.7)"`, `"elastic.out(1, 0.3)"`, `"none"`.
22
44
  - **stagger** — number `0.1` or object: `{ amount: 0.3, from: "center" }`, `{ each: 0.1, from: "random" }`.
23
45
  - **overwrite** — `false` (default), `true`, or `"auto"`.
24
- - **repeat** — number or `-1` for infinite. **yoyo** — alternates direction with repeat.
46
+ - **repeat** — finite number; never `-1` in HyperFrames. Compute repeats from the visible duration. **yoyo** — alternates direction with repeat.
25
47
  - **onComplete**, **onStart**, **onUpdate** — callbacks.
26
48
  - **immediateRender** — default `true` for from()/fromTo(). Set `false` on later tweens targeting the same property+element to avoid overwrite.
27
49
 
@@ -209,3 +231,10 @@ Pause or kill off-screen animations.
209
231
  - Chain animations with delay when a timeline can sequence them.
210
232
  - Create tweens before the DOM exists.
211
233
  - Skip cleanup — always kill tweens when no longer needed.
234
+ - Use infinite repeat values in HyperFrames compositions. Use finite repeat counts computed from the visible duration.
235
+
236
+ ## Credits And References
237
+
238
+ - HyperFrames adapter source: `packages/core/src/runtime/adapters/gsap.ts`.
239
+ - GSAP documentation: https://gsap.com/docs/v3/
240
+ - GSAP timeline pause and seek behavior: https://gsap.com/docs/v3/GSAP/Timeline/pause%28%29/
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hyperframes
3
- description: Create video compositions, animations, title cards, overlays, captions, voiceovers, audio-reactive visuals, and scene transitions in HyperFrames HTML. Use when asked to build any HTML-based video content, add captions or subtitles synced to audio, generate text-to-speech narration, create audio-reactive animation (beat sync, glow, pulse driven by music), add animated text highlighting (marker sweeps, hand-drawn circles, burst lines, scribble, sketchout), or add transitions between scenes (crossfades, wipes, reveals, shader transitions). Covers composition authoring, timing, media, and the full video production workflow. For CLI commands (init, lint, preview, render, transcribe, tts) see the hyperframes-cli skill.
3
+ description: Create video compositions, animations, title cards, overlays, captions, voiceovers, audio-reactive visuals, and scene transitions in HyperFrames HTML. Use when asked to build any HTML-based video content, add captions or subtitles synced to audio, generate text-to-speech narration, create audio-reactive animation (beat sync, glow, pulse driven by music), add animated text highlighting (marker sweeps, hand-drawn circles, burst lines, scribble, sketchout), or add transitions between scenes (crossfades, wipes, reveals, shader transitions). Covers composition authoring, timing, media, and the full video production workflow. For dev-loop CLI commands (init, lint, inspect, preview, render) see the hyperframes-cli skill; for asset preprocessing commands (tts, transcribe, remove-background) see the hyperframes-media skill.
4
4
  ---
5
5
 
6
6
  # HyperFrames
@@ -9,37 +9,58 @@ HTML is the source of truth for video. A composition is an HTML file with `data-
9
9
 
10
10
  ## Approach
11
11
 
12
+ ### Discovery (exploratory requests only)
13
+
14
+ For open-ended requests ("make me a product launch video", "create something for our brand") where the user hasn't committed to a direction, understand intent before picking colors:
15
+
16
+ - **Audience** — who watches this? Developers? Executives? General consumers?
17
+ - **Platform** — where does it play? Social (15s), website hero, product demo, internal?
18
+ - **Priority** — what matters most? Motion quality? Content accuracy? Brand fidelity? Speed?
19
+ - **Variations** — does the user want options, or a single best shot?
20
+
21
+ For specific requests ("add a title card", "fix the timing on scene 3"), skip discovery.
22
+
23
+ For exploratory requests, consider offering 2-3 variations that differ meaningfully — not just color swaps, but different pacing, energy levels, or structural approaches. One safe/expected, one ambitious. Don't mandate this — it's a tool available when appropriate.
24
+
25
+ ### Step 1: Design system
26
+
27
+ If `design.md` or `DESIGN.md` exists in the project, read it first (check both casings — they're different files on Linux). It's the source of truth for brand colors, fonts, and constraints. Use its exact values — don't invent colors or substitute fonts. Any format works (YAML frontmatter, prose, tables — just extract the values).
28
+
29
+ If it names fonts you can't find locally (no `fonts/` directory with `.woff2` files, not a built-in font), warn the user before writing HTML: "design.md specifies [font name] but no font files found. Please add .woff2 files to `fonts/` or I'll fall back to [closest built-in alternative]."
30
+
31
+ If no `design.md` exists, offer the user a choice:
32
+
33
+ 1. **User named a style or mood?** → Read [visual-styles.md](./visual-styles.md) for the 8 named presets. Pick the closest match.
34
+ 2. **Want to browse options visually?** → Run the design picker: read [references/design-picker.md](references/design-picker.md) for the full workflow. This serves a visual picker page. The user configures mood, palette, typography, and motion in the browser, then copies the generated design.md and pastes it back into the conversation.
35
+ 3. **Want to skip and go fast?** → Ask: mood, light or dark, any brand colors/fonts? Then pick a palette from [house-style.md](./house-style.md).
36
+
37
+ **design.md defines the brand. It does not define video composition rules.** Those come from [references/video-composition.md](references/video-composition.md) and [house-style.md](./house-style.md). Use brand colors at video-appropriate scale — not at web-UI opacity.
38
+
39
+ ### Step 2: Prompt expansion
40
+
41
+ Always run on every composition (except single-scene pieces and trivial edits). This step grounds the user's intent against `design.md` and `house-style.md` and produces a consistent intermediate that every downstream agent reads the same way.
42
+
43
+ Read [references/prompt-expansion.md](references/prompt-expansion.md) for the full process and output format.
44
+
45
+ ### Step 3: Plan
46
+
12
47
  Before writing HTML, think at a high level:
13
48
 
14
49
  1. **What** — what should the viewer experience? Identify the narrative arc, key moments, and emotional beats.
15
50
  2. **Structure** — how many compositions, which are sub-compositions vs inline, what tracks carry what (video, audio, overlays, captions).
16
- 3. **Timing** — which clips drive the duration, where do transitions land, what's the pacing.
17
- 4. **Layout** — build the end-state first. See "Layout Before Animation" below.
18
- 5. **Animate** — then add motion using the rules below.
51
+ 3. **Rhythm** — declare your scene rhythm before implementing. Which scenes are quick hits, which are holds, where do shaders land, where does energy peak. Name the pattern: fast-fast-SLOW-fast-SHADER-hold. Read [references/beat-direction.md](references/beat-direction.md) for rhythm templates.
52
+ 4. **Timing** — which clips drive the duration, where do transitions land, what's the pacing.
53
+ 5. **Layout** — build the end-state first. See "Layout Before Animation" below.
54
+ 6. **Animate** — then add motion using the rules below.
19
55
 
20
- For small edits (fix a color, adjust timing, add one element), skip straight to the rules.
56
+ **Build what was asked.** A request for "a title card" is not a request for "a title card + 3 supporting scenes + ambient music + captions." Every scene, every element, every tween should earn its place. If additional scenes or elements would genuinely improve the piece, propose them — don't add them.
21
57
 
22
- ### Visual Identity Gate
58
+ For small edits (fix a color, adjust timing, add one element), skip straight to the rules.
23
59
 
24
60
  <HARD-GATE>
25
- Before writing ANY composition HTML, you MUST have a visual identity defined. Do NOT write compositions with default or generic colors.
26
-
27
- Check in this order:
28
-
29
- 1. **DESIGN.md exists in the project?** → Read it. Use its exact colors, fonts, motion rules, and "What NOT to Do" constraints.
30
- 2. **visual-style.md exists?** → Read it. Apply its `style_prompt_full` and structured fields. (Note: `visual-style.md` is a project-specific file. `visual-styles.md` is the style library with 8 named presets — different files.)
31
- 3. **User named a style** (e.g., "Swiss Pulse", "dark and techy", "luxury brand")? → Read [visual-styles.md](./visual-styles.md) for the 8 named presets. Generate a minimal DESIGN.md with: `## Style Prompt` (one paragraph), `## Colors` (3-5 hex values with roles), `## Typography` (1-2 font families), `## What NOT to Do` (3-5 anti-patterns).
32
- 4. **None of the above?** → Ask 3 questions before writing any HTML:
33
- - What's the mood? (explosive / cinematic / fluid / technical / chaotic / warm)
34
- - Light or dark canvas?
35
- - Any specific brand colors, fonts, or visual references?
36
- Then generate a minimal DESIGN.md from the answers.
37
-
38
- Every composition must trace its palette and typography back to a DESIGN.md, visual-style.md, or explicit user direction. If you're reaching for `#333`, `#3b82f6`, or `Roboto` — you skipped this step.
61
+ Before writing ANY composition HTML — verify you have a visual identity from Step 1. If you're reaching for `#333`, `#3b82f6`, or `Roboto`, you skipped it.
39
62
  </HARD-GATE>
40
63
 
41
- For motion defaults, sizing, entrance patterns, and easing — follow [house-style.md](./house-style.md). The house style handles HOW things move. The DESIGN.md handles WHAT things look like.
42
-
43
64
  ## Layout Before Animation
44
65
 
45
66
  Position every element where it should be at its **most visible moment** — the frame where it's fully entered, correctly placed, and not yet exiting. Write this as static HTML+CSS first. No GSAP yet.
@@ -50,7 +71,7 @@ Position every element where it should be at its **most visible moment** — the
50
71
 
51
72
  1. **Identify the hero frame** for each scene — the moment when the most elements are simultaneously visible. This is the layout you build.
52
73
  2. **Write static CSS** for that frame. The `.scene-content` container MUST fill the full scene using `width: 100%; height: 100%; padding: Npx;` with `display: flex; flex-direction: column; gap: Npx; box-sizing: border-box`. Use padding to push content inward — NEVER `position: absolute; top: Npx` on a content container. Absolute-positioned content containers overflow when content is taller than the remaining space. Reserve `position: absolute` for decoratives only.
53
- 3. **Add entrances with `gsap.from()`** — animate FROM offscreen/invisible TO the CSS position. The CSS position is the ground truth; the tween describes the journey to get there.
74
+ 3. **Add entrances with `gsap.from()`** — animate FROM offscreen/invisible TO the CSS position. The CSS position is the ground truth; the tween describes the journey to get there. (In sub-compositions loaded via `data-composition-src`, prefer `gsap.fromTo()` — see load-bearing GSAP rules in [references/motion-principles.md](references/motion-principles.md).)
54
75
  4. **Add exits with `gsap.to()`** — animate TO offscreen/invisible FROM the CSS position.
55
76
 
56
77
  ### Example
@@ -127,13 +148,20 @@ Layered effects (glow behind text, shadow elements, background patterns) and z-s
127
148
 
128
149
  ### Composition Clips
129
150
 
130
- | Attribute | Required | Values |
131
- | ---------------------------- | -------- | -------------------------------------------- |
132
- | `data-composition-id` | Yes | Unique composition ID |
133
- | `data-start` | Yes | Start time (root composition: use `"0"`) |
134
- | `data-duration` | Yes | Takes precedence over GSAP timeline duration |
135
- | `data-width` / `data-height` | Yes | Pixel dimensions (1920x1080 or 1080x1920) |
136
- | `data-composition-src` | No | Path to external HTML file |
151
+ | Attribute | Required | Values |
152
+ | ---------------------------- | -------- | ----------------------------------------------------------------- |
153
+ | `data-composition-id` | Yes | Unique composition ID |
154
+ | `data-start` | Yes | Start time (root composition: use `"0"`) |
155
+ | `data-duration` | Yes | Takes precedence over GSAP timeline duration |
156
+ | `data-width` / `data-height` | Yes | Pixel dimensions (1920x1080 or 1080x1920) |
157
+ | `data-composition-src` | No | Path to external HTML file |
158
+ | `data-variable-values` | No | JSON object of per-instance variable overrides on a sub-comp host |
159
+
160
+ On the root `<html>` element:
161
+
162
+ | Attribute | Required | Values |
163
+ | ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
164
+ | `data-composition-variables` | No | JSON array of declared variables (id/type/label/default) — drives Studio editing UI and provides defaults for `getVariables()` |
137
165
 
138
166
  ## Composition Structure
139
167
 
@@ -163,6 +191,75 @@ Sub-composition structure:
163
191
 
164
192
  Load in root: `<div id="el-1" data-composition-id="my-comp" data-composition-src="compositions/my-comp.html" data-start="0" data-duration="10" data-track-index="1"></div>`
165
193
 
194
+ ## Variables (Parametrized Compositions)
195
+
196
+ Render the same composition with different content — title, theme color, prices, captions — without editing the source HTML.
197
+
198
+ **Three-step pattern:**
199
+
200
+ 1. **Declare** variables on the composition's `<html>` root with `data-composition-variables`. Each entry needs `id`, `type` (one of `string`, `number`, `color`, `boolean`, `enum`), `label`, and `default`. Enum entries also need `options: [{value, label}, ...]`.
201
+ 2. **Read** the resolved values inside the composition's script with `window.__hyperframes.getVariables()`. Returns the merged result of declared defaults + per-instance overrides + CLI overrides.
202
+ 3. **Override** at render time with `npx hyperframes render --variables '{...}'` (top-level) or with `data-variable-values='{...}'` on the host element (per-instance for sub-comps).
203
+
204
+ ```html
205
+ <!doctype html>
206
+ <html
207
+ data-composition-variables='[
208
+ {"id":"title","type":"string","label":"Title","default":"Hello"},
209
+ {"id":"theme","type":"enum","label":"Theme","default":"light","options":[
210
+ {"value":"light","label":"Light"},
211
+ {"value":"dark","label":"Dark"}
212
+ ]}
213
+ ]'
214
+ >
215
+ <body>
216
+ <div data-composition-id="root" data-width="1920" data-height="1080">
217
+ <h1 id="hero" class="clip" data-start="0" data-duration="3"></h1>
218
+ <script>
219
+ const { title, theme } = window.__hyperframes.getVariables();
220
+ document.getElementById("hero").textContent = title;
221
+ document.body.dataset.theme = theme;
222
+ </script>
223
+ </div>
224
+ </body>
225
+ </html>
226
+ ```
227
+
228
+ ```bash
229
+ # Dev preview uses declared defaults
230
+ npx hyperframes preview
231
+
232
+ # Render with overrides
233
+ npx hyperframes render --variables '{"title":"Q4 Report","theme":"dark"}' --output q4.mp4
234
+
235
+ # Or from a JSON file
236
+ npx hyperframes render --variables-file ./vars.json
237
+ ```
238
+
239
+ **Sub-composition per-instance values:** the same `getVariables()` works inside sub-comps loaded via `data-composition-src`. Each host element passes its own values:
240
+
241
+ ```html
242
+ <div
243
+ data-composition-id="card-pro"
244
+ data-composition-src="compositions/card.html"
245
+ data-variable-values='{"title":"Pro","price":"$29"}'
246
+ ></div>
247
+ <div
248
+ data-composition-id="card-enterprise"
249
+ data-composition-src="compositions/card.html"
250
+ data-variable-values='{"title":"Enterprise","price":"Custom"}'
251
+ ></div>
252
+ ```
253
+
254
+ The runtime layers each host's `data-variable-values` over the sub-comp's declared defaults on a per-instance basis, so the same source can be embedded multiple times with different content.
255
+
256
+ **Rules of thumb:**
257
+
258
+ - Always provide a sensible `default` for every declared variable. Dev preview uses defaults — without them, the composition won't render correctly until `--variables` is provided.
259
+ - Read variables once at the top of the script (`const { title } = ...`), not inside frame loops or event handlers — `getVariables()` allocates a fresh object per call.
260
+ - Use `--strict-variables` in CI to fail fast on undeclared keys or type mismatches.
261
+ - Variable types are validated at render time. `string`, `number`, `boolean`, and `color` (hex string) check `typeof`; `enum` checks the value is in the declared `options`.
262
+
166
263
  ## Video and Audio
167
264
 
168
265
  Video must be `muted playsinline`. Audio is always a separate `<audio>` element:
@@ -259,27 +356,34 @@ tl.from("#s2-heading", { x: -40, opacity: 0, duration: 0.6, ease: "expo.out" },
259
356
  - 60px+ headlines, 20px+ body, 16px+ data labels for rendered video
260
357
  - `font-variant-numeric: tabular-nums` on number columns
261
358
 
262
- When no `visual-style.md` or animation direction is provided, follow [house-style.md](./house-style.md) for aesthetic defaults.
359
+ If no `design.md` exists, follow [house-style.md](./house-style.md) for aesthetic defaults.
263
360
 
264
361
  ## Typography and Assets
265
362
 
266
- - **Fonts:** Just write the `font-family` you want in CSS — the compiler embeds supported fonts automatically. If a font isn't supported, the compiler warns.
363
+ - **Built-in fonts:** Write the `font-family` you want in CSS — the compiler embeds supported fonts automatically.
364
+ - **Custom fonts:** If design.md names a font that isn't built-in, the user must provide `.woff2` files in a `fonts/` directory. If missing, warn before writing HTML. When files exist, add `@font-face` declarations pointing to the local files.
267
365
  - Add `crossorigin="anonymous"` to external media
268
366
  - For dynamic text overflow, use `window.__hyperframes.fitTextFontSize(text, { maxWidth, fontFamily, fontWeight })`
269
367
  - All files live at the project root alongside `index.html`; sub-compositions use `../`
270
368
 
271
369
  ## Editing Existing Compositions
272
370
 
273
- - Read the full composition firstmatch existing fonts, colors, animation patterns
371
+ - **Read actual files, don't guess.** When editing, extending, or creating companion compositions, read the existing source. Don't reconstruct hex codes from memory. Don't guess GSAP easing patterns. The composition IS the spec extract exact values from it.
372
+ - Match existing fonts, colors, animation patterns from what you read
274
373
  - Only change what was requested
275
374
  - Preserve timing of unrelated clips
276
375
 
277
376
  ## Output Checklist
278
377
 
378
+ **Fast (run immediately, block on results):**
379
+
279
380
  - [ ] `npx hyperframes lint` and `npx hyperframes validate` both pass
381
+ - [ ] Design adherence verified if design.md exists
382
+
383
+ **Slow (run in parallel while presenting the preview to the user):**
384
+
280
385
  - [ ] `npx hyperframes inspect` passes, or every reported overflow is intentionally marked
281
386
  - [ ] Contrast warnings addressed (see Quality Checks below)
282
- - [ ] Layout issues addressed (see Quality Checks below)
283
387
  - [ ] Animation choreography verified (see Quality Checks below)
284
388
 
285
389
  ## Quality Checks
@@ -317,6 +421,24 @@ If warnings appear:
317
421
 
318
422
  Use `--no-contrast` to skip if iterating rapidly and you'll check later.
319
423
 
424
+ ### Design Adherence
425
+
426
+ If a `design.md` exists, verify the composition follows it after authoring. Read the HTML and check:
427
+
428
+ 1. **Colors** — every hex value in the composition appears in design.md's palette section (however the user labeled it: Colors, Palette, Theme, etc.). Flag any invented colors.
429
+ 2. **Typography** — font families and weights match design.md's type spec. No substitutions.
430
+ 3. **Corners** — border-radius values match the declared corner style, if specified.
431
+ 4. **Spacing** — padding and gap values fall within the declared density range, if specified.
432
+ 5. **Depth** — shadow usage matches the declared depth level, if specified (flat = none, subtle = light, layered = glows).
433
+ 6. **Avoidance rules** — if design.md has a section listing things to avoid (commonly "What NOT to Do", "Don'ts", "Anti-patterns", or "Do's and Don'ts"), verify none are present.
434
+
435
+ Report violations as a checklist. Fix each one before serving.
436
+
437
+ If no `design.md` exists (house-style-only path), verify:
438
+
439
+ 1. **Palette consistency** — the same bg, fg, and accent colors are used across all scenes. No per-scene color invention.
440
+ 2. **No lazy defaults** — check the composition against house-style.md's "Lazy Defaults to Question" list. If any appear, they must be a deliberate choice for the content, not a default.
441
+
320
442
  ### Animation Map
321
443
 
322
444
  After authoring animations, run the animation map to verify choreography:
@@ -345,16 +467,20 @@ Skip on small edits (fixing a color, adjusting one duration). Run on new composi
345
467
  ## References (loaded on demand)
346
468
 
347
469
  - **[references/captions.md](references/captions.md)** — Captions, subtitles, lyrics, karaoke synced to audio. Tone-adaptive style detection, per-word styling, text overflow prevention, caption exit guarantees, word grouping. Read when adding any text synced to audio timing.
348
- - **[references/tts.md](references/tts.md)** — Text-to-speech with Kokoro-82M. Voice selection, speed tuning, TTS+captions workflow. Read when generating narration or voiceover.
349
470
  - **[references/audio-reactive.md](references/audio-reactive.md)** — Audio-reactive animation: map frequency bands and amplitude to GSAP properties. Read when visuals should respond to music, voice, or sound.
350
471
  - **[references/css-patterns.md](references/css-patterns.md)** — CSS+GSAP marker highlighting: highlight, circle, burst, scribble, sketchout. Deterministic, fully seekable. Read when adding visual emphasis to text.
472
+ - **[references/video-composition.md](references/video-composition.md)** — Video-medium rules: density, color presence, scale, frame composition, design.md as brand not layout. **Always read** — these override web instincts.
473
+ - **[references/beat-direction.md](references/beat-direction.md)** — Beat planning: concept, mood, choreography verbs, rhythm templates, transition decisions, depth layers. **Always read for multi-scene compositions.**
351
474
  - **[references/typography.md](references/typography.md)** — Typography: font pairing, OpenType features, dark-background adjustments, font discovery script. **Always read** — every composition has text.
352
- - **[references/motion-principles.md](references/motion-principles.md)** — Motion design principles: easing as emotion, timing as weight, choreography as hierarchy, scene pacing, ambient motion, anti-patterns. Read when choreographing GSAP animations.
353
- - **[visual-styles.md](visual-styles.md)** — 8 named visual styles (Swiss Pulse, Velvet Standard, Deconstructed, Maximalist Type, Data Drift, Soft Signal, Folk Frequency, Shadow Cut) with hex palettes, GSAP easing signatures, and shader pairings. Read when user names a style or when generating DESIGN.md.
354
- - **[house-style.md](house-style.md)** — Default motion, sizing, and color palettes when no style is specified.
475
+ - **[references/motion-principles.md](references/motion-principles.md)** — Motion design principles, image motion treatment, load-bearing GSAP rules. **Always read** every composition has motion.
476
+ - **[references/techniques.md](references/techniques.md)** — 11 visual techniques with code patterns: SVG drawing, Canvas 2D, CSS 3D, kinetic type, Lottie, video compositing, typing effect, variable fonts, MotionPath, velocity transitions, audio-reactive. Read when planning techniques per beat.
477
+ - **[references/narration.md](references/narration.md)** — Pacing, tone, script structure, number pronunciation, opening line patterns. Read when the composition includes voiceover or TTS.
478
+ - **[references/design-picker.md](references/design-picker.md)** — Create a design.md via visual picker. Read when no design.md exists and the user wants to create one.
479
+ - **[visual-styles.md](visual-styles.md)** — 8 named visual styles with hex palettes, GSAP easing signatures, and shader pairings. Read when user names a style or when generating design.md.
480
+ - **[house-style.md](house-style.md)** — Default motion, sizing, and color palettes when no design.md is specified.
355
481
  - **[patterns.md](patterns.md)** — PiP, title cards, slide show patterns.
356
482
  - **[data-in-motion.md](data-in-motion.md)** — Data, stats, and infographic patterns.
357
- - **[references/transcript-guide.md](references/transcript-guide.md)** — Transcription commands, whisper models, external APIs, troubleshooting.
483
+ - **[references/transcript-guide.md](references/transcript-guide.md)** — Caption-side transcript handling: input formats, mandatory quality check, cleaning JS, OpenAI/Groq API fallback, "if no transcript exists" flow. (For the `transcribe` CLI invocation, model selection rules, and the `.en` gotcha, see the `hyperframes-media` skill.)
358
484
  - **[references/dynamic-techniques.md](references/dynamic-techniques.md)** — Dynamic caption animation techniques (karaoke, clip-path, slam, scatter, elastic, 3D).
359
485
 
360
486
  - **[references/transitions.md](references/transitions.md)** — Scene transitions: crossfades, wipes, reveals, shader transitions. Energy/mood selection, CSS vs WebGL guidance. **Always read for multi-scene compositions** — scenes without transitions feel like jump cuts.
@@ -1,6 +1,6 @@
1
1
  # House Style
2
2
 
3
- Creative direction for compositions when no `visual-style.md` is provided. These are starting points — override anything that doesn't serve the content.
3
+ Creative direction for compositions when no `design.md` is provided. These are starting points — override anything that doesn't serve the content. When a `design.md` exists, its brand values take precedence; house-style fills gaps.
4
4
 
5
5
  ## Before Writing HTML
6
6
 
@@ -44,6 +44,8 @@ Ideas (mix and match, 2-5 per scene):
44
44
 
45
45
  All decoratives should have slow ambient GSAP animation — breathing, drift, pulse. Static decoratives feel dead.
46
46
 
47
+ **Decorative count vs motion count.** The "2-5 per scene" count refers to decorative _elements_. If a project's `design.md` says "single ambient motion per scene", it means one looping motion applied to these decoratives (a shared breath/drift/pulse) — not one element total. A scene with 4 decoratives sharing one breathing motion is correct; a scene with 1 decorative is under-dressed.
48
+
47
49
  ## Motion
48
50
 
49
51
  See [references/motion-principles.md](references/motion-principles.md) for full rules. Quick: 0.3–0.6s, vary eases, combine transforms on entrances, overlap entries.
@@ -30,6 +30,79 @@ tl.to(
30
30
  tl.to("#pip-frame", { left: 40, duration: 0.6 }, 30);
31
31
  ```
32
32
 
33
+ ## Text Behind Subject (transparent webm overlay)
34
+
35
+ Put a headline _behind_ a presenter so their silhouette occludes the text. Requires a transparent cutout produced by `npx hyperframes remove-background presenter.mp4 -o presenter.webm`.
36
+
37
+ Three layers, plus one critical rule:
38
+
39
+ ```html
40
+ <!-- z=1 base — full opaque mp4 (lobby + presenter), always visible -->
41
+ <video
42
+ id="cf-base"
43
+ data-start="0"
44
+ data-duration="6"
45
+ data-media-start="0"
46
+ data-track-index="0"
47
+ src="presenter.mp4"
48
+ muted
49
+ playsinline
50
+ ></video>
51
+
52
+ <!-- z=2 headline — visible the whole time -->
53
+ <h1
54
+ id="cf-headline"
55
+ style="position:absolute;top:50%;left:50%;
56
+ transform:translate(-50%,-50%); z-index:2; font-size:220px; font-weight:900;
57
+ color:#fff; text-shadow:0 6px 32px rgba(0,0,0,.55); clip-path:inset(0 0 100% 0);"
58
+ >
59
+ MAKE IT IN HYPERFRAMES
60
+ </h1>
61
+
62
+ <!-- z=3 cutout — same source, alpha around presenter, hidden until the cut -->
63
+ <!-- WRAPPER has the opacity, NOT the video itself (see rule below). -->
64
+ <div class="cutout-wrap" style="position:absolute;inset:0;z-index:3;opacity:0">
65
+ <video
66
+ id="cf-cutout"
67
+ data-start="0"
68
+ data-duration="6"
69
+ data-media-start="0"
70
+ data-track-index="1"
71
+ src="presenter.webm"
72
+ muted
73
+ playsinline
74
+ ></video>
75
+ </div>
76
+ ```
77
+
78
+ ```js
79
+ const tl = gsap.timeline({ paused: true });
80
+ const CUT = 3.3;
81
+
82
+ // Reveal headline early
83
+ tl.to("#cf-headline", { clipPath: "inset(0 0 0% 0)", duration: 0.6, ease: "expo.out" }, 0.25);
84
+
85
+ // At the cut, flip the cutout wrapper visible — the presenter's silhouette
86
+ // punches through the headline.
87
+ tl.set(".cutout-wrap", { opacity: 1 }, CUT);
88
+
89
+ // Sentinel: extend timeline to the composition's full duration so the
90
+ // renderer doesn't bail past the last meaningful tween.
91
+ tl.set({}, {}, 6);
92
+
93
+ window.__timelines["cover-flip"] = tl;
94
+ ```
95
+
96
+ **Why a wrapper div, not opacity on the video itself?**
97
+
98
+ The framework forces `opacity: 1` on any element with `data-start`/`data-duration` while it's "active" — that's how it manages clip lifecycles. A CSS `opacity: 0` on the video element is silently overwritten. Wrap the video in a div with no `data-*` attributes; the wrapper is owned by your CSS/GSAP.
99
+
100
+ **Why both videos at `data-start="0"`?**
101
+
102
+ So both decode in sync from t=0. Late-mounting the cutout (`data-start=3.3`) makes Chrome do a seek + decoder warm-up at mount, which can land a frame off the base mp4 — visible as a one-frame jitter at the cut.
103
+
104
+ **Color match:** `remove-background` defaults to `--quality balanced` (crf 18) which keeps the cutout's RGB nearly identical to the source mp4 — minimal edge halo or color shift when overlaid. Use `--quality best` (crf 12) for hero shots; only drop to `--quality fast` (crf 30) when the cutout sits over a _different_ background and the size matters.
105
+
33
106
  ## Title Card with Fade
34
107
 
35
108
  ```html
@@ -0,0 +1,102 @@
1
+ # Beat Direction
2
+
3
+ How to plan and direct individual scenes (beats) in a multi-scene composition. Read before writing any multi-scene video.
4
+
5
+ ---
6
+
7
+ ## Per-Beat Direction
8
+
9
+ Each beat is a WORLD, not a layout. Before writing CSS specs and GSAP instructions, describe what the viewer EXPERIENCES. The difference between a great storyboard and a mediocre one:
10
+
11
+ **Mediocre:** "Dark navy background. '$1.9T' in white, 280px. Logo top-left. Wave image bottom-right."
12
+ **Great:** "Camera is already mid-flight over a vast dark canvas. The gradient wave sweeps across the frame like aurora borealis — alive, shifting. '$1.9T' SLAMS into existence with such force the wave ripples in response. This isn't a slide — it's a moment."
13
+
14
+ The first describes pixels. The second describes an experience. Write the second, then figure out the pixels.
15
+
16
+ Each beat should have:
17
+
18
+ ### Concept
19
+
20
+ The big idea for this beat in 2-3 sentences. What visual WORLD are we in? What metaphor drives it? What should the viewer FEEL? This is the most important part — everything else flows from it.
21
+
22
+ ### Mood direction
23
+
24
+ Cultural and design references, not hex codes:
25
+
26
+ - "Geometric, rhythmic, precise. Think Josef Albers or Bauhaus color studies."
27
+ - "Warm workspace. Nice notebook energy, not technical blueprint."
28
+ - "Cinematic title sequence. The kind of opening where you lean forward."
29
+
30
+ ### Animation choreography
31
+
32
+ Specific motion verbs per element — not "it animates in" but HOW:
33
+
34
+ | Energy | Verbs | Example |
35
+ | ------------- | --------------------------------------------- | ------------------------------------- |
36
+ | High impact | SLAMS, CRASHES, PUNCHES, STAMPS, SHATTERS | "$1.9T" SLAMS in from left at -5° |
37
+ | Medium energy | CASCADE, SLIDES, DROPS, FILLS, DRAWS | Three cards CASCADE in staggered 0.3s |
38
+ | Low energy | types on, FLOATS, morphs, COUNTS UP, fades in | Counter COUNTS UP from 0 to 135K |
39
+
40
+ Every element gets a verb. If you can't name the verb, the element is not yet designed.
41
+
42
+ ### Transition
43
+
44
+ How this beat hands off to the next. Specify the type and parameters.
45
+
46
+ **When to pick which:**
47
+
48
+ | Choose shader transition for | Choose CSS transition for | Choose hard cut for |
49
+ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------- |
50
+ | Reveals, big reaction shots, product/logo unveils, energy shifts, "wow" moments | Continuous camera-motion beats where the scene feels like one move broken into cuts | Rapid-fire lists, percussive edits on the beat, comedic timing |
51
+ | Any moment the music/VO punctuates with a downbeat or SFX hit | Beats that ease from one composition into the next with shared motion vocabulary | Sequences of 3+ quick tempo-matched switches |
52
+ | Brand moments where the transition itself _is_ the visual | Minimal/editorial pacing | Anytime a 0.3-0.8s transition would feel too slow |
53
+
54
+ Rule of thumb: if the beat is the _centerpiece_ of the video, shader-transition into it. If the beat is connective tissue, CSS-transition. A brand reel of 5-7 beats usually wants 1-2 shader transitions (the hero reveal + the CTA) and the rest CSS or hard cuts — too many shader transitions flatten their impact.
55
+
56
+ **CSS transitions** (choose from `skills/hyperframes/references/transitions/catalog.md`):
57
+
58
+ - Velocity-matched upward: exit `y:-150, blur:30px, 0.33s power2.in` → entry `y:150→0, blur:30px→0, 1.0s power2.out`
59
+ - Whip pan: exit `x:-400, blur:24px, 0.3s power3.in` → entry `x:400→0, blur:24px→0, 0.3s power3.out`
60
+ - Blur through: exit `blur:20px, 0.3s` → entry `blur:20px→0, 0.25s power3.out`
61
+ - Zoom through: exit `scale:1→1.2, blur:20px, 0.2s power3.in` → entry `scale:0.75→1, blur:20px→0, 0.5s expo.out`
62
+ - Hard cut / smash cut (for rapid-fire sequences)
63
+
64
+ **Shader transitions** (choose from `packages/shader-transitions/README.md`):
65
+
66
+ - Cross-Warp Morph (organic, versatile) — 0.5-0.8s, power2.inOut
67
+ - Cinematic Zoom (professional momentum) — 0.4-0.6s, power2.inOut
68
+ - Gravitational Lens (otherworldly) — 0.6-1.0s, power2.inOut
69
+ - Glitch (aggressive, high energy) — 0.3-0.5s
70
+ - See `packages/shader-transitions/README.md` for the full API, available shaders, and setup
71
+
72
+ ### Depth layers
73
+
74
+ What's in foreground, midground, and background. Every beat should have at least 2 layers:
75
+
76
+ - "BG: dark navy fill + subtle radial glow. MG: stat cards with drop shadow. FG: brand logo bottom-right."
77
+
78
+ ### SFX cues
79
+
80
+ What sounds at what moment:
81
+
82
+ - "On the capture pulse — a soft, warm analog shutter click."
83
+ - "Left side carries a faint low drone. On fold: drone cuts. Silence. Then a single clean chime."
84
+
85
+ ---
86
+
87
+ ## Rhythm Planning
88
+
89
+ Before writing HTML, declare your scene rhythm: which scenes are quick hits, which are holds, where do shaders land, where does energy peak. Name the pattern — fast-fast-SLOW-fast-SHADER-hold — before implementing.
90
+
91
+ | Video type | Typical rhythm pattern |
92
+ | ---------------------- | --------------------------------- |
93
+ | Social ad (15s) | hook-PUNCH-hold-CTA |
94
+ | Product demo (30-60s) | slow-build-BUILD-PEAK-breathe-CTA |
95
+ | Launch teaser (10-20s) | SLAM-proof-SLAM-hold |
96
+ | Brand reel (20-45s) | drift-build-PEAK-drift-resolve |
97
+
98
+ ---
99
+
100
+ ## Velocity-Matched Transitions
101
+
102
+ Exit the outgoing beat with an accelerating ease (power2.in or power3.in) plus a blur ramp. Enter the incoming beat with a decelerating ease (power2.out or power3.out) plus blur clear. The fastest point of both easing curves meets at the cut — the viewer perceives continuous camera motion, not two discrete animations. Match exit velocity to entry velocity within ~5% tolerance.