@clypra-studio/engine 0.1.2 → 1.0.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 (41) hide show
  1. package/dist/TransitionDefinition-CC6oSTYB.d.cts +158 -0
  2. package/dist/TransitionDefinition-CC6oSTYB.d.ts +158 -0
  3. package/dist/chunk-4Y7ZSGHJ.js +2990 -0
  4. package/dist/chunk-4Y7ZSGHJ.js.map +1 -0
  5. package/dist/chunk-AUMNXFYQ.js +667 -0
  6. package/dist/chunk-AUMNXFYQ.js.map +1 -0
  7. package/dist/{chunk-CJRH4PAV.js → chunk-LGW5SSLZ.js} +292 -61
  8. package/dist/chunk-LGW5SSLZ.js.map +1 -0
  9. package/dist/{chunk-EVQAI3P3.js → chunk-S24UVNPZ.js} +5 -1
  10. package/dist/{chunk-EVQAI3P3.js.map → chunk-S24UVNPZ.js.map} +1 -1
  11. package/dist/{index-BWo6qV_z.d.cts → index-BP1N8Yg7.d.cts} +2 -2
  12. package/dist/{index-BWo6qV_z.d.ts → index-BP1N8Yg7.d.ts} +2 -2
  13. package/dist/index.cjs +3882 -1366
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +428 -3798
  16. package/dist/index.d.ts +428 -3798
  17. package/dist/index.js +1373 -1498
  18. package/dist/index.js.map +1 -1
  19. package/dist/textEffects/index.cjs.map +1 -1
  20. package/dist/textEffects/index.js +1 -1
  21. package/dist/transitions/index.cjs +2207 -3
  22. package/dist/transitions/index.cjs.map +1 -1
  23. package/dist/transitions/index.d.cts +54 -5
  24. package/dist/transitions/index.d.ts +54 -5
  25. package/dist/transitions/index.js +53 -3
  26. package/dist/v2/backends/index.cjs +246 -33
  27. package/dist/v2/backends/index.cjs.map +1 -1
  28. package/dist/v2/backends/index.d.cts +1 -1
  29. package/dist/v2/backends/index.d.ts +1 -1
  30. package/dist/v2/backends/index.js +1 -1
  31. package/dist/videoEffects/index.cjs +287 -62
  32. package/dist/videoEffects/index.cjs.map +1 -1
  33. package/dist/videoEffects/index.d.cts +31 -134
  34. package/dist/videoEffects/index.d.ts +31 -134
  35. package/dist/videoEffects/index.js +1 -1
  36. package/package.json +2 -2
  37. package/dist/chunk-5JOAEDIQ.js +0 -446
  38. package/dist/chunk-5JOAEDIQ.js.map +0 -1
  39. package/dist/chunk-CJRH4PAV.js.map +0 -1
  40. package/dist/chunk-QMRMNH52.js +0 -811
  41. package/dist/chunk-QMRMNH52.js.map +0 -1
@@ -0,0 +1,2990 @@
1
+ // src/transitions/TransitionRenderer.ts
2
+ var TransitionRenderer = class {
3
+ /**
4
+ * Render a transition between two frames
5
+ *
6
+ * @param ctx - Canvas 2D context
7
+ * @param fromFrame - Canvas or image of the outgoing frame
8
+ * @param toFrame - Canvas or image of the incoming frame
9
+ * @param renderer - Transition type
10
+ * @param params - Transition parameters
11
+ * @param progress - Transition progress (0-1)
12
+ */
13
+ static render(ctx, fromFrame, toFrame, renderer, params, progress) {
14
+ const method = this.getRenderer(renderer);
15
+ if (method) {
16
+ const easedProgress = this.applyEasing(progress, params.easing || "ease-in-out");
17
+ method.call(this, ctx, fromFrame, toFrame, params, easedProgress);
18
+ } else {
19
+ console.warn(`Unknown transition renderer: ${renderer}`);
20
+ this.renderFade(ctx, fromFrame, toFrame, params, progress);
21
+ }
22
+ }
23
+ /**
24
+ * Get the renderer function for a transition type
25
+ */
26
+ static getRenderer(type) {
27
+ const renderers = {
28
+ // Basic
29
+ fade: this.renderFade,
30
+ dissolve: this.renderDissolve,
31
+ cut: this.renderCut,
32
+ canvas: this.renderFade,
33
+ // Legacy fallback for clypra app
34
+ // Zoom
35
+ zoom_in: this.renderZoomIn,
36
+ zoom_out: this.renderZoomOut,
37
+ zoom_blur: this.renderZoomBlur,
38
+ // Slide
39
+ slide_left: this.renderSlideLeft,
40
+ slide_right: this.renderSlideRight,
41
+ slide_up: this.renderSlideUp,
42
+ slide_down: this.renderSlideDown,
43
+ // Wipe
44
+ wipe_left: this.renderWipeLeft,
45
+ wipe_right: this.renderWipeRight,
46
+ wipe_up: this.renderWipeUp,
47
+ wipe_down: this.renderWipeDown,
48
+ wipe_clockwise: this.renderWipeClockwise,
49
+ wipe_center: this.renderWipeCenter,
50
+ // Shape
51
+ circle_expand: this.renderCircleExpand,
52
+ circle_collapse: this.renderCircleCollapse,
53
+ diamond_expand: this.renderDiamondExpand,
54
+ rectangle_expand: this.renderRectangleExpand,
55
+ // Blur
56
+ blur_fade: this.renderBlurFade,
57
+ directional_blur: this.renderDirectionalBlur,
58
+ // Creative
59
+ glitch: this.renderGlitch,
60
+ rgb_split: this.renderRGBSplit,
61
+ chromatic: this.renderChromatic,
62
+ film_burn: this.renderFilmBurn,
63
+ light_leak: this.renderLightLeak,
64
+ whip_pan: this.renderWhipPan
65
+ };
66
+ return renderers[type] || null;
67
+ }
68
+ // ============================================================================
69
+ // BASIC TRANSITIONS
70
+ // ============================================================================
71
+ static renderFade(ctx, from, to, params, progress) {
72
+ const width = ctx.canvas.width;
73
+ const height = ctx.canvas.height;
74
+ ctx.globalAlpha = 1 - progress;
75
+ ctx.drawImage(from, 0, 0, width, height);
76
+ ctx.globalAlpha = progress;
77
+ ctx.drawImage(to, 0, 0, width, height);
78
+ ctx.globalAlpha = 1;
79
+ }
80
+ static renderDissolve(ctx, from, to, params, progress) {
81
+ this.renderFade(ctx, from, to, params, progress);
82
+ }
83
+ static renderCut(ctx, from, to, params, progress) {
84
+ const width = ctx.canvas.width;
85
+ const height = ctx.canvas.height;
86
+ if (progress < 0.5) {
87
+ ctx.drawImage(from, 0, 0, width, height);
88
+ } else {
89
+ ctx.drawImage(to, 0, 0, width, height);
90
+ }
91
+ }
92
+ // ============================================================================
93
+ // ZOOM TRANSITIONS
94
+ // ============================================================================
95
+ static renderZoomIn(ctx, from, to, params, progress) {
96
+ const width = ctx.canvas.width;
97
+ const height = ctx.canvas.height;
98
+ const scale = params.scale || 1.3;
99
+ const fromScale = 1 + progress * (scale - 1);
100
+ ctx.save();
101
+ ctx.translate(width / 2, height / 2);
102
+ ctx.scale(fromScale, fromScale);
103
+ ctx.globalAlpha = 1 - progress;
104
+ ctx.drawImage(from, -width / 2, -height / 2, width, height);
105
+ ctx.restore();
106
+ ctx.globalAlpha = progress;
107
+ ctx.drawImage(to, 0, 0, width, height);
108
+ ctx.globalAlpha = 1;
109
+ }
110
+ static renderZoomOut(ctx, from, to, params, progress) {
111
+ const width = ctx.canvas.width;
112
+ const height = ctx.canvas.height;
113
+ const scale = params.scale || 0.7;
114
+ const fromScale = 1 - progress * (1 - scale);
115
+ ctx.save();
116
+ ctx.translate(width / 2, height / 2);
117
+ ctx.scale(fromScale, fromScale);
118
+ ctx.globalAlpha = 1 - progress;
119
+ ctx.drawImage(from, -width / 2, -height / 2, width, height);
120
+ ctx.restore();
121
+ ctx.globalAlpha = progress;
122
+ ctx.drawImage(to, 0, 0, width, height);
123
+ ctx.globalAlpha = 1;
124
+ }
125
+ static renderZoomBlur(ctx, from, to, params, progress) {
126
+ const blurAmount = (params.blurAmount || 10) * (1 - Math.abs(progress - 0.5) * 2);
127
+ ctx.filter = `blur(${blurAmount}px)`;
128
+ this.renderZoomIn(ctx, from, to, params, progress);
129
+ ctx.filter = "none";
130
+ }
131
+ // ============================================================================
132
+ // SLIDE TRANSITIONS
133
+ // ============================================================================
134
+ static renderSlideLeft(ctx, from, to, params, progress) {
135
+ const width = ctx.canvas.width;
136
+ const height = ctx.canvas.height;
137
+ ctx.drawImage(from, -width * progress, 0, width, height);
138
+ ctx.drawImage(to, width * (1 - progress), 0, width, height);
139
+ }
140
+ static renderSlideRight(ctx, from, to, params, progress) {
141
+ const width = ctx.canvas.width;
142
+ const height = ctx.canvas.height;
143
+ ctx.drawImage(from, width * progress, 0, width, height);
144
+ ctx.drawImage(to, -width * (1 - progress), 0, width, height);
145
+ }
146
+ static renderSlideUp(ctx, from, to, params, progress) {
147
+ const width = ctx.canvas.width;
148
+ const height = ctx.canvas.height;
149
+ ctx.drawImage(from, 0, -height * progress, width, height);
150
+ ctx.drawImage(to, 0, height * (1 - progress), width, height);
151
+ }
152
+ static renderSlideDown(ctx, from, to, params, progress) {
153
+ const width = ctx.canvas.width;
154
+ const height = ctx.canvas.height;
155
+ ctx.drawImage(from, 0, height * progress, width, height);
156
+ ctx.drawImage(to, 0, -height * (1 - progress), width, height);
157
+ }
158
+ // ============================================================================
159
+ // WIPE TRANSITIONS
160
+ // ============================================================================
161
+ static renderWipeLeft(ctx, from, to, params, progress) {
162
+ const width = ctx.canvas.width;
163
+ const height = ctx.canvas.height;
164
+ const wipeX = width * progress;
165
+ ctx.drawImage(from, 0, 0, width, height);
166
+ ctx.save();
167
+ ctx.beginPath();
168
+ ctx.rect(0, 0, wipeX, height);
169
+ ctx.clip();
170
+ ctx.drawImage(to, 0, 0, width, height);
171
+ ctx.restore();
172
+ }
173
+ static renderWipeRight(ctx, from, to, params, progress) {
174
+ const width = ctx.canvas.width;
175
+ const height = ctx.canvas.height;
176
+ const wipeX = width * (1 - progress);
177
+ ctx.drawImage(from, 0, 0, width, height);
178
+ ctx.save();
179
+ ctx.beginPath();
180
+ ctx.rect(wipeX, 0, width - wipeX, height);
181
+ ctx.clip();
182
+ ctx.drawImage(to, 0, 0, width, height);
183
+ ctx.restore();
184
+ }
185
+ static renderWipeUp(ctx, from, to, params, progress) {
186
+ const width = ctx.canvas.width;
187
+ const height = ctx.canvas.height;
188
+ const wipeY = height * progress;
189
+ ctx.drawImage(from, 0, 0, width, height);
190
+ ctx.save();
191
+ ctx.beginPath();
192
+ ctx.rect(0, 0, width, wipeY);
193
+ ctx.clip();
194
+ ctx.drawImage(to, 0, 0, width, height);
195
+ ctx.restore();
196
+ }
197
+ static renderWipeDown(ctx, from, to, params, progress) {
198
+ const width = ctx.canvas.width;
199
+ const height = ctx.canvas.height;
200
+ const wipeY = height * (1 - progress);
201
+ ctx.drawImage(from, 0, 0, width, height);
202
+ ctx.save();
203
+ ctx.beginPath();
204
+ ctx.rect(0, wipeY, width, height - wipeY);
205
+ ctx.clip();
206
+ ctx.drawImage(to, 0, 0, width, height);
207
+ ctx.restore();
208
+ }
209
+ static renderWipeClockwise(ctx, from, to, params, progress) {
210
+ const width = ctx.canvas.width;
211
+ const height = ctx.canvas.height;
212
+ const centerX = width / 2;
213
+ const centerY = height / 2;
214
+ const angle = progress * Math.PI * 2;
215
+ ctx.drawImage(from, 0, 0, width, height);
216
+ ctx.save();
217
+ ctx.beginPath();
218
+ ctx.moveTo(centerX, centerY);
219
+ ctx.arc(centerX, centerY, Math.max(width, height), -Math.PI / 2, angle - Math.PI / 2);
220
+ ctx.closePath();
221
+ ctx.clip();
222
+ ctx.drawImage(to, 0, 0, width, height);
223
+ ctx.restore();
224
+ }
225
+ static renderWipeCenter(ctx, from, to, params, progress) {
226
+ const width = ctx.canvas.width;
227
+ const height = ctx.canvas.height;
228
+ const centerX = width / 2;
229
+ const centerY = height / 2;
230
+ const radius = Math.max(width, height) * progress;
231
+ ctx.drawImage(from, 0, 0, width, height);
232
+ ctx.save();
233
+ ctx.beginPath();
234
+ ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
235
+ ctx.clip();
236
+ ctx.drawImage(to, 0, 0, width, height);
237
+ ctx.restore();
238
+ }
239
+ // ============================================================================
240
+ // SHAPE TRANSITIONS
241
+ // ============================================================================
242
+ static renderCircleExpand(ctx, from, to, params, progress) {
243
+ this.renderWipeCenter(ctx, from, to, params, progress);
244
+ }
245
+ static renderCircleCollapse(ctx, from, to, params, progress) {
246
+ this.renderWipeCenter(ctx, to, from, params, 1 - progress);
247
+ }
248
+ static renderDiamondExpand(ctx, from, to, params, progress) {
249
+ const width = ctx.canvas.width;
250
+ const height = ctx.canvas.height;
251
+ const centerX = width / 2;
252
+ const centerY = height / 2;
253
+ const size = Math.max(width, height) * progress;
254
+ ctx.drawImage(from, 0, 0, width, height);
255
+ ctx.save();
256
+ ctx.beginPath();
257
+ ctx.moveTo(centerX, centerY - size);
258
+ ctx.lineTo(centerX + size, centerY);
259
+ ctx.lineTo(centerX, centerY + size);
260
+ ctx.lineTo(centerX - size, centerY);
261
+ ctx.closePath();
262
+ ctx.clip();
263
+ ctx.drawImage(to, 0, 0, width, height);
264
+ ctx.restore();
265
+ }
266
+ static renderRectangleExpand(ctx, from, to, params, progress) {
267
+ const width = ctx.canvas.width;
268
+ const height = ctx.canvas.height;
269
+ const rectWidth = width * progress;
270
+ const rectHeight = height * progress;
271
+ const x = (width - rectWidth) / 2;
272
+ const y = (height - rectHeight) / 2;
273
+ ctx.drawImage(from, 0, 0, width, height);
274
+ ctx.save();
275
+ ctx.beginPath();
276
+ ctx.rect(x, y, rectWidth, rectHeight);
277
+ ctx.clip();
278
+ ctx.drawImage(to, 0, 0, width, height);
279
+ ctx.restore();
280
+ }
281
+ // ============================================================================
282
+ // BLUR TRANSITIONS
283
+ // ============================================================================
284
+ static renderBlurFade(ctx, from, to, params, progress) {
285
+ const blurAmount = (params.blurAmount || 10) * (1 - Math.abs(progress - 0.5) * 2);
286
+ ctx.filter = `blur(${blurAmount}px)`;
287
+ this.renderFade(ctx, from, to, params, progress);
288
+ ctx.filter = "none";
289
+ }
290
+ static renderDirectionalBlur(ctx, from, to, params, progress) {
291
+ this.renderBlurFade(ctx, from, to, params, progress);
292
+ }
293
+ // ============================================================================
294
+ // CREATIVE TRANSITIONS
295
+ // ============================================================================
296
+ static renderGlitch(ctx, from, to, params, progress) {
297
+ this.renderFade(ctx, from, to, params, progress);
298
+ const width = ctx.canvas.width;
299
+ const height = ctx.canvas.height;
300
+ const glitchIntensity = Math.sin(progress * Math.PI) * 20;
301
+ for (let i = 0; i < 5; i++) {
302
+ const y = Math.random() * height;
303
+ const sliceHeight = Math.random() * 20;
304
+ const offset = (Math.random() - 0.5) * glitchIntensity;
305
+ const imageData = ctx.getImageData(0, y, width, sliceHeight);
306
+ ctx.putImageData(imageData, offset, y);
307
+ }
308
+ }
309
+ static renderRGBSplit(ctx, from, to, params, progress) {
310
+ const offset = Math.sin(progress * Math.PI) * 10;
311
+ ctx.globalCompositeOperation = "screen";
312
+ ctx.globalAlpha = 0.5;
313
+ ctx.drawImage(from, offset, 0, ctx.canvas.width, ctx.canvas.height);
314
+ ctx.drawImage(to, -offset, 0, ctx.canvas.width, ctx.canvas.height);
315
+ ctx.globalAlpha = 1;
316
+ ctx.globalCompositeOperation = "source-over";
317
+ }
318
+ static renderChromatic(ctx, from, to, params, progress) {
319
+ this.renderRGBSplit(ctx, from, to, params, progress);
320
+ }
321
+ static renderFilmBurn(ctx, from, to, params, progress) {
322
+ this.renderFade(ctx, from, to, params, progress);
323
+ const intensity = Math.sin(progress * Math.PI);
324
+ ctx.fillStyle = `rgba(255, 200, 100, ${intensity * 0.5})`;
325
+ ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
326
+ }
327
+ static renderLightLeak(ctx, from, to, params, progress) {
328
+ this.renderFade(ctx, from, to, params, progress);
329
+ const gradient = ctx.createLinearGradient(0, 0, ctx.canvas.width, ctx.canvas.height);
330
+ const intensity = Math.sin(progress * Math.PI);
331
+ gradient.addColorStop(0, `rgba(255, 200, 100, ${intensity * 0.4})`);
332
+ gradient.addColorStop(1, "rgba(255, 200, 100, 0)");
333
+ ctx.globalCompositeOperation = "screen";
334
+ ctx.fillStyle = gradient;
335
+ ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
336
+ ctx.globalCompositeOperation = "source-over";
337
+ }
338
+ static renderWhipPan(ctx, from, to, params, progress) {
339
+ const blurAmount = Math.sin(progress * Math.PI) * 20;
340
+ ctx.filter = `blur(${blurAmount}px)`;
341
+ if (progress < 0.5) {
342
+ const offset = progress * ctx.canvas.width * 2;
343
+ ctx.drawImage(from, -offset, 0, ctx.canvas.width, ctx.canvas.height);
344
+ } else {
345
+ const offset = (1 - progress) * ctx.canvas.width * 2;
346
+ ctx.drawImage(to, offset, 0, ctx.canvas.width, ctx.canvas.height);
347
+ }
348
+ ctx.filter = "none";
349
+ }
350
+ // ============================================================================
351
+ // EASING FUNCTIONS
352
+ // ============================================================================
353
+ static applyEasing(t, easing = "linear") {
354
+ switch (easing) {
355
+ case "linear":
356
+ return t;
357
+ case "ease":
358
+ case "ease-in-out":
359
+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
360
+ case "ease-in":
361
+ return t * t;
362
+ case "ease-out":
363
+ return t * (2 - t);
364
+ case "ease-in-quad":
365
+ return t * t;
366
+ case "ease-out-quad":
367
+ return t * (2 - t);
368
+ case "ease-in-out-quad":
369
+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
370
+ case "ease-in-cubic":
371
+ return t * t * t;
372
+ case "ease-out-cubic":
373
+ return --t * t * t + 1;
374
+ case "ease-in-out-cubic":
375
+ return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
376
+ case "ease-in-quart":
377
+ return t * t * t * t;
378
+ case "ease-out-quart":
379
+ return 1 - --t * t * t * t;
380
+ case "ease-in-out-quart":
381
+ return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
382
+ case "spring":
383
+ return 1 - Math.cos(t * Math.PI * 2.5) * (1 - t);
384
+ case "bounce":
385
+ if (t < 1 / 2.75) {
386
+ return 7.5625 * t * t;
387
+ } else if (t < 2 / 2.75) {
388
+ return 7.5625 * (t -= 1.5 / 2.75) * t + 0.75;
389
+ } else if (t < 2.5 / 2.75) {
390
+ return 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375;
391
+ } else {
392
+ return 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
393
+ }
394
+ default:
395
+ return t;
396
+ }
397
+ }
398
+ };
399
+
400
+ // src/transitions/presets.ts
401
+ var TRANSITION_CATEGORIES = ["fade", "slide", "wipe", "zoom", "dissolve", "creative"];
402
+ var PRESETS_RAW = [
403
+ // ========== FADE ==========
404
+ {
405
+ id: "simple-fade",
406
+ name: "Simple Fade",
407
+ category: "fade",
408
+ description: "Classic crossfade - smooth opacity transition",
409
+ tags: ["basic", "smooth", "classic"],
410
+ defaultDuration: 1,
411
+ renderer: "fade",
412
+ params: {}
413
+ },
414
+ {
415
+ id: "fade-to-black",
416
+ name: "Fade to Black",
417
+ category: "fade",
418
+ description: "Fade out to black, then fade in from black",
419
+ tags: ["dramatic", "black", "film"],
420
+ defaultDuration: 1.5,
421
+ renderer: "fade",
422
+ params: {
423
+ color: "#000000"
424
+ }
425
+ },
426
+ {
427
+ id: "fade-to-white",
428
+ name: "Fade to White",
429
+ category: "fade",
430
+ description: "Bright flash transition through white",
431
+ tags: ["bright", "flash", "clean"],
432
+ defaultDuration: 1,
433
+ renderer: "fade",
434
+ params: {
435
+ color: "#FFFFFF"
436
+ }
437
+ },
438
+ {
439
+ id: "dissolve",
440
+ name: "Dissolve",
441
+ category: "dissolve",
442
+ description: "Smooth crossfade dissolution",
443
+ tags: ["smooth", "classic", "blend"],
444
+ defaultDuration: 1,
445
+ renderer: "dissolve",
446
+ params: {}
447
+ },
448
+ // ========== SLIDE ==========
449
+ {
450
+ id: "slide-left",
451
+ name: "Slide Left",
452
+ category: "slide",
453
+ description: "New clip slides in from right to left",
454
+ tags: ["directional", "smooth", "horizontal"],
455
+ defaultDuration: 0.8,
456
+ renderer: "slide_left",
457
+ params: {}
458
+ },
459
+ {
460
+ id: "slide-right",
461
+ name: "Slide Right",
462
+ category: "slide",
463
+ description: "New clip slides in from left to right",
464
+ tags: ["directional", "smooth", "horizontal"],
465
+ defaultDuration: 0.8,
466
+ renderer: "slide_right",
467
+ params: {}
468
+ },
469
+ {
470
+ id: "slide-up",
471
+ name: "Slide Up",
472
+ category: "slide",
473
+ description: "New clip slides in from bottom to top",
474
+ tags: ["directional", "smooth", "vertical"],
475
+ defaultDuration: 0.8,
476
+ renderer: "slide_up",
477
+ params: {}
478
+ },
479
+ {
480
+ id: "slide-down",
481
+ name: "Slide Down",
482
+ category: "slide",
483
+ description: "New clip slides in from top to bottom",
484
+ tags: ["directional", "smooth", "vertical"],
485
+ defaultDuration: 0.8,
486
+ renderer: "slide_down",
487
+ params: {}
488
+ },
489
+ // ========== WIPE ==========
490
+ {
491
+ id: "wipe-left",
492
+ name: "Wipe Left",
493
+ category: "wipe",
494
+ description: "Clean horizontal wipe from left",
495
+ tags: ["directional", "clean", "horizontal"],
496
+ defaultDuration: 0.9,
497
+ renderer: "wipe_left",
498
+ params: {}
499
+ },
500
+ {
501
+ id: "wipe-right",
502
+ name: "Wipe Right",
503
+ category: "wipe",
504
+ description: "Clean horizontal wipe from right",
505
+ tags: ["directional", "clean", "horizontal"],
506
+ defaultDuration: 0.9,
507
+ renderer: "wipe_right",
508
+ params: {}
509
+ },
510
+ {
511
+ id: "wipe-up",
512
+ name: "Wipe Up",
513
+ category: "wipe",
514
+ description: "Clean vertical wipe from bottom",
515
+ tags: ["directional", "clean", "vertical"],
516
+ defaultDuration: 0.9,
517
+ renderer: "wipe_up",
518
+ params: {}
519
+ },
520
+ {
521
+ id: "wipe-down",
522
+ name: "Wipe Down",
523
+ category: "wipe",
524
+ description: "Clean vertical wipe from top",
525
+ tags: ["directional", "clean", "vertical"],
526
+ defaultDuration: 0.9,
527
+ renderer: "wipe_down",
528
+ params: {}
529
+ },
530
+ {
531
+ id: "wipe-clockwise",
532
+ name: "Clock Wipe",
533
+ category: "wipe",
534
+ description: "Rotating clock hand wipe effect",
535
+ tags: ["radial", "rotating", "clock"],
536
+ defaultDuration: 1.2,
537
+ renderer: "wipe_clockwise",
538
+ params: {}
539
+ },
540
+ {
541
+ id: "wipe-center",
542
+ name: "Circle Wipe",
543
+ category: "wipe",
544
+ description: "Circular reveal from center outward",
545
+ tags: ["radial", "reveal", "circular"],
546
+ defaultDuration: 1,
547
+ renderer: "wipe_center",
548
+ params: {}
549
+ },
550
+ // ========== ZOOM ==========
551
+ {
552
+ id: "zoom-in",
553
+ name: "Zoom In",
554
+ category: "zoom",
555
+ description: "Outgoing clip zooms in while new clip fades in",
556
+ tags: ["scale", "dramatic", "zoom"],
557
+ defaultDuration: 1,
558
+ renderer: "zoom_in",
559
+ params: {
560
+ scale: 1.3
561
+ }
562
+ },
563
+ {
564
+ id: "zoom-out",
565
+ name: "Zoom Out",
566
+ category: "zoom",
567
+ description: "Outgoing clip zooms out while new clip fades in",
568
+ tags: ["scale", "reveal", "zoom"],
569
+ defaultDuration: 1,
570
+ renderer: "zoom_out",
571
+ params: {
572
+ scale: 0.7
573
+ }
574
+ },
575
+ {
576
+ id: "zoom-blur",
577
+ name: "Zoom with Blur",
578
+ category: "zoom",
579
+ description: "Fast zoom with motion blur for energy",
580
+ tags: ["fast", "blur", "energy"],
581
+ defaultDuration: 0.6,
582
+ renderer: "zoom_blur",
583
+ params: {
584
+ scale: 1.3,
585
+ blurAmount: 12
586
+ }
587
+ },
588
+ // ========== SHAPE ==========
589
+ {
590
+ id: "circle-expand",
591
+ name: "Circle Expand",
592
+ category: "wipe",
593
+ description: "New clip expands from center in a circle",
594
+ tags: ["radial", "expand", "circle"],
595
+ defaultDuration: 1,
596
+ renderer: "circle_expand",
597
+ params: {}
598
+ },
599
+ {
600
+ id: "circle-collapse",
601
+ name: "Circle Collapse",
602
+ category: "wipe",
603
+ description: "Old clip collapses to center in a circle",
604
+ tags: ["radial", "collapse", "circle"],
605
+ defaultDuration: 1,
606
+ renderer: "circle_collapse",
607
+ params: {}
608
+ },
609
+ {
610
+ id: "diamond-expand",
611
+ name: "Diamond Expand",
612
+ category: "wipe",
613
+ description: "New clip expands from center in a diamond shape",
614
+ tags: ["geometric", "expand", "diamond"],
615
+ defaultDuration: 1,
616
+ renderer: "diamond_expand",
617
+ params: {}
618
+ },
619
+ {
620
+ id: "rectangle-expand",
621
+ name: "Rectangle Expand",
622
+ category: "wipe",
623
+ description: "New clip expands from center in a rectangle",
624
+ tags: ["geometric", "expand", "rectangle"],
625
+ defaultDuration: 1,
626
+ renderer: "rectangle_expand",
627
+ params: {}
628
+ },
629
+ // ========== BLUR ==========
630
+ {
631
+ id: "blur-fade",
632
+ name: "Blur Fade",
633
+ category: "creative",
634
+ description: "Dreamy fade with motion blur effect",
635
+ tags: ["blur", "dreamy", "soft"],
636
+ defaultDuration: 1.2,
637
+ renderer: "blur_fade",
638
+ params: {
639
+ blurAmount: 15
640
+ }
641
+ },
642
+ {
643
+ id: "directional-blur",
644
+ name: "Directional Blur",
645
+ category: "creative",
646
+ description: "Fade with directional motion blur",
647
+ tags: ["blur", "motion", "directional"],
648
+ defaultDuration: 1,
649
+ renderer: "directional_blur",
650
+ params: {
651
+ blurAmount: 12
652
+ }
653
+ },
654
+ // ========== CREATIVE ==========
655
+ {
656
+ id: "glitch",
657
+ name: "Glitch",
658
+ category: "creative",
659
+ description: "Digital glitch transition with artifacts",
660
+ tags: ["glitch", "digital", "distortion"],
661
+ defaultDuration: 0.8,
662
+ renderer: "glitch",
663
+ params: {}
664
+ },
665
+ {
666
+ id: "rgb-split",
667
+ name: "RGB Split",
668
+ category: "creative",
669
+ description: "Chromatic aberration RGB channel split",
670
+ tags: ["chromatic", "rgb", "split"],
671
+ defaultDuration: 0.7,
672
+ renderer: "rgb_split",
673
+ params: {}
674
+ },
675
+ {
676
+ id: "chromatic",
677
+ name: "Chromatic",
678
+ category: "creative",
679
+ description: "Chromatic aberration effect",
680
+ tags: ["chromatic", "aberration", "color"],
681
+ defaultDuration: 0.8,
682
+ renderer: "chromatic",
683
+ params: {}
684
+ },
685
+ {
686
+ id: "film-burn",
687
+ name: "Film Burn",
688
+ category: "creative",
689
+ description: "Vintage film burn effect",
690
+ tags: ["film", "burn", "vintage"],
691
+ defaultDuration: 1.2,
692
+ renderer: "film_burn",
693
+ params: {}
694
+ },
695
+ {
696
+ id: "light-leak",
697
+ name: "Light Leak",
698
+ category: "creative",
699
+ description: "Light leak overlay transition",
700
+ tags: ["light", "leak", "vintage"],
701
+ defaultDuration: 1,
702
+ renderer: "light_leak",
703
+ params: {}
704
+ },
705
+ {
706
+ id: "whip-pan",
707
+ name: "Whip Pan",
708
+ category: "creative",
709
+ description: "Fast whip pan with motion blur",
710
+ tags: ["whip", "fast", "blur"],
711
+ defaultDuration: 0.5,
712
+ renderer: "whip_pan",
713
+ params: {}
714
+ },
715
+ // ========== BASIC (for compatibility) ==========
716
+ {
717
+ id: "cut",
718
+ name: "Cut",
719
+ category: "fade",
720
+ description: "Instant cut (no transition)",
721
+ tags: ["instant", "cut", "basic"],
722
+ defaultDuration: 0,
723
+ renderer: "cut",
724
+ params: {}
725
+ }
726
+ ];
727
+ var TRANSITION_PRESETS = PRESETS_RAW.map((p) => ({
728
+ ...p,
729
+ defaultDurationMs: Math.round(p.defaultDuration * 1e3)
730
+ }));
731
+
732
+ // src/transitions/helpers.ts
733
+ function getTransitionCategories() {
734
+ return [...TRANSITION_CATEGORIES];
735
+ }
736
+ function getTransitionsByCategory(category) {
737
+ return TRANSITION_PRESETS.filter((preset) => preset.category === category);
738
+ }
739
+ function searchTransitions(query) {
740
+ if (!query || query.trim() === "") {
741
+ return TRANSITION_PRESETS;
742
+ }
743
+ const lowerQuery = query.toLowerCase().trim();
744
+ return TRANSITION_PRESETS.filter((preset) => {
745
+ if (preset.name.toLowerCase().includes(lowerQuery)) {
746
+ return true;
747
+ }
748
+ if (preset.description.toLowerCase().includes(lowerQuery)) {
749
+ return true;
750
+ }
751
+ if (preset.tags.some((tag) => tag.toLowerCase().includes(lowerQuery))) {
752
+ return true;
753
+ }
754
+ if (preset.renderer.toLowerCase().includes(lowerQuery)) {
755
+ return true;
756
+ }
757
+ return false;
758
+ });
759
+ }
760
+ function getTransitionById(id) {
761
+ return TRANSITION_PRESETS.find((preset) => preset.id === id);
762
+ }
763
+ function getTransitionByRenderer(renderer) {
764
+ return TRANSITION_PRESETS.find((preset) => preset.renderer === renderer);
765
+ }
766
+ function getAllTransitions() {
767
+ return [...TRANSITION_PRESETS];
768
+ }
769
+ function getTransitionCountByCategory() {
770
+ const counts = {};
771
+ for (const category of TRANSITION_CATEGORIES) {
772
+ counts[category] = getTransitionsByCategory(category).length;
773
+ }
774
+ return counts;
775
+ }
776
+ function getAllTransitionTags() {
777
+ const tagsSet = /* @__PURE__ */ new Set();
778
+ for (const preset of TRANSITION_PRESETS) {
779
+ for (const tag of preset.tags) {
780
+ tagsSet.add(tag);
781
+ }
782
+ }
783
+ return Array.from(tagsSet).sort();
784
+ }
785
+ function getTransitionsByTags(tags) {
786
+ if (tags.length === 0) {
787
+ return TRANSITION_PRESETS;
788
+ }
789
+ const lowerTags = tags.map((tag) => tag.toLowerCase());
790
+ return TRANSITION_PRESETS.filter((preset) => {
791
+ const presetTags = preset.tags.map((tag) => tag.toLowerCase());
792
+ return lowerTags.every((tag) => presetTags.includes(tag));
793
+ });
794
+ }
795
+ function getRecommendedDuration(presetId) {
796
+ const preset = getTransitionById(presetId);
797
+ return preset?.defaultDuration ?? 1;
798
+ }
799
+
800
+ // src/effects/transitions/geometric/PushTransition.ts
801
+ import { Filter } from "pixi.js";
802
+
803
+ // src/effects/transitions/defaultVertexShader.ts
804
+ var defaultVertexShader = `
805
+ in vec2 aPosition;
806
+ out vec2 vTextureCoord;
807
+ out vec2 vNormalizedCoord;
808
+
809
+ uniform vec4 uInputSize;
810
+ uniform vec4 uOutputFrame;
811
+ uniform vec4 uOutputTexture;
812
+
813
+ vec4 filterVertexPosition(void) {
814
+ vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
815
+ position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
816
+ position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
817
+ return vec4(position, 0.0, 1.0);
818
+ }
819
+
820
+ vec2 filterTextureCoord(void) {
821
+ return aPosition * (uOutputFrame.zw * uInputSize.zw);
822
+ }
823
+
824
+ void main(void) {
825
+ gl_Position = filterVertexPosition();
826
+ vTextureCoord = filterTextureCoord();
827
+ vNormalizedCoord = aPosition;
828
+ }
829
+ `;
830
+
831
+ // src/effects/transitions/geometric/PushTransition.ts
832
+ var fragment = `
833
+ in vec2 vNormalizedCoord;
834
+ out vec4 finalColor;
835
+
836
+ uniform sampler2D uFrom;
837
+ uniform sampler2D uTo;
838
+ uniform float uProgress;
839
+ uniform float uDirection; // 0=left, 1=right, 2=up, 3=down
840
+ uniform float uEasing; // 0=linear, 1=easeIn, 2=easeOut, 3=easeInOut
841
+
842
+ // Easing functions
843
+ float easeIn(float t) {
844
+ return t * t;
845
+ }
846
+
847
+ float easeOut(float t) {
848
+ return t * (2.0 - t);
849
+ }
850
+
851
+ float easeInOut(float t) {
852
+ return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
853
+ }
854
+
855
+ float applyEasing(float t, float easingType) {
856
+ if (easingType < 0.5) return t; // linear
857
+ if (easingType < 1.5) return easeIn(t);
858
+ if (easingType < 2.5) return easeOut(t);
859
+ return easeInOut(t);
860
+ }
861
+
862
+ void main() {
863
+ float t = applyEasing(uProgress, uEasing);
864
+ vec2 uv = vNormalizedCoord;
865
+
866
+ // Calculate offset based on direction
867
+ vec2 offsetFrom = vec2(0.0);
868
+ vec2 offsetTo = vec2(0.0);
869
+
870
+ if (uDirection < 0.5) {
871
+ // Push left
872
+ offsetFrom = vec2(-t, 0.0);
873
+ offsetTo = vec2(1.0 - t, 0.0);
874
+ } else if (uDirection < 1.5) {
875
+ // Push right
876
+ offsetFrom = vec2(t, 0.0);
877
+ offsetTo = vec2(-1.0 + t, 0.0);
878
+ } else if (uDirection < 2.5) {
879
+ // Push up
880
+ offsetFrom = vec2(0.0, -t);
881
+ offsetTo = vec2(0.0, 1.0 - t);
882
+ } else {
883
+ // Push down
884
+ offsetFrom = vec2(0.0, t);
885
+ offsetTo = vec2(0.0, -1.0 + t);
886
+ }
887
+
888
+ vec2 uvFrom = uv + offsetFrom;
889
+ vec2 uvTo = uv + offsetTo;
890
+
891
+ vec4 color;
892
+
893
+ // Check which clip is visible at this UV coordinate
894
+ if (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0) {
895
+ color = texture(uFrom, uvFrom);
896
+ } else if (uvTo.x >= 0.0 && uvTo.x <= 1.0 && uvTo.y >= 0.0 && uvTo.y <= 1.0) {
897
+ color = texture(uTo, uvTo);
898
+ } else {
899
+ color = vec4(0.0, 0.0, 0.0, 1.0);
900
+ }
901
+
902
+ finalColor = color;
903
+ }
904
+ `;
905
+ var PushTransition = {
906
+ id: "push",
907
+ name: "Push",
908
+ category: "geometric",
909
+ description: "One clip pushes the other off screen in a configurable direction.",
910
+ tags: ["push", "slide", "spatial", "directional"],
911
+ defaultDurationMs: 800,
912
+ params: [
913
+ { key: "direction", label: "Direction", type: "select", value: "left", options: ["left", "right", "up", "down"] },
914
+ { key: "easing", label: "Easing", type: "select", value: "easeInOut", options: ["linear", "easeIn", "easeOut", "easeInOut"] }
915
+ ],
916
+ create(params) {
917
+ const dirStr = params.direction || "left";
918
+ const dirVal = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
919
+ const easeStr = params.easing || "easeInOut";
920
+ const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
921
+ return Filter.from({
922
+ gl: { vertex: defaultVertexShader, fragment },
923
+ resources: {
924
+ transitionUniforms: {
925
+ uProgress: { value: 0, type: "f32" },
926
+ uDirection: { value: dirVal, type: "f32" },
927
+ uEasing: { value: easeVal, type: "f32" }
928
+ }
929
+ }
930
+ });
931
+ },
932
+ updateProgress(filter, progress, params) {
933
+ const u = filter.resources?.transitionUniforms?.uniforms;
934
+ if (u) {
935
+ u.uProgress = progress;
936
+ const dirStr = params.direction || "left";
937
+ u.uDirection = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
938
+ const easeStr = params.easing || "easeInOut";
939
+ u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
940
+ }
941
+ }
942
+ };
943
+
944
+ // src/effects/transitions/geometric/IrisRevealTransition.ts
945
+ import { Filter as Filter2 } from "pixi.js";
946
+ var fragment2 = `
947
+ in vec2 vNormalizedCoord;
948
+ out vec4 finalColor;
949
+
950
+ uniform sampler2D uFrom;
951
+ uniform sampler2D uTo;
952
+ uniform float uProgress;
953
+ uniform vec2 uCenter;
954
+ uniform float uEdgeSoftness;
955
+ uniform float uShape; // 0 = circle, 1 = square, 2 = hexagon
956
+
957
+ float sdCircle(vec2 p, float r) {
958
+ return length(p) - r;
959
+ }
960
+
961
+ float sdSquare(vec2 p, float r) {
962
+ vec2 d = abs(p) - r;
963
+ return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
964
+ }
965
+
966
+ float sdHexagon(vec2 p, float r) {
967
+ const vec3 k = vec3(-0.866025404, 0.5, 0.577350269);
968
+ p = abs(p);
969
+ p -= 2.0 * min(dot(k.xy, p), 0.0) * k.xy;
970
+ p -= vec2(clamp(p.x, -k.z * r, k.z * r), r);
971
+ return length(p) * sign(p.y);
972
+ }
973
+
974
+ void main(void) {
975
+ vec2 uv = vNormalizedCoord;
976
+ vec4 fromColor = texture(uFrom, uv);
977
+ vec4 toColor = texture(uTo, uv);
978
+
979
+ vec2 p = uv - uCenter;
980
+ float r = uProgress * 1.0; // Scaled radius to fully cover screen
981
+
982
+ float dist = 0.0;
983
+ if (uShape < 0.5) {
984
+ dist = sdCircle(p, r);
985
+ } else if (uShape < 1.5) {
986
+ dist = sdSquare(p, r);
987
+ } else {
988
+ dist = sdHexagon(p, r);
989
+ }
990
+
991
+ float mask = smoothstep(uEdgeSoftness, 0.0, dist);
992
+ finalColor = mix(fromColor, toColor, mask);
993
+ }
994
+ `;
995
+ var IrisRevealTransition = {
996
+ id: "iris-reveal",
997
+ name: "Iris Reveal",
998
+ category: "geometric",
999
+ description: "A circular, square, or hexagonal mask expands from a center point to reveal the incoming clip.",
1000
+ tags: ["mask", "geometric", "radial", "reveal"],
1001
+ defaultDurationMs: 800,
1002
+ params: [
1003
+ { key: "centerX", label: "Center X", type: "range", value: 0.5, min: 0, max: 1, step: 0.01 },
1004
+ { key: "centerY", label: "Center Y", type: "range", value: 0.5, min: 0, max: 1, step: 0.01 },
1005
+ { key: "edgeSoftness", label: "Edge Softness", type: "range", value: 0.05, min: 0, max: 0.2, step: 0.01 },
1006
+ { key: "shape", label: "Shape", type: "select", value: "circle", options: ["circle", "square", "hexagon"] }
1007
+ ],
1008
+ create(params) {
1009
+ const shapeStr = params.shape || "circle";
1010
+ const shapeVal = shapeStr === "circle" ? 0 : shapeStr === "square" ? 1 : 2;
1011
+ return Filter2.from({
1012
+ gl: { vertex: defaultVertexShader, fragment: fragment2 },
1013
+ resources: {
1014
+ transitionUniforms: {
1015
+ uProgress: { value: 0, type: "f32" },
1016
+ uCenter: { value: [params.centerX ?? 0.5, params.centerY ?? 0.5], type: "vec2<f32>" },
1017
+ uEdgeSoftness: { value: params.edgeSoftness ?? 0.05, type: "f32" },
1018
+ uShape: { value: shapeVal, type: "f32" }
1019
+ }
1020
+ }
1021
+ });
1022
+ },
1023
+ updateProgress(filter, progress, params) {
1024
+ const u = filter.resources?.transitionUniforms?.uniforms;
1025
+ if (u) {
1026
+ u.uProgress = progress;
1027
+ u.uCenter = [params.centerX ?? 0.5, params.centerY ?? 0.5];
1028
+ u.uEdgeSoftness = params.edgeSoftness ?? 0.05;
1029
+ const shapeStr = params.shape || "circle";
1030
+ u.uShape = shapeStr === "circle" ? 0 : shapeStr === "square" ? 1 : 2;
1031
+ }
1032
+ }
1033
+ };
1034
+
1035
+ // src/effects/transitions/geometric/FoldTurnTransition.ts
1036
+ import { Filter as Filter3 } from "pixi.js";
1037
+ var fragment3 = `
1038
+ in vec2 vNormalizedCoord;
1039
+ out vec4 finalColor;
1040
+
1041
+ uniform sampler2D uFrom;
1042
+ uniform sampler2D uTo;
1043
+ uniform float uProgress;
1044
+ uniform float uFoldDirection; // 0=left, 1=right, 2=top, 3=bottom
1045
+ uniform float uShadowIntensity;
1046
+
1047
+ void main(void) {
1048
+ vec2 uv = vNormalizedCoord;
1049
+ vec4 toColor = texture(uTo, uv);
1050
+
1051
+ vec4 color = toColor; // Default to incoming showing behind
1052
+ float shadow = 0.0;
1053
+
1054
+ if (uFoldDirection < 0.5) {
1055
+ // Left
1056
+ float split = 1.0 - uProgress;
1057
+ if (uv.x < split) {
1058
+ vec2 foldUv = vec2(uv.x / max(split, 0.001), uv.y);
1059
+ color = texture(uFrom, foldUv);
1060
+ shadow = smoothstep(split - 0.1, split, uv.x) * uShadowIntensity;
1061
+ color.rgb = mix(color.rgb, vec3(0.0), shadow);
1062
+ }
1063
+ } else if (uFoldDirection < 1.5) {
1064
+ // Right
1065
+ float split = uProgress;
1066
+ if (uv.x > split) {
1067
+ vec2 foldUv = vec2((uv.x - split) / max(1.0 - split, 0.001), uv.y);
1068
+ color = texture(uFrom, foldUv);
1069
+ shadow = smoothstep(split + 0.1, split, uv.x) * uShadowIntensity;
1070
+ color.rgb = mix(color.rgb, vec3(0.0), shadow);
1071
+ }
1072
+ } else if (uFoldDirection < 2.5) {
1073
+ // Top
1074
+ float split = 1.0 - uProgress;
1075
+ if (uv.y < split) {
1076
+ vec2 foldUv = vec2(uv.x, uv.y / max(split, 0.001));
1077
+ color = texture(uFrom, foldUv);
1078
+ shadow = smoothstep(split - 0.1, split, uv.y) * uShadowIntensity;
1079
+ color.rgb = mix(color.rgb, vec3(0.0), shadow);
1080
+ }
1081
+ } else {
1082
+ // Bottom
1083
+ float split = uProgress;
1084
+ if (uv.y > split) {
1085
+ vec2 foldUv = vec2(uv.x, (uv.y - split) / max(1.0 - split, 0.001));
1086
+ color = texture(uFrom, foldUv);
1087
+ shadow = smoothstep(split + 0.1, split, uv.y) * uShadowIntensity;
1088
+ color.rgb = mix(color.rgb, vec3(0.0), shadow);
1089
+ }
1090
+ }
1091
+
1092
+ finalColor = color;
1093
+ }
1094
+ `;
1095
+ var FoldTurnTransition = {
1096
+ id: "fold-turn",
1097
+ name: "Fold Turn",
1098
+ category: "geometric",
1099
+ description: "The outgoing clip skews away like a folding page, revealing the incoming clip with edge shadow depth.",
1100
+ tags: ["page", "fold", "geometric", "skew", "depth"],
1101
+ defaultDurationMs: 900,
1102
+ params: [
1103
+ { key: "foldDirection", label: "Fold Direction", type: "select", value: "left", options: ["left", "right", "top", "bottom"] },
1104
+ { key: "shadowIntensity", label: "Shadow Intensity", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
1105
+ ],
1106
+ create(params) {
1107
+ const dirStr = params.foldDirection || "left";
1108
+ const dirVal = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "top" ? 2 : 3;
1109
+ return Filter3.from({
1110
+ gl: { vertex: defaultVertexShader, fragment: fragment3 },
1111
+ resources: {
1112
+ transitionUniforms: {
1113
+ uProgress: { value: 0, type: "f32" },
1114
+ uFoldDirection: { value: dirVal, type: "f32" },
1115
+ uShadowIntensity: { value: params.shadowIntensity ?? 0.5, type: "f32" }
1116
+ }
1117
+ }
1118
+ });
1119
+ },
1120
+ updateProgress(filter, progress, params) {
1121
+ const u = filter.resources?.transitionUniforms?.uniforms;
1122
+ if (u) {
1123
+ u.uProgress = progress;
1124
+ const dirStr = params.foldDirection || "left";
1125
+ u.uFoldDirection = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "top" ? 2 : 3;
1126
+ u.uShadowIntensity = params.shadowIntensity ?? 0.5;
1127
+ }
1128
+ }
1129
+ };
1130
+
1131
+ // src/effects/transitions/optical-distortion/ZoomTransition.ts
1132
+ import { Filter as Filter4 } from "pixi.js";
1133
+ var fragment4 = `
1134
+ in vec2 vNormalizedCoord;
1135
+ out vec4 finalColor;
1136
+
1137
+ uniform sampler2D uFrom;
1138
+ uniform sampler2D uTo;
1139
+ uniform float uProgress;
1140
+ uniform float uDirection; // 0=in, 1=out
1141
+ uniform float uIntensity;
1142
+ uniform float uEasing;
1143
+ uniform float uBlur;
1144
+
1145
+ // Easing functions
1146
+ float easeIn(float t) {
1147
+ return t * t;
1148
+ }
1149
+
1150
+ float easeOut(float t) {
1151
+ return t * (2.0 - t);
1152
+ }
1153
+
1154
+ float easeInOut(float t) {
1155
+ return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
1156
+ }
1157
+
1158
+ float applyEasing(float t, float easingType) {
1159
+ if (easingType < 0.5) return t; // linear
1160
+ if (easingType < 1.5) return easeIn(t);
1161
+ if (easingType < 2.5) return easeOut(t);
1162
+ return easeInOut(t);
1163
+ }
1164
+
1165
+ vec4 sampleWithBlur(sampler2D tex, vec2 uv, float blurAmount) {
1166
+ if (uBlur < 0.5 || blurAmount < 0.01) {
1167
+ return texture(tex, uv);
1168
+ }
1169
+
1170
+ // Simple 5-tap blur
1171
+ vec4 color = vec4(0.0);
1172
+ float offset = blurAmount * 0.01;
1173
+
1174
+ color += texture(tex, uv) * 0.4;
1175
+ color += texture(tex, uv + vec2(offset, 0.0)) * 0.15;
1176
+ color += texture(tex, uv - vec2(offset, 0.0)) * 0.15;
1177
+ color += texture(tex, uv + vec2(0.0, offset)) * 0.15;
1178
+ color += texture(tex, uv - vec2(0.0, offset)) * 0.15;
1179
+
1180
+ return color;
1181
+ }
1182
+
1183
+ void main() {
1184
+ float t = applyEasing(uProgress, uEasing);
1185
+ vec2 center = vec2(0.5, 0.5);
1186
+
1187
+ // Calculate zoom scales
1188
+ float scaleA, scaleB;
1189
+
1190
+ if (uDirection < 0.5) {
1191
+ // Zoom in: A shrinks, B grows from small
1192
+ scaleA = 1.0 + t * uIntensity;
1193
+ scaleB = 1.0 - (1.0 - t) * uIntensity;
1194
+ } else {
1195
+ // Zoom out: A grows, B shrinks to small
1196
+ scaleA = 1.0 - t * uIntensity * 0.5;
1197
+ scaleB = 1.0 + (1.0 - t) * uIntensity;
1198
+ }
1199
+
1200
+ // Apply zoom
1201
+ vec2 uvA = (vNormalizedCoord - center) / scaleA + center;
1202
+ vec2 uvB = (vNormalizedCoord - center) / scaleB + center;
1203
+
1204
+ // Blur amount based on zoom speed
1205
+ float blurAmountA = abs(scaleA - 1.0) * 2.0;
1206
+ float blurAmountB = abs(scaleB - 1.0) * 2.0;
1207
+
1208
+ // Sample with optional blur
1209
+ vec4 colorA = sampleWithBlur(uFrom, uvA, blurAmountA);
1210
+ vec4 colorB = sampleWithBlur(uTo, uvB, blurAmountB);
1211
+
1212
+ // Handle out-of-bounds UVs
1213
+ if (uvA.x < 0.0 || uvA.x > 1.0 || uvA.y < 0.0 || uvA.y > 1.0) {
1214
+ colorA = vec4(0.0);
1215
+ }
1216
+ if (uvB.x < 0.0 || uvB.x > 1.0 || uvB.y < 0.0 || uvB.y > 1.0) {
1217
+ colorB = vec4(0.0);
1218
+ }
1219
+
1220
+ // Blend
1221
+ finalColor = mix(colorA, colorB, t);
1222
+ }
1223
+ `;
1224
+ var ZoomTransition = {
1225
+ id: "zoom",
1226
+ name: "Zoom",
1227
+ category: "optical-distortion",
1228
+ description: "Zoom in or out while transitioning between clips with dynamic scaling and motion blur.",
1229
+ tags: ["zoom", "scale", "dynamic", "motion"],
1230
+ defaultDurationMs: 800,
1231
+ params: [
1232
+ { key: "direction", label: "Direction", type: "select", value: "in", options: ["in", "out"] },
1233
+ { key: "intensity", label: "Intensity", type: "range", value: 0.5, min: 0, max: 2, step: 0.1 },
1234
+ { key: "easing", label: "Easing", type: "select", value: "easeInOut", options: ["linear", "easeIn", "easeOut", "easeInOut"] },
1235
+ { key: "blur", label: "Motion Blur", type: "toggle", value: true }
1236
+ ],
1237
+ create(params) {
1238
+ const dirStr = params.direction || "in";
1239
+ const dirVal = dirStr === "in" ? 0 : 1;
1240
+ const easeStr = params.easing || "easeInOut";
1241
+ const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
1242
+ const blurVal = params.blur ?? true ? 1 : 0;
1243
+ return Filter4.from({
1244
+ gl: { vertex: defaultVertexShader, fragment: fragment4 },
1245
+ resources: {
1246
+ transitionUniforms: {
1247
+ uProgress: { value: 0, type: "f32" },
1248
+ uDirection: { value: dirVal, type: "f32" },
1249
+ uIntensity: { value: params.intensity ?? 0.5, type: "f32" },
1250
+ uEasing: { value: easeVal, type: "f32" },
1251
+ uBlur: { value: blurVal, type: "f32" }
1252
+ }
1253
+ }
1254
+ });
1255
+ },
1256
+ updateProgress(filter, progress, params) {
1257
+ const u = filter.resources?.transitionUniforms?.uniforms;
1258
+ if (u) {
1259
+ u.uProgress = progress;
1260
+ const dirStr = params.direction || "in";
1261
+ u.uDirection = dirStr === "in" ? 0 : 1;
1262
+ u.uIntensity = params.intensity ?? 0.5;
1263
+ const easeStr = params.easing || "easeInOut";
1264
+ u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
1265
+ u.uBlur = params.blur ?? true ? 1 : 0;
1266
+ }
1267
+ }
1268
+ };
1269
+
1270
+ // src/effects/transitions/optical-distortion/ChromaticPushTransition.ts
1271
+ import { Filter as Filter5 } from "pixi.js";
1272
+ var fragment5 = `
1273
+ in vec2 vNormalizedCoord;
1274
+ out vec4 finalColor;
1275
+
1276
+ uniform sampler2D uFrom;
1277
+ uniform sampler2D uTo;
1278
+ uniform float uProgress;
1279
+ uniform float uDirection; // 0=left, 1=right, 2=up, 3=down
1280
+ uniform float uSplitIntensity;
1281
+
1282
+ vec4 sampleChannel(sampler2D texA, sampler2D texB, vec2 baseUv, vec2 pushA, vec2 pushB, vec2 channelShift) {
1283
+ vec2 uvA = baseUv + pushA + channelShift;
1284
+ vec2 uvB = baseUv + pushB + channelShift;
1285
+
1286
+ if (uvA.x >= 0.0 && uvA.x <= 1.0 && uvA.y >= 0.0 && uvA.y <= 1.0) {
1287
+ return texture(texA, uvA);
1288
+ } else if (uvB.x >= 0.0 && uvB.x <= 1.0 && uvB.y >= 0.0 && uvB.y <= 1.0) {
1289
+ return texture(texB, uvB);
1290
+ }
1291
+ return vec4(0.0, 0.0, 0.0, 1.0);
1292
+ }
1293
+
1294
+ void main(void) {
1295
+ vec2 uv = vNormalizedCoord;
1296
+
1297
+ // Slide/push offset
1298
+ vec2 offsetFrom = vec2(0.0);
1299
+ vec2 offsetTo = vec2(0.0);
1300
+
1301
+ if (uDirection < 0.5) {
1302
+ // Left
1303
+ offsetFrom = vec2(-uProgress, 0.0);
1304
+ offsetTo = vec2(1.0 - uProgress, 0.0);
1305
+ } else if (uDirection < 1.5) {
1306
+ // Right
1307
+ offsetFrom = vec2(uProgress, 0.0);
1308
+ offsetTo = vec2(-1.0 + uProgress, 0.0);
1309
+ } else if (uDirection < 2.5) {
1310
+ // Up
1311
+ offsetFrom = vec2(0.0, -uProgress);
1312
+ offsetTo = vec2(0.0, 1.0 - uProgress);
1313
+ } else {
1314
+ // Down
1315
+ offsetFrom = vec2(0.0, uProgress);
1316
+ offsetTo = vec2(0.0, -1.0 + uProgress);
1317
+ }
1318
+
1319
+ // Chromatic split offset (peaks at progress = 0.5)
1320
+ float splitOffset = sin(uProgress * 3.14159265) * uSplitIntensity * 0.005;
1321
+
1322
+ float r = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(splitOffset, 0.0)).r;
1323
+ float g = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(0.0, 0.0)).g;
1324
+ float b = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(-splitOffset, 0.0)).b;
1325
+ float a = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(0.0, 0.0)).a;
1326
+
1327
+ finalColor = vec4(r, g, b, a);
1328
+ }
1329
+ `;
1330
+ var ChromaticPushTransition = {
1331
+ id: "chromatic-push",
1332
+ name: "Chromatic Push",
1333
+ category: "optical-distortion",
1334
+ description: "A spatial push transition where R/G/B channels split and offset horizontally, peaking mid-transition.",
1335
+ tags: ["chromatic", "push", "glitch", "distortion", "split"],
1336
+ defaultDurationMs: 800,
1337
+ params: [
1338
+ { key: "direction", label: "Direction", type: "select", value: "left", options: ["left", "right", "up", "down"] },
1339
+ { key: "splitIntensity", label: "Split Intensity", type: "range", value: 8, min: 0, max: 20, step: 0.5 }
1340
+ ],
1341
+ create(params) {
1342
+ const dirStr = params.direction || "left";
1343
+ const dirVal = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
1344
+ return Filter5.from({
1345
+ gl: { vertex: defaultVertexShader, fragment: fragment5 },
1346
+ resources: {
1347
+ transitionUniforms: {
1348
+ uProgress: { value: 0, type: "f32" },
1349
+ uDirection: { value: dirVal, type: "f32" },
1350
+ uSplitIntensity: { value: params.splitIntensity ?? 8, type: "f32" }
1351
+ }
1352
+ }
1353
+ });
1354
+ },
1355
+ updateProgress(filter, progress, params) {
1356
+ const u = filter.resources?.transitionUniforms?.uniforms;
1357
+ if (u) {
1358
+ u.uProgress = progress;
1359
+ const dirStr = params.direction || "left";
1360
+ u.uDirection = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
1361
+ u.uSplitIntensity = params.splitIntensity ?? 8;
1362
+ }
1363
+ }
1364
+ };
1365
+
1366
+ // src/effects/transitions/optical-distortion/RefractionWarpTransition.ts
1367
+ import { Filter as Filter6 } from "pixi.js";
1368
+ var fragment6 = `
1369
+ in vec2 vNormalizedCoord;
1370
+ out vec4 finalColor;
1371
+
1372
+ uniform sampler2D uFrom;
1373
+ uniform sampler2D uTo;
1374
+ uniform float uProgress;
1375
+ uniform float uRippleScale;
1376
+ uniform float uAmplitude;
1377
+
1378
+ void main(void) {
1379
+ vec2 uv = vNormalizedCoord;
1380
+
1381
+ // Displacement intensity peaks at progress = 0.5
1382
+ float distortion = sin(uProgress * 3.14159265);
1383
+
1384
+ // Dynamic wave calculations for water/glass refraction
1385
+ float waveX = sin(uv.y * uRippleScale + uProgress * 6.28) * uAmplitude * distortion;
1386
+ float waveY = cos(uv.x * uRippleScale + uProgress * 6.28) * uAmplitude * distortion;
1387
+
1388
+ vec2 displacedUv = clamp(uv + vec2(waveX, waveY), 0.001, 0.999);
1389
+
1390
+ vec4 fromColor = texture(uFrom, displacedUv);
1391
+ vec4 toColor = texture(uTo, displacedUv);
1392
+
1393
+ // Crossfade under the displacement
1394
+ finalColor = mix(fromColor, toColor, uProgress);
1395
+ }
1396
+ `;
1397
+ var RefractionWarpTransition = {
1398
+ id: "refraction-warp",
1399
+ name: "Refraction Warp",
1400
+ category: "optical-distortion",
1401
+ description: "The incoming clip melts through the outgoing clip via a rippling, glass-like refraction distortion.",
1402
+ tags: ["refraction", "warp", "distortion", "melt", "water"],
1403
+ defaultDurationMs: 900,
1404
+ params: [
1405
+ { key: "rippleScale", label: "Ripple Scale", type: "range", value: 12, min: 1, max: 20, step: 0.5 },
1406
+ { key: "amplitude", label: "Amplitude", type: "range", value: 0.05, min: 0, max: 0.1, step: 5e-3 }
1407
+ ],
1408
+ create(params) {
1409
+ return Filter6.from({
1410
+ gl: { vertex: defaultVertexShader, fragment: fragment6 },
1411
+ resources: {
1412
+ transitionUniforms: {
1413
+ uProgress: { value: 0, type: "f32" },
1414
+ uRippleScale: { value: params.rippleScale ?? 12, type: "f32" },
1415
+ uAmplitude: { value: params.amplitude ?? 0.05, type: "f32" }
1416
+ }
1417
+ }
1418
+ });
1419
+ },
1420
+ updateProgress(filter, progress, params) {
1421
+ const u = filter.resources?.transitionUniforms?.uniforms;
1422
+ if (u) {
1423
+ u.uProgress = progress;
1424
+ u.uRippleScale = params.rippleScale ?? 12;
1425
+ u.uAmplitude = params.amplitude ?? 0.05;
1426
+ }
1427
+ }
1428
+ };
1429
+
1430
+ // src/effects/transitions/temporal/GlitchTransition.ts
1431
+ import { Filter as Filter7 } from "pixi.js";
1432
+ var fragment7 = `
1433
+ in vec2 vNormalizedCoord;
1434
+ out vec4 finalColor;
1435
+
1436
+ uniform sampler2D uFrom;
1437
+ uniform sampler2D uTo;
1438
+ uniform float uProgress;
1439
+ uniform float uIntensity;
1440
+ uniform float uBlockSize;
1441
+ uniform float uRgbShift;
1442
+ uniform float uNoise;
1443
+ uniform vec2 uResolution;
1444
+
1445
+ float rand(vec2 co) {
1446
+ return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
1447
+ }
1448
+
1449
+ float blockRand(vec2 uv, float blockSize) {
1450
+ vec2 block = floor(uv * uResolution / blockSize);
1451
+ return rand(block + vec2(uProgress * 10.0));
1452
+ }
1453
+
1454
+ void main(void) {
1455
+ vec2 uv = vNormalizedCoord;
1456
+ float t = uProgress;
1457
+
1458
+ // Glitch intensity peaks at mid-transition
1459
+ float glitchAmount = uIntensity * (1.0 - abs(t * 2.0 - 1.0));
1460
+
1461
+ // Block-based displacement
1462
+ float blockR = blockRand(uv, uBlockSize);
1463
+
1464
+ if (blockR < glitchAmount) {
1465
+ // Random horizontal displacement
1466
+ float displacement = (rand(vec2(blockR, t)) - 0.5) * glitchAmount * 0.3;
1467
+ uv.x += displacement;
1468
+
1469
+ // Random vertical jitter (smaller)
1470
+ float jitter = (rand(vec2(blockR + 1.0, t)) - 0.5) * glitchAmount * 0.1;
1471
+ uv.y += jitter;
1472
+ }
1473
+
1474
+ uv = clamp(uv, 0.0, 1.0);
1475
+
1476
+ vec4 colorA, colorB;
1477
+
1478
+ if (uRgbShift > 0.5 && glitchAmount > 0.1) {
1479
+ float shiftAmount = glitchAmount * 0.01;
1480
+
1481
+ float rA = texture(uFrom, uv + vec2(shiftAmount, 0.0)).r;
1482
+ float gA = texture(uFrom, uv).g;
1483
+ float bA = texture(uFrom, uv - vec2(shiftAmount, 0.0)).b;
1484
+ colorA = vec4(rA, gA, bA, 1.0);
1485
+
1486
+ float rB = texture(uTo, uv + vec2(shiftAmount, 0.0)).r;
1487
+ float gB = texture(uTo, uv).g;
1488
+ float bB = texture(uTo, uv - vec2(shiftAmount, 0.0)).b;
1489
+ colorB = vec4(rB, gB, bB, 1.0);
1490
+ } else {
1491
+ colorA = texture(uFrom, uv);
1492
+ colorB = texture(uTo, uv);
1493
+ }
1494
+
1495
+ float blockSwitch = blockRand(vNormalizedCoord, uBlockSize * 0.5);
1496
+ float threshold = mix(t, 0.5, glitchAmount);
1497
+
1498
+ vec4 color;
1499
+ if (blockSwitch < threshold) {
1500
+ color = colorB;
1501
+ } else {
1502
+ color = mix(colorA, colorB, t);
1503
+ }
1504
+
1505
+ if (uNoise > 0.5 && glitchAmount > 0.2) {
1506
+ float noiseVal = rand(vNormalizedCoord * 500.0 + vec2(t * 100.0));
1507
+ if (noiseVal > 0.95) {
1508
+ color.rgb = vec3(noiseVal);
1509
+ }
1510
+ }
1511
+
1512
+ if (glitchAmount > 0.4) {
1513
+ float corruptionChance = rand(vec2(floor(t * 60.0)));
1514
+ if (corruptionChance < glitchAmount * 0.1) {
1515
+ color.rgb = 1.0 - color.rgb;
1516
+ }
1517
+ }
1518
+
1519
+ finalColor = color;
1520
+ }
1521
+ `;
1522
+ var GlitchTransition = {
1523
+ id: "glitch",
1524
+ name: "Glitch",
1525
+ category: "temporal",
1526
+ description: "Chaotic digital glitch with block displacement, RGB shifting, and noise artifacts.",
1527
+ tags: ["glitch", "digital", "chaos", "corruption", "artifacts"],
1528
+ defaultDurationMs: 500,
1529
+ // Short strobe/glitch style duration
1530
+ params: [
1531
+ { key: "intensity", label: "Intensity", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 },
1532
+ { key: "blockSize", label: "Block Size", type: "range", value: 10, min: 1, max: 50, step: 1 },
1533
+ { key: "rgbShift", label: "RGB Shift", type: "toggle", value: true },
1534
+ { key: "noise", label: "Noise", type: "toggle", value: true }
1535
+ ],
1536
+ create(params) {
1537
+ const rgbShiftVal = params.rgbShift ?? true ? 1 : 0;
1538
+ const noiseVal = params.noise ?? true ? 1 : 0;
1539
+ return Filter7.from({
1540
+ gl: { vertex: defaultVertexShader, fragment: fragment7 },
1541
+ resources: {
1542
+ transitionUniforms: {
1543
+ uProgress: { value: 0, type: "f32" },
1544
+ uIntensity: { value: params.intensity ?? 0.5, type: "f32" },
1545
+ uBlockSize: { value: params.blockSize ?? 10, type: "f32" },
1546
+ uRgbShift: { value: rgbShiftVal, type: "f32" },
1547
+ uNoise: { value: noiseVal, type: "f32" },
1548
+ uResolution: { value: [1280, 720], type: "vec2<f32>" }
1549
+ }
1550
+ }
1551
+ });
1552
+ },
1553
+ updateProgress(filter, progress, params) {
1554
+ const u = filter.resources?.transitionUniforms?.uniforms;
1555
+ if (u) {
1556
+ u.uProgress = progress;
1557
+ u.uIntensity = params.intensity ?? 0.5;
1558
+ u.uBlockSize = params.blockSize ?? 10;
1559
+ u.uRgbShift = params.rgbShift ?? true ? 1 : 0;
1560
+ u.uNoise = params.noise ?? true ? 1 : 0;
1561
+ }
1562
+ }
1563
+ };
1564
+
1565
+ // src/effects/transitions/temporal/StrobeCutTransition.ts
1566
+ import { Filter as Filter8 } from "pixi.js";
1567
+ var fragment8 = `
1568
+ in vec2 vNormalizedCoord;
1569
+ out vec4 finalColor;
1570
+
1571
+ uniform sampler2D uFrom;
1572
+ uniform sampler2D uTo;
1573
+ uniform float uProgress;
1574
+ uniform float uFlashRate;
1575
+ uniform float uUseFlashColor;
1576
+ uniform vec3 uFlashColor;
1577
+
1578
+ void main(void) {
1579
+ vec2 uv = vNormalizedCoord;
1580
+
1581
+ // Flash rate accelerates as progress goes 0 -> 1
1582
+ float currentRate = mix(4.0, uFlashRate, uProgress);
1583
+
1584
+ // Calculate strobe state: 0.0 or 1.0
1585
+ float strobeVal = fract(uProgress * currentRate * 3.0);
1586
+ float choice = step(strobeVal, 0.5);
1587
+
1588
+ vec4 fromColor = texture(uFrom, uv);
1589
+ vec4 toColor = texture(uTo, uv);
1590
+
1591
+ // Hard cut/switch based on strobe choice
1592
+ // But as progress approaches 1.0, we lean more towards toColor
1593
+ float blendVal = mix(choice, 1.0, uProgress * uProgress);
1594
+ vec4 baseColor = mix(fromColor, toColor, step(0.5, blendVal));
1595
+
1596
+ if (uUseFlashColor > 0.5) {
1597
+ // Flash glow intensity spikes at strobe peaks
1598
+ float flashGlow = sin(strobeVal * 3.14159) * (1.0 - abs(uProgress - 0.5) * 2.0);
1599
+ baseColor = mix(baseColor, vec4(uFlashColor, 1.0), flashGlow * 0.5);
1600
+ }
1601
+
1602
+ finalColor = baseColor;
1603
+ }
1604
+ `;
1605
+ var hexToVec3 = (hex) => {
1606
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
1607
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
1608
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
1609
+ return [r, g, b];
1610
+ };
1611
+ var StrobeCutTransition = {
1612
+ id: "strobe-cut",
1613
+ name: "Strobe Cut",
1614
+ category: "temporal",
1615
+ description: "Rapidly strobes between outgoing and incoming clips at an accelerating rate with optional color flashes.",
1616
+ tags: ["temporal", "strobe", "flash", "cut", "rhythm"],
1617
+ defaultDurationMs: 400,
1618
+ // Accelerating strobe cut works best in short duration
1619
+ params: [
1620
+ { key: "flashRate", label: "Flash Rate", type: "range", value: 12, min: 4, max: 24, step: 1 },
1621
+ { key: "useFlashColor", label: "Use Flash Color", type: "toggle", value: true },
1622
+ { key: "flashColor", label: "Flash Color", type: "color", value: "#FFFFFF" }
1623
+ ],
1624
+ create(params) {
1625
+ const useColor = params.useFlashColor ?? true ? 1 : 0;
1626
+ const colorHex = params.flashColor ?? "#FFFFFF";
1627
+ const colorVal = hexToVec3(colorHex);
1628
+ return Filter8.from({
1629
+ gl: { vertex: defaultVertexShader, fragment: fragment8 },
1630
+ resources: {
1631
+ transitionUniforms: {
1632
+ uProgress: { value: 0, type: "f32" },
1633
+ uFlashRate: { value: params.flashRate ?? 12, type: "f32" },
1634
+ uUseFlashColor: { value: useColor, type: "f32" },
1635
+ uFlashColor: { value: colorVal, type: "vec3<f32>" }
1636
+ }
1637
+ }
1638
+ });
1639
+ },
1640
+ updateProgress(filter, progress, params) {
1641
+ const u = filter.resources?.transitionUniforms?.uniforms;
1642
+ if (u) {
1643
+ u.uProgress = progress;
1644
+ u.uFlashRate = params.flashRate ?? 12;
1645
+ u.uUseFlashColor = params.useFlashColor ?? true ? 1 : 0;
1646
+ const colorHex = params.flashColor ?? "#FFFFFF";
1647
+ u.uFlashColor = hexToVec3(colorHex);
1648
+ }
1649
+ }
1650
+ };
1651
+
1652
+ // src/effects/transitions/temporal/FrameHoldStutterTransition.ts
1653
+ import { Filter as Filter9 } from "pixi.js";
1654
+ var fragment9 = `
1655
+ in vec2 vNormalizedCoord;
1656
+ out vec4 finalColor;
1657
+
1658
+ uniform sampler2D uFrom;
1659
+ uniform sampler2D uTo;
1660
+ uniform float uProgress;
1661
+ uniform float uStutterCount;
1662
+ uniform float uHoldRatio;
1663
+
1664
+ void main(void) {
1665
+ vec2 uv = vNormalizedCoord;
1666
+
1667
+ vec4 color;
1668
+
1669
+ if (uProgress < uHoldRatio) {
1670
+ // Calculate fraction of current stutter step for pulse effects
1671
+ float stepProgress = fract(uProgress * uStutterCount / uHoldRatio);
1672
+ float shift = sin(stepProgress * 3.14159) * 0.015;
1673
+
1674
+ // Sample outgoing clip with chromatic stutter pulse
1675
+ float r = texture(uFrom, uv + vec2(shift, 0.0)).r;
1676
+ float g = texture(uFrom, uv).g;
1677
+ float b = texture(uFrom, uv - vec2(shift, 0.0)).b;
1678
+ color = vec4(r, g, b, 1.0);
1679
+ } else {
1680
+ // Hard cut to incoming clip in the final percentage
1681
+ color = texture(uTo, uv);
1682
+ }
1683
+
1684
+ finalColor = color;
1685
+ }
1686
+ `;
1687
+ var FrameHoldStutterTransition = {
1688
+ id: "frame-hold-stutter",
1689
+ name: "Frame Hold Stutter",
1690
+ category: "temporal",
1691
+ description: "Freezes and stutters the outgoing clip rhythmically before cutting hard to the incoming clip.",
1692
+ tags: ["temporal", "stutter", "freeze", "hold", "rhythm"],
1693
+ defaultDurationMs: 600,
1694
+ params: [
1695
+ { key: "stutterCount", label: "Stutter Count", type: "range", value: 3, min: 2, max: 5, step: 1 },
1696
+ { key: "holdRatio", label: "Hold Ratio", type: "range", value: 0.7, min: 0.5, max: 0.9, step: 0.05 }
1697
+ ],
1698
+ create(params) {
1699
+ return Filter9.from({
1700
+ gl: { vertex: defaultVertexShader, fragment: fragment9 },
1701
+ resources: {
1702
+ transitionUniforms: {
1703
+ uProgress: { value: 0, type: "f32" },
1704
+ uStutterCount: { value: params.stutterCount ?? 3, type: "f32" },
1705
+ uHoldRatio: { value: params.holdRatio ?? 0.7, type: "f32" }
1706
+ }
1707
+ }
1708
+ });
1709
+ },
1710
+ updateProgress(filter, progress, params) {
1711
+ const u = filter.resources?.transitionUniforms?.uniforms;
1712
+ if (u) {
1713
+ const holdRatio = params.holdRatio ?? 0.7;
1714
+ const stutterCount = params.stutterCount ?? 3;
1715
+ let displayProgress = progress;
1716
+ if (progress < holdRatio) {
1717
+ const step = Math.floor(progress * stutterCount / holdRatio) / stutterCount;
1718
+ displayProgress = step * holdRatio;
1719
+ }
1720
+ u.uProgress = displayProgress;
1721
+ u.uStutterCount = stutterCount;
1722
+ u.uHoldRatio = holdRatio;
1723
+ }
1724
+ }
1725
+ };
1726
+
1727
+ // src/effects/transitions/particle-dissolve/CrossDissolveTransition.ts
1728
+ import { Filter as Filter10 } from "pixi.js";
1729
+ var fragment10 = `
1730
+ in vec2 vNormalizedCoord;
1731
+ out vec4 finalColor;
1732
+
1733
+ uniform sampler2D uFrom;
1734
+ uniform sampler2D uTo;
1735
+ uniform float uProgress;
1736
+ uniform float uEasing;
1737
+ uniform vec3 uFadeColor;
1738
+ uniform float uUseFadeColor;
1739
+
1740
+ float easeIn(float t) {
1741
+ return t * t;
1742
+ }
1743
+
1744
+ float easeOut(float t) {
1745
+ return t * (2.0 - t);
1746
+ }
1747
+
1748
+ float easeInOut(float t) {
1749
+ return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
1750
+ }
1751
+
1752
+ float smoothStepEase(float t) {
1753
+ return t * t * (3.0 - 2.0 * t);
1754
+ }
1755
+
1756
+ float applyEasing(float t, float easingType) {
1757
+ if (easingType < 0.5) return t; // linear
1758
+ if (easingType < 1.5) return easeIn(t);
1759
+ if (easingType < 2.5) return easeOut(t);
1760
+ if (easingType < 3.5) return easeInOut(t);
1761
+ return smoothStepEase(t);
1762
+ }
1763
+
1764
+ void main(void) {
1765
+ vec2 uv = vNormalizedCoord;
1766
+ float t = applyEasing(uProgress, uEasing);
1767
+
1768
+ vec4 colorA = texture(uFrom, uv);
1769
+ vec4 colorB = texture(uTo, uv);
1770
+ vec4 result;
1771
+
1772
+ if (uUseFadeColor > 0.5) {
1773
+ if (t < 0.5) {
1774
+ float fadeOut = t * 2.0;
1775
+ result = mix(colorA, vec4(uFadeColor, 1.0), fadeOut);
1776
+ } else {
1777
+ float fadeIn = (t - 0.5) * 2.0;
1778
+ result = mix(vec4(uFadeColor, 1.0), colorB, fadeIn);
1779
+ }
1780
+ } else {
1781
+ result = mix(colorA, colorB, t);
1782
+ }
1783
+
1784
+ finalColor = result;
1785
+ }
1786
+ `;
1787
+ var hexToVec32 = (hex) => {
1788
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
1789
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
1790
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
1791
+ return [r, g, b];
1792
+ };
1793
+ var CrossDissolveTransition = {
1794
+ id: "cross-dissolve",
1795
+ name: "Cross Dissolve",
1796
+ category: "particle-dissolve",
1797
+ description: "Classic fade between two clips with alpha blending or optional solid color dip.",
1798
+ tags: ["transition", "blend", "dissolve", "fade", "alpha"],
1799
+ defaultDurationMs: 800,
1800
+ params: [
1801
+ { key: "easing", label: "Easing", type: "select", value: "linear", options: ["linear", "easeIn", "easeOut", "easeInOut", "smoothstep"] },
1802
+ { key: "useFadeColor", label: "Fade Through Color", type: "toggle", value: false },
1803
+ { key: "fadeColor", label: "Fade Color", type: "color", value: "#000000" }
1804
+ ],
1805
+ create(params) {
1806
+ const easeStr = params.easing || "linear";
1807
+ const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : easeStr === "easeInOut" ? 3 : 4;
1808
+ const useFadeVal = params.useFadeColor ?? false ? 1 : 0;
1809
+ const colorHex = params.fadeColor ?? "#000000";
1810
+ const colorVal = hexToVec32(colorHex);
1811
+ return Filter10.from({
1812
+ gl: { vertex: defaultVertexShader, fragment: fragment10 },
1813
+ resources: {
1814
+ transitionUniforms: {
1815
+ uProgress: { value: 0, type: "f32" },
1816
+ uEasing: { value: easeVal, type: "f32" },
1817
+ uUseFadeColor: { value: useFadeVal, type: "f32" },
1818
+ uFadeColor: { value: colorVal, type: "vec3<f32>" }
1819
+ }
1820
+ }
1821
+ });
1822
+ },
1823
+ updateProgress(filter, progress, params) {
1824
+ const u = filter.resources?.transitionUniforms?.uniforms;
1825
+ if (u) {
1826
+ u.uProgress = progress;
1827
+ const easeStr = params.easing || "linear";
1828
+ u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : easeStr === "easeInOut" ? 3 : 4;
1829
+ u.uUseFadeColor = params.useFadeColor ?? false ? 1 : 0;
1830
+ const colorHex = params.fadeColor ?? "#000000";
1831
+ u.uFadeColor = hexToVec32(colorHex);
1832
+ }
1833
+ }
1834
+ };
1835
+
1836
+ // src/effects/transitions/particle-dissolve/DirectionalDissolveTransition.ts
1837
+ import { Filter as Filter11 } from "pixi.js";
1838
+ var fragment11 = `
1839
+ in vec2 vNormalizedCoord;
1840
+ out vec4 finalColor;
1841
+
1842
+ uniform sampler2D uFrom;
1843
+ uniform sampler2D uTo;
1844
+ uniform float uProgress;
1845
+ uniform float uDirection; // 0=horizontal, 1=vertical, 2=diagonal
1846
+ uniform float uNoiseScale;
1847
+ uniform float uEdgeSharpness;
1848
+
1849
+ float hash(vec2 p) {
1850
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
1851
+ }
1852
+
1853
+ void main(void) {
1854
+ vec2 uv = vNormalizedCoord;
1855
+
1856
+ // Directional gradient
1857
+ float grad = 0.0;
1858
+ if (uDirection < 0.5) {
1859
+ grad = uv.x;
1860
+ } else if (uDirection < 1.5) {
1861
+ grad = uv.y;
1862
+ } else {
1863
+ grad = (uv.x + uv.y) * 0.5;
1864
+ }
1865
+
1866
+ // Pixelated noise map
1867
+ float noiseVal = hash(floor(uv * uNoiseScale));
1868
+
1869
+ // Combine gradient and noise
1870
+ float value = grad + (noiseVal - 0.5) * 0.3;
1871
+
1872
+ // Map progress from 0.0 -> 1.3 to ensure clean complete state at both ends
1873
+ float progressMapped = uProgress * 1.3;
1874
+
1875
+ // Sharpness control
1876
+ float width = 0.2 * (1.0 - uEdgeSharpness) + 0.001;
1877
+ float alpha = smoothstep(progressMapped - width, progressMapped + width, value);
1878
+
1879
+ vec4 fromColor = texture(uFrom, uv);
1880
+ vec4 toColor = texture(uTo, uv);
1881
+
1882
+ finalColor = mix(toColor, fromColor, alpha);
1883
+ }
1884
+ `;
1885
+ var DirectionalDissolveTransition = {
1886
+ id: "directional-dissolve",
1887
+ name: "Directional Dissolve",
1888
+ category: "particle-dissolve",
1889
+ description: "Dissolves outgoing clip into incoming clip using a noise threshold that sweeps in a specified direction.",
1890
+ tags: ["particle", "dissolve", "noise", "sweep", "wave"],
1891
+ defaultDurationMs: 900,
1892
+ params: [
1893
+ { key: "direction", label: "Direction", type: "select", value: "horizontal", options: ["horizontal", "vertical", "diagonal"] },
1894
+ { key: "noiseScale", label: "Noise Scale", type: "range", value: 15, min: 1, max: 30, step: 1 },
1895
+ { key: "edgeSharpness", label: "Edge Sharpness", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
1896
+ ],
1897
+ create(params) {
1898
+ const dirStr = params.direction || "horizontal";
1899
+ const dirVal = dirStr === "horizontal" ? 0 : dirStr === "vertical" ? 1 : 2;
1900
+ return Filter11.from({
1901
+ gl: { vertex: defaultVertexShader, fragment: fragment11 },
1902
+ resources: {
1903
+ transitionUniforms: {
1904
+ uProgress: { value: 0, type: "f32" },
1905
+ uDirection: { value: dirVal, type: "f32" },
1906
+ uNoiseScale: { value: params.noiseScale ?? 15, type: "f32" },
1907
+ uEdgeSharpness: { value: params.edgeSharpness ?? 0.5, type: "f32" }
1908
+ }
1909
+ }
1910
+ });
1911
+ },
1912
+ updateProgress(filter, progress, params) {
1913
+ const u = filter.resources?.transitionUniforms?.uniforms;
1914
+ if (u) {
1915
+ u.uProgress = progress;
1916
+ const dirStr = params.direction || "horizontal";
1917
+ u.uDirection = dirStr === "horizontal" ? 0 : dirStr === "vertical" ? 1 : 2;
1918
+ u.uNoiseScale = params.noiseScale ?? 15;
1919
+ u.uEdgeSharpness = params.edgeSharpness ?? 0.5;
1920
+ }
1921
+ }
1922
+ };
1923
+
1924
+ // src/effects/transitions/particle-dissolve/PixelateCollapseTransition.ts
1925
+ import { Filter as Filter12 } from "pixi.js";
1926
+ var fragment12 = `
1927
+ in vec2 vNormalizedCoord;
1928
+ out vec4 finalColor;
1929
+
1930
+ uniform sampler2D uFrom;
1931
+ uniform sampler2D uTo;
1932
+ uniform float uProgress;
1933
+ uniform float uMaxBlockSize;
1934
+ uniform float uSymmetry;
1935
+ uniform vec2 uResolution;
1936
+
1937
+ void main(void) {
1938
+ vec2 uv = vNormalizedCoord;
1939
+
1940
+ // Calculate bell curve for block size peaking at progress = 0.5
1941
+ float bellCurve = 0.0;
1942
+ if (uProgress < 0.5) {
1943
+ bellCurve = uProgress * 2.0;
1944
+ } else {
1945
+ // If asymmetric, make B resolve faster (decay speed = 4.0 instead of 2.0)
1946
+ float decayFactor = (uSymmetry > 0.5) ? 2.0 : 4.0;
1947
+ bellCurve = max(0.0, 1.0 - (uProgress - 0.5) * decayFactor);
1948
+ }
1949
+
1950
+ // Determine current pixel block size (1.0 = no pixelation)
1951
+ float currentBlockSize = mix(1.0, uMaxBlockSize, bellCurve);
1952
+
1953
+ // Quantize texture coordinates
1954
+ vec2 blockResolution = uResolution / currentBlockSize;
1955
+ vec2 pixelatedUv = floor(uv * blockResolution) / blockResolution;
1956
+
1957
+ vec4 color;
1958
+ if (uProgress < 0.5) {
1959
+ color = texture(uFrom, pixelatedUv);
1960
+ } else {
1961
+ color = texture(uTo, pixelatedUv);
1962
+ }
1963
+
1964
+ finalColor = color;
1965
+ }
1966
+ `;
1967
+ var PixelateCollapseTransition = {
1968
+ id: "pixelate-collapse",
1969
+ name: "Pixelate Collapse",
1970
+ category: "particle-dissolve",
1971
+ description: "The outgoing clip breaks into increasingly large pixel blocks before collapsing into the incoming clip.",
1972
+ tags: ["pixelate", "collapse", "particle", "grid", "pixel"],
1973
+ defaultDurationMs: 800,
1974
+ params: [
1975
+ { key: "maxBlockSize", label: "Max Block Size", type: "range", value: 32, min: 8, max: 64, step: 1 },
1976
+ { key: "symmetry", label: "Symmetric Resolution", type: "toggle", value: true }
1977
+ ],
1978
+ create(params) {
1979
+ const symmetryVal = params.symmetry ?? true ? 1 : 0;
1980
+ return Filter12.from({
1981
+ gl: { vertex: defaultVertexShader, fragment: fragment12 },
1982
+ resources: {
1983
+ transitionUniforms: {
1984
+ uProgress: { value: 0, type: "f32" },
1985
+ uMaxBlockSize: { value: params.maxBlockSize ?? 32, type: "f32" },
1986
+ uSymmetry: { value: symmetryVal, type: "f32" },
1987
+ uResolution: { value: [1280, 720], type: "vec2<f32>" }
1988
+ }
1989
+ }
1990
+ });
1991
+ },
1992
+ updateProgress(filter, progress, params) {
1993
+ const u = filter.resources?.transitionUniforms?.uniforms;
1994
+ if (u) {
1995
+ u.uProgress = progress;
1996
+ u.uMaxBlockSize = params.maxBlockSize ?? 32;
1997
+ u.uSymmetry = params.symmetry ?? true ? 1 : 0;
1998
+ }
1999
+ }
2000
+ };
2001
+
2002
+ // src/effects/transitions/light-based/LumaWipeTransition.ts
2003
+ import { Filter as Filter13 } from "pixi.js";
2004
+ var fragment13 = `
2005
+ in vec2 vNormalizedCoord;
2006
+ out vec4 finalColor;
2007
+
2008
+ uniform sampler2D uFrom;
2009
+ uniform sampler2D uTo;
2010
+ uniform float uProgress;
2011
+ uniform float uSoftness;
2012
+ uniform float uInvert;
2013
+ uniform float uGradient; // 0=horizontal, 1=vertical, 2=diagonal, 3=radial, 4=noise
2014
+ uniform float uEasing;
2015
+
2016
+ float easeIn(float t) {
2017
+ return t * t;
2018
+ }
2019
+
2020
+ float easeOut(float t) {
2021
+ return t * (2.0 - t);
2022
+ }
2023
+
2024
+ float easeInOut(float t) {
2025
+ return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
2026
+ }
2027
+
2028
+ float applyEasing(float t, float easingType) {
2029
+ if (easingType < 0.5) return t; // linear
2030
+ if (easingType < 1.5) return easeIn(t);
2031
+ if (easingType < 2.5) return easeOut(t);
2032
+ return easeInOut(t);
2033
+ }
2034
+
2035
+ float rand(vec2 co) {
2036
+ return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
2037
+ }
2038
+
2039
+ float getGradient(vec2 uv, float gradientType) {
2040
+ if (gradientType < 0.5) {
2041
+ return uv.x;
2042
+ } else if (gradientType < 1.5) {
2043
+ return uv.y;
2044
+ } else if (gradientType < 2.5) {
2045
+ return (uv.x + uv.y) * 0.5;
2046
+ } else if (gradientType < 3.5) {
2047
+ vec2 center = vec2(0.5, 0.5);
2048
+ return length(uv - center) * 1.414; // normalize to 0-1
2049
+ } else {
2050
+ return rand(floor(uv * 20.0) / 20.0);
2051
+ }
2052
+ }
2053
+
2054
+ void main(void) {
2055
+ vec2 uv = vNormalizedCoord;
2056
+ float t = applyEasing(uProgress, uEasing);
2057
+
2058
+ float gradient = getGradient(uv, uGradient);
2059
+
2060
+ if (uInvert > 0.5) {
2061
+ gradient = 1.0 - gradient;
2062
+ }
2063
+
2064
+ // Scale threshold map to range [0.0 - softness, 1.0 + softness] to ensure complete wipe
2065
+ float mappedThreshold = mix(-uSoftness, 1.0 + uSoftness, t);
2066
+
2067
+ float lower = mappedThreshold - uSoftness;
2068
+ float upper = mappedThreshold + uSoftness;
2069
+
2070
+ float mask = smoothstep(lower, upper, gradient);
2071
+
2072
+ vec4 colorA = texture(uFrom, uv);
2073
+ vec4 colorB = texture(uTo, uv);
2074
+
2075
+ finalColor = mix(colorA, colorB, mask);
2076
+ }
2077
+ `;
2078
+ var LumaWipeTransition = {
2079
+ id: "luma-wipe",
2080
+ name: "Luma Wipe",
2081
+ category: "light-based",
2082
+ description: "Transitions between clips based on luminance threshold using a directional, radial, or noise gradient.",
2083
+ tags: ["wipe", "luma", "mask", "reveal", "gradient"],
2084
+ defaultDurationMs: 800,
2085
+ params: [
2086
+ { key: "gradient", label: "Gradient Type", type: "select", value: "diagonal", options: ["horizontal", "vertical", "diagonal", "radial", "noise"] },
2087
+ { key: "softness", label: "Softness", type: "range", value: 0.1, min: 0, max: 0.5, step: 0.01 },
2088
+ { key: "invert", label: "Invert", type: "toggle", value: false },
2089
+ { key: "easing", label: "Easing", type: "select", value: "linear", options: ["linear", "easeIn", "easeOut", "easeInOut"] }
2090
+ ],
2091
+ create(params) {
2092
+ const gradStr = params.gradient || "diagonal";
2093
+ const gradVal = gradStr === "horizontal" ? 0 : gradStr === "vertical" ? 1 : gradStr === "diagonal" ? 2 : gradStr === "radial" ? 3 : 4;
2094
+ const easeStr = params.easing || "linear";
2095
+ const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
2096
+ const invertVal = params.invert ?? false ? 1 : 0;
2097
+ return Filter13.from({
2098
+ gl: { vertex: defaultVertexShader, fragment: fragment13 },
2099
+ resources: {
2100
+ transitionUniforms: {
2101
+ uProgress: { value: 0, type: "f32" },
2102
+ uSoftness: { value: params.softness ?? 0.1, type: "f32" },
2103
+ uInvert: { value: invertVal, type: "f32" },
2104
+ uGradient: { value: gradVal, type: "f32" },
2105
+ uEasing: { value: easeVal, type: "f32" }
2106
+ }
2107
+ }
2108
+ });
2109
+ },
2110
+ updateProgress(filter, progress, params) {
2111
+ const u = filter.resources?.transitionUniforms?.uniforms;
2112
+ if (u) {
2113
+ u.uProgress = progress;
2114
+ u.uSoftness = params.softness ?? 0.1;
2115
+ u.uInvert = params.invert ?? false ? 1 : 0;
2116
+ const gradStr = params.gradient || "diagonal";
2117
+ u.uGradient = gradStr === "horizontal" ? 0 : gradStr === "vertical" ? 1 : gradStr === "diagonal" ? 2 : gradStr === "radial" ? 3 : 4;
2118
+ const easeStr = params.easing || "linear";
2119
+ u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
2120
+ }
2121
+ }
2122
+ };
2123
+
2124
+ // src/effects/transitions/light-based/LightLeakSweepTransition.ts
2125
+ import { Filter as Filter14 } from "pixi.js";
2126
+ var fragment14 = `
2127
+ in vec2 vNormalizedCoord;
2128
+ out vec4 finalColor;
2129
+
2130
+ uniform sampler2D uFrom;
2131
+ uniform sampler2D uTo;
2132
+ uniform float uProgress;
2133
+ uniform float uBandWidth;
2134
+ uniform float uAngle; // in degrees
2135
+ uniform vec3 uLeakColor;
2136
+
2137
+ void main(void) {
2138
+ vec2 uv = vNormalizedCoord;
2139
+
2140
+ // Convert angle to radians
2141
+ float rad = uAngle * 3.14159265 / 180.0;
2142
+
2143
+ // Project UV onto the sweep axis
2144
+ vec2 dir = vec2(cos(rad), sin(rad));
2145
+ float linePos = dot(uv - vec2(0.5), dir) + 0.5;
2146
+
2147
+ // Map sweep center position to sweep completely off edges
2148
+ float sweepCenter = mix(-uBandWidth, 1.0 + uBandWidth, uProgress);
2149
+ float dist = linePos - sweepCenter;
2150
+
2151
+ // Wipe mask (0.0 = incoming, 1.0 = outgoing)
2152
+ float mask = smoothstep(-uBandWidth * 0.5, uBandWidth * 0.5, dist);
2153
+
2154
+ // Light leak glow band centered at the sweep line
2155
+ float glow = smoothstep(uBandWidth, 0.0, abs(dist));
2156
+
2157
+ vec4 fromColor = texture(uFrom, uv);
2158
+ vec4 toColor = texture(uTo, uv);
2159
+
2160
+ vec4 baseColor = mix(toColor, fromColor, mask);
2161
+
2162
+ // Additive warm light leak sweep glow
2163
+ finalColor = vec4(clamp(baseColor.rgb + uLeakColor * glow * 1.3, 0.0, 1.0), baseColor.a);
2164
+ }
2165
+ `;
2166
+ var hexToVec33 = (hex) => {
2167
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
2168
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
2169
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
2170
+ return [r, g, b];
2171
+ };
2172
+ var LightLeakSweepTransition = {
2173
+ id: "light-leak-sweep",
2174
+ name: "Light Leak Sweep",
2175
+ category: "light-based",
2176
+ description: "A warm light leak sweeps across the frame, wiping the outgoing clip into the incoming clip under the glow.",
2177
+ tags: ["light", "leak", "sweep", "glow", "warm"],
2178
+ defaultDurationMs: 900,
2179
+ params: [
2180
+ { key: "leakColor", label: "Leak Color", type: "color", value: "#FF9E3B" },
2181
+ // Warm amber
2182
+ { key: "bandWidth", label: "Band Width", type: "range", value: 0.3, min: 0.1, max: 0.5, step: 0.01 },
2183
+ { key: "angle", label: "Sweep Angle", type: "range", value: 45, min: 0, max: 90, step: 1 }
2184
+ ],
2185
+ create(params) {
2186
+ const colorHex = params.leakColor ?? "#FF9E3B";
2187
+ const colorVal = hexToVec33(colorHex);
2188
+ return Filter14.from({
2189
+ gl: { vertex: defaultVertexShader, fragment: fragment14 },
2190
+ resources: {
2191
+ transitionUniforms: {
2192
+ uProgress: { value: 0, type: "f32" },
2193
+ uBandWidth: { value: params.bandWidth ?? 0.3, type: "f32" },
2194
+ uAngle: { value: params.angle ?? 45, type: "f32" },
2195
+ uLeakColor: { value: colorVal, type: "vec3<f32>" }
2196
+ }
2197
+ }
2198
+ });
2199
+ },
2200
+ updateProgress(filter, progress, params) {
2201
+ const u = filter.resources?.transitionUniforms?.uniforms;
2202
+ if (u) {
2203
+ u.uProgress = progress;
2204
+ u.uBandWidth = params.bandWidth ?? 0.3;
2205
+ u.uAngle = params.angle ?? 45;
2206
+ const colorHex = params.leakColor ?? "#FF9E3B";
2207
+ u.uLeakColor = hexToVec33(colorHex);
2208
+ }
2209
+ }
2210
+ };
2211
+
2212
+ // src/effects/transitions/light-based/FilmBurnWipeTransition.ts
2213
+ import { Filter as Filter15 } from "pixi.js";
2214
+ var fragment15 = `
2215
+ in vec2 vNormalizedCoord;
2216
+ out vec4 finalColor;
2217
+
2218
+ uniform sampler2D uFrom;
2219
+ uniform sampler2D uTo;
2220
+ uniform float uProgress;
2221
+ uniform float uIrregularity;
2222
+ uniform float uEdgeGlow;
2223
+ uniform vec3 uBurnColor;
2224
+
2225
+ float hash(vec2 p) {
2226
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
2227
+ }
2228
+
2229
+ float noise(vec2 p) {
2230
+ vec2 i = floor(p);
2231
+ vec2 f = fract(p);
2232
+ vec2 u = f * f * (3.0 - 2.0 * f);
2233
+ return mix(mix(hash(i + vec2(0.0, 0.0)), hash(i + vec2(1.0, 0.0)), u.x),
2234
+ mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
2235
+ }
2236
+
2237
+ void main(void) {
2238
+ vec2 uv = vNormalizedCoord;
2239
+
2240
+ // Procedural layered noise for organic melting outline
2241
+ float n = noise(uv * 6.0) * 0.7 + noise(uv * 12.0) * 0.3;
2242
+ float burnValue = uv.x + n * uIrregularity * 0.4;
2243
+
2244
+ // Map progress to sweep across the screen completely
2245
+ float threshold = uProgress * 1.4;
2246
+
2247
+ // Mask for clean swap (0.0 = burnt/To, 1.0 = normal/From)
2248
+ float burnMask = smoothstep(threshold - 0.01, threshold + 0.01, burnValue);
2249
+
2250
+ vec4 fromColor = texture(uFrom, uv);
2251
+ vec4 toColor = texture(uTo, uv);
2252
+ vec4 baseColor = mix(toColor, fromColor, burnMask);
2253
+
2254
+ // Glowing border along the melting front
2255
+ float edgeThickness = 0.05 * uEdgeGlow + 0.001;
2256
+ float edgeVal = abs(burnValue - threshold);
2257
+ float edge = 1.0 - smoothstep(0.0, edgeThickness, edgeVal);
2258
+
2259
+ if (edge > 0.001) {
2260
+ // Hot orange outer glow, blending into hot white uBurnColor at the core
2261
+ vec3 fireGlow = vec3(1.0, 0.35, 0.05); // Hot orange
2262
+ vec3 hotEdge = mix(fireGlow, uBurnColor, smoothstep(0.5, 1.0, edge));
2263
+ baseColor.rgb = clamp(baseColor.rgb + hotEdge * edge * 1.6, 0.0, 1.0);
2264
+ }
2265
+
2266
+ finalColor = baseColor;
2267
+ }
2268
+ `;
2269
+ var hexToVec34 = (hex) => {
2270
+ const r = parseInt(hex.slice(1, 3), 16) / 255;
2271
+ const g = parseInt(hex.slice(3, 5), 16) / 255;
2272
+ const b = parseInt(hex.slice(5, 7), 16) / 255;
2273
+ return [r, g, b];
2274
+ };
2275
+ var FilmBurnWipeTransition = {
2276
+ id: "film-burn-wipe",
2277
+ name: "Film Burn Wipe",
2278
+ category: "light-based",
2279
+ description: "An organic, irregular burn edge eats through the outgoing clip to reveal the incoming clip, with a hot glow along the melt line.",
2280
+ tags: ["film", "burn", "wipe", "glow", "organic"],
2281
+ defaultDurationMs: 950,
2282
+ params: [
2283
+ { key: "burnColor", label: "Burn Color", type: "color", value: "#FFFFFF" },
2284
+ // Hot white core
2285
+ { key: "irregularity", label: "Irregularity", type: "range", value: 0.6, min: 0, max: 1, step: 0.05 },
2286
+ { key: "edgeGlow", label: "Edge Glow", type: "range", value: 0.7, min: 0, max: 1, step: 0.05 }
2287
+ ],
2288
+ create(params) {
2289
+ const colorHex = params.burnColor ?? "#FFFFFF";
2290
+ const colorVal = hexToVec34(colorHex);
2291
+ return Filter15.from({
2292
+ gl: { vertex: defaultVertexShader, fragment: fragment15 },
2293
+ resources: {
2294
+ transitionUniforms: {
2295
+ uProgress: { value: 0, type: "f32" },
2296
+ uIrregularity: { value: params.irregularity ?? 0.6, type: "f32" },
2297
+ uEdgeGlow: { value: params.edgeGlow ?? 0.7, type: "f32" },
2298
+ uBurnColor: { value: colorVal, type: "vec3<f32>" }
2299
+ }
2300
+ }
2301
+ });
2302
+ },
2303
+ updateProgress(filter, progress, params) {
2304
+ const u = filter.resources?.transitionUniforms?.uniforms;
2305
+ if (u) {
2306
+ u.uProgress = progress;
2307
+ u.uIrregularity = params.irregularity ?? 0.6;
2308
+ u.uEdgeGlow = params.edgeGlow ?? 0.7;
2309
+ const colorHex = params.burnColor ?? "#FFFFFF";
2310
+ u.uBurnColor = hexToVec34(colorHex);
2311
+ }
2312
+ }
2313
+ };
2314
+
2315
+ // src/effects/transitions/depth-based/DepthPushTransition.ts
2316
+ import { Filter as Filter16 } from "pixi.js";
2317
+ var fragment16 = `
2318
+ in vec2 vNormalizedCoord;
2319
+ out vec4 finalColor;
2320
+
2321
+ uniform sampler2D uFrom;
2322
+ uniform sampler2D uTo;
2323
+ uniform float uProgress;
2324
+ uniform float uDepthCurve; // 0=linear, 1=ease-in, 2=ease-out
2325
+ uniform float uAtmosphericFade; // 0 to 1
2326
+
2327
+ float applyDepthCurve(float t, float curveType) {
2328
+ if (curveType < 0.5) return t; // linear
2329
+ if (curveType < 1.5) return t * t; // ease-in
2330
+ return t * (2.0 - t); // ease-out
2331
+ }
2332
+
2333
+ void main() {
2334
+ float t = applyDepthCurve(uProgress, uDepthCurve);
2335
+
2336
+ // uTo scales from 0.3 to 1.0 (dolly in towards uTo)
2337
+ float scaleTo = 0.3 + 0.7 * t;
2338
+ // uFrom scales from 1.0 to 1.4 (zooms past the camera)
2339
+ float scaleFrom = 1.0 + 0.4 * t;
2340
+
2341
+ vec2 center = vec2(0.5);
2342
+ vec2 uvTo = (vNormalizedCoord - center) / scaleTo + center;
2343
+ vec2 uvFrom = (vNormalizedCoord - center) / scaleFrom + center;
2344
+
2345
+ bool inTo = (uvTo.x >= 0.0 && uvTo.x <= 1.0 && uvTo.y >= 0.0 && uvTo.y <= 1.0);
2346
+ bool inFrom = (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0);
2347
+
2348
+ vec4 colorFrom = vec4(0.0);
2349
+ if (inFrom) {
2350
+ colorFrom = texture(uFrom, uvFrom);
2351
+ // Darken the receding clip to simulate atmospheric/physical depth
2352
+ colorFrom.rgb *= (1.0 - t * uAtmosphericFade);
2353
+ }
2354
+
2355
+ vec4 colorTo = vec4(0.0);
2356
+ if (inTo) {
2357
+ colorTo = texture(uTo, uvTo);
2358
+ }
2359
+
2360
+ vec4 color;
2361
+ if (inTo) {
2362
+ // uTo is layered on top, blending in as progress increases
2363
+ color = mix(colorFrom, colorTo, t);
2364
+ } else {
2365
+ // Outside uTo bounds, show the fading uFrom
2366
+ color = colorFrom * (1.0 - t);
2367
+ }
2368
+
2369
+ finalColor = color;
2370
+ }
2371
+ `;
2372
+ var DepthPushTransition = {
2373
+ id: "depth-push",
2374
+ name: "Depth Push",
2375
+ category: "depth-based",
2376
+ description: "The incoming clip grows and brightens from deep space while the outgoing clip scales up and recedes.",
2377
+ tags: ["depth", "dolly", "3d", "scale"],
2378
+ defaultDurationMs: 1e3,
2379
+ params: [
2380
+ { key: "depthCurve", label: "Depth Curve", type: "select", value: "ease-in", options: ["linear", "ease-in", "ease-out"] },
2381
+ { key: "atmosphericFade", label: "Atmospheric Fade", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
2382
+ ],
2383
+ create(params) {
2384
+ const curveStr = params.depthCurve || "ease-in";
2385
+ const curveVal = curveStr === "linear" ? 0 : curveStr === "ease-in" ? 1 : 2;
2386
+ const fadeVal = params.atmosphericFade ?? 0.5;
2387
+ return Filter16.from({
2388
+ gl: { vertex: defaultVertexShader, fragment: fragment16 },
2389
+ resources: {
2390
+ transitionUniforms: {
2391
+ uProgress: { value: 0, type: "f32" },
2392
+ uDepthCurve: { value: curveVal, type: "f32" },
2393
+ uAtmosphericFade: { value: fadeVal, type: "f32" }
2394
+ }
2395
+ }
2396
+ });
2397
+ },
2398
+ updateProgress(filter, progress, params) {
2399
+ const u = filter.resources?.transitionUniforms?.uniforms;
2400
+ if (u) {
2401
+ u.uProgress = progress;
2402
+ const curveStr = params.depthCurve || "ease-in";
2403
+ u.uDepthCurve = curveStr === "linear" ? 0 : curveStr === "ease-in" ? 1 : 2;
2404
+ u.uAtmosphericFade = params.atmosphericFade ?? 0.5;
2405
+ }
2406
+ }
2407
+ };
2408
+
2409
+ // src/effects/transitions/depth-based/RackFocusBlendTransition.ts
2410
+ import { Filter as Filter17 } from "pixi.js";
2411
+ var fragment17 = `
2412
+ in vec2 vNormalizedCoord;
2413
+ out vec4 finalColor;
2414
+
2415
+ uniform sampler2D uFrom;
2416
+ uniform sampler2D uTo;
2417
+ uniform float uProgress;
2418
+ uniform float uMaxBlur;
2419
+ uniform float uFocusOffset;
2420
+
2421
+ #define PI 3.14159265359
2422
+
2423
+ // Smooth 8-tap single-pass blur mimicking Kawase blur
2424
+ vec4 sampleBlur(sampler2D tex, vec2 uv, float blurAmount) {
2425
+ if (blurAmount < 0.1) {
2426
+ return texture(tex, uv);
2427
+ }
2428
+
2429
+ vec4 sum = vec4(0.0);
2430
+ float offset = blurAmount * 0.0008;
2431
+
2432
+ // First ring
2433
+ sum += texture(tex, uv + vec2(-1.0, -1.0) * offset) * 0.125;
2434
+ sum += texture(tex, uv + vec2(1.0, -1.0) * offset) * 0.125;
2435
+ sum += texture(tex, uv + vec2(-1.0, 1.0) * offset) * 0.125;
2436
+ sum += texture(tex, uv + vec2(1.0, 1.0) * offset) * 0.125;
2437
+
2438
+ // Second ring (simulating deeper multi-pass blur offsets)
2439
+ float offset2 = offset * 2.0;
2440
+ sum += texture(tex, uv + vec2(-1.5, 0.0) * offset2) * 0.125;
2441
+ sum += texture(tex, uv + vec2(1.5, 0.0) * offset2) * 0.125;
2442
+ sum += texture(tex, uv + vec2(0.0, -1.5) * offset2) * 0.125;
2443
+ sum += texture(tex, uv + vec2(0.0, 1.5) * offset2) * 0.125;
2444
+
2445
+ return sum;
2446
+ }
2447
+
2448
+ void main() {
2449
+ // Offset the bell curves for each clip to break symmetry and shift the focus peak
2450
+ float tFrom = clamp(uProgress + uFocusOffset, 0.0, 1.0);
2451
+ float tTo = clamp(uProgress - uFocusOffset, 0.0, 1.0);
2452
+
2453
+ float blurFrom = uMaxBlur * sin(tFrom * PI);
2454
+ float blurTo = uMaxBlur * sin(tTo * PI);
2455
+
2456
+ vec2 uv = vNormalizedCoord;
2457
+
2458
+ vec4 colorFrom = sampleBlur(uFrom, uv, blurFrom);
2459
+ vec4 colorTo = sampleBlur(uTo, uv, blurTo);
2460
+
2461
+ // Smooth crossfade underneath the blur
2462
+ finalColor = mix(colorFrom, colorTo, uProgress);
2463
+ }
2464
+ `;
2465
+ var RackFocusBlendTransition = {
2466
+ id: "rack-focus-blend",
2467
+ name: "Rack Focus Blend",
2468
+ category: "depth-based",
2469
+ description: "Defocuses the outgoing clip and sharpens the incoming clip, shifting the focal plane near the midpoint.",
2470
+ tags: ["depth", "blur", "lens", "focus"],
2471
+ defaultDurationMs: 1200,
2472
+ params: [
2473
+ { key: "maxBlur", label: "Max Blur", type: "range", value: 12, min: 4, max: 24, step: 1 },
2474
+ { key: "focusOffset", label: "Focus Offset", type: "range", value: 0, min: -0.3, max: 0.3, step: 0.05 }
2475
+ ],
2476
+ create(params) {
2477
+ const maxBlurVal = params.maxBlur ?? 12;
2478
+ const offsetVal = params.focusOffset ?? 0;
2479
+ return Filter17.from({
2480
+ gl: { vertex: defaultVertexShader, fragment: fragment17 },
2481
+ resources: {
2482
+ transitionUniforms: {
2483
+ uProgress: { value: 0, type: "f32" },
2484
+ uMaxBlur: { value: maxBlurVal, type: "f32" },
2485
+ uFocusOffset: { value: offsetVal, type: "f32" }
2486
+ }
2487
+ }
2488
+ });
2489
+ },
2490
+ updateProgress(filter, progress, params) {
2491
+ const u = filter.resources?.transitionUniforms?.uniforms;
2492
+ if (u) {
2493
+ u.uProgress = progress;
2494
+ u.uMaxBlur = params.maxBlur ?? 12;
2495
+ u.uFocusOffset = params.focusOffset ?? 0;
2496
+ }
2497
+ }
2498
+ };
2499
+
2500
+ // src/effects/transitions/depth-based/ParallaxLayerSplitTransition.ts
2501
+ import { Filter as Filter18 } from "pixi.js";
2502
+ var fragment18 = `
2503
+ in vec2 vNormalizedCoord;
2504
+ out vec4 finalColor;
2505
+
2506
+ uniform sampler2D uFrom;
2507
+ uniform sampler2D uTo;
2508
+ uniform float uProgress;
2509
+ uniform float uBandCount;
2510
+ uniform float uParallaxStrength;
2511
+ uniform float uStaggerDelay;
2512
+
2513
+ void main() {
2514
+ vec2 uv = vNormalizedCoord;
2515
+
2516
+ // Determine which horizontal band this pixel belongs to
2517
+ float bandIndex = floor(uv.y * uBandCount);
2518
+
2519
+ // Stagger progress per band
2520
+ float delay = bandIndex * uStaggerDelay;
2521
+ float maxDelay = (uBandCount - 1.0) * uStaggerDelay;
2522
+ float denom = max(1.0 - maxDelay, 0.01);
2523
+ float t = clamp((uProgress - delay) / denom, 0.0, 1.0);
2524
+
2525
+ // Parallax speed based on band index
2526
+ float speed = 1.0 + bandIndex * uParallaxStrength;
2527
+
2528
+ // Shift horizontally. We shift left (adding offset to UV)
2529
+ float offset = t * speed;
2530
+ vec2 uvFrom = uv + vec2(offset, 0.0);
2531
+
2532
+ vec4 color;
2533
+ if (uvFrom.x >= 0.0 && uvFrom.x <= 1.0) {
2534
+ color = texture(uFrom, uvFrom);
2535
+ } else {
2536
+ // Reveal the incoming clip static underneath in the gaps
2537
+ color = texture(uTo, uv);
2538
+ }
2539
+
2540
+ finalColor = color;
2541
+ }
2542
+ `;
2543
+ var ParallaxLayerSplitTransition = {
2544
+ id: "parallax-layer-split",
2545
+ name: "Parallax Layer Split",
2546
+ category: "depth-based",
2547
+ description: "Splits the frame into staggered horizontal strips shifting at different speeds to reveal the next clip.",
2548
+ tags: ["depth", "slide", "stagger", "parallax"],
2549
+ defaultDurationMs: 1e3,
2550
+ params: [
2551
+ { key: "bandCount", label: "Band Count", type: "range", value: 3, min: 2, max: 5, step: 1 },
2552
+ { key: "parallaxStrength", label: "Parallax Strength", type: "range", value: 0.5, min: 0.2, max: 1, step: 0.05 },
2553
+ { key: "staggerDelay", label: "Stagger Delay", type: "range", value: 0.1, min: 0, max: 0.3, step: 0.05 }
2554
+ ],
2555
+ create(params) {
2556
+ const bandVal = params.bandCount ?? 3;
2557
+ const strengthVal = params.parallaxStrength ?? 0.5;
2558
+ const delayVal = params.staggerDelay ?? 0.1;
2559
+ return Filter18.from({
2560
+ gl: { vertex: defaultVertexShader, fragment: fragment18 },
2561
+ resources: {
2562
+ transitionUniforms: {
2563
+ uProgress: { value: 0, type: "f32" },
2564
+ uBandCount: { value: bandVal, type: "f32" },
2565
+ uParallaxStrength: { value: strengthVal, type: "f32" },
2566
+ uStaggerDelay: { value: delayVal, type: "f32" }
2567
+ }
2568
+ }
2569
+ });
2570
+ },
2571
+ updateProgress(filter, progress, params) {
2572
+ const u = filter.resources?.transitionUniforms?.uniforms;
2573
+ if (u) {
2574
+ u.uProgress = progress;
2575
+ u.uBandCount = params.bandCount ?? 3;
2576
+ u.uParallaxStrength = params.parallaxStrength ?? 0.5;
2577
+ u.uStaggerDelay = params.staggerDelay ?? 0.1;
2578
+ }
2579
+ }
2580
+ };
2581
+
2582
+ // src/effects/transitions/physics-simulated/ShatterBurstTransition.ts
2583
+ import { Filter as Filter19 } from "pixi.js";
2584
+ var fragment19 = `
2585
+ in vec2 vNormalizedCoord;
2586
+ out vec4 finalColor;
2587
+
2588
+ uniform sampler2D uFrom;
2589
+ uniform sampler2D uTo;
2590
+ uniform float uProgress;
2591
+ uniform float uGridRes;
2592
+ uniform float uExplosionForce;
2593
+ uniform float uRotationAmount;
2594
+
2595
+ vec2 hash22(vec2 p) {
2596
+ vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));
2597
+ p3 += dot(p3, p3.yzx + 33.33);
2598
+ return fract((p3.xx + p3.yz) * p3.zy);
2599
+ }
2600
+
2601
+ void main() {
2602
+ vec2 uv = vNormalizedCoord;
2603
+
2604
+ float minDist = 999.0;
2605
+ vec2 closestCell = vec2(-99.0);
2606
+ vec2 closestTransformedCenter = vec2(0.5);
2607
+ vec2 closestOriginalCenter = vec2(0.5);
2608
+
2609
+ vec2 g = floor(uv * uGridRes);
2610
+
2611
+ // 5x5 neighborhood search in destination space to find the closest transformed cell center
2612
+ for (float dx = -2.0; dx <= 2.0; dx += 1.0) {
2613
+ for (float dy = -2.0; dy <= 2.0; dy += 1.0) {
2614
+ vec2 cell = g + vec2(dx, dy);
2615
+
2616
+ // Skip out-of-grid cells
2617
+ if (cell.x < 0.0 || cell.x >= uGridRes || cell.y < 0.0 || cell.y >= uGridRes) {
2618
+ continue;
2619
+ }
2620
+
2621
+ vec2 rand = hash22(cell);
2622
+ vec2 origCenter = (cell + rand) / uGridRes;
2623
+
2624
+ // Outward velocity vector relative to frame center with random variation
2625
+ vec2 toCenter = origCenter - vec2(0.5);
2626
+ vec2 velocity = (normalize(toCenter) + (rand - 0.5) * 0.3) * uExplosionForce;
2627
+
2628
+ // Transformed center under quadratic acceleration
2629
+ vec2 transCenter = origCenter + velocity * uProgress * uProgress;
2630
+
2631
+ float d = distance(uv, transCenter);
2632
+ if (d < minDist) {
2633
+ minDist = d;
2634
+ closestCell = cell;
2635
+ closestTransformedCenter = transCenter;
2636
+ closestOriginalCenter = origCenter;
2637
+ }
2638
+ }
2639
+ }
2640
+
2641
+ // Calculate rotation for the selected cell
2642
+ vec2 randVal = hash22(closestCell);
2643
+ float randRot = (randVal.x - 0.5) * 2.0;
2644
+ float angle = randRot * uRotationAmount * uProgress * 4.0;
2645
+
2646
+ // Rotate pixel relative to transformed center, then translate back to original cell space
2647
+ vec2 relUv = uv - closestTransformedCenter;
2648
+ float cosA = cos(-angle);
2649
+ float sinA = sin(-angle);
2650
+ vec2 rotatedUv = vec2(relUv.x * cosA - relUv.y * sinA, relUv.x * sinA + relUv.y * cosA);
2651
+ vec2 uvFrom = rotatedUv + closestOriginalCenter;
2652
+
2653
+ // Check if the traced-back pixel uvFrom actually lands inside the same Voronoi cell
2654
+ bool inside = false;
2655
+ if (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0) {
2656
+ vec2 gFrom = floor(uvFrom * uGridRes);
2657
+ float minDistFrom = 999.0;
2658
+ vec2 closestCellFrom = vec2(-99.0);
2659
+
2660
+ // 3x3 search in original space
2661
+ for (float dx = -1.0; dx <= 1.0; dx += 1.0) {
2662
+ for (float dy = -1.0; dy <= 1.0; dy += 1.0) {
2663
+ vec2 cell = gFrom + vec2(dx, dy);
2664
+ if (cell.x < 0.0 || cell.x >= uGridRes || cell.y < 0.0 || cell.y >= uGridRes) {
2665
+ continue;
2666
+ }
2667
+ vec2 rand = hash22(cell);
2668
+ vec2 origCenter = (cell + rand) / uGridRes;
2669
+ float d = distance(uvFrom, origCenter);
2670
+ if (d < minDistFrom) {
2671
+ minDistFrom = d;
2672
+ closestCellFrom = cell;
2673
+ }
2674
+ }
2675
+ }
2676
+
2677
+ if (distance(closestCellFrom, closestCell) < 0.1) {
2678
+ inside = true;
2679
+ }
2680
+ }
2681
+
2682
+ vec4 color;
2683
+ if (inside) {
2684
+ color = texture(uFrom, uvFrom);
2685
+ } else {
2686
+ // Reveal the incoming clip in the gaps
2687
+ color = texture(uTo, uv);
2688
+ }
2689
+
2690
+ finalColor = color;
2691
+ }
2692
+ `;
2693
+ var ShatterBurstTransition = {
2694
+ id: "shatter-burst",
2695
+ name: "Shatter Burst",
2696
+ category: "physics-simulated",
2697
+ description: "Breaks the outgoing clip into polygonal shards that explode outwards, revealing the incoming clip.",
2698
+ tags: ["physics", "shatter", "particles", "creative"],
2699
+ defaultDurationMs: 1e3,
2700
+ params: [
2701
+ { key: "shardCount", label: "Shard Count", type: "range", value: 24, min: 8, max: 40, step: 1 },
2702
+ { key: "explosionForce", label: "Explosion Force", type: "range", value: 1.5, min: 0.5, max: 3, step: 0.1 },
2703
+ { key: "rotationAmount", label: "Rotation Amount", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
2704
+ ],
2705
+ create(params) {
2706
+ const shardVal = params.shardCount ?? 24;
2707
+ const gridResVal = Math.floor(Math.sqrt(shardVal));
2708
+ const forceVal = params.explosionForce ?? 1.5;
2709
+ const rotVal = params.rotationAmount ?? 0.5;
2710
+ return Filter19.from({
2711
+ gl: { vertex: defaultVertexShader, fragment: fragment19 },
2712
+ resources: {
2713
+ transitionUniforms: {
2714
+ uProgress: { value: 0, type: "f32" },
2715
+ uGridRes: { value: gridResVal, type: "f32" },
2716
+ uExplosionForce: { value: forceVal, type: "f32" },
2717
+ uRotationAmount: { value: rotVal, type: "f32" }
2718
+ }
2719
+ }
2720
+ });
2721
+ },
2722
+ updateProgress(filter, progress, params) {
2723
+ const u = filter.resources?.transitionUniforms?.uniforms;
2724
+ if (u) {
2725
+ u.uProgress = progress;
2726
+ const shardVal = params.shardCount ?? 24;
2727
+ u.uGridRes = Math.floor(Math.sqrt(shardVal));
2728
+ u.uExplosionForce = params.explosionForce ?? 1.5;
2729
+ u.uRotationAmount = params.rotationAmount ?? 0.5;
2730
+ }
2731
+ }
2732
+ };
2733
+
2734
+ // src/effects/transitions/physics-simulated/ElasticSnapCutTransition.ts
2735
+ import { Filter as Filter20 } from "pixi.js";
2736
+ var fragment20 = `
2737
+ in vec2 vNormalizedCoord;
2738
+ out vec4 finalColor;
2739
+
2740
+ uniform sampler2D uFrom;
2741
+ uniform sampler2D uTo;
2742
+ uniform float uProgress;
2743
+ uniform float uAmplitude;
2744
+ uniform float uDamping;
2745
+ uniform float uFrequency;
2746
+
2747
+ #define TWO_PI 6.28318530718
2748
+
2749
+ void main() {
2750
+ float t = uProgress;
2751
+ vec4 color;
2752
+
2753
+ // Snap to the incoming clip at the end of the transition (progress >= 0.99)
2754
+ if (t >= 0.99) {
2755
+ color = texture(uTo, vNormalizedCoord);
2756
+ } else {
2757
+ // Damped harmonic oscillation curve
2758
+ float scale = 1.0 + uAmplitude * exp(-uDamping * t) * sin(uFrequency * t * TWO_PI);
2759
+
2760
+ // Squash and stretch relative to center (preserving volume/area)
2761
+ float scaleX = scale;
2762
+ float scaleY = 2.0 - scale;
2763
+
2764
+ vec2 center = vec2(0.5);
2765
+ vec2 uv = (vNormalizedCoord - center) / vec2(scaleX, scaleY) + center;
2766
+
2767
+ if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) {
2768
+ color = texture(uFrom, uv);
2769
+ } else {
2770
+ // Fallback to black for out-of-bounds UV coordinates
2771
+ color = vec4(0.0, 0.0, 0.0, 1.0);
2772
+ }
2773
+ }
2774
+
2775
+ finalColor = color;
2776
+ }
2777
+ `;
2778
+ var ElasticSnapCutTransition = {
2779
+ id: "elastic-snap-cut",
2780
+ name: "Elastic Snap Cut",
2781
+ category: "physics-simulated",
2782
+ description: "Squashes and stretches the outgoing clip under spring-dampener physics before snapping to a clean cut.",
2783
+ tags: ["physics", "stretch", "bounce", "spring"],
2784
+ defaultDurationMs: 800,
2785
+ params: [
2786
+ { key: "amplitude", label: "Amplitude", type: "range", value: 0.15, min: 0.05, max: 0.3, step: 0.01 },
2787
+ { key: "damping", label: "Damping", type: "range", value: 4, min: 1, max: 8, step: 0.1 },
2788
+ { key: "frequency", label: "Frequency", type: "range", value: 5, min: 2, max: 10, step: 0.5 }
2789
+ ],
2790
+ create(params) {
2791
+ const ampVal = params.amplitude ?? 0.15;
2792
+ const dampVal = params.damping ?? 4;
2793
+ const freqVal = params.frequency ?? 5;
2794
+ return Filter20.from({
2795
+ gl: { vertex: defaultVertexShader, fragment: fragment20 },
2796
+ resources: {
2797
+ transitionUniforms: {
2798
+ uProgress: { value: 0, type: "f32" },
2799
+ uAmplitude: { value: ampVal, type: "f32" },
2800
+ uDamping: { value: dampVal, type: "f32" },
2801
+ uFrequency: { value: freqVal, type: "f32" }
2802
+ }
2803
+ }
2804
+ });
2805
+ },
2806
+ updateProgress(filter, progress, params) {
2807
+ const u = filter.resources?.transitionUniforms?.uniforms;
2808
+ if (u) {
2809
+ u.uProgress = progress;
2810
+ u.uAmplitude = params.amplitude ?? 0.15;
2811
+ u.uDamping = params.damping ?? 4;
2812
+ u.uFrequency = params.frequency ?? 5;
2813
+ }
2814
+ }
2815
+ };
2816
+
2817
+ // src/effects/transitions/physics-simulated/GravityDropTransition.ts
2818
+ import { Filter as Filter21 } from "pixi.js";
2819
+ var fragment21 = `
2820
+ in vec2 vNormalizedCoord;
2821
+ out vec4 finalColor;
2822
+
2823
+ uniform sampler2D uFrom;
2824
+ uniform sampler2D uTo;
2825
+ uniform float uProgress;
2826
+ uniform float uDropDistance;
2827
+ uniform float uBounceStrength;
2828
+ uniform float uGravity;
2829
+
2830
+ // Standard ease-out bounce implementation
2831
+ float bounceCurve(float t) {
2832
+ float d1 = 2.75;
2833
+ if (t < 1.0 / d1) {
2834
+ return 7.5625 * t * t;
2835
+ } else if (t < 2.0 / d1) {
2836
+ float t2 = t - 1.5 / d1;
2837
+ return 1.0 - (0.25 - 7.5625 * t2 * t2);
2838
+ } else if (t < 2.5 / d1) {
2839
+ float t2 = t - 2.25 / d1;
2840
+ return 1.0 - (0.0625 - 7.5625 * t2 * t2);
2841
+ } else {
2842
+ float t2 = t - 2.625 / d1;
2843
+ return 1.0 - (0.015625 - 7.5625 * t2 * t2);
2844
+ }
2845
+ }
2846
+
2847
+ void main() {
2848
+ float t = uProgress;
2849
+
2850
+ // Outgoing clip moves downward under gravity (quadratic acceleration)
2851
+ float yOffsetFrom = t * t * uGravity * uDropDistance;
2852
+ vec2 uvFrom = vNormalizedCoord + vec2(0.0, yOffsetFrom);
2853
+
2854
+ // Incoming clip settles with a bounce curve.
2855
+ // If bounce strength is 0, it behaves like a smooth quadratic ease-out.
2856
+ float smoothVal = t * (2.0 - t);
2857
+ float bounceVal = bounceCurve(t);
2858
+ float b = mix(smoothVal, bounceVal, uBounceStrength);
2859
+
2860
+ // Incoming clip starts above the screen and moves down to center
2861
+ float yOffsetTo = -uDropDistance * (1.0 - b);
2862
+ vec2 uvTo = vNormalizedCoord + vec2(0.0, yOffsetTo);
2863
+
2864
+ bool inTo = (uvTo.x >= 0.0 && uvTo.x <= 1.0 && uvTo.y >= 0.0 && uvTo.y <= 1.0);
2865
+ bool inFrom = (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0);
2866
+
2867
+ vec4 color = vec4(0.0, 0.0, 0.0, 1.0); // Black background
2868
+
2869
+ // Composite: incoming uTo on top
2870
+ if (inTo) {
2871
+ color = texture(uTo, uvTo);
2872
+ } else if (inFrom) {
2873
+ color = texture(uFrom, uvFrom);
2874
+ }
2875
+
2876
+ finalColor = color;
2877
+ }
2878
+ `;
2879
+ var GravityDropTransition = {
2880
+ id: "gravity-drop",
2881
+ name: "Gravity Drop",
2882
+ category: "physics-simulated",
2883
+ description: "The outgoing clip falls downward under gravity while the incoming clip drops in from the top with a physical bounce settle.",
2884
+ tags: ["physics", "gravity", "bounce", "slide"],
2885
+ defaultDurationMs: 1e3,
2886
+ params: [
2887
+ { key: "dropDistance", label: "Drop Distance", type: "range", value: 1, min: 0.5, max: 2, step: 0.1 },
2888
+ { key: "bounceStrength", label: "Bounce Strength", type: "range", value: 0.2, min: 0, max: 0.4, step: 0.05 },
2889
+ { key: "gravity", label: "Gravity", type: "range", value: 1.5, min: 0.5, max: 3, step: 0.1 }
2890
+ ],
2891
+ create(params) {
2892
+ const dropVal = params.dropDistance ?? 1;
2893
+ const bounceVal = params.bounceStrength ?? 0.2;
2894
+ const gravVal = params.gravity ?? 1.5;
2895
+ return Filter21.from({
2896
+ gl: { vertex: defaultVertexShader, fragment: fragment21 },
2897
+ resources: {
2898
+ transitionUniforms: {
2899
+ uProgress: { value: 0, type: "f32" },
2900
+ uDropDistance: { value: dropVal, type: "f32" },
2901
+ uBounceStrength: { value: bounceVal, type: "f32" },
2902
+ uGravity: { value: gravVal, type: "f32" }
2903
+ }
2904
+ }
2905
+ });
2906
+ },
2907
+ updateProgress(filter, progress, params) {
2908
+ const u = filter.resources?.transitionUniforms?.uniforms;
2909
+ if (u) {
2910
+ u.uProgress = progress;
2911
+ u.uDropDistance = params.dropDistance ?? 1;
2912
+ u.uBounceStrength = params.bounceStrength ?? 0.2;
2913
+ u.uGravity = params.gravity ?? 1.5;
2914
+ }
2915
+ }
2916
+ };
2917
+
2918
+ // src/effects/transitions/index.ts
2919
+ var ALL_TRANSITIONS = [
2920
+ PushTransition,
2921
+ IrisRevealTransition,
2922
+ FoldTurnTransition,
2923
+ ZoomTransition,
2924
+ ChromaticPushTransition,
2925
+ RefractionWarpTransition,
2926
+ GlitchTransition,
2927
+ StrobeCutTransition,
2928
+ FrameHoldStutterTransition,
2929
+ CrossDissolveTransition,
2930
+ DirectionalDissolveTransition,
2931
+ PixelateCollapseTransition,
2932
+ LumaWipeTransition,
2933
+ LightLeakSweepTransition,
2934
+ FilmBurnWipeTransition,
2935
+ DepthPushTransition,
2936
+ RackFocusBlendTransition,
2937
+ ParallaxLayerSplitTransition,
2938
+ ShatterBurstTransition,
2939
+ ElasticSnapCutTransition,
2940
+ GravityDropTransition
2941
+ ];
2942
+ var transitionEffects = ALL_TRANSITIONS;
2943
+ var transitionEffectsById = Object.fromEntries(
2944
+ ALL_TRANSITIONS.map((t) => [t.id, t])
2945
+ );
2946
+ function getTransitionEffect(id) {
2947
+ return transitionEffectsById[id];
2948
+ }
2949
+
2950
+ export {
2951
+ PushTransition,
2952
+ IrisRevealTransition,
2953
+ FoldTurnTransition,
2954
+ ZoomTransition,
2955
+ ChromaticPushTransition,
2956
+ RefractionWarpTransition,
2957
+ GlitchTransition,
2958
+ StrobeCutTransition,
2959
+ FrameHoldStutterTransition,
2960
+ CrossDissolveTransition,
2961
+ DirectionalDissolveTransition,
2962
+ PixelateCollapseTransition,
2963
+ LumaWipeTransition,
2964
+ LightLeakSweepTransition,
2965
+ FilmBurnWipeTransition,
2966
+ DepthPushTransition,
2967
+ RackFocusBlendTransition,
2968
+ ParallaxLayerSplitTransition,
2969
+ ShatterBurstTransition,
2970
+ ElasticSnapCutTransition,
2971
+ GravityDropTransition,
2972
+ ALL_TRANSITIONS,
2973
+ transitionEffects,
2974
+ transitionEffectsById,
2975
+ getTransitionEffect,
2976
+ TransitionRenderer,
2977
+ TRANSITION_CATEGORIES,
2978
+ TRANSITION_PRESETS,
2979
+ getTransitionCategories,
2980
+ getTransitionsByCategory,
2981
+ searchTransitions,
2982
+ getTransitionById,
2983
+ getTransitionByRenderer,
2984
+ getAllTransitions,
2985
+ getTransitionCountByCategory,
2986
+ getAllTransitionTags,
2987
+ getTransitionsByTags,
2988
+ getRecommendedDuration
2989
+ };
2990
+ //# sourceMappingURL=chunk-4Y7ZSGHJ.js.map