hyperframes 0.3.0 → 0.3.1

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 (33) hide show
  1. package/dist/cli.js +7152 -6407
  2. package/dist/docs/{templates.md → examples.md} +2 -2
  3. package/dist/skills/gsap/SKILL.md +5 -16
  4. package/dist/skills/gsap/references/effects.md +7 -14
  5. package/dist/skills/hyperframes/SKILL.md +124 -43
  6. package/dist/skills/hyperframes/house-style.md +34 -93
  7. package/dist/skills/hyperframes/references/captions.md +2 -2
  8. package/dist/skills/hyperframes/references/css-patterns.md +36 -34
  9. package/dist/skills/hyperframes/references/transitions/catalog.md +4 -19
  10. package/dist/skills/hyperframes/references/transitions/css-other.md +0 -11
  11. package/dist/skills/hyperframes/references/transitions.md +53 -37
  12. package/dist/skills/hyperframes/references/{fonts.md → typography.md} +73 -32
  13. package/dist/skills/hyperframes/scripts/animation-map.mjs +596 -0
  14. package/dist/skills/hyperframes/scripts/contrast-report.mjs +335 -0
  15. package/dist/skills/hyperframes-cli/SKILL.md +1 -1
  16. package/dist/studio/assets/hyperframes-player-eEkqo7g7.js +198 -0
  17. package/dist/studio/assets/index-DZEa45DQ.css +1 -0
  18. package/dist/studio/assets/{index-QlToZFln.js → index-Pn53dCTs.js} +21 -21
  19. package/dist/studio/index.html +2 -2
  20. package/dist/templates/_shared/AGENTS.md +59 -0
  21. package/dist/templates/_shared/CLAUDE.md +7 -7
  22. package/package.json +1 -1
  23. package/dist/skills/gsap/references/frameworks.md +0 -56
  24. package/dist/skills/gsap/references/plugins.md +0 -194
  25. package/dist/skills/gsap/references/react.md +0 -80
  26. package/dist/skills/gsap/references/scrolltrigger.md +0 -147
  27. package/dist/skills/gsap/references/utils.md +0 -91
  28. package/dist/skills/hyperframes/references/examples.md +0 -146
  29. package/dist/skills/hyperframes/references/marker-highlight.md +0 -158
  30. package/dist/skills/hyperframes/references/transitions/shader-setup.md +0 -463
  31. package/dist/skills/hyperframes/references/transitions/shader-transitions.md +0 -329
  32. package/dist/studio/assets/hyperframes-player-Ba4c3ztZ.js +0 -198
  33. package/dist/studio/assets/index-DHr9yo58.css +0 -1
@@ -15,16 +15,16 @@ Pure CSS + GSAP implementations of all five MarkerHighlight.js drawing modes. Us
15
15
  Yellow marker sweep behind text. The most common mode.
16
16
 
17
17
  ```html
18
- <div class="mh-highlight-wrap">
19
- <div class="mh-highlight-bar" id="hl-1"></div>
18
+ <span class="mh-highlight-wrap">
19
+ <span class="mh-highlight-bar" id="hl-1"></span>
20
20
  <span class="mh-highlight-text">highlighted text</span>
21
- </div>
21
+ </span>
22
22
  ```
23
23
 
24
24
  ```css
25
25
  .mh-highlight-wrap {
26
26
  position: relative;
27
- display: inline-block;
27
+ display: inline;
28
28
  }
29
29
  .mh-highlight-bar {
30
30
  position: absolute;
@@ -75,16 +75,16 @@ tl.to(
75
75
  Hand-drawn circle around text. Use `border-radius: 50%` with a slight rotation for organic feel.
76
76
 
77
77
  ```html
78
- <div class="mh-circle-wrap">
78
+ <span class="mh-circle-wrap">
79
79
  <span class="mh-circle-text" id="circle-word">IMPORTANT</span>
80
- <div class="mh-circle-ring" id="circle-1"></div>
81
- </div>
80
+ <span class="mh-circle-ring" id="circle-1"></span>
81
+ </span>
82
82
  ```
83
83
 
84
84
  ```css
85
85
  .mh-circle-wrap {
86
86
  position: relative;
87
- display: inline-block;
87
+ display: inline;
88
88
  }
89
89
  .mh-circle-text {
90
90
  position: relative;
@@ -148,29 +148,29 @@ tl.to(
148
148
  Radiating lines from text center. Each line is a positioned div rotated to its angle.
149
149
 
150
150
  ```html
151
- <div class="mh-burst-wrap">
151
+ <span class="mh-burst-wrap">
152
152
  <span class="mh-burst-text">WOW</span>
153
- <div class="mh-burst-container" id="burst-1">
154
- <div class="mh-burst-line" style="--angle: 0deg; --len: 70px;"></div>
155
- <div class="mh-burst-line" style="--angle: 30deg; --len: 55px;"></div>
156
- <div class="mh-burst-line" style="--angle: 60deg; --len: 80px;"></div>
157
- <div class="mh-burst-line" style="--angle: 90deg; --len: 45px;"></div>
158
- <div class="mh-burst-line" style="--angle: 120deg; --len: 65px;"></div>
159
- <div class="mh-burst-line" style="--angle: 150deg; --len: 75px;"></div>
160
- <div class="mh-burst-line" style="--angle: 180deg; --len: 50px;"></div>
161
- <div class="mh-burst-line" style="--angle: 210deg; --len: 60px;"></div>
162
- <div class="mh-burst-line" style="--angle: 240deg; --len: 80px;"></div>
163
- <div class="mh-burst-line" style="--angle: 270deg; --len: 40px;"></div>
164
- <div class="mh-burst-line" style="--angle: 300deg; --len: 70px;"></div>
165
- <div class="mh-burst-line" style="--angle: 330deg; --len: 55px;"></div>
166
- </div>
167
- </div>
153
+ <span class="mh-burst-container" id="burst-1">
154
+ <span class="mh-burst-line" style="--angle: 0deg; --len: 70px;"></span>
155
+ <span class="mh-burst-line" style="--angle: 30deg; --len: 55px;"></span>
156
+ <span class="mh-burst-line" style="--angle: 60deg; --len: 80px;"></span>
157
+ <span class="mh-burst-line" style="--angle: 90deg; --len: 45px;"></span>
158
+ <span class="mh-burst-line" style="--angle: 120deg; --len: 65px;"></span>
159
+ <span class="mh-burst-line" style="--angle: 150deg; --len: 75px;"></span>
160
+ <span class="mh-burst-line" style="--angle: 180deg; --len: 50px;"></span>
161
+ <span class="mh-burst-line" style="--angle: 210deg; --len: 60px;"></span>
162
+ <span class="mh-burst-line" style="--angle: 240deg; --len: 80px;"></span>
163
+ <span class="mh-burst-line" style="--angle: 270deg; --len: 40px;"></span>
164
+ <span class="mh-burst-line" style="--angle: 300deg; --len: 70px;"></span>
165
+ <span class="mh-burst-line" style="--angle: 330deg; --len: 55px;"></span>
166
+ </span>
167
+ </span>
168
168
  ```
169
169
 
170
170
  ```css
171
171
  .mh-burst-wrap {
172
172
  position: relative;
173
- display: inline-block;
173
+ display: inline;
174
174
  }
175
175
  .mh-burst-text {
176
176
  position: relative;
@@ -186,6 +186,7 @@ Radiating lines from text center. Each line is a positioned div rotated to its a
186
186
  }
187
187
  .mh-burst-line {
188
188
  position: absolute;
189
+ display: block;
189
190
  width: 3px;
190
191
  height: var(--len);
191
192
  background: #1e88e5;
@@ -214,7 +215,7 @@ tl.fromTo(
214
215
  Wavy SVG underlines and strikethroughs that draw themselves via `stroke-dashoffset`.
215
216
 
216
217
  ```html
217
- <div class="mh-scribble-wrap">
218
+ <span class="mh-scribble-wrap">
218
219
  <span class="mh-scribble-text">underlined text</span>
219
220
  <svg class="mh-scribble-svg" viewBox="0 0 500 24" preserveAspectRatio="none">
220
221
  <path
@@ -232,7 +233,7 @@ Wavy SVG underlines and strikethroughs that draw themselves via `stroke-dashoffs
232
233
  ```css
233
234
  .mh-scribble-wrap {
234
235
  position: relative;
235
- display: inline-block;
236
+ display: inline;
236
237
  }
237
238
  .mh-scribble-text {
238
239
  position: relative;
@@ -283,19 +284,19 @@ Scale the path's viewBox width to match text width. The wave pattern `Q x1,y1 x2
283
284
  Cross-hatch lines over de-emphasized text. Multiple angled lines create a "crossed out" effect.
284
285
 
285
286
  ```html
286
- <div class="mh-sketchout-wrap">
287
+ <span class="mh-sketchout-wrap">
287
288
  <span class="mh-sketchout-text">old price</span>
288
- <div class="mh-sketchout-lines" id="sketchout-1">
289
- <div class="mh-sketchout-line mh-sketchout-fwd"></div>
290
- <div class="mh-sketchout-line mh-sketchout-bwd"></div>
291
- </div>
292
- </div>
289
+ <span class="mh-sketchout-lines" id="sketchout-1">
290
+ <span class="mh-sketchout-line mh-sketchout-fwd"></span>
291
+ <span class="mh-sketchout-line mh-sketchout-bwd"></span>
292
+ </span>
293
+ </span>
293
294
  ```
294
295
 
295
296
  ```css
296
297
  .mh-sketchout-wrap {
297
298
  position: relative;
298
- display: inline-block;
299
+ display: inline;
299
300
  }
300
301
  .mh-sketchout-text {
301
302
  position: relative;
@@ -312,6 +313,7 @@ Cross-hatch lines over de-emphasized text. Multiple angled lines create a "cross
312
313
  }
313
314
  .mh-sketchout-line {
314
315
  position: absolute;
316
+ display: block;
315
317
  top: 50%;
316
318
  left: 0;
317
319
  width: 100%;
@@ -28,19 +28,9 @@ These cause real bugs if violated.
28
28
 
29
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
30
 
31
- ## Hard Rules (Shader)
32
-
33
- Read [shader-setup.md](./shader-setup.md) for the full setup code these rules apply to.
34
-
35
- **WebGL setup:** `gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false)` — NOT true. Vertex shader flips Y: `v_uv.y = 1.0 - v_uv.y`. `preserveDrawingBuffer: true` required for HyperFrames capture. No `fwidth()` without extension — use constant `0.003`.
36
-
37
- **Rendering model:** GL canvas stays visible entire composition — DOM scenes remain `opacity: 0`. Passthrough shader for holds. Scene capture = static snapshots at load; animated GSAP tweens on elements won't appear.
38
-
39
- **Scene capture:** Canvas `fillText` doesn't match CSS fonts exactly (known, not a bug). No CSS gradients or SVGs. Images and videos ARE supported via `ctx.drawImage()`. Video scenes re-capture every frame during transitions via `recaptureVideoScene()`.
40
-
41
- **Timeline:** Use `tl.call()` for begin/end — NOT `onStart`/`onComplete`. Each tween proxy `{p:0}` must be unique. Never boomerang (`u_progress*(1.-u_progress)*4.`). Morph both scenes.
31
+ ## Shader Transitions
42
32
 
43
- **Shader code:** One noise library per shader (NQ or ND, not both). Always `clamp(uv, 0., 1.)`.
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".
44
34
 
45
35
  ## Scene Template
46
36
 
@@ -118,15 +108,10 @@ All code examples use `old` for the outgoing scene-inner selector and `new` for
118
108
  | Distortion | Glitch, chromatic aberration, ripple, VHS tape | [css-distortion.md](./css-distortion.md) |
119
109
  | Mechanical | Shutter, clock wipe | [css-mechanical.md](./css-mechanical.md) |
120
110
  | Grid | Grid dissolve | [css-grid.md](./css-grid.md) |
121
- | Other | Flash cut, gravity drop, morph circle | [css-other.md](./css-other.md) |
111
+ | Other | Gravity drop, morph circle | [css-other.md](./css-other.md) |
122
112
  | Blur | Blur through, directional blur | [css-blur.md](./css-blur.md) |
123
113
  | Destruction | Page burn | [css-destruction.md](./css-destruction.md) |
124
114
 
125
115
  ## Shader Transitions
126
116
 
127
- WebGL fragment shaders that composite between scene textures per-pixel. Require setup boilerplate.
128
-
129
- | What | Reference |
130
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
131
- | Setup (canvas, capture, WebGL init, render loop, GSAP integration) | [shader-setup.md](./shader-setup.md) |
132
- | Fragment shaders (14 transitions: domain warp, ridged burn, whip pan, SDF iris, ripple waves, gravitational lens, cinematic zoom, chromatic split, glitch, swirl vortex, thermal distortion, flash through white, cross-warp morph, light leak) | [shader-transitions.md](./shader-transitions.md) |
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.
@@ -1,16 +1,5 @@
1
1
  ## Other
2
2
 
3
- ### Flash Cut
4
-
5
- White full-screen overlay flashes at swap point. 0.03s on, 0.1s off.
6
-
7
- ```js
8
- tl.to("#flash-overlay", { opacity: 1, duration: 0.03, ease: "power4.out" }, T);
9
- tl.set(old, { opacity: 0 }, T + 0.03);
10
- tl.set(new, { opacity: 1 }, T + 0.03);
11
- tl.to("#flash-overlay", { opacity: 0, duration: 0.1, ease: "power2.out" }, T + 0.05);
12
- ```
13
-
14
3
  ### Gravity Drop
15
4
 
16
5
  Old scene falls down with slight rotation. New scene was behind it. Needs z-index.
@@ -1,14 +1,23 @@
1
1
  # Scene Transitions
2
2
 
3
- A transition tells the viewer how two scenes relate. A crossfade says "this continues." A push slide says "next point." A flash cut says "wake up." A blur crossfade says "drift with me." Choose transitions that match what the content is doing emotionally, not just technically.
3
+ A transition tells the viewer how two scenes relate. A crossfade says "this continues." A push slide says "next point." A blur crossfade says "drift with me." Choose transitions that match what the content is doing emotionally, not just technically.
4
+
5
+ ## Animation Rules for Multi-Scene Compositions
6
+
7
+ These are non-negotiable for every multi-scene composition:
8
+
9
+ 1. **Every composition uses transitions.** No exceptions. Scenes without transitions feel like jump cuts.
10
+ 2. **Every scene uses entrance animations.** Elements animate IN via `gsap.from()` — opacity, position, scale, etc. No scene should pop fully-formed onto screen.
11
+ 3. **Exit animations are BANNED** except on the final scene. Do NOT use `gsap.to()` to animate elements out before a transition fires. The transition IS the exit. Outgoing scene content must be fully visible when the transition starts — the transition handles the visual handoff.
12
+ 4. **Final scene exception:** The last scene MAY fade elements out (e.g., fade to black at the end of the composition). This is the only scene where exit animations are allowed.
4
13
 
5
14
  ## Energy → Primary Transition
6
15
 
7
- | Energy | Primary | Accent for key moments | Duration | Easing |
8
- | ---------------------------------------- | ---------------------------- | ------------------------------ | --------- | ---------------------- |
9
- | **Calm** (wellness, brand story, luxury) | Blur crossfade, focus pull | Light leak, circle iris | 0.5-0.8s | `sine.inOut`, `power1` |
10
- | **Medium** (corporate, SaaS, explainer) | Push slide, staggered blocks | Squeeze, vertical push | 0.3-0.5s | `power2`, `power3` |
11
- | **High** (promos, sports, music, launch) | Flash cut, zoom through | Staggered blocks, gravity drop | 0.15-0.3s | `power4`, `expo` |
16
+ | Energy | CSS Primary | Shader Primary | Accent | Duration | Easing |
17
+ | ---------------------------------------- | ---------------------------- | ------------------------------------ | ------------------------------ | --------- | ---------------------- |
18
+ | **Calm** (wellness, brand story, luxury) | Blur crossfade, focus pull | Cross-warp morph, thermal distortion | Light leak, circle iris | 0.5-0.8s | `sine.inOut`, `power1` |
19
+ | **Medium** (corporate, SaaS, explainer) | Push slide, staggered blocks | Whip pan, cinematic zoom | Squeeze, vertical push | 0.3-0.5s | `power2`, `power3` |
20
+ | **High** (promos, sports, music, launch) | Zoom through, overexposure | Ridged burn, glitch, chromatic split | Staggered blocks, gravity drop | 0.15-0.3s | `power4`, `expo` |
12
21
 
13
22
  Pick ONE primary (60-70% of scene changes) + 1-2 accents. Never use a different transition for every scene.
14
23
 
@@ -16,17 +25,17 @@ Pick ONE primary (60-70% of scene changes) + 1-2 accents. Never use a different
16
25
 
17
26
  Think about what the transition _communicates_, not just what it looks like.
18
27
 
19
- | Mood | Transitions | Why it works |
20
- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
21
- | **Warm / inviting** | Light leak, blur crossfade, focus pull, film burn, light leak (shader), thermal distortion | Soft edges, warm color washes. Nothing sharp or mechanical. The transition feels like sunlight. |
22
- | **Cold / clinical** | Squeeze, zoom out, blinds, shutter, grid dissolve, gravitational lens | Content transforms mechanically — compressed, shrunk, sliced, gridded. Zoom out creates clinical distance. No softness. |
23
- | **Editorial / magazine** | Push slide, vertical push, diagonal split, shutter, whip pan | Like turning a page or slicing a layout. Clean directional movement. Whip pan is a fast editorial camera move. |
24
- | **Tech / futuristic** | Grid dissolve, staggered blocks, blinds, chromatic aberration, glitch (shader), chromatic split (shader) | Grid dissolve is the core "data" transition. Shader glitch adds posterization + scan lines. |
25
- | **Tense / edgy** | Glitch, VHS, chromatic aberration, flash cut, ripple, ridged burn, glitch (shader) | Instability, distortion, digital breakdown. Ridged burn adds sharp lightning-crack edges. |
26
- | **Playful / fun** | Elastic push, 3D flip, circle iris, morph circle, clock wipe, ripple waves, swirl vortex | Overshoot, bounce, rotation, expansion. Swirl vortex adds organic spiral distortion. |
27
- | **Dramatic / cinematic** | Zoom through, zoom out, gravity drop, overexposure, diagonal split, color dip to black, cinematic zoom (shader), gravitational lens, domain warp, flash through white | Scale, weight, light extremes. Shader transitions add per-pixel depth. |
28
- | **Premium / luxury** | Focus pull, blur crossfade, color dip to black, slow crossfade, cross-warp morph, thermal distortion | Restraint. Cross-warp morph flows both scenes into each other organically. |
29
- | **Retro / analog** | Film burn, light leak, VHS, clock wipe | Organic imperfection. Warm color bleeds, scan line displacement. Clock wipe evokes broadcast TV. |
28
+ | Mood | Transitions | Why it works |
29
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
30
+ | **Warm / inviting** | Light leak, blur crossfade, focus pull, film burn · **Shader:** thermal distortion, light leak, cross-warp morph | Soft edges, warm color washes. Nothing sharp or mechanical. |
31
+ | **Cold / clinical** | Squeeze, zoom out, blinds, shutter, grid dissolve · **Shader:** gravitational lens | Content transforms mechanically — compressed, shrunk, sliced, gridded. |
32
+ | **Editorial / magazine** | Push slide, vertical push, diagonal split, shutter · **Shader:** whip pan | Like turning a page or slicing a layout. Clean directional movement. |
33
+ | **Tech / futuristic** | Grid dissolve, staggered blocks, blinds, chromatic aberration · **Shader:** glitch, chromatic split | Grid dissolve is the core "data" transition. Shader glitch adds posterization + scan lines. |
34
+ | **Tense / edgy** | Glitch, VHS, chromatic aberration, ripple · **Shader:** ridged burn, glitch, domain warp | Instability, distortion, digital breakdown. Ridged burn adds sharp lightning-crack edges. |
35
+ | **Playful / fun** | Elastic push, 3D flip, circle iris, morph circle, clock wipe · **Shader:** ripple waves, swirl vortex | Overshoot, bounce, rotation, expansion. Swirl vortex adds organic spiral distortion. |
36
+ | **Dramatic / cinematic** | Zoom through, zoom out, gravity drop, overexposure, color dip to black · **Shader:** cinematic zoom, gravitational lens, domain warp | Scale, weight, light extremes. Shader transitions add per-pixel depth. |
37
+ | **Premium / luxury** | Focus pull, blur crossfade, color dip to black · **Shader:** cross-warp morph, thermal distortion | Restraint. Cross-warp morph flows both scenes into each other organically. |
38
+ | **Retro / analog** | Film burn, light leak, VHS, clock wipe · **Shader:** light leak | Organic imperfection. Warm color bleeds, scan line displacement. |
30
39
 
31
40
  ## Narrative Position
32
41
 
@@ -62,34 +71,41 @@ Think about what the transition _communicates_, not just what it looks like.
62
71
 
63
72
  Read [transitions/catalog.md](transitions/catalog.md) for GSAP code and hard rules for every transition type.
64
73
 
65
- | Category | Transitions |
66
- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
- | Content-transforming | Push slide, vertical push, elastic push, squeeze, zoom through, zoom out, gravity drop, 3D flip |
68
- | Reveal/mask | Circle iris, diamond iris, diagonal split, clock wipe, shutter |
69
- | Dissolve | Crossfade, blur crossfade, focus pull, color dip |
70
- | Cover | Staggered blocks, horizontal blinds, vertical blinds |
71
- | Light | Light leak, overexposure burn, film burn |
72
- | Distortion | Glitch, chromatic aberration, ripple, VHS tape |
73
- | Pattern | Grid dissolve |
74
- | Instant | Flash cut, morph circle |
75
- | Shader (WebGL) | Domain warp, ridged burn, whip pan, SDF iris, ripple waves, gravitational lens, cinematic zoom, chromatic split, glitch, swirl vortex, thermal distortion, flash through white, cross-warp morph, light leak (shader) |
74
+ | Category | CSS | Shader (WebGL) |
75
+ | ----------- | -------------------------------------------------------------- | ------------------------------------------------------------------------- |
76
+ | Push/slide | Push slide, vertical push, elastic push, squeeze | Whip pan |
77
+ | Scale/zoom | Zoom through, zoom out, gravity drop, 3D flip | Cinematic zoom, gravitational lens |
78
+ | Reveal/mask | Circle iris, diamond iris, diagonal split, clock wipe, shutter | SDF iris |
79
+ | Dissolve | Crossfade, blur crossfade, focus pull, color dip | Cross-warp morph, domain warp |
80
+ | Cover | Staggered blocks, horizontal blinds, vertical blinds | — |
81
+ | Light | Light leak, overexposure burn, film burn | Light leak (shader), thermal distortion |
82
+ | Distortion | Glitch, chromatic aberration, ripple, VHS tape | Glitch (shader), chromatic split, ridged burn, ripple waves, swirl vortex |
83
+ | Pattern | Grid dissolve, morph circle | — |
76
84
 
77
85
  ## Transitions That Don't Work in CSS
78
86
 
79
87
  Avoid: star iris, tilt-shift, lens flare, hinge/door. See catalog.md for why.
80
88
 
81
- ## CSS vs Shader: When to Use Which
89
+ ## CSS vs Shader
90
+
91
+ CSS transitions animate scene containers with opacity, transforms, clip-path, and filters. Shader transitions composite both scene textures per-pixel on a WebGL canvas — they can warp, dissolve, and morph in ways CSS cannot.
92
+
93
+ **Both are first-class options.** Shaders are provided by the `@hyperframes/shader-transitions` package — import from the package instead of writing raw GLSL. CSS transitions are simpler to set up. Choose based on the effect you want, not based on which is easier.
94
+
95
+ When a composition uses shader transitions, ALL transitions in that composition should be shader-based (the WebGL canvas replaces DOM-based scene switching). Don't mix CSS and shader transitions in the same composition.
96
+
97
+ ## Shader-Compatible CSS Rules
82
98
 
83
- Most compositions should use **CSS/GSAP transitions** (the other categories above). They're simpler, lighter, and handle most needs. Use **shader transitions** only when you need an effect that CSS can't achieve:
99
+ Shader transitions capture DOM scenes to WebGL textures via html2canvas. The canvas 2D rendering pipeline doesn't match CSS exactly. Follow these rules to avoid visible artifacts at transition boundaries:
84
100
 
85
- | Use CSS/GSAP when | Use Shader when |
86
- | ---------------------------------------------- | ----------------------------------------------- |
87
- | Opacity, transform, clip-path, filter effects | Per-pixel noise dissolves, domain warping |
88
- | Simple crossfades, wipes, slides | Both scenes actively morph into each other |
89
- | No images/video in scenes (text + shapes only) | Live video needs to play through the transition |
90
- | Quick to set up, no boilerplate | Willing to add WebGL setup layer (~200 lines) |
101
+ 1. **No `transparent` keyword in gradients.** Canvas interpolates `transparent` as `rgba(0,0,0,0)` (black at zero alpha), creating dark fringes. Always use the target color at zero alpha: `rgba(200,117,51,0)` not `transparent`.
102
+ 2. **No gradient backgrounds on elements thinner than 4px.** Canvas can't match CSS gradient rendering on 1-2px elements. Use solid `background-color` on thin accent lines.
103
+ 3. **No CSS variables (`var()`) on elements visible during capture.** html2canvas doesn't reliably resolve custom properties. Use literal color values in inline styles.
104
+ 4. **Mark uncapturable decorative elements with `data-no-capture`.** The capture function skips these. They're present on the live DOM but absent from the shader texture. Use for elements that can't follow the rules above.
105
+ 5. **No gradient opacity below 0.15.** Gradient elements below 10% opacity render differently in canvas vs CSS. Increase to 0.15+ or use a solid color at equivalent brightness.
106
+ 6. **Every `.scene` div must have explicit `background-color`, AND pass the same color as `bgColor` in the `init()` config.** The package captures scene elements via html2canvas. Both the CSS `background-color` on `.scene` and the `bgColor` config must match. Without either, the texture renders as black.
91
107
 
92
- Shader transitions require setup boilerplate (canvas, scene capture, WebGL init). Read [transitions/shader-setup.md](transitions/shader-setup.md) for the complete code. The fragment shaders themselves are in the Shader section of [transitions/catalog.md](transitions/catalog.md).
108
+ These rules only apply to shader transition compositions. CSS-only compositions have no restrictions.
93
109
 
94
110
  ## Visual Pattern Warning
95
111
 
@@ -4,7 +4,11 @@ The compiler embeds supported fonts — just write `font-family` in CSS.
4
4
 
5
5
  ## Banned
6
6
 
7
- Inter, Roboto, Open Sans, Noto Sans, Arimo, Lato, Source Sans, PT Sans, Nunito, Poppins, Outfit, Sora, Playfair Display, Cormorant Garamond, Bodoni Moda, EB Garamond, Cinzel, Prata
7
+ Training-data defaults that every LLM reaches for. These produce monoculture across compositions.
8
+
9
+ Inter, Roboto, Open Sans, Noto Sans, Arimo, Lato, Source Sans, PT Sans, Nunito, Poppins, Outfit, Sora, Playfair Display, Cormorant Garamond, Bodoni Moda, EB Garamond, Cinzel, Prata, Syne
10
+
11
+ **Syne in particular** is the most overused "distinctive" display font. It is an instant AI design tell.
8
12
 
9
13
  ## Guardrails
10
14
 
@@ -34,16 +38,18 @@ Don't default to what you know. If the content is luxury, a grotesque sans might
34
38
  Save this script to `/tmp/fontquery.py` and run with `curl -s 'https://fonts.google.com/metadata/fonts' > /tmp/gfonts.json && python3 /tmp/fontquery.py /tmp/gfonts.json`:
35
39
 
36
40
  ```python
37
- import json, sys
41
+ import json, sys, random
38
42
  from collections import OrderedDict
39
43
 
44
+ random.seed() # true random each run
45
+
40
46
  with open(sys.argv[1]) as f:
41
47
  data = json.load(f)
42
48
  fonts = data.get("familyMetadataList", [])
43
49
 
44
50
  ban = {"Inter","Roboto","Open Sans","Noto Sans","Lato","Poppins","Source Sans 3",
45
51
  "PT Sans","Nunito","Outfit","Sora","Playfair Display","Cormorant Garamond",
46
- "Bodoni Moda","EB Garamond","Cinzel","Prata","Arimo","Source Sans Pro"}
52
+ "Bodoni Moda","EB Garamond","Cinzel","Prata","Arimo","Source Sans Pro","Syne"}
47
53
  skip_pfx = ("Roboto","Noto ","Google Sans","Bpmf","Playwrite","Anek","BIZ ",
48
54
  "Nanum","Shippori","Sawarabi","Zen ","Kaisei","Kiwi ","Yuji ","Radio ")
49
55
 
@@ -77,28 +83,15 @@ for f in fonts:
77
83
  if f.get("category") == "Monospace" and f.get("dateAdded","") >= "2018-01-01" and f.get("popularity",9999) < 600:
78
84
  R["Monospace"].append(f); seen.add(f["family"])
79
85
 
80
- # Impact & Condensed — curated names + heavy display fonts
86
+ # Impact & Condensed — heavy display fonts with 800+ weight
81
87
  R["Impact & Condensed"] = []
82
- impact = {"Bebas Neue","Archivo Black","Big Shoulders Display","Teko","League Gothic",
83
- "Barlow Condensed","Staatliches","Anton","Oswald","Saira","Syne",
84
- "Titillium Web","Alumni Sans","Advent Pro"}
85
88
  for f in fonts:
86
89
  if not ok(f) or f["family"] in seen: continue
87
- is_impact = f["family"] in impact
88
- is_heavy_display = ("Display" in (f.get("classifications") or [])
89
- and any(k in list(f.get("fonts",{}).keys()) for k in ("800","900"))
90
- and f.get("popularity",9999) < 400
91
- and f.get("category") in ("Sans Serif","Display"))
92
- if is_impact or is_heavy_display:
90
+ has_heavy = any(k in list(f.get("fonts",{}).keys()) for k in ("800","900"))
91
+ is_display = f.get("category") in ("Sans Serif","Display")
92
+ if has_heavy and is_display and f.get("popularity",9999) < 400:
93
93
  R["Impact & Condensed"].append(f); seen.add(f["family"])
94
94
 
95
- # Bold Geometric Display — curated
96
- R["Bold Geometric Display"] = []
97
- for f in fonts:
98
- if not ok(f) or f["family"] in seen: continue
99
- if f["family"] in {"DM Serif Display","Abril Fatface","Righteous","Orbitron","Black Ops One"}:
100
- R["Bold Geometric Display"].append(f); seen.add(f["family"])
101
-
102
95
  # Script & Handwriting — popular (<300)
103
96
  R["Script & Handwriting"] = []
104
97
  for f in fonts:
@@ -106,21 +99,16 @@ for f in fonts:
106
99
  if f.get("category") == "Handwriting" and f.get("popularity",9999) < 300:
107
100
  R["Script & Handwriting"].append(f); seen.add(f["family"])
108
101
 
109
- # Established Classics — good older fonts
110
- R["Established Classics"] = []
111
- classics = {"Josefin Sans","Raleway","Montserrat","Abel","Exo","Red Hat Display",
112
- "Rubik","Alegreya","Arvo","Besley","Crimson Text","Fraunces",
113
- "Lora","Merriweather","Vollkorn"}
114
- for f in fonts:
115
- if f["family"] in classics and f["family"] not in seen:
116
- R["Established Classics"].append(f); seen.add(f["family"])
117
102
 
118
- # Print
103
+ # Randomize the top 5 in each category so the LLM doesn't always pick the same first result
119
104
  for cat in R:
120
105
  R[cat].sort(key=lambda x: x.get("popularity",9999))
106
+ top5 = R[cat][:5]
107
+ rest = R[cat][5:]
108
+ random.shuffle(top5)
109
+ R[cat] = top5 + rest
121
110
  limits = {"Trending Sans":15,"Trending Serif":12,"Monospace":8,
122
- "Impact & Condensed":12,"Bold Geometric Display":8,
123
- "Script & Handwriting":10,"Established Classics":20}
111
+ "Impact & Condensed":12,"Script & Handwriting":10}
124
112
  for cat in R:
125
113
  items = R[cat][:limits.get(cat,10)]
126
114
  if not items: continue
@@ -131,4 +119,57 @@ for cat in R:
131
119
  print()
132
120
  ```
133
121
 
134
- Seven categories: trending sans, trending serif, monospace, impact/condensed, bold geometric, script/handwriting, and established classics. Cross classification boundaries when pairing.
122
+ Five categories: trending sans, trending serif, monospace, impact/condensed, script/handwriting. All dynamically filtered from Google Fonts metadata — no hardcoded font names. Cross classification boundaries when pairing.
123
+
124
+ ## Selection Thinking
125
+
126
+ Don't pick fonts by category reflex (editorial → serif, tech → mono, modern → geometric sans). That's pattern matching, not design.
127
+
128
+ 1. **Name the register.** What voice is the content speaking in? Institutional authority? Personal confession? Technical precision? Casual irreverence? The register narrows the field more than the category.
129
+ 2. **Think physically.** Imagine the font as a physical object the brand could ship — a museum exhibit caption, a hand-painted shop sign, a 1970s mainframe terminal manual, a fabric label inside a coat, a children's book printed on cheap newsprint, a tax form. Whichever physical object fits the register is pointing at the right _kind_ of typeface.
130
+ 3. **Reject your first instinct.** The first font that feels right is usually your training-data default for that register. If you picked it last time too, find something else.
131
+ 4. **Cross-check the assumption.** An editorial brief does NOT need a serif. A technical brief does NOT need a sans. A children's product does NOT need a rounded display font. The most distinctive choice often contradicts the category expectation.
132
+
133
+ ## Similar-Font Pairing
134
+
135
+ Never pair two fonts that are similar but not identical — two geometric sans-serifs, two transitional serifs, two humanist sans. They create visual friction without clear hierarchy. The viewer senses something is "off" but can't articulate it. Either use one font at two weights, or pair fonts that contrast on multiple axes: serif + sans, condensed + wide, geometric + humanist.
136
+
137
+ ## Dark Backgrounds
138
+
139
+ Light text on dark backgrounds creates two optical illusions you need to compensate for:
140
+
141
+ - **Increased apparent weight.** Light-on-dark reads heavier than dark-on-light at the same `font-weight`. Use 350 instead of 400 for body text. Headlines are less affected because size compensates.
142
+ - **Tighter apparent spacing.** Light halos around letterforms reduce perceived gaps. Increase `line-height` by 0.05-0.1 beyond your light-background value. For display sizes, add 0.01em `letter-spacing` to counteract.
143
+
144
+ ## OpenType Features for Data
145
+
146
+ Most fonts ship with OpenType features that are off by default. Turn them on for data compositions:
147
+
148
+ ```css
149
+ /* Tabular numbers — digits align vertically in columns */
150
+ .stat-value,
151
+ .timer,
152
+ .data-column {
153
+ font-variant-numeric: tabular-nums;
154
+ }
155
+
156
+ /* Diagonal fractions — renders 1/2 as ½ */
157
+ .recipe-amount,
158
+ .ratio {
159
+ font-variant-numeric: diagonal-fractions;
160
+ }
161
+
162
+ /* Small caps for abbreviations — less visual shouting */
163
+ .abbreviation,
164
+ .unit {
165
+ font-variant-caps: all-small-caps;
166
+ }
167
+
168
+ /* Disable ligatures in code — fi, fl, ffi should stay separate */
169
+ code,
170
+ .code {
171
+ font-variant-ligatures: none;
172
+ }
173
+ ```
174
+
175
+ `tabular-nums` is essential any time numbers are stacked vertically — stat callouts, timers, scoreboards, data tables. Without it, digits have proportional widths and columns don't align.