@clypra-studio/engine 1.8.0 → 1.9.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.
@@ -1,2235 +0,0 @@
1
- import {
2
- __export
3
- } from "./chunk-PZ5AY32C.js";
4
-
5
- // src/videoEffects/renderers/light/index.ts
6
- var light_exports = {};
7
- __export(light_exports, {
8
- renderDustParticles: () => renderDustParticles,
9
- renderFire: () => renderFire,
10
- renderFlash: () => renderFlash,
11
- renderFlicker: () => renderFlicker,
12
- renderGlow: () => renderGlow,
13
- renderLightLeak: () => renderLightLeak,
14
- renderLightLeak2: () => renderLightLeak2,
15
- renderParticles: () => renderParticles,
16
- renderVignette: () => renderVignette
17
- });
18
-
19
- // src/videoEffects/renderers/light/lightLeak.ts
20
- function renderLightLeak(ctx, params, intensity, time) {
21
- const width = ctx.canvas.width;
22
- const height = ctx.canvas.height;
23
- const gradient = ctx.createLinearGradient(0, 0, width, height);
24
- gradient.addColorStop(0, `rgba(255, 200, 100, ${intensity * 0.3})`);
25
- gradient.addColorStop(1, "rgba(255, 200, 100, 0)");
26
- ctx.globalCompositeOperation = "screen";
27
- ctx.fillStyle = gradient;
28
- ctx.fillRect(0, 0, width, height);
29
- ctx.globalCompositeOperation = "source-over";
30
- }
31
-
32
- // src/videoEffects/utils/colorUtils.ts
33
- function hexToRgba(hex, alpha) {
34
- hex = hex.replace("#", "");
35
- const r = parseInt(hex.substring(0, 2), 16);
36
- const g = parseInt(hex.substring(2, 4), 16);
37
- const b = parseInt(hex.substring(4, 6), 16);
38
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
39
- }
40
- function rgbaToComponents(rgba) {
41
- const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
42
- if (!match) {
43
- return { r: 0, g: 0, b: 0, a: 1 };
44
- }
45
- return {
46
- r: parseInt(match[1]),
47
- g: parseInt(match[2]),
48
- b: parseInt(match[3]),
49
- a: match[4] ? parseFloat(match[4]) : 1
50
- };
51
- }
52
- function blendColors(color1, color2, ratio) {
53
- const c1 = rgbaToComponents(color1);
54
- const c2 = rgbaToComponents(color2);
55
- const r = Math.round(c1.r * (1 - ratio) + c2.r * ratio);
56
- const g = Math.round(c1.g * (1 - ratio) + c2.g * ratio);
57
- const b = Math.round(c1.b * (1 - ratio) + c2.b * ratio);
58
- const a = c1.a * (1 - ratio) + c2.a * ratio;
59
- return `rgba(${r}, ${g}, ${b}, ${a})`;
60
- }
61
-
62
- // src/videoEffects/renderers/light/lightLeak2.ts
63
- function renderLightLeak2(ctx, params, intensity, time) {
64
- const width = ctx.canvas.width;
65
- const height = ctx.canvas.height;
66
- const duration = params.duration || 3;
67
- const progress = time % duration / duration;
68
- let x, y;
69
- let fadeMultiplier = 1;
70
- if (progress < 0.4) {
71
- const phase1Progress = progress / 0.4;
72
- x = width * phase1Progress;
73
- y = height;
74
- } else if (progress < 0.8) {
75
- const phase2Progress = (progress - 0.4) / 0.4;
76
- x = width;
77
- y = height * (1 - phase2Progress);
78
- } else {
79
- const phase3Progress = (progress - 0.8) / 0.2;
80
- x = width;
81
- y = 0;
82
- fadeMultiplier = 1 - phase3Progress;
83
- }
84
- const leakSize = Math.min(width, height) * (params.size || 0.8);
85
- const gradient = ctx.createRadialGradient(x, y, 0, x, y, leakSize);
86
- const color1 = params.color1 || "#FF6B35";
87
- const color2 = params.color2 || "#FF8C42";
88
- const color3 = params.color3 || "#FFA500";
89
- const alpha = intensity * fadeMultiplier;
90
- gradient.addColorStop(0, hexToRgba(color1, alpha * 0.9));
91
- gradient.addColorStop(0.2, hexToRgba(color2, alpha * 0.7));
92
- gradient.addColorStop(0.5, hexToRgba(color3, alpha * 0.4));
93
- gradient.addColorStop(0.8, hexToRgba(color3, alpha * 0.1));
94
- gradient.addColorStop(1, "rgba(255, 165, 0, 0)");
95
- ctx.globalCompositeOperation = "screen";
96
- ctx.fillStyle = gradient;
97
- ctx.fillRect(0, 0, width, height);
98
- ctx.globalCompositeOperation = "source-over";
99
- }
100
-
101
- // src/videoEffects/renderers/light/flash.ts
102
- function renderFlash(ctx, params, intensity, time) {
103
- const flashColor = params.flashColor || "#ffffff";
104
- const flashIntensity = (params.flashIntensity || 1) * intensity;
105
- ctx.globalCompositeOperation = "screen";
106
- ctx.fillStyle = flashColor;
107
- ctx.globalAlpha = flashIntensity;
108
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
109
- ctx.globalAlpha = 1;
110
- ctx.globalCompositeOperation = "source-over";
111
- }
112
-
113
- // src/videoEffects/renderers/light/flicker.ts
114
- function renderFlicker(ctx, params, intensity, time) {
115
- const flickerAmount = Math.random() * intensity;
116
- ctx.globalAlpha = 1 - flickerAmount * 0.5;
117
- }
118
-
119
- // src/videoEffects/renderers/light/vignette.ts
120
- function renderVignette(ctx, params, intensity, time) {
121
- const width = ctx.canvas.width;
122
- const height = ctx.canvas.height;
123
- const radius = params.radius || 0.7;
124
- const gradient = ctx.createRadialGradient(width / 2, height / 2, Math.min(width, height) * radius, width / 2, height / 2, Math.max(width, height));
125
- gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
126
- gradient.addColorStop(1, `rgba(0, 0, 0, ${intensity * 0.7})`);
127
- ctx.fillStyle = gradient;
128
- ctx.fillRect(0, 0, width, height);
129
- }
130
-
131
- // src/videoEffects/renderers/light/glow.ts
132
- function renderGlow(ctx, params, intensity, time) {
133
- const glowAmount = (params.glowAmount || 10) * intensity;
134
- ctx.shadowBlur = glowAmount;
135
- ctx.shadowColor = params.glowColor || "#ffffff";
136
- }
137
-
138
- // src/videoEffects/renderers/light/fire.ts
139
- function renderFire(ctx, params, intensity, time) {
140
- const width = ctx.canvas.width;
141
- const height = ctx.canvas.height;
142
- const fireHeight = (params.fireHeight ?? 0.4) * height;
143
- const particleCount = Math.floor((params.particleCount ?? 50) * intensity);
144
- const fireColor1 = params.fireColor1 ?? "#FF4500";
145
- const fireColor2 = params.fireColor2 ?? "#FFA500";
146
- const fireColor3 = params.fireColor3 ?? "#FFD700";
147
- const gradient = ctx.createLinearGradient(0, height, 0, height - fireHeight);
148
- gradient.addColorStop(0, fireColor1);
149
- gradient.addColorStop(0.5, fireColor2);
150
- gradient.addColorStop(1, fireColor3);
151
- ctx.globalAlpha = 0.6 * intensity;
152
- ctx.fillStyle = gradient;
153
- ctx.beginPath();
154
- ctx.moveTo(0, height);
155
- const waveCount = 8;
156
- const waveAmplitude = 40;
157
- const waveSpeed = time * 3;
158
- for (let i = 0; i <= width; i += width / 100) {
159
- const waveOffset = Math.sin(i / width * waveCount + waveSpeed) * waveAmplitude;
160
- ctx.lineTo(i, height - fireHeight + waveOffset);
161
- }
162
- ctx.lineTo(width, height);
163
- ctx.closePath();
164
- ctx.fill();
165
- ctx.globalAlpha = 0.8 * intensity;
166
- for (let i = 0; i < particleCount; i++) {
167
- const x = (Math.sin(time * 2 + i * 0.5) * 0.5 + 0.5) * width;
168
- const particleProgress = (time * 0.5 + i * 0.1) % 1;
169
- const y = height - particleProgress * fireHeight * 1.2;
170
- const size = (1 - particleProgress) * 8 * intensity;
171
- const alpha = (1 - particleProgress) * intensity;
172
- ctx.globalAlpha = alpha;
173
- ctx.fillStyle = i % 3 === 0 ? fireColor1 : i % 3 === 1 ? fireColor2 : fireColor3;
174
- ctx.beginPath();
175
- ctx.arc(x, y, size, 0, Math.PI * 2);
176
- ctx.fill();
177
- }
178
- ctx.globalAlpha = 1;
179
- }
180
-
181
- // src/videoEffects/renderers/light/particles.ts
182
- function renderParticles(ctx, params, intensity, time) {
183
- const width = ctx.canvas.width;
184
- const height = ctx.canvas.height;
185
- const particleCount = Math.floor((params.particleCount ?? 100) * intensity);
186
- const particleSize = (params.particleSize ?? 3) * intensity;
187
- const particleColor = params.particleColor ?? "#FFFFFF";
188
- const driftSpeed = params.driftSpeed ?? 1;
189
- const fadeEffect = params.fadeEffect ?? true;
190
- ctx.globalCompositeOperation = "screen";
191
- for (let i = 0; i < particleCount; i++) {
192
- const seed = i * 0.1;
193
- const x = (Math.sin(time * driftSpeed * 0.5 + seed) * 0.5 + 0.5) * width;
194
- const y = (time * driftSpeed * 20 + i * 15) % (height + 100) - 50;
195
- const sizeVariation = Math.sin(time * 2 + seed) * 0.3 + 0.7;
196
- const size = particleSize * sizeVariation;
197
- let alpha = intensity * 0.8;
198
- if (fadeEffect) {
199
- if (y < 100) {
200
- alpha *= y / 100;
201
- } else if (y > height - 100) {
202
- alpha *= (height - y) / 100;
203
- }
204
- }
205
- ctx.globalAlpha = Math.max(0, alpha);
206
- ctx.fillStyle = particleColor;
207
- ctx.beginPath();
208
- ctx.arc(x, y, size, 0, Math.PI * 2);
209
- ctx.fill();
210
- }
211
- ctx.globalAlpha = 1;
212
- ctx.globalCompositeOperation = "source-over";
213
- }
214
- function renderDustParticles(ctx, params, intensity, time) {
215
- const width = ctx.canvas.width;
216
- const height = ctx.canvas.height;
217
- const particleCount = Math.floor((params.particleCount ?? 60) * intensity);
218
- const particleSize = (params.particleSize ?? 2) * intensity;
219
- const particleColor = params.particleColor ?? "#E0E0E0";
220
- ctx.globalCompositeOperation = "screen";
221
- ctx.globalAlpha = 0.3 * intensity;
222
- for (let i = 0; i < particleCount; i++) {
223
- const seed = i * 0.05;
224
- const x = (Math.sin(time * 0.2 + seed) * 0.5 + 0.5) * width;
225
- const y = (Math.cos(time * 0.15 + seed * 2) * 0.5 + 0.5) * height;
226
- const sizePulse = Math.sin(time + seed * 3) * 0.2 + 0.8;
227
- const size = particleSize * sizePulse;
228
- const alphaVariation = Math.sin(time * 0.5 + seed * 5) * 0.3 + 0.7;
229
- ctx.globalAlpha = 0.2 * intensity * alphaVariation;
230
- ctx.fillStyle = particleColor;
231
- ctx.beginPath();
232
- ctx.arc(x, y, size, 0, Math.PI * 2);
233
- ctx.fill();
234
- }
235
- ctx.globalAlpha = 1;
236
- ctx.globalCompositeOperation = "source-over";
237
- }
238
-
239
- // src/videoEffects/effectsRegistry.ts
240
- var EFFECTS_REGISTRY = {
241
- // ==================== LIGHT EFFECTS ====================
242
- light_leak: {
243
- id: "light_leak",
244
- name: "Light Leak",
245
- category: "light",
246
- description: "Classic light leak effect",
247
- defaultParams: {},
248
- parameterSchema: {},
249
- tags: ["light", "vintage", "film"]
250
- },
251
- light_leak_2: {
252
- id: "light_leak_2",
253
- name: "Leak 2",
254
- category: "light",
255
- description: "Animated red/orange light moving across the frame",
256
- defaultParams: {
257
- duration: 3,
258
- size: 0.8,
259
- color1: "#FF6B35",
260
- color2: "#FF8C42",
261
- color3: "#FFA500"
262
- },
263
- parameterSchema: {
264
- duration: {
265
- type: "number",
266
- label: "Duration",
267
- min: 1,
268
- max: 10,
269
- default: 3,
270
- step: 0.5
271
- },
272
- size: {
273
- type: "number",
274
- label: "Size",
275
- min: 0.1,
276
- max: 1.5,
277
- default: 0.8,
278
- step: 0.1
279
- },
280
- color1: {
281
- type: "color",
282
- label: "Primary Color",
283
- default: "#FF6B35"
284
- },
285
- color2: {
286
- type: "color",
287
- label: "Secondary Color",
288
- default: "#FF8C42"
289
- },
290
- color3: {
291
- type: "color",
292
- label: "Tertiary Color",
293
- default: "#FFA500"
294
- }
295
- },
296
- tags: ["light", "animated", "cinematic", "warm"]
297
- },
298
- flash: {
299
- id: "flash",
300
- name: "Flash",
301
- category: "light",
302
- description: "Bright flash effect",
303
- defaultParams: { flashColor: "#ffffff", flashIntensity: 1 },
304
- parameterSchema: {
305
- flashColor: {
306
- type: "color",
307
- label: "Flash Color",
308
- default: "#ffffff"
309
- },
310
- flashIntensity: {
311
- type: "number",
312
- label: "Intensity",
313
- min: 0,
314
- max: 1,
315
- default: 1,
316
- step: 0.1
317
- }
318
- },
319
- tags: ["light", "bright", "instant"]
320
- },
321
- flicker: {
322
- id: "flicker",
323
- name: "Flicker",
324
- category: "light",
325
- description: "Random light flickering effect",
326
- defaultParams: {},
327
- parameterSchema: {},
328
- tags: ["light", "flicker", "dynamic"]
329
- },
330
- vignette: {
331
- id: "vignette",
332
- name: "Vignette",
333
- category: "light",
334
- description: "Darkens the edges of the frame",
335
- defaultParams: { radius: 0.7 },
336
- parameterSchema: {
337
- radius: {
338
- type: "number",
339
- label: "Radius",
340
- min: 0.1,
341
- max: 1,
342
- default: 0.7,
343
- step: 0.05
344
- }
345
- },
346
- tags: ["light", "vintage", "cinematic"]
347
- },
348
- glow: {
349
- id: "glow",
350
- name: "Glow",
351
- category: "light",
352
- description: "Adds a glow effect",
353
- defaultParams: { glowAmount: 10, glowColor: "#ffffff" },
354
- parameterSchema: {
355
- glowAmount: {
356
- type: "number",
357
- label: "Amount",
358
- min: 0,
359
- max: 50,
360
- default: 10,
361
- step: 1
362
- },
363
- glowColor: {
364
- type: "color",
365
- label: "Color",
366
- default: "#ffffff"
367
- }
368
- },
369
- tags: ["light", "soft", "dreamy"]
370
- },
371
- fire: {
372
- id: "fire",
373
- name: "Fire",
374
- category: "light",
375
- description: "Animated fire effect with particles",
376
- defaultParams: {
377
- fireHeight: 0.4,
378
- particleCount: 50,
379
- fireColor1: "#FF4500",
380
- fireColor2: "#FFA500",
381
- fireColor3: "#FFD700"
382
- },
383
- parameterSchema: {
384
- fireHeight: {
385
- type: "number",
386
- label: "Fire Height",
387
- min: 0.1,
388
- max: 0.8,
389
- default: 0.4,
390
- step: 0.05
391
- },
392
- particleCount: {
393
- type: "number",
394
- label: "Particle Count",
395
- min: 10,
396
- max: 100,
397
- default: 50,
398
- step: 5
399
- },
400
- fireColor1: {
401
- type: "color",
402
- label: "Base Color",
403
- default: "#FF4500"
404
- },
405
- fireColor2: {
406
- type: "color",
407
- label: "Mid Color",
408
- default: "#FFA500"
409
- },
410
- fireColor3: {
411
- type: "color",
412
- label: "Top Color",
413
- default: "#FFD700"
414
- }
415
- },
416
- tags: ["light", "animated", "fire", "particles"]
417
- },
418
- particles: {
419
- id: "particles",
420
- name: "Particles",
421
- category: "light",
422
- description: "Floating particle effect",
423
- defaultParams: {
424
- particleCount: 100,
425
- particleSize: 3,
426
- particleColor: "#FFFFFF",
427
- driftSpeed: 1,
428
- fadeEffect: true
429
- },
430
- parameterSchema: {
431
- particleCount: {
432
- type: "number",
433
- label: "Particle Count",
434
- min: 20,
435
- max: 200,
436
- default: 100,
437
- step: 10
438
- },
439
- particleSize: {
440
- type: "number",
441
- label: "Particle Size",
442
- min: 1,
443
- max: 10,
444
- default: 3,
445
- step: 0.5
446
- },
447
- particleColor: {
448
- type: "color",
449
- label: "Color",
450
- default: "#FFFFFF"
451
- },
452
- driftSpeed: {
453
- type: "number",
454
- label: "Drift Speed",
455
- min: 0.1,
456
- max: 3,
457
- default: 1,
458
- step: 0.1
459
- },
460
- fadeEffect: {
461
- type: "boolean",
462
- label: "Fade at Edges",
463
- default: true
464
- }
465
- },
466
- tags: ["light", "animated", "particles", "floating"]
467
- },
468
- dust_particles: {
469
- id: "dust_particles",
470
- name: "Dust Particles",
471
- category: "light",
472
- description: "Slow drifting dust particles",
473
- defaultParams: {
474
- particleCount: 60,
475
- particleSize: 2,
476
- particleColor: "#E0E0E0"
477
- },
478
- parameterSchema: {
479
- particleCount: {
480
- type: "number",
481
- label: "Particle Count",
482
- min: 20,
483
- max: 150,
484
- default: 60,
485
- step: 10
486
- },
487
- particleSize: {
488
- type: "number",
489
- label: "Particle Size",
490
- min: 1,
491
- max: 5,
492
- default: 2,
493
- step: 0.5
494
- },
495
- particleColor: {
496
- type: "color",
497
- label: "Color",
498
- default: "#E0E0E0"
499
- }
500
- },
501
- tags: ["light", "particles", "dust", "subtle"]
502
- },
503
- // ==================== BODY EFFECTS ====================
504
- body_glow: {
505
- id: "body_glow",
506
- name: "Body Glow",
507
- category: "body",
508
- description: "Adds a soft neon glow around the body silhouette",
509
- defaultParams: { glowColor: "#7C6FFF", glowRadius: 20, glowIntensity: 0.8 },
510
- parameterSchema: {
511
- glowColor: { type: "color", label: "Glow Color", default: "#7C6FFF" },
512
- glowRadius: { type: "number", label: "Glow Radius", min: 5, max: 50, default: 20, step: 1 },
513
- glowIntensity: { type: "number", label: "Glow Intensity", min: 0.1, max: 1, default: 0.8, step: 0.05 }
514
- },
515
- tags: ["body", "neon", "glow"]
516
- },
517
- body_outline: {
518
- id: "body_outline",
519
- name: "Body Outline",
520
- category: "body",
521
- description: "Traces the outline of the body with a glowing line",
522
- defaultParams: { outlineColor: "#00E5FF", outlineWidth: 6, feather: 15 },
523
- parameterSchema: {
524
- outlineColor: { type: "color", label: "Outline Color", default: "#00E5FF" },
525
- outlineWidth: { type: "number", label: "Outline Width", min: 2, max: 20, default: 6, step: 1 },
526
- feather: { type: "number", label: "Feather", min: 0, max: 30, default: 15, step: 1 }
527
- },
528
- tags: ["body", "outline", "glowing"]
529
- },
530
- body_particles: {
531
- id: "body_particles",
532
- name: "Body Particles",
533
- category: "body",
534
- description: "Emits floating particles tracing the body shape",
535
- defaultParams: { particleColor: "#FF2A85", particleCount: 60, particleSize: 3, drift: 8 },
536
- parameterSchema: {
537
- particleColor: { type: "color", label: "Particle Color", default: "#FF2A85" },
538
- particleCount: { type: "number", label: "Particle Count", min: 10, max: 150, default: 60, step: 5 },
539
- particleSize: { type: "number", label: "Particle Size", min: 1, max: 8, default: 3, step: 0.5 },
540
- drift: { type: "number", label: "Drift", min: 2, max: 20, default: 8, step: 1 }
541
- },
542
- tags: ["body", "particles", "floating"]
543
- },
544
- "body-segmentation-glow": {
545
- id: "body-segmentation-glow",
546
- name: "Segmentation Glow",
547
- category: "body",
548
- description: "Glow overlay matching body segmentation mask",
549
- defaultParams: { glowColor: "#FFD700", glowRadius: 25 },
550
- parameterSchema: {
551
- glowColor: { type: "color", label: "Color", default: "#FFD700" },
552
- glowRadius: { type: "number", label: "Radius", min: 5, max: 50, default: 25, step: 1 }
553
- },
554
- tags: ["body", "segmentation", "glow"]
555
- },
556
- // Native video filter effects (unified registry metadata)
557
- "light-leak": {
558
- id: "light-leak",
559
- name: "Light Leak",
560
- category: "light",
561
- description: "Classic cinematic light sweep across the frame",
562
- defaultParams: { gain: 0.6, lacunarity: 2.5, alpha: 0.8, angle: 30, speed: 1, animated: true },
563
- parameterSchema: {
564
- gain: { type: "number", label: "Gain", min: 0, max: 1, default: 0.6, step: 0.05 },
565
- lacunarity: { type: "number", label: "Lacunarity", min: 0, max: 5, default: 2.5, step: 0.1 },
566
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.8, step: 0.05 },
567
- angle: { type: "number", label: "Angle", min: -180, max: 180, default: 30, step: 5 },
568
- speed: { type: "number", label: "Speed", min: 0, max: 5, default: 1, step: 0.1 }
569
- },
570
- tags: ["light", "vintage", "film"]
571
- },
572
- "lens-flare": {
573
- id: "lens-flare",
574
- name: "Lens Flare",
575
- category: "light",
576
- description: "Double-stage lens flare: Godray filter coupled with an animated GPU starburst shader.",
577
- defaultParams: { godrayGain: 0.4, godrayAlpha: 0.5, flareIntensity: 0.8, flareColor: "#7C6FFF", speed: 1, animated: true },
578
- parameterSchema: {
579
- godrayGain: { type: "number", label: "Rays Gain", min: 0, max: 1, default: 0.4, step: 0.05 },
580
- godrayAlpha: { type: "number", label: "Rays Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
581
- flareIntensity: { type: "number", label: "Intensity", min: 0, max: 3, default: 0.8, step: 0.05 },
582
- flareColor: { type: "color", label: "Color", default: "#7C6FFF" },
583
- speed: { type: "number", label: "Speed", min: 0, max: 4, default: 1, step: 0.1 }
584
- },
585
- tags: ["light", "flare", "cinematic"]
586
- },
587
- "rgb-split": {
588
- id: "rgb-split",
589
- name: "RGB Split",
590
- category: "glitch",
591
- description: "Split red, green, and blue channels",
592
- defaultParams: { redX: 4, redY: 0, blueX: -4, blueY: 0, greenX: 0, greenY: 0, speed: 1.5, animated: true },
593
- parameterSchema: {
594
- redX: { type: "number", label: "Red X", min: -50, max: 50, default: 4, step: 0.5 },
595
- redY: { type: "number", label: "Red Y", min: -50, max: 50, default: 0, step: 0.5 },
596
- blueX: { type: "number", label: "Blue X", min: -50, max: 50, default: -4, step: 0.5 },
597
- blueY: { type: "number", label: "Blue Y", min: -50, max: 50, default: 0, step: 0.5 },
598
- greenX: { type: "number", label: "Green X", min: -50, max: 50, default: 0, step: 0.5 },
599
- greenY: { type: "number", label: "Green Y", min: -50, max: 50, default: 0, step: 0.5 },
600
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
601
- },
602
- tags: ["glitch", "rgb", "chromatic"]
603
- },
604
- "vhs": {
605
- id: "vhs",
606
- name: "VHS",
607
- category: "glitch",
608
- description: "Vintage tape tracking lines and phosphor noise",
609
- defaultParams: { noise: 0.08, scanlines: true, lineAlpha: 0.25, hShift: 3e-3, bandSpeed: 1.2, bandAlpha: 0.35 },
610
- parameterSchema: {
611
- noise: { type: "number", label: "Noise", min: 0, max: 0.3, default: 0.08, step: 0.01 },
612
- scanlines: { type: "boolean", label: "Scanlines", default: true },
613
- lineAlpha: { type: "number", label: "Line Alpha", min: 0, max: 1, default: 0.25, step: 0.05 },
614
- hShift: { type: "number", label: "H-Shift", min: 0, max: 0.02, default: 3e-3, step: 1e-3 },
615
- bandSpeed: { type: "number", label: "Band Speed", min: 0.1, max: 5, default: 1.2, step: 0.1 },
616
- bandAlpha: { type: "number", label: "Band Alpha", min: 0, max: 1, default: 0.35, step: 0.05 }
617
- },
618
- tags: ["glitch", "retro", "vhs", "tape"]
619
- },
620
- "glitch-band": {
621
- id: "glitch-band",
622
- name: "Glitch Band",
623
- category: "glitch",
624
- description: "Digital glitch slices running dynamically",
625
- defaultParams: { slices: 15, offset: 80, direction: 0, redX: -3, redY: 0, blueX: 3, blueY: 0, animated: true },
626
- parameterSchema: {
627
- slices: { type: "number", label: "Slices", min: 2, max: 80, default: 15, step: 1 },
628
- offset: { type: "number", label: "Offset", min: 0, max: 400, default: 80, step: 5 },
629
- direction: { type: "number", label: "Direction", min: 0, max: 360, default: 0, step: 5 },
630
- redX: { type: "number", label: "Red X", min: -20, max: 20, default: -3, step: 1 },
631
- redY: { type: "number", label: "Red Y", min: -20, max: 20, default: 0, step: 1 },
632
- blueX: { type: "number", label: "Blue X", min: -20, max: 20, default: 3, step: 1 },
633
- blueY: { type: "number", label: "Blue Y", min: -20, max: 20, default: 0, step: 1 }
634
- },
635
- tags: ["glitch", "digital", "distortion"]
636
- },
637
- "crt": {
638
- id: "crt",
639
- name: "CRT Monitor",
640
- category: "glitch",
641
- description: "Old television curve display and phosphor noise",
642
- defaultParams: { curvature: 1, lineWidth: 1, lineContrast: 0.25, noise: 0.15, vignetting: 0.3, flicker: 0.15, animated: true },
643
- parameterSchema: {
644
- curvature: { type: "number", label: "Curvature", min: 0, max: 6, default: 1, step: 0.1 },
645
- lineWidth: { type: "number", label: "Line Width", min: 0, max: 5, default: 1, step: 0.5 },
646
- lineContrast: { type: "number", label: "Line Contrast", min: 0, max: 1, default: 0.25, step: 0.05 },
647
- noise: { type: "number", label: "Noise", min: 0, max: 0.8, default: 0.15, step: 0.05 },
648
- vignetting: { type: "number", label: "Vignette Size", min: 0, max: 0.8, default: 0.3, step: 0.05 },
649
- flicker: { type: "number", label: "Flicker", min: 0, max: 0.5, default: 0.15, step: 0.05 }
650
- },
651
- tags: ["glitch", "retro", "tv"]
652
- },
653
- "film-grain": {
654
- id: "film-grain",
655
- name: "Film Grain",
656
- category: "cinematic",
657
- description: "Real organic analog movie grain",
658
- defaultParams: { intensity: 0.25, size: 2, animated: true },
659
- parameterSchema: {
660
- intensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.25, step: 0.05 },
661
- size: { type: "number", label: "Grain Size", min: 0.5, max: 6, default: 2, step: 0.1 }
662
- },
663
- tags: ["cinematic", "film", "grain"]
664
- },
665
- "tilt-shift": {
666
- id: "tilt-shift",
667
- name: "Tilt Shift",
668
- category: "cinematic",
669
- description: "Miniature belt blur focus effect",
670
- defaultParams: { blur: 40, gradientBlur: 300, focusY: 0.5, focusRange: 0.15 },
671
- parameterSchema: {
672
- blur: { type: "number", label: "Edge Blur", min: 0, max: 100, default: 40, step: 1 },
673
- gradientBlur: { type: "number", label: "Gradient Blur", min: 50, max: 800, default: 300, step: 10 },
674
- focusY: { type: "number", label: "Focus Position", min: 0, max: 1, default: 0.5, step: 0.05 },
675
- focusRange: { type: "number", label: "Focus Range", min: 0.05, max: 0.4, default: 0.15, step: 0.05 }
676
- },
677
- tags: ["cinematic", "blur", "miniature"]
678
- },
679
- "cinematic-lut": {
680
- id: "cinematic-lut",
681
- name: "Cinematic LUT",
682
- category: "cinematic",
683
- description: "Orange and Teal cinematic lookup table filter",
684
- defaultParams: { lutIntensity: 0.8, brightness: 1, contrast: 1, saturation: 1 },
685
- parameterSchema: {
686
- lutIntensity: { type: "number", label: "LUT Intensity", min: 0, max: 1, default: 0.8, step: 0.05 },
687
- brightness: { type: "number", label: "Brightness", min: 0.5, max: 1.5, default: 1, step: 0.05 },
688
- contrast: { type: "number", label: "Contrast", min: 0.5, max: 1.5, default: 1, step: 0.05 },
689
- saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 }
690
- },
691
- tags: ["cinematic", "color", "lut"]
692
- },
693
- "motion-blur": {
694
- id: "motion-blur",
695
- name: "Motion Blur",
696
- category: "cinematic",
697
- description: "Speed-based directional camera blur",
698
- defaultParams: { velocityX: 20, velocityY: 0, kernelSize: 9, offset: 0 },
699
- parameterSchema: {
700
- velocityX: { type: "number", label: "Velocity X", min: -80, max: 80, default: 20, step: 1 },
701
- velocityY: { type: "number", label: "Velocity Y", min: -80, max: 80, default: 0, step: 1 },
702
- kernelSize: { type: "number", label: "Kernel Size", min: 5, max: 25, default: 9, step: 2 },
703
- offset: { type: "number", label: "Offset", min: 0, max: 10, default: 0, step: 1 }
704
- },
705
- tags: ["cinematic", "blur", "motion"]
706
- },
707
- "shockwave": {
708
- id: "shockwave",
709
- name: "Shockwave",
710
- category: "distortion",
711
- description: "Expanding shockwave wave refraction",
712
- defaultParams: { centerX: 0.5, centerY: 0.5, speed: 1.5, amplitude: 30, wavelength: 160, brightness: 1, radius: 600, animated: true },
713
- parameterSchema: {
714
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
715
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
716
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 },
717
- amplitude: { type: "number", label: "Amplitude", min: 1, max: 100, default: 30, step: 1 },
718
- wavelength: { type: "number", label: "Wavelength", min: 10, max: 300, default: 160, step: 5 },
719
- brightness: { type: "number", label: "Brightness", min: 0.5, max: 2, default: 1, step: 0.05 },
720
- radius: { type: "number", label: "Max Radius", min: 100, max: 1e3, default: 600, step: 10 }
721
- },
722
- tags: ["distortion", "ripple", "shockwave"]
723
- },
724
- "bulge-pinch": {
725
- id: "bulge-pinch",
726
- name: "Bulge Pinch",
727
- category: "distortion",
728
- description: "Spherical bulge or pinch warp",
729
- defaultParams: { centerX: 0.5, centerY: 0.5, radius: 200, strength: 0.5, speed: 1.5, animated: true },
730
- parameterSchema: {
731
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
732
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
733
- radius: { type: "number", label: "Warp Radius", min: 10, max: 600, default: 200, step: 10 },
734
- strength: { type: "number", label: "Warp Strength", min: -1, max: 1, default: 0.5, step: 0.05 },
735
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
736
- },
737
- tags: ["distortion", "bulge", "pinch"]
738
- },
739
- "twist": {
740
- id: "twist",
741
- name: "Twist Twirl",
742
- category: "distortion",
743
- description: "Warp frame in a spiral twirl",
744
- defaultParams: { centerX: 0.5, centerY: 0.5, radius: 300, angle: 4, speed: 1, animated: true },
745
- parameterSchema: {
746
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
747
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
748
- radius: { type: "number", label: "Twirl Radius", min: 50, max: 800, default: 300, step: 10 },
749
- angle: { type: "number", label: "Angle", min: -15, max: 15, default: 4, step: 0.5 },
750
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
751
- },
752
- tags: ["distortion", "twist", "twirl"]
753
- },
754
- "reflection": {
755
- id: "reflection",
756
- name: "Reflection",
757
- category: "distortion",
758
- description: "Water mirror ripple reflection",
759
- defaultParams: { boundary: 0.5, amplitudeStart: 0, amplitudeEnd: 20, wavelengthStart: 30, wavelengthEnd: 100, alphaStart: 1, alphaEnd: 1, speed: 1, mirror: true, animated: true },
760
- parameterSchema: {
761
- boundary: { type: "number", label: "Boundary", min: 0.1, max: 0.9, default: 0.5, step: 0.05 },
762
- amplitudeStart: { type: "number", label: "Amp Start", min: 0, max: 50, default: 0, step: 1 },
763
- amplitudeEnd: { type: "number", label: "Amp End", min: 0, max: 100, default: 20, step: 1 },
764
- wavelengthStart: { type: "number", label: "Wavelength Start", min: 10, max: 100, default: 30, step: 5 },
765
- wavelengthEnd: { type: "number", label: "Wavelength End", min: 10, max: 300, default: 100, step: 5 },
766
- alphaStart: { type: "number", label: "Alpha Start", min: 0, max: 1, default: 1, step: 0.05 },
767
- alphaEnd: { type: "number", label: "Alpha End", min: 0, max: 1, default: 1, step: 0.05 },
768
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
769
- },
770
- tags: ["distortion", "reflection", "water"]
771
- },
772
- "color-gradient": {
773
- id: "color-gradient",
774
- name: "Color Gradient",
775
- category: "light",
776
- description: "Overlay a linear or radial multi-stop color gradient.",
777
- defaultParams: { gradientType: 0, color1: "#7C6FFF", color2: "#0E0E12", alpha: 0.5 },
778
- parameterSchema: {
779
- gradientType: { type: "number", label: "Type (0:Lin, 1:Rad)", min: 0, max: 1, default: 0, step: 1 },
780
- color1: { type: "color", label: "Start Color", default: "#7C6FFF" },
781
- color2: { type: "color", label: "End Color", default: "#0E0E12" },
782
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.5, step: 0.05 }
783
- },
784
- tags: ["light", "color", "gradient"]
785
- },
786
- "color-overlay": {
787
- id: "color-overlay",
788
- name: "Color Overlay",
789
- category: "light",
790
- description: "Overlay a solid tint color onto the frame.",
791
- defaultParams: { color: "#7C6FFF", alpha: 0.3 },
792
- parameterSchema: {
793
- color: { type: "color", label: "Color", default: "#7C6FFF" },
794
- alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 0.3, step: 0.05 }
795
- },
796
- tags: ["light", "color", "overlay"]
797
- },
798
- "color-adjustments": {
799
- id: "color-adjustments",
800
- name: "Color Adjustments",
801
- category: "light",
802
- description: "Adjust exposure, brightness, contrast, saturation, temperature, tint, sepia, grayscale, hue, invert, and vignette.",
803
- defaultParams: {
804
- exposure: 0,
805
- brightness: 0,
806
- contrast: 0,
807
- saturation: 0,
808
- temperature: 0,
809
- tint: 0,
810
- sepia: 0,
811
- grayscale: 0,
812
- hueRotate: 0,
813
- vignette: 0,
814
- invert: 0,
815
- blur: 0
816
- },
817
- parameterSchema: {
818
- exposure: { type: "number", label: "Exposure", min: -1, max: 1, default: 0, step: 0.01 },
819
- brightness: { type: "number", label: "Brightness", min: -1, max: 1, default: 0, step: 0.01 },
820
- contrast: { type: "number", label: "Contrast", min: -1, max: 1, default: 0, step: 0.01 },
821
- saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.01 },
822
- temperature: { type: "number", label: "Temperature", min: -1, max: 1, default: 0, step: 0.01 },
823
- tint: { type: "number", label: "Tint", min: -1, max: 1, default: 0, step: 0.01 },
824
- sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0, step: 0.01 },
825
- grayscale: { type: "number", label: "Grayscale", min: 0, max: 1, default: 0, step: 0.01 },
826
- hueRotate: { type: "number", label: "Hue Rotate", min: 0, max: 6.28318, default: 0, step: 0.01 },
827
- vignette: { type: "number", label: "Vignette", min: 0, max: 1, default: 0, step: 0.01 },
828
- invert: { type: "number", label: "Invert", min: 0, max: 1, default: 0, step: 0.01 },
829
- blur: { type: "number", label: "Blur", min: 0, max: 15, default: 0, step: 0.5 }
830
- },
831
- tags: ["color", "adjustments", "light", "vignette"]
832
- },
833
- "hsl-adjustment": {
834
- id: "hsl-adjustment",
835
- name: "HSL Adjustment",
836
- category: "light",
837
- description: "Adjust hue, saturation, and lightness of the video.",
838
- defaultParams: { hue: 0, saturation: 0, lightness: 0, colorize: false, alpha: 1 },
839
- parameterSchema: {
840
- hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 1 },
841
- saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.05 },
842
- lightness: { type: "number", label: "Lightness", min: -1, max: 1, default: 0, step: 0.05 },
843
- colorize: { type: "boolean", label: "Colorize", default: false },
844
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
845
- },
846
- tags: ["light", "color", "hsl", "hue"]
847
- },
848
- "alpha": {
849
- id: "alpha",
850
- name: "Opacity (Alpha)",
851
- category: "light",
852
- description: "Adjust layer opacity / alpha transparency.",
853
- defaultParams: { alpha: 1 },
854
- parameterSchema: {
855
- alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 1, step: 0.05 }
856
- },
857
- tags: ["light", "alpha", "opacity"]
858
- },
859
- "color-matrix": {
860
- id: "color-matrix",
861
- name: "Color Matrix Presets",
862
- category: "light",
863
- description: "Color grading adjustments and retro filter presets.",
864
- defaultParams: { brightness: 1, contrast: 1, saturation: 1, hue: 0, mode: "none" },
865
- parameterSchema: {
866
- brightness: { type: "number", label: "Brightness", min: 0, max: 2, default: 1, step: 0.05 },
867
- contrast: { type: "number", label: "Contrast", min: 0, max: 2, default: 1, step: 0.05 },
868
- saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 },
869
- hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 2 },
870
- mode: { type: "string", label: "Preset", default: "none" }
871
- },
872
- tags: ["light", "color", "presets", "vintage"]
873
- },
874
- "neon-glow": {
875
- id: "neon-glow",
876
- name: "Neon Glow (Community)",
877
- category: "light",
878
- description: "Wrap your visual features in a premium neon glow outline.",
879
- defaultParams: { distance: 15, innerStrength: 1, outerStrength: 2, color: "#7C6FFF", quality: 0.1, knockout: false },
880
- parameterSchema: {
881
- distance: { type: "number", label: "Distance", min: 1, max: 100, default: 15, step: 1 },
882
- innerStrength: { type: "number", label: "Inner Strength", min: 0, max: 10, default: 1, step: 0.2 },
883
- outerStrength: { type: "number", label: "Outer Strength", min: 0, max: 10, default: 2, step: 0.2 },
884
- color: { type: "color", label: "Glow Color", default: "#7C6FFF" },
885
- quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
886
- knockout: { type: "boolean", label: "Knockout", default: false }
887
- },
888
- tags: ["light", "glow", "neon", "outline"]
889
- },
890
- "gaussian-blur": {
891
- id: "gaussian-blur",
892
- name: "Gaussian Blur",
893
- category: "cinematic",
894
- description: "Classic high-fidelity Gaussian blur filter.",
895
- defaultParams: { blur: 8, quality: 4 },
896
- parameterSchema: {
897
- blur: { type: "number", label: "Blur Strength", min: 0, max: 100, default: 8, step: 0.5 },
898
- quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
899
- },
900
- tags: ["cinematic", "blur", "gaussian"]
901
- },
902
- "kawase-blur": {
903
- id: "kawase-blur",
904
- name: "Kawase Blur",
905
- category: "cinematic",
906
- description: "Fast, high-quality multi-pass Kawase blur.",
907
- defaultParams: { blur: 8, quality: 4 },
908
- parameterSchema: {
909
- blur: { type: "number", label: "Blur Radius", min: 0, max: 100, default: 8, step: 0.5 },
910
- quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
911
- },
912
- tags: ["cinematic", "blur", "kawase"]
913
- },
914
- "zoom-blur": {
915
- id: "zoom-blur",
916
- name: "Zoom Blur",
917
- category: "cinematic",
918
- description: "Radial focal zoom blur emanating from a point.",
919
- defaultParams: { strength: 0.15, centerX: 0.5, centerY: 0.5, innerRadius: 0, radius: 400 },
920
- parameterSchema: {
921
- strength: { type: "number", label: "Blur Strength", min: 0, max: 1, default: 0.15, step: 0.02 },
922
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
923
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
924
- innerRadius: { type: "number", label: "Inner Rad", min: 0, max: 600, default: 0, step: 10 },
925
- radius: { type: "number", label: "Outer Rad", min: 50, max: 1200, default: 400, step: 10 }
926
- },
927
- tags: ["cinematic", "blur", "zoom", "focus"]
928
- },
929
- "radial-blur": {
930
- id: "radial-blur",
931
- name: "Radial Blur",
932
- category: "cinematic",
933
- description: "Radial spin blur around a focal center point.",
934
- defaultParams: { angle: 10, centerX: 0.5, centerY: 0.5, kernelSize: 9, radius: -1 },
935
- parameterSchema: {
936
- angle: { type: "number", label: "Spin Angle", min: -180, max: 180, default: 10, step: 1 },
937
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
938
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
939
- kernelSize: { type: "number", label: "Kernel Size", min: 3, max: 25, default: 9, step: 2 },
940
- radius: { type: "number", label: "Max Radius", min: -1, max: 1200, default: -1, step: 10 }
941
- },
942
- tags: ["cinematic", "blur", "radial", "spin"]
943
- },
944
- "drop-shadow": {
945
- id: "drop-shadow",
946
- name: "Drop Shadow",
947
- category: "cinematic",
948
- description: "Apply an adjustable drop shadow overlay onto your layer.",
949
- defaultParams: { blur: 4, alpha: 0.5, offsetX: 4, offsetY: 4, color: "#000000", shadowOnly: false },
950
- parameterSchema: {
951
- blur: { type: "number", label: "Shadow Blur", min: 0, max: 50, default: 4, step: 0.5 },
952
- alpha: { type: "number", label: "Shadow Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
953
- offsetX: { type: "number", label: "Offset X", min: -100, max: 100, default: 4, step: 1 },
954
- offsetY: { type: "number", label: "Offset Y", min: -100, max: 100, default: 4, step: 1 },
955
- color: { type: "color", label: "Shadow Color", default: "#000000" },
956
- shadowOnly: { type: "boolean", label: "Shadow Only", default: false }
957
- },
958
- tags: ["cinematic", "shadow", "drop"]
959
- },
960
- "static-noise": {
961
- id: "static-noise",
962
- name: "Static Noise",
963
- category: "glitch",
964
- description: "Classic static analog noise/grain filter.",
965
- defaultParams: { noise: 0.15, animated: true },
966
- parameterSchema: {
967
- noise: { type: "number", label: "Noise Density", min: 0, max: 1, default: 0.15, step: 0.02 },
968
- animated: { type: "boolean", label: "Animated Seed", default: true }
969
- },
970
- tags: ["glitch", "noise", "grain", "static"]
971
- },
972
- "old-film": {
973
- id: "old-film",
974
- name: "Old Film",
975
- category: "cinematic",
976
- description: "Simulates vintage cinema projector noise, sepia tint, vignette, and scratches.",
977
- defaultParams: { sepia: 0.3, noise: 0.15, noiseSize: 1, scratchDensity: 0.3, scratchWidth: 1, vignetting: 0.3, vignettingAlpha: 1, vignettingBlur: 0.3 },
978
- parameterSchema: {
979
- sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0.3, step: 0.05 },
980
- noise: { type: "number", label: "Noise", min: 0, max: 1, default: 0.15, step: 0.05 },
981
- noiseSize: { type: "number", label: "Noise Size", min: 0.2, max: 5, default: 1, step: 0.1 },
982
- scratchDensity: { type: "number", label: "Scratch Density", min: 0, max: 1, default: 0.3, step: 0.05 },
983
- scratchWidth: { type: "number", label: "Scratch Width", min: 0.5, max: 6, default: 1, step: 0.2 },
984
- vignetting: { type: "number", label: "Vignette", min: 0, max: 1, default: 0.3, step: 0.05 },
985
- vignettingAlpha: { type: "number", label: "Vignette Alpha", min: 0, max: 1, default: 1, step: 0.05 },
986
- vignettingBlur: { type: "number", label: "Vignette Blur", min: 0, max: 1, default: 0.3, step: 0.05 }
987
- },
988
- tags: ["cinematic", "film", "vintage", "retro", "scratches"]
989
- },
990
- "displacement": {
991
- id: "displacement",
992
- name: "Displacement Map",
993
- category: "distortion",
994
- description: "Warp and distort the frame using a procedural noise displacement sprite.",
995
- defaultParams: { scaleX: 20, scaleY: 20, animated: true, speed: 1 },
996
- parameterSchema: {
997
- scaleX: { type: "number", label: "Scale X", min: -200, max: 200, default: 20, step: 1 },
998
- scaleY: { type: "number", label: "Scale Y", min: -200, max: 200, default: 20, step: 1 },
999
- animated: { type: "boolean", label: "Flow Motion", default: true },
1000
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
1001
- },
1002
- tags: ["distortion", "displacement", "warp", "liquid"]
1003
- },
1004
- "outline": {
1005
- id: "outline",
1006
- name: "Outline Overlay",
1007
- category: "distortion",
1008
- description: "Draws a solid colored outline around the non-transparent boundaries.",
1009
- defaultParams: { thickness: 3, color: "#7C6FFF", quality: 0.1, alpha: 1 },
1010
- parameterSchema: {
1011
- thickness: { type: "number", label: "Thickness", min: 0, max: 20, default: 3, step: 1 },
1012
- color: { type: "color", label: "Color", default: "#7C6FFF" },
1013
- quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
1014
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
1015
- },
1016
- tags: ["distortion", "outline", "stroke", "border"]
1017
- },
1018
- "grayscale": {
1019
- id: "grayscale",
1020
- name: "Grayscale",
1021
- category: "cinematic",
1022
- description: "Converts the layer to monochrome black and white.",
1023
- defaultParams: {},
1024
- parameterSchema: {},
1025
- tags: ["cinematic", "grayscale", "monochrome", "bw"]
1026
- },
1027
- "dot": {
1028
- id: "dot",
1029
- name: "Halftone Dots",
1030
- category: "distortion",
1031
- description: "Halftone dot raster pattern, simulating newspaper or comic book prints.",
1032
- defaultParams: { scale: 1, angle: 1, grayscale: true },
1033
- parameterSchema: {
1034
- scale: { type: "number", label: "Dot Scale", min: 0.1, max: 10, default: 1, step: 0.1 },
1035
- angle: { type: "number", label: "Angle", min: 0, max: 6.28, default: 1, step: 0.05 },
1036
- grayscale: { type: "boolean", label: "Grayscale", default: true }
1037
- },
1038
- tags: ["distortion", "dot", "halftone", "comic"]
1039
- },
1040
- "emboss": {
1041
- id: "emboss",
1042
- name: "Emboss Relief",
1043
- category: "distortion",
1044
- description: "Simulates an embossed 3D relief depth on the frame.",
1045
- defaultParams: { strength: 5 },
1046
- parameterSchema: {
1047
- strength: { type: "number", label: "Strength", min: 0, max: 20, default: 5, step: 0.5 }
1048
- },
1049
- tags: ["distortion", "emboss", "relief"]
1050
- },
1051
- "cross-hatch": {
1052
- id: "cross-hatch",
1053
- name: "Cross Hatch Sketch",
1054
- category: "distortion",
1055
- description: "Simulates a crosshatched pencil sketch on paper.",
1056
- defaultParams: {},
1057
- parameterSchema: {},
1058
- tags: ["distortion", "sketch", "drawing", "hatch"]
1059
- },
1060
- "pixelate": {
1061
- id: "pixelate",
1062
- name: "Pixelate Mosaic",
1063
- category: "distortion",
1064
- description: "Pixelate the video frame into large blocky mosaic cells.",
1065
- defaultParams: { sizeX: 10, sizeY: 10 },
1066
- parameterSchema: {
1067
- sizeX: { type: "number", label: "Cell Width", min: 1, max: 200, default: 10, step: 1 },
1068
- sizeY: { type: "number", label: "Cell Height", min: 1, max: 200, default: 10, step: 1 }
1069
- },
1070
- tags: ["distortion", "pixelate", "mosaic", "8bit"]
1071
- },
1072
- "ascii": {
1073
- id: "ascii",
1074
- name: "ASCII Art",
1075
- category: "distortion",
1076
- description: "Converts the video frame into interactive retro matrix ASCII text characters.",
1077
- defaultParams: { size: 8, replaceColor: false },
1078
- parameterSchema: {
1079
- size: { type: "number", label: "Char Size", min: 2, max: 50, default: 8, step: 1 },
1080
- replaceColor: { type: "boolean", label: "Replace Color", default: false }
1081
- },
1082
- tags: ["distortion", "ascii", "text", "terminal"]
1083
- }
1084
- };
1085
- function drawBodySilhouette(ctx, cx, cy, w, h) {
1086
- ctx.beginPath();
1087
- ctx.ellipse(cx, cy - h * 0.22, w * 0.28, w * 0.28, 0, 0, Math.PI * 2);
1088
- ctx.rect(cx - w * 0.08, cy - h * 0.1, w * 0.16, h * 0.06);
1089
- ctx.moveTo(cx - w * 0.5, cy - h * 0.04);
1090
- ctx.quadraticCurveTo(cx - w * 0.4, cy - h * 0.08, cx, cy - h * 0.08);
1091
- ctx.quadraticCurveTo(cx + w * 0.4, cy - h * 0.08, cx + w * 0.5, cy - h * 0.04);
1092
- ctx.lineTo(cx + w * 0.45, cy + h * 0.4);
1093
- ctx.lineTo(cx - w * 0.45, cy + h * 0.4);
1094
- ctx.closePath();
1095
- }
1096
- function imageDataToCanvas(imageData) {
1097
- const canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(imageData.width, imageData.height) : document.createElement("canvas");
1098
- if (canvas instanceof HTMLCanvasElement) {
1099
- canvas.width = imageData.width;
1100
- canvas.height = imageData.height;
1101
- }
1102
- const ctx = canvas.getContext("2d");
1103
- if (ctx) {
1104
- ctx.putImageData(imageData, 0, 0);
1105
- }
1106
- return canvas;
1107
- }
1108
- function pseudoRandom(seed) {
1109
- const x = Math.sin(seed * 12.9898) * 43758.5453;
1110
- return x - Math.floor(x);
1111
- }
1112
- function renderBodyGlow(ctx, params, intensity, time, bodyMask) {
1113
- const canvas = ctx.canvas;
1114
- const glowColor = params.glowColor || "#7C6FFF";
1115
- const glowRadius = (params.glowRadius ?? 20) * intensity * (1 + Math.sin(time * 3) * 0.2);
1116
- const glowIntensity = (params.glowIntensity ?? 0.8) * intensity * 0.18;
1117
- ctx.save();
1118
- ctx.globalCompositeOperation = "screen";
1119
- ctx.shadowColor = glowColor;
1120
- ctx.shadowBlur = glowRadius;
1121
- ctx.fillStyle = glowColor;
1122
- ctx.strokeStyle = glowColor;
1123
- ctx.lineWidth = 2;
1124
- ctx.globalAlpha = glowIntensity;
1125
- if (bodyMask) {
1126
- const maskCanvas = imageDataToCanvas(bodyMask);
1127
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
1128
- } else {
1129
- const cx = canvas.width / 2;
1130
- const cy = canvas.height * 0.5;
1131
- const w = canvas.width * 0.28;
1132
- const h = canvas.height * 0.52;
1133
- drawBodySilhouette(ctx, cx, cy, w, h);
1134
- ctx.fill();
1135
- ctx.stroke();
1136
- }
1137
- ctx.restore();
1138
- }
1139
- function renderBodyOutline(ctx, params, intensity, time, bodyMask) {
1140
- const canvas = ctx.canvas;
1141
- const outlineColor = params.outlineColor || "#00E5FF";
1142
- const pulseWidth = (params.outlineWidth ?? 6) * intensity * (1 + Math.sin(time * 2.5) * 0.15);
1143
- const feather = (params.feather ?? 15) * (1 + Math.sin(time * 2) * 0.15);
1144
- ctx.save();
1145
- ctx.globalCompositeOperation = "screen";
1146
- ctx.globalAlpha = Math.min(1, intensity);
1147
- if (bodyMask) {
1148
- const maskCanvas = imageDataToCanvas(bodyMask);
1149
- const maskCtx = maskCanvas.getContext("2d");
1150
- if (maskCtx) {
1151
- maskCtx.save();
1152
- maskCtx.globalCompositeOperation = "source-in";
1153
- maskCtx.fillStyle = outlineColor;
1154
- maskCtx.fillRect(0, 0, maskCanvas.width, maskCanvas.height);
1155
- maskCtx.restore();
1156
- }
1157
- ctx.filter = `blur(${pulseWidth}px)`;
1158
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
1159
- ctx.filter = "none";
1160
- ctx.drawImage(maskCanvas, -pulseWidth * 0.5, 0, canvas.width, canvas.height);
1161
- ctx.drawImage(maskCanvas, pulseWidth * 0.5, 0, canvas.width, canvas.height);
1162
- ctx.drawImage(maskCanvas, 0, -pulseWidth * 0.5, canvas.width, canvas.height);
1163
- ctx.drawImage(maskCanvas, 0, pulseWidth * 0.5, canvas.width, canvas.height);
1164
- } else {
1165
- ctx.strokeStyle = outlineColor;
1166
- ctx.lineWidth = Math.max(1, pulseWidth);
1167
- ctx.shadowColor = outlineColor;
1168
- ctx.shadowBlur = feather;
1169
- const cx = canvas.width / 2;
1170
- const cy = canvas.height * 0.5;
1171
- const w = canvas.width * 0.28;
1172
- const h = canvas.height * 0.52;
1173
- drawBodySilhouette(ctx, cx, cy, w, h);
1174
- ctx.stroke();
1175
- }
1176
- ctx.restore();
1177
- }
1178
- function renderBodyParticles(ctx, params, intensity, time, bodyMask) {
1179
- const canvas = ctx.canvas;
1180
- const particleColor = params.particleColor || "#FF2A85";
1181
- const count = Math.min(150, (params.particleCount ?? 60) * intensity);
1182
- const size = params.particleSize ?? 3;
1183
- const drift = params.drift ?? 8;
1184
- ctx.save();
1185
- ctx.globalCompositeOperation = "screen";
1186
- ctx.fillStyle = particleColor;
1187
- if (bodyMask) {
1188
- ctx.globalAlpha = Math.min(0.85, 0.25 + intensity * 0.6);
1189
- const seed = Math.floor(time * 24);
1190
- for (let i = 0; i < count; i++) {
1191
- const x = Math.floor(pseudoRandom(seed + i * 37) * canvas.width);
1192
- const y = Math.floor(pseudoRandom(seed + i * 43) * canvas.height);
1193
- const maskIdx = (Math.floor(y * bodyMask.height / canvas.height) * bodyMask.width + Math.floor(x * bodyMask.width / canvas.width)) * 4 + 3;
1194
- if (bodyMask.data[maskIdx] < 64) continue;
1195
- const xDrift = Math.sin((time + i) * 2.1) * drift * intensity;
1196
- const pSize = 1 + pseudoRandom(seed + i * 53) * (size - 1);
1197
- ctx.beginPath();
1198
- ctx.arc(x + xDrift, y - pseudoRandom(seed + i * 59) * 20 * intensity, pSize, 0, Math.PI * 2);
1199
- ctx.fill();
1200
- }
1201
- } else {
1202
- const cx = canvas.width / 2;
1203
- const cy = canvas.height * 0.5;
1204
- const w = canvas.width * 0.28;
1205
- const h = canvas.height * 0.52;
1206
- for (let i = 0; i < count; i++) {
1207
- const angle = i / count * Math.PI * 2;
1208
- const radius = 0.8 + Math.sin(angle * 3) * 0.15;
1209
- const px = cx + Math.cos(angle + time * 0.2) * w * radius;
1210
- const py = cy + Math.sin(angle + time * 0.2) * h * radius;
1211
- const dy = -((time * 25 + i * 4) % 35);
1212
- const dx = Math.sin(time * 1.5 + i * 0.6) * drift;
1213
- ctx.globalAlpha = 0.2 + 0.6 * (0.5 + 0.5 * Math.sin(time * 3 + i));
1214
- ctx.beginPath();
1215
- ctx.arc(px + dx, py + dy, size, 0, Math.PI * 2);
1216
- ctx.fill();
1217
- }
1218
- }
1219
- ctx.restore();
1220
- }
1221
- function renderBodySegmentationGlow(ctx, params, intensity, time, bodyMask) {
1222
- const canvas = ctx.canvas;
1223
- const glowColor = params.glowColor || "#FFD700";
1224
- const glowRadius = (params.glowRadius ?? 25) * intensity;
1225
- ctx.save();
1226
- ctx.globalCompositeOperation = "source-over";
1227
- ctx.shadowColor = glowColor;
1228
- ctx.shadowBlur = glowRadius;
1229
- ctx.fillStyle = glowColor;
1230
- ctx.globalAlpha = 0.12 * intensity;
1231
- if (bodyMask) {
1232
- const maskCanvas = imageDataToCanvas(bodyMask);
1233
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
1234
- } else {
1235
- const cx = canvas.width / 2;
1236
- const cy = canvas.height * 0.5;
1237
- const w = canvas.width * 0.28;
1238
- const h = canvas.height * 0.52;
1239
- drawBodySilhouette(ctx, cx, cy, w, h);
1240
- ctx.fill();
1241
- }
1242
- ctx.restore();
1243
- }
1244
- function getEffectMetadata(id) {
1245
- return EFFECTS_REGISTRY[id];
1246
- }
1247
- function getEffectsByCategory(category) {
1248
- return Object.values(EFFECTS_REGISTRY).filter((effect) => effect.category === category);
1249
- }
1250
- function getEffectRenderer(id) {
1251
- const renderers = {
1252
- // Light
1253
- flash: renderFlash,
1254
- flicker: renderFlicker,
1255
- vignette: renderVignette,
1256
- glow: renderGlow,
1257
- light_leak: renderLightLeak,
1258
- light_leak_2: renderLightLeak2,
1259
- fire: renderFire,
1260
- particles: renderParticles,
1261
- dust_particles: renderDustParticles,
1262
- // Body
1263
- body_glow: renderBodyGlow,
1264
- body_outline: renderBodyOutline,
1265
- body_particles: renderBodyParticles,
1266
- "body-segmentation-glow": renderBodySegmentationGlow,
1267
- // Normalized aliases retained for existing saved projects.
1268
- "light-leak": renderLightLeak,
1269
- "lens-flare": renderLightLeak2,
1270
- "lens_flare": renderLightLeak2,
1271
- "rgb-split": (ctx, params, intensity) => {
1272
- const shift = Math.floor(Number(params.redX ?? 4) * intensity);
1273
- if (shift === 0) return;
1274
- ctx.save();
1275
- ctx.globalCompositeOperation = "screen";
1276
- ctx.globalAlpha = 0.4 * intensity;
1277
- ctx.drawImage(ctx.canvas, -shift, 0);
1278
- ctx.drawImage(ctx.canvas, shift, 0);
1279
- ctx.restore();
1280
- },
1281
- "rgb_split": (ctx, params, intensity) => {
1282
- const shift = Math.floor(Number(params.redX ?? 4) * intensity);
1283
- if (shift === 0) return;
1284
- ctx.save();
1285
- ctx.globalCompositeOperation = "screen";
1286
- ctx.globalAlpha = 0.4 * intensity;
1287
- ctx.drawImage(ctx.canvas, -shift, 0);
1288
- ctx.drawImage(ctx.canvas, shift, 0);
1289
- ctx.restore();
1290
- },
1291
- "vhs": (ctx, params, intensity) => {
1292
- const width = ctx.canvas.width;
1293
- const height = ctx.canvas.height;
1294
- ctx.save();
1295
- ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.15})`;
1296
- for (let y = 0; y < height; y += 4) {
1297
- ctx.fillRect(0, y, width, 1.5);
1298
- }
1299
- ctx.restore();
1300
- },
1301
- "glitch-band": (ctx, params, intensity) => {
1302
- const width = ctx.canvas.width;
1303
- const height = ctx.canvas.height;
1304
- const y = Math.floor(Math.random() * height);
1305
- ctx.save();
1306
- ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
1307
- ctx.fillRect(0, y, width, 8);
1308
- ctx.restore();
1309
- },
1310
- "glitch_band": (ctx, params, intensity) => {
1311
- const width = ctx.canvas.width;
1312
- const height = ctx.canvas.height;
1313
- const y = Math.floor(Math.random() * height);
1314
- ctx.save();
1315
- ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
1316
- ctx.fillRect(0, y, width, 8);
1317
- ctx.restore();
1318
- },
1319
- "crt": (ctx, params, intensity) => {
1320
- const width = ctx.canvas.width;
1321
- const height = ctx.canvas.height;
1322
- ctx.save();
1323
- ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.12})`;
1324
- for (let y = 0; y < height; y += 3) {
1325
- ctx.fillRect(0, y, width, 1);
1326
- }
1327
- ctx.restore();
1328
- },
1329
- "film-grain": (ctx, params, intensity) => {
1330
- const width = ctx.canvas.width;
1331
- const height = ctx.canvas.height;
1332
- ctx.save();
1333
- for (let i = 0; i < 120 * intensity; i++) {
1334
- const x = Math.random() * width;
1335
- const y = Math.random() * height;
1336
- const alpha = 0.04 + Math.random() * 0.05;
1337
- ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha})` : `rgba(0, 0, 0, ${alpha})`;
1338
- ctx.fillRect(x, y, 2, 2);
1339
- }
1340
- ctx.restore();
1341
- },
1342
- "film_grain": (ctx, params, intensity) => {
1343
- const width = ctx.canvas.width;
1344
- const height = ctx.canvas.height;
1345
- ctx.save();
1346
- for (let i = 0; i < 120 * intensity; i++) {
1347
- const x = Math.random() * width;
1348
- const y = Math.random() * height;
1349
- const alpha = 0.04 + Math.random() * 0.05;
1350
- ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha})` : `rgba(0, 0, 0, ${alpha})`;
1351
- ctx.fillRect(x, y, 2, 2);
1352
- }
1353
- ctx.restore();
1354
- },
1355
- "tilt-shift": (ctx, params, intensity) => {
1356
- ctx.save();
1357
- try {
1358
- ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
1359
- ctx.drawImage(ctx.canvas, 0, 0);
1360
- } catch {
1361
- }
1362
- ctx.restore();
1363
- },
1364
- "tilt_shift": (ctx, params, intensity) => {
1365
- ctx.save();
1366
- try {
1367
- ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
1368
- ctx.drawImage(ctx.canvas, 0, 0);
1369
- } catch {
1370
- }
1371
- ctx.restore();
1372
- },
1373
- "cinematic-lut": (ctx, params, intensity) => {
1374
- const width = ctx.canvas.width;
1375
- const height = ctx.canvas.height;
1376
- ctx.save();
1377
- ctx.globalCompositeOperation = "color";
1378
- ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
1379
- ctx.fillRect(0, 0, width, height);
1380
- ctx.restore();
1381
- },
1382
- "cinematic_lut": (ctx, params, intensity) => {
1383
- const width = ctx.canvas.width;
1384
- const height = ctx.canvas.height;
1385
- ctx.save();
1386
- ctx.globalCompositeOperation = "color";
1387
- ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
1388
- ctx.fillRect(0, 0, width, height);
1389
- ctx.restore();
1390
- },
1391
- "motion-blur": (ctx, params, intensity) => {
1392
- ctx.save();
1393
- ctx.globalAlpha = 0.4 * intensity;
1394
- const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
1395
- const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
1396
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
1397
- ctx.restore();
1398
- },
1399
- "motion_blur": (ctx, params, intensity) => {
1400
- ctx.save();
1401
- ctx.globalAlpha = 0.4 * intensity;
1402
- const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
1403
- const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
1404
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
1405
- ctx.restore();
1406
- },
1407
- "shockwave": (ctx, params, intensity, time) => {
1408
- const width = ctx.canvas.width;
1409
- const height = ctx.canvas.height;
1410
- ctx.save();
1411
- ctx.strokeStyle = `rgba(255, 255, 255, ${intensity * 0.25})`;
1412
- ctx.lineWidth = 6;
1413
- ctx.beginPath();
1414
- ctx.arc(width / 2, height / 2, time * 160 % (width / 2 + 50), 0, Math.PI * 2);
1415
- ctx.stroke();
1416
- ctx.restore();
1417
- },
1418
- "bulge-pinch": (ctx, params, intensity) => {
1419
- const width = ctx.canvas.width;
1420
- const height = ctx.canvas.height;
1421
- ctx.save();
1422
- ctx.translate(width / 2, height / 2);
1423
- const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
1424
- ctx.scale(scale, scale);
1425
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
1426
- ctx.restore();
1427
- },
1428
- "bulge_pinch": (ctx, params, intensity) => {
1429
- const width = ctx.canvas.width;
1430
- const height = ctx.canvas.height;
1431
- ctx.save();
1432
- ctx.translate(width / 2, height / 2);
1433
- const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
1434
- ctx.scale(scale, scale);
1435
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
1436
- ctx.restore();
1437
- },
1438
- "twist": (ctx, params, intensity) => {
1439
- const width = ctx.canvas.width;
1440
- const height = ctx.canvas.height;
1441
- ctx.save();
1442
- ctx.translate(width / 2, height / 2);
1443
- ctx.rotate(Number(params.angle ?? 4) * intensity * 0.02);
1444
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
1445
- ctx.restore();
1446
- },
1447
- "reflection": (ctx, params, intensity) => {
1448
- const width = ctx.canvas.width;
1449
- const height = ctx.canvas.height;
1450
- const boundaryY = Number(params.boundary ?? 0.5) * height;
1451
- ctx.save();
1452
- ctx.translate(0, boundaryY * 2);
1453
- ctx.scale(1, -1);
1454
- ctx.globalAlpha = 0.7 * intensity;
1455
- ctx.drawImage(ctx.canvas, 0, boundaryY, width, height - boundaryY, 0, boundaryY, width, height - boundaryY);
1456
- ctx.restore();
1457
- },
1458
- "color-gradient": (ctx, params, intensity) => {
1459
- const width = ctx.canvas.width;
1460
- const height = ctx.canvas.height;
1461
- ctx.save();
1462
- const grad = params.gradientType === 1 ? ctx.createRadialGradient(width / 2, height / 2, 10, width / 2, height / 2, Math.max(width, height) / 2) : ctx.createLinearGradient(0, 0, width, height);
1463
- grad.addColorStop(0, params.color1 || "#7C6FFF");
1464
- grad.addColorStop(1, params.color2 || "#0E0E12");
1465
- ctx.fillStyle = grad;
1466
- ctx.globalAlpha = Number(params.alpha ?? 0.5) * intensity;
1467
- ctx.fillRect(0, 0, width, height);
1468
- ctx.restore();
1469
- },
1470
- "color-overlay": (ctx, params, intensity) => {
1471
- const width = ctx.canvas.width;
1472
- const height = ctx.canvas.height;
1473
- ctx.save();
1474
- ctx.fillStyle = params.color || "#7C6FFF";
1475
- ctx.globalAlpha = Number(params.alpha ?? 0.3) * intensity;
1476
- ctx.fillRect(0, 0, width, height);
1477
- ctx.restore();
1478
- },
1479
- "color-adjustments": (ctx, params, intensity) => {
1480
- const width = ctx.canvas.width;
1481
- const height = ctx.canvas.height;
1482
- const f = intensity;
1483
- const exp = Number(params.exposure ?? 0) * f;
1484
- const brightnessVal = 1 + Number(params.brightness ?? 0) * f + exp;
1485
- const contrastVal = 1 + Number(params.contrast ?? 0) * f;
1486
- const saturationVal = 1 + Number(params.saturation ?? 0) * f;
1487
- const sepiaVal = Number(params.sepia ?? 0) * f;
1488
- const grayscaleVal = Number(params.grayscale ?? 0) * f;
1489
- const hueVal = Number(params.hueRotate ?? 0) * f;
1490
- const invertVal = Number(params.invert ?? 0) * f;
1491
- const blurVal = Number(params.blur ?? 0) * f;
1492
- const filterParts = [];
1493
- if (brightnessVal !== 1) filterParts.push(`brightness(${brightnessVal})`);
1494
- if (contrastVal !== 1) filterParts.push(`contrast(${contrastVal})`);
1495
- if (saturationVal !== 1) filterParts.push(`saturate(${saturationVal})`);
1496
- if (sepiaVal > 0) filterParts.push(`sepia(${sepiaVal * 100}%)`);
1497
- if (grayscaleVal > 0) filterParts.push(`grayscale(${grayscaleVal * 100}%)`);
1498
- if (hueVal !== 0) filterParts.push(`hue-rotate(${hueVal * 180 / Math.PI}deg)`);
1499
- if (invertVal > 0) filterParts.push(`invert(${invertVal * 100}%)`);
1500
- if (blurVal > 0) filterParts.push(`blur(${blurVal}px)`);
1501
- if (filterParts.length > 0) {
1502
- ctx.save();
1503
- const temp = document.createElement("canvas");
1504
- temp.width = width;
1505
- temp.height = height;
1506
- const tempCtx = temp.getContext("2d");
1507
- if (tempCtx) {
1508
- tempCtx.drawImage(ctx.canvas, 0, 0);
1509
- ctx.clearRect(0, 0, width, height);
1510
- ctx.filter = filterParts.join(" ");
1511
- ctx.drawImage(temp, 0, 0);
1512
- ctx.filter = "none";
1513
- }
1514
- ctx.restore();
1515
- }
1516
- const tempVal = Number(params.temperature ?? 0) * f;
1517
- if (tempVal !== 0) {
1518
- ctx.save();
1519
- ctx.globalCompositeOperation = "soft-light";
1520
- if (tempVal > 0) {
1521
- ctx.fillStyle = `rgba(255, 140, 40, ${tempVal})`;
1522
- } else {
1523
- ctx.fillStyle = `rgba(40, 120, 255, ${-tempVal})`;
1524
- }
1525
- ctx.fillRect(0, 0, width, height);
1526
- ctx.restore();
1527
- }
1528
- const tintVal = Number(params.tint ?? 0) * f;
1529
- if (tintVal !== 0) {
1530
- ctx.save();
1531
- ctx.globalCompositeOperation = "soft-light";
1532
- if (tintVal > 0) {
1533
- ctx.fillStyle = `rgba(255, 40, 180, ${tintVal})`;
1534
- } else {
1535
- ctx.fillStyle = `rgba(40, 255, 100, ${-tintVal})`;
1536
- }
1537
- ctx.fillRect(0, 0, width, height);
1538
- ctx.restore();
1539
- }
1540
- const vignetteVal = Number(params.vignette ?? 0) * f;
1541
- if (vignetteVal > 0) {
1542
- ctx.save();
1543
- ctx.globalCompositeOperation = "multiply";
1544
- const cx = width / 2;
1545
- const cy = height / 2;
1546
- const maxRadius = Math.sqrt(cx * cx + cy * cy);
1547
- const gradient = ctx.createRadialGradient(cx, cy, maxRadius * 0.45, cx, cy, maxRadius * 1);
1548
- gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
1549
- gradient.addColorStop(0.5, `rgba(0, 0, 0, ${vignetteVal * 0.15})`);
1550
- gradient.addColorStop(0.8, `rgba(0, 0, 0, ${vignetteVal * 0.55})`);
1551
- gradient.addColorStop(1, `rgba(0, 0, 0, ${vignetteVal * 0.9})`);
1552
- ctx.fillStyle = gradient;
1553
- ctx.fillRect(0, 0, width, height);
1554
- ctx.restore();
1555
- }
1556
- },
1557
- "hsl-adjustment": (ctx, params, intensity) => {
1558
- if (params.colorize) {
1559
- ctx.save();
1560
- ctx.fillStyle = "rgba(124, 111, 255, 0.2)";
1561
- ctx.globalAlpha = Number(params.alpha ?? 1) * intensity;
1562
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1563
- ctx.restore();
1564
- }
1565
- },
1566
- "alpha": (ctx, params, intensity) => {
1567
- ctx.save();
1568
- ctx.globalAlpha = 1 - (1 - Number(params.alpha ?? 1)) * intensity;
1569
- ctx.restore();
1570
- },
1571
- "color-matrix": (ctx, params, intensity) => {
1572
- ctx.save();
1573
- ctx.globalCompositeOperation = "color";
1574
- ctx.fillStyle = `rgba(255, 120, 0, ${0.1 * intensity})`;
1575
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1576
- ctx.restore();
1577
- },
1578
- "neon-glow": (ctx, params, intensity) => {
1579
- ctx.save();
1580
- ctx.shadowBlur = Number(params.distance ?? 15) * intensity;
1581
- ctx.shadowColor = params.color || "#7C6FFF";
1582
- ctx.restore();
1583
- },
1584
- "gaussian-blur": (ctx, params, intensity) => {
1585
- ctx.save();
1586
- try {
1587
- ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
1588
- ctx.drawImage(ctx.canvas, 0, 0);
1589
- } catch {
1590
- }
1591
- ctx.restore();
1592
- },
1593
- "kawase-blur": (ctx, params, intensity) => {
1594
- ctx.save();
1595
- try {
1596
- ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
1597
- ctx.drawImage(ctx.canvas, 0, 0);
1598
- } catch {
1599
- }
1600
- ctx.restore();
1601
- },
1602
- "zoom-blur": (ctx, params, intensity) => {
1603
- ctx.save();
1604
- try {
1605
- ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
1606
- ctx.drawImage(ctx.canvas, 0, 0);
1607
- } catch {
1608
- }
1609
- ctx.restore();
1610
- },
1611
- "radial-blur": (ctx, params, intensity) => {
1612
- ctx.save();
1613
- try {
1614
- ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
1615
- ctx.drawImage(ctx.canvas, 0, 0);
1616
- } catch {
1617
- }
1618
- ctx.restore();
1619
- },
1620
- "drop-shadow": (ctx, params, intensity) => {
1621
- ctx.save();
1622
- ctx.shadowBlur = Number(params.blur ?? 4) * intensity;
1623
- ctx.shadowColor = params.color || "#000000";
1624
- ctx.shadowOffsetX = Number(params.offsetX ?? 4) * intensity;
1625
- ctx.shadowOffsetY = Number(params.offsetY ?? 4) * intensity;
1626
- ctx.restore();
1627
- },
1628
- "static-noise": (ctx, params, intensity) => {
1629
- const width = ctx.canvas.width;
1630
- const height = ctx.canvas.height;
1631
- ctx.save();
1632
- const density = Number(params.noise ?? 0.15) * intensity;
1633
- for (let i = 0; i < 200 * density; i++) {
1634
- const x = Math.random() * width;
1635
- const y = Math.random() * height;
1636
- ctx.fillStyle = `rgba(255, 255, 255, ${0.1 + Math.random() * 0.15})`;
1637
- ctx.fillRect(x, y, 2, 2);
1638
- }
1639
- ctx.restore();
1640
- },
1641
- "old-film": (ctx, params, intensity) => {
1642
- const width = ctx.canvas.width;
1643
- const height = ctx.canvas.height;
1644
- ctx.save();
1645
- ctx.globalCompositeOperation = "color";
1646
- ctx.fillStyle = `rgba(139, 69, 19, ${Number(params.sepia ?? 0.3) * intensity})`;
1647
- ctx.fillRect(0, 0, width, height);
1648
- ctx.globalCompositeOperation = "source-over";
1649
- for (let i = 0; i < 50 * intensity; i++) {
1650
- ctx.fillStyle = "rgba(255,255,255,0.06)";
1651
- ctx.fillRect(Math.random() * width, Math.random() * height, 2, 2);
1652
- }
1653
- ctx.restore();
1654
- },
1655
- "displacement": (ctx, params, intensity) => {
1656
- ctx.save();
1657
- const shiftX = Number(params.scaleX ?? 20) * intensity * 0.1;
1658
- const shiftY = Number(params.scaleY ?? 20) * intensity * 0.1;
1659
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
1660
- ctx.restore();
1661
- },
1662
- "outline": (ctx, params, intensity) => {
1663
- ctx.save();
1664
- ctx.strokeStyle = params.color || "#7C6FFF";
1665
- ctx.lineWidth = Number(params.thickness ?? 3) * intensity;
1666
- ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1667
- ctx.restore();
1668
- },
1669
- "grayscale": (ctx, params, intensity) => {
1670
- ctx.save();
1671
- ctx.globalCompositeOperation = "luminosity";
1672
- ctx.fillStyle = "#ffffff";
1673
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1674
- ctx.restore();
1675
- },
1676
- "dot": (ctx, params, intensity) => {
1677
- const width = ctx.canvas.width;
1678
- const height = ctx.canvas.height;
1679
- ctx.save();
1680
- ctx.fillStyle = "rgba(0,0,0,0.15)";
1681
- const step = Math.max(4, Math.floor(10 * Number(params.scale ?? 1)));
1682
- for (let x = 0; x < width; x += step) {
1683
- for (let y = 0; y < height; y += step) {
1684
- ctx.beginPath();
1685
- ctx.arc(x, y, 1.5 * intensity, 0, Math.PI * 2);
1686
- ctx.fill();
1687
- }
1688
- }
1689
- ctx.restore();
1690
- },
1691
- "emboss": (ctx, params, intensity) => {
1692
- ctx.save();
1693
- ctx.globalAlpha = 0.3 * intensity;
1694
- ctx.drawImage(ctx.canvas, 1, 1);
1695
- ctx.restore();
1696
- },
1697
- "cross-hatch": (ctx, params, intensity) => {
1698
- const width = ctx.canvas.width;
1699
- const height = ctx.canvas.height;
1700
- ctx.save();
1701
- ctx.strokeStyle = `rgba(0,0,0,${0.15 * intensity})`;
1702
- ctx.lineWidth = 1;
1703
- for (let i = 0; i < width; i += 20) {
1704
- ctx.beginPath();
1705
- ctx.moveTo(i, 0);
1706
- ctx.lineTo(i + height, height);
1707
- ctx.stroke();
1708
- }
1709
- ctx.restore();
1710
- },
1711
- "pixelate": (ctx, params, intensity) => {
1712
- const width = ctx.canvas.width;
1713
- const height = ctx.canvas.height;
1714
- const cellW = Math.max(2, Math.floor(Number(params.sizeX ?? 10) * intensity));
1715
- const cellH = Math.max(2, Math.floor(Number(params.sizeY ?? 10) * intensity));
1716
- ctx.save();
1717
- ctx.imageSmoothingEnabled = false;
1718
- const tempCanvas = document.createElement("canvas");
1719
- tempCanvas.width = Math.max(4, Math.floor(width / cellW));
1720
- tempCanvas.height = Math.max(4, Math.floor(height / cellH));
1721
- const tempCtx = tempCanvas.getContext("2d");
1722
- tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
1723
- ctx.clearRect(0, 0, width, height);
1724
- ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
1725
- ctx.restore();
1726
- },
1727
- "ascii": (ctx, params, intensity) => {
1728
- const width = ctx.canvas.width;
1729
- const height = ctx.canvas.height;
1730
- const size = Math.max(4, Math.floor(Number(params.size ?? 8) * intensity));
1731
- ctx.save();
1732
- ctx.imageSmoothingEnabled = false;
1733
- const tempCanvas = document.createElement("canvas");
1734
- tempCanvas.width = Math.max(4, Math.floor(width / size));
1735
- tempCanvas.height = Math.max(4, Math.floor(height / size));
1736
- const tempCtx = tempCanvas.getContext("2d");
1737
- tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
1738
- ctx.clearRect(0, 0, width, height);
1739
- ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
1740
- ctx.restore();
1741
- }
1742
- };
1743
- return renderers[id] || null;
1744
- }
1745
- function searchEffects(query) {
1746
- const lowerQuery = query.toLowerCase();
1747
- return Object.values(EFFECTS_REGISTRY).filter((effect) => effect.name.toLowerCase().includes(lowerQuery) || effect.description.toLowerCase().includes(lowerQuery) || effect.tags.some((tag) => tag.toLowerCase().includes(lowerQuery)));
1748
- }
1749
-
1750
- // src/videoEffects/EffectRenderer.ts
1751
- var EffectRenderer = class {
1752
- /**
1753
- * Apply an effect to a canvas context
1754
- *
1755
- * @param ctx - Canvas 2D context
1756
- * @param renderer - Effect type
1757
- * @param params - Effect parameters
1758
- * @param intensity - Effect intensity (0-1)
1759
- * @param time - Current time for animated effects
1760
- */
1761
- static apply(ctx, renderer, params, intensity = 1, time = 0, bodyMask) {
1762
- const method = getEffectRenderer(renderer);
1763
- if (method) {
1764
- method.call(this, ctx, params, intensity, time, bodyMask);
1765
- } else {
1766
- console.warn(`Unknown effect renderer: ${renderer}`);
1767
- }
1768
- }
1769
- };
1770
-
1771
- // src/videoEffects/EffectGraph.ts
1772
- var EffectGraph = class {
1773
- schemaVersion;
1774
- graphId;
1775
- name;
1776
- nodes = /* @__PURE__ */ new Map();
1777
- edges = [];
1778
- connections = [];
1779
- constructor(definition) {
1780
- if (definition) {
1781
- this.schemaVersion = definition.schemaVersion;
1782
- this.graphId = definition.graphId;
1783
- this.name = definition.name;
1784
- for (const node of definition.nodes) {
1785
- this.nodes.set(node.id, node);
1786
- }
1787
- this.connections = [...definition.connections];
1788
- }
1789
- }
1790
- addNode(node) {
1791
- if (this.nodes.has(node.id)) {
1792
- throw new Error(`[EffectGraph] Node "${node.id}" already exists`);
1793
- }
1794
- this.nodes.set(node.id, node);
1795
- return this;
1796
- }
1797
- addEdge(from, to) {
1798
- if (!this.nodes.has(from)) throw new Error(`[EffectGraph] Unknown node "${from}"`);
1799
- if (!this.nodes.has(to)) throw new Error(`[EffectGraph] Unknown node "${to}"`);
1800
- this.edges.push({ from, to });
1801
- return this;
1802
- }
1803
- removeNode(id) {
1804
- this.nodes.delete(id);
1805
- this.edges = this.edges.filter((e) => e.from !== id && e.to !== id);
1806
- this.connections = this.connections.filter((c) => c.fromNode !== id && c.toNode !== id);
1807
- return this;
1808
- }
1809
- /**
1810
- * Topological sort via Kahn's algorithm.
1811
- * Returns nodes in render order or throws on circular dependency.
1812
- */
1813
- resolve() {
1814
- const inDegree = /* @__PURE__ */ new Map();
1815
- const adjList = /* @__PURE__ */ new Map();
1816
- for (const id of this.nodes.keys()) {
1817
- inDegree.set(id, 0);
1818
- adjList.set(id, []);
1819
- }
1820
- for (const edge of this.edges) {
1821
- inDegree.set(edge.to, (inDegree.get(edge.to) ?? 0) + 1);
1822
- adjList.get(edge.from).push(edge.to);
1823
- }
1824
- for (const conn of this.connections) {
1825
- if (this.nodes.has(conn.fromNode) && this.nodes.has(conn.toNode)) {
1826
- const neighbors = adjList.get(conn.fromNode) || [];
1827
- if (!neighbors.includes(conn.toNode)) {
1828
- neighbors.push(conn.toNode);
1829
- adjList.set(conn.fromNode, neighbors);
1830
- inDegree.set(conn.toNode, (inDegree.get(conn.toNode) ?? 0) + 1);
1831
- }
1832
- }
1833
- }
1834
- for (const [id, node] of this.nodes.entries()) {
1835
- if (node.dependencies) {
1836
- for (const depId of node.dependencies) {
1837
- if (this.nodes.has(depId)) {
1838
- const neighbors = adjList.get(depId) || [];
1839
- if (!neighbors.includes(id)) {
1840
- neighbors.push(id);
1841
- adjList.set(depId, neighbors);
1842
- inDegree.set(id, (inDegree.get(id) ?? 0) + 1);
1843
- }
1844
- }
1845
- }
1846
- }
1847
- }
1848
- const queue = [];
1849
- for (const [id, degree] of inDegree) {
1850
- if (degree === 0) queue.push(id);
1851
- }
1852
- const sorted = [];
1853
- while (queue.length > 0) {
1854
- const id = queue.shift();
1855
- sorted.push(this.nodes.get(id));
1856
- for (const neighbour of adjList.get(id) ?? []) {
1857
- const deg = (inDegree.get(neighbour) ?? 1) - 1;
1858
- inDegree.set(neighbour, deg);
1859
- if (deg === 0) queue.push(neighbour);
1860
- }
1861
- }
1862
- if (sorted.length !== this.nodes.size) {
1863
- const cycle = [...this.nodes.keys()].filter((id) => (inDegree.get(id) ?? 0) > 0);
1864
- throw new Error(`[EffectGraph] Circular dependency detected in nodes: ${cycle.join(", ")}`);
1865
- }
1866
- return sorted;
1867
- }
1868
- getExecutionOrder() {
1869
- return this.resolve().map((node) => node.id);
1870
- }
1871
- getUpstreamNodes(nodeId) {
1872
- const node = this.nodes.get(nodeId);
1873
- const deps = node?.dependencies || [];
1874
- const connected = this.connections.filter((conn) => conn.toNode === nodeId).map((conn) => conn.fromNode);
1875
- return Array.from(/* @__PURE__ */ new Set([...deps, ...connected]));
1876
- }
1877
- /** Returns nodes that can execute in the browser-side authoring raster path. */
1878
- resolveCanvas2D() {
1879
- return this.resolve().filter((n) => n.effect?.backend !== "native");
1880
- }
1881
- get size() {
1882
- return this.nodes.size;
1883
- }
1884
- clear() {
1885
- this.nodes.clear();
1886
- this.edges = [];
1887
- this.connections = [];
1888
- return this;
1889
- }
1890
- };
1891
-
1892
- // src/videoEffects/EffectEngine.ts
1893
- var EffectEngine = class {
1894
- activeGraph = null;
1895
- canvasPool = /* @__PURE__ */ new Map();
1896
- constructor() {
1897
- }
1898
- /**
1899
- * Set the active effect graph to execute
1900
- */
1901
- loadGraph(graph) {
1902
- this.activeGraph = graph;
1903
- this.clearPool();
1904
- }
1905
- /**
1906
- * Clear active graph and associated canvases
1907
- */
1908
- unloadGraph() {
1909
- this.activeGraph = null;
1910
- this.clearPool();
1911
- }
1912
- /**
1913
- * Evaluate node parameters at specific timestamp `t`
1914
- */
1915
- evaluateParameters(node, time) {
1916
- const params = { ...node.params };
1917
- if (!node.keyframes) return params;
1918
- for (const [key, track] of Object.entries(node.keyframes)) {
1919
- if (!track || track.length === 0) continue;
1920
- const sortedKeys = [...track].sort((a, b) => a.time - b.time);
1921
- if (time <= sortedKeys[0].time) {
1922
- params[key] = sortedKeys[0].value;
1923
- continue;
1924
- }
1925
- if (time >= sortedKeys[sortedKeys.length - 1].time) {
1926
- params[key] = sortedKeys[sortedKeys.length - 1].value;
1927
- continue;
1928
- }
1929
- for (let i = 0; i < sortedKeys.length - 1; i++) {
1930
- const k0 = sortedKeys[i];
1931
- const k1 = sortedKeys[i + 1];
1932
- if (time >= k0.time && time <= k1.time) {
1933
- const tRange = k1.time - k0.time;
1934
- const tProgress = tRange === 0 ? 0 : (time - k0.time) / tRange;
1935
- const easedProgress = this.applyEasing(k0.easing, tProgress);
1936
- params[key] = this.interpolate(k0.value, k1.value, easedProgress);
1937
- break;
1938
- }
1939
- }
1940
- }
1941
- return params;
1942
- }
1943
- /**
1944
- * Render the active graph onto a Canvas 2D Context
1945
- *
1946
- * @param ctx Target canvas context
1947
- * @param time Timestamp relative to effect start
1948
- * @param sourceTexture Optional raw image source
1949
- */
1950
- render(ctx, time, sourceTexture) {
1951
- if (!this.activeGraph) return;
1952
- const width = ctx.canvas.width;
1953
- const height = ctx.canvas.height;
1954
- const execOrder = this.activeGraph.getExecutionOrder();
1955
- const outputs = /* @__PURE__ */ new Map();
1956
- for (const nodeId of execOrder) {
1957
- const node = this.activeGraph.nodes.get(nodeId);
1958
- const upstreams = this.activeGraph.getUpstreamNodes(nodeId);
1959
- const buffer = this.acquireCanvas(nodeId, width, height);
1960
- const bufferCtx = buffer.getContext("2d");
1961
- bufferCtx.clearRect(0, 0, width, height);
1962
- if (node.type === "source") {
1963
- if (sourceTexture) {
1964
- bufferCtx.drawImage(sourceTexture, 0, 0, width, height);
1965
- }
1966
- outputs.set(nodeId, buffer);
1967
- } else {
1968
- const evaluatedParams = this.evaluateParameters(node, time);
1969
- const intensity = evaluatedParams.intensity ?? 1;
1970
- if (upstreams.length > 0) {
1971
- const mainInput = outputs.get(upstreams[0]);
1972
- if (mainInput) {
1973
- bufferCtx.drawImage(mainInput, 0, 0, width, height);
1974
- }
1975
- }
1976
- EffectRenderer.apply(bufferCtx, node.type, evaluatedParams, intensity, time);
1977
- outputs.set(nodeId, buffer);
1978
- }
1979
- }
1980
- const finalNodeId = execOrder[execOrder.length - 1];
1981
- const finalFrame = outputs.get(finalNodeId);
1982
- if (finalFrame) {
1983
- ctx.drawImage(finalFrame, 0, 0, width, height);
1984
- }
1985
- }
1986
- /**
1987
- * Interpolate values (numbers or colors)
1988
- */
1989
- interpolate(val0, val1, progress) {
1990
- if (typeof val0 === "number" && typeof val1 === "number") {
1991
- return val0 + (val1 - val0) * progress;
1992
- }
1993
- return progress < 0.5 ? val0 : val1;
1994
- }
1995
- /**
1996
- * Easing curves mapping
1997
- */
1998
- applyEasing(easing, t) {
1999
- switch (easing) {
2000
- case "ease-in":
2001
- case "ease-in-quad":
2002
- return t * t;
2003
- case "ease-out":
2004
- case "ease-out-quad":
2005
- return t * (2 - t);
2006
- case "ease-in-out":
2007
- case "ease-in-out-quad":
2008
- return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
2009
- case "linear":
2010
- default:
2011
- return t;
2012
- }
2013
- }
2014
- /**
2015
- * Acquire Offscreen Canvas context from reuse pool
2016
- */
2017
- acquireCanvas(nodeId, w, h) {
2018
- let canvas = this.canvasPool.get(nodeId);
2019
- if (!canvas) {
2020
- canvas = document.createElement("canvas");
2021
- this.canvasPool.set(nodeId, canvas);
2022
- }
2023
- if (canvas.width !== w || canvas.height !== h) {
2024
- canvas.width = w;
2025
- canvas.height = h;
2026
- }
2027
- return canvas;
2028
- }
2029
- clearPool() {
2030
- this.canvasPool.clear();
2031
- }
2032
- };
2033
-
2034
- // src/videoEffects/utils/canvasUtils.ts
2035
- function addNoise(ctx, amount) {
2036
- const width = ctx.canvas.width;
2037
- const height = ctx.canvas.height;
2038
- const imageData = ctx.getImageData(0, 0, width, height);
2039
- const data = imageData.data;
2040
- for (let i = 0; i < data.length; i += 4) {
2041
- const noise = (Math.random() - 0.5) * 255 * amount;
2042
- data[i] += noise;
2043
- data[i + 1] += noise;
2044
- data[i + 2] += noise;
2045
- }
2046
- ctx.putImageData(imageData, 0, 0);
2047
- }
2048
- function clearCanvas(ctx, color) {
2049
- if (color) {
2050
- ctx.fillStyle = color;
2051
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
2052
- } else {
2053
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
2054
- }
2055
- }
2056
- function withContext(ctx, fn) {
2057
- ctx.save();
2058
- try {
2059
- return fn(ctx);
2060
- } finally {
2061
- ctx.restore();
2062
- }
2063
- }
2064
-
2065
- // src/videoEffects/api.ts
2066
- function getEffectPreviewUrl(effectId, category) {
2067
- return `https://raw.githubusercontent.com/AIEraDev/clypra-api/main/public/effect-previews/${category}/${effectId}.webm`;
2068
- }
2069
- function effectMetadataToApi(metadata) {
2070
- const previewUrl = getEffectPreviewUrl(metadata.id, metadata.category);
2071
- return {
2072
- id: metadata.id,
2073
- name: metadata.name,
2074
- type: "effect",
2075
- category: metadata.category,
2076
- description: metadata.description,
2077
- thumbnail: generateThumbnailUrl(metadata.id),
2078
- renderer: metadata.id,
2079
- params: metadata.defaultParams,
2080
- parameterSchema: metadata.parameterSchema,
2081
- tags: metadata.tags,
2082
- isPremium: metadata.premium,
2083
- intensity: {
2084
- min: 0,
2085
- max: 1,
2086
- default: 0.8,
2087
- step: 0.01
2088
- },
2089
- previewUrl,
2090
- previewDuration: 3,
2091
- thumbnailUrl: generateThumbnailUrl(metadata.id)
2092
- };
2093
- }
2094
- function generateThumbnailUrl(effectId) {
2095
- return `https://raw.githubusercontent.com/AIEraDev/clypra-api/main/public/effect-thumbnails/${effectId}.jpg`;
2096
- }
2097
- function getAllEffectsForApi() {
2098
- return Object.values(EFFECTS_REGISTRY).map((metadata) => effectMetadataToApi(metadata));
2099
- }
2100
- function getEffectsByCategoryForApi(category) {
2101
- const effects = getEffectsByCategory(category);
2102
- return effects.map((metadata) => effectMetadataToApi(metadata));
2103
- }
2104
- function searchEffectsForApi(query) {
2105
- const results = searchEffects(query);
2106
- return results.map((metadata) => effectMetadataToApi(metadata));
2107
- }
2108
- function getEffectByIdForApi(id) {
2109
- const metadata = getEffectMetadata(id);
2110
- if (!metadata) return null;
2111
- return effectMetadataToApi(metadata);
2112
- }
2113
- function getEffectCategoriesSummary() {
2114
- const categories = /* @__PURE__ */ new Map();
2115
- Object.values(EFFECTS_REGISTRY).forEach((effect) => {
2116
- const cat = effect.category;
2117
- if (!categories.has(cat)) {
2118
- categories.set(cat, {
2119
- count: 0,
2120
- description: getCategoryDescription(cat)
2121
- });
2122
- }
2123
- categories.get(cat).count++;
2124
- });
2125
- return Array.from(categories.entries()).map(([id, data]) => ({
2126
- id,
2127
- name: capitalizeCategory(id),
2128
- count: data.count,
2129
- description: data.description
2130
- }));
2131
- }
2132
- function getCategoryDescription(category) {
2133
- const descriptions = {
2134
- essentials: "Essential visual enhancements",
2135
- glitch: "Digital glitches and VHS noise",
2136
- retro: "Vintage film and nostalgic looks",
2137
- light: "Lighting flares, glow, and leaks",
2138
- motion: "Blur, camera movement, and speed",
2139
- color: "Color corrections and grading",
2140
- body: "Body tracking and segmentation effects"
2141
- };
2142
- return descriptions[category] || "";
2143
- }
2144
- function capitalizeCategory(category) {
2145
- return category.charAt(0).toUpperCase() + category.slice(1);
2146
- }
2147
- function generateEffectsManifest() {
2148
- return {
2149
- version: "1.0.0",
2150
- totalCount: Object.keys(EFFECTS_REGISTRY).length,
2151
- categories: getEffectCategoriesSummary(),
2152
- effects: getAllEffectsForApi()
2153
- };
2154
- }
2155
-
2156
- // src/videoEffects/renderers/camera/index.ts
2157
- var camera_exports = {};
2158
- __export(camera_exports, {
2159
- renderDolly: () => renderDolly,
2160
- renderPan: () => renderPan,
2161
- renderRotate: () => renderRotate,
2162
- renderShake: () => renderShake,
2163
- renderZoom: () => renderZoom
2164
- });
2165
-
2166
- // src/videoEffects/renderers/camera/shake.ts
2167
- function renderShake(ctx, params, intensity, time) {
2168
- const shakeIntensity = (params.intensity || 50) * intensity;
2169
- const frequency = params.frequency || 10;
2170
- const offsetX = Math.sin(time * frequency) * shakeIntensity;
2171
- const offsetY = Math.cos(time * frequency * 1.3) * shakeIntensity;
2172
- ctx.translate(offsetX, offsetY);
2173
- }
2174
-
2175
- // src/videoEffects/renderers/camera/zoom.ts
2176
- function renderZoom(ctx, params, intensity, time) {
2177
- const scale = 1 + (params.scale || 0.2) * intensity;
2178
- const centerX = params.centerX || 0.5;
2179
- const centerY = params.centerY || 0.5;
2180
- const width = ctx.canvas.width;
2181
- const height = ctx.canvas.height;
2182
- ctx.translate(width * centerX, height * centerY);
2183
- ctx.scale(scale, scale);
2184
- ctx.translate(-width * centerX, -height * centerY);
2185
- }
2186
-
2187
- // src/videoEffects/renderers/camera/pan.ts
2188
- function renderPan(ctx, params, intensity, time) {
2189
- const panX = (params.panX || 0) * intensity;
2190
- const panY = (params.panY || 0) * intensity;
2191
- ctx.translate(panX, panY);
2192
- }
2193
-
2194
- // src/videoEffects/renderers/camera/rotate.ts
2195
- function renderRotate(ctx, params, intensity, time) {
2196
- const angle = (params.angle || 0) * intensity * (Math.PI / 180);
2197
- const width = ctx.canvas.width;
2198
- const height = ctx.canvas.height;
2199
- ctx.translate(width / 2, height / 2);
2200
- ctx.rotate(angle);
2201
- ctx.translate(-width / 2, -height / 2);
2202
- }
2203
-
2204
- // src/videoEffects/renderers/camera/dolly.ts
2205
- function renderDolly(ctx, params, intensity, time) {
2206
- renderZoom(ctx, params, intensity, time);
2207
- }
2208
-
2209
- export {
2210
- hexToRgba,
2211
- rgbaToComponents,
2212
- blendColors,
2213
- light_exports,
2214
- EFFECTS_REGISTRY,
2215
- getEffectMetadata,
2216
- getEffectsByCategory,
2217
- getEffectRenderer,
2218
- searchEffects,
2219
- EffectRenderer,
2220
- EffectGraph,
2221
- EffectEngine,
2222
- addNoise,
2223
- clearCanvas,
2224
- withContext,
2225
- getEffectPreviewUrl,
2226
- effectMetadataToApi,
2227
- getAllEffectsForApi,
2228
- getEffectsByCategoryForApi,
2229
- searchEffectsForApi,
2230
- getEffectByIdForApi,
2231
- getEffectCategoriesSummary,
2232
- generateEffectsManifest,
2233
- camera_exports
2234
- };
2235
- //# sourceMappingURL=chunk-SH7HOGVX.js.map