hyperframes 0.6.97 → 0.6.98

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 (77) hide show
  1. package/dist/beat-analyzer.global.js +326 -0
  2. package/dist/cli.js +2479 -1961
  3. package/dist/commands/layout-audit.browser.js +86 -0
  4. package/dist/hyperframe-runtime.js +22 -22
  5. package/dist/hyperframe.manifest.json +1 -1
  6. package/dist/hyperframe.runtime.iife.js +22 -22
  7. package/dist/skills/hyperframes-cli/SKILL.md +67 -103
  8. package/dist/skills/hyperframes-cli/references/doctor-browser.md +45 -0
  9. package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +51 -0
  10. package/dist/skills/hyperframes-cli/references/lambda.md +132 -0
  11. package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +93 -0
  12. package/dist/skills/hyperframes-cli/references/preview-render.md +107 -0
  13. package/dist/skills/hyperframes-cli/references/upgrade-info-misc.md +75 -0
  14. package/dist/studio/assets/hyperframes-player-DgsMQSvV.js +418 -0
  15. package/dist/studio/assets/index-B62bDCQv.css +1 -0
  16. package/dist/studio/assets/index-Ce3pBm_I.js +252 -0
  17. package/dist/studio/assets/{index-HveJ0MuV.js → index-D-ET9M0b.js} +1 -1
  18. package/dist/studio/assets/index-D-bS9Dxx.js +1 -0
  19. package/dist/studio/index.html +2 -2
  20. package/dist/templates/_shared/AGENTS.md +46 -21
  21. package/dist/templates/_shared/CLAUDE.md +16 -14
  22. package/package.json +3 -2
  23. package/dist/pngDecodeBlitWorker.js +0 -239
  24. package/dist/skills/gsap/SKILL.md +0 -240
  25. package/dist/skills/gsap/references/effects.md +0 -297
  26. package/dist/skills/gsap/scripts/extract-audio-data.py +0 -188
  27. package/dist/skills/hyperframes/SKILL.md +0 -491
  28. package/dist/skills/hyperframes/data-in-motion.md +0 -19
  29. package/dist/skills/hyperframes/house-style.md +0 -73
  30. package/dist/skills/hyperframes/palettes/bold-energetic.md +0 -14
  31. package/dist/skills/hyperframes/palettes/clean-corporate.md +0 -14
  32. package/dist/skills/hyperframes/palettes/dark-premium.md +0 -14
  33. package/dist/skills/hyperframes/palettes/jewel-rich.md +0 -14
  34. package/dist/skills/hyperframes/palettes/monochrome.md +0 -14
  35. package/dist/skills/hyperframes/palettes/nature-earth.md +0 -14
  36. package/dist/skills/hyperframes/palettes/neon-electric.md +0 -14
  37. package/dist/skills/hyperframes/palettes/pastel-soft.md +0 -14
  38. package/dist/skills/hyperframes/palettes/warm-editorial.md +0 -14
  39. package/dist/skills/hyperframes/patterns.md +0 -191
  40. package/dist/skills/hyperframes/references/audio-reactive.md +0 -76
  41. package/dist/skills/hyperframes/references/beat-direction.md +0 -171
  42. package/dist/skills/hyperframes/references/captions.md +0 -163
  43. package/dist/skills/hyperframes/references/css-patterns.md +0 -373
  44. package/dist/skills/hyperframes/references/design-picker.md +0 -117
  45. package/dist/skills/hyperframes/references/dynamic-techniques.md +0 -102
  46. package/dist/skills/hyperframes/references/html-in-canvas-patterns.md +0 -507
  47. package/dist/skills/hyperframes/references/motion-principles.md +0 -150
  48. package/dist/skills/hyperframes/references/narration.md +0 -92
  49. package/dist/skills/hyperframes/references/prompt-expansion.md +0 -68
  50. package/dist/skills/hyperframes/references/techniques.md +0 -525
  51. package/dist/skills/hyperframes/references/text-effects.md +0 -64
  52. package/dist/skills/hyperframes/references/transcript-guide.md +0 -107
  53. package/dist/skills/hyperframes/references/transitions/catalog.md +0 -117
  54. package/dist/skills/hyperframes/references/transitions/css-3d.md +0 -12
  55. package/dist/skills/hyperframes/references/transitions/css-blur.md +0 -51
  56. package/dist/skills/hyperframes/references/transitions/css-cover.md +0 -43
  57. package/dist/skills/hyperframes/references/transitions/css-destruction.md +0 -95
  58. package/dist/skills/hyperframes/references/transitions/css-dissolve.md +0 -66
  59. package/dist/skills/hyperframes/references/transitions/css-distortion.md +0 -45
  60. package/dist/skills/hyperframes/references/transitions/css-grid.md +0 -10
  61. package/dist/skills/hyperframes/references/transitions/css-light.md +0 -49
  62. package/dist/skills/hyperframes/references/transitions/css-mechanical.md +0 -30
  63. package/dist/skills/hyperframes/references/transitions/css-other.md +0 -25
  64. package/dist/skills/hyperframes/references/transitions/css-push.md +0 -41
  65. package/dist/skills/hyperframes/references/transitions/css-radial.md +0 -37
  66. package/dist/skills/hyperframes/references/transitions/css-scale.md +0 -24
  67. package/dist/skills/hyperframes/references/transitions.md +0 -138
  68. package/dist/skills/hyperframes/references/typography.md +0 -175
  69. package/dist/skills/hyperframes/references/video-composition.md +0 -62
  70. package/dist/skills/hyperframes/scripts/animation-map.mjs +0 -601
  71. package/dist/skills/hyperframes/scripts/contrast-report.mjs +0 -348
  72. package/dist/skills/hyperframes/scripts/package-loader.mjs +0 -269
  73. package/dist/skills/hyperframes/templates/design-picker.html +0 -1432
  74. package/dist/skills/hyperframes/visual-styles.md +0 -443
  75. package/dist/studio/assets/hyperframes-player-Daj5djxa.js +0 -418
  76. package/dist/studio/assets/index-B0twsRu0.css +0 -1
  77. package/dist/studio/assets/index-Cfye9xzo.js +0 -251
@@ -1,491 +0,0 @@
1
- ---
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 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
- ---
5
-
6
- # HyperFrames
7
-
8
- HTML is the source of truth for video. A composition is an HTML file with `data-*` attributes for timing, a GSAP timeline for animation, and CSS for appearance. The framework handles clip visibility, media playback, and timeline sync.
9
-
10
- ## Approach
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 a design spec exists in the project, read it first. Look in precedence order: `frame.md` → `design.md` → `DESIGN.md` (`design.md` and `DESIGN.md` are different files on Linux — check both casings; `frame.md` is always lowercase, no `FRAME.md` variant). `frame.md` is the preferred spec for video/hyperframes projects and wins if more than one exists; it uses the same format as `design.md`. 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: "the spec 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 `frame.md` or `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
- **The design spec 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 the design spec (`frame.md` or `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
-
47
- Before writing HTML, think at a high level:
48
-
49
- 1. **What** — what should the viewer experience? Identify the narrative arc, key moments, and emotional beats.
50
- 2. **Structure** — how many compositions, which are sub-compositions vs inline, what tracks carry what (video, audio, overlays, captions).
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.
55
-
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.
57
-
58
- For small edits (fix a color, adjust timing, add one element), skip straight to the rules.
59
-
60
- <HARD-GATE>
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.
62
- </HARD-GATE>
63
-
64
- ## Layout Before Animation
65
-
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.
67
-
68
- **Why this matters:** If you position elements at their animated start state (offscreen, scaled to 0, opacity 0) and tween them to where you think they should land, you're guessing the final layout. Overlaps are invisible until the video renders. By building the end state first, you can see and fix layout problems before adding any motion.
69
-
70
- ### The process
71
-
72
- 1. **Identify the hero frame** for each scene — the moment when the most elements are simultaneously visible. This is the layout you build.
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.
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).)
75
- 4. **Add exits with `gsap.to()`** — animate TO offscreen/invisible FROM the CSS position.
76
-
77
- ### Example
78
-
79
- ```css
80
- /* scene-content fills the scene, padding positions content */
81
- .scene-content {
82
- display: flex;
83
- flex-direction: column;
84
- justify-content: center;
85
- width: 100%;
86
- height: 100%;
87
- padding: 120px 160px;
88
- gap: 24px;
89
- box-sizing: border-box;
90
- }
91
- .title {
92
- font-size: 120px;
93
- }
94
- .subtitle {
95
- font-size: 42px;
96
- }
97
- /* Container fills any scene size (1920x1080, 1080x1920, etc).
98
- Padding positions content. Flex + gap handles spacing. */
99
- ```
100
-
101
- **WRONG — hardcoded dimensions and absolute positioning:**
102
-
103
- ```css
104
- .scene-content {
105
- position: absolute;
106
- top: 200px;
107
- left: 160px;
108
- width: 1920px;
109
- height: 1080px;
110
- display: flex; /* ... */
111
- }
112
- ```
113
-
114
- ```js
115
- // Step 3: Animate INTO those positions
116
- tl.from(".title", { y: 60, opacity: 0, duration: 0.6, ease: "power3.out" }, 0);
117
- tl.from(".subtitle", { y: 40, opacity: 0, duration: 0.5, ease: "power3.out" }, 0.2);
118
- tl.from(".logo", { scale: 0.8, opacity: 0, duration: 0.4, ease: "power2.out" }, 0.3);
119
-
120
- // Step 4: Animate OUT from those positions
121
- tl.to(".title", { y: -40, opacity: 0, duration: 0.4, ease: "power2.in" }, 3);
122
- tl.to(".subtitle", { y: -30, opacity: 0, duration: 0.3, ease: "power2.in" }, 3.1);
123
- tl.to(".logo", { scale: 0.9, opacity: 0, duration: 0.3, ease: "power2.in" }, 3.2);
124
- ```
125
-
126
- ### When elements share space across time
127
-
128
- If element A exits before element B enters in the same area, both should have correct CSS positions for their respective hero frames. The timeline ordering guarantees they never visually coexist — but if you skip the layout step, you won't catch the case where they accidentally overlap due to a timing error.
129
-
130
- ### What counts as intentional overlap
131
-
132
- Layered effects (glow behind text, shadow elements, background patterns) and z-stacked designs (card stacks, depth layers) are intentional. The layout step is about catching **unintentional** overlap — two headlines landing on top of each other, a stat covering a label, content bleeding off-frame.
133
-
134
- ## Data Attributes
135
-
136
- ### All Clips
137
-
138
- | Attribute | Required | Values |
139
- | ------------------ | --------------------------------- | ------------------------------------------------------ |
140
- | `id` | Yes | Unique identifier |
141
- | `data-start` | Yes | Seconds or clip ID reference (`"el-1"`, `"intro + 2"`) |
142
- | `data-duration` | Required for img/div/compositions | Seconds. Video/audio defaults to media duration. |
143
- | `data-track-index` | Yes | Integer. Same-track clips cannot overlap. |
144
- | `data-media-start` | No | Trim offset into source (seconds) |
145
- | `data-volume` | No | 0-1 (default 1) |
146
-
147
- `data-track-index` does **not** affect visual layering — use CSS `z-index`.
148
-
149
- ### Composition Clips
150
-
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()` |
165
-
166
- ## Composition Structure
167
-
168
- Sub-compositions loaded via `data-composition-src` use a `<template>` wrapper. **Standalone compositions (the main index.html) do NOT use `<template>`** — they put the `data-composition-id` div directly in `<body>`. Using `<template>` on a standalone file hides all content from the browser and breaks rendering.
169
-
170
- Sub-composition structure:
171
-
172
- ```html
173
- <template id="my-comp-template">
174
- <div data-composition-id="my-comp" data-width="1920" data-height="1080">
175
- <!-- content -->
176
- <style>
177
- [data-composition-id="my-comp"] {
178
- /* scoped styles */
179
- }
180
- </style>
181
- <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
182
- <script>
183
- window.__timelines = window.__timelines || {};
184
- const tl = gsap.timeline({ paused: true });
185
- // tweens...
186
- window.__timelines["my-comp"] = tl;
187
- </script>
188
- </div>
189
- </template>
190
- ```
191
-
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>`
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
-
263
- ## Video and Audio
264
-
265
- Video must be `muted playsinline`. Audio is always a separate `<audio>` element:
266
-
267
- ```html
268
- <video
269
- id="el-v"
270
- data-start="0"
271
- data-duration="30"
272
- data-track-index="0"
273
- src="video.mp4"
274
- muted
275
- playsinline
276
- ></video>
277
- <audio
278
- id="el-a"
279
- data-start="0"
280
- data-duration="30"
281
- data-track-index="2"
282
- src="video.mp4"
283
- data-volume="1"
284
- ></audio>
285
- ```
286
-
287
- ## Timeline Contract
288
-
289
- - All timelines start `{ paused: true }` — the player controls playback
290
- - Register every timeline: `window.__timelines["<composition-id>"] = tl`
291
- - Framework auto-nests sub-timelines — do NOT manually add them
292
- - Duration comes from `data-duration`, not from GSAP timeline length
293
- - Never create empty tweens to set duration
294
-
295
- ## Rules (Non-Negotiable)
296
-
297
- **Deterministic:** No `Math.random()`, `Date.now()`, or time-based logic. Use a seeded PRNG if you need pseudo-random values (e.g. mulberry32).
298
-
299
- **GSAP:** Only animate visual properties (`opacity`, `x`, `y`, `scale`, `rotation`, `color`, `backgroundColor`, `borderRadius`, transforms). Do NOT animate `visibility`, `display`, or call `video.play()`/`audio.play()`.
300
-
301
- **Animation conflicts:** Never animate the same property on the same element from multiple timelines simultaneously.
302
-
303
- **No `repeat: -1`:** Infinite-repeat timelines break the capture engine. Calculate the exact repeat count from composition duration: `repeat: Math.ceil(duration / cycleDuration) - 1`.
304
-
305
- **Synchronous timeline construction:** Never build timelines inside `async`/`await`, `setTimeout`, or Promises. The capture engine reads `window.__timelines` synchronously after page load. Fonts are embedded by the compiler, so they're available immediately — no need to wait for font loading.
306
-
307
- **Never do:**
308
-
309
- 1. Forget `window.__timelines` registration
310
- 2. Use video for audio — always muted video + separate `<audio>`
311
- 3. Nest video inside a timed div — use a non-timed wrapper
312
- 4. Use `data-layer` (use `data-track-index`) or `data-end` (use `data-duration`)
313
- 5. Animate video element dimensions — animate a wrapper div
314
- 6. Call play/pause/seek on media — framework owns playback
315
- 7. Create a top-level container without `data-composition-id`
316
- 8. Use `repeat: -1` on any timeline or tween — always finite repeats
317
- 9. Build timelines asynchronously (inside `async`, `setTimeout`, `Promise`)
318
- 10. Use `gsap.set()` on clip elements from later scenes — they don't exist in the DOM at page load. Use `tl.set(selector, vars, timePosition)` inside the timeline at or after the clip's `data-start` time instead.
319
- 11. Use `<br>` in content text — forced line breaks don't account for actual rendered font width. Text that wraps naturally + a `<br>` produces an extra unwanted break, causing overlap. Let text wrap via `max-width` instead. Exception: short display titles where each word is deliberately on its own line (e.g., "THE\nIMMORTAL\nGAME" at 130px).
320
-
321
- ## Scene Transitions (Non-Negotiable)
322
-
323
- Every multi-scene composition MUST follow ALL of these rules. Violating any one of them is a broken composition.
324
-
325
- 1. **ALWAYS use transitions between scenes.** No jump cuts. No exceptions.
326
- 2. **ALWAYS use entrance animations on every scene.** Every element animates IN via `gsap.from()`. No element may appear fully-formed. If a scene has 5 elements, it needs 5 entrance tweens.
327
- 3. **NEVER use exit animations** except on the final scene. This means: NO `gsap.to()` that animates opacity to 0, y offscreen, scale to 0, or any other "out" animation before a transition fires. The transition IS the exit. The outgoing scene's content MUST be fully visible at the moment the transition starts.
328
- 4. **Final scene only:** The last scene may fade elements out (e.g., fade to black). This is the ONLY scene where `gsap.to(..., { opacity: 0 })` is allowed.
329
-
330
- **WRONG — exit animation before transition:**
331
-
332
- ```js
333
- // BANNED — this empties the scene before the transition can use it
334
- tl.to("#s1-title", { opacity: 0, y: -40, duration: 0.4 }, 6.5);
335
- tl.to("#s1-subtitle", { opacity: 0, duration: 0.3 }, 6.7);
336
- // transition fires on empty frame
337
- ```
338
-
339
- **RIGHT — entrance only, transition handles exit:**
340
-
341
- ```js
342
- // Scene 1 entrance animations
343
- tl.from("#s1-title", { y: 50, opacity: 0, duration: 0.7, ease: "power3.out" }, 0.3);
344
- tl.from("#s1-subtitle", { y: 30, opacity: 0, duration: 0.5, ease: "power2.out" }, 0.6);
345
- // NO exit tweens — transition at 7.2s handles the scene change
346
- // Scene 2 entrance animations
347
- tl.from("#s2-heading", { x: -40, opacity: 0, duration: 0.6, ease: "expo.out" }, 8.0);
348
- ```
349
-
350
- ## Animation Guardrails
351
-
352
- - Offset first animation 0.1-0.3s (not t=0)
353
- - Vary eases across entrance tweens — use at least 3 different eases per scene
354
- - Don't repeat an entrance pattern within a scene
355
- - Avoid full-screen linear gradients on dark backgrounds (H.264 banding — use radial or solid + localized glow)
356
- - 60px+ headlines, 20px+ body, 16px+ data labels for rendered video
357
- - `font-variant-numeric: tabular-nums` on number columns
358
-
359
- If no `frame.md` or `design.md` exists, follow [house-style.md](./house-style.md) for aesthetic defaults.
360
-
361
- ## Typography and Assets
362
-
363
- - **Built-in fonts:** Write the `font-family` you want in CSS — the compiler embeds supported fonts automatically.
364
- - **Custom fonts:** If the spec (`frame.md` or `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.
365
- - Add `crossorigin="anonymous"` to external media
366
- - For dynamic text overflow, use `window.__hyperframes.fitTextFontSize(text, { maxWidth, fontFamily, fontWeight })`
367
- - All files live at the project root alongside `index.html`; sub-compositions use `../`
368
-
369
- ## Editing Existing Compositions
370
-
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
373
- - Only change what was requested
374
- - Preserve timing of unrelated clips
375
-
376
- ## Output Checklist
377
-
378
- **Fast (run immediately, block on results):**
379
-
380
- - [ ] `npx hyperframes lint` and `npx hyperframes validate` both pass
381
- - [ ] Design adherence verified if a design spec (`frame.md` or `design.md`) exists
382
-
383
- **Slow (run in parallel while presenting the preview to the user):**
384
-
385
- - [ ] `npx hyperframes inspect` passes, or every reported overflow is intentionally marked
386
- - [ ] Contrast warnings addressed (see Quality Checks below)
387
- - [ ] Animation choreography verified (see Quality Checks below)
388
-
389
- ## Quality Checks
390
-
391
- ### Visual Inspect
392
-
393
- `hyperframes inspect` runs the composition in headless Chrome, seeks through the timeline, and maps visual layout issues with timestamps, selectors, bounding boxes, and fix hints. Run it after `lint` and `validate`:
394
-
395
- ```bash
396
- npx hyperframes inspect
397
- npx hyperframes inspect --json
398
- ```
399
-
400
- Failures usually mean text is spilling out of a bubble/card, a fixed-size label is clipping dynamic copy, or text has moved off the canvas. Fix by increasing container size or padding, reducing font size or letter spacing, adding a real `max-width` so text wraps inside the container, or using `window.__hyperframes.fitTextFontSize(...)` for dynamic copy.
401
-
402
- Use `--samples 15` for dense videos and `--at 1.5,4,7.25` for specific hero frames. Repeated static issues are collapsed by default to avoid flooding agent context. If overflow is intentional for an entrance/exit animation, mark the element or ancestor with `data-layout-allow-overflow`. If a decorative element should never be audited, mark it with `data-layout-ignore`.
403
-
404
- `hyperframes layout` is the compatibility alias for the same check.
405
-
406
- ### Contrast
407
-
408
- `hyperframes validate` runs a WCAG contrast audit by default. It seeks to 5 timestamps, screenshots the page, samples background pixels behind every text element, and computes contrast ratios. Failures appear as warnings:
409
-
410
- ```
411
- ⚠ WCAG AA contrast warnings (3):
412
- · .subtitle "secondary text" — 2.67:1 (need 4.5:1, t=5.3s)
413
- ```
414
-
415
- If warnings appear:
416
-
417
- - On dark backgrounds: brighten the failing color until it clears 4.5:1 (normal text) or 3:1 (large text, 24px+ or 19px+ bold)
418
- - On light backgrounds: darken it
419
- - Stay within the palette family — don't invent a new color, adjust the existing one
420
- - Re-run `hyperframes validate` until clean
421
-
422
- Use `--no-contrast` to skip if iterating rapidly and you'll check later.
423
-
424
- ### Design Adherence
425
-
426
- If a design spec (`frame.md` or `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 the spec's palette section (however the user labeled it: Colors, Palette, Theme, etc.). Flag any invented colors.
429
- 2. **Typography** — font families and weights match the spec'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 the spec 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 spec 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
-
442
- ### Animation Map
443
-
444
- After authoring animations, run the animation map to verify choreography:
445
-
446
- ```bash
447
- node skills/hyperframes/scripts/animation-map.mjs <composition-dir> \
448
- --out <composition-dir>/.hyperframes/anim-map
449
- ```
450
-
451
- Outputs a single `animation-map.json` with:
452
-
453
- - **Per-tween summaries**: `"#card1 animates opacity+y over 0.50s. moves 23px up. fades in. ends at (120, 200)"`
454
- - **ASCII timeline**: Gantt chart of all tweens across the composition duration
455
- - **Stagger detection**: reports actual intervals (`"3 elements stagger at 120ms"`)
456
- - **Dead zones**: periods over 1s with no animation — intentional hold or missing entrance?
457
- - **Element lifecycles**: first/last animation time, final visibility
458
- - **Scene snapshots**: visible element state at 5 key timestamps
459
- - **Flags**: `offscreen`, `collision`, `invisible`, `paced-fast` (under 0.2s), `paced-slow` (over 2s)
460
-
461
- Read the JSON. Scan summaries for anything unexpected. Check every flag — fix or justify. Verify the timeline shows the intended choreography rhythm. Re-run after fixes.
462
-
463
- Skip on small edits (fixing a color, adjusting one duration). Run on new compositions and significant animation changes.
464
-
465
- ---
466
-
467
- ## References (loaded on demand)
468
-
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.
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.
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, the design spec 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.**
474
- - **[references/typography.md](references/typography.md)** — Typography: font pairing, OpenType features, dark-background adjustments, font discovery script. **Always read** — every composition has text.
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)** — 13 primitive animation techniques with code patterns: SVG drawing, Canvas 2D, CSS 3D, kinetic type, Lottie, video compositing, typing, variable fonts, MotionPath, velocity transitions, audio-reactive, clip-path reveals, WebGL shaders. Adapt the patterns — don't copy-paste. (For pre-built UI templates — terminal chrome, device mockups, moodboard layouts — see `registry/blocks/`.)
477
- - **[references/html-in-canvas-patterns.md](references/html-in-canvas-patterns.md)** — HTML-in-Canvas patterns: live DOM as GPU texture via `drawElementImage` + `layoutsubtree`. Shared boilerplate + ~6 effect recipes (iPhone/MacBook mockups, liquid glass, magnetic, portal, shatter, text cursor). Use for 1–3 hero beats per video.
478
- - **[references/narration.md](references/narration.md)** — Pacing, tone, script structure, number pronunciation, opening line patterns. Read when the composition includes voiceover or TTS.
479
- - **[references/design-picker.md](references/design-picker.md)** — Create a design.md via visual picker. Read when no `frame.md` or `design.md` exists and the user wants to create one.
480
- - **[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 a design spec.
481
- - **[house-style.md](house-style.md)** — Default motion, sizing, and color palettes when no `frame.md` or `design.md` is specified.
482
- - **[patterns.md](patterns.md)** — PiP, title cards, slide show patterns.
483
- - **[data-in-motion.md](data-in-motion.md)** — Data, stats, and infographic patterns.
484
- - **[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.)
485
- - **[references/dynamic-techniques.md](references/dynamic-techniques.md)** — Dynamic caption animation techniques (karaoke, clip-path, slam, scatter, elastic, 3D).
486
-
487
- - **[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.
488
- - [transitions/catalog.md](references/transitions/catalog.md) — Hard rules, scene template, and routing to per-type implementation code.
489
- - Shader transitions are in `@hyperframes/shader-transitions` (`packages/shader-transitions/`) — read package source, not skill files.
490
-
491
- GSAP patterns and effects are in the `/gsap` skill.
@@ -1,19 +0,0 @@
1
- # Data in Motion
2
-
3
- Light guidance for data and stats in video compositions. The [house style](./house-style.md) handles aesthetics — this just addresses data-specific pitfalls.
4
-
5
- ## Visual Continuity
6
-
7
- When successive stats belong to the same concept (Q1 → Q2 → Q3 → Q4, or three metrics for the same product), keep them in the same visual space with the same aesthetic. Only the VALUE changes. An aesthetic change should signal a new concept, not just a new number.
8
-
9
- ## Numbers Need Visual Weight
10
-
11
- A number on its own floats in empty space. Pair every metric with a visual element that gives it presence — a proportional fill bar, a background color shift, a shape that represents the value, a progress ring. The visual doesn't need to be a chart — it just needs to fill the frame and make the data feel tangible rather than just text on a background.
12
-
13
- ## Avoid Web Patterns
14
-
15
- - **No pie charts** — hard to compare, looks like PowerPoint
16
- - **No multi-axis charts** — viewer can't study intersections in a 3-second window
17
- - **No 6-panel dashboards** — 2-3 related metrics side-by-side is fine, 6+ is a web pattern
18
- - **No gridlines, tick marks, or legends** — visual noise that adds nothing in motion
19
- - **No chart library output** — build with GSAP + SVG/CSS, not D3 or Chart.js
@@ -1,73 +0,0 @@
1
- # House Style
2
-
3
- Creative direction for compositions when no design spec (`frame.md` or `design.md`) is provided. These are starting points — override anything that doesn't serve the content. When a spec exists, its brand values take precedence; house-style fills gaps.
4
-
5
- ## Before Writing HTML
6
-
7
- 1. **Interpret the prompt.** Generate real content. A recipe lists real ingredients. A HUD has real readouts.
8
- 2. **Pick a palette.** Light or dark? Declare bg, fg, accent before writing code.
9
- 3. **Pick typefaces.** Run the font discovery script in [references/typography.md](references/typography.md) — or pick a font you already know that fits the theme. The script broadens your options; it's not the only source.
10
-
11
- ## Lazy Defaults to Question
12
-
13
- These patterns are AI design tells — the first thing every LLM reaches for. If you're about to use one, pause and ask: is this a deliberate choice for THIS content, or am I defaulting?
14
-
15
- - Gradient text (`background-clip: text` + gradient)
16
- - Left-edge accent stripes on cards/callouts
17
- - Cyan-on-dark / purple-to-blue gradients / neon accents
18
- - Pure `#000` or `#fff` (tint toward your accent hue instead)
19
- - Identical card grids (same-size cards repeated)
20
- - Everything centered with equal weight (lead the eye somewhere)
21
- - Banned fonts (see [references/typography.md](references/typography.md) for full list)
22
-
23
- If the content genuinely calls for one of these — centered layout for a solemn closing, cards for a real product UI mockup, a banned font because it's the perfect thematic match — use it. The goal is intentionality, not avoidance.
24
-
25
- ## Color
26
-
27
- - Match light/dark to content: food, wellness, kids → light. Tech, cinema, finance → dark.
28
- - One accent hue. Same background across all scenes.
29
- - Tint neutrals toward your accent (even subtle warmth/coolness beats dead gray).
30
- - **Contrast:** enforced by `hyperframes validate` (WCAG AA). Text must be readable with decoratives removed.
31
- - Declare palette up front. Don't invent colors per-element.
32
-
33
- ## Background Layer
34
-
35
- Every scene needs visual depth — persistent decorative elements that stay visible while content animates in. Without these, scenes feel empty during entrance staggering.
36
-
37
- Ideas (mix and match, 2-5 per scene):
38
-
39
- - Radial glows (accent-tinted, low opacity, breathing scale)
40
- - Ghost text (theme words at 3-8% opacity, very large, slow drift)
41
- - Accent lines (hairline rules, subtle pulse)
42
- - Grain/noise overlay, geometric shapes, grid patterns
43
- - Thematic decoratives (orbit rings for space, vinyl grooves for music, grid lines for data)
44
-
45
- All decoratives should have slow ambient GSAP animation — breathing, drift, pulse. Static decoratives feel dead.
46
-
47
- **Decorative count vs motion count.** The "2-5 per scene" count refers to decorative _elements_. If a project's spec (`frame.md` or `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
-
49
- ## Motion
50
-
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.
52
-
53
- ## Typography
54
-
55
- See [references/typography.md](references/typography.md) for full rules. Quick: 700-900 headlines / 300-400 body, serif + sans (not two sans), 60px+ headlines / 20px+ body.
56
-
57
- ## Palettes
58
-
59
- Declare one background, one foreground, one accent before writing HTML.
60
-
61
- | Category | Use for | File |
62
- | ----------------- | --------------------------------------------- | ---------------------------------------------------------- |
63
- | Bold / Energetic | Product launches, social media, announcements | [palettes/bold-energetic.md](palettes/bold-energetic.md) |
64
- | Warm / Editorial | Storytelling, documentaries, case studies | [palettes/warm-editorial.md](palettes/warm-editorial.md) |
65
- | Dark / Premium | Tech, finance, luxury, cinematic | [palettes/dark-premium.md](palettes/dark-premium.md) |
66
- | Clean / Corporate | Explainers, tutorials, presentations | [palettes/clean-corporate.md](palettes/clean-corporate.md) |
67
- | Nature / Earth | Sustainability, outdoor, organic | [palettes/nature-earth.md](palettes/nature-earth.md) |
68
- | Neon / Electric | Gaming, tech, nightlife | [palettes/neon-electric.md](palettes/neon-electric.md) |
69
- | Pastel / Soft | Fashion, beauty, lifestyle, wellness | [palettes/pastel-soft.md](palettes/pastel-soft.md) |
70
- | Jewel / Rich | Luxury, events, sophisticated | [palettes/jewel-rich.md](palettes/jewel-rich.md) |
71
- | Monochrome | Dramatic, typography-focused | [palettes/monochrome.md](palettes/monochrome.md) |
72
-
73
- Or derive from OKLCH — pick a hue, build bg/fg/accent at different lightnesses, tint everything toward that hue.
@@ -1,14 +0,0 @@
1
- # Bold / Energetic
2
-
3
- Product launches, social media, announcements, high-energy content.
4
-
5
- ```
6
- #FFBE0B #FB5607 #FF006E #8338EC #3A86FF
7
- #F72585 #7209B7 #3A0CA3 #4361EE #4CC9F0
8
- #EF476F #FFD166 #06D6A0 #118AB2 #073B4C
9
- #FF595E #FFCA3A #8AC926 #1982C4 #6A4C93
10
- #9B5DE5 #F15BB5 #FEE440 #00BBF9 #00F5D4
11
- #390099 #9E0059 #FF0054 #FF5400 #FFBD00
12
- #3D348B #7678ED #F7B801 #F18701 #F35B04
13
- #FFBC42 #D81159 #8F2D56 #218380 #73D2DE
14
- ```
@@ -1,14 +0,0 @@
1
- # Clean / Corporate
2
-
3
- Explainers, tutorials, presentations, professional content.
4
-
5
- ```
6
- #FFFCF2 #CCC5B9 #403D39 #252422 #EB5E28
7
- #22223B #4A4E69 #9A8C98 #C9ADA7 #F2E9E4
8
- #3D5A80 #98C1D9 #E0FBFC #EE6C4D #293241
9
- #2B2D42 #8D99AE #EDF2F4 #EF233C #D90429
10
- #353535 #3C6E71 #FFFFFF #D9D9D9 #284B63
11
- #E7ECEF #274C77 #6096BA #A3CEF1 #8B8C89
12
- #CFDBD5 #E8EDDF #F5CB5C #242423 #333533
13
- #2F6690 #3A7CA5 #D9DCD6 #16425B #81C3D7
14
- ```
@@ -1,14 +0,0 @@
1
- # Dark / Premium
2
-
3
- Tech, finance, luxury, cinematic content.
4
-
5
- ```
6
- #000000 #14213D #FCA311 #E5E5E5 #FFFFFF
7
- #000814 #001D3D #003566 #FFC300 #FFD60A
8
- #0D1B2A #1B263B #415A77 #778DA9 #E0E1DD
9
- #0D1321 #1D2D44 #3E5C76 #748CAB #F0EBD8
10
- #011627 #FDFFFC #2EC4B6 #E71D36 #FF9F1C
11
- #0B090A #161A1D #660708 #A4161A #E5383B
12
- #001427 #708D81 #F4D58D #BF0603 #8D0801
13
- #001524 #15616D #FFECD1 #FF7D00 #78290F
14
- ```
@@ -1,14 +0,0 @@
1
- # Jewel / Rich
2
-
3
- Luxury, events, sophisticated, high-end content.
4
-
5
- ```
6
- #5F0F40 #9A031E #FB8B24 #E36414 #0F4C5C
7
- #780000 #C1121F #FDF0D5 #003049 #669BBC
8
- #10002B #240046 #3C096C #5A189A #7B2CBF
9
- #355070 #6D597A #B56576 #E56B6F #EAAC8B
10
- #6F1D1B #BB9457 #432818 #99582A #FFE6A7
11
- #231942 #5E548E #9F86C0 #BE95C4 #E0B1CB
12
- #461220 #8C2F39 #B23A48 #FCB9B2 #FED0BB
13
- #780116 #F7B538 #DB7C26 #D8572A #C32F27
14
- ```