dsh-hyperframes 0.1.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 (66) hide show
  1. package/README.en.md +35 -0
  2. package/README.md +35 -0
  3. package/cordis.patch.yml +7 -0
  4. package/lib/index.d.ts +35 -0
  5. package/lib/index.js +74 -0
  6. package/package.json +63 -0
  7. package/skills/gsap/SKILL.md +213 -0
  8. package/skills/gsap/references/effects.md +297 -0
  9. package/skills/gsap/scripts/extract-audio-data.py +188 -0
  10. package/skills/hyperframes/SKILL.md +366 -0
  11. package/skills/hyperframes/data-in-motion.md +19 -0
  12. package/skills/hyperframes/house-style.md +71 -0
  13. package/skills/hyperframes/palettes/bold-energetic.md +14 -0
  14. package/skills/hyperframes/palettes/clean-corporate.md +14 -0
  15. package/skills/hyperframes/palettes/dark-premium.md +14 -0
  16. package/skills/hyperframes/palettes/jewel-rich.md +14 -0
  17. package/skills/hyperframes/palettes/monochrome.md +14 -0
  18. package/skills/hyperframes/palettes/nature-earth.md +14 -0
  19. package/skills/hyperframes/palettes/neon-electric.md +14 -0
  20. package/skills/hyperframes/palettes/pastel-soft.md +14 -0
  21. package/skills/hyperframes/palettes/warm-editorial.md +14 -0
  22. package/skills/hyperframes/patterns.md +118 -0
  23. package/skills/hyperframes/references/audio-reactive.md +76 -0
  24. package/skills/hyperframes/references/captions.md +132 -0
  25. package/skills/hyperframes/references/css-patterns.md +373 -0
  26. package/skills/hyperframes/references/dynamic-techniques.md +90 -0
  27. package/skills/hyperframes/references/motion-principles.md +69 -0
  28. package/skills/hyperframes/references/transcript-guide.md +151 -0
  29. package/skills/hyperframes/references/transitions/catalog.md +117 -0
  30. package/skills/hyperframes/references/transitions/css-3d.md +12 -0
  31. package/skills/hyperframes/references/transitions/css-blur.md +51 -0
  32. package/skills/hyperframes/references/transitions/css-cover.md +43 -0
  33. package/skills/hyperframes/references/transitions/css-destruction.md +95 -0
  34. package/skills/hyperframes/references/transitions/css-dissolve.md +66 -0
  35. package/skills/hyperframes/references/transitions/css-distortion.md +45 -0
  36. package/skills/hyperframes/references/transitions/css-grid.md +10 -0
  37. package/skills/hyperframes/references/transitions/css-light.md +49 -0
  38. package/skills/hyperframes/references/transitions/css-mechanical.md +30 -0
  39. package/skills/hyperframes/references/transitions/css-other.md +25 -0
  40. package/skills/hyperframes/references/transitions/css-push.md +41 -0
  41. package/skills/hyperframes/references/transitions/css-radial.md +37 -0
  42. package/skills/hyperframes/references/transitions/css-scale.md +24 -0
  43. package/skills/hyperframes/references/transitions.md +112 -0
  44. package/skills/hyperframes/references/tts.md +75 -0
  45. package/skills/hyperframes/references/typography.md +175 -0
  46. package/skills/hyperframes/scripts/animation-map.mjs +596 -0
  47. package/skills/hyperframes/scripts/contrast-report.mjs +335 -0
  48. package/skills/hyperframes/visual-styles.md +211 -0
  49. package/skills/hyperframes-cli/SKILL.md +152 -0
  50. package/skills/hyperframes-registry/SKILL.md +106 -0
  51. package/skills/hyperframes-registry/examples/add-block.md +51 -0
  52. package/skills/hyperframes-registry/examples/add-component.md +73 -0
  53. package/skills/hyperframes-registry/references/demo-html-pattern.md +54 -0
  54. package/skills/hyperframes-registry/references/discovery.md +53 -0
  55. package/skills/hyperframes-registry/references/install-locations.md +45 -0
  56. package/skills/hyperframes-registry/references/wiring-blocks.md +91 -0
  57. package/skills/hyperframes-registry/references/wiring-components.md +77 -0
  58. package/skills/website-to-hyperframes/SKILL.md +125 -0
  59. package/skills/website-to-hyperframes/references/step-1-capture.md +74 -0
  60. package/skills/website-to-hyperframes/references/step-2-design.md +178 -0
  61. package/skills/website-to-hyperframes/references/step-3-script.md +96 -0
  62. package/skills/website-to-hyperframes/references/step-4-storyboard.md +246 -0
  63. package/skills/website-to-hyperframes/references/step-5-vo.md +42 -0
  64. package/skills/website-to-hyperframes/references/step-6-build.md +229 -0
  65. package/skills/website-to-hyperframes/references/step-7-validate.md +114 -0
  66. package/skills/website-to-hyperframes/references/techniques.md +387 -0
@@ -0,0 +1,90 @@
1
+ # Dynamic Caption Techniques
2
+
3
+ You are here because SKILL.md told you to read this file before writing animation code. Pick your technique combination from the table below based on the energy level you detected from the transcript, then implement using standard GSAP patterns.
4
+
5
+ ## Technique Selection by Energy
6
+
7
+ | Energy level | Highlight | Exit | Cycle pattern |
8
+ | ------------ | ------------------------------------- | ------------------- | ----------------------------------------- |
9
+ | High | Karaoke with accent glow + scale pop | Scatter or drop | Alternate highlight styles every 2 groups |
10
+ | Medium-high | Karaoke with color pop | Scatter or collapse | Alternate every 3 groups |
11
+ | Medium | Karaoke (subtle, white only) | Fade + slide | Alternate every 3 groups |
12
+ | Medium-low | Karaoke (minimal scale change) | Fade | Single style, vary ease per group |
13
+ | Low | Karaoke (warm tones, slow transition) | Collapse | Alternate every 4 groups |
14
+
15
+ **All energy levels use karaoke highlight as the baseline.** The difference is intensity — high energy gets accent color + glow + 15% scale pop on active words, low energy gets a gentle white shift with 3% scale.
16
+
17
+ **Emphasis words always break the pattern.** When a word is flagged as emphasis (emotional keyword, ALL CAPS, brand name), give it a stronger animation than surrounding words (larger scale, accent color, overshoot ease). This creates contrast.
18
+
19
+ **Marker highlight modes add a visual layer on top of karaoke.** For emphasis words that need more than color/scale, add a marker-style effect — highlight sweep, circle, burst, or scribble — using the `/marker-highlight` skill. Match mode to energy: burst for hype, circle for key terms, highlight for standard, scribble for subtle.
20
+
21
+ ## Audio-Reactive Captions (Mandatory for Music)
22
+
23
+ **If the source audio is music (vocals over instrumentation, beats, any musical content), you MUST extract audio data and add audio-reactive animations.** This is not optional — music without audio reactivity looks disconnected. Even low-energy ballads get subtle bass pulse and treble glow.
24
+
25
+ No special wiring is needed. The group loop already iterates over every caption group to build entrance, karaoke, and exit tweens. At that point, read the audio data for each group's time range and use it to modulate the group's animation intensity with regular GSAP tweens.
26
+
27
+ ```js
28
+ // Load audio data inline (same pattern as TRANSCRIPT)
29
+ var AUDIO = JSON.parse(audioDataJson); // { fps, totalFrames, frames: [{ bands: [...] }] }
30
+
31
+ GROUPS.forEach(function (group, gi) {
32
+ var groupEl = document.getElementById("cg-" + gi);
33
+ if (!groupEl) return;
34
+
35
+ // Read peak energy for this group's time range
36
+ var startFrame = Math.floor(group.start * AUDIO.fps);
37
+ var endFrame = Math.min(Math.floor(group.end * AUDIO.fps), AUDIO.totalFrames - 1);
38
+ var peakBass = 0;
39
+ var peakTreble = 0;
40
+ for (var f = startFrame; f <= endFrame; f++) {
41
+ var frame = AUDIO.frames[f];
42
+ if (!frame) continue;
43
+ peakBass = Math.max(peakBass, frame.bands[0] || 0, frame.bands[1] || 0);
44
+ peakTreble = Math.max(peakTreble, frame.bands[6] || 0, frame.bands[7] || 0);
45
+ }
46
+
47
+ // Modulate entrance — louder groups enter bigger and glowier
48
+ tl.to(
49
+ groupEl,
50
+ {
51
+ scale: 1 + peakBass * 0.06,
52
+ textShadow:
53
+ "0 0 " + Math.round(peakTreble * 12) + "px rgba(255,255,255," + peakTreble * 0.4 + ")",
54
+ duration: 0.3,
55
+ ease: "power2.out",
56
+ },
57
+ group.start,
58
+ );
59
+
60
+ // Reset at exit so audio-driven values don't persist
61
+ tl.set(groupEl, { scale: 1, textShadow: "none" }, group.end - 0.15);
62
+ });
63
+ ```
64
+
65
+ This shapes the animation at build time, not playback time — no per-frame callbacks, no `tl.call()` loops, no async fetch timing issues. Loud groups come in with more weight and glow; quiet groups come in soft. The audio data modulates _how much_, the content determines _what_.
66
+
67
+ Keep audio reactivity subtle — 3-6% scale variation and soft glow. Heavy pulsing makes text unreadable.
68
+
69
+ To generate the audio data file:
70
+
71
+ ```bash
72
+ python3 skills/gsap-effects/scripts/extract-audio-data.py audio.mp3 --fps 30 --bands 8 -o audio-data.json
73
+ ```
74
+
75
+ ## Combining Techniques
76
+
77
+ Don't use the same highlight animation on every group — cycle through styles using the group index. Don't combine multiple competing animations on the same word at the same timestamp. Vary techniques across groups to match the content's pace changes.
78
+
79
+ **Marker highlight effects** (from the `/marker-highlight` skill) layer well with karaoke — use karaoke for the word-by-word reveal, then add a marker effect on emphasis words only. For example: karaoke highlights each word in white, but brand names get a yellow highlight sweep and stats get a red circle. Cycle marker modes across groups for visual variety (see the mode-to-energy mapping in the marker-highlight skill).
80
+
81
+ ## Available Tools
82
+
83
+ These tools are available in the HyperFrames runtime. Use them when they solve a real problem — not every composition needs all of them.
84
+
85
+ | Tool | What it does | Access | When it's useful |
86
+ | ------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
87
+ | **pretext** | Pure-arithmetic text measurement without DOM reflow. 0.0002ms per call. | `window.__hyperframes.pretext.prepare(text, font)` / `.layout(prepared, maxWidth, lineHeight)` | Per-frame text reflow, shrinkwrap containers, computing layout before render |
88
+ | **fitTextFontSize** | Finds the largest font size that fits text on one line. Built on pretext. | `window.__hyperframes.fitTextFontSize(text, { maxWidth, fontFamily, fontWeight })` | Overflow prevention for long phrases, portrait mode, large base sizes |
89
+ | **audio data** | Pre-extracted per-frame RMS energy and frequency bands. | Extract with `extract-audio-data.py`, load inline or via `fetch("audio-data.json")` | Audio-reactive visuals — modulate intensity based on the music |
90
+ | **GSAP** | Animation timeline with tweens and callbacks. | `gsap.to()`, `gsap.set()`, `tl.to()`, `tl.set()` | All caption animation |
@@ -0,0 +1,69 @@
1
+ # Motion Principles
2
+
3
+ ## Guardrails
4
+
5
+ You know these rules but you violate them. Stop.
6
+
7
+ - **Don't use the same ease on every tween.** You default to `power2.out` on everything. Vary eases like you vary font weights — no more than 2 independent tweens with the same ease in a scene.
8
+ - **Don't use the same speed on everything.** You default to 0.4-0.5s for everything. The slowest scene should be 3× slower than the fastest. Vary duration deliberately.
9
+ - **Don't enter everything from the same direction.** You default to `y: 30, opacity: 0` on every element. Vary: from left, from right, from scale, opacity-only, letter-spacing.
10
+ - **Don't use the same stagger on every scene.** Each scene needs its own rhythm.
11
+ - **Don't use ambient zoom on every scene.** Pick different ambient motion per scene: slow pan, subtle rotation, scale push, color shift, or nothing. Stillness after motion is powerful.
12
+ - **Don't start at t=0.** Offset the first animation 0.1-0.3s. Zero-delay feels like a jump cut.
13
+
14
+ ## What You Don't Do Without Being Told
15
+
16
+ ### Easing is emotion, not technique
17
+
18
+ The transition is the verb. The easing is the adverb. A slide-in with `expo.out` = confident. With `sine.inOut` = dreamy. With `elastic.out` = playful. Same motion, different meaning. Choose the adverb deliberately.
19
+
20
+ **Direction rules — these are not optional:**
21
+
22
+ - `.out` for elements entering. Starts fast, decelerates. Feels responsive. This is your default.
23
+ - `.in` for elements leaving. Starts slow, accelerates away. Throws them off.
24
+ - `.inOut` for elements moving between positions.
25
+
26
+ You get this backwards constantly. Ease-in for entrances feels sluggish. Ease-out for exits feels reluctant.
27
+
28
+ ### Speed communicates weight
29
+
30
+ - Fast (0.15-0.3s) — energy, urgency, confidence
31
+ - Medium (0.3-0.5s) — professional, most content
32
+ - Slow (0.5-0.8s) — gravity, luxury, contemplation
33
+ - Very slow (0.8-2.0s) — cinematic, emotional, atmospheric
34
+
35
+ ### Scene structure: build / breathe / resolve
36
+
37
+ Every scene has three phases. You dump everything in the build and leave nothing for breathe or resolve.
38
+
39
+ - **Build (0-30%)** — elements enter, staggered. Don't dump everything at once.
40
+ - **Breathe (30-70%)** — content visible, alive with ONE ambient motion.
41
+ - **Resolve (70-100%)** — exit or decisive end. Exits are faster than entrances.
42
+
43
+ ### Transitions are meaning
44
+
45
+ - **Crossfade** = "this continues"
46
+ - **Hard cut** = "wake up" / disruption
47
+ - **Slow dissolve** = "drift with me"
48
+
49
+ You crossfade everything. Use hard cuts for disruption and register shifts.
50
+
51
+ ### Choreography is hierarchy
52
+
53
+ The element that moves first is perceived as most important. Stagger in order of importance, not DOM order. Don't wait for completion — overlap entries. Total stagger sequence under 500ms regardless of item count.
54
+
55
+ ### Asymmetry
56
+
57
+ Entrances need longer than exits. A card takes 0.4s to appear but 0.25s to disappear.
58
+
59
+ ## Visual Composition
60
+
61
+ You build for the web. Video frames are not pages.
62
+
63
+ - **Two focal points minimum per scene.** The eye needs somewhere to travel. Never a single text block floating in empty space.
64
+ - **Fill the frame.** Hero text: 60-80% of width. You will try to use web-sized elements. Don't.
65
+ - **Three layers minimum per scene.** Background treatment (glow, oversized faded type, color panel). Foreground content. Accent elements (dividers, labels, data bars).
66
+ - **Background is not empty.** Radial glows, oversized faded type bleeding off-frame, subtle border panels, hairline rules. Pure solid #000 reads as "nothing loaded."
67
+ - **Anchor to edges.** Pin content to left/top or right/bottom. Centered-and-floating is a web pattern.
68
+ - **Split frames.** Data panel on the left, content on the right. Top bar with metadata, full-width below. Zone-based layouts, not centered stacks.
69
+ - **Use structural elements.** Rules, dividers, border panels. They create paths for the eye and animate well (scaleX from 0).
@@ -0,0 +1,151 @@
1
+ # Transcript Guide
2
+
3
+ ## How Transcripts Are Generated
4
+
5
+ `hyperframes transcribe` handles both transcription and format conversion:
6
+
7
+ ```bash
8
+ # Transcribe audio/video (uses whisper.cpp locally, no API key needed)
9
+ npx hyperframes transcribe audio.mp3
10
+
11
+ # Use a larger model for better accuracy
12
+ npx hyperframes transcribe audio.mp3 --model medium.en
13
+
14
+ # Filter to English only (skips non-English speech)
15
+ npx hyperframes transcribe audio.mp3 --language en
16
+
17
+ # Import an existing transcript from another tool
18
+ npx hyperframes transcribe captions.srt
19
+ npx hyperframes transcribe captions.vtt
20
+ npx hyperframes transcribe openai-response.json
21
+ ```
22
+
23
+ ## Supported Input Formats
24
+
25
+ The CLI auto-detects and normalizes these formats:
26
+
27
+ | Format | Extension | Source | Word-level? |
28
+ | --------------------- | --------- | --------------------------------------------------------------------------- | ----------------- |
29
+ | whisper.cpp JSON | `.json` | `hyperframes init --video`, `hyperframes transcribe` | Yes |
30
+ | OpenAI Whisper API | `.json` | `openai.audio.transcriptions.create({ timestamp_granularities: ["word"] })` | Yes |
31
+ | SRT subtitles | `.srt` | Video editors, subtitle tools, YouTube | No (phrase-level) |
32
+ | VTT subtitles | `.vtt` | Web players, YouTube, transcription services | No (phrase-level) |
33
+ | Normalized word array | `.json` | Pre-processed by any tool | Yes |
34
+
35
+ **Word-level timestamps produce better captions.** SRT/VTT give phrase-level timing, which works but can't do per-word animation effects.
36
+
37
+ ## Whisper Model Guide
38
+
39
+ The default model (`small.en`) balances accuracy and speed. For better results, use a larger model:
40
+
41
+ | Model | Size | Speed | Accuracy | When to use |
42
+ | ---------- | ------ | -------- | --------- | ------------------------------------- |
43
+ | `tiny` | 75 MB | Fastest | Low | Quick previews, testing pipeline |
44
+ | `base` | 142 MB | Fast | Fair | Short clips, clear audio |
45
+ | `small` | 466 MB | Moderate | Good | **Default** — good for most content |
46
+ | `medium` | 1.5 GB | Slow | Very good | Important content, noisy audio, music |
47
+ | `large-v3` | 3.1 GB | Slowest | Best | Production quality |
48
+
49
+ **Only add `.en` suffix when the user explicitly says the audio is English.** `.en` models are slightly more accurate for English but will TRANSLATE non-English audio instead of transcribing it.
50
+
51
+ **Critical: `.en` models translate non-English audio into English** — they don't transcribe it. If the audio might not be English, always use a model without the `.en` suffix and pass `--language` to specify the source language. If you're unsure of the language, use `small` (not `small.en`) without `--language` — whisper will auto-detect.
52
+
53
+ ```bash
54
+ # Spanish audio
55
+ npx hyperframes transcribe audio.mp3 --model small --language es
56
+
57
+ # Unknown language — let whisper auto-detect
58
+ npx hyperframes transcribe audio.mp3 --model small
59
+ ```
60
+
61
+ **Music and vocals over instrumentation**: `small.en` will misidentify lyrics — use `medium.en` as the minimum, or import lyrics manually. Even `medium.en` struggles with heavily produced tracks; for music videos, providing known lyrics as an SRT/VTT and importing with `hyperframes transcribe lyrics.srt` will always beat automated transcription.
62
+
63
+ ## Transcript Quality Check (Mandatory)
64
+
65
+ After every transcription, **read the transcript and check for quality issues before proceeding.** Bad transcripts produce nonsensical captions. Never skip this step.
66
+
67
+ ### What to look for
68
+
69
+ | Signal | Example | Cause |
70
+ | ---------------------------- | -------------------------------------- | ---------------------------------------------------------------------------- |
71
+ | Music note tokens (`♪`, `�`) | `{ "text": "♪" }` or `{ "text": "�" }` | Whisper detected music, not speech |
72
+ | Garbled / nonsense words | "Do a chin", "Get so gay", "huh" | Model misheard lyrics or background noise |
73
+ | Long gaps with no words | 20+ seconds of only `♪` tokens | Instrumental section — expected, but high ratio means speech is being missed |
74
+ | Repeated filler | Many "huh", "uh", "oh" entries | Model is hallucinating on music |
75
+ | Very short word spans | Words with `end - start < 0.05` | Unreliable timestamp alignment |
76
+
77
+ ### Automatic retry rules
78
+
79
+ **If more than 20% of entries are `♪`/`�` tokens, or the transcript contains obvious nonsense words, the transcription failed.** Do not proceed with the bad transcript. Instead:
80
+
81
+ 1. **Retry with `medium.en`** if the original used `small.en` or smaller:
82
+ ```bash
83
+ npx hyperframes transcribe audio.mp3 --model medium.en
84
+ ```
85
+ 2. **If `medium.en` also fails** (still >20% music tokens or garbled), tell the user the audio is too noisy for local transcription and suggest:
86
+ - Providing lyrics manually as an SRT/VTT file
87
+ - Using an external API (OpenAI or Groq Whisper — see below)
88
+ 3. **Always clean the transcript** before building captions — filter out `♪`/`�` tokens and entries where `text` is a single non-word character. Only real words should reach the caption composition.
89
+
90
+ ### Cleaning a transcript
91
+
92
+ After transcription (even with a good model), strip non-word entries:
93
+
94
+ ```js
95
+ var raw = JSON.parse(transcriptJson);
96
+ var words = raw.filter(function (w) {
97
+ if (!w.text || w.text.trim().length === 0) return false;
98
+ if (/^[♪�\u266a\u266b\u266c\u266d\u266e\u266f]+$/.test(w.text)) return false;
99
+ if (/^(huh|uh|um|ah|oh)$/i.test(w.text) && w.end - w.start < 0.1) return false;
100
+ return true;
101
+ });
102
+ ```
103
+
104
+ ### When to use which model (decision tree)
105
+
106
+ 1. **Is this speech over silence/light background?** → `small.en` is fine
107
+ 2. **Is this speech over music, or music with vocals?** → Start with `medium.en`
108
+ 3. **Is this a produced music track (vocals + full instrumentation)?** → Start with `medium.en`, expect to need manual lyrics or an external API
109
+ 4. **Is this multilingual?** → Use `medium` or `large-v3` (no `.en` suffix)
110
+
111
+ ## Using External Transcription APIs
112
+
113
+ For the best accuracy, use an external API and import the result:
114
+
115
+ **OpenAI Whisper API** (recommended for quality):
116
+
117
+ ```bash
118
+ # Generate with word timestamps, then import
119
+ curl https://api.openai.com/v1/audio/transcriptions \
120
+ -H "Authorization: Bearer $OPENAI_API_KEY" \
121
+ -F file=@audio.mp3 -F model=whisper-1 \
122
+ -F response_format=verbose_json \
123
+ -F "timestamp_granularities[]=word" \
124
+ -o transcript-openai.json
125
+
126
+ npx hyperframes transcribe transcript-openai.json
127
+ ```
128
+
129
+ **Groq Whisper API** (fast, free tier available):
130
+
131
+ ```bash
132
+ curl https://api.groq.com/openai/v1/audio/transcriptions \
133
+ -H "Authorization: Bearer $GROQ_API_KEY" \
134
+ -F file=@audio.mp3 -F model=whisper-large-v3 \
135
+ -F response_format=verbose_json \
136
+ -F "timestamp_granularities[]=word" \
137
+ -o transcript-groq.json
138
+
139
+ npx hyperframes transcribe transcript-groq.json
140
+ ```
141
+
142
+ ## If No Transcript Exists
143
+
144
+ 1. Check the project root for `transcript.json`, `.srt`, or `.vtt` files
145
+ 2. If none found, run transcription — pick the starting model based on the content type:
146
+ - Speech/voiceover → `small.en`
147
+ - Music with vocals → `medium.en`
148
+ ```bash
149
+ npx hyperframes transcribe <audio-or-video-file> --model medium.en
150
+ ```
151
+ 3. **Read the transcript and run the quality check** (see above). If it fails, retry with a larger model or suggest manual lyrics.
@@ -0,0 +1,117 @@
1
+ # Transition Catalog
2
+
3
+ Hard rules, scene template, and routing to implementation code. Read the reference file for the transition type you need — don't load all of them.
4
+
5
+ ## Hard Rules (CSS)
6
+
7
+ These cause real bugs if violated.
8
+
9
+ **Scene visibility:** Scene 1 visible by default (no `opacity: 0`). Scenes 2+ have `opacity: 0` on the CONTAINER div. GSAP reveals them. No visibility shim (`timedEls`).
10
+
11
+ **Fonts:** Just write the `font-family` you want — the compiler embeds supported fonts automatically via `@font-face` with inline data URIs. No need for `<link>` tags or `@import`. Works in all contexts including sandboxed iframes.
12
+
13
+ **Element structure:** No `class="clip"` on scene divs in standalone compositions. Only the root div gets `data-composition-id`/`data-start`/`data-duration`.
14
+
15
+ **Overlay elements:** Staggered blocks = full-screen 1920x1080, NOT thin strips. Glitch RGB overlays = normal blending at 35% opacity, NOT `mix-blend-mode: multiply` (invisible on dark backgrounds). Light leak overlays = larger than the frame (2400px+), never a visible shape. Overexposure = use `filter: brightness()` on the scene, not just a white overlay.
16
+
17
+ **VHS tape:** Clone actual scene content with `cloneNode(true)`, NOT colored bars. Each strip: wider than frame (2020px at left:-50px). Red+blue chromatic copies at z-index above main strip. Seeded PRNG for deterministic random offsets.
18
+
19
+ **Z-index:** Gravity drop, zoom out, diagonal split need outgoing scene ON TOP (`zIndex: 10`) so it exits while revealing the new scene behind (`zIndex: 1`).
20
+
21
+ **Page burn:** Content burns with the page — no falling debris. Hide scene1 via `tl.set` at burn end, NEVER `onComplete` (not reversible). `onUpdate` must restore `clipPath: "none"` when `wp <= 0` for rewind support. Incoming scene fades from black at 90% through burn.
22
+
23
+ **Clock wipe:** 9-point polygon with intermediate edge positions. Step through 4 quadrants with separate tweens.
24
+
25
+ **Grid dissolve:** Cycle 5 palette colors per cell, not monochrome.
26
+
27
+ **Blinds count by energy:** Calm: 4h/6v. Medium: 6-8h/8v. High: 12-16h/16v.
28
+
29
+ **Don't use:** Star iris (polygon interpolation broken), tilt-shift (no selective CSS blur), lens flare (visible shape, not optical), hinge/door (distorts too fast).
30
+
31
+ ## Shader Transitions
32
+
33
+ Shader setup, WebGL init, capture, and fragment shaders are handled by `@hyperframes/shader-transitions` (`packages/shader-transitions/`). Read the package source for API details. Compositions using shaders must follow the CSS rules in [transitions.md](../transitions.md) § "Shader-Compatible CSS Rules".
34
+
35
+ ## Scene Template
36
+
37
+ ```html
38
+ <!DOCTYPE html>
39
+ <html lang="en">
40
+ <head>
41
+ <meta charset="UTF-8" />
42
+ <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
43
+ <style>
44
+ body {
45
+ margin: 0;
46
+ width: 1920px;
47
+ height: 1080px;
48
+ overflow: hidden;
49
+ background: #000;
50
+ font-family: "YOUR FONT", sans-serif; /* compiler embeds supported fonts automatically */
51
+ }
52
+ .scene {
53
+ position: absolute;
54
+ top: 0;
55
+ left: 0;
56
+ width: 1920px;
57
+ height: 1080px;
58
+ overflow: hidden;
59
+ }
60
+ #scene1 {
61
+ z-index: 1;
62
+ background: #color;
63
+ }
64
+ #scene2 {
65
+ z-index: 2;
66
+ background: #color;
67
+ opacity: 0;
68
+ }
69
+ </style>
70
+ </head>
71
+ <body>
72
+ <div
73
+ id="root"
74
+ data-composition-id="main"
75
+ data-width="1920"
76
+ data-height="1080"
77
+ data-start="0"
78
+ data-duration="TOTAL"
79
+ >
80
+ <div id="scene1" class="scene"><!-- visible --></div>
81
+ <div id="scene2" class="scene"><!-- hidden --></div>
82
+ </div>
83
+ <script>
84
+ window.__timelines = window.__timelines || {};
85
+ var tl = gsap.timeline({ paused: true });
86
+ // Transition code here
87
+ window.__timelines["main"] = tl;
88
+ </script>
89
+ </body>
90
+ </html>
91
+ ```
92
+
93
+ Every transition follows: position new scene → animate outgoing → swap → animate incoming → clean up overlays.
94
+
95
+ ## CSS Transitions
96
+
97
+ All code examples use `old` for the outgoing scene-inner selector and `new` for the incoming, with `T` as the transition start time. Read the reference file for the type you need.
98
+
99
+ | Type | Transitions | Reference |
100
+ | -------------- | ---------------------------------------------------- | ------------------------------------------ |
101
+ | Push | Push slide, vertical push, elastic push, squeeze | [css-push.md](./css-push.md) |
102
+ | Radial / Shape | Circle iris, diamond iris, diagonal split | [css-radial.md](./css-radial.md) |
103
+ | 3D | 3D card flip | [css-3d.md](./css-3d.md) |
104
+ | Scale / Zoom | Zoom through, zoom out | [css-scale.md](./css-scale.md) |
105
+ | Dissolve | Crossfade, blur crossfade, focus pull, color dip | [css-dissolve.md](./css-dissolve.md) |
106
+ | Cover | Staggered blocks, horizontal blinds, vertical blinds | [css-cover.md](./css-cover.md) |
107
+ | Light | Light leak, overexposure burn, film burn | [css-light.md](./css-light.md) |
108
+ | Distortion | Glitch, chromatic aberration, ripple, VHS tape | [css-distortion.md](./css-distortion.md) |
109
+ | Mechanical | Shutter, clock wipe | [css-mechanical.md](./css-mechanical.md) |
110
+ | Grid | Grid dissolve | [css-grid.md](./css-grid.md) |
111
+ | Other | Gravity drop, morph circle | [css-other.md](./css-other.md) |
112
+ | Blur | Blur through, directional blur | [css-blur.md](./css-blur.md) |
113
+ | Destruction | Page burn | [css-destruction.md](./css-destruction.md) |
114
+
115
+ ## Shader Transitions
116
+
117
+ WebGL shader transitions are provided by `@hyperframes/shader-transitions` (`packages/shader-transitions/`). The package handles setup, capture, WebGL init, render loop, and GSAP integration. Read the package source for available shaders and API — do not copy raw GLSL manually.
@@ -0,0 +1,12 @@
1
+ ## 3D
2
+
3
+ ### 3D Card Flip
4
+
5
+ 180° Y-axis rotation. Requires CSS: `backface-visibility: hidden; transform-style: preserve-3d;` on both scene-inners. Parent needs `perspective: 1200px`.
6
+
7
+ ```js
8
+ tl.set(new, { rotationY: -180, opacity: 1 }, T);
9
+ tl.to(old, { rotationY: 180, duration: 0.6, ease: "power2.inOut" }, T);
10
+ tl.to(new, { rotationY: 0, duration: 0.6, ease: "power2.inOut" }, T);
11
+ tl.set(old, { opacity: 0 }, T + 0.6);
12
+ ```
@@ -0,0 +1,51 @@
1
+ ## Blur
2
+
3
+ All blur transitions scale with energy. See SKILL.md "Blur Intensity by Energy" for the full table.
4
+
5
+ ### Blur Through
6
+
7
+ Content becomes fully abstract before resolving. The heaviest blur transition.
8
+
9
+ **Calm (default for this type — it's inherently heavy):**
10
+
11
+ ```js
12
+ tl.to(old, { filter: "blur(30px)", scale: 1.08, duration: 0.5, ease: "power1.in" }, T);
13
+ tl.to(old, { opacity: 0, duration: 0.3, ease: "power1.in" }, T + 0.3);
14
+ // Hold: both scenes in abstract blur state
15
+ tl.fromTo(new,
16
+ { filter: "blur(30px)", scale: 0.92, opacity: 0 },
17
+ { filter: "blur(30px)", scale: 0.92, opacity: 1, duration: 0.2, ease: "none" }, T + 0.5);
18
+ // Slow resolve
19
+ tl.to(new, { filter: "blur(0px)", scale: 1, duration: 0.7, ease: "power1.out" }, T + 0.7);
20
+ ```
21
+
22
+ **Medium:**
23
+
24
+ ```js
25
+ tl.to(old, { filter: "blur(15px)", scale: 1.05, opacity: 0, duration: 0.4, ease: "power2.in" }, T);
26
+ tl.fromTo(new,
27
+ { filter: "blur(15px)", scale: 0.95, opacity: 0 },
28
+ { filter: "blur(0px)", scale: 1, opacity: 1, duration: 0.4, ease: "power2.out" }, T + 0.2);
29
+ ```
30
+
31
+ ### Directional Blur
32
+
33
+ Blur + skew simulating motion in one direction. Scale blur and skew with energy.
34
+
35
+ **Medium (default):**
36
+
37
+ ```js
38
+ tl.to(old, { filter: "blur(12px)", skewX: -8, x: -200, opacity: 0, duration: 0.4, ease: "power3.in" }, T);
39
+ tl.fromTo(new,
40
+ { filter: "blur(12px)", skewX: 8, x: 200, opacity: 0 },
41
+ { filter: "blur(0px)", skewX: 0, x: 0, opacity: 1, duration: 0.4, ease: "power3.out" }, T + 0.15);
42
+ ```
43
+
44
+ **Calm (heavier blur, gentler motion):**
45
+
46
+ ```js
47
+ tl.to(old, { filter: "blur(20px)", skewX: -4, x: -100, opacity: 0, duration: 0.6, ease: "power1.in" }, T);
48
+ tl.fromTo(new,
49
+ { filter: "blur(20px)", skewX: 4, x: 100, opacity: 0 },
50
+ { filter: "blur(0px)", skewX: 0, x: 0, opacity: 1, duration: 0.6, ease: "power1.out" }, T + 0.3);
51
+ ```
@@ -0,0 +1,43 @@
1
+ ## Cover
2
+
3
+ ### Staggered Color Blocks
4
+
5
+ Full-screen (1920x1080) colored divs slide across staggered. Scene swaps while covered.
6
+
7
+ **2-block** (standard):
8
+
9
+ ```js
10
+ tl.set("#wipe-a", { x: -1920 }, T - 0.01);
11
+ tl.set("#wipe-b", { x: -1920 }, T - 0.01);
12
+ tl.to("#wipe-a", { x: 0, duration: 0.25, ease: "power3.inOut" }, T);
13
+ tl.to("#wipe-b", { x: 0, duration: 0.25, ease: "power3.inOut" }, T + 0.06);
14
+ tl.set(old, { opacity: 0 }, T + 0.2);
15
+ tl.set(new, { opacity: 1 }, T + 0.2);
16
+ tl.to("#wipe-a", { x: 1920, duration: 0.25, ease: "power3.inOut" }, T + 0.28);
17
+ tl.to("#wipe-b", { x: 1920, duration: 0.25, ease: "power3.inOut" }, T + 0.34);
18
+ ```
19
+
20
+ **5-block** (dense variant): same pattern with 5 blocks at 0.04s stagger. Use composition palette colors.
21
+
22
+ ### Horizontal Blinds
23
+
24
+ Full-width strips slide across staggered. Each strip: `width: 1920px; height: Xpx`.
25
+
26
+ **6 strips** (180px each): `0.03s` stagger
27
+ **12 strips** (90px each): `0.018s` stagger
28
+
29
+ ```js
30
+ for (var i = 0; i < N; i++) {
31
+ tl.set("#blind-h-" + i, { x: -1920 }, T - 0.01);
32
+ tl.fromTo("#blind-h-" + i, { x: -1920 }, { x: 0, duration: 0.2, ease: "power3.inOut" }, T + i * stagger);
33
+ }
34
+ tl.set(old, { opacity: 0 }, T + coverTime);
35
+ tl.set(new, { opacity: 1 }, T + coverTime);
36
+ for (var i = 0; i < N; i++) {
37
+ tl.to("#blind-h-" + i, { x: 1920, duration: 0.2, ease: "power3.inOut" }, T + exitStart + i * stagger);
38
+ }
39
+ ```
40
+
41
+ ### Vertical Blinds
42
+
43
+ Same as horizontal but strips are tall and narrow, moving on Y axis.
@@ -0,0 +1,95 @@
1
+ ## Destruction
2
+
3
+ ### Page Burn
4
+
5
+ The outgoing scene literally burns away from a corner. A fire front expands with noise-based irregular edges, a canvas draws the scorched char line at the burn boundary, and individual text characters/elements chip off and fall with gravity as the fire reaches them. The incoming scene reveals behind the burn.
6
+
7
+ This transition has three systems working together:
8
+
9
+ 1. **Fire geometry** — a radial front expanding from a corner (e.g., bottom-right) with noise-based irregularity for organic edges
10
+ 2. **Scene clipping** — the outgoing scene uses an SVG clip-path (with `fill-rule: evenodd`) that cuts a hole matching the fire front. As the fire expands, more of the scene is clipped away. All content (text, images, lines) burns with the page — no separate debris.
11
+ 3. **Scorched edge** — a `<canvas>` overlay draws a radial gradient fringe at the fire boundary to simulate charring
12
+
13
+ **When to use:** Dramatic reveals, edgy/destructive mood, gaming, cyberpunk. This is the most dramatic transition in the catalog — reserve it for hero moments.
14
+
15
+ **Requirements:**
16
+
17
+ - A `<canvas>` element for the burn edge overlay
18
+ - A noise function for organic fire edge geometry
19
+ - SVG clip-path with evenodd fill-rule for the inverted clip
20
+
21
+ **Fire geometry (deterministic noise):**
22
+
23
+ ```js
24
+ function noise(x) {
25
+ var ix = Math.floor(x),
26
+ fx = x - ix;
27
+ var a = Math.sin(ix * 127.1 + 311.7) * 43758.5453;
28
+ var b = Math.sin((ix + 1) * 127.1 + 311.7) * 43758.5453;
29
+ var t = fx * fx * (3 - 2 * fx);
30
+ return a - Math.floor(a) + (b - Math.floor(b) - (a - Math.floor(a))) * t;
31
+ }
32
+
33
+ function fireRadiusAtAngle(angle, progress) {
34
+ var base = progress * maxRadius;
35
+ return (
36
+ base +
37
+ noise(angle * 3 + progress * 4) * 50 +
38
+ noise(angle * 8 + progress * 9) * 20 +
39
+ noise(angle * 15 + progress * 15) * 8
40
+ );
41
+ }
42
+ ```
43
+
44
+ **Incoming scene timing:** The incoming scene should NOT be visible during the burn. As the fire consumes the outgoing scene, **black shows through the holes** — this is the dramatic part. The viewer watches content being destroyed against blackness.
45
+
46
+ At ~90% through the burn, the incoming scene fades in SLOWLY from black — the background first, then content staggered. Use long, gentle fades (`power1.out`, 0.8-1.2s durations) so it feels like the new scene materializes from darkness, not a hard swap.
47
+
48
+ ```js
49
+ // Scene 2 stays at opacity: 0 during the burn — black behind the fire
50
+ tl.set("#s2-title", { opacity: 0 }, T);
51
+ tl.set("#s2-subtitle", { opacity: 0 }, T);
52
+
53
+ // At 90% through, scene bg fades in slowly from black
54
+ var contentReveal = T + BURN_DURATION * 0.9;
55
+ tl.to("#scene2", { opacity: 1, duration: 1.2, ease: "power1.out" }, contentReveal);
56
+
57
+ // Content fades in staggered on top, even slower
58
+ tl.to("#s2-title", { opacity: 1, duration: 1.0, ease: "power1.out" }, contentReveal + 0.5);
59
+ tl.to("#s2-subtitle", { opacity: 1, duration: 0.8, ease: "power1.out" }, contentReveal + 0.7);
60
+ ```
61
+
62
+ **Content burns with the page — no falling debris.** The clip-path on scene1 IS the effect — as the fire shape expands, everything behind the fire edge (text, images, lines) disappears naturally. Don't clone elements, don't create falling debris. The content is part of the page being consumed. The scorched canvas edge provides the visual char line at the burn boundary.
63
+
64
+ **Hide scene1 via `tl.set` at burn end — NEVER in `onComplete`.** Using `onComplete` to hide scene1 is not reversible when scrubbing. Instead, use a `tl.set` at the exact burn end time:
65
+
66
+ ```js
67
+ tl.to(
68
+ burnState,
69
+ {
70
+ progress: 1,
71
+ duration: BURN_DURATION,
72
+ ease: "none",
73
+ onUpdate: function () {
74
+ var wp = burnState.progress;
75
+ var scene1 = document.getElementById("scene1");
76
+ if (wp <= 0) {
77
+ scene1.style.clipPath = "none"; // fully visible when rewound
78
+ } else if (wp < 1) {
79
+ scene1.style.clipPath = buildClipPath(wp);
80
+ }
81
+ drawEdge(wp);
82
+ },
83
+ // NO onComplete — use tl.set instead
84
+ },
85
+ T,
86
+ );
87
+
88
+ // Hide scene1 at exact burn end — reversible via timeline
89
+ tl.set("#scene1", { opacity: 0 }, T + BURN_DURATION);
90
+ tl.set("#scene1", { clipPath: "none" }, T + BURN_DURATION);
91
+ ```
92
+
93
+ The `onUpdate` handles clip-path and canvas edge per-frame. The `tl.set` handles the final hide — and GSAP automatically reverses it when scrubbing backward, restoring scene1 to `opacity: 1`.
94
+
95
+ The `onUpdate` callback is the key — it runs every frame to advance the clip-path and canvas edge in sync with the timeline.