hyperframes 0.6.31 → 0.6.32
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 +5894 -4574
- package/dist/skills/hyperframes/SKILL.md +2 -1
- package/dist/skills/hyperframes/references/beat-direction.md +99 -30
- package/dist/skills/hyperframes/references/dynamic-techniques.md +19 -7
- package/dist/skills/hyperframes/references/html-in-canvas-patterns.md +507 -0
- package/dist/skills/hyperframes/references/motion-principles.md +60 -52
- package/dist/skills/hyperframes/references/prompt-expansion.md +3 -3
- package/dist/skills/hyperframes/references/techniques.md +172 -19
- package/dist/skills/hyperframes/references/text-effects.md +64 -0
- package/dist/skills/hyperframes/references/transitions.md +61 -35
- package/dist/studio/assets/index-C-pv1DOD.js +120 -0
- package/dist/studio/assets/index-Cd3DF1je.css +1 -0
- package/dist/studio/index.html +2 -2
- package/package.json +4 -2
- package/dist/studio/assets/index-BWBj8I6Q.css +0 -1
- package/dist/studio/assets/index-Do0kAMcy.js +0 -115
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
# HTML-in-Canvas Patterns
|
|
2
|
+
|
|
3
|
+
HyperFrames' most powerful visual capability. Capture ANY live HTML/CSS as a GPU texture, then render it through WebGL shaders, Three.js 3D scenes, or post-processing effects — at 60fps, pixel-perfect, with every CSS feature supported.
|
|
4
|
+
|
|
5
|
+
**Read this file when a beat deserves cinematic treatment beyond flat GSAP animations.** Use for 1-3 hero beats per video, not every beat. The rest can use standard GSAP — the contrast between flat beats and HTML-in-Canvas beats IS part of the visual storytelling.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Core Boilerplate (same in every HTML-in-Canvas composition)
|
|
10
|
+
|
|
11
|
+
Every HTML-in-Canvas effect shares this structure. Learn this once, adapt it for any effect.
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<!-- 1. Source HTML — your content goes inside a layoutsubtree canvas -->
|
|
15
|
+
<canvas
|
|
16
|
+
id="hic-source"
|
|
17
|
+
layoutsubtree
|
|
18
|
+
width="1920"
|
|
19
|
+
height="1080"
|
|
20
|
+
style="position:absolute;inset:0;opacity:0;"
|
|
21
|
+
>
|
|
22
|
+
<div id="hic-content" style="width:1920px;height:1080px;">
|
|
23
|
+
<!-- YOUR HTML CONTENT HERE — text, images, cards, dashboards, anything -->
|
|
24
|
+
</div>
|
|
25
|
+
</canvas>
|
|
26
|
+
|
|
27
|
+
<!-- 2. Render target — the visible canvas that shows the effect -->
|
|
28
|
+
<canvas id="hic-output" width="1920" height="1080" style="position:absolute;inset:0;"></canvas>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
// 3. Feature detection — always check, always provide fallback
|
|
33
|
+
function isHiCSupported() {
|
|
34
|
+
var tc = document.createElement("canvas");
|
|
35
|
+
if (!("layoutSubtree" in tc)) return false;
|
|
36
|
+
tc.setAttribute("layoutsubtree", "");
|
|
37
|
+
var ctx = tc.getContext("2d");
|
|
38
|
+
return ctx && typeof ctx.drawElementImage === "function";
|
|
39
|
+
}
|
|
40
|
+
var apiOk = isHiCSupported();
|
|
41
|
+
|
|
42
|
+
// 4. Capture function — call this every frame in onUpdate
|
|
43
|
+
var capCanvas = document.getElementById("hic-source");
|
|
44
|
+
var capCtx = capCanvas.getContext("2d");
|
|
45
|
+
function captureContent() {
|
|
46
|
+
if (apiOk) {
|
|
47
|
+
capCtx.drawElementImage(document.getElementById("hic-content"), 0, 0, 1920, 1080);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 5. Drive from GSAP timeline — capture + render every frame
|
|
52
|
+
tl.to(
|
|
53
|
+
proxy,
|
|
54
|
+
{
|
|
55
|
+
/* your animation properties */
|
|
56
|
+
duration: BEAT_DURATION,
|
|
57
|
+
ease: "sine.inOut",
|
|
58
|
+
onUpdate: function () {
|
|
59
|
+
captureContent();
|
|
60
|
+
// render your effect here (Three.js or WebGL2)
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
0,
|
|
64
|
+
);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Fallback:** When `drawElementImage` is not available (preview without Chrome flag), draw a solid-color placeholder or use Canvas 2D text. The HyperFrames renderer auto-enables the flag — the effect WILL work in the final video. See the liquid-glass block for a complete fallback example.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Effect Catalog
|
|
72
|
+
|
|
73
|
+
### 1. 3D Rotation with Bloom (Three.js)
|
|
74
|
+
|
|
75
|
+
**What it looks like:** Content floats in 3D space, slowly rotating with cinematic glow around bright edges. Like a product screenshot displayed in a dark theater.
|
|
76
|
+
|
|
77
|
+
**When to use:** Hero product showcase, feature reveal, CTA with premium feel.
|
|
78
|
+
|
|
79
|
+
**Key Three.js components:** `PlaneGeometry` + `CanvasTexture` + `EffectComposer` + `UnrealBloomPass`
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
// After the boilerplate above, add:
|
|
83
|
+
var scene3d = new THREE.Scene();
|
|
84
|
+
var camera = new THREE.PerspectiveCamera(45, 1920 / 1080, 0.1, 100);
|
|
85
|
+
camera.position.set(0, 0, 4);
|
|
86
|
+
|
|
87
|
+
var renderer = new THREE.WebGLRenderer({
|
|
88
|
+
canvas: document.getElementById("hic-output"),
|
|
89
|
+
antialias: true,
|
|
90
|
+
alpha: true,
|
|
91
|
+
});
|
|
92
|
+
renderer.setSize(1920, 1080);
|
|
93
|
+
|
|
94
|
+
var texture = new THREE.CanvasTexture(capCanvas);
|
|
95
|
+
var mesh = new THREE.Mesh(
|
|
96
|
+
new THREE.PlaneGeometry(3.6, 2.2),
|
|
97
|
+
new THREE.MeshBasicMaterial({ map: texture }),
|
|
98
|
+
);
|
|
99
|
+
scene3d.add(mesh);
|
|
100
|
+
|
|
101
|
+
// Post-processing: bloom for cinematic glow.
|
|
102
|
+
// EffectComposer / RenderPass / UnrealBloomPass are ES-module named imports
|
|
103
|
+
// (see the import block below) — they're NOT properties of THREE in modern
|
|
104
|
+
// versions. Three.js r150+ removed the UMD `examples/js/` globals.
|
|
105
|
+
var composer = new EffectComposer(renderer);
|
|
106
|
+
composer.addPass(new RenderPass(scene3d, camera));
|
|
107
|
+
composer.addPass(new UnrealBloomPass(new THREE.Vector2(1920, 1080), 0.3, 0.4, 0.85));
|
|
108
|
+
|
|
109
|
+
var proxy = { rotY: -0.12, zoom: 4.2 };
|
|
110
|
+
tl.to(
|
|
111
|
+
proxy,
|
|
112
|
+
{
|
|
113
|
+
rotY: 0.12,
|
|
114
|
+
zoom: 3.6,
|
|
115
|
+
duration: BEAT_DURATION,
|
|
116
|
+
ease: "sine.inOut",
|
|
117
|
+
onUpdate: function () {
|
|
118
|
+
captureContent();
|
|
119
|
+
texture.needsUpdate = true;
|
|
120
|
+
mesh.rotation.y = proxy.rotY;
|
|
121
|
+
camera.position.z = proxy.zoom;
|
|
122
|
+
composer.render();
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
0,
|
|
126
|
+
);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Load Three.js and post-processing via ESM (use a `type="module"` script):**
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<script type="module">
|
|
133
|
+
import * as THREE from "https://cdn.jsdelivr.net/npm/three@0.181.2/+esm";
|
|
134
|
+
import { EffectComposer } from "https://cdn.jsdelivr.net/npm/three@0.181.2/examples/jsm/postprocessing/EffectComposer.js";
|
|
135
|
+
import { RenderPass } from "https://cdn.jsdelivr.net/npm/three@0.181.2/examples/jsm/postprocessing/RenderPass.js";
|
|
136
|
+
import { ShaderPass } from "https://cdn.jsdelivr.net/npm/three@0.181.2/examples/jsm/postprocessing/ShaderPass.js";
|
|
137
|
+
import { UnrealBloomPass } from "https://cdn.jsdelivr.net/npm/three@0.181.2/examples/jsm/postprocessing/UnrealBloomPass.js";
|
|
138
|
+
// ... rest of composition code using these imports
|
|
139
|
+
</script>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The `examples/js/` path was removed in Three.js r152. Use `examples/jsm/` (ES modules) with `three@0.181.2` — the version used by the HyperFrames Three.js adapter.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### 2. Magnetic Cursor Distortion (Raw WebGL2)
|
|
147
|
+
|
|
148
|
+
**What it looks like:** Content warps and bends toward a moving point, like a magnet pulling on pixels. Chromatic aberration splits RGB channels at the distortion site.
|
|
149
|
+
|
|
150
|
+
**When to use:** Interactive feel, product demo with cursor, "look at THIS feature" moment.
|
|
151
|
+
|
|
152
|
+
**Key technique:** Custom fragment shader with Gaussian warp + chromatic split. No Three.js needed — just raw WebGL2.
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
// WebGL2 setup
|
|
156
|
+
var gl = document.getElementById("hic-output").getContext("webgl2", {
|
|
157
|
+
alpha: false,
|
|
158
|
+
preserveDrawingBuffer: true,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Vertex shader — full-screen quad
|
|
162
|
+
var VS = `#version 300 es
|
|
163
|
+
in vec2 a_pos;
|
|
164
|
+
out vec2 v_uv;
|
|
165
|
+
void main() {
|
|
166
|
+
v_uv = a_pos * 0.5 + 0.5;
|
|
167
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
168
|
+
}`;
|
|
169
|
+
|
|
170
|
+
// Fragment shader — magnetic warp + chromatic aberration
|
|
171
|
+
var FS = `#version 300 es
|
|
172
|
+
precision highp float;
|
|
173
|
+
in vec2 v_uv;
|
|
174
|
+
out vec4 fragColor;
|
|
175
|
+
uniform sampler2D u_tex;
|
|
176
|
+
uniform vec2 u_cursor; // cursor position (0-1)
|
|
177
|
+
uniform float u_strength; // warp strength (0-1)
|
|
178
|
+
|
|
179
|
+
void main() {
|
|
180
|
+
vec2 uv = v_uv;
|
|
181
|
+
vec2 delta = uv - u_cursor;
|
|
182
|
+
float dist = length(delta);
|
|
183
|
+
float warp = u_strength * exp(-dist * dist * 8.0);
|
|
184
|
+
vec2 warped = uv - delta * warp * 0.3;
|
|
185
|
+
|
|
186
|
+
// Chromatic aberration at distortion site
|
|
187
|
+
float aberration = warp * 0.008;
|
|
188
|
+
float r = texture(u_tex, warped + vec2(aberration, 0.0)).r;
|
|
189
|
+
float g = texture(u_tex, warped).g;
|
|
190
|
+
float b = texture(u_tex, warped - vec2(aberration, 0.0)).b;
|
|
191
|
+
fragColor = vec4(r, g, b, 1.0);
|
|
192
|
+
}`;
|
|
193
|
+
|
|
194
|
+
// Compile, link, setup quad geometry, upload texture...
|
|
195
|
+
// (See registry/blocks/vfx-magnetic/vfx-magnetic.html for complete implementation)
|
|
196
|
+
|
|
197
|
+
// Drive cursor position from GSAP
|
|
198
|
+
var proxy = { cx: 0.2, cy: 0.5, strength: 0.0 };
|
|
199
|
+
tl.to(
|
|
200
|
+
proxy,
|
|
201
|
+
{
|
|
202
|
+
cx: 0.8,
|
|
203
|
+
cy: 0.4,
|
|
204
|
+
strength: 1.0,
|
|
205
|
+
duration: BEAT_DURATION,
|
|
206
|
+
ease: "power2.inOut",
|
|
207
|
+
onUpdate: function () {
|
|
208
|
+
captureContent();
|
|
209
|
+
// Upload texture, set uniforms, draw
|
|
210
|
+
gl.uniform2f(cursorLoc, proxy.cx, proxy.cy);
|
|
211
|
+
gl.uniform1f(strengthLoc, proxy.strength);
|
|
212
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
0,
|
|
216
|
+
);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### 3. Shatter / Fragment Explosion (Three.js)
|
|
222
|
+
|
|
223
|
+
**What it looks like:** Content breaks into geometric fragments that fly apart, revealing what's behind.
|
|
224
|
+
|
|
225
|
+
**When to use:** Dramatic transition, "breaking free" moment, tension release.
|
|
226
|
+
|
|
227
|
+
**Key technique:** Subdivide the source texture into triangle mesh fragments using BufferGeometry, then animate each fragment's position/rotation with GSAP.
|
|
228
|
+
|
|
229
|
+
Study `registry/blocks/vfx-shatter/vfx-shatter.html` for the complete 1156-line implementation. The core idea:
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
// 1. Capture content to texture (same boilerplate)
|
|
233
|
+
// Seeded PRNG for determinism — Math.random() is banned
|
|
234
|
+
function mulberry32(seed) {
|
|
235
|
+
return function () {
|
|
236
|
+
seed |= 0;
|
|
237
|
+
seed = (seed + 0x6d2b79f5) | 0;
|
|
238
|
+
var t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
|
|
239
|
+
t ^= t + Math.imul(t ^ (t >>> 7), 61 | t);
|
|
240
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
var rng = mulberry32(42);
|
|
244
|
+
|
|
245
|
+
// 2. Create N triangle fragments from the texture
|
|
246
|
+
var fragments = [];
|
|
247
|
+
for (var i = 0; i < NUM_FRAGMENTS; i++) {
|
|
248
|
+
var geom = new THREE.BufferGeometry();
|
|
249
|
+
var mesh = new THREE.Mesh(geom, new THREE.MeshBasicMaterial({ map: texture }));
|
|
250
|
+
scene3d.add(mesh);
|
|
251
|
+
fragments.push({ mesh: mesh, targetPos: randomExplosionVector(rng), delay: rng() * 0.5 });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// 3. Animate: first hold still, then EXPLODE
|
|
255
|
+
tl.to({}, { duration: holdTime }, 0);
|
|
256
|
+
fragments.forEach(function (frag) {
|
|
257
|
+
tl.to(
|
|
258
|
+
frag.mesh.position,
|
|
259
|
+
{
|
|
260
|
+
x: frag.targetPos.x,
|
|
261
|
+
y: frag.targetPos.y,
|
|
262
|
+
z: frag.targetPos.z,
|
|
263
|
+
duration: 0.8,
|
|
264
|
+
ease: "power3.in",
|
|
265
|
+
},
|
|
266
|
+
holdTime + frag.delay,
|
|
267
|
+
);
|
|
268
|
+
tl.to(
|
|
269
|
+
frag.mesh.rotation,
|
|
270
|
+
{ x: rng() * 4, y: rng() * 4, duration: 0.8, ease: "power2.in" },
|
|
271
|
+
holdTime + frag.delay,
|
|
272
|
+
);
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
### 4. Liquid / Fluid Surface (Three.js)
|
|
279
|
+
|
|
280
|
+
**What it looks like:** Content floats above a rippling liquid surface with real-time wave dynamics. Or content IS the surface, undulating like water.
|
|
281
|
+
|
|
282
|
+
**When to use:** Organic/premium feel, ambient background, "living" product showcase.
|
|
283
|
+
|
|
284
|
+
**Key technique:** Subdivided PlaneGeometry with vertex displacement driven by noise functions in a vertex shader.
|
|
285
|
+
|
|
286
|
+
Study `registry/blocks/vfx-liquid-background/vfx-liquid-background.html` for the 1244-line implementation. Core idea:
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
// Custom vertex shader with wave displacement
|
|
290
|
+
var vertexShader = `
|
|
291
|
+
varying vec2 vUv;
|
|
292
|
+
uniform float u_time;
|
|
293
|
+
void main() {
|
|
294
|
+
vUv = uv;
|
|
295
|
+
vec3 pos = position;
|
|
296
|
+
// Sine wave displacement
|
|
297
|
+
pos.z += sin(pos.x * 3.0 + u_time * 2.0) * 0.15;
|
|
298
|
+
pos.z += cos(pos.y * 2.5 + u_time * 1.5) * 0.1;
|
|
299
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
|
|
300
|
+
}
|
|
301
|
+
`;
|
|
302
|
+
|
|
303
|
+
var mesh = new THREE.Mesh(
|
|
304
|
+
new THREE.PlaneGeometry(4, 3, 64, 64), // heavily subdivided for smooth waves
|
|
305
|
+
new THREE.ShaderMaterial({
|
|
306
|
+
vertexShader: vertexShader,
|
|
307
|
+
fragmentShader: `varying vec2 vUv; uniform sampler2D u_tex;
|
|
308
|
+
void main() { gl_FragColor = texture2D(u_tex, vUv); }`,
|
|
309
|
+
uniforms: {
|
|
310
|
+
u_tex: { value: texture },
|
|
311
|
+
u_time: { value: 0 },
|
|
312
|
+
},
|
|
313
|
+
}),
|
|
314
|
+
);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
### 5. Portal / Dimensional Reveal (Three.js)
|
|
320
|
+
|
|
321
|
+
**What it looks like:** A glowing circular portal opens and content emerges through it from another dimension.
|
|
322
|
+
|
|
323
|
+
**When to use:** Product reveal, "entering the app" moment, hero feature introduction.
|
|
324
|
+
|
|
325
|
+
Study `registry/blocks/vfx-portal/vfx-portal.html` for the complete 863-line implementation.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## When to Use HTML-in-Canvas vs Standard GSAP
|
|
330
|
+
|
|
331
|
+
| Scenario | Use | Why |
|
|
332
|
+
| -------------------------------- | ------------------------------------ | ------------------------------------ |
|
|
333
|
+
| Hero product screenshot showcase | HTML-in-Canvas (3D rotation + bloom) | Makes flat UI feel cinematic |
|
|
334
|
+
| Feature list / stats | Standard GSAP | Content-focused, doesn't need 3D |
|
|
335
|
+
| CTA / brand reveal | HTML-in-Canvas (portal or magnetic) | Makes the moment memorable |
|
|
336
|
+
| Social proof / logos | Standard GSAP | Orderly cascade, trust is steady |
|
|
337
|
+
| Transition between acts | HTML-in-Canvas (shatter) | Dramatic act break |
|
|
338
|
+
| Background atmosphere | HTML-in-Canvas (liquid surface) | Premium ambient feel |
|
|
339
|
+
| Quick feature cards | Standard GSAP | Speed matters, 3D would slow it down |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## More Effects You Can Build
|
|
344
|
+
|
|
345
|
+
These aren't in the VFX blocks — build them yourself from the core boilerplate + a custom fragment shader. Each effect is a single GLSL function applied to the captured texture.
|
|
346
|
+
|
|
347
|
+
### 6. Noise Dissolve
|
|
348
|
+
|
|
349
|
+
Content dissolves into noise particles, revealing what's behind. Great for transitions.
|
|
350
|
+
|
|
351
|
+
```glsl
|
|
352
|
+
// Fragment shader — noise-based dissolve
|
|
353
|
+
uniform float u_progress; // 0.0 = fully visible, 1.0 = fully dissolved
|
|
354
|
+
uniform sampler2D u_tex;
|
|
355
|
+
|
|
356
|
+
float hash(vec2 p) {
|
|
357
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
void main() {
|
|
361
|
+
vec2 uv = v_uv;
|
|
362
|
+
float noise = hash(uv * 50.0);
|
|
363
|
+
float threshold = u_progress;
|
|
364
|
+
if (noise < threshold) {
|
|
365
|
+
// Edge glow at the dissolve boundary
|
|
366
|
+
float edge = smoothstep(threshold - 0.05, threshold, noise);
|
|
367
|
+
fragColor = vec4(1.0, 0.6, 0.2, 1.0) * (1.0 - edge); // orange edge glow
|
|
368
|
+
} else {
|
|
369
|
+
fragColor = texture(u_tex, uv);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### 7. Holographic / Iridescent
|
|
375
|
+
|
|
376
|
+
Content gets a rainbow-shifting holographic sheen that moves with time. Premium, futuristic feel.
|
|
377
|
+
|
|
378
|
+
```glsl
|
|
379
|
+
uniform float u_time;
|
|
380
|
+
uniform sampler2D u_tex;
|
|
381
|
+
|
|
382
|
+
void main() {
|
|
383
|
+
vec4 color = texture(u_tex, v_uv);
|
|
384
|
+
// Iridescent color shift based on position + time
|
|
385
|
+
float angle = v_uv.x * 6.28 + v_uv.y * 3.14 + u_time * 0.5;
|
|
386
|
+
vec3 holo = vec3(
|
|
387
|
+
sin(angle) * 0.5 + 0.5,
|
|
388
|
+
sin(angle + 2.094) * 0.5 + 0.5,
|
|
389
|
+
sin(angle + 4.189) * 0.5 + 0.5
|
|
390
|
+
);
|
|
391
|
+
// Blend holographic over content (subtle overlay)
|
|
392
|
+
fragColor = vec4(mix(color.rgb, holo, 0.15 + 0.1 * sin(u_time)), color.a);
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### 8. Scan Lines + CRT
|
|
397
|
+
|
|
398
|
+
Retro CRT monitor look — scan lines, slight curvature, phosphor glow. Great for "code" or "terminal" beats.
|
|
399
|
+
|
|
400
|
+
```glsl
|
|
401
|
+
uniform sampler2D u_tex;
|
|
402
|
+
uniform float u_time;
|
|
403
|
+
|
|
404
|
+
void main() {
|
|
405
|
+
vec2 uv = v_uv;
|
|
406
|
+
// Barrel distortion (CRT curvature)
|
|
407
|
+
vec2 centered = uv - 0.5;
|
|
408
|
+
float dist = dot(centered, centered);
|
|
409
|
+
uv = uv + centered * dist * 0.15;
|
|
410
|
+
|
|
411
|
+
vec4 color = texture(u_tex, uv);
|
|
412
|
+
// Scan lines
|
|
413
|
+
float scanline = sin(uv.y * 800.0) * 0.04;
|
|
414
|
+
color.rgb -= scanline;
|
|
415
|
+
// Slight RGB offset (phosphor)
|
|
416
|
+
color.r = texture(u_tex, uv + vec2(0.001, 0.0)).r;
|
|
417
|
+
color.b = texture(u_tex, uv - vec2(0.001, 0.0)).b;
|
|
418
|
+
// Vignette
|
|
419
|
+
float vignette = 1.0 - dist * 2.0;
|
|
420
|
+
fragColor = vec4(color.rgb * vignette, 1.0);
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### 9. Frosted Glass Blur
|
|
425
|
+
|
|
426
|
+
Content behind frosted glass — visible but softened, with subtle light refraction. Good for "behind the scenes" or "coming soon" moments.
|
|
427
|
+
|
|
428
|
+
```glsl
|
|
429
|
+
uniform sampler2D u_tex;
|
|
430
|
+
uniform float u_blur; // 0.0 = clear, 1.0 = full frost
|
|
431
|
+
|
|
432
|
+
void main() {
|
|
433
|
+
vec2 uv = v_uv;
|
|
434
|
+
vec4 color = vec4(0.0);
|
|
435
|
+
// Box blur with offset
|
|
436
|
+
float radius = u_blur * 0.015;
|
|
437
|
+
for (float x = -2.0; x <= 2.0; x += 1.0) {
|
|
438
|
+
for (float y = -2.0; y <= 2.0; y += 1.0) {
|
|
439
|
+
color += texture(u_tex, uv + vec2(x, y) * radius);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
color /= 25.0;
|
|
443
|
+
// Add frost noise texture
|
|
444
|
+
float frost = fract(sin(dot(uv * 200.0, vec2(12.9898, 78.233))) * 43758.5453);
|
|
445
|
+
color.rgb += frost * 0.03 * u_blur;
|
|
446
|
+
fragColor = color;
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### 10. Pixel Sort / Glitch Art
|
|
451
|
+
|
|
452
|
+
Pixels rearrange themselves in vertical or horizontal strips — digital art aesthetic. Great for tech/creative brands.
|
|
453
|
+
|
|
454
|
+
```glsl
|
|
455
|
+
uniform sampler2D u_tex;
|
|
456
|
+
uniform float u_intensity; // 0-1
|
|
457
|
+
|
|
458
|
+
void main() {
|
|
459
|
+
vec2 uv = v_uv;
|
|
460
|
+
// Random horizontal displacement per row
|
|
461
|
+
float row = floor(uv.y * 80.0);
|
|
462
|
+
float noise = fract(sin(row * 127.1) * 43758.5);
|
|
463
|
+
float displace = step(0.7, noise) * u_intensity * 0.1;
|
|
464
|
+
// Shift UV with RGB split
|
|
465
|
+
float r = texture(u_tex, uv + vec2(displace, 0.0)).r;
|
|
466
|
+
float g = texture(u_tex, uv).g;
|
|
467
|
+
float b = texture(u_tex, uv - vec2(displace * 0.5, 0.0)).b;
|
|
468
|
+
fragColor = vec4(r, g, b, 1.0);
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Creating ANY Custom Effect
|
|
475
|
+
|
|
476
|
+
The fragment shaders above are templates. The pattern is always:
|
|
477
|
+
|
|
478
|
+
1. **Capture your HTML content** with `drawElementImage` (the boilerplate at the top)
|
|
479
|
+
2. **Upload the captured canvas as a WebGL texture**
|
|
480
|
+
3. **Write a fragment shader** that reads from the texture and outputs modified colors
|
|
481
|
+
4. **Drive shader uniforms from GSAP** via `onUpdate`
|
|
482
|
+
|
|
483
|
+
Any GLSL effect from ShaderToy, The Book of Shaders, CodePen, or anywhere else can be adapted:
|
|
484
|
+
|
|
485
|
+
1. Find an effect you like (search "GLSL [effect name]" or browse shadertoy.com)
|
|
486
|
+
2. Copy the fragment shader
|
|
487
|
+
3. Replace `iResolution` with `vec2(1920.0, 1080.0)`, `iTime` with your `u_time` uniform
|
|
488
|
+
4. Add `uniform sampler2D u_tex;` for the captured content texture
|
|
489
|
+
5. Wire the uniforms to GSAP proxy values
|
|
490
|
+
|
|
491
|
+
**Geometry ideas beyond flat planes:**
|
|
492
|
+
|
|
493
|
+
- `SphereGeometry` — content mapped onto a globe (world map, global reach)
|
|
494
|
+
- `CylinderGeometry` — content on a rotating cylinder (carousel/scroll feel)
|
|
495
|
+
- `TorusGeometry` — content wrapped around a ring (infinity, cycle)
|
|
496
|
+
- `BoxGeometry` — content on a 3D box (product packaging, dice)
|
|
497
|
+
- GLTF models — content mapped as screen texture on phone, laptop, monitor (see `vfx-iphone-device`)
|
|
498
|
+
|
|
499
|
+
**Post-processing stacking** (Three.js EffectComposer):
|
|
500
|
+
|
|
501
|
+
- Bloom + film grain = cinematic
|
|
502
|
+
- Bloom + chromatic aberration = lens effect
|
|
503
|
+
- Depth of field + vignette = focused attention
|
|
504
|
+
- Film grain + scan lines = retro
|
|
505
|
+
- Multiple passes stack — add as many as you want
|
|
506
|
+
|
|
507
|
+
**You are not limited to the effects listed here.** If you can imagine a visual treatment, you can build it. The HTML-in-Canvas API gives you the source material (any HTML rendered as a texture), and WebGL/Three.js gives you unlimited creative control over how that material is presented.
|
|
@@ -1,82 +1,90 @@
|
|
|
1
1
|
# Motion Principles
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Common defaults that produce monoculture
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
These are the patterns LLMs reach for without thinking. None of them are wrong in isolation — they're wrong as defaults. If every scene of every video lands on the same easing, the same speed, and the same entrance direction, the compositions blur into one another no matter what the brand is.
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
7
|
+
- **Same ease on every tween.** `power2.out` is the most common default. Aim for variety: no more than two independent tweens sharing an ease within a scene. Eases are like font weights — vary them deliberately.
|
|
8
|
+
- **Same speed on every tween.** 0.4–0.5s is a common default that flattens rhythm. The slowest motion in a scene should be roughly 3× slower than the fastest. Vary duration so the eye can tell what's important.
|
|
9
|
+
- **Same entrance direction.** `y: 30, opacity: 0` is the universal LLM entrance. The same scene can use entrances from left, from right, from scale, from blur, opacity-only, letter-spacing — each one says something different about the element.
|
|
10
|
+
- **Same stagger across scenes.** Each scene should have its own rhythm. A 0.08s stagger in beat 1 and a 0.15s stagger in beat 2 makes the two beats feel like different moments.
|
|
11
|
+
- **Ambient zoom on every scene.** Slow-scale-up is the default ambient motion and it telegraphs "LLM-generated video." Vary the ambient motion per scene: slow pan, subtle rotation, color temperature shift, gentle drift — and sometimes nothing. Stillness after motion has real weight.
|
|
12
|
+
- **First animation at t=0.** Zero-delay feels like a jump cut. Offset the opening 0.1–0.3s so the scene reads as composed rather than thrown together.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Easing is emotion, not technique
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
The motion is the verb. The easing is the adverb. A slide-in with `expo.out` feels confident. With `sine.inOut`, dreamy. With `elastic.out`, playful. Same motion, three different meanings. Choose the adverb deliberately.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
**Direction rules:**
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
- `.out` for elements entering. Starts fast, decelerates. Feels responsive. This is the default for entrances.
|
|
21
|
+
- `.in` for elements leaving. Starts slow, accelerates away. Sends them off with momentum.
|
|
22
|
+
- `.inOut` for elements moving between positions, neither entering nor leaving the scene.
|
|
21
23
|
|
|
22
|
-
-
|
|
23
|
-
- `.in` for elements leaving. Starts slow, accelerates away. Throws them off.
|
|
24
|
-
- `.inOut` for elements moving between positions.
|
|
24
|
+
Ease-in on an entrance feels sluggish. Ease-out on an exit feels reluctant. These are the most common reversals and they're worth checking your work against.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
## Speed expresses weight
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Duration is one of the most direct ways a composition communicates what it values. Faster motion reads as confident, urgent, kinetic — it gives the viewer less time to study what's happening, which means the work has to land in fewer frames. Slower motion reads as deliberate, considered, weighty — the viewer has time to take in the element, which means each element has to earn that attention.
|
|
29
29
|
|
|
30
|
-
|
|
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
|
|
30
|
+
Useful calibration ranges (not prescriptions — what a duration _expresses_ depends on what surrounds it):
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
- **0.15–0.3s** — quick, percussive, kinetic. The motion reads as something happening _to_ the frame.
|
|
33
|
+
- **0.3–0.5s** — comfortable, professional. The motion reads as composed and reliable.
|
|
34
|
+
- **0.5–0.8s** — deliberate. The motion has visible weight and asks for attention.
|
|
35
|
+
- **0.8s+** — atmospheric. The motion becomes part of what the scene _is_, not something happening within it.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
A composition that uses only one of these ranges feels one-note. Mix them — a scene where the headline takes 0.7s to settle and the supporting details land in 0.25s creates contrast that reinforces hierarchy without needing different colors or sizes.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
- **Breathe (30-70%)** — content visible, alive with ONE ambient motion.
|
|
41
|
-
- **Resolve (70-100%)** — exit or decisive end. Exits are faster than entrances.
|
|
39
|
+
## Scene structure: build, breathe, resolve
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
Every scene has three phases. The most common failure is dumping everything into the build and leaving nothing for the other two.
|
|
44
42
|
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
47
|
-
- **
|
|
43
|
+
- **Build (0–30%)** — elements enter, staggered. Not all at once.
|
|
44
|
+
- **Breathe (30–70%)** — content visible, alive with one ambient motion. The viewer reads, registers, settles.
|
|
45
|
+
- **Resolve (70–100%)** — exit or decisive end. Exits are faster than entrances (see Asymmetry below).
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
A scene that's all build feels like a slideshow. A scene with no breathe phase doesn't let the content land.
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
## Transitions carry meaning
|
|
52
50
|
|
|
53
|
-
The
|
|
51
|
+
The transition type tells the viewer how two scenes relate:
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
- **Crossfade** — "this continues." Connective tissue between related ideas.
|
|
54
|
+
- **Hard cut** — "wake up" or a register shift. Disruption, surprise, percussive emphasis.
|
|
55
|
+
- **Slow dissolve** — "drift with me." Atmospheric, meditative, between-thoughts.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Crossfade is the default and it's defensible most of the time. The thing to watch for is using it for everything — when every transition is a crossfade, the viewer stops registering scene changes as meaningful. Hard cuts and slow dissolves are tools for the moments where the change in scene _is_ the message.
|
|
58
58
|
|
|
59
|
-
##
|
|
59
|
+
## Choreography is hierarchy
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
The element that moves first is perceived as most important. Stagger in order of importance, not DOM order. Don't wait for one entrance to complete before starting the next — overlap entries. Total stagger sequence under 500ms regardless of item count keeps the scene from feeling like a slow drip.
|
|
62
62
|
|
|
63
|
-
|
|
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).
|
|
63
|
+
## Asymmetry between entrances and exits
|
|
70
64
|
|
|
71
|
-
|
|
65
|
+
Entrances need longer than exits. A card might take 0.4s to appear but 0.25s to disappear — entrances build presence, exits remove it, and remove takes less time than build.
|
|
72
66
|
|
|
73
|
-
|
|
67
|
+
## Visual composition
|
|
74
68
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- **
|
|
78
|
-
- **
|
|
79
|
-
- **
|
|
69
|
+
Video frames are not web pages. Web layout patterns that work on a scrollable page often look broken in a fixed-frame composition.
|
|
70
|
+
|
|
71
|
+
- **Two focal points minimum per scene.** The eye needs somewhere to travel. A single text block floating in empty space reads as unfinished.
|
|
72
|
+
- **Fill the frame.** Hero text typically wants 60–80% of frame width. Web type sizes — 16px body, 32px headlines — disappear at video distance.
|
|
73
|
+
- **Three layers minimum.** Background treatment (glow, oversized faded type, color panel), foreground content, accent elements (dividers, labels, data bars). A scene with only one layer reads flat.
|
|
74
|
+
- **Background is not empty.** Radial glows, oversized faded type bleeding off-frame, subtle border panels, hairline rules. Pure solid `#000` reads as "nothing loaded."
|
|
75
|
+
- **Anchor to edges.** Pin content to left/top or right/bottom. Centered-and-floating is a web pattern that looks lost on a 16:9 canvas.
|
|
76
|
+
- **Split frames.** Data panel on the left, content on the right. Top bar with metadata, full-width below. Zone-based layouts beat centered stacks.
|
|
77
|
+
- **Use structural elements.** Rules, dividers, border panels. They create paths for the eye and animate well (`scaleX` from 0).
|
|
78
|
+
|
|
79
|
+
## Image motion treatment
|
|
80
|
+
|
|
81
|
+
Embedded images shouldn't sit flat — every image earns some motion treatment:
|
|
82
|
+
|
|
83
|
+
- **Perspective tilt** — `gsap.set(el, { transformPerspective: 1200, rotationY: -8 })` plus a `box-shadow` creates depth. Do NOT use CSS `transform: perspective(...)`; GSAP will overwrite it.
|
|
84
|
+
- **Slow zoom (Ken Burns)** — GSAP `scale: 1` → `1.04` over beat duration. Makes photos feel cinematic rather than pasted in.
|
|
85
|
+
- **Device frame** — wrap in a laptop or phone shape using `border-radius` and `box-shadow`.
|
|
86
|
+
- **Floating UI** — extract a key element and animate it at a different z-depth for parallax.
|
|
87
|
+
- **Scroll reveal** — clip the image to a viewport window and animate `y` position.
|
|
80
88
|
|
|
81
89
|
## Load-Bearing GSAP Rules
|
|
82
90
|
|
|
@@ -132,7 +140,7 @@ Rules below came out of two independent website-to-hyperframes builds (2026-04-2
|
|
|
132
140
|
tl.to(".aura", { scale: 1.08, yoyo: true, repeat: 5, duration: 1.2 }, 0);
|
|
133
141
|
```
|
|
134
142
|
|
|
135
|
-
- **Hard-kill every scene boundary, not just captions.** The
|
|
143
|
+
- **Hard-kill every scene boundary, not just captions.** The same hard-kill pattern from `captions.md` generalizes to all elements with exit animations: any element whose visibility changes at a beat boundary needs a deterministic `tl.set()` kill after its fade, because later tweens on the same element (or `immediateRender` from a sibling tween) can resurrect it. Apply to every element with an exit animation:
|
|
136
144
|
|
|
137
145
|
```js
|
|
138
146
|
tl.to(el, { opacity: 0, duration: 0.3 }, beatEnd);
|