hyperframes 0.2.2 → 0.2.3-alpha.2
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.
- package/dist/cli.js +8651 -7892
- package/dist/docker/Dockerfile.render +33 -0
- package/dist/hyperframe-runtime.js +5 -5
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +5 -5
- package/dist/skills/gsap/SKILL.md +222 -0
- package/dist/skills/gsap/references/effects.md +304 -0
- package/dist/skills/gsap/references/frameworks.md +56 -0
- package/dist/skills/gsap/references/plugins.md +194 -0
- package/dist/skills/gsap/references/react.md +80 -0
- package/dist/skills/gsap/references/scrolltrigger.md +147 -0
- package/dist/skills/gsap/references/utils.md +91 -0
- package/dist/skills/gsap/scripts/extract-audio-data.py +188 -0
- package/dist/skills/hyperframes/SKILL.md +175 -0
- package/dist/skills/hyperframes/references/audio-reactive.md +76 -0
- package/dist/skills/hyperframes/references/captions.md +132 -0
- package/dist/skills/hyperframes/references/css-patterns.md +371 -0
- package/dist/skills/hyperframes/references/examples.md +146 -0
- package/dist/skills/hyperframes/references/marker-highlight.md +158 -0
- package/dist/skills/hyperframes/references/transitions/catalog.md +132 -0
- package/dist/skills/hyperframes/references/transitions/css-3d.md +12 -0
- package/dist/skills/hyperframes/references/transitions/css-blur.md +51 -0
- package/dist/skills/hyperframes/references/transitions/css-cover.md +43 -0
- package/dist/skills/hyperframes/references/transitions/css-destruction.md +95 -0
- package/dist/skills/hyperframes/references/transitions/css-dissolve.md +66 -0
- package/dist/skills/hyperframes/references/transitions/css-distortion.md +45 -0
- package/dist/skills/hyperframes/references/transitions/css-grid.md +10 -0
- package/dist/skills/hyperframes/references/transitions/css-light.md +49 -0
- package/dist/skills/hyperframes/references/transitions/css-mechanical.md +30 -0
- package/dist/skills/hyperframes/references/transitions/css-other.md +36 -0
- package/dist/skills/hyperframes/references/transitions/css-push.md +41 -0
- package/dist/skills/hyperframes/references/transitions/css-radial.md +37 -0
- package/dist/skills/hyperframes/references/transitions/css-scale.md +24 -0
- package/dist/skills/hyperframes/references/transitions/shader-setup.md +463 -0
- package/dist/skills/hyperframes/references/transitions/shader-transitions.md +329 -0
- package/dist/skills/hyperframes/references/transitions.md +96 -0
- package/dist/skills/hyperframes/references/tts.md +56 -0
- package/dist/skills/hyperframes-cli/SKILL.md +114 -0
- package/dist/studio/assets/{index-DA_l-VKo.js → index-B0VCLOXQ.js} +15 -15
- package/dist/studio/index.html +1 -1
- package/dist/templates/_shared/CLAUDE.md +5 -7
- package/dist/templates/blank/index.html +8 -10
- package/package.json +2 -4
- package/dist/skills/hyperframes-captions/SKILL.md +0 -212
- package/dist/skills/hyperframes-compose/SKILL.md +0 -155
- package/dist/skills/hyperframes-tts/SKILL.md +0 -79
- package/dist/templates/blank/compositions/captions.html +0 -95
- /package/dist/skills/{hyperframes-compose → hyperframes}/data-in-motion.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/house-style.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/bold-energetic.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/clean-corporate.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/dark-premium.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/jewel-rich.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/monochrome.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/nature-earth.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/neon-electric.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/pastel-soft.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/palettes/warm-editorial.md +0 -0
- /package/dist/skills/{hyperframes-compose → hyperframes}/patterns.md +0 -0
- /package/dist/skills/{hyperframes-captions → hyperframes/references}/dynamic-techniques.md +0 -0
- /package/dist/skills/{hyperframes-captions → hyperframes/references}/transcript-guide.md +0 -0
package/dist/studio/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>HyperFrames Studio</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-B0VCLOXQ.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-BT9D8I7B.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
**Always invoke the relevant skill before writing or modifying compositions.** Skills encode framework-specific patterns (e.g., `class="clip"`, `window.__timelines`, `data-*` attributes) that are NOT in generic web docs. Skipping them produces broken compositions.
|
|
6
6
|
|
|
7
|
-
| Skill
|
|
8
|
-
|
|
|
9
|
-
| **hyperframes
|
|
10
|
-
| **hyperframes-
|
|
11
|
-
| **gsap
|
|
12
|
-
| **gsap-timeline** | `/gsap-timeline` | Timeline sequencing, position parameter, labels, nesting |
|
|
13
|
-
| **gsap-performance** | `/gsap-performance` | Animation performance — transforms over layout props, will-change, batching |
|
|
7
|
+
| Skill | Command | When to use |
|
|
8
|
+
| ------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| **hyperframes** | `/hyperframes` | Creating or editing HTML compositions, captions, TTS, audio-reactive animation, marker highlights |
|
|
10
|
+
| **hyperframes-cli** | `/hyperframes-cli` | CLI commands: init, lint, preview, render, transcribe, tts |
|
|
11
|
+
| **gsap** | `/gsap` | GSAP animations — tweens, timelines, easing, ScrollTrigger, plugins, React/Vue/Svelte, performance optimization |
|
|
14
12
|
|
|
15
13
|
> **Skills not available?** Ask the user to run `npx hyperframes skills` and restart their
|
|
16
14
|
> agent session, or install manually: `npx skills add heygen-com/hyperframes` and
|
|
@@ -48,21 +48,19 @@
|
|
|
48
48
|
data-volume="1"
|
|
49
49
|
></audio>
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
data-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
data-width="1920"
|
|
59
|
-
data-height="1080"
|
|
60
|
-
></div>
|
|
51
|
+
<!--
|
|
52
|
+
Add your clips here. Example:
|
|
53
|
+
<div id="title" class="clip" data-start="0" data-duration="5" data-track-index="1"
|
|
54
|
+
style="font-size: 64px; color: #fff; padding: 40px">
|
|
55
|
+
Hello World
|
|
56
|
+
</div>
|
|
57
|
+
-->
|
|
61
58
|
</div>
|
|
62
59
|
|
|
63
60
|
<script>
|
|
64
61
|
window.__timelines = window.__timelines || {};
|
|
65
62
|
const tl = gsap.timeline({ paused: true });
|
|
63
|
+
// Example: tl.from("#title", { opacity: 0, y: -50, duration: 1 }, 0);
|
|
66
64
|
window.__timelines["main"] = tl;
|
|
67
65
|
</script>
|
|
68
66
|
</body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperframes",
|
|
3
|
-
"version": "0.2.2",
|
|
3
|
+
"version": "0.2.3-alpha.2",
|
|
4
4
|
"description": "HyperFrames CLI — create, preview, and render HTML video compositions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,14 +21,13 @@
|
|
|
21
21
|
"build:fonts": "cd ../producer && tsx scripts/generate-font-data.ts",
|
|
22
22
|
"build:studio": "cd ../studio && bun run build",
|
|
23
23
|
"build:runtime": "tsx scripts/build-runtime.ts",
|
|
24
|
-
"build:copy": "mkdir -p dist/studio dist/docs dist/templates dist/skills && cp -r ../studio/dist/* dist/studio/ && cp -r src/templates/blank src/templates/_shared dist/templates/ && cp -r ../../skills/hyperframes
|
|
24
|
+
"build:copy": "mkdir -p dist/studio dist/docs dist/templates dist/skills dist/docker && cp -r ../studio/dist/* dist/studio/ && cp -r src/templates/blank src/templates/_shared dist/templates/ && cp -r ../../skills/hyperframes ../../skills/hyperframes-cli ../../skills/gsap dist/skills/ && cp src/docker/Dockerfile.render dist/docker/ && (cp src/docs/*.md dist/docs/ 2>/dev/null || true)",
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hono/node-server": "^1.8.0",
|
|
29
29
|
"@puppeteer/browsers": "^2.13.0",
|
|
30
30
|
"adm-zip": "^0.5.16",
|
|
31
|
-
"cheerio": "^1.2.0",
|
|
32
31
|
"citty": "^0.2.1",
|
|
33
32
|
"compare-versions": "^6.1.1",
|
|
34
33
|
"esbuild": "^0.25.0",
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
"@types/mime-types": "^3.0.1",
|
|
50
49
|
"@types/node": "^22.0.0",
|
|
51
50
|
"adm-zip": "^0.5.16",
|
|
52
|
-
"cheerio": "^1.2.0",
|
|
53
51
|
"hono": "^4.0.0",
|
|
54
52
|
"linkedom": "^0.18.12",
|
|
55
53
|
"mime-types": "^3.0.2",
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hyperframes-captions
|
|
3
|
-
description: Captions, subtitles, lyrics, and karaoke synced to audio in HyperFrames. Tone-adaptive — detects script energy and applies matching typography, color, and animation with per-word styling.
|
|
4
|
-
trigger: Syncing text to audio timing — captions, subtitles, lyrics, karaoke, transcription overlays, word-level or phrase-level text timed to speech or music.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Captions
|
|
8
|
-
|
|
9
|
-
## Language Rule (Non-Negotiable)
|
|
10
|
-
|
|
11
|
-
**Never use `.en` models unless the user explicitly states the audio is English.** `.en` models (small.en, medium.en) TRANSLATE non-English audio into English instead of transcribing it. This silently destroys the original language.
|
|
12
|
-
|
|
13
|
-
When transcribing:
|
|
14
|
-
|
|
15
|
-
1. If the user says the language → use `--model small --language <code>` (no `.en` suffix)
|
|
16
|
-
2. If the user says it's English → use `--model small.en`
|
|
17
|
-
3. If the language is unknown → use `--model small` (no `.en`, no `--language`) — whisper auto-detects
|
|
18
|
-
|
|
19
|
-
**Default model is `small` (not `small.en`).** Only add `.en` when explicitly told the audio is English.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
Analyze the spoken content to determine caption style. If the user specifies a style, use that. Otherwise, detect tone from the transcript.
|
|
24
|
-
|
|
25
|
-
## Transcript Source
|
|
26
|
-
|
|
27
|
-
The project's `transcript.json` contains a normalized word array with word-level timestamps:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
[
|
|
31
|
-
{ "text": "Hello", "start": 0.0, "end": 0.5 },
|
|
32
|
-
{ "text": "world.", "start": 0.6, "end": 1.2 }
|
|
33
|
-
]
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This is the only format the captions composition consumes. Use it directly:
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const words = JSON.parse(transcriptJson); // [{ text, start, end }]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
For transcription commands, whisper model selection, external APIs (OpenAI, Groq), and supported input formats, see [transcript-guide.md](./transcript-guide.md).
|
|
43
|
-
|
|
44
|
-
## Style Detection (Default — When No Style Is Specified)
|
|
45
|
-
|
|
46
|
-
Read the full transcript before choosing a style. The style comes from the content, not a template.
|
|
47
|
-
|
|
48
|
-
### Four Dimensions
|
|
49
|
-
|
|
50
|
-
**1. Visual feel** — the overall aesthetic personality:
|
|
51
|
-
|
|
52
|
-
- Corporate/professional scripts → clean, minimal, restrained
|
|
53
|
-
- Energetic/marketing scripts → bold, punchy, high-impact
|
|
54
|
-
- Storytelling/narrative scripts → elegant, warm, cinematic
|
|
55
|
-
- Technical/educational scripts → precise, high-contrast, structured
|
|
56
|
-
- Social media/casual scripts → playful, dynamic, friendly
|
|
57
|
-
|
|
58
|
-
**2. Color palette** — driven by the content's mood:
|
|
59
|
-
|
|
60
|
-
- Dark backgrounds with bright accents for high energy
|
|
61
|
-
- Muted/neutral tones for professional or calm content
|
|
62
|
-
- High contrast (white on black, black on white) for clarity
|
|
63
|
-
- One accent color for emphasis — not multiple
|
|
64
|
-
|
|
65
|
-
**3. Font mood** — typography character, not specific font names:
|
|
66
|
-
|
|
67
|
-
- Heavy/condensed for impact and energy
|
|
68
|
-
- Clean sans-serif for modern and professional
|
|
69
|
-
- Rounded for friendly and approachable
|
|
70
|
-
- Serif for elegance and storytelling
|
|
71
|
-
|
|
72
|
-
**4. Animation character** — how words enter and exit:
|
|
73
|
-
|
|
74
|
-
- Scale-pop/slam for punchy energy
|
|
75
|
-
- Gentle fade/slide for calm or professional
|
|
76
|
-
- Word-by-word reveal for emphasis
|
|
77
|
-
- Typewriter for technical or narrative pacing
|
|
78
|
-
|
|
79
|
-
## Per-Word Styling
|
|
80
|
-
|
|
81
|
-
Scan the script for words that deserve distinct visual treatment. Not every word is equal — some carry the message.
|
|
82
|
-
|
|
83
|
-
### What to Detect
|
|
84
|
-
|
|
85
|
-
- **Brand names / product names** — larger size, unique color, distinct entrance
|
|
86
|
-
- **ALL CAPS words** — the author emphasized them intentionally. Scale boost, flash, or accent color.
|
|
87
|
-
- **Numbers / statistics** — bold weight, accent color. Numbers are the payload in data-driven content.
|
|
88
|
-
- **Emotional keywords** — "incredible", "insane", "amazing", "revolutionary" → exaggerated animation (overshoot, bounce)
|
|
89
|
-
- **Proper nouns** — names of people, places, events → distinct accent or italic
|
|
90
|
-
- **Call-to-action phrases** — "sign up", "get started", "try it now" → highlight, underline, or color pop
|
|
91
|
-
|
|
92
|
-
### How to Apply
|
|
93
|
-
|
|
94
|
-
For each detected word, specify:
|
|
95
|
-
|
|
96
|
-
- Font size multiplier (e.g., 1.3x for emphasis, 1.5x for hero moments)
|
|
97
|
-
- Color override (specific hex value)
|
|
98
|
-
- Weight/style change (bolder, italic)
|
|
99
|
-
- Animation variant (overshoot entrance, glow pulse, scale pop)
|
|
100
|
-
- **Marker highlight mode** — for visual emphasis beyond color/scale, add a marker-style effect: highlight sweep behind the word, hand-drawn circle around it, burst lines radiating from it, or scribble underline beneath it. See the `/marker-highlight` skill for patterns and the energy-to-mode mapping table.
|
|
101
|
-
|
|
102
|
-
## Script-to-Style Mapping
|
|
103
|
-
|
|
104
|
-
| Script tone | Font mood | Animation | Color | Size |
|
|
105
|
-
| -------------------- | ------------------------------------- | --------------------------------------- | -------------------------------------------- | -------------------- |
|
|
106
|
-
| Hype/launch | Heavy condensed, 800-900 weight | Scale-pop, back.out(1.7), fast 0.1-0.2s | Bright accent on dark (cyan, yellow, lime) | Large 72-96px |
|
|
107
|
-
| Corporate/pitch | Clean sans-serif, 600-700 weight | Fade + slide-up, power3.out, 0.3s | White/neutral on dark, single muted accent | Medium 56-72px |
|
|
108
|
-
| Tutorial/educational | Mono or clean sans, 500-600 weight | Typewriter or gentle fade, 0.4-0.5s | High contrast, minimal color | Medium 48-64px |
|
|
109
|
-
| Storytelling/brand | Serif or elegant sans, 400-500 weight | Slow fade, power2.out, 0.5-0.6s | Warm muted tones, low opacity (0.85-0.9) | Smaller 44-56px |
|
|
110
|
-
| Social/casual | Rounded sans, 700-800 weight | Bounce, elastic.out, word-by-word | Playful colors, colored backgrounds on pills | Medium-large 56-80px |
|
|
111
|
-
|
|
112
|
-
## Word Grouping by Tone
|
|
113
|
-
|
|
114
|
-
Group size affects pacing. Fast content needs fast caption turnover.
|
|
115
|
-
|
|
116
|
-
- **High energy:** 2-3 words per group. Quick turnover matches rapid delivery.
|
|
117
|
-
- **Conversational:** 3-5 words per group. Natural phrase length.
|
|
118
|
-
- **Measured/calm:** 4-6 words per group. Longer groups match slower pace.
|
|
119
|
-
|
|
120
|
-
Break groups on sentence boundaries (period, question mark, exclamation), pauses (150ms+ gap), or max word count — whichever comes first.
|
|
121
|
-
|
|
122
|
-
## Positioning
|
|
123
|
-
|
|
124
|
-
- **Landscape (1920x1080):** Bottom 80-120px, centered
|
|
125
|
-
- **Portrait (1080x1920):** Lower middle ~600-700px from bottom, centered
|
|
126
|
-
- Never cover the subject's face
|
|
127
|
-
- Use `position: absolute` — never relative (causes overflow)
|
|
128
|
-
- One caption group visible at a time
|
|
129
|
-
|
|
130
|
-
## Text Overflow Prevention
|
|
131
|
-
|
|
132
|
-
Use `window.__hyperframes.fitTextFontSize()` to measure actual rendered text width and compute the correct font size. This replaces character-count heuristics with pixel-accurate measurement powered by [pretext](https://github.com/chenglou/pretext).
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
GROUPS.forEach(function (group, gi) {
|
|
136
|
-
var result = window.__hyperframes.fitTextFontSize(group.text.toUpperCase(), {
|
|
137
|
-
fontFamily: "Outfit",
|
|
138
|
-
fontWeight: 900,
|
|
139
|
-
maxWidth: 1600,
|
|
140
|
-
});
|
|
141
|
-
wordEls.forEach(function (el) {
|
|
142
|
-
el.style.fontSize = result.fontSize + "px";
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
| Option | Default | Description |
|
|
148
|
-
| -------------- | ---------- | ---------------------------------------------------- |
|
|
149
|
-
| `maxWidth` | `1600` | Container width in px (1600 landscape, 900 portrait) |
|
|
150
|
-
| `baseFontSize` | `78` | Starting font size — used when text fits |
|
|
151
|
-
| `minFontSize` | `42` | Floor — never shrink below this |
|
|
152
|
-
| `fontWeight` | `900` | Must match the CSS font-weight |
|
|
153
|
-
| `fontFamily` | `"Outfit"` | Must match the CSS font-family |
|
|
154
|
-
| `step` | `2` | Decrement step in px per iteration |
|
|
155
|
-
|
|
156
|
-
`fontWeight` and `fontFamily` must match the CSS applied to the text elements exactly, or measurements will be inaccurate.
|
|
157
|
-
|
|
158
|
-
**Safety nets (still required in CSS):**
|
|
159
|
-
|
|
160
|
-
- `max-width: 1600px` (landscape) or `max-width: 900px` (portrait) on caption container
|
|
161
|
-
- `overflow: hidden` as a fallback for `fits: false` edge cases
|
|
162
|
-
- `position: absolute` on all caption elements
|
|
163
|
-
- Explicit `height` on caption container (e.g., `200px`)
|
|
164
|
-
|
|
165
|
-
## Caption Exit Guarantee
|
|
166
|
-
|
|
167
|
-
Captions that stick on screen are the most common caption bug. Every caption group **must** have a hard kill after its exit animation.
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
// Animate exit (soft — can fail if tweens conflict)
|
|
171
|
-
tl.to(groupEl, { opacity: 0, scale: 0.95, duration: 0.12, ease: "power2.in" }, group.end - 0.12);
|
|
172
|
-
|
|
173
|
-
// Hard kill at group.end (deterministic — guarantees invisible)
|
|
174
|
-
tl.set(groupEl, { opacity: 0, visibility: "hidden" }, group.end);
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Why both?** The `tl.to` exit can fail to fully hide a group when karaoke word-level tweens conflict with the parent exit tween, `fromTo` entrance tweens lock values that override later tweens, or timeline scrubbing lands between the exit start and end. The `tl.set` at `group.end` is a deterministic kill — it fires at an exact time, doesn't animate, and can't be overridden.
|
|
178
|
-
|
|
179
|
-
**Self-lint rule:** After building the timeline, verify every caption group has a hard kill:
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
GROUPS.forEach(function (group, gi) {
|
|
183
|
-
var el = document.getElementById("cg-" + gi);
|
|
184
|
-
if (!el) return;
|
|
185
|
-
tl.seek(group.end + 0.01);
|
|
186
|
-
var computed = window.getComputedStyle(el);
|
|
187
|
-
if (computed.opacity !== "0" && computed.visibility !== "hidden") {
|
|
188
|
-
console.warn(
|
|
189
|
-
"[caption-lint] group " + gi + " still visible at t=" + (group.end + 0.01).toFixed(2) + "s",
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
tl.seek(0);
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Place this **before** `window.__timelines[id] = tl` so it runs at composition init.
|
|
197
|
-
|
|
198
|
-
## References
|
|
199
|
-
|
|
200
|
-
For dynamic animation techniques (karaoke, clip-path reveals, slam words, scatter exits, elastic entrances, 3D rotation, audio-reactive captions, pretext-based positioning and grouping), see [dynamic-techniques.md](./dynamic-techniques.md).
|
|
201
|
-
|
|
202
|
-
For animated text emphasis (highlight sweeps, hand-drawn circles, burst lines, scribble underlines, sketchout effects) that pairs with per-word styling, see the `/marker-highlight` skill.
|
|
203
|
-
|
|
204
|
-
For transcription commands, whisper models, external APIs, and troubleshooting, see [transcript-guide.md](./transcript-guide.md).
|
|
205
|
-
|
|
206
|
-
## Constraints
|
|
207
|
-
|
|
208
|
-
- **Deterministic.** No `Math.random()`, no `Date.now()`.
|
|
209
|
-
- **Sync to transcript timestamps.** Words appear when spoken.
|
|
210
|
-
- **One group visible at a time.** No overlapping caption groups.
|
|
211
|
-
- **Every caption group must have a hard `tl.set` kill at `group.end`.** Exit animations alone are not sufficient.
|
|
212
|
-
- **Check project root** for font files before defaulting to Google Fonts.
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hyperframes-compose
|
|
3
|
-
description: Create video compositions, animations, title cards, or overlays in HyperFrames HTML. Use when asked to build any HTML-based video content.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Compose Video
|
|
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
|
-
Before writing HTML, think at a high level:
|
|
13
|
-
|
|
14
|
-
1. **What** — what should the viewer experience? Identify the narrative arc, key moments, and emotional beats.
|
|
15
|
-
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. **Execute** — then implement using the rules below.
|
|
18
|
-
|
|
19
|
-
For small edits (fix a color, adjust timing, add one element), skip straight to the rules.
|
|
20
|
-
|
|
21
|
-
When no `visual-style.md` or animation direction is provided, follow [house-style.md](./house-style.md) for motion defaults, sizing, and color palettes.
|
|
22
|
-
|
|
23
|
-
## Data Attributes
|
|
24
|
-
|
|
25
|
-
### All Clips
|
|
26
|
-
|
|
27
|
-
| Attribute | Required | Values |
|
|
28
|
-
| ------------------ | --------------------------------- | ------------------------------------------------------ |
|
|
29
|
-
| `id` | Yes | Unique identifier |
|
|
30
|
-
| `data-start` | Yes | Seconds or clip ID reference (`"el-1"`, `"intro + 2"`) |
|
|
31
|
-
| `data-duration` | Required for img/div/compositions | Seconds. Video/audio defaults to media duration. |
|
|
32
|
-
| `data-track-index` | Yes | Integer. Same-track clips **cannot overlap**. |
|
|
33
|
-
| `data-media-start` | No | Trim offset into source (seconds) |
|
|
34
|
-
| `data-volume` | No | 0-1 (default 1) |
|
|
35
|
-
|
|
36
|
-
`data-track-index` does **not** affect visual layering — use CSS `z-index`.
|
|
37
|
-
|
|
38
|
-
### Composition Clips
|
|
39
|
-
|
|
40
|
-
| Attribute | Required | Values |
|
|
41
|
-
| ---------------------------- | -------- | -------------------------------------------- |
|
|
42
|
-
| `data-composition-id` | Yes | Unique composition ID |
|
|
43
|
-
| `data-duration` | Yes | Takes precedence over GSAP timeline duration |
|
|
44
|
-
| `data-width` / `data-height` | Yes | Pixel dimensions (1920x1080 or 1080x1920) |
|
|
45
|
-
| `data-composition-src` | No | Path to external HTML file |
|
|
46
|
-
|
|
47
|
-
## Composition Structure
|
|
48
|
-
|
|
49
|
-
Every composition is a `<template>` wrapping a `<div>` with `data-composition-id`. Each must include its own GSAP script and register its timeline:
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<template id="my-comp-template">
|
|
53
|
-
<div data-composition-id="my-comp" data-width="1920" data-height="1080">
|
|
54
|
-
<!-- content -->
|
|
55
|
-
<style>
|
|
56
|
-
[data-composition-id="my-comp"] {
|
|
57
|
-
/* scoped styles */
|
|
58
|
-
}
|
|
59
|
-
</style>
|
|
60
|
-
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
|
61
|
-
<script>
|
|
62
|
-
window.__timelines = window.__timelines || {};
|
|
63
|
-
const tl = gsap.timeline({ paused: true });
|
|
64
|
-
// tweens...
|
|
65
|
-
window.__timelines["my-comp"] = tl;
|
|
66
|
-
</script>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
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>`
|
|
72
|
-
|
|
73
|
-
## Video and Audio
|
|
74
|
-
|
|
75
|
-
Video must be `muted playsinline`. Audio is always a separate `<audio>` element:
|
|
76
|
-
|
|
77
|
-
```html
|
|
78
|
-
<video
|
|
79
|
-
id="el-v"
|
|
80
|
-
data-start="0"
|
|
81
|
-
data-duration="30"
|
|
82
|
-
data-track-index="0"
|
|
83
|
-
src="video.mp4"
|
|
84
|
-
muted
|
|
85
|
-
playsinline
|
|
86
|
-
></video>
|
|
87
|
-
<audio
|
|
88
|
-
id="el-a"
|
|
89
|
-
data-start="0"
|
|
90
|
-
data-duration="30"
|
|
91
|
-
data-track-index="2"
|
|
92
|
-
src="video.mp4"
|
|
93
|
-
data-volume="1"
|
|
94
|
-
></audio>
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Timeline Contract
|
|
98
|
-
|
|
99
|
-
- All timelines start `{ paused: true }` — the player controls playback
|
|
100
|
-
- Register every timeline: `window.__timelines["<composition-id>"] = tl`
|
|
101
|
-
- Framework auto-nests sub-timelines — do NOT manually add them
|
|
102
|
-
- Duration comes from `data-duration`, not from GSAP timeline length
|
|
103
|
-
- Never create empty tweens to set duration
|
|
104
|
-
|
|
105
|
-
## Rules (Non-Negotiable)
|
|
106
|
-
|
|
107
|
-
**Deterministic:** No `Math.random()`, `Date.now()`, or time-based logic. The renderer must produce identical output every time.
|
|
108
|
-
|
|
109
|
-
**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()`.
|
|
110
|
-
|
|
111
|
-
**Animation conflicts:** Never animate the same property on the same element from multiple timelines simultaneously — causes flickering in headless renders.
|
|
112
|
-
|
|
113
|
-
**Never do:**
|
|
114
|
-
|
|
115
|
-
1. Forget `window.__timelines` registration
|
|
116
|
-
2. Use video for audio — always muted video + separate `<audio>`
|
|
117
|
-
3. Nest video inside a timed div — use a non-timed wrapper
|
|
118
|
-
4. Use `data-layer` (use `data-track-index`) or `data-end` (use `data-duration`)
|
|
119
|
-
5. Animate video element dimensions — animate a wrapper div
|
|
120
|
-
6. Call play/pause/seek on media — framework owns playback
|
|
121
|
-
7. Create a top-level container without `data-composition-id`
|
|
122
|
-
|
|
123
|
-
## Editing Existing Compositions
|
|
124
|
-
|
|
125
|
-
- Read the full composition first — match existing fonts, colors, animation patterns
|
|
126
|
-
- Only change what was requested — don't rewrite untouched sections
|
|
127
|
-
- Don't rewrite entire files for small changes
|
|
128
|
-
- Preserve timing of unrelated clips
|
|
129
|
-
|
|
130
|
-
## Typography and Assets
|
|
131
|
-
|
|
132
|
-
- Every composition loads its own fonts (`@import` or `@font-face` in `<style>`)
|
|
133
|
-
- Use `font-display: block` for local fonts — renderer needs fonts loaded before capturing
|
|
134
|
-
- Add `crossorigin="anonymous"` to media loaded from external URLs
|
|
135
|
-
- Minimum readable text: 20px landscape, 18px portrait
|
|
136
|
-
- For dynamic text that may overflow its container, use `window.__hyperframes.fitTextFontSize(text, { maxWidth, fontFamily, fontWeight })` to compute the largest font size that fits on one line. Returns `{ fontSize, fits }`. Options: `baseFontSize` (default 78), `minFontSize` (default 42), `step` (default 2). `fontFamily` and `fontWeight` must match the CSS applied to the element.
|
|
137
|
-
- All files (video, audio, fonts, images) live at the project root alongside `index.html`
|
|
138
|
-
- From sub-compositions, use `../` to reference root files
|
|
139
|
-
|
|
140
|
-
For PiP, title cards, and slide show patterns, see [patterns.md](./patterns.md).
|
|
141
|
-
For data, stats, and infographics, see [data-in-motion.md](./data-in-motion.md).
|
|
142
|
-
For typewriter text and other GSAP animation effects, see the `gsap-effects` skill.
|
|
143
|
-
For audio-driven animation (beat sync, glow, pulse), see the `audio-reactive` skill.
|
|
144
|
-
|
|
145
|
-
## Output Checklist
|
|
146
|
-
|
|
147
|
-
- [ ] Every top-level container has `data-composition-id`
|
|
148
|
-
- [ ] Every composition has `data-width`, `data-height`, `data-duration`
|
|
149
|
-
- [ ] Compositions in own HTML files, loaded via `data-composition-src`
|
|
150
|
-
- [ ] `<template>` wrapper on sub-compositions
|
|
151
|
-
- [ ] `window.__timelines` registered for every composition
|
|
152
|
-
- [ ] 100% deterministic — no randomness
|
|
153
|
-
- [ ] Each composition includes GSAP: `<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>`
|
|
154
|
-
- [ ] `npx hyperframes lint` passes with 0 errors
|
|
155
|
-
- [ ] `npx hyperframes validate` passes with 0 errors (run both before opening the studio)
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hyperframes-tts
|
|
3
|
-
description: Generate speech audio locally using Kokoro-82M (no API key). Use when asked to create narration, voiceover, or text-to-speech audio for compositions, or when a user needs spoken audio from text. Covers voice selection, speed tuning, and integrating TTS output with compositions and captions.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Text-to-Speech
|
|
7
|
-
|
|
8
|
-
## Voice Selection
|
|
9
|
-
|
|
10
|
-
Match voice to content. Default is `af_heart`.
|
|
11
|
-
|
|
12
|
-
| Content type | Voice | Why |
|
|
13
|
-
| ----------------- | --------------------- | ----------------------------- |
|
|
14
|
-
| Product demo | `af_heart`/`af_nova` | Warm, professional |
|
|
15
|
-
| Tutorial / how-to | `am_adam`/`bf_emma` | Neutral, easy to follow |
|
|
16
|
-
| Marketing / promo | `af_sky`/`am_michael` | Energetic or authoritative |
|
|
17
|
-
| Documentation | `bf_emma`/`bm_george` | Clear British English, formal |
|
|
18
|
-
| Casual / social | `af_heart`/`af_sky` | Approachable, natural |
|
|
19
|
-
|
|
20
|
-
Run `npx hyperframes tts --list` for all 54 voices (8 languages: EN, JP, ZH, KO, FR, DE, IT, PT).
|
|
21
|
-
|
|
22
|
-
## Speed Tuning
|
|
23
|
-
|
|
24
|
-
- **0.7-0.8** — Tutorial, complex content, accessibility
|
|
25
|
-
- **1.0** — Natural pace (default)
|
|
26
|
-
- **1.1-1.2** — Intros, transitions, upbeat content
|
|
27
|
-
- **1.5+** — Rarely appropriate; test carefully
|
|
28
|
-
|
|
29
|
-
## Composing with TTS Audio
|
|
30
|
-
|
|
31
|
-
Generate a voiceover and use it as the audio track:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx hyperframes tts "Your script here" --voice af_nova --output narration.wav
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Then reference it in the composition as a standard `<audio>` element:
|
|
38
|
-
|
|
39
|
-
```html
|
|
40
|
-
<audio
|
|
41
|
-
id="narration"
|
|
42
|
-
data-start="0"
|
|
43
|
-
data-duration="auto"
|
|
44
|
-
data-track-index="2"
|
|
45
|
-
src="narration.wav"
|
|
46
|
-
data-volume="1"
|
|
47
|
-
></audio>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## TTS + Captions Workflow
|
|
51
|
-
|
|
52
|
-
Generate speech, then transcribe it back for word-level caption timestamps:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
# 1. Generate speech
|
|
56
|
-
npx hyperframes tts script.txt --voice af_heart --output narration.wav
|
|
57
|
-
|
|
58
|
-
# 2. Transcribe for word-level timestamps
|
|
59
|
-
npx hyperframes transcribe narration.wav
|
|
60
|
-
|
|
61
|
-
# 3. Result: narration.wav + transcript.json ready for captions
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This avoids manually timing captions — whisper extracts precise word boundaries from the generated audio.
|
|
65
|
-
|
|
66
|
-
## Long Scripts
|
|
67
|
-
|
|
68
|
-
For scripts longer than a few paragraphs, write the text to a `.txt` file and pass the path:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
npx hyperframes tts script.txt --voice bf_emma --output narration.wav
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The model handles long text well but very long inputs (>5 minutes of speech) may benefit from splitting into segments.
|
|
75
|
-
|
|
76
|
-
## Requirements
|
|
77
|
-
|
|
78
|
-
- Python 3.8+ with `kokoro-onnx` and `soundfile` installed (`pip install kokoro-onnx soundfile`)
|
|
79
|
-
- Model downloads automatically on first use (~311 MB + ~27 MB voices, cached in `~/.cache/hyperframes/tts/`)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<template id="captions-template">
|
|
2
|
-
<div
|
|
3
|
-
data-composition-id="captions"
|
|
4
|
-
data-width="1920"
|
|
5
|
-
data-height="1080"
|
|
6
|
-
data-duration="__VIDEO_DURATION__"
|
|
7
|
-
>
|
|
8
|
-
<div id="captions-container"></div>
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
[data-composition-id="captions"] {
|
|
12
|
-
width: 1920px;
|
|
13
|
-
height: 1080px;
|
|
14
|
-
pointer-events: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
[data-composition-id="captions"] #captions-container {
|
|
18
|
-
position: absolute;
|
|
19
|
-
bottom: 100px;
|
|
20
|
-
left: 50%;
|
|
21
|
-
transform: translateX(-50%);
|
|
22
|
-
display: flex;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
align-items: center;
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 150px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.caption-group {
|
|
30
|
-
position: absolute;
|
|
31
|
-
opacity: 0;
|
|
32
|
-
font-family: "Inter", sans-serif;
|
|
33
|
-
font-size: 48px;
|
|
34
|
-
font-weight: 700;
|
|
35
|
-
color: #ffffff;
|
|
36
|
-
text-shadow:
|
|
37
|
-
0 2px 8px rgba(0, 0, 0, 0.8),
|
|
38
|
-
0 0 2px rgba(0, 0, 0, 0.9);
|
|
39
|
-
white-space: nowrap;
|
|
40
|
-
max-width: 1600px;
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
44
|
-
|
|
45
|
-
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
|
46
|
-
<script>
|
|
47
|
-
(function () {
|
|
48
|
-
window.__timelines = window.__timelines || {};
|
|
49
|
-
const tl = gsap.timeline({ paused: true });
|
|
50
|
-
|
|
51
|
-
const script = [];
|
|
52
|
-
|
|
53
|
-
if (script.length === 0) {
|
|
54
|
-
window.__timelines["captions"] = tl;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const container = document.getElementById("captions-container");
|
|
59
|
-
|
|
60
|
-
// Group words into lines (max 5 words per line)
|
|
61
|
-
const lines = [];
|
|
62
|
-
for (let i = 0; i < script.length; i += 5) {
|
|
63
|
-
const lineWords = script.slice(i, i + 5);
|
|
64
|
-
lines.push({
|
|
65
|
-
text: lineWords.map((w) => w.text).join(" "),
|
|
66
|
-
start: lineWords[0].start,
|
|
67
|
-
end: lineWords[lineWords.length - 1].end,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
lines.forEach((line, index) => {
|
|
72
|
-
const el = document.createElement("div");
|
|
73
|
-
el.className = "caption-group";
|
|
74
|
-
el.textContent = line.text;
|
|
75
|
-
container.appendChild(el);
|
|
76
|
-
|
|
77
|
-
tl.fromTo(
|
|
78
|
-
el,
|
|
79
|
-
{ opacity: 0, y: 20 },
|
|
80
|
-
{ opacity: 1, y: 0, duration: 0.3, ease: "power3.out" },
|
|
81
|
-
line.start,
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const hideTime =
|
|
85
|
-
index < lines.length - 1 ? Math.min(line.end, lines[index + 1].start) : line.end;
|
|
86
|
-
|
|
87
|
-
tl.to(el, { opacity: 0, y: -10, duration: 0.25, ease: "power2.in" }, hideTime - 0.25);
|
|
88
|
-
tl.set(el, { opacity: 0, visibility: "hidden" }, hideTime);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
window.__timelines["captions"] = tl;
|
|
92
|
-
})();
|
|
93
|
-
</script>
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|