@clypra-studio/engine 1.8.1 → 1.10.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.
@@ -19,12 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/videoEffects/index.ts
20
20
  var videoEffects_exports = {};
21
21
  __export(videoEffects_exports, {
22
- CameraEffects: () => camera_exports,
23
22
  EFFECTS_REGISTRY: () => EFFECTS_REGISTRY,
24
23
  EffectEngine: () => EffectEngine,
25
24
  EffectGraph: () => EffectGraph,
26
25
  EffectRenderer: () => EffectRenderer,
27
- LightEffects: () => light_exports,
28
26
  addNoise: () => addNoise,
29
27
  blendColors: () => blendColors,
30
28
  clearCanvas: () => clearCanvas,
@@ -46,714 +44,23 @@ __export(videoEffects_exports, {
46
44
  });
47
45
  module.exports = __toCommonJS(videoEffects_exports);
48
46
 
49
- // src/videoEffects/renderers/light/index.ts
50
- var light_exports = {};
51
- __export(light_exports, {
52
- renderDustParticles: () => renderDustParticles,
53
- renderFire: () => renderFire,
54
- renderFlash: () => renderFlash,
55
- renderFlicker: () => renderFlicker,
56
- renderGlow: () => renderGlow,
57
- renderLightLeak: () => renderLightLeak,
58
- renderLightLeak2: () => renderLightLeak2,
59
- renderParticles: () => renderParticles,
60
- renderVignette: () => renderVignette
61
- });
62
-
63
- // src/videoEffects/renderers/light/lightLeak.ts
64
- function renderLightLeak(ctx, params, intensity, time) {
65
- const width = ctx.canvas.width;
66
- const height = ctx.canvas.height;
67
- const gradient = ctx.createLinearGradient(0, 0, width, height);
68
- gradient.addColorStop(0, `rgba(255, 200, 100, ${intensity * 0.3})`);
69
- gradient.addColorStop(1, "rgba(255, 200, 100, 0)");
70
- ctx.globalCompositeOperation = "screen";
71
- ctx.fillStyle = gradient;
72
- ctx.fillRect(0, 0, width, height);
73
- ctx.globalCompositeOperation = "source-over";
74
- }
75
-
76
- // src/videoEffects/utils/colorUtils.ts
77
- function hexToRgba(hex, alpha) {
78
- hex = hex.replace("#", "");
79
- const r = parseInt(hex.substring(0, 2), 16);
80
- const g = parseInt(hex.substring(2, 4), 16);
81
- const b = parseInt(hex.substring(4, 6), 16);
82
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
83
- }
84
- function rgbaToComponents(rgba) {
85
- const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
86
- if (!match) {
87
- return { r: 0, g: 0, b: 0, a: 1 };
88
- }
89
- return {
90
- r: parseInt(match[1]),
91
- g: parseInt(match[2]),
92
- b: parseInt(match[3]),
93
- a: match[4] ? parseFloat(match[4]) : 1
94
- };
95
- }
96
- function blendColors(color1, color2, ratio) {
97
- const c1 = rgbaToComponents(color1);
98
- const c2 = rgbaToComponents(color2);
99
- const r = Math.round(c1.r * (1 - ratio) + c2.r * ratio);
100
- const g = Math.round(c1.g * (1 - ratio) + c2.g * ratio);
101
- const b = Math.round(c1.b * (1 - ratio) + c2.b * ratio);
102
- const a = c1.a * (1 - ratio) + c2.a * ratio;
103
- return `rgba(${r}, ${g}, ${b}, ${a})`;
104
- }
105
-
106
- // src/videoEffects/renderers/light/lightLeak2.ts
107
- function renderLightLeak2(ctx, params, intensity, time) {
108
- const width = ctx.canvas.width;
109
- const height = ctx.canvas.height;
110
- const duration = params.duration || 3;
111
- const progress = time % duration / duration;
112
- let x, y;
113
- let fadeMultiplier = 1;
114
- if (progress < 0.4) {
115
- const phase1Progress = progress / 0.4;
116
- x = width * phase1Progress;
117
- y = height;
118
- } else if (progress < 0.8) {
119
- const phase2Progress = (progress - 0.4) / 0.4;
120
- x = width;
121
- y = height * (1 - phase2Progress);
122
- } else {
123
- const phase3Progress = (progress - 0.8) / 0.2;
124
- x = width;
125
- y = 0;
126
- fadeMultiplier = 1 - phase3Progress;
127
- }
128
- const leakSize = Math.min(width, height) * (params.size || 0.8);
129
- const gradient = ctx.createRadialGradient(x, y, 0, x, y, leakSize);
130
- const color1 = params.color1 || "#FF6B35";
131
- const color2 = params.color2 || "#FF8C42";
132
- const color3 = params.color3 || "#FFA500";
133
- const alpha = intensity * fadeMultiplier;
134
- gradient.addColorStop(0, hexToRgba(color1, alpha * 0.9));
135
- gradient.addColorStop(0.2, hexToRgba(color2, alpha * 0.7));
136
- gradient.addColorStop(0.5, hexToRgba(color3, alpha * 0.4));
137
- gradient.addColorStop(0.8, hexToRgba(color3, alpha * 0.1));
138
- gradient.addColorStop(1, "rgba(255, 165, 0, 0)");
139
- ctx.globalCompositeOperation = "screen";
140
- ctx.fillStyle = gradient;
141
- ctx.fillRect(0, 0, width, height);
142
- ctx.globalCompositeOperation = "source-over";
143
- }
144
-
145
- // src/videoEffects/renderers/light/flash.ts
146
- function renderFlash(ctx, params, intensity, time) {
147
- const flashColor = params.flashColor || "#ffffff";
148
- const flashIntensity = (params.flashIntensity || 1) * intensity;
149
- ctx.globalCompositeOperation = "screen";
150
- ctx.fillStyle = flashColor;
151
- ctx.globalAlpha = flashIntensity;
152
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
153
- ctx.globalAlpha = 1;
154
- ctx.globalCompositeOperation = "source-over";
155
- }
156
-
157
- // src/videoEffects/renderers/light/flicker.ts
158
- function renderFlicker(ctx, params, intensity, time) {
159
- const flickerAmount = Math.random() * intensity;
160
- ctx.globalAlpha = 1 - flickerAmount * 0.5;
161
- }
162
-
163
- // src/videoEffects/renderers/light/vignette.ts
164
- function renderVignette(ctx, params, intensity, time) {
165
- const width = ctx.canvas.width;
166
- const height = ctx.canvas.height;
167
- const radius = params.radius || 0.7;
168
- const gradient = ctx.createRadialGradient(width / 2, height / 2, Math.min(width, height) * radius, width / 2, height / 2, Math.max(width, height));
169
- gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
170
- gradient.addColorStop(1, `rgba(0, 0, 0, ${intensity * 0.7})`);
171
- ctx.fillStyle = gradient;
172
- ctx.fillRect(0, 0, width, height);
173
- }
174
-
175
- // src/videoEffects/renderers/light/glow.ts
176
- function renderGlow(ctx, params, intensity, time) {
177
- const glowAmount = (params.glowAmount || 10) * intensity;
178
- ctx.shadowBlur = glowAmount;
179
- ctx.shadowColor = params.glowColor || "#ffffff";
180
- }
181
-
182
- // src/videoEffects/renderers/light/fire.ts
183
- function renderFire(ctx, params, intensity, time) {
184
- const width = ctx.canvas.width;
185
- const height = ctx.canvas.height;
186
- const fireHeight = (params.fireHeight ?? 0.4) * height;
187
- const particleCount = Math.floor((params.particleCount ?? 50) * intensity);
188
- const fireColor1 = params.fireColor1 ?? "#FF4500";
189
- const fireColor2 = params.fireColor2 ?? "#FFA500";
190
- const fireColor3 = params.fireColor3 ?? "#FFD700";
191
- const gradient = ctx.createLinearGradient(0, height, 0, height - fireHeight);
192
- gradient.addColorStop(0, fireColor1);
193
- gradient.addColorStop(0.5, fireColor2);
194
- gradient.addColorStop(1, fireColor3);
195
- ctx.globalAlpha = 0.6 * intensity;
196
- ctx.fillStyle = gradient;
197
- ctx.beginPath();
198
- ctx.moveTo(0, height);
199
- const waveCount = 8;
200
- const waveAmplitude = 40;
201
- const waveSpeed = time * 3;
202
- for (let i = 0; i <= width; i += width / 100) {
203
- const waveOffset = Math.sin(i / width * waveCount + waveSpeed) * waveAmplitude;
204
- ctx.lineTo(i, height - fireHeight + waveOffset);
205
- }
206
- ctx.lineTo(width, height);
207
- ctx.closePath();
208
- ctx.fill();
209
- ctx.globalAlpha = 0.8 * intensity;
210
- for (let i = 0; i < particleCount; i++) {
211
- const x = (Math.sin(time * 2 + i * 0.5) * 0.5 + 0.5) * width;
212
- const particleProgress = (time * 0.5 + i * 0.1) % 1;
213
- const y = height - particleProgress * fireHeight * 1.2;
214
- const size = (1 - particleProgress) * 8 * intensity;
215
- const alpha = (1 - particleProgress) * intensity;
216
- ctx.globalAlpha = alpha;
217
- ctx.fillStyle = i % 3 === 0 ? fireColor1 : i % 3 === 1 ? fireColor2 : fireColor3;
218
- ctx.beginPath();
219
- ctx.arc(x, y, size, 0, Math.PI * 2);
220
- ctx.fill();
221
- }
222
- ctx.globalAlpha = 1;
223
- }
224
-
225
- // src/videoEffects/renderers/light/particles.ts
226
- function renderParticles(ctx, params, intensity, time) {
227
- const width = ctx.canvas.width;
228
- const height = ctx.canvas.height;
229
- const particleCount = Math.floor((params.particleCount ?? 100) * intensity);
230
- const particleSize = (params.particleSize ?? 3) * intensity;
231
- const particleColor = params.particleColor ?? "#FFFFFF";
232
- const driftSpeed = params.driftSpeed ?? 1;
233
- const fadeEffect = params.fadeEffect ?? true;
234
- ctx.globalCompositeOperation = "screen";
235
- for (let i = 0; i < particleCount; i++) {
236
- const seed = i * 0.1;
237
- const x = (Math.sin(time * driftSpeed * 0.5 + seed) * 0.5 + 0.5) * width;
238
- const y = (time * driftSpeed * 20 + i * 15) % (height + 100) - 50;
239
- const sizeVariation = Math.sin(time * 2 + seed) * 0.3 + 0.7;
240
- const size = particleSize * sizeVariation;
241
- let alpha = intensity * 0.8;
242
- if (fadeEffect) {
243
- if (y < 100) {
244
- alpha *= y / 100;
245
- } else if (y > height - 100) {
246
- alpha *= (height - y) / 100;
247
- }
248
- }
249
- ctx.globalAlpha = Math.max(0, alpha);
250
- ctx.fillStyle = particleColor;
251
- ctx.beginPath();
252
- ctx.arc(x, y, size, 0, Math.PI * 2);
253
- ctx.fill();
254
- }
255
- ctx.globalAlpha = 1;
256
- ctx.globalCompositeOperation = "source-over";
257
- }
258
- function renderDustParticles(ctx, params, intensity, time) {
259
- const width = ctx.canvas.width;
260
- const height = ctx.canvas.height;
261
- const particleCount = Math.floor((params.particleCount ?? 60) * intensity);
262
- const particleSize = (params.particleSize ?? 2) * intensity;
263
- const particleColor = params.particleColor ?? "#E0E0E0";
264
- ctx.globalCompositeOperation = "screen";
265
- ctx.globalAlpha = 0.3 * intensity;
266
- for (let i = 0; i < particleCount; i++) {
267
- const seed = i * 0.05;
268
- const x = (Math.sin(time * 0.2 + seed) * 0.5 + 0.5) * width;
269
- const y = (Math.cos(time * 0.15 + seed * 2) * 0.5 + 0.5) * height;
270
- const sizePulse = Math.sin(time + seed * 3) * 0.2 + 0.8;
271
- const size = particleSize * sizePulse;
272
- const alphaVariation = Math.sin(time * 0.5 + seed * 5) * 0.3 + 0.7;
273
- ctx.globalAlpha = 0.2 * intensity * alphaVariation;
274
- ctx.fillStyle = particleColor;
275
- ctx.beginPath();
276
- ctx.arc(x, y, size, 0, Math.PI * 2);
277
- ctx.fill();
278
- }
279
- ctx.globalAlpha = 1;
280
- ctx.globalCompositeOperation = "source-over";
281
- }
282
-
283
47
  // src/videoEffects/effectsRegistry.ts
284
48
  var EFFECTS_REGISTRY = {
285
- // ==================== LIGHT EFFECTS ====================
286
- light_leak: {
287
- id: "light_leak",
288
- name: "Light Leak",
289
- category: "light",
290
- description: "Classic light leak effect",
291
- defaultParams: {},
292
- parameterSchema: {},
293
- tags: ["light", "vintage", "film"]
294
- },
295
- light_leak_2: {
296
- id: "light_leak_2",
297
- name: "Leak 2",
298
- category: "light",
299
- description: "Animated red/orange light moving across the frame",
300
- defaultParams: {
301
- duration: 3,
302
- size: 0.8,
303
- color1: "#FF6B35",
304
- color2: "#FF8C42",
305
- color3: "#FFA500"
306
- },
307
- parameterSchema: {
308
- duration: {
309
- type: "number",
310
- label: "Duration",
311
- min: 1,
312
- max: 10,
313
- default: 3,
314
- step: 0.5
315
- },
316
- size: {
317
- type: "number",
318
- label: "Size",
319
- min: 0.1,
320
- max: 1.5,
321
- default: 0.8,
322
- step: 0.1
323
- },
324
- color1: {
325
- type: "color",
326
- label: "Primary Color",
327
- default: "#FF6B35"
328
- },
329
- color2: {
330
- type: "color",
331
- label: "Secondary Color",
332
- default: "#FF8C42"
333
- },
334
- color3: {
335
- type: "color",
336
- label: "Tertiary Color",
337
- default: "#FFA500"
338
- }
339
- },
340
- tags: ["light", "animated", "cinematic", "warm"]
341
- },
342
- flash: {
343
- id: "flash",
344
- name: "Flash",
345
- category: "light",
346
- description: "Bright flash effect",
347
- defaultParams: { flashColor: "#ffffff", flashIntensity: 1 },
348
- parameterSchema: {
349
- flashColor: {
350
- type: "color",
351
- label: "Flash Color",
352
- default: "#ffffff"
353
- },
354
- flashIntensity: {
355
- type: "number",
356
- label: "Intensity",
357
- min: 0,
358
- max: 1,
359
- default: 1,
360
- step: 0.1
361
- }
362
- },
363
- tags: ["light", "bright", "instant"]
364
- },
365
- flicker: {
366
- id: "flicker",
367
- name: "Flicker",
368
- category: "light",
369
- description: "Random light flickering effect",
370
- defaultParams: {},
371
- parameterSchema: {},
372
- tags: ["light", "flicker", "dynamic"]
373
- },
374
- vignette: {
375
- id: "vignette",
376
- name: "Vignette",
377
- category: "light",
378
- description: "Darkens the edges of the frame",
379
- defaultParams: { radius: 0.7 },
380
- parameterSchema: {
381
- radius: {
382
- type: "number",
383
- label: "Radius",
384
- min: 0.1,
385
- max: 1,
386
- default: 0.7,
387
- step: 0.05
388
- }
389
- },
390
- tags: ["light", "vintage", "cinematic"]
391
- },
392
- glow: {
393
- id: "glow",
394
- name: "Glow",
395
- category: "light",
396
- description: "Adds a glow effect",
397
- defaultParams: { glowAmount: 10, glowColor: "#ffffff" },
398
- parameterSchema: {
399
- glowAmount: {
400
- type: "number",
401
- label: "Amount",
402
- min: 0,
403
- max: 50,
404
- default: 10,
405
- step: 1
406
- },
407
- glowColor: {
408
- type: "color",
409
- label: "Color",
410
- default: "#ffffff"
411
- }
412
- },
413
- tags: ["light", "soft", "dreamy"]
414
- },
415
- fire: {
416
- id: "fire",
417
- name: "Fire",
418
- category: "light",
419
- description: "Animated fire effect with particles",
420
- defaultParams: {
421
- fireHeight: 0.4,
422
- particleCount: 50,
423
- fireColor1: "#FF4500",
424
- fireColor2: "#FFA500",
425
- fireColor3: "#FFD700"
426
- },
427
- parameterSchema: {
428
- fireHeight: {
429
- type: "number",
430
- label: "Fire Height",
431
- min: 0.1,
432
- max: 0.8,
433
- default: 0.4,
434
- step: 0.05
435
- },
436
- particleCount: {
437
- type: "number",
438
- label: "Particle Count",
439
- min: 10,
440
- max: 100,
441
- default: 50,
442
- step: 5
443
- },
444
- fireColor1: {
445
- type: "color",
446
- label: "Base Color",
447
- default: "#FF4500"
448
- },
449
- fireColor2: {
450
- type: "color",
451
- label: "Mid Color",
452
- default: "#FFA500"
453
- },
454
- fireColor3: {
455
- type: "color",
456
- label: "Top Color",
457
- default: "#FFD700"
458
- }
459
- },
460
- tags: ["light", "animated", "fire", "particles"]
461
- },
462
- particles: {
463
- id: "particles",
464
- name: "Particles",
465
- category: "light",
466
- description: "Floating particle effect",
467
- defaultParams: {
468
- particleCount: 100,
469
- particleSize: 3,
470
- particleColor: "#FFFFFF",
471
- driftSpeed: 1,
472
- fadeEffect: true
473
- },
474
- parameterSchema: {
475
- particleCount: {
476
- type: "number",
477
- label: "Particle Count",
478
- min: 20,
479
- max: 200,
480
- default: 100,
481
- step: 10
482
- },
483
- particleSize: {
484
- type: "number",
485
- label: "Particle Size",
486
- min: 1,
487
- max: 10,
488
- default: 3,
489
- step: 0.5
490
- },
491
- particleColor: {
492
- type: "color",
493
- label: "Color",
494
- default: "#FFFFFF"
495
- },
496
- driftSpeed: {
497
- type: "number",
498
- label: "Drift Speed",
499
- min: 0.1,
500
- max: 3,
501
- default: 1,
502
- step: 0.1
503
- },
504
- fadeEffect: {
505
- type: "boolean",
506
- label: "Fade at Edges",
507
- default: true
508
- }
509
- },
510
- tags: ["light", "animated", "particles", "floating"]
511
- },
512
- dust_particles: {
513
- id: "dust_particles",
514
- name: "Dust Particles",
515
- category: "light",
516
- description: "Slow drifting dust particles",
517
- defaultParams: {
518
- particleCount: 60,
519
- particleSize: 2,
520
- particleColor: "#E0E0E0"
521
- },
522
- parameterSchema: {
523
- particleCount: {
524
- type: "number",
525
- label: "Particle Count",
526
- min: 20,
527
- max: 150,
528
- default: 60,
529
- step: 10
530
- },
531
- particleSize: {
532
- type: "number",
533
- label: "Particle Size",
534
- min: 1,
535
- max: 5,
536
- default: 2,
537
- step: 0.5
538
- },
539
- particleColor: {
540
- type: "color",
541
- label: "Color",
542
- default: "#E0E0E0"
543
- }
544
- },
545
- tags: ["light", "particles", "dust", "subtle"]
546
- },
547
- // ==================== BODY EFFECTS ====================
548
- body_glow: {
549
- id: "body_glow",
550
- name: "Body Glow",
551
- category: "body",
552
- description: "Adds a soft neon glow around the body silhouette",
553
- defaultParams: { glowColor: "#7C6FFF", glowRadius: 20, glowIntensity: 0.8 },
554
- parameterSchema: {
555
- glowColor: { type: "color", label: "Glow Color", default: "#7C6FFF" },
556
- glowRadius: { type: "number", label: "Glow Radius", min: 5, max: 50, default: 20, step: 1 },
557
- glowIntensity: { type: "number", label: "Glow Intensity", min: 0.1, max: 1, default: 0.8, step: 0.05 }
558
- },
559
- tags: ["body", "neon", "glow"]
560
- },
561
- body_outline: {
562
- id: "body_outline",
563
- name: "Body Outline",
564
- category: "body",
565
- description: "Traces the outline of the body with a glowing line",
566
- defaultParams: { outlineColor: "#00E5FF", outlineWidth: 6, feather: 15 },
567
- parameterSchema: {
568
- outlineColor: { type: "color", label: "Outline Color", default: "#00E5FF" },
569
- outlineWidth: { type: "number", label: "Outline Width", min: 2, max: 20, default: 6, step: 1 },
570
- feather: { type: "number", label: "Feather", min: 0, max: 30, default: 15, step: 1 }
571
- },
572
- tags: ["body", "outline", "glowing"]
573
- },
574
- body_particles: {
575
- id: "body_particles",
576
- name: "Body Particles",
577
- category: "body",
578
- description: "Emits floating particles tracing the body shape",
579
- defaultParams: { particleColor: "#FF2A85", particleCount: 60, particleSize: 3, drift: 8 },
580
- parameterSchema: {
581
- particleColor: { type: "color", label: "Particle Color", default: "#FF2A85" },
582
- particleCount: { type: "number", label: "Particle Count", min: 10, max: 150, default: 60, step: 5 },
583
- particleSize: { type: "number", label: "Particle Size", min: 1, max: 8, default: 3, step: 0.5 },
584
- drift: { type: "number", label: "Drift", min: 2, max: 20, default: 8, step: 1 }
585
- },
586
- tags: ["body", "particles", "floating"]
587
- },
588
- "body-segmentation-glow": {
589
- id: "body-segmentation-glow",
590
- name: "Segmentation Glow",
591
- category: "body",
592
- description: "Glow overlay matching body segmentation mask",
593
- defaultParams: { glowColor: "#FFD700", glowRadius: 25 },
594
- parameterSchema: {
595
- glowColor: { type: "color", label: "Color", default: "#FFD700" },
596
- glowRadius: { type: "number", label: "Radius", min: 5, max: 50, default: 25, step: 1 }
597
- },
598
- tags: ["body", "segmentation", "glow"]
599
- },
600
- // Native video filter effects (unified registry metadata)
601
- "light-leak": {
602
- id: "light-leak",
603
- name: "Light Leak",
604
- category: "light",
605
- description: "Classic cinematic light sweep across the frame",
606
- defaultParams: { gain: 0.6, lacunarity: 2.5, alpha: 0.8, angle: 30, speed: 1, animated: true },
607
- parameterSchema: {
608
- gain: { type: "number", label: "Gain", min: 0, max: 1, default: 0.6, step: 0.05 },
609
- lacunarity: { type: "number", label: "Lacunarity", min: 0, max: 5, default: 2.5, step: 0.1 },
610
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.8, step: 0.05 },
611
- angle: { type: "number", label: "Angle", min: -180, max: 180, default: 30, step: 5 },
612
- speed: { type: "number", label: "Speed", min: 0, max: 5, default: 1, step: 0.1 }
613
- },
614
- tags: ["light", "vintage", "film"]
615
- },
616
- "lens-flare": {
617
- id: "lens-flare",
618
- name: "Lens Flare",
619
- category: "light",
620
- description: "Double-stage lens flare: Godray filter coupled with an animated GPU starburst shader.",
621
- defaultParams: { godrayGain: 0.4, godrayAlpha: 0.5, flareIntensity: 0.8, flareColor: "#7C6FFF", speed: 1, animated: true },
622
- parameterSchema: {
623
- godrayGain: { type: "number", label: "Rays Gain", min: 0, max: 1, default: 0.4, step: 0.05 },
624
- godrayAlpha: { type: "number", label: "Rays Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
625
- flareIntensity: { type: "number", label: "Intensity", min: 0, max: 3, default: 0.8, step: 0.05 },
626
- flareColor: { type: "color", label: "Color", default: "#7C6FFF" },
627
- speed: { type: "number", label: "Speed", min: 0, max: 4, default: 1, step: 0.1 }
628
- },
629
- tags: ["light", "flare", "cinematic"]
630
- },
631
- "rgb-split": {
632
- id: "rgb-split",
633
- name: "RGB Split",
634
- category: "glitch",
635
- description: "Split red, green, and blue channels",
636
- defaultParams: { redX: 4, redY: 0, blueX: -4, blueY: 0, greenX: 0, greenY: 0, speed: 1.5, animated: true },
637
- parameterSchema: {
638
- redX: { type: "number", label: "Red X", min: -50, max: 50, default: 4, step: 0.5 },
639
- redY: { type: "number", label: "Red Y", min: -50, max: 50, default: 0, step: 0.5 },
640
- blueX: { type: "number", label: "Blue X", min: -50, max: 50, default: -4, step: 0.5 },
641
- blueY: { type: "number", label: "Blue Y", min: -50, max: 50, default: 0, step: 0.5 },
642
- greenX: { type: "number", label: "Green X", min: -50, max: 50, default: 0, step: 0.5 },
643
- greenY: { type: "number", label: "Green Y", min: -50, max: 50, default: 0, step: 0.5 },
644
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
645
- },
646
- tags: ["glitch", "rgb", "chromatic"]
647
- },
648
- "vhs": {
649
- id: "vhs",
650
- name: "VHS",
651
- category: "glitch",
652
- description: "Vintage tape tracking lines and phosphor noise",
653
- defaultParams: { noise: 0.08, scanlines: true, lineAlpha: 0.25, hShift: 3e-3, bandSpeed: 1.2, bandAlpha: 0.35 },
654
- parameterSchema: {
655
- noise: { type: "number", label: "Noise", min: 0, max: 0.3, default: 0.08, step: 0.01 },
656
- scanlines: { type: "boolean", label: "Scanlines", default: true },
657
- lineAlpha: { type: "number", label: "Line Alpha", min: 0, max: 1, default: 0.25, step: 0.05 },
658
- hShift: { type: "number", label: "H-Shift", min: 0, max: 0.02, default: 3e-3, step: 1e-3 },
659
- bandSpeed: { type: "number", label: "Band Speed", min: 0.1, max: 5, default: 1.2, step: 0.1 },
660
- bandAlpha: { type: "number", label: "Band Alpha", min: 0, max: 1, default: 0.35, step: 0.05 }
661
- },
662
- tags: ["glitch", "retro", "vhs", "tape"]
663
- },
664
- "glitch-band": {
665
- id: "glitch-band",
666
- name: "Glitch Band",
667
- category: "glitch",
668
- description: "Digital glitch slices running dynamically",
669
- defaultParams: { slices: 15, offset: 80, direction: 0, redX: -3, redY: 0, blueX: 3, blueY: 0, animated: true },
670
- parameterSchema: {
671
- slices: { type: "number", label: "Slices", min: 2, max: 80, default: 15, step: 1 },
672
- offset: { type: "number", label: "Offset", min: 0, max: 400, default: 80, step: 5 },
673
- direction: { type: "number", label: "Direction", min: 0, max: 360, default: 0, step: 5 },
674
- redX: { type: "number", label: "Red X", min: -20, max: 20, default: -3, step: 1 },
675
- redY: { type: "number", label: "Red Y", min: -20, max: 20, default: 0, step: 1 },
676
- blueX: { type: "number", label: "Blue X", min: -20, max: 20, default: 3, step: 1 },
677
- blueY: { type: "number", label: "Blue Y", min: -20, max: 20, default: 0, step: 1 }
678
- },
679
- tags: ["glitch", "digital", "distortion"]
680
- },
681
- "crt": {
682
- id: "crt",
683
- name: "CRT Monitor",
684
- category: "glitch",
685
- description: "Old television curve display and phosphor noise",
686
- defaultParams: { curvature: 1, lineWidth: 1, lineContrast: 0.25, noise: 0.15, vignetting: 0.3, flicker: 0.15, animated: true },
687
- parameterSchema: {
688
- curvature: { type: "number", label: "Curvature", min: 0, max: 6, default: 1, step: 0.1 },
689
- lineWidth: { type: "number", label: "Line Width", min: 0, max: 5, default: 1, step: 0.5 },
690
- lineContrast: { type: "number", label: "Line Contrast", min: 0, max: 1, default: 0.25, step: 0.05 },
691
- noise: { type: "number", label: "Noise", min: 0, max: 0.8, default: 0.15, step: 0.05 },
692
- vignetting: { type: "number", label: "Vignette Size", min: 0, max: 0.8, default: 0.3, step: 0.05 },
693
- flicker: { type: "number", label: "Flicker", min: 0, max: 0.5, default: 0.15, step: 0.05 }
694
- },
695
- tags: ["glitch", "retro", "tv"]
696
- },
697
- "film-grain": {
698
- id: "film-grain",
699
- name: "Film Grain",
700
- category: "cinematic",
701
- description: "Real organic analog movie grain",
702
- defaultParams: { intensity: 0.25, size: 2, animated: true },
703
- parameterSchema: {
704
- intensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.25, step: 0.05 },
705
- size: { type: "number", label: "Grain Size", min: 0.5, max: 6, default: 2, step: 0.1 }
706
- },
707
- tags: ["cinematic", "film", "grain"]
708
- },
709
- "tilt-shift": {
710
- id: "tilt-shift",
711
- name: "Tilt Shift",
712
- category: "cinematic",
713
- description: "Miniature belt blur focus effect",
714
- defaultParams: { blur: 40, gradientBlur: 300, focusY: 0.5, focusRange: 0.15 },
715
- parameterSchema: {
716
- blur: { type: "number", label: "Edge Blur", min: 0, max: 100, default: 40, step: 1 },
717
- gradientBlur: { type: "number", label: "Gradient Blur", min: 50, max: 800, default: 300, step: 10 },
718
- focusY: { type: "number", label: "Focus Position", min: 0, max: 1, default: 0.5, step: 0.05 },
719
- focusRange: { type: "number", label: "Focus Range", min: 0.05, max: 0.4, default: 0.15, step: 0.05 }
720
- },
721
- tags: ["cinematic", "blur", "miniature"]
722
- },
723
- "cinematic-lut": {
724
- id: "cinematic-lut",
725
- name: "Cinematic LUT",
726
- category: "cinematic",
727
- description: "Orange and Teal cinematic lookup table filter",
728
- defaultParams: { lutIntensity: 0.8, brightness: 1, contrast: 1, saturation: 1 },
729
- parameterSchema: {
730
- lutIntensity: { type: "number", label: "LUT Intensity", min: 0, max: 1, default: 0.8, step: 0.05 },
731
- brightness: { type: "number", label: "Brightness", min: 0.5, max: 1.5, default: 1, step: 0.05 },
732
- contrast: { type: "number", label: "Contrast", min: 0.5, max: 1.5, default: 1, step: 0.05 },
733
- saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 }
734
- },
735
- tags: ["cinematic", "color", "lut"]
736
- },
737
- "motion-blur": {
738
- id: "motion-blur",
739
- name: "Motion Blur",
740
- category: "cinematic",
741
- description: "Speed-based directional camera blur",
742
- defaultParams: { velocityX: 20, velocityY: 0, kernelSize: 9, offset: 0 },
743
- parameterSchema: {
744
- velocityX: { type: "number", label: "Velocity X", min: -80, max: 80, default: 20, step: 1 },
745
- velocityY: { type: "number", label: "Velocity Y", min: -80, max: 80, default: 0, step: 1 },
746
- kernelSize: { type: "number", label: "Kernel Size", min: 5, max: 25, default: 9, step: 2 },
747
- offset: { type: "number", label: "Offset", min: 0, max: 10, default: 0, step: 1 }
748
- },
749
- tags: ["cinematic", "blur", "motion"]
750
- },
751
- "shockwave": {
49
+ shockwave: {
752
50
  id: "shockwave",
753
51
  name: "Shockwave",
754
52
  category: "distortion",
755
53
  description: "Expanding shockwave wave refraction",
756
- defaultParams: { centerX: 0.5, centerY: 0.5, speed: 1.5, amplitude: 30, wavelength: 160, brightness: 1, radius: 600, animated: true },
54
+ defaultParams: {
55
+ centerX: 0.5,
56
+ centerY: 0.5,
57
+ speed: 1.5,
58
+ amplitude: 30,
59
+ wavelength: 160,
60
+ brightness: 1,
61
+ radius: 600,
62
+ animated: true
63
+ },
757
64
  parameterSchema: {
758
65
  centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
759
66
  centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
@@ -765,526 +72,86 @@ var EFFECTS_REGISTRY = {
765
72
  },
766
73
  tags: ["distortion", "ripple", "shockwave"]
767
74
  },
768
- "bulge-pinch": {
769
- id: "bulge-pinch",
770
- name: "Bulge Pinch",
771
- category: "distortion",
772
- description: "Spherical bulge or pinch warp",
773
- defaultParams: { centerX: 0.5, centerY: 0.5, radius: 200, strength: 0.5, speed: 1.5, animated: true },
774
- parameterSchema: {
775
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
776
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
777
- radius: { type: "number", label: "Warp Radius", min: 10, max: 600, default: 200, step: 10 },
778
- strength: { type: "number", label: "Warp Strength", min: -1, max: 1, default: 0.5, step: 0.05 },
779
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
780
- },
781
- tags: ["distortion", "bulge", "pinch"]
782
- },
783
- "twist": {
784
- id: "twist",
785
- name: "Twist Twirl",
786
- category: "distortion",
787
- description: "Warp frame in a spiral twirl",
788
- defaultParams: { centerX: 0.5, centerY: 0.5, radius: 300, angle: 4, speed: 1, animated: true },
789
- parameterSchema: {
790
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
791
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
792
- radius: { type: "number", label: "Twirl Radius", min: 50, max: 800, default: 300, step: 10 },
793
- angle: { type: "number", label: "Angle", min: -15, max: 15, default: 4, step: 0.5 },
794
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
795
- },
796
- tags: ["distortion", "twist", "twirl"]
797
- },
798
- "reflection": {
799
- id: "reflection",
800
- name: "Reflection",
801
- category: "distortion",
802
- description: "Water mirror ripple reflection",
803
- defaultParams: { boundary: 0.5, amplitudeStart: 0, amplitudeEnd: 20, wavelengthStart: 30, wavelengthEnd: 100, alphaStart: 1, alphaEnd: 1, speed: 1, mirror: true, animated: true },
804
- parameterSchema: {
805
- boundary: { type: "number", label: "Boundary", min: 0.1, max: 0.9, default: 0.5, step: 0.05 },
806
- amplitudeStart: { type: "number", label: "Amp Start", min: 0, max: 50, default: 0, step: 1 },
807
- amplitudeEnd: { type: "number", label: "Amp End", min: 0, max: 100, default: 20, step: 1 },
808
- wavelengthStart: { type: "number", label: "Wavelength Start", min: 10, max: 100, default: 30, step: 5 },
809
- wavelengthEnd: { type: "number", label: "Wavelength End", min: 10, max: 300, default: 100, step: 5 },
810
- alphaStart: { type: "number", label: "Alpha Start", min: 0, max: 1, default: 1, step: 0.05 },
811
- alphaEnd: { type: "number", label: "Alpha End", min: 0, max: 1, default: 1, step: 0.05 },
812
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
813
- },
814
- tags: ["distortion", "reflection", "water"]
815
- },
816
- "color-gradient": {
817
- id: "color-gradient",
818
- name: "Color Gradient",
819
- category: "light",
820
- description: "Overlay a linear or radial multi-stop color gradient.",
821
- defaultParams: { gradientType: 0, color1: "#7C6FFF", color2: "#0E0E12", alpha: 0.5 },
822
- parameterSchema: {
823
- gradientType: { type: "number", label: "Type (0:Lin, 1:Rad)", min: 0, max: 1, default: 0, step: 1 },
824
- color1: { type: "color", label: "Start Color", default: "#7C6FFF" },
825
- color2: { type: "color", label: "End Color", default: "#0E0E12" },
826
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.5, step: 0.05 }
827
- },
828
- tags: ["light", "color", "gradient"]
829
- },
830
- "color-overlay": {
831
- id: "color-overlay",
832
- name: "Color Overlay",
833
- category: "light",
834
- description: "Overlay a solid tint color onto the frame.",
835
- defaultParams: { color: "#7C6FFF", alpha: 0.3 },
836
- parameterSchema: {
837
- color: { type: "color", label: "Color", default: "#7C6FFF" },
838
- alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 0.3, step: 0.05 }
839
- },
840
- tags: ["light", "color", "overlay"]
841
- },
842
- "color-adjustments": {
843
- id: "color-adjustments",
844
- name: "Color Adjustments",
845
- category: "light",
846
- description: "Adjust exposure, brightness, contrast, saturation, temperature, tint, sepia, grayscale, hue, invert, and vignette.",
75
+ ChromaticAberration: {
76
+ id: "ChromaticAberration",
77
+ name: "Chromatic Aberration",
78
+ category: "glitch",
79
+ description: "Directional RGB channel displacement with optical edge-feather falloff",
847
80
  defaultParams: {
848
- exposure: 0,
849
- brightness: 0,
850
- contrast: 0,
851
- saturation: 0,
852
- temperature: 0,
853
- tint: 0,
854
- sepia: 0,
855
- grayscale: 0,
856
- hueRotate: 0,
857
- vignette: 0,
858
- invert: 0,
859
- blur: 0
860
- },
861
- parameterSchema: {
862
- exposure: { type: "number", label: "Exposure", min: -1, max: 1, default: 0, step: 0.01 },
863
- brightness: { type: "number", label: "Brightness", min: -1, max: 1, default: 0, step: 0.01 },
864
- contrast: { type: "number", label: "Contrast", min: -1, max: 1, default: 0, step: 0.01 },
865
- saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.01 },
866
- temperature: { type: "number", label: "Temperature", min: -1, max: 1, default: 0, step: 0.01 },
867
- tint: { type: "number", label: "Tint", min: -1, max: 1, default: 0, step: 0.01 },
868
- sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0, step: 0.01 },
869
- grayscale: { type: "number", label: "Grayscale", min: 0, max: 1, default: 0, step: 0.01 },
870
- hueRotate: { type: "number", label: "Hue Rotate", min: 0, max: 6.28318, default: 0, step: 0.01 },
871
- vignette: { type: "number", label: "Vignette", min: 0, max: 1, default: 0, step: 0.01 },
872
- invert: { type: "number", label: "Invert", min: 0, max: 1, default: 0, step: 0.01 },
873
- blur: { type: "number", label: "Blur", min: 0, max: 15, default: 0, step: 0.5 }
874
- },
875
- tags: ["color", "adjustments", "light", "vignette"]
876
- },
877
- "hsl-adjustment": {
878
- id: "hsl-adjustment",
879
- name: "HSL Adjustment",
880
- category: "light",
881
- description: "Adjust hue, saturation, and lightness of the video.",
882
- defaultParams: { hue: 0, saturation: 0, lightness: 0, colorize: false, alpha: 1 },
883
- parameterSchema: {
884
- hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 1 },
885
- saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.05 },
886
- lightness: { type: "number", label: "Lightness", min: -1, max: 1, default: 0, step: 0.05 },
887
- colorize: { type: "boolean", label: "Colorize", default: false },
888
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
889
- },
890
- tags: ["light", "color", "hsl", "hue"]
891
- },
892
- "alpha": {
893
- id: "alpha",
894
- name: "Opacity (Alpha)",
895
- category: "light",
896
- description: "Adjust layer opacity / alpha transparency.",
897
- defaultParams: { alpha: 1 },
898
- parameterSchema: {
899
- alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 1, step: 0.05 }
900
- },
901
- tags: ["light", "alpha", "opacity"]
902
- },
903
- "color-matrix": {
904
- id: "color-matrix",
905
- name: "Color Matrix Presets",
906
- category: "light",
907
- description: "Color grading adjustments and retro filter presets.",
908
- defaultParams: { brightness: 1, contrast: 1, saturation: 1, hue: 0, mode: "none" },
909
- parameterSchema: {
910
- brightness: { type: "number", label: "Brightness", min: 0, max: 2, default: 1, step: 0.05 },
911
- contrast: { type: "number", label: "Contrast", min: 0, max: 2, default: 1, step: 0.05 },
912
- saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 },
913
- hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 2 },
914
- mode: { type: "string", label: "Preset", default: "none" }
915
- },
916
- tags: ["light", "color", "presets", "vintage"]
917
- },
918
- "neon-glow": {
919
- id: "neon-glow",
920
- name: "Neon Glow (Community)",
921
- category: "light",
922
- description: "Wrap your visual features in a premium neon glow outline.",
923
- defaultParams: { distance: 15, innerStrength: 1, outerStrength: 2, color: "#7C6FFF", quality: 0.1, knockout: false },
924
- parameterSchema: {
925
- distance: { type: "number", label: "Distance", min: 1, max: 100, default: 15, step: 1 },
926
- innerStrength: { type: "number", label: "Inner Strength", min: 0, max: 10, default: 1, step: 0.2 },
927
- outerStrength: { type: "number", label: "Outer Strength", min: 0, max: 10, default: 2, step: 0.2 },
928
- color: { type: "color", label: "Glow Color", default: "#7C6FFF" },
929
- quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
930
- knockout: { type: "boolean", label: "Knockout", default: false }
931
- },
932
- tags: ["light", "glow", "neon", "outline"]
933
- },
934
- "gaussian-blur": {
935
- id: "gaussian-blur",
936
- name: "Gaussian Blur",
937
- category: "cinematic",
938
- description: "Classic high-fidelity Gaussian blur filter.",
939
- defaultParams: { blur: 8, quality: 4 },
940
- parameterSchema: {
941
- blur: { type: "number", label: "Blur Strength", min: 0, max: 100, default: 8, step: 0.5 },
942
- quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
81
+ amount: 8,
82
+ angleDegrees: 0,
83
+ edgeFeather: 0.5
943
84
  },
944
- tags: ["cinematic", "blur", "gaussian"]
945
- },
946
- "kawase-blur": {
947
- id: "kawase-blur",
948
- name: "Kawase Blur",
949
- category: "cinematic",
950
- description: "Fast, high-quality multi-pass Kawase blur.",
951
- defaultParams: { blur: 8, quality: 4 },
952
85
  parameterSchema: {
953
- blur: { type: "number", label: "Blur Radius", min: 0, max: 100, default: 8, step: 0.5 },
954
- quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
86
+ amount: { type: "number", label: "Amount (px)", min: 0, max: 50, default: 8, step: 0.5 },
87
+ angleDegrees: { type: "number", label: "Angle (\xB0)", min: 0, max: 360, default: 0, step: 1 },
88
+ edgeFeather: { type: "number", label: "Edge Feather", min: 0, max: 1, default: 0.5, step: 0.05 }
955
89
  },
956
- tags: ["cinematic", "blur", "kawase"]
90
+ tags: ["glitch", "chromatic", "aberration", "color", "distortion", "lens", "optical"]
957
91
  },
958
- "zoom-blur": {
959
- id: "zoom-blur",
960
- name: "Zoom Blur",
961
- category: "cinematic",
962
- description: "Radial focal zoom blur emanating from a point.",
963
- defaultParams: { strength: 0.15, centerX: 0.5, centerY: 0.5, innerRadius: 0, radius: 400 },
964
- parameterSchema: {
965
- strength: { type: "number", label: "Blur Strength", min: 0, max: 1, default: 0.15, step: 0.02 },
966
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
967
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
968
- innerRadius: { type: "number", label: "Inner Rad", min: 0, max: 600, default: 0, step: 10 },
969
- radius: { type: "number", label: "Outer Rad", min: 50, max: 1200, default: 400, step: 10 }
970
- },
971
- tags: ["cinematic", "blur", "zoom", "focus"]
972
- },
973
- "radial-blur": {
974
- id: "radial-blur",
975
- name: "Radial Blur",
976
- category: "cinematic",
977
- description: "Radial spin blur around a focal center point.",
978
- defaultParams: { angle: 10, centerX: 0.5, centerY: 0.5, kernelSize: 9, radius: -1 },
979
- parameterSchema: {
980
- angle: { type: "number", label: "Spin Angle", min: -180, max: 180, default: 10, step: 1 },
981
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
982
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
983
- kernelSize: { type: "number", label: "Kernel Size", min: 3, max: 25, default: 9, step: 2 },
984
- radius: { type: "number", label: "Max Radius", min: -1, max: 1200, default: -1, step: 10 }
985
- },
986
- tags: ["cinematic", "blur", "radial", "spin"]
987
- },
988
- "drop-shadow": {
989
- id: "drop-shadow",
990
- name: "Drop Shadow",
991
- category: "cinematic",
992
- description: "Apply an adjustable drop shadow overlay onto your layer.",
993
- defaultParams: { blur: 4, alpha: 0.5, offsetX: 4, offsetY: 4, color: "#000000", shadowOnly: false },
994
- parameterSchema: {
995
- blur: { type: "number", label: "Shadow Blur", min: 0, max: 50, default: 4, step: 0.5 },
996
- alpha: { type: "number", label: "Shadow Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
997
- offsetX: { type: "number", label: "Offset X", min: -100, max: 100, default: 4, step: 1 },
998
- offsetY: { type: "number", label: "Offset Y", min: -100, max: 100, default: 4, step: 1 },
999
- color: { type: "color", label: "Shadow Color", default: "#000000" },
1000
- shadowOnly: { type: "boolean", label: "Shadow Only", default: false }
1001
- },
1002
- tags: ["cinematic", "shadow", "drop"]
1003
- },
1004
- "static-noise": {
1005
- id: "static-noise",
1006
- name: "Static Noise",
92
+ RgbSplit: {
93
+ id: "RgbSplit",
94
+ name: "RGB Split",
1007
95
  category: "glitch",
1008
- description: "Classic static analog noise/grain filter.",
1009
- defaultParams: { noise: 0.15, animated: true },
1010
- parameterSchema: {
1011
- noise: { type: "number", label: "Noise Density", min: 0, max: 1, default: 0.15, step: 0.02 },
1012
- animated: { type: "boolean", label: "Animated Seed", default: true }
96
+ description: "Discrete horizontal and vertical color channel separation",
97
+ defaultParams: {
98
+ splitX: 8,
99
+ splitY: 8
1013
100
  },
1014
- tags: ["glitch", "noise", "grain", "static"]
1015
- },
1016
- "old-film": {
1017
- id: "old-film",
1018
- name: "Old Film",
1019
- category: "cinematic",
1020
- description: "Simulates vintage cinema projector noise, sepia tint, vignette, and scratches.",
1021
- defaultParams: { sepia: 0.3, noise: 0.15, noiseSize: 1, scratchDensity: 0.3, scratchWidth: 1, vignetting: 0.3, vignettingAlpha: 1, vignettingBlur: 0.3 },
1022
101
  parameterSchema: {
1023
- sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0.3, step: 0.05 },
1024
- noise: { type: "number", label: "Noise", min: 0, max: 1, default: 0.15, step: 0.05 },
1025
- noiseSize: { type: "number", label: "Noise Size", min: 0.2, max: 5, default: 1, step: 0.1 },
1026
- scratchDensity: { type: "number", label: "Scratch Density", min: 0, max: 1, default: 0.3, step: 0.05 },
1027
- scratchWidth: { type: "number", label: "Scratch Width", min: 0.5, max: 6, default: 1, step: 0.2 },
1028
- vignetting: { type: "number", label: "Vignette", min: 0, max: 1, default: 0.3, step: 0.05 },
1029
- vignettingAlpha: { type: "number", label: "Vignette Alpha", min: 0, max: 1, default: 1, step: 0.05 },
1030
- vignettingBlur: { type: "number", label: "Vignette Blur", min: 0, max: 1, default: 0.3, step: 0.05 }
102
+ splitX: { type: "number", label: "Split X (px)", min: 0, max: 50, default: 8, step: 0.5 },
103
+ splitY: { type: "number", label: "Split Y (px)", min: 0, max: 50, default: 8, step: 0.5 }
1031
104
  },
1032
- tags: ["cinematic", "film", "vintage", "retro", "scratches"]
105
+ tags: ["glitch", "rgb", "split", "color", "shift"]
1033
106
  },
1034
- "displacement": {
1035
- id: "displacement",
1036
- name: "Displacement Map",
1037
- category: "distortion",
1038
- description: "Warp and distort the frame using a procedural noise displacement sprite.",
1039
- defaultParams: { scaleX: 20, scaleY: 20, animated: true, speed: 1 },
1040
- parameterSchema: {
1041
- scaleX: { type: "number", label: "Scale X", min: -200, max: 200, default: 20, step: 1 },
1042
- scaleY: { type: "number", label: "Scale Y", min: -200, max: 200, default: 20, step: 1 },
1043
- animated: { type: "boolean", label: "Flow Motion", default: true },
1044
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
107
+ FilmGrain: {
108
+ id: "FilmGrain",
109
+ name: "Film Grain",
110
+ category: "retro",
111
+ description: "Procedural cinematic film grain with adjustable size and intensity",
112
+ defaultParams: {
113
+ grainIntensity: 0.15,
114
+ grainSize: 1,
115
+ grainSeed: 0,
116
+ animated: true
1045
117
  },
1046
- tags: ["distortion", "displacement", "warp", "liquid"]
1047
- },
1048
- "outline": {
1049
- id: "outline",
1050
- name: "Outline Overlay",
1051
- category: "distortion",
1052
- description: "Draws a solid colored outline around the non-transparent boundaries.",
1053
- defaultParams: { thickness: 3, color: "#7C6FFF", quality: 0.1, alpha: 1 },
1054
118
  parameterSchema: {
1055
- thickness: { type: "number", label: "Thickness", min: 0, max: 20, default: 3, step: 1 },
1056
- color: { type: "color", label: "Color", default: "#7C6FFF" },
1057
- quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
1058
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
119
+ grainIntensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.15, step: 0.01 },
120
+ grainSize: { type: "number", label: "Grain Size", min: 0.1, max: 5, default: 1, step: 0.1 },
121
+ grainSeed: { type: "number", label: "Grain Seed", min: 0, max: 100, default: 0, step: 0.1 },
122
+ animated: { type: "boolean", label: "Animated", default: true }
1059
123
  },
1060
- tags: ["distortion", "outline", "stroke", "border"]
124
+ tags: ["retro", "film", "grain", "noise", "cinematic", "texture"]
1061
125
  },
1062
- "grayscale": {
1063
- id: "grayscale",
1064
- name: "Grayscale",
1065
- category: "cinematic",
1066
- description: "Converts the layer to monochrome black and white.",
1067
- defaultParams: {},
1068
- parameterSchema: {},
1069
- tags: ["cinematic", "grayscale", "monochrome", "bw"]
1070
- },
1071
- "dot": {
1072
- id: "dot",
1073
- name: "Halftone Dots",
1074
- category: "distortion",
1075
- description: "Halftone dot raster pattern, simulating newspaper or comic book prints.",
1076
- defaultParams: { scale: 1, angle: 1, grayscale: true },
1077
- parameterSchema: {
1078
- scale: { type: "number", label: "Dot Scale", min: 0.1, max: 10, default: 1, step: 0.1 },
1079
- angle: { type: "number", label: "Angle", min: 0, max: 6.28, default: 1, step: 0.05 },
1080
- grayscale: { type: "boolean", label: "Grayscale", default: true }
126
+ Scanlines: {
127
+ id: "Scanlines",
128
+ name: "Scanlines",
129
+ category: "retro",
130
+ description: "CRT raster scanlines with controllable count and intensity",
131
+ defaultParams: {
132
+ scanlineCount: 120,
133
+ scanlineIntensity: 0.5
1081
134
  },
1082
- tags: ["distortion", "dot", "halftone", "comic"]
1083
- },
1084
- "emboss": {
1085
- id: "emboss",
1086
- name: "Emboss Relief",
1087
- category: "distortion",
1088
- description: "Simulates an embossed 3D relief depth on the frame.",
1089
- defaultParams: { strength: 5 },
1090
135
  parameterSchema: {
1091
- strength: { type: "number", label: "Strength", min: 0, max: 20, default: 5, step: 0.5 }
136
+ scanlineCount: { type: "number", label: "Line Count", min: 10, max: 1e3, default: 120, step: 10 },
137
+ scanlineIntensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.5, step: 0.05 }
1092
138
  },
1093
- tags: ["distortion", "emboss", "relief"]
139
+ tags: ["retro", "crt", "scanlines", "tv", "vhs", "analog"]
1094
140
  },
1095
- "cross-hatch": {
1096
- id: "cross-hatch",
1097
- name: "Cross Hatch Sketch",
1098
- category: "distortion",
1099
- description: "Simulates a crosshatched pencil sketch on paper.",
1100
- defaultParams: {},
1101
- parameterSchema: {},
1102
- tags: ["distortion", "sketch", "drawing", "hatch"]
1103
- },
1104
- "pixelate": {
1105
- id: "pixelate",
1106
- name: "Pixelate Mosaic",
1107
- category: "distortion",
1108
- description: "Pixelate the video frame into large blocky mosaic cells.",
1109
- defaultParams: { sizeX: 10, sizeY: 10 },
1110
- parameterSchema: {
1111
- sizeX: { type: "number", label: "Cell Width", min: 1, max: 200, default: 10, step: 1 },
1112
- sizeY: { type: "number", label: "Cell Height", min: 1, max: 200, default: 10, step: 1 }
141
+ Pixelate: {
142
+ id: "Pixelate",
143
+ name: "Pixelate",
144
+ category: "retro",
145
+ description: "Mosaic pixelation with adjustable block size",
146
+ defaultParams: {
147
+ pixelSize: 18
1113
148
  },
1114
- tags: ["distortion", "pixelate", "mosaic", "8bit"]
1115
- },
1116
- "ascii": {
1117
- id: "ascii",
1118
- name: "ASCII Art",
1119
- category: "distortion",
1120
- description: "Converts the video frame into interactive retro matrix ASCII text characters.",
1121
- defaultParams: { size: 8, replaceColor: false },
1122
149
  parameterSchema: {
1123
- size: { type: "number", label: "Char Size", min: 2, max: 50, default: 8, step: 1 },
1124
- replaceColor: { type: "boolean", label: "Replace Color", default: false }
150
+ pixelSize: { type: "number", label: "Block Size (px)", min: 1, max: 100, default: 18, step: 1 }
1125
151
  },
1126
- tags: ["distortion", "ascii", "text", "terminal"]
152
+ tags: ["retro", "pixelate", "mosaic", "8bit", "censorship"]
1127
153
  }
1128
154
  };
1129
- function drawBodySilhouette(ctx, cx, cy, w, h) {
1130
- ctx.beginPath();
1131
- ctx.ellipse(cx, cy - h * 0.22, w * 0.28, w * 0.28, 0, 0, Math.PI * 2);
1132
- ctx.rect(cx - w * 0.08, cy - h * 0.1, w * 0.16, h * 0.06);
1133
- ctx.moveTo(cx - w * 0.5, cy - h * 0.04);
1134
- ctx.quadraticCurveTo(cx - w * 0.4, cy - h * 0.08, cx, cy - h * 0.08);
1135
- ctx.quadraticCurveTo(cx + w * 0.4, cy - h * 0.08, cx + w * 0.5, cy - h * 0.04);
1136
- ctx.lineTo(cx + w * 0.45, cy + h * 0.4);
1137
- ctx.lineTo(cx - w * 0.45, cy + h * 0.4);
1138
- ctx.closePath();
1139
- }
1140
- function imageDataToCanvas(imageData) {
1141
- const canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(imageData.width, imageData.height) : document.createElement("canvas");
1142
- if (canvas instanceof HTMLCanvasElement) {
1143
- canvas.width = imageData.width;
1144
- canvas.height = imageData.height;
1145
- }
1146
- const ctx = canvas.getContext("2d");
1147
- if (ctx) {
1148
- ctx.putImageData(imageData, 0, 0);
1149
- }
1150
- return canvas;
1151
- }
1152
- function pseudoRandom(seed) {
1153
- const x = Math.sin(seed * 12.9898) * 43758.5453;
1154
- return x - Math.floor(x);
1155
- }
1156
- function renderBodyGlow(ctx, params, intensity, time, bodyMask) {
1157
- const canvas = ctx.canvas;
1158
- const glowColor = params.glowColor || "#7C6FFF";
1159
- const glowRadius = (params.glowRadius ?? 20) * intensity * (1 + Math.sin(time * 3) * 0.2);
1160
- const glowIntensity = (params.glowIntensity ?? 0.8) * intensity * 0.18;
1161
- ctx.save();
1162
- ctx.globalCompositeOperation = "screen";
1163
- ctx.shadowColor = glowColor;
1164
- ctx.shadowBlur = glowRadius;
1165
- ctx.fillStyle = glowColor;
1166
- ctx.strokeStyle = glowColor;
1167
- ctx.lineWidth = 2;
1168
- ctx.globalAlpha = glowIntensity;
1169
- if (bodyMask) {
1170
- const maskCanvas = imageDataToCanvas(bodyMask);
1171
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
1172
- } else {
1173
- const cx = canvas.width / 2;
1174
- const cy = canvas.height * 0.5;
1175
- const w = canvas.width * 0.28;
1176
- const h = canvas.height * 0.52;
1177
- drawBodySilhouette(ctx, cx, cy, w, h);
1178
- ctx.fill();
1179
- ctx.stroke();
1180
- }
1181
- ctx.restore();
1182
- }
1183
- function renderBodyOutline(ctx, params, intensity, time, bodyMask) {
1184
- const canvas = ctx.canvas;
1185
- const outlineColor = params.outlineColor || "#00E5FF";
1186
- const pulseWidth = (params.outlineWidth ?? 6) * intensity * (1 + Math.sin(time * 2.5) * 0.15);
1187
- const feather = (params.feather ?? 15) * (1 + Math.sin(time * 2) * 0.15);
1188
- ctx.save();
1189
- ctx.globalCompositeOperation = "screen";
1190
- ctx.globalAlpha = Math.min(1, intensity);
1191
- if (bodyMask) {
1192
- const maskCanvas = imageDataToCanvas(bodyMask);
1193
- const maskCtx = maskCanvas.getContext("2d");
1194
- if (maskCtx) {
1195
- maskCtx.save();
1196
- maskCtx.globalCompositeOperation = "source-in";
1197
- maskCtx.fillStyle = outlineColor;
1198
- maskCtx.fillRect(0, 0, maskCanvas.width, maskCanvas.height);
1199
- maskCtx.restore();
1200
- }
1201
- ctx.filter = `blur(${pulseWidth}px)`;
1202
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
1203
- ctx.filter = "none";
1204
- ctx.drawImage(maskCanvas, -pulseWidth * 0.5, 0, canvas.width, canvas.height);
1205
- ctx.drawImage(maskCanvas, pulseWidth * 0.5, 0, canvas.width, canvas.height);
1206
- ctx.drawImage(maskCanvas, 0, -pulseWidth * 0.5, canvas.width, canvas.height);
1207
- ctx.drawImage(maskCanvas, 0, pulseWidth * 0.5, canvas.width, canvas.height);
1208
- } else {
1209
- ctx.strokeStyle = outlineColor;
1210
- ctx.lineWidth = Math.max(1, pulseWidth);
1211
- ctx.shadowColor = outlineColor;
1212
- ctx.shadowBlur = feather;
1213
- const cx = canvas.width / 2;
1214
- const cy = canvas.height * 0.5;
1215
- const w = canvas.width * 0.28;
1216
- const h = canvas.height * 0.52;
1217
- drawBodySilhouette(ctx, cx, cy, w, h);
1218
- ctx.stroke();
1219
- }
1220
- ctx.restore();
1221
- }
1222
- function renderBodyParticles(ctx, params, intensity, time, bodyMask) {
1223
- const canvas = ctx.canvas;
1224
- const particleColor = params.particleColor || "#FF2A85";
1225
- const count = Math.min(150, (params.particleCount ?? 60) * intensity);
1226
- const size = params.particleSize ?? 3;
1227
- const drift = params.drift ?? 8;
1228
- ctx.save();
1229
- ctx.globalCompositeOperation = "screen";
1230
- ctx.fillStyle = particleColor;
1231
- if (bodyMask) {
1232
- ctx.globalAlpha = Math.min(0.85, 0.25 + intensity * 0.6);
1233
- const seed = Math.floor(time * 24);
1234
- for (let i = 0; i < count; i++) {
1235
- const x = Math.floor(pseudoRandom(seed + i * 37) * canvas.width);
1236
- const y = Math.floor(pseudoRandom(seed + i * 43) * canvas.height);
1237
- const maskIdx = (Math.floor(y * bodyMask.height / canvas.height) * bodyMask.width + Math.floor(x * bodyMask.width / canvas.width)) * 4 + 3;
1238
- if (bodyMask.data[maskIdx] < 64) continue;
1239
- const xDrift = Math.sin((time + i) * 2.1) * drift * intensity;
1240
- const pSize = 1 + pseudoRandom(seed + i * 53) * (size - 1);
1241
- ctx.beginPath();
1242
- ctx.arc(x + xDrift, y - pseudoRandom(seed + i * 59) * 20 * intensity, pSize, 0, Math.PI * 2);
1243
- ctx.fill();
1244
- }
1245
- } else {
1246
- const cx = canvas.width / 2;
1247
- const cy = canvas.height * 0.5;
1248
- const w = canvas.width * 0.28;
1249
- const h = canvas.height * 0.52;
1250
- for (let i = 0; i < count; i++) {
1251
- const angle = i / count * Math.PI * 2;
1252
- const radius = 0.8 + Math.sin(angle * 3) * 0.15;
1253
- const px = cx + Math.cos(angle + time * 0.2) * w * radius;
1254
- const py = cy + Math.sin(angle + time * 0.2) * h * radius;
1255
- const dy = -((time * 25 + i * 4) % 35);
1256
- const dx = Math.sin(time * 1.5 + i * 0.6) * drift;
1257
- ctx.globalAlpha = 0.2 + 0.6 * (0.5 + 0.5 * Math.sin(time * 3 + i));
1258
- ctx.beginPath();
1259
- ctx.arc(px + dx, py + dy, size, 0, Math.PI * 2);
1260
- ctx.fill();
1261
- }
1262
- }
1263
- ctx.restore();
1264
- }
1265
- function renderBodySegmentationGlow(ctx, params, intensity, time, bodyMask) {
1266
- const canvas = ctx.canvas;
1267
- const glowColor = params.glowColor || "#FFD700";
1268
- const glowRadius = (params.glowRadius ?? 25) * intensity;
1269
- ctx.save();
1270
- ctx.globalCompositeOperation = "source-over";
1271
- ctx.shadowColor = glowColor;
1272
- ctx.shadowBlur = glowRadius;
1273
- ctx.fillStyle = glowColor;
1274
- ctx.globalAlpha = 0.12 * intensity;
1275
- if (bodyMask) {
1276
- const maskCanvas = imageDataToCanvas(bodyMask);
1277
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
1278
- } else {
1279
- const cx = canvas.width / 2;
1280
- const cy = canvas.height * 0.5;
1281
- const w = canvas.width * 0.28;
1282
- const h = canvas.height * 0.52;
1283
- drawBodySilhouette(ctx, cx, cy, w, h);
1284
- ctx.fill();
1285
- }
1286
- ctx.restore();
1287
- }
1288
155
  function getEffectMetadata(id) {
1289
156
  return EFFECTS_REGISTRY[id];
1290
157
  }
@@ -1292,163 +159,8 @@ function getEffectsByCategory(category) {
1292
159
  return Object.values(EFFECTS_REGISTRY).filter((effect) => effect.category === category);
1293
160
  }
1294
161
  function getEffectRenderer(id) {
1295
- const renderers = {
1296
- // Light
1297
- flash: renderFlash,
1298
- flicker: renderFlicker,
1299
- vignette: renderVignette,
1300
- glow: renderGlow,
1301
- light_leak: renderLightLeak,
1302
- light_leak_2: renderLightLeak2,
1303
- fire: renderFire,
1304
- particles: renderParticles,
1305
- dust_particles: renderDustParticles,
1306
- // Body
1307
- body_glow: renderBodyGlow,
1308
- body_outline: renderBodyOutline,
1309
- body_particles: renderBodyParticles,
1310
- "body-segmentation-glow": renderBodySegmentationGlow,
1311
- // Normalized aliases retained for existing saved projects.
1312
- "light-leak": renderLightLeak,
1313
- "lens-flare": renderLightLeak2,
1314
- "lens_flare": renderLightLeak2,
1315
- "rgb-split": (ctx, params, intensity) => {
1316
- const shift = Math.floor(Number(params.redX ?? 4) * intensity);
1317
- if (shift === 0) return;
1318
- ctx.save();
1319
- ctx.globalCompositeOperation = "screen";
1320
- ctx.globalAlpha = 0.4 * intensity;
1321
- ctx.drawImage(ctx.canvas, -shift, 0);
1322
- ctx.drawImage(ctx.canvas, shift, 0);
1323
- ctx.restore();
1324
- },
1325
- "rgb_split": (ctx, params, intensity) => {
1326
- const shift = Math.floor(Number(params.redX ?? 4) * intensity);
1327
- if (shift === 0) return;
1328
- ctx.save();
1329
- ctx.globalCompositeOperation = "screen";
1330
- ctx.globalAlpha = 0.4 * intensity;
1331
- ctx.drawImage(ctx.canvas, -shift, 0);
1332
- ctx.drawImage(ctx.canvas, shift, 0);
1333
- ctx.restore();
1334
- },
1335
- "vhs": (ctx, params, intensity) => {
1336
- const width = ctx.canvas.width;
1337
- const height = ctx.canvas.height;
1338
- ctx.save();
1339
- ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.15})`;
1340
- for (let y = 0; y < height; y += 4) {
1341
- ctx.fillRect(0, y, width, 1.5);
1342
- }
1343
- ctx.restore();
1344
- },
1345
- "glitch-band": (ctx, params, intensity) => {
1346
- const width = ctx.canvas.width;
1347
- const height = ctx.canvas.height;
1348
- const y = Math.floor(Math.random() * height);
1349
- ctx.save();
1350
- ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
1351
- ctx.fillRect(0, y, width, 8);
1352
- ctx.restore();
1353
- },
1354
- "glitch_band": (ctx, params, intensity) => {
1355
- const width = ctx.canvas.width;
1356
- const height = ctx.canvas.height;
1357
- const y = Math.floor(Math.random() * height);
1358
- ctx.save();
1359
- ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
1360
- ctx.fillRect(0, y, width, 8);
1361
- ctx.restore();
1362
- },
1363
- "crt": (ctx, params, intensity) => {
1364
- const width = ctx.canvas.width;
1365
- const height = ctx.canvas.height;
1366
- ctx.save();
1367
- ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.12})`;
1368
- for (let y = 0; y < height; y += 3) {
1369
- ctx.fillRect(0, y, width, 1);
1370
- }
1371
- ctx.restore();
1372
- },
1373
- "film-grain": (ctx, params, intensity) => {
1374
- const width = ctx.canvas.width;
1375
- const height = ctx.canvas.height;
1376
- ctx.save();
1377
- for (let i = 0; i < 120 * intensity; i++) {
1378
- const x = Math.random() * width;
1379
- const y = Math.random() * height;
1380
- const alpha = 0.04 + Math.random() * 0.05;
1381
- ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha})` : `rgba(0, 0, 0, ${alpha})`;
1382
- ctx.fillRect(x, y, 2, 2);
1383
- }
1384
- ctx.restore();
1385
- },
1386
- "film_grain": (ctx, params, intensity) => {
1387
- const width = ctx.canvas.width;
1388
- const height = ctx.canvas.height;
1389
- ctx.save();
1390
- for (let i = 0; i < 120 * intensity; i++) {
1391
- const x = Math.random() * width;
1392
- const y = Math.random() * height;
1393
- const alpha = 0.04 + Math.random() * 0.05;
1394
- ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha})` : `rgba(0, 0, 0, ${alpha})`;
1395
- ctx.fillRect(x, y, 2, 2);
1396
- }
1397
- ctx.restore();
1398
- },
1399
- "tilt-shift": (ctx, params, intensity) => {
1400
- ctx.save();
1401
- try {
1402
- ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
1403
- ctx.drawImage(ctx.canvas, 0, 0);
1404
- } catch {
1405
- }
1406
- ctx.restore();
1407
- },
1408
- "tilt_shift": (ctx, params, intensity) => {
1409
- ctx.save();
1410
- try {
1411
- ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
1412
- ctx.drawImage(ctx.canvas, 0, 0);
1413
- } catch {
1414
- }
1415
- ctx.restore();
1416
- },
1417
- "cinematic-lut": (ctx, params, intensity) => {
1418
- const width = ctx.canvas.width;
1419
- const height = ctx.canvas.height;
1420
- ctx.save();
1421
- ctx.globalCompositeOperation = "color";
1422
- ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
1423
- ctx.fillRect(0, 0, width, height);
1424
- ctx.restore();
1425
- },
1426
- "cinematic_lut": (ctx, params, intensity) => {
1427
- const width = ctx.canvas.width;
1428
- const height = ctx.canvas.height;
1429
- ctx.save();
1430
- ctx.globalCompositeOperation = "color";
1431
- ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
1432
- ctx.fillRect(0, 0, width, height);
1433
- ctx.restore();
1434
- },
1435
- "motion-blur": (ctx, params, intensity) => {
1436
- ctx.save();
1437
- ctx.globalAlpha = 0.4 * intensity;
1438
- const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
1439
- const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
1440
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
1441
- ctx.restore();
1442
- },
1443
- "motion_blur": (ctx, params, intensity) => {
1444
- ctx.save();
1445
- ctx.globalAlpha = 0.4 * intensity;
1446
- const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
1447
- const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
1448
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
1449
- ctx.restore();
1450
- },
1451
- "shockwave": (ctx, params, intensity, time) => {
162
+ if (id === "shockwave") {
163
+ return (ctx, _params, intensity, time) => {
1452
164
  const width = ctx.canvas.width;
1453
165
  const height = ctx.canvas.height;
1454
166
  ctx.save();
@@ -1458,337 +170,15 @@ function getEffectRenderer(id) {
1458
170
  ctx.arc(width / 2, height / 2, time * 160 % (width / 2 + 50), 0, Math.PI * 2);
1459
171
  ctx.stroke();
1460
172
  ctx.restore();
1461
- },
1462
- "bulge-pinch": (ctx, params, intensity) => {
1463
- const width = ctx.canvas.width;
1464
- const height = ctx.canvas.height;
1465
- ctx.save();
1466
- ctx.translate(width / 2, height / 2);
1467
- const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
1468
- ctx.scale(scale, scale);
1469
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
1470
- ctx.restore();
1471
- },
1472
- "bulge_pinch": (ctx, params, intensity) => {
1473
- const width = ctx.canvas.width;
1474
- const height = ctx.canvas.height;
1475
- ctx.save();
1476
- ctx.translate(width / 2, height / 2);
1477
- const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
1478
- ctx.scale(scale, scale);
1479
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
1480
- ctx.restore();
1481
- },
1482
- "twist": (ctx, params, intensity) => {
1483
- const width = ctx.canvas.width;
1484
- const height = ctx.canvas.height;
1485
- ctx.save();
1486
- ctx.translate(width / 2, height / 2);
1487
- ctx.rotate(Number(params.angle ?? 4) * intensity * 0.02);
1488
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
1489
- ctx.restore();
1490
- },
1491
- "reflection": (ctx, params, intensity) => {
1492
- const width = ctx.canvas.width;
1493
- const height = ctx.canvas.height;
1494
- const boundaryY = Number(params.boundary ?? 0.5) * height;
1495
- ctx.save();
1496
- ctx.translate(0, boundaryY * 2);
1497
- ctx.scale(1, -1);
1498
- ctx.globalAlpha = 0.7 * intensity;
1499
- ctx.drawImage(ctx.canvas, 0, boundaryY, width, height - boundaryY, 0, boundaryY, width, height - boundaryY);
1500
- ctx.restore();
1501
- },
1502
- "color-gradient": (ctx, params, intensity) => {
1503
- const width = ctx.canvas.width;
1504
- const height = ctx.canvas.height;
1505
- ctx.save();
1506
- 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);
1507
- grad.addColorStop(0, params.color1 || "#7C6FFF");
1508
- grad.addColorStop(1, params.color2 || "#0E0E12");
1509
- ctx.fillStyle = grad;
1510
- ctx.globalAlpha = Number(params.alpha ?? 0.5) * intensity;
1511
- ctx.fillRect(0, 0, width, height);
1512
- ctx.restore();
1513
- },
1514
- "color-overlay": (ctx, params, intensity) => {
1515
- const width = ctx.canvas.width;
1516
- const height = ctx.canvas.height;
1517
- ctx.save();
1518
- ctx.fillStyle = params.color || "#7C6FFF";
1519
- ctx.globalAlpha = Number(params.alpha ?? 0.3) * intensity;
1520
- ctx.fillRect(0, 0, width, height);
1521
- ctx.restore();
1522
- },
1523
- "color-adjustments": (ctx, params, intensity) => {
1524
- const width = ctx.canvas.width;
1525
- const height = ctx.canvas.height;
1526
- const f = intensity;
1527
- const exp = Number(params.exposure ?? 0) * f;
1528
- const brightnessVal = 1 + Number(params.brightness ?? 0) * f + exp;
1529
- const contrastVal = 1 + Number(params.contrast ?? 0) * f;
1530
- const saturationVal = 1 + Number(params.saturation ?? 0) * f;
1531
- const sepiaVal = Number(params.sepia ?? 0) * f;
1532
- const grayscaleVal = Number(params.grayscale ?? 0) * f;
1533
- const hueVal = Number(params.hueRotate ?? 0) * f;
1534
- const invertVal = Number(params.invert ?? 0) * f;
1535
- const blurVal = Number(params.blur ?? 0) * f;
1536
- const filterParts = [];
1537
- if (brightnessVal !== 1) filterParts.push(`brightness(${brightnessVal})`);
1538
- if (contrastVal !== 1) filterParts.push(`contrast(${contrastVal})`);
1539
- if (saturationVal !== 1) filterParts.push(`saturate(${saturationVal})`);
1540
- if (sepiaVal > 0) filterParts.push(`sepia(${sepiaVal * 100}%)`);
1541
- if (grayscaleVal > 0) filterParts.push(`grayscale(${grayscaleVal * 100}%)`);
1542
- if (hueVal !== 0) filterParts.push(`hue-rotate(${hueVal * 180 / Math.PI}deg)`);
1543
- if (invertVal > 0) filterParts.push(`invert(${invertVal * 100}%)`);
1544
- if (blurVal > 0) filterParts.push(`blur(${blurVal}px)`);
1545
- if (filterParts.length > 0) {
1546
- ctx.save();
1547
- const temp = document.createElement("canvas");
1548
- temp.width = width;
1549
- temp.height = height;
1550
- const tempCtx = temp.getContext("2d");
1551
- if (tempCtx) {
1552
- tempCtx.drawImage(ctx.canvas, 0, 0);
1553
- ctx.clearRect(0, 0, width, height);
1554
- ctx.filter = filterParts.join(" ");
1555
- ctx.drawImage(temp, 0, 0);
1556
- ctx.filter = "none";
1557
- }
1558
- ctx.restore();
1559
- }
1560
- const tempVal = Number(params.temperature ?? 0) * f;
1561
- if (tempVal !== 0) {
1562
- ctx.save();
1563
- ctx.globalCompositeOperation = "soft-light";
1564
- if (tempVal > 0) {
1565
- ctx.fillStyle = `rgba(255, 140, 40, ${tempVal})`;
1566
- } else {
1567
- ctx.fillStyle = `rgba(40, 120, 255, ${-tempVal})`;
1568
- }
1569
- ctx.fillRect(0, 0, width, height);
1570
- ctx.restore();
1571
- }
1572
- const tintVal = Number(params.tint ?? 0) * f;
1573
- if (tintVal !== 0) {
1574
- ctx.save();
1575
- ctx.globalCompositeOperation = "soft-light";
1576
- if (tintVal > 0) {
1577
- ctx.fillStyle = `rgba(255, 40, 180, ${tintVal})`;
1578
- } else {
1579
- ctx.fillStyle = `rgba(40, 255, 100, ${-tintVal})`;
1580
- }
1581
- ctx.fillRect(0, 0, width, height);
1582
- ctx.restore();
1583
- }
1584
- const vignetteVal = Number(params.vignette ?? 0) * f;
1585
- if (vignetteVal > 0) {
1586
- ctx.save();
1587
- ctx.globalCompositeOperation = "multiply";
1588
- const cx = width / 2;
1589
- const cy = height / 2;
1590
- const maxRadius = Math.sqrt(cx * cx + cy * cy);
1591
- const gradient = ctx.createRadialGradient(cx, cy, maxRadius * 0.45, cx, cy, maxRadius * 1);
1592
- gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
1593
- gradient.addColorStop(0.5, `rgba(0, 0, 0, ${vignetteVal * 0.15})`);
1594
- gradient.addColorStop(0.8, `rgba(0, 0, 0, ${vignetteVal * 0.55})`);
1595
- gradient.addColorStop(1, `rgba(0, 0, 0, ${vignetteVal * 0.9})`);
1596
- ctx.fillStyle = gradient;
1597
- ctx.fillRect(0, 0, width, height);
1598
- ctx.restore();
1599
- }
1600
- },
1601
- "hsl-adjustment": (ctx, params, intensity) => {
1602
- if (params.colorize) {
1603
- ctx.save();
1604
- ctx.fillStyle = "rgba(124, 111, 255, 0.2)";
1605
- ctx.globalAlpha = Number(params.alpha ?? 1) * intensity;
1606
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1607
- ctx.restore();
1608
- }
1609
- },
1610
- "alpha": (ctx, params, intensity) => {
1611
- ctx.save();
1612
- ctx.globalAlpha = 1 - (1 - Number(params.alpha ?? 1)) * intensity;
1613
- ctx.restore();
1614
- },
1615
- "color-matrix": (ctx, params, intensity) => {
1616
- ctx.save();
1617
- ctx.globalCompositeOperation = "color";
1618
- ctx.fillStyle = `rgba(255, 120, 0, ${0.1 * intensity})`;
1619
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1620
- ctx.restore();
1621
- },
1622
- "neon-glow": (ctx, params, intensity) => {
1623
- ctx.save();
1624
- ctx.shadowBlur = Number(params.distance ?? 15) * intensity;
1625
- ctx.shadowColor = params.color || "#7C6FFF";
1626
- ctx.restore();
1627
- },
1628
- "gaussian-blur": (ctx, params, intensity) => {
1629
- ctx.save();
1630
- try {
1631
- ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
1632
- ctx.drawImage(ctx.canvas, 0, 0);
1633
- } catch {
1634
- }
1635
- ctx.restore();
1636
- },
1637
- "kawase-blur": (ctx, params, intensity) => {
1638
- ctx.save();
1639
- try {
1640
- ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
1641
- ctx.drawImage(ctx.canvas, 0, 0);
1642
- } catch {
1643
- }
1644
- ctx.restore();
1645
- },
1646
- "zoom-blur": (ctx, params, intensity) => {
1647
- ctx.save();
1648
- try {
1649
- ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
1650
- ctx.drawImage(ctx.canvas, 0, 0);
1651
- } catch {
1652
- }
1653
- ctx.restore();
1654
- },
1655
- "radial-blur": (ctx, params, intensity) => {
1656
- ctx.save();
1657
- try {
1658
- ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
1659
- ctx.drawImage(ctx.canvas, 0, 0);
1660
- } catch {
1661
- }
1662
- ctx.restore();
1663
- },
1664
- "drop-shadow": (ctx, params, intensity) => {
1665
- ctx.save();
1666
- ctx.shadowBlur = Number(params.blur ?? 4) * intensity;
1667
- ctx.shadowColor = params.color || "#000000";
1668
- ctx.shadowOffsetX = Number(params.offsetX ?? 4) * intensity;
1669
- ctx.shadowOffsetY = Number(params.offsetY ?? 4) * intensity;
1670
- ctx.restore();
1671
- },
1672
- "static-noise": (ctx, params, intensity) => {
1673
- const width = ctx.canvas.width;
1674
- const height = ctx.canvas.height;
1675
- ctx.save();
1676
- const density = Number(params.noise ?? 0.15) * intensity;
1677
- for (let i = 0; i < 200 * density; i++) {
1678
- const x = Math.random() * width;
1679
- const y = Math.random() * height;
1680
- ctx.fillStyle = `rgba(255, 255, 255, ${0.1 + Math.random() * 0.15})`;
1681
- ctx.fillRect(x, y, 2, 2);
1682
- }
1683
- ctx.restore();
1684
- },
1685
- "old-film": (ctx, params, intensity) => {
1686
- const width = ctx.canvas.width;
1687
- const height = ctx.canvas.height;
1688
- ctx.save();
1689
- ctx.globalCompositeOperation = "color";
1690
- ctx.fillStyle = `rgba(139, 69, 19, ${Number(params.sepia ?? 0.3) * intensity})`;
1691
- ctx.fillRect(0, 0, width, height);
1692
- ctx.globalCompositeOperation = "source-over";
1693
- for (let i = 0; i < 50 * intensity; i++) {
1694
- ctx.fillStyle = "rgba(255,255,255,0.06)";
1695
- ctx.fillRect(Math.random() * width, Math.random() * height, 2, 2);
1696
- }
1697
- ctx.restore();
1698
- },
1699
- "displacement": (ctx, params, intensity) => {
1700
- ctx.save();
1701
- const shiftX = Number(params.scaleX ?? 20) * intensity * 0.1;
1702
- const shiftY = Number(params.scaleY ?? 20) * intensity * 0.1;
1703
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
1704
- ctx.restore();
1705
- },
1706
- "outline": (ctx, params, intensity) => {
1707
- ctx.save();
1708
- ctx.strokeStyle = params.color || "#7C6FFF";
1709
- ctx.lineWidth = Number(params.thickness ?? 3) * intensity;
1710
- ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1711
- ctx.restore();
1712
- },
1713
- "grayscale": (ctx, params, intensity) => {
1714
- ctx.save();
1715
- ctx.globalCompositeOperation = "luminosity";
1716
- ctx.fillStyle = "#ffffff";
1717
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
1718
- ctx.restore();
1719
- },
1720
- "dot": (ctx, params, intensity) => {
1721
- const width = ctx.canvas.width;
1722
- const height = ctx.canvas.height;
1723
- ctx.save();
1724
- ctx.fillStyle = "rgba(0,0,0,0.15)";
1725
- const step = Math.max(4, Math.floor(10 * Number(params.scale ?? 1)));
1726
- for (let x = 0; x < width; x += step) {
1727
- for (let y = 0; y < height; y += step) {
1728
- ctx.beginPath();
1729
- ctx.arc(x, y, 1.5 * intensity, 0, Math.PI * 2);
1730
- ctx.fill();
1731
- }
1732
- }
1733
- ctx.restore();
1734
- },
1735
- "emboss": (ctx, params, intensity) => {
1736
- ctx.save();
1737
- ctx.globalAlpha = 0.3 * intensity;
1738
- ctx.drawImage(ctx.canvas, 1, 1);
1739
- ctx.restore();
1740
- },
1741
- "cross-hatch": (ctx, params, intensity) => {
1742
- const width = ctx.canvas.width;
1743
- const height = ctx.canvas.height;
1744
- ctx.save();
1745
- ctx.strokeStyle = `rgba(0,0,0,${0.15 * intensity})`;
1746
- ctx.lineWidth = 1;
1747
- for (let i = 0; i < width; i += 20) {
1748
- ctx.beginPath();
1749
- ctx.moveTo(i, 0);
1750
- ctx.lineTo(i + height, height);
1751
- ctx.stroke();
1752
- }
1753
- ctx.restore();
1754
- },
1755
- "pixelate": (ctx, params, intensity) => {
1756
- const width = ctx.canvas.width;
1757
- const height = ctx.canvas.height;
1758
- const cellW = Math.max(2, Math.floor(Number(params.sizeX ?? 10) * intensity));
1759
- const cellH = Math.max(2, Math.floor(Number(params.sizeY ?? 10) * intensity));
1760
- ctx.save();
1761
- ctx.imageSmoothingEnabled = false;
1762
- const tempCanvas = document.createElement("canvas");
1763
- tempCanvas.width = Math.max(4, Math.floor(width / cellW));
1764
- tempCanvas.height = Math.max(4, Math.floor(height / cellH));
1765
- const tempCtx = tempCanvas.getContext("2d");
1766
- tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
1767
- ctx.clearRect(0, 0, width, height);
1768
- ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
1769
- ctx.restore();
1770
- },
1771
- "ascii": (ctx, params, intensity) => {
1772
- const width = ctx.canvas.width;
1773
- const height = ctx.canvas.height;
1774
- const size = Math.max(4, Math.floor(Number(params.size ?? 8) * intensity));
1775
- ctx.save();
1776
- ctx.imageSmoothingEnabled = false;
1777
- const tempCanvas = document.createElement("canvas");
1778
- tempCanvas.width = Math.max(4, Math.floor(width / size));
1779
- tempCanvas.height = Math.max(4, Math.floor(height / size));
1780
- const tempCtx = tempCanvas.getContext("2d");
1781
- tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
1782
- ctx.clearRect(0, 0, width, height);
1783
- ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
1784
- ctx.restore();
1785
- }
1786
- };
1787
- return renderers[id] || null;
173
+ };
174
+ }
175
+ return null;
1788
176
  }
1789
177
  function searchEffects(query) {
1790
178
  const lowerQuery = query.toLowerCase();
1791
- 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)));
179
+ return Object.values(EFFECTS_REGISTRY).filter(
180
+ (effect) => effect.name.toLowerCase().includes(lowerQuery) || effect.description.toLowerCase().includes(lowerQuery) || effect.tags.some((tag) => tag.toLowerCase().includes(lowerQuery))
181
+ );
1792
182
  }
1793
183
 
1794
184
  // src/videoEffects/EffectRenderer.ts
@@ -2075,6 +465,36 @@ var EffectEngine = class {
2075
465
  }
2076
466
  };
2077
467
 
468
+ // src/videoEffects/utils/colorUtils.ts
469
+ function hexToRgba(hex, alpha) {
470
+ hex = hex.replace("#", "");
471
+ const r = parseInt(hex.substring(0, 2), 16);
472
+ const g = parseInt(hex.substring(2, 4), 16);
473
+ const b = parseInt(hex.substring(4, 6), 16);
474
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
475
+ }
476
+ function rgbaToComponents(rgba) {
477
+ const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
478
+ if (!match) {
479
+ return { r: 0, g: 0, b: 0, a: 1 };
480
+ }
481
+ return {
482
+ r: parseInt(match[1]),
483
+ g: parseInt(match[2]),
484
+ b: parseInt(match[3]),
485
+ a: match[4] ? parseFloat(match[4]) : 1
486
+ };
487
+ }
488
+ function blendColors(color1, color2, ratio) {
489
+ const c1 = rgbaToComponents(color1);
490
+ const c2 = rgbaToComponents(color2);
491
+ const r = Math.round(c1.r * (1 - ratio) + c2.r * ratio);
492
+ const g = Math.round(c1.g * (1 - ratio) + c2.g * ratio);
493
+ const b = Math.round(c1.b * (1 - ratio) + c2.b * ratio);
494
+ const a = c1.a * (1 - ratio) + c2.a * ratio;
495
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
496
+ }
497
+
2078
498
  // src/videoEffects/utils/canvasUtils.ts
2079
499
  function addNoise(ctx, amount) {
2080
500
  const width = ctx.canvas.width;
@@ -2196,67 +616,12 @@ function generateEffectsManifest() {
2196
616
  effects: getAllEffectsForApi()
2197
617
  };
2198
618
  }
2199
-
2200
- // src/videoEffects/renderers/camera/index.ts
2201
- var camera_exports = {};
2202
- __export(camera_exports, {
2203
- renderDolly: () => renderDolly,
2204
- renderPan: () => renderPan,
2205
- renderRotate: () => renderRotate,
2206
- renderShake: () => renderShake,
2207
- renderZoom: () => renderZoom
2208
- });
2209
-
2210
- // src/videoEffects/renderers/camera/shake.ts
2211
- function renderShake(ctx, params, intensity, time) {
2212
- const shakeIntensity = (params.intensity || 50) * intensity;
2213
- const frequency = params.frequency || 10;
2214
- const offsetX = Math.sin(time * frequency) * shakeIntensity;
2215
- const offsetY = Math.cos(time * frequency * 1.3) * shakeIntensity;
2216
- ctx.translate(offsetX, offsetY);
2217
- }
2218
-
2219
- // src/videoEffects/renderers/camera/zoom.ts
2220
- function renderZoom(ctx, params, intensity, time) {
2221
- const scale = 1 + (params.scale || 0.2) * intensity;
2222
- const centerX = params.centerX || 0.5;
2223
- const centerY = params.centerY || 0.5;
2224
- const width = ctx.canvas.width;
2225
- const height = ctx.canvas.height;
2226
- ctx.translate(width * centerX, height * centerY);
2227
- ctx.scale(scale, scale);
2228
- ctx.translate(-width * centerX, -height * centerY);
2229
- }
2230
-
2231
- // src/videoEffects/renderers/camera/pan.ts
2232
- function renderPan(ctx, params, intensity, time) {
2233
- const panX = (params.panX || 0) * intensity;
2234
- const panY = (params.panY || 0) * intensity;
2235
- ctx.translate(panX, panY);
2236
- }
2237
-
2238
- // src/videoEffects/renderers/camera/rotate.ts
2239
- function renderRotate(ctx, params, intensity, time) {
2240
- const angle = (params.angle || 0) * intensity * (Math.PI / 180);
2241
- const width = ctx.canvas.width;
2242
- const height = ctx.canvas.height;
2243
- ctx.translate(width / 2, height / 2);
2244
- ctx.rotate(angle);
2245
- ctx.translate(-width / 2, -height / 2);
2246
- }
2247
-
2248
- // src/videoEffects/renderers/camera/dolly.ts
2249
- function renderDolly(ctx, params, intensity, time) {
2250
- renderZoom(ctx, params, intensity, time);
2251
- }
2252
619
  // Annotate the CommonJS export names for ESM import in node:
2253
620
  0 && (module.exports = {
2254
- CameraEffects,
2255
621
  EFFECTS_REGISTRY,
2256
622
  EffectEngine,
2257
623
  EffectGraph,
2258
624
  EffectRenderer,
2259
- LightEffects,
2260
625
  addNoise,
2261
626
  blendColors,
2262
627
  clearCanvas,