@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.
package/dist/index.cjs CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/index.ts
@@ -31,7 +41,6 @@ __export(index_exports, {
31
41
  CANONICAL_RENDERER_VERSION: () => CANONICAL_RENDERER_VERSION,
32
42
  CANONICAL_SCHEMA_VERSION: () => CANONICAL_SCHEMA_VERSION,
33
43
  COMPOSITION_PRESETS: () => COMPOSITION_PRESETS,
34
- CameraEffects: () => camera_exports,
35
44
  CanvasDevice: () => CanvasDevice,
36
45
  CommandBufferBuilder: () => CommandBufferBuilder,
37
46
  CommandExecutor: () => CommandExecutor,
@@ -83,8 +92,9 @@ __export(index_exports, {
83
92
  LOTTIE_TEMPLATE_PRESETS: () => LOTTIE_TEMPLATE_PRESETS,
84
93
  LayerAnimationSchema: () => LayerAnimationSchema,
85
94
  LayoutEngine: () => LayoutEngine,
86
- LightEffects: () => light_exports,
87
95
  LiveBroadcastBridge: () => LiveBroadcastBridge,
96
+ MAX_ASSET_BYTES: () => MAX_ASSET_BYTES,
97
+ MAX_LOTTIE_BYTES: () => MAX_LOTTIE_BYTES,
88
98
  MediaEncoderRegistry: () => MediaEncoderRegistry,
89
99
  MediaImageEngine: () => MediaImageEngine,
90
100
  MetricEngine: () => MetricEngine,
@@ -174,6 +184,7 @@ __export(index_exports, {
174
184
  calculateMediaFit: () => calculateMediaFit,
175
185
  calculateResizeBounds: () => calculateResizeBounds,
176
186
  calculateRotationAngle: () => calculateRotationAngle,
187
+ calculateSha256: () => calculateSha256,
177
188
  canonicalContentHash: () => canonicalContentHash,
178
189
  canonicalTemplateHash: () => canonicalTemplateHash,
179
190
  canonicalizeSceneDocument: () => canonicalizeSceneDocument,
@@ -290,6 +301,8 @@ __export(index_exports, {
290
301
  injectSolidColor: () => injectSolidColor,
291
302
  injectText: () => injectText,
292
303
  injectTextStyle: () => injectTextStyle,
304
+ inspectLottieJson: () => inspectLottieJson,
305
+ inspectStickerAsset: () => inspectStickerAsset,
293
306
  interpolateColorString: () => interpolateColorString,
294
307
  interpolateValue: () => interpolateValue,
295
308
  isKeyframed: () => isKeyframed,
@@ -357,6 +370,7 @@ __export(index_exports, {
357
370
  runtimeAssetResolver: () => runtimeAssetResolver,
358
371
  sampleVideoContextAtTime: () => sampleVideoContextAtTime,
359
372
  scanLottieFonts: () => scanLottieFonts,
373
+ scanLottieNodes: () => scanLottieNodes,
360
374
  scanTextLayers: () => scanTextLayers,
361
375
  sceneToConfig: () => sceneToConfig,
362
376
  searchEffects: () => searchEffects,
@@ -8236,1749 +8250,141 @@ function getRenderCapabilities(plan, target) {
8236
8250
  return plan.capabilities[target];
8237
8251
  }
8238
8252
 
8239
- // src/videoEffects/renderers/light/index.ts
8240
- var light_exports = {};
8241
- __export(light_exports, {
8242
- renderDustParticles: () => renderDustParticles,
8243
- renderFire: () => renderFire,
8244
- renderFlash: () => renderFlash,
8245
- renderFlicker: () => renderFlicker,
8246
- renderGlow: () => renderGlow,
8247
- renderLightLeak: () => renderLightLeak,
8248
- renderLightLeak2: () => renderLightLeak2,
8249
- renderParticles: () => renderParticles,
8250
- renderVignette: () => renderVignette
8251
- });
8252
-
8253
- // src/videoEffects/renderers/light/lightLeak.ts
8254
- function renderLightLeak(ctx, params, intensity, time) {
8255
- const width = ctx.canvas.width;
8256
- const height = ctx.canvas.height;
8257
- const gradient = ctx.createLinearGradient(0, 0, width, height);
8258
- gradient.addColorStop(0, `rgba(255, 200, 100, ${intensity * 0.3})`);
8259
- gradient.addColorStop(1, "rgba(255, 200, 100, 0)");
8260
- ctx.globalCompositeOperation = "screen";
8261
- ctx.fillStyle = gradient;
8262
- ctx.fillRect(0, 0, width, height);
8263
- ctx.globalCompositeOperation = "source-over";
8264
- }
8265
-
8266
- // src/videoEffects/utils/colorUtils.ts
8267
- function hexToRgba(hex, alpha2) {
8268
- hex = hex.replace("#", "");
8269
- const r = parseInt(hex.substring(0, 2), 16);
8270
- const g = parseInt(hex.substring(2, 4), 16);
8271
- const b = parseInt(hex.substring(4, 6), 16);
8272
- return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
8273
- }
8274
- function rgbaToComponents(rgba) {
8275
- const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
8276
- if (!match) {
8277
- return { r: 0, g: 0, b: 0, a: 1 };
8278
- }
8279
- return {
8280
- r: parseInt(match[1]),
8281
- g: parseInt(match[2]),
8282
- b: parseInt(match[3]),
8283
- a: match[4] ? parseFloat(match[4]) : 1
8284
- };
8285
- }
8286
- function blendColors(color1, color2, ratio) {
8287
- const c1 = rgbaToComponents(color1);
8288
- const c2 = rgbaToComponents(color2);
8289
- const r = Math.round(c1.r * (1 - ratio) + c2.r * ratio);
8290
- const g = Math.round(c1.g * (1 - ratio) + c2.g * ratio);
8291
- const b = Math.round(c1.b * (1 - ratio) + c2.b * ratio);
8292
- const a = c1.a * (1 - ratio) + c2.a * ratio;
8293
- return `rgba(${r}, ${g}, ${b}, ${a})`;
8294
- }
8295
-
8296
- // src/videoEffects/renderers/light/lightLeak2.ts
8297
- function renderLightLeak2(ctx, params, intensity, time) {
8298
- const width = ctx.canvas.width;
8299
- const height = ctx.canvas.height;
8300
- const duration = params.duration || 3;
8301
- const progress = time % duration / duration;
8302
- let x, y;
8303
- let fadeMultiplier = 1;
8304
- if (progress < 0.4) {
8305
- const phase1Progress = progress / 0.4;
8306
- x = width * phase1Progress;
8307
- y = height;
8308
- } else if (progress < 0.8) {
8309
- const phase2Progress = (progress - 0.4) / 0.4;
8310
- x = width;
8311
- y = height * (1 - phase2Progress);
8312
- } else {
8313
- const phase3Progress = (progress - 0.8) / 0.2;
8314
- x = width;
8315
- y = 0;
8316
- fadeMultiplier = 1 - phase3Progress;
8317
- }
8318
- const leakSize = Math.min(width, height) * (params.size || 0.8);
8319
- const gradient = ctx.createRadialGradient(x, y, 0, x, y, leakSize);
8320
- const color1 = params.color1 || "#FF6B35";
8321
- const color2 = params.color2 || "#FF8C42";
8322
- const color3 = params.color3 || "#FFA500";
8323
- const alpha2 = intensity * fadeMultiplier;
8324
- gradient.addColorStop(0, hexToRgba(color1, alpha2 * 0.9));
8325
- gradient.addColorStop(0.2, hexToRgba(color2, alpha2 * 0.7));
8326
- gradient.addColorStop(0.5, hexToRgba(color3, alpha2 * 0.4));
8327
- gradient.addColorStop(0.8, hexToRgba(color3, alpha2 * 0.1));
8328
- gradient.addColorStop(1, "rgba(255, 165, 0, 0)");
8329
- ctx.globalCompositeOperation = "screen";
8330
- ctx.fillStyle = gradient;
8331
- ctx.fillRect(0, 0, width, height);
8332
- ctx.globalCompositeOperation = "source-over";
8333
- }
8334
-
8335
- // src/videoEffects/renderers/light/flash.ts
8336
- function renderFlash(ctx, params, intensity, time) {
8337
- const flashColor = params.flashColor || "#ffffff";
8338
- const flashIntensity = (params.flashIntensity || 1) * intensity;
8339
- ctx.globalCompositeOperation = "screen";
8340
- ctx.fillStyle = flashColor;
8341
- ctx.globalAlpha = flashIntensity;
8342
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
8343
- ctx.globalAlpha = 1;
8344
- ctx.globalCompositeOperation = "source-over";
8345
- }
8346
-
8347
- // src/videoEffects/renderers/light/flicker.ts
8348
- function renderFlicker(ctx, params, intensity, time) {
8349
- const flickerAmount = Math.random() * intensity;
8350
- ctx.globalAlpha = 1 - flickerAmount * 0.5;
8351
- }
8352
-
8353
- // src/videoEffects/renderers/light/vignette.ts
8354
- function renderVignette(ctx, params, intensity, time) {
8355
- const width = ctx.canvas.width;
8356
- const height = ctx.canvas.height;
8357
- const radius = params.radius || 0.7;
8358
- const gradient = ctx.createRadialGradient(width / 2, height / 2, Math.min(width, height) * radius, width / 2, height / 2, Math.max(width, height));
8359
- gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
8360
- gradient.addColorStop(1, `rgba(0, 0, 0, ${intensity * 0.7})`);
8361
- ctx.fillStyle = gradient;
8362
- ctx.fillRect(0, 0, width, height);
8363
- }
8364
-
8365
- // src/videoEffects/renderers/light/glow.ts
8366
- function renderGlow(ctx, params, intensity, time) {
8367
- const glowAmount = (params.glowAmount || 10) * intensity;
8368
- ctx.shadowBlur = glowAmount;
8369
- ctx.shadowColor = params.glowColor || "#ffffff";
8370
- }
8371
-
8372
- // src/videoEffects/renderers/light/fire.ts
8373
- function renderFire(ctx, params, intensity, time) {
8374
- const width = ctx.canvas.width;
8375
- const height = ctx.canvas.height;
8376
- const fireHeight = (params.fireHeight ?? 0.4) * height;
8377
- const particleCount = Math.floor((params.particleCount ?? 50) * intensity);
8378
- const fireColor1 = params.fireColor1 ?? "#FF4500";
8379
- const fireColor2 = params.fireColor2 ?? "#FFA500";
8380
- const fireColor3 = params.fireColor3 ?? "#FFD700";
8381
- const gradient = ctx.createLinearGradient(0, height, 0, height - fireHeight);
8382
- gradient.addColorStop(0, fireColor1);
8383
- gradient.addColorStop(0.5, fireColor2);
8384
- gradient.addColorStop(1, fireColor3);
8385
- ctx.globalAlpha = 0.6 * intensity;
8386
- ctx.fillStyle = gradient;
8387
- ctx.beginPath();
8388
- ctx.moveTo(0, height);
8389
- const waveCount = 8;
8390
- const waveAmplitude = 40;
8391
- const waveSpeed = time * 3;
8392
- for (let i = 0; i <= width; i += width / 100) {
8393
- const waveOffset = Math.sin(i / width * waveCount + waveSpeed) * waveAmplitude;
8394
- ctx.lineTo(i, height - fireHeight + waveOffset);
8395
- }
8396
- ctx.lineTo(width, height);
8397
- ctx.closePath();
8398
- ctx.fill();
8399
- ctx.globalAlpha = 0.8 * intensity;
8400
- for (let i = 0; i < particleCount; i++) {
8401
- const x = (Math.sin(time * 2 + i * 0.5) * 0.5 + 0.5) * width;
8402
- const particleProgress = (time * 0.5 + i * 0.1) % 1;
8403
- const y = height - particleProgress * fireHeight * 1.2;
8404
- const size = (1 - particleProgress) * 8 * intensity;
8405
- const alpha2 = (1 - particleProgress) * intensity;
8406
- ctx.globalAlpha = alpha2;
8407
- ctx.fillStyle = i % 3 === 0 ? fireColor1 : i % 3 === 1 ? fireColor2 : fireColor3;
8408
- ctx.beginPath();
8409
- ctx.arc(x, y, size, 0, Math.PI * 2);
8410
- ctx.fill();
8411
- }
8412
- ctx.globalAlpha = 1;
8413
- }
8414
-
8415
- // src/videoEffects/renderers/light/particles.ts
8416
- function renderParticles(ctx, params, intensity, time) {
8417
- const width = ctx.canvas.width;
8418
- const height = ctx.canvas.height;
8419
- const particleCount = Math.floor((params.particleCount ?? 100) * intensity);
8420
- const particleSize = (params.particleSize ?? 3) * intensity;
8421
- const particleColor = params.particleColor ?? "#FFFFFF";
8422
- const driftSpeed = params.driftSpeed ?? 1;
8423
- const fadeEffect = params.fadeEffect ?? true;
8424
- ctx.globalCompositeOperation = "screen";
8425
- for (let i = 0; i < particleCount; i++) {
8426
- const seed = i * 0.1;
8427
- const x = (Math.sin(time * driftSpeed * 0.5 + seed) * 0.5 + 0.5) * width;
8428
- const y = (time * driftSpeed * 20 + i * 15) % (height + 100) - 50;
8429
- const sizeVariation = Math.sin(time * 2 + seed) * 0.3 + 0.7;
8430
- const size = particleSize * sizeVariation;
8431
- let alpha2 = intensity * 0.8;
8432
- if (fadeEffect) {
8433
- if (y < 100) {
8434
- alpha2 *= y / 100;
8435
- } else if (y > height - 100) {
8436
- alpha2 *= (height - y) / 100;
8437
- }
8438
- }
8439
- ctx.globalAlpha = Math.max(0, alpha2);
8440
- ctx.fillStyle = particleColor;
8441
- ctx.beginPath();
8442
- ctx.arc(x, y, size, 0, Math.PI * 2);
8443
- ctx.fill();
8444
- }
8445
- ctx.globalAlpha = 1;
8446
- ctx.globalCompositeOperation = "source-over";
8447
- }
8448
- function renderDustParticles(ctx, params, intensity, time) {
8449
- const width = ctx.canvas.width;
8450
- const height = ctx.canvas.height;
8451
- const particleCount = Math.floor((params.particleCount ?? 60) * intensity);
8452
- const particleSize = (params.particleSize ?? 2) * intensity;
8453
- const particleColor = params.particleColor ?? "#E0E0E0";
8454
- ctx.globalCompositeOperation = "screen";
8455
- ctx.globalAlpha = 0.3 * intensity;
8456
- for (let i = 0; i < particleCount; i++) {
8457
- const seed = i * 0.05;
8458
- const x = (Math.sin(time * 0.2 + seed) * 0.5 + 0.5) * width;
8459
- const y = (Math.cos(time * 0.15 + seed * 2) * 0.5 + 0.5) * height;
8460
- const sizePulse = Math.sin(time + seed * 3) * 0.2 + 0.8;
8461
- const size = particleSize * sizePulse;
8462
- const alphaVariation = Math.sin(time * 0.5 + seed * 5) * 0.3 + 0.7;
8463
- ctx.globalAlpha = 0.2 * intensity * alphaVariation;
8464
- ctx.fillStyle = particleColor;
8465
- ctx.beginPath();
8466
- ctx.arc(x, y, size, 0, Math.PI * 2);
8467
- ctx.fill();
8468
- }
8469
- ctx.globalAlpha = 1;
8470
- ctx.globalCompositeOperation = "source-over";
8471
- }
8472
-
8473
- // src/videoEffects/effectsRegistry.ts
8474
- var EFFECTS_REGISTRY = {
8475
- // ==================== LIGHT EFFECTS ====================
8476
- light_leak: {
8477
- id: "light_leak",
8478
- name: "Light Leak",
8479
- category: "light",
8480
- description: "Classic light leak effect",
8481
- defaultParams: {},
8482
- parameterSchema: {},
8483
- tags: ["light", "vintage", "film"]
8484
- },
8485
- light_leak_2: {
8486
- id: "light_leak_2",
8487
- name: "Leak 2",
8488
- category: "light",
8489
- description: "Animated red/orange light moving across the frame",
8490
- defaultParams: {
8491
- duration: 3,
8492
- size: 0.8,
8493
- color1: "#FF6B35",
8494
- color2: "#FF8C42",
8495
- color3: "#FFA500"
8496
- },
8497
- parameterSchema: {
8498
- duration: {
8499
- type: "number",
8500
- label: "Duration",
8501
- min: 1,
8502
- max: 10,
8503
- default: 3,
8504
- step: 0.5
8505
- },
8506
- size: {
8507
- type: "number",
8508
- label: "Size",
8509
- min: 0.1,
8510
- max: 1.5,
8511
- default: 0.8,
8512
- step: 0.1
8513
- },
8514
- color1: {
8515
- type: "color",
8516
- label: "Primary Color",
8517
- default: "#FF6B35"
8518
- },
8519
- color2: {
8520
- type: "color",
8521
- label: "Secondary Color",
8522
- default: "#FF8C42"
8523
- },
8524
- color3: {
8525
- type: "color",
8526
- label: "Tertiary Color",
8527
- default: "#FFA500"
8528
- }
8529
- },
8530
- tags: ["light", "animated", "cinematic", "warm"]
8531
- },
8532
- flash: {
8533
- id: "flash",
8534
- name: "Flash",
8535
- category: "light",
8536
- description: "Bright flash effect",
8537
- defaultParams: { flashColor: "#ffffff", flashIntensity: 1 },
8538
- parameterSchema: {
8539
- flashColor: {
8540
- type: "color",
8541
- label: "Flash Color",
8542
- default: "#ffffff"
8543
- },
8544
- flashIntensity: {
8545
- type: "number",
8546
- label: "Intensity",
8547
- min: 0,
8548
- max: 1,
8549
- default: 1,
8550
- step: 0.1
8551
- }
8552
- },
8553
- tags: ["light", "bright", "instant"]
8554
- },
8555
- flicker: {
8556
- id: "flicker",
8557
- name: "Flicker",
8558
- category: "light",
8559
- description: "Random light flickering effect",
8560
- defaultParams: {},
8561
- parameterSchema: {},
8562
- tags: ["light", "flicker", "dynamic"]
8563
- },
8564
- vignette: {
8565
- id: "vignette",
8566
- name: "Vignette",
8567
- category: "light",
8568
- description: "Darkens the edges of the frame",
8569
- defaultParams: { radius: 0.7 },
8570
- parameterSchema: {
8571
- radius: {
8572
- type: "number",
8573
- label: "Radius",
8574
- min: 0.1,
8575
- max: 1,
8576
- default: 0.7,
8577
- step: 0.05
8578
- }
8579
- },
8580
- tags: ["light", "vintage", "cinematic"]
8581
- },
8582
- glow: {
8583
- id: "glow",
8584
- name: "Glow",
8585
- category: "light",
8586
- description: "Adds a glow effect",
8587
- defaultParams: { glowAmount: 10, glowColor: "#ffffff" },
8588
- parameterSchema: {
8589
- glowAmount: {
8590
- type: "number",
8591
- label: "Amount",
8592
- min: 0,
8593
- max: 50,
8594
- default: 10,
8595
- step: 1
8596
- },
8597
- glowColor: {
8598
- type: "color",
8599
- label: "Color",
8600
- default: "#ffffff"
8601
- }
8602
- },
8603
- tags: ["light", "soft", "dreamy"]
8604
- },
8605
- fire: {
8606
- id: "fire",
8607
- name: "Fire",
8608
- category: "light",
8609
- description: "Animated fire effect with particles",
8610
- defaultParams: {
8611
- fireHeight: 0.4,
8612
- particleCount: 50,
8613
- fireColor1: "#FF4500",
8614
- fireColor2: "#FFA500",
8615
- fireColor3: "#FFD700"
8616
- },
8617
- parameterSchema: {
8618
- fireHeight: {
8619
- type: "number",
8620
- label: "Fire Height",
8621
- min: 0.1,
8622
- max: 0.8,
8623
- default: 0.4,
8624
- step: 0.05
8625
- },
8626
- particleCount: {
8627
- type: "number",
8628
- label: "Particle Count",
8629
- min: 10,
8630
- max: 100,
8631
- default: 50,
8632
- step: 5
8633
- },
8634
- fireColor1: {
8635
- type: "color",
8636
- label: "Base Color",
8637
- default: "#FF4500"
8638
- },
8639
- fireColor2: {
8640
- type: "color",
8641
- label: "Mid Color",
8642
- default: "#FFA500"
8643
- },
8644
- fireColor3: {
8645
- type: "color",
8646
- label: "Top Color",
8647
- default: "#FFD700"
8648
- }
8649
- },
8650
- tags: ["light", "animated", "fire", "particles"]
8651
- },
8652
- particles: {
8653
- id: "particles",
8654
- name: "Particles",
8655
- category: "light",
8656
- description: "Floating particle effect",
8657
- defaultParams: {
8658
- particleCount: 100,
8659
- particleSize: 3,
8660
- particleColor: "#FFFFFF",
8661
- driftSpeed: 1,
8662
- fadeEffect: true
8663
- },
8664
- parameterSchema: {
8665
- particleCount: {
8666
- type: "number",
8667
- label: "Particle Count",
8668
- min: 20,
8669
- max: 200,
8670
- default: 100,
8671
- step: 10
8672
- },
8673
- particleSize: {
8674
- type: "number",
8675
- label: "Particle Size",
8676
- min: 1,
8677
- max: 10,
8678
- default: 3,
8679
- step: 0.5
8680
- },
8681
- particleColor: {
8682
- type: "color",
8683
- label: "Color",
8684
- default: "#FFFFFF"
8685
- },
8686
- driftSpeed: {
8687
- type: "number",
8688
- label: "Drift Speed",
8689
- min: 0.1,
8690
- max: 3,
8691
- default: 1,
8692
- step: 0.1
8693
- },
8694
- fadeEffect: {
8695
- type: "boolean",
8696
- label: "Fade at Edges",
8697
- default: true
8698
- }
8699
- },
8700
- tags: ["light", "animated", "particles", "floating"]
8701
- },
8702
- dust_particles: {
8703
- id: "dust_particles",
8704
- name: "Dust Particles",
8705
- category: "light",
8706
- description: "Slow drifting dust particles",
8707
- defaultParams: {
8708
- particleCount: 60,
8709
- particleSize: 2,
8710
- particleColor: "#E0E0E0"
8711
- },
8712
- parameterSchema: {
8713
- particleCount: {
8714
- type: "number",
8715
- label: "Particle Count",
8716
- min: 20,
8717
- max: 150,
8718
- default: 60,
8719
- step: 10
8720
- },
8721
- particleSize: {
8722
- type: "number",
8723
- label: "Particle Size",
8724
- min: 1,
8725
- max: 5,
8726
- default: 2,
8727
- step: 0.5
8728
- },
8729
- particleColor: {
8730
- type: "color",
8731
- label: "Color",
8732
- default: "#E0E0E0"
8733
- }
8734
- },
8735
- tags: ["light", "particles", "dust", "subtle"]
8736
- },
8737
- // ==================== BODY EFFECTS ====================
8738
- body_glow: {
8739
- id: "body_glow",
8740
- name: "Body Glow",
8741
- category: "body",
8742
- description: "Adds a soft neon glow around the body silhouette",
8743
- defaultParams: { glowColor: "#7C6FFF", glowRadius: 20, glowIntensity: 0.8 },
8744
- parameterSchema: {
8745
- glowColor: { type: "color", label: "Glow Color", default: "#7C6FFF" },
8746
- glowRadius: { type: "number", label: "Glow Radius", min: 5, max: 50, default: 20, step: 1 },
8747
- glowIntensity: { type: "number", label: "Glow Intensity", min: 0.1, max: 1, default: 0.8, step: 0.05 }
8748
- },
8749
- tags: ["body", "neon", "glow"]
8750
- },
8751
- body_outline: {
8752
- id: "body_outline",
8753
- name: "Body Outline",
8754
- category: "body",
8755
- description: "Traces the outline of the body with a glowing line",
8756
- defaultParams: { outlineColor: "#00E5FF", outlineWidth: 6, feather: 15 },
8757
- parameterSchema: {
8758
- outlineColor: { type: "color", label: "Outline Color", default: "#00E5FF" },
8759
- outlineWidth: { type: "number", label: "Outline Width", min: 2, max: 20, default: 6, step: 1 },
8760
- feather: { type: "number", label: "Feather", min: 0, max: 30, default: 15, step: 1 }
8761
- },
8762
- tags: ["body", "outline", "glowing"]
8763
- },
8764
- body_particles: {
8765
- id: "body_particles",
8766
- name: "Body Particles",
8767
- category: "body",
8768
- description: "Emits floating particles tracing the body shape",
8769
- defaultParams: { particleColor: "#FF2A85", particleCount: 60, particleSize: 3, drift: 8 },
8770
- parameterSchema: {
8771
- particleColor: { type: "color", label: "Particle Color", default: "#FF2A85" },
8772
- particleCount: { type: "number", label: "Particle Count", min: 10, max: 150, default: 60, step: 5 },
8773
- particleSize: { type: "number", label: "Particle Size", min: 1, max: 8, default: 3, step: 0.5 },
8774
- drift: { type: "number", label: "Drift", min: 2, max: 20, default: 8, step: 1 }
8775
- },
8776
- tags: ["body", "particles", "floating"]
8777
- },
8778
- "body-segmentation-glow": {
8779
- id: "body-segmentation-glow",
8780
- name: "Segmentation Glow",
8781
- category: "body",
8782
- description: "Glow overlay matching body segmentation mask",
8783
- defaultParams: { glowColor: "#FFD700", glowRadius: 25 },
8784
- parameterSchema: {
8785
- glowColor: { type: "color", label: "Color", default: "#FFD700" },
8786
- glowRadius: { type: "number", label: "Radius", min: 5, max: 50, default: 25, step: 1 }
8787
- },
8788
- tags: ["body", "segmentation", "glow"]
8789
- },
8790
- // Native video filter effects (unified registry metadata)
8791
- "light-leak": {
8792
- id: "light-leak",
8793
- name: "Light Leak",
8794
- category: "light",
8795
- description: "Classic cinematic light sweep across the frame",
8796
- defaultParams: { gain: 0.6, lacunarity: 2.5, alpha: 0.8, angle: 30, speed: 1, animated: true },
8797
- parameterSchema: {
8798
- gain: { type: "number", label: "Gain", min: 0, max: 1, default: 0.6, step: 0.05 },
8799
- lacunarity: { type: "number", label: "Lacunarity", min: 0, max: 5, default: 2.5, step: 0.1 },
8800
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.8, step: 0.05 },
8801
- angle: { type: "number", label: "Angle", min: -180, max: 180, default: 30, step: 5 },
8802
- speed: { type: "number", label: "Speed", min: 0, max: 5, default: 1, step: 0.1 }
8803
- },
8804
- tags: ["light", "vintage", "film"]
8805
- },
8806
- "lens-flare": {
8807
- id: "lens-flare",
8808
- name: "Lens Flare",
8809
- category: "light",
8810
- description: "Double-stage lens flare: Godray filter coupled with an animated GPU starburst shader.",
8811
- defaultParams: { godrayGain: 0.4, godrayAlpha: 0.5, flareIntensity: 0.8, flareColor: "#7C6FFF", speed: 1, animated: true },
8812
- parameterSchema: {
8813
- godrayGain: { type: "number", label: "Rays Gain", min: 0, max: 1, default: 0.4, step: 0.05 },
8814
- godrayAlpha: { type: "number", label: "Rays Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
8815
- flareIntensity: { type: "number", label: "Intensity", min: 0, max: 3, default: 0.8, step: 0.05 },
8816
- flareColor: { type: "color", label: "Color", default: "#7C6FFF" },
8817
- speed: { type: "number", label: "Speed", min: 0, max: 4, default: 1, step: 0.1 }
8818
- },
8819
- tags: ["light", "flare", "cinematic"]
8820
- },
8821
- "rgb-split": {
8822
- id: "rgb-split",
8823
- name: "RGB Split",
8824
- category: "glitch",
8825
- description: "Split red, green, and blue channels",
8826
- defaultParams: { redX: 4, redY: 0, blueX: -4, blueY: 0, greenX: 0, greenY: 0, speed: 1.5, animated: true },
8827
- parameterSchema: {
8828
- redX: { type: "number", label: "Red X", min: -50, max: 50, default: 4, step: 0.5 },
8829
- redY: { type: "number", label: "Red Y", min: -50, max: 50, default: 0, step: 0.5 },
8830
- blueX: { type: "number", label: "Blue X", min: -50, max: 50, default: -4, step: 0.5 },
8831
- blueY: { type: "number", label: "Blue Y", min: -50, max: 50, default: 0, step: 0.5 },
8832
- greenX: { type: "number", label: "Green X", min: -50, max: 50, default: 0, step: 0.5 },
8833
- greenY: { type: "number", label: "Green Y", min: -50, max: 50, default: 0, step: 0.5 },
8834
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
8835
- },
8836
- tags: ["glitch", "rgb", "chromatic"]
8837
- },
8838
- "vhs": {
8839
- id: "vhs",
8840
- name: "VHS",
8841
- category: "glitch",
8842
- description: "Vintage tape tracking lines and phosphor noise",
8843
- defaultParams: { noise: 0.08, scanlines: true, lineAlpha: 0.25, hShift: 3e-3, bandSpeed: 1.2, bandAlpha: 0.35 },
8844
- parameterSchema: {
8845
- noise: { type: "number", label: "Noise", min: 0, max: 0.3, default: 0.08, step: 0.01 },
8846
- scanlines: { type: "boolean", label: "Scanlines", default: true },
8847
- lineAlpha: { type: "number", label: "Line Alpha", min: 0, max: 1, default: 0.25, step: 0.05 },
8848
- hShift: { type: "number", label: "H-Shift", min: 0, max: 0.02, default: 3e-3, step: 1e-3 },
8849
- bandSpeed: { type: "number", label: "Band Speed", min: 0.1, max: 5, default: 1.2, step: 0.1 },
8850
- bandAlpha: { type: "number", label: "Band Alpha", min: 0, max: 1, default: 0.35, step: 0.05 }
8851
- },
8852
- tags: ["glitch", "retro", "vhs", "tape"]
8853
- },
8854
- "glitch-band": {
8855
- id: "glitch-band",
8856
- name: "Glitch Band",
8857
- category: "glitch",
8858
- description: "Digital glitch slices running dynamically",
8859
- defaultParams: { slices: 15, offset: 80, direction: 0, redX: -3, redY: 0, blueX: 3, blueY: 0, animated: true },
8860
- parameterSchema: {
8861
- slices: { type: "number", label: "Slices", min: 2, max: 80, default: 15, step: 1 },
8862
- offset: { type: "number", label: "Offset", min: 0, max: 400, default: 80, step: 5 },
8863
- direction: { type: "number", label: "Direction", min: 0, max: 360, default: 0, step: 5 },
8864
- redX: { type: "number", label: "Red X", min: -20, max: 20, default: -3, step: 1 },
8865
- redY: { type: "number", label: "Red Y", min: -20, max: 20, default: 0, step: 1 },
8866
- blueX: { type: "number", label: "Blue X", min: -20, max: 20, default: 3, step: 1 },
8867
- blueY: { type: "number", label: "Blue Y", min: -20, max: 20, default: 0, step: 1 }
8868
- },
8869
- tags: ["glitch", "digital", "distortion"]
8870
- },
8871
- "crt": {
8872
- id: "crt",
8873
- name: "CRT Monitor",
8874
- category: "glitch",
8875
- description: "Old television curve display and phosphor noise",
8876
- defaultParams: { curvature: 1, lineWidth: 1, lineContrast: 0.25, noise: 0.15, vignetting: 0.3, flicker: 0.15, animated: true },
8877
- parameterSchema: {
8878
- curvature: { type: "number", label: "Curvature", min: 0, max: 6, default: 1, step: 0.1 },
8879
- lineWidth: { type: "number", label: "Line Width", min: 0, max: 5, default: 1, step: 0.5 },
8880
- lineContrast: { type: "number", label: "Line Contrast", min: 0, max: 1, default: 0.25, step: 0.05 },
8881
- noise: { type: "number", label: "Noise", min: 0, max: 0.8, default: 0.15, step: 0.05 },
8882
- vignetting: { type: "number", label: "Vignette Size", min: 0, max: 0.8, default: 0.3, step: 0.05 },
8883
- flicker: { type: "number", label: "Flicker", min: 0, max: 0.5, default: 0.15, step: 0.05 }
8884
- },
8885
- tags: ["glitch", "retro", "tv"]
8886
- },
8887
- "film-grain": {
8888
- id: "film-grain",
8889
- name: "Film Grain",
8890
- category: "cinematic",
8891
- description: "Real organic analog movie grain",
8892
- defaultParams: { intensity: 0.25, size: 2, animated: true },
8893
- parameterSchema: {
8894
- intensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.25, step: 0.05 },
8895
- size: { type: "number", label: "Grain Size", min: 0.5, max: 6, default: 2, step: 0.1 }
8896
- },
8897
- tags: ["cinematic", "film", "grain"]
8898
- },
8899
- "tilt-shift": {
8900
- id: "tilt-shift",
8901
- name: "Tilt Shift",
8902
- category: "cinematic",
8903
- description: "Miniature belt blur focus effect",
8904
- defaultParams: { blur: 40, gradientBlur: 300, focusY: 0.5, focusRange: 0.15 },
8905
- parameterSchema: {
8906
- blur: { type: "number", label: "Edge Blur", min: 0, max: 100, default: 40, step: 1 },
8907
- gradientBlur: { type: "number", label: "Gradient Blur", min: 50, max: 800, default: 300, step: 10 },
8908
- focusY: { type: "number", label: "Focus Position", min: 0, max: 1, default: 0.5, step: 0.05 },
8909
- focusRange: { type: "number", label: "Focus Range", min: 0.05, max: 0.4, default: 0.15, step: 0.05 }
8910
- },
8911
- tags: ["cinematic", "blur", "miniature"]
8912
- },
8913
- "cinematic-lut": {
8914
- id: "cinematic-lut",
8915
- name: "Cinematic LUT",
8916
- category: "cinematic",
8917
- description: "Orange and Teal cinematic lookup table filter",
8918
- defaultParams: { lutIntensity: 0.8, brightness: 1, contrast: 1, saturation: 1 },
8919
- parameterSchema: {
8920
- lutIntensity: { type: "number", label: "LUT Intensity", min: 0, max: 1, default: 0.8, step: 0.05 },
8921
- brightness: { type: "number", label: "Brightness", min: 0.5, max: 1.5, default: 1, step: 0.05 },
8922
- contrast: { type: "number", label: "Contrast", min: 0.5, max: 1.5, default: 1, step: 0.05 },
8923
- saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 }
8924
- },
8925
- tags: ["cinematic", "color", "lut"]
8926
- },
8927
- "motion-blur": {
8928
- id: "motion-blur",
8929
- name: "Motion Blur",
8930
- category: "cinematic",
8931
- description: "Speed-based directional camera blur",
8932
- defaultParams: { velocityX: 20, velocityY: 0, kernelSize: 9, offset: 0 },
8933
- parameterSchema: {
8934
- velocityX: { type: "number", label: "Velocity X", min: -80, max: 80, default: 20, step: 1 },
8935
- velocityY: { type: "number", label: "Velocity Y", min: -80, max: 80, default: 0, step: 1 },
8936
- kernelSize: { type: "number", label: "Kernel Size", min: 5, max: 25, default: 9, step: 2 },
8937
- offset: { type: "number", label: "Offset", min: 0, max: 10, default: 0, step: 1 }
8938
- },
8939
- tags: ["cinematic", "blur", "motion"]
8940
- },
8941
- "shockwave": {
8942
- id: "shockwave",
8943
- name: "Shockwave",
8944
- category: "distortion",
8945
- description: "Expanding shockwave wave refraction",
8946
- defaultParams: { centerX: 0.5, centerY: 0.5, speed: 1.5, amplitude: 30, wavelength: 160, brightness: 1, radius: 600, animated: true },
8947
- parameterSchema: {
8948
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
8949
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
8950
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 },
8951
- amplitude: { type: "number", label: "Amplitude", min: 1, max: 100, default: 30, step: 1 },
8952
- wavelength: { type: "number", label: "Wavelength", min: 10, max: 300, default: 160, step: 5 },
8953
- brightness: { type: "number", label: "Brightness", min: 0.5, max: 2, default: 1, step: 0.05 },
8954
- radius: { type: "number", label: "Max Radius", min: 100, max: 1e3, default: 600, step: 10 }
8955
- },
8956
- tags: ["distortion", "ripple", "shockwave"]
8957
- },
8958
- "bulge-pinch": {
8959
- id: "bulge-pinch",
8960
- name: "Bulge Pinch",
8961
- category: "distortion",
8962
- description: "Spherical bulge or pinch warp",
8963
- defaultParams: { centerX: 0.5, centerY: 0.5, radius: 200, strength: 0.5, speed: 1.5, animated: true },
8964
- parameterSchema: {
8965
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
8966
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
8967
- radius: { type: "number", label: "Warp Radius", min: 10, max: 600, default: 200, step: 10 },
8968
- strength: { type: "number", label: "Warp Strength", min: -1, max: 1, default: 0.5, step: 0.05 },
8969
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
8970
- },
8971
- tags: ["distortion", "bulge", "pinch"]
8972
- },
8973
- "twist": {
8974
- id: "twist",
8975
- name: "Twist Twirl",
8976
- category: "distortion",
8977
- description: "Warp frame in a spiral twirl",
8978
- defaultParams: { centerX: 0.5, centerY: 0.5, radius: 300, angle: 4, speed: 1, animated: true },
8979
- parameterSchema: {
8980
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
8981
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
8982
- radius: { type: "number", label: "Twirl Radius", min: 50, max: 800, default: 300, step: 10 },
8983
- angle: { type: "number", label: "Angle", min: -15, max: 15, default: 4, step: 0.5 },
8984
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
8985
- },
8986
- tags: ["distortion", "twist", "twirl"]
8987
- },
8988
- "reflection": {
8989
- id: "reflection",
8990
- name: "Reflection",
8991
- category: "distortion",
8992
- description: "Water mirror ripple reflection",
8993
- defaultParams: { boundary: 0.5, amplitudeStart: 0, amplitudeEnd: 20, wavelengthStart: 30, wavelengthEnd: 100, alphaStart: 1, alphaEnd: 1, speed: 1, mirror: true, animated: true },
8994
- parameterSchema: {
8995
- boundary: { type: "number", label: "Boundary", min: 0.1, max: 0.9, default: 0.5, step: 0.05 },
8996
- amplitudeStart: { type: "number", label: "Amp Start", min: 0, max: 50, default: 0, step: 1 },
8997
- amplitudeEnd: { type: "number", label: "Amp End", min: 0, max: 100, default: 20, step: 1 },
8998
- wavelengthStart: { type: "number", label: "Wavelength Start", min: 10, max: 100, default: 30, step: 5 },
8999
- wavelengthEnd: { type: "number", label: "Wavelength End", min: 10, max: 300, default: 100, step: 5 },
9000
- alphaStart: { type: "number", label: "Alpha Start", min: 0, max: 1, default: 1, step: 0.05 },
9001
- alphaEnd: { type: "number", label: "Alpha End", min: 0, max: 1, default: 1, step: 0.05 },
9002
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
9003
- },
9004
- tags: ["distortion", "reflection", "water"]
9005
- },
9006
- "color-gradient": {
9007
- id: "color-gradient",
9008
- name: "Color Gradient",
9009
- category: "light",
9010
- description: "Overlay a linear or radial multi-stop color gradient.",
9011
- defaultParams: { gradientType: 0, color1: "#7C6FFF", color2: "#0E0E12", alpha: 0.5 },
9012
- parameterSchema: {
9013
- gradientType: { type: "number", label: "Type (0:Lin, 1:Rad)", min: 0, max: 1, default: 0, step: 1 },
9014
- color1: { type: "color", label: "Start Color", default: "#7C6FFF" },
9015
- color2: { type: "color", label: "End Color", default: "#0E0E12" },
9016
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.5, step: 0.05 }
9017
- },
9018
- tags: ["light", "color", "gradient"]
9019
- },
9020
- "color-overlay": {
9021
- id: "color-overlay",
9022
- name: "Color Overlay",
9023
- category: "light",
9024
- description: "Overlay a solid tint color onto the frame.",
9025
- defaultParams: { color: "#7C6FFF", alpha: 0.3 },
9026
- parameterSchema: {
9027
- color: { type: "color", label: "Color", default: "#7C6FFF" },
9028
- alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 0.3, step: 0.05 }
9029
- },
9030
- tags: ["light", "color", "overlay"]
9031
- },
9032
- "color-adjustments": {
9033
- id: "color-adjustments",
9034
- name: "Color Adjustments",
9035
- category: "light",
9036
- description: "Adjust exposure, brightness, contrast, saturation, temperature, tint, sepia, grayscale, hue, invert, and vignette.",
9037
- defaultParams: {
9038
- exposure: 0,
9039
- brightness: 0,
9040
- contrast: 0,
9041
- saturation: 0,
9042
- temperature: 0,
9043
- tint: 0,
9044
- sepia: 0,
9045
- grayscale: 0,
9046
- hueRotate: 0,
9047
- vignette: 0,
9048
- invert: 0,
9049
- blur: 0
9050
- },
9051
- parameterSchema: {
9052
- exposure: { type: "number", label: "Exposure", min: -1, max: 1, default: 0, step: 0.01 },
9053
- brightness: { type: "number", label: "Brightness", min: -1, max: 1, default: 0, step: 0.01 },
9054
- contrast: { type: "number", label: "Contrast", min: -1, max: 1, default: 0, step: 0.01 },
9055
- saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.01 },
9056
- temperature: { type: "number", label: "Temperature", min: -1, max: 1, default: 0, step: 0.01 },
9057
- tint: { type: "number", label: "Tint", min: -1, max: 1, default: 0, step: 0.01 },
9058
- sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0, step: 0.01 },
9059
- grayscale: { type: "number", label: "Grayscale", min: 0, max: 1, default: 0, step: 0.01 },
9060
- hueRotate: { type: "number", label: "Hue Rotate", min: 0, max: 6.28318, default: 0, step: 0.01 },
9061
- vignette: { type: "number", label: "Vignette", min: 0, max: 1, default: 0, step: 0.01 },
9062
- invert: { type: "number", label: "Invert", min: 0, max: 1, default: 0, step: 0.01 },
9063
- blur: { type: "number", label: "Blur", min: 0, max: 15, default: 0, step: 0.5 }
9064
- },
9065
- tags: ["color", "adjustments", "light", "vignette"]
9066
- },
9067
- "hsl-adjustment": {
9068
- id: "hsl-adjustment",
9069
- name: "HSL Adjustment",
9070
- category: "light",
9071
- description: "Adjust hue, saturation, and lightness of the video.",
9072
- defaultParams: { hue: 0, saturation: 0, lightness: 0, colorize: false, alpha: 1 },
9073
- parameterSchema: {
9074
- hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 1 },
9075
- saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.05 },
9076
- lightness: { type: "number", label: "Lightness", min: -1, max: 1, default: 0, step: 0.05 },
9077
- colorize: { type: "boolean", label: "Colorize", default: false },
9078
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
9079
- },
9080
- tags: ["light", "color", "hsl", "hue"]
9081
- },
9082
- "alpha": {
9083
- id: "alpha",
9084
- name: "Opacity (Alpha)",
9085
- category: "light",
9086
- description: "Adjust layer opacity / alpha transparency.",
9087
- defaultParams: { alpha: 1 },
9088
- parameterSchema: {
9089
- alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 1, step: 0.05 }
9090
- },
9091
- tags: ["light", "alpha", "opacity"]
9092
- },
9093
- "color-matrix": {
9094
- id: "color-matrix",
9095
- name: "Color Matrix Presets",
9096
- category: "light",
9097
- description: "Color grading adjustments and retro filter presets.",
9098
- defaultParams: { brightness: 1, contrast: 1, saturation: 1, hue: 0, mode: "none" },
9099
- parameterSchema: {
9100
- brightness: { type: "number", label: "Brightness", min: 0, max: 2, default: 1, step: 0.05 },
9101
- contrast: { type: "number", label: "Contrast", min: 0, max: 2, default: 1, step: 0.05 },
9102
- saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 },
9103
- hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 2 },
9104
- mode: { type: "string", label: "Preset", default: "none" }
9105
- },
9106
- tags: ["light", "color", "presets", "vintage"]
9107
- },
9108
- "neon-glow": {
9109
- id: "neon-glow",
9110
- name: "Neon Glow (Community)",
9111
- category: "light",
9112
- description: "Wrap your visual features in a premium neon glow outline.",
9113
- defaultParams: { distance: 15, innerStrength: 1, outerStrength: 2, color: "#7C6FFF", quality: 0.1, knockout: false },
9114
- parameterSchema: {
9115
- distance: { type: "number", label: "Distance", min: 1, max: 100, default: 15, step: 1 },
9116
- innerStrength: { type: "number", label: "Inner Strength", min: 0, max: 10, default: 1, step: 0.2 },
9117
- outerStrength: { type: "number", label: "Outer Strength", min: 0, max: 10, default: 2, step: 0.2 },
9118
- color: { type: "color", label: "Glow Color", default: "#7C6FFF" },
9119
- quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
9120
- knockout: { type: "boolean", label: "Knockout", default: false }
9121
- },
9122
- tags: ["light", "glow", "neon", "outline"]
9123
- },
9124
- "gaussian-blur": {
9125
- id: "gaussian-blur",
9126
- name: "Gaussian Blur",
9127
- category: "cinematic",
9128
- description: "Classic high-fidelity Gaussian blur filter.",
9129
- defaultParams: { blur: 8, quality: 4 },
9130
- parameterSchema: {
9131
- blur: { type: "number", label: "Blur Strength", min: 0, max: 100, default: 8, step: 0.5 },
9132
- quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
9133
- },
9134
- tags: ["cinematic", "blur", "gaussian"]
9135
- },
9136
- "kawase-blur": {
9137
- id: "kawase-blur",
9138
- name: "Kawase Blur",
9139
- category: "cinematic",
9140
- description: "Fast, high-quality multi-pass Kawase blur.",
9141
- defaultParams: { blur: 8, quality: 4 },
9142
- parameterSchema: {
9143
- blur: { type: "number", label: "Blur Radius", min: 0, max: 100, default: 8, step: 0.5 },
9144
- quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
9145
- },
9146
- tags: ["cinematic", "blur", "kawase"]
9147
- },
9148
- "zoom-blur": {
9149
- id: "zoom-blur",
9150
- name: "Zoom Blur",
9151
- category: "cinematic",
9152
- description: "Radial focal zoom blur emanating from a point.",
9153
- defaultParams: { strength: 0.15, centerX: 0.5, centerY: 0.5, innerRadius: 0, radius: 400 },
9154
- parameterSchema: {
9155
- strength: { type: "number", label: "Blur Strength", min: 0, max: 1, default: 0.15, step: 0.02 },
9156
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
9157
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
9158
- innerRadius: { type: "number", label: "Inner Rad", min: 0, max: 600, default: 0, step: 10 },
9159
- radius: { type: "number", label: "Outer Rad", min: 50, max: 1200, default: 400, step: 10 }
9160
- },
9161
- tags: ["cinematic", "blur", "zoom", "focus"]
9162
- },
9163
- "radial-blur": {
9164
- id: "radial-blur",
9165
- name: "Radial Blur",
9166
- category: "cinematic",
9167
- description: "Radial spin blur around a focal center point.",
9168
- defaultParams: { angle: 10, centerX: 0.5, centerY: 0.5, kernelSize: 9, radius: -1 },
9169
- parameterSchema: {
9170
- angle: { type: "number", label: "Spin Angle", min: -180, max: 180, default: 10, step: 1 },
9171
- centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
9172
- centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
9173
- kernelSize: { type: "number", label: "Kernel Size", min: 3, max: 25, default: 9, step: 2 },
9174
- radius: { type: "number", label: "Max Radius", min: -1, max: 1200, default: -1, step: 10 }
9175
- },
9176
- tags: ["cinematic", "blur", "radial", "spin"]
9177
- },
9178
- "drop-shadow": {
9179
- id: "drop-shadow",
9180
- name: "Drop Shadow",
9181
- category: "cinematic",
9182
- description: "Apply an adjustable drop shadow overlay onto your layer.",
9183
- defaultParams: { blur: 4, alpha: 0.5, offsetX: 4, offsetY: 4, color: "#000000", shadowOnly: false },
9184
- parameterSchema: {
9185
- blur: { type: "number", label: "Shadow Blur", min: 0, max: 50, default: 4, step: 0.5 },
9186
- alpha: { type: "number", label: "Shadow Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
9187
- offsetX: { type: "number", label: "Offset X", min: -100, max: 100, default: 4, step: 1 },
9188
- offsetY: { type: "number", label: "Offset Y", min: -100, max: 100, default: 4, step: 1 },
9189
- color: { type: "color", label: "Shadow Color", default: "#000000" },
9190
- shadowOnly: { type: "boolean", label: "Shadow Only", default: false }
9191
- },
9192
- tags: ["cinematic", "shadow", "drop"]
9193
- },
9194
- "static-noise": {
9195
- id: "static-noise",
9196
- name: "Static Noise",
9197
- category: "glitch",
9198
- description: "Classic static analog noise/grain filter.",
9199
- defaultParams: { noise: 0.15, animated: true },
9200
- parameterSchema: {
9201
- noise: { type: "number", label: "Noise Density", min: 0, max: 1, default: 0.15, step: 0.02 },
9202
- animated: { type: "boolean", label: "Animated Seed", default: true }
9203
- },
9204
- tags: ["glitch", "noise", "grain", "static"]
9205
- },
9206
- "old-film": {
9207
- id: "old-film",
9208
- name: "Old Film",
9209
- category: "cinematic",
9210
- description: "Simulates vintage cinema projector noise, sepia tint, vignette, and scratches.",
9211
- defaultParams: { sepia: 0.3, noise: 0.15, noiseSize: 1, scratchDensity: 0.3, scratchWidth: 1, vignetting: 0.3, vignettingAlpha: 1, vignettingBlur: 0.3 },
9212
- parameterSchema: {
9213
- sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0.3, step: 0.05 },
9214
- noise: { type: "number", label: "Noise", min: 0, max: 1, default: 0.15, step: 0.05 },
9215
- noiseSize: { type: "number", label: "Noise Size", min: 0.2, max: 5, default: 1, step: 0.1 },
9216
- scratchDensity: { type: "number", label: "Scratch Density", min: 0, max: 1, default: 0.3, step: 0.05 },
9217
- scratchWidth: { type: "number", label: "Scratch Width", min: 0.5, max: 6, default: 1, step: 0.2 },
9218
- vignetting: { type: "number", label: "Vignette", min: 0, max: 1, default: 0.3, step: 0.05 },
9219
- vignettingAlpha: { type: "number", label: "Vignette Alpha", min: 0, max: 1, default: 1, step: 0.05 },
9220
- vignettingBlur: { type: "number", label: "Vignette Blur", min: 0, max: 1, default: 0.3, step: 0.05 }
9221
- },
9222
- tags: ["cinematic", "film", "vintage", "retro", "scratches"]
9223
- },
9224
- "displacement": {
9225
- id: "displacement",
9226
- name: "Displacement Map",
9227
- category: "distortion",
9228
- description: "Warp and distort the frame using a procedural noise displacement sprite.",
9229
- defaultParams: { scaleX: 20, scaleY: 20, animated: true, speed: 1 },
9230
- parameterSchema: {
9231
- scaleX: { type: "number", label: "Scale X", min: -200, max: 200, default: 20, step: 1 },
9232
- scaleY: { type: "number", label: "Scale Y", min: -200, max: 200, default: 20, step: 1 },
9233
- animated: { type: "boolean", label: "Flow Motion", default: true },
9234
- speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
9235
- },
9236
- tags: ["distortion", "displacement", "warp", "liquid"]
9237
- },
9238
- "outline": {
9239
- id: "outline",
9240
- name: "Outline Overlay",
9241
- category: "distortion",
9242
- description: "Draws a solid colored outline around the non-transparent boundaries.",
9243
- defaultParams: { thickness: 3, color: "#7C6FFF", quality: 0.1, alpha: 1 },
9244
- parameterSchema: {
9245
- thickness: { type: "number", label: "Thickness", min: 0, max: 20, default: 3, step: 1 },
9246
- color: { type: "color", label: "Color", default: "#7C6FFF" },
9247
- quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
9248
- alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
9249
- },
9250
- tags: ["distortion", "outline", "stroke", "border"]
9251
- },
9252
- "grayscale": {
9253
- id: "grayscale",
9254
- name: "Grayscale",
9255
- category: "cinematic",
9256
- description: "Converts the layer to monochrome black and white.",
9257
- defaultParams: {},
9258
- parameterSchema: {},
9259
- tags: ["cinematic", "grayscale", "monochrome", "bw"]
9260
- },
9261
- "dot": {
9262
- id: "dot",
9263
- name: "Halftone Dots",
9264
- category: "distortion",
9265
- description: "Halftone dot raster pattern, simulating newspaper or comic book prints.",
9266
- defaultParams: { scale: 1, angle: 1, grayscale: true },
9267
- parameterSchema: {
9268
- scale: { type: "number", label: "Dot Scale", min: 0.1, max: 10, default: 1, step: 0.1 },
9269
- angle: { type: "number", label: "Angle", min: 0, max: 6.28, default: 1, step: 0.05 },
9270
- grayscale: { type: "boolean", label: "Grayscale", default: true }
9271
- },
9272
- tags: ["distortion", "dot", "halftone", "comic"]
9273
- },
9274
- "emboss": {
9275
- id: "emboss",
9276
- name: "Emboss Relief",
9277
- category: "distortion",
9278
- description: "Simulates an embossed 3D relief depth on the frame.",
9279
- defaultParams: { strength: 5 },
9280
- parameterSchema: {
9281
- strength: { type: "number", label: "Strength", min: 0, max: 20, default: 5, step: 0.5 }
9282
- },
9283
- tags: ["distortion", "emboss", "relief"]
9284
- },
9285
- "cross-hatch": {
9286
- id: "cross-hatch",
9287
- name: "Cross Hatch Sketch",
9288
- category: "distortion",
9289
- description: "Simulates a crosshatched pencil sketch on paper.",
9290
- defaultParams: {},
9291
- parameterSchema: {},
9292
- tags: ["distortion", "sketch", "drawing", "hatch"]
9293
- },
9294
- "pixelate": {
9295
- id: "pixelate",
9296
- name: "Pixelate Mosaic",
9297
- category: "distortion",
9298
- description: "Pixelate the video frame into large blocky mosaic cells.",
9299
- defaultParams: { sizeX: 10, sizeY: 10 },
9300
- parameterSchema: {
9301
- sizeX: { type: "number", label: "Cell Width", min: 1, max: 200, default: 10, step: 1 },
9302
- sizeY: { type: "number", label: "Cell Height", min: 1, max: 200, default: 10, step: 1 }
9303
- },
9304
- tags: ["distortion", "pixelate", "mosaic", "8bit"]
9305
- },
9306
- "ascii": {
9307
- id: "ascii",
9308
- name: "ASCII Art",
9309
- category: "distortion",
9310
- description: "Converts the video frame into interactive retro matrix ASCII text characters.",
9311
- defaultParams: { size: 8, replaceColor: false },
9312
- parameterSchema: {
9313
- size: { type: "number", label: "Char Size", min: 2, max: 50, default: 8, step: 1 },
9314
- replaceColor: { type: "boolean", label: "Replace Color", default: false }
9315
- },
9316
- tags: ["distortion", "ascii", "text", "terminal"]
9317
- }
9318
- };
9319
- function drawBodySilhouette(ctx, cx, cy, w, h) {
9320
- ctx.beginPath();
9321
- ctx.ellipse(cx, cy - h * 0.22, w * 0.28, w * 0.28, 0, 0, Math.PI * 2);
9322
- ctx.rect(cx - w * 0.08, cy - h * 0.1, w * 0.16, h * 0.06);
9323
- ctx.moveTo(cx - w * 0.5, cy - h * 0.04);
9324
- ctx.quadraticCurveTo(cx - w * 0.4, cy - h * 0.08, cx, cy - h * 0.08);
9325
- ctx.quadraticCurveTo(cx + w * 0.4, cy - h * 0.08, cx + w * 0.5, cy - h * 0.04);
9326
- ctx.lineTo(cx + w * 0.45, cy + h * 0.4);
9327
- ctx.lineTo(cx - w * 0.45, cy + h * 0.4);
9328
- ctx.closePath();
9329
- }
9330
- function imageDataToCanvas(imageData) {
9331
- const canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(imageData.width, imageData.height) : document.createElement("canvas");
9332
- if (canvas instanceof HTMLCanvasElement) {
9333
- canvas.width = imageData.width;
9334
- canvas.height = imageData.height;
9335
- }
9336
- const ctx = canvas.getContext("2d");
9337
- if (ctx) {
9338
- ctx.putImageData(imageData, 0, 0);
9339
- }
9340
- return canvas;
9341
- }
9342
- function pseudoRandom(seed) {
9343
- const x = Math.sin(seed * 12.9898) * 43758.5453;
9344
- return x - Math.floor(x);
9345
- }
9346
- function renderBodyGlow(ctx, params, intensity, time, bodyMask) {
9347
- const canvas = ctx.canvas;
9348
- const glowColor = params.glowColor || "#7C6FFF";
9349
- const glowRadius = (params.glowRadius ?? 20) * intensity * (1 + Math.sin(time * 3) * 0.2);
9350
- const glowIntensity = (params.glowIntensity ?? 0.8) * intensity * 0.18;
9351
- ctx.save();
9352
- ctx.globalCompositeOperation = "screen";
9353
- ctx.shadowColor = glowColor;
9354
- ctx.shadowBlur = glowRadius;
9355
- ctx.fillStyle = glowColor;
9356
- ctx.strokeStyle = glowColor;
9357
- ctx.lineWidth = 2;
9358
- ctx.globalAlpha = glowIntensity;
9359
- if (bodyMask) {
9360
- const maskCanvas = imageDataToCanvas(bodyMask);
9361
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
9362
- } else {
9363
- const cx = canvas.width / 2;
9364
- const cy = canvas.height * 0.5;
9365
- const w = canvas.width * 0.28;
9366
- const h = canvas.height * 0.52;
9367
- drawBodySilhouette(ctx, cx, cy, w, h);
9368
- ctx.fill();
9369
- ctx.stroke();
9370
- }
9371
- ctx.restore();
9372
- }
9373
- function renderBodyOutline(ctx, params, intensity, time, bodyMask) {
9374
- const canvas = ctx.canvas;
9375
- const outlineColor = params.outlineColor || "#00E5FF";
9376
- const pulseWidth = (params.outlineWidth ?? 6) * intensity * (1 + Math.sin(time * 2.5) * 0.15);
9377
- const feather = (params.feather ?? 15) * (1 + Math.sin(time * 2) * 0.15);
9378
- ctx.save();
9379
- ctx.globalCompositeOperation = "screen";
9380
- ctx.globalAlpha = Math.min(1, intensity);
9381
- if (bodyMask) {
9382
- const maskCanvas = imageDataToCanvas(bodyMask);
9383
- const maskCtx = maskCanvas.getContext("2d");
9384
- if (maskCtx) {
9385
- maskCtx.save();
9386
- maskCtx.globalCompositeOperation = "source-in";
9387
- maskCtx.fillStyle = outlineColor;
9388
- maskCtx.fillRect(0, 0, maskCanvas.width, maskCanvas.height);
9389
- maskCtx.restore();
9390
- }
9391
- ctx.filter = `blur(${pulseWidth}px)`;
9392
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
9393
- ctx.filter = "none";
9394
- ctx.drawImage(maskCanvas, -pulseWidth * 0.5, 0, canvas.width, canvas.height);
9395
- ctx.drawImage(maskCanvas, pulseWidth * 0.5, 0, canvas.width, canvas.height);
9396
- ctx.drawImage(maskCanvas, 0, -pulseWidth * 0.5, canvas.width, canvas.height);
9397
- ctx.drawImage(maskCanvas, 0, pulseWidth * 0.5, canvas.width, canvas.height);
9398
- } else {
9399
- ctx.strokeStyle = outlineColor;
9400
- ctx.lineWidth = Math.max(1, pulseWidth);
9401
- ctx.shadowColor = outlineColor;
9402
- ctx.shadowBlur = feather;
9403
- const cx = canvas.width / 2;
9404
- const cy = canvas.height * 0.5;
9405
- const w = canvas.width * 0.28;
9406
- const h = canvas.height * 0.52;
9407
- drawBodySilhouette(ctx, cx, cy, w, h);
9408
- ctx.stroke();
9409
- }
9410
- ctx.restore();
9411
- }
9412
- function renderBodyParticles(ctx, params, intensity, time, bodyMask) {
9413
- const canvas = ctx.canvas;
9414
- const particleColor = params.particleColor || "#FF2A85";
9415
- const count = Math.min(150, (params.particleCount ?? 60) * intensity);
9416
- const size = params.particleSize ?? 3;
9417
- const drift = params.drift ?? 8;
9418
- ctx.save();
9419
- ctx.globalCompositeOperation = "screen";
9420
- ctx.fillStyle = particleColor;
9421
- if (bodyMask) {
9422
- ctx.globalAlpha = Math.min(0.85, 0.25 + intensity * 0.6);
9423
- const seed = Math.floor(time * 24);
9424
- for (let i = 0; i < count; i++) {
9425
- const x = Math.floor(pseudoRandom(seed + i * 37) * canvas.width);
9426
- const y = Math.floor(pseudoRandom(seed + i * 43) * canvas.height);
9427
- const maskIdx = (Math.floor(y * bodyMask.height / canvas.height) * bodyMask.width + Math.floor(x * bodyMask.width / canvas.width)) * 4 + 3;
9428
- if (bodyMask.data[maskIdx] < 64) continue;
9429
- const xDrift = Math.sin((time + i) * 2.1) * drift * intensity;
9430
- const pSize = 1 + pseudoRandom(seed + i * 53) * (size - 1);
9431
- ctx.beginPath();
9432
- ctx.arc(x + xDrift, y - pseudoRandom(seed + i * 59) * 20 * intensity, pSize, 0, Math.PI * 2);
9433
- ctx.fill();
9434
- }
9435
- } else {
9436
- const cx = canvas.width / 2;
9437
- const cy = canvas.height * 0.5;
9438
- const w = canvas.width * 0.28;
9439
- const h = canvas.height * 0.52;
9440
- for (let i = 0; i < count; i++) {
9441
- const angle = i / count * Math.PI * 2;
9442
- const radius = 0.8 + Math.sin(angle * 3) * 0.15;
9443
- const px = cx + Math.cos(angle + time * 0.2) * w * radius;
9444
- const py = cy + Math.sin(angle + time * 0.2) * h * radius;
9445
- const dy = -((time * 25 + i * 4) % 35);
9446
- const dx = Math.sin(time * 1.5 + i * 0.6) * drift;
9447
- ctx.globalAlpha = 0.2 + 0.6 * (0.5 + 0.5 * Math.sin(time * 3 + i));
9448
- ctx.beginPath();
9449
- ctx.arc(px + dx, py + dy, size, 0, Math.PI * 2);
9450
- ctx.fill();
9451
- }
9452
- }
9453
- ctx.restore();
9454
- }
9455
- function renderBodySegmentationGlow(ctx, params, intensity, time, bodyMask) {
9456
- const canvas = ctx.canvas;
9457
- const glowColor = params.glowColor || "#FFD700";
9458
- const glowRadius = (params.glowRadius ?? 25) * intensity;
9459
- ctx.save();
9460
- ctx.globalCompositeOperation = "source-over";
9461
- ctx.shadowColor = glowColor;
9462
- ctx.shadowBlur = glowRadius;
9463
- ctx.fillStyle = glowColor;
9464
- ctx.globalAlpha = 0.12 * intensity;
9465
- if (bodyMask) {
9466
- const maskCanvas = imageDataToCanvas(bodyMask);
9467
- ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
9468
- } else {
9469
- const cx = canvas.width / 2;
9470
- const cy = canvas.height * 0.5;
9471
- const w = canvas.width * 0.28;
9472
- const h = canvas.height * 0.52;
9473
- drawBodySilhouette(ctx, cx, cy, w, h);
9474
- ctx.fill();
9475
- }
9476
- ctx.restore();
9477
- }
9478
- function getEffectMetadata(id) {
9479
- return EFFECTS_REGISTRY[id];
9480
- }
9481
- function getEffectsByCategory(category) {
9482
- return Object.values(EFFECTS_REGISTRY).filter((effect) => effect.category === category);
9483
- }
9484
- function getEffectRenderer(id) {
9485
- const renderers = {
9486
- // Light
9487
- flash: renderFlash,
9488
- flicker: renderFlicker,
9489
- vignette: renderVignette,
9490
- glow: renderGlow,
9491
- light_leak: renderLightLeak,
9492
- light_leak_2: renderLightLeak2,
9493
- fire: renderFire,
9494
- particles: renderParticles,
9495
- dust_particles: renderDustParticles,
9496
- // Body
9497
- body_glow: renderBodyGlow,
9498
- body_outline: renderBodyOutline,
9499
- body_particles: renderBodyParticles,
9500
- "body-segmentation-glow": renderBodySegmentationGlow,
9501
- // Normalized aliases retained for existing saved projects.
9502
- "light-leak": renderLightLeak,
9503
- "lens-flare": renderLightLeak2,
9504
- "lens_flare": renderLightLeak2,
9505
- "rgb-split": (ctx, params, intensity) => {
9506
- const shift = Math.floor(Number(params.redX ?? 4) * intensity);
9507
- if (shift === 0) return;
9508
- ctx.save();
9509
- ctx.globalCompositeOperation = "screen";
9510
- ctx.globalAlpha = 0.4 * intensity;
9511
- ctx.drawImage(ctx.canvas, -shift, 0);
9512
- ctx.drawImage(ctx.canvas, shift, 0);
9513
- ctx.restore();
9514
- },
9515
- "rgb_split": (ctx, params, intensity) => {
9516
- const shift = Math.floor(Number(params.redX ?? 4) * intensity);
9517
- if (shift === 0) return;
9518
- ctx.save();
9519
- ctx.globalCompositeOperation = "screen";
9520
- ctx.globalAlpha = 0.4 * intensity;
9521
- ctx.drawImage(ctx.canvas, -shift, 0);
9522
- ctx.drawImage(ctx.canvas, shift, 0);
9523
- ctx.restore();
9524
- },
9525
- "vhs": (ctx, params, intensity) => {
9526
- const width = ctx.canvas.width;
9527
- const height = ctx.canvas.height;
9528
- ctx.save();
9529
- ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.15})`;
9530
- for (let y = 0; y < height; y += 4) {
9531
- ctx.fillRect(0, y, width, 1.5);
9532
- }
9533
- ctx.restore();
9534
- },
9535
- "glitch-band": (ctx, params, intensity) => {
9536
- const width = ctx.canvas.width;
9537
- const height = ctx.canvas.height;
9538
- const y = Math.floor(Math.random() * height);
9539
- ctx.save();
9540
- ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
9541
- ctx.fillRect(0, y, width, 8);
9542
- ctx.restore();
9543
- },
9544
- "glitch_band": (ctx, params, intensity) => {
9545
- const width = ctx.canvas.width;
9546
- const height = ctx.canvas.height;
9547
- const y = Math.floor(Math.random() * height);
9548
- ctx.save();
9549
- ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
9550
- ctx.fillRect(0, y, width, 8);
9551
- ctx.restore();
9552
- },
9553
- "crt": (ctx, params, intensity) => {
9554
- const width = ctx.canvas.width;
9555
- const height = ctx.canvas.height;
9556
- ctx.save();
9557
- ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.12})`;
9558
- for (let y = 0; y < height; y += 3) {
9559
- ctx.fillRect(0, y, width, 1);
9560
- }
9561
- ctx.restore();
9562
- },
9563
- "film-grain": (ctx, params, intensity) => {
9564
- const width = ctx.canvas.width;
9565
- const height = ctx.canvas.height;
9566
- ctx.save();
9567
- for (let i = 0; i < 120 * intensity; i++) {
9568
- const x = Math.random() * width;
9569
- const y = Math.random() * height;
9570
- const alpha2 = 0.04 + Math.random() * 0.05;
9571
- ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha2})` : `rgba(0, 0, 0, ${alpha2})`;
9572
- ctx.fillRect(x, y, 2, 2);
9573
- }
9574
- ctx.restore();
9575
- },
9576
- "film_grain": (ctx, params, intensity) => {
9577
- const width = ctx.canvas.width;
9578
- const height = ctx.canvas.height;
9579
- ctx.save();
9580
- for (let i = 0; i < 120 * intensity; i++) {
9581
- const x = Math.random() * width;
9582
- const y = Math.random() * height;
9583
- const alpha2 = 0.04 + Math.random() * 0.05;
9584
- ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha2})` : `rgba(0, 0, 0, ${alpha2})`;
9585
- ctx.fillRect(x, y, 2, 2);
9586
- }
9587
- ctx.restore();
9588
- },
9589
- "tilt-shift": (ctx, params, intensity) => {
9590
- ctx.save();
9591
- try {
9592
- ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
9593
- ctx.drawImage(ctx.canvas, 0, 0);
9594
- } catch {
9595
- }
9596
- ctx.restore();
9597
- },
9598
- "tilt_shift": (ctx, params, intensity) => {
9599
- ctx.save();
9600
- try {
9601
- ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
9602
- ctx.drawImage(ctx.canvas, 0, 0);
9603
- } catch {
9604
- }
9605
- ctx.restore();
9606
- },
9607
- "cinematic-lut": (ctx, params, intensity) => {
9608
- const width = ctx.canvas.width;
9609
- const height = ctx.canvas.height;
9610
- ctx.save();
9611
- ctx.globalCompositeOperation = "color";
9612
- ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
9613
- ctx.fillRect(0, 0, width, height);
9614
- ctx.restore();
9615
- },
9616
- "cinematic_lut": (ctx, params, intensity) => {
9617
- const width = ctx.canvas.width;
9618
- const height = ctx.canvas.height;
9619
- ctx.save();
9620
- ctx.globalCompositeOperation = "color";
9621
- ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
9622
- ctx.fillRect(0, 0, width, height);
9623
- ctx.restore();
9624
- },
9625
- "motion-blur": (ctx, params, intensity) => {
9626
- ctx.save();
9627
- ctx.globalAlpha = 0.4 * intensity;
9628
- const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
9629
- const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
9630
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
9631
- ctx.restore();
9632
- },
9633
- "motion_blur": (ctx, params, intensity) => {
9634
- ctx.save();
9635
- ctx.globalAlpha = 0.4 * intensity;
9636
- const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
9637
- const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
9638
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
9639
- ctx.restore();
9640
- },
9641
- "shockwave": (ctx, params, intensity, time) => {
9642
- const width = ctx.canvas.width;
9643
- const height = ctx.canvas.height;
9644
- ctx.save();
9645
- ctx.strokeStyle = `rgba(255, 255, 255, ${intensity * 0.25})`;
9646
- ctx.lineWidth = 6;
9647
- ctx.beginPath();
9648
- ctx.arc(width / 2, height / 2, time * 160 % (width / 2 + 50), 0, Math.PI * 2);
9649
- ctx.stroke();
9650
- ctx.restore();
9651
- },
9652
- "bulge-pinch": (ctx, params, intensity) => {
9653
- const width = ctx.canvas.width;
9654
- const height = ctx.canvas.height;
9655
- ctx.save();
9656
- ctx.translate(width / 2, height / 2);
9657
- const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
9658
- ctx.scale(scale, scale);
9659
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
9660
- ctx.restore();
9661
- },
9662
- "bulge_pinch": (ctx, params, intensity) => {
9663
- const width = ctx.canvas.width;
9664
- const height = ctx.canvas.height;
9665
- ctx.save();
9666
- ctx.translate(width / 2, height / 2);
9667
- const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
9668
- ctx.scale(scale, scale);
9669
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
9670
- ctx.restore();
9671
- },
9672
- "twist": (ctx, params, intensity) => {
9673
- const width = ctx.canvas.width;
9674
- const height = ctx.canvas.height;
9675
- ctx.save();
9676
- ctx.translate(width / 2, height / 2);
9677
- ctx.rotate(Number(params.angle ?? 4) * intensity * 0.02);
9678
- ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
9679
- ctx.restore();
9680
- },
9681
- "reflection": (ctx, params, intensity) => {
9682
- const width = ctx.canvas.width;
9683
- const height = ctx.canvas.height;
9684
- const boundaryY = Number(params.boundary ?? 0.5) * height;
9685
- ctx.save();
9686
- ctx.translate(0, boundaryY * 2);
9687
- ctx.scale(1, -1);
9688
- ctx.globalAlpha = 0.7 * intensity;
9689
- ctx.drawImage(ctx.canvas, 0, boundaryY, width, height - boundaryY, 0, boundaryY, width, height - boundaryY);
9690
- ctx.restore();
9691
- },
9692
- "color-gradient": (ctx, params, intensity) => {
9693
- const width = ctx.canvas.width;
9694
- const height = ctx.canvas.height;
9695
- ctx.save();
9696
- 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);
9697
- grad.addColorStop(0, params.color1 || "#7C6FFF");
9698
- grad.addColorStop(1, params.color2 || "#0E0E12");
9699
- ctx.fillStyle = grad;
9700
- ctx.globalAlpha = Number(params.alpha ?? 0.5) * intensity;
9701
- ctx.fillRect(0, 0, width, height);
9702
- ctx.restore();
9703
- },
9704
- "color-overlay": (ctx, params, intensity) => {
9705
- const width = ctx.canvas.width;
9706
- const height = ctx.canvas.height;
9707
- ctx.save();
9708
- ctx.fillStyle = params.color || "#7C6FFF";
9709
- ctx.globalAlpha = Number(params.alpha ?? 0.3) * intensity;
9710
- ctx.fillRect(0, 0, width, height);
9711
- ctx.restore();
9712
- },
9713
- "color-adjustments": (ctx, params, intensity) => {
9714
- const width = ctx.canvas.width;
9715
- const height = ctx.canvas.height;
9716
- const f = intensity;
9717
- const exp = Number(params.exposure ?? 0) * f;
9718
- const brightnessVal = 1 + Number(params.brightness ?? 0) * f + exp;
9719
- const contrastVal = 1 + Number(params.contrast ?? 0) * f;
9720
- const saturationVal = 1 + Number(params.saturation ?? 0) * f;
9721
- const sepiaVal = Number(params.sepia ?? 0) * f;
9722
- const grayscaleVal = Number(params.grayscale ?? 0) * f;
9723
- const hueVal = Number(params.hueRotate ?? 0) * f;
9724
- const invertVal = Number(params.invert ?? 0) * f;
9725
- const blurVal = Number(params.blur ?? 0) * f;
9726
- const filterParts = [];
9727
- if (brightnessVal !== 1) filterParts.push(`brightness(${brightnessVal})`);
9728
- if (contrastVal !== 1) filterParts.push(`contrast(${contrastVal})`);
9729
- if (saturationVal !== 1) filterParts.push(`saturate(${saturationVal})`);
9730
- if (sepiaVal > 0) filterParts.push(`sepia(${sepiaVal * 100}%)`);
9731
- if (grayscaleVal > 0) filterParts.push(`grayscale(${grayscaleVal * 100}%)`);
9732
- if (hueVal !== 0) filterParts.push(`hue-rotate(${hueVal * 180 / Math.PI}deg)`);
9733
- if (invertVal > 0) filterParts.push(`invert(${invertVal * 100}%)`);
9734
- if (blurVal > 0) filterParts.push(`blur(${blurVal}px)`);
9735
- if (filterParts.length > 0) {
9736
- ctx.save();
9737
- const temp = document.createElement("canvas");
9738
- temp.width = width;
9739
- temp.height = height;
9740
- const tempCtx = temp.getContext("2d");
9741
- if (tempCtx) {
9742
- tempCtx.drawImage(ctx.canvas, 0, 0);
9743
- ctx.clearRect(0, 0, width, height);
9744
- ctx.filter = filterParts.join(" ");
9745
- ctx.drawImage(temp, 0, 0);
9746
- ctx.filter = "none";
9747
- }
9748
- ctx.restore();
9749
- }
9750
- const tempVal = Number(params.temperature ?? 0) * f;
9751
- if (tempVal !== 0) {
9752
- ctx.save();
9753
- ctx.globalCompositeOperation = "soft-light";
9754
- if (tempVal > 0) {
9755
- ctx.fillStyle = `rgba(255, 140, 40, ${tempVal})`;
9756
- } else {
9757
- ctx.fillStyle = `rgba(40, 120, 255, ${-tempVal})`;
9758
- }
9759
- ctx.fillRect(0, 0, width, height);
9760
- ctx.restore();
9761
- }
9762
- const tintVal = Number(params.tint ?? 0) * f;
9763
- if (tintVal !== 0) {
9764
- ctx.save();
9765
- ctx.globalCompositeOperation = "soft-light";
9766
- if (tintVal > 0) {
9767
- ctx.fillStyle = `rgba(255, 40, 180, ${tintVal})`;
9768
- } else {
9769
- ctx.fillStyle = `rgba(40, 255, 100, ${-tintVal})`;
9770
- }
9771
- ctx.fillRect(0, 0, width, height);
9772
- ctx.restore();
9773
- }
9774
- const vignetteVal = Number(params.vignette ?? 0) * f;
9775
- if (vignetteVal > 0) {
9776
- ctx.save();
9777
- ctx.globalCompositeOperation = "multiply";
9778
- const cx = width / 2;
9779
- const cy = height / 2;
9780
- const maxRadius = Math.sqrt(cx * cx + cy * cy);
9781
- const gradient = ctx.createRadialGradient(cx, cy, maxRadius * 0.45, cx, cy, maxRadius * 1);
9782
- gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
9783
- gradient.addColorStop(0.5, `rgba(0, 0, 0, ${vignetteVal * 0.15})`);
9784
- gradient.addColorStop(0.8, `rgba(0, 0, 0, ${vignetteVal * 0.55})`);
9785
- gradient.addColorStop(1, `rgba(0, 0, 0, ${vignetteVal * 0.9})`);
9786
- ctx.fillStyle = gradient;
9787
- ctx.fillRect(0, 0, width, height);
9788
- ctx.restore();
9789
- }
9790
- },
9791
- "hsl-adjustment": (ctx, params, intensity) => {
9792
- if (params.colorize) {
9793
- ctx.save();
9794
- ctx.fillStyle = "rgba(124, 111, 255, 0.2)";
9795
- ctx.globalAlpha = Number(params.alpha ?? 1) * intensity;
9796
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
9797
- ctx.restore();
9798
- }
9799
- },
9800
- "alpha": (ctx, params, intensity) => {
9801
- ctx.save();
9802
- ctx.globalAlpha = 1 - (1 - Number(params.alpha ?? 1)) * intensity;
9803
- ctx.restore();
9804
- },
9805
- "color-matrix": (ctx, params, intensity) => {
9806
- ctx.save();
9807
- ctx.globalCompositeOperation = "color";
9808
- ctx.fillStyle = `rgba(255, 120, 0, ${0.1 * intensity})`;
9809
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
9810
- ctx.restore();
9811
- },
9812
- "neon-glow": (ctx, params, intensity) => {
9813
- ctx.save();
9814
- ctx.shadowBlur = Number(params.distance ?? 15) * intensity;
9815
- ctx.shadowColor = params.color || "#7C6FFF";
9816
- ctx.restore();
9817
- },
9818
- "gaussian-blur": (ctx, params, intensity) => {
9819
- ctx.save();
9820
- try {
9821
- ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
9822
- ctx.drawImage(ctx.canvas, 0, 0);
9823
- } catch {
9824
- }
9825
- ctx.restore();
9826
- },
9827
- "kawase-blur": (ctx, params, intensity) => {
9828
- ctx.save();
9829
- try {
9830
- ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
9831
- ctx.drawImage(ctx.canvas, 0, 0);
9832
- } catch {
9833
- }
9834
- ctx.restore();
9835
- },
9836
- "zoom-blur": (ctx, params, intensity) => {
9837
- ctx.save();
9838
- try {
9839
- ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
9840
- ctx.drawImage(ctx.canvas, 0, 0);
9841
- } catch {
9842
- }
9843
- ctx.restore();
8253
+ // src/videoEffects/effectsRegistry.ts
8254
+ var EFFECTS_REGISTRY = {
8255
+ shockwave: {
8256
+ id: "shockwave",
8257
+ name: "Shockwave",
8258
+ category: "distortion",
8259
+ description: "Expanding shockwave wave refraction",
8260
+ defaultParams: {
8261
+ centerX: 0.5,
8262
+ centerY: 0.5,
8263
+ speed: 1.5,
8264
+ amplitude: 30,
8265
+ wavelength: 160,
8266
+ brightness: 1,
8267
+ radius: 600,
8268
+ animated: true
9844
8269
  },
9845
- "radial-blur": (ctx, params, intensity) => {
9846
- ctx.save();
9847
- try {
9848
- ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
9849
- ctx.drawImage(ctx.canvas, 0, 0);
9850
- } catch {
9851
- }
9852
- ctx.restore();
8270
+ parameterSchema: {
8271
+ centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
8272
+ centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
8273
+ speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 },
8274
+ amplitude: { type: "number", label: "Amplitude", min: 1, max: 100, default: 30, step: 1 },
8275
+ wavelength: { type: "number", label: "Wavelength", min: 10, max: 300, default: 160, step: 5 },
8276
+ brightness: { type: "number", label: "Brightness", min: 0.5, max: 2, default: 1, step: 0.05 },
8277
+ radius: { type: "number", label: "Max Radius", min: 100, max: 1e3, default: 600, step: 10 }
9853
8278
  },
9854
- "drop-shadow": (ctx, params, intensity) => {
9855
- ctx.save();
9856
- ctx.shadowBlur = Number(params.blur ?? 4) * intensity;
9857
- ctx.shadowColor = params.color || "#000000";
9858
- ctx.shadowOffsetX = Number(params.offsetX ?? 4) * intensity;
9859
- ctx.shadowOffsetY = Number(params.offsetY ?? 4) * intensity;
9860
- ctx.restore();
8279
+ tags: ["distortion", "ripple", "shockwave"]
8280
+ },
8281
+ ChromaticAberration: {
8282
+ id: "ChromaticAberration",
8283
+ name: "Chromatic Aberration",
8284
+ category: "glitch",
8285
+ description: "Directional RGB channel displacement with optical edge-feather falloff",
8286
+ defaultParams: {
8287
+ amount: 8,
8288
+ angleDegrees: 0,
8289
+ edgeFeather: 0.5
9861
8290
  },
9862
- "static-noise": (ctx, params, intensity) => {
9863
- const width = ctx.canvas.width;
9864
- const height = ctx.canvas.height;
9865
- ctx.save();
9866
- const density = Number(params.noise ?? 0.15) * intensity;
9867
- for (let i = 0; i < 200 * density; i++) {
9868
- const x = Math.random() * width;
9869
- const y = Math.random() * height;
9870
- ctx.fillStyle = `rgba(255, 255, 255, ${0.1 + Math.random() * 0.15})`;
9871
- ctx.fillRect(x, y, 2, 2);
9872
- }
9873
- ctx.restore();
8291
+ parameterSchema: {
8292
+ amount: { type: "number", label: "Amount (px)", min: 0, max: 50, default: 8, step: 0.5 },
8293
+ angleDegrees: { type: "number", label: "Angle (\xB0)", min: 0, max: 360, default: 0, step: 1 },
8294
+ edgeFeather: { type: "number", label: "Edge Feather", min: 0, max: 1, default: 0.5, step: 0.05 }
9874
8295
  },
9875
- "old-film": (ctx, params, intensity) => {
9876
- const width = ctx.canvas.width;
9877
- const height = ctx.canvas.height;
9878
- ctx.save();
9879
- ctx.globalCompositeOperation = "color";
9880
- ctx.fillStyle = `rgba(139, 69, 19, ${Number(params.sepia ?? 0.3) * intensity})`;
9881
- ctx.fillRect(0, 0, width, height);
9882
- ctx.globalCompositeOperation = "source-over";
9883
- for (let i = 0; i < 50 * intensity; i++) {
9884
- ctx.fillStyle = "rgba(255,255,255,0.06)";
9885
- ctx.fillRect(Math.random() * width, Math.random() * height, 2, 2);
9886
- }
9887
- ctx.restore();
8296
+ tags: ["glitch", "chromatic", "aberration", "color", "distortion", "lens", "optical"]
8297
+ },
8298
+ RgbSplit: {
8299
+ id: "RgbSplit",
8300
+ name: "RGB Split",
8301
+ category: "glitch",
8302
+ description: "Discrete horizontal and vertical color channel separation",
8303
+ defaultParams: {
8304
+ splitX: 8,
8305
+ splitY: 8
9888
8306
  },
9889
- "displacement": (ctx, params, intensity) => {
9890
- ctx.save();
9891
- const shiftX = Number(params.scaleX ?? 20) * intensity * 0.1;
9892
- const shiftY = Number(params.scaleY ?? 20) * intensity * 0.1;
9893
- ctx.drawImage(ctx.canvas, shiftX, shiftY);
9894
- ctx.restore();
8307
+ parameterSchema: {
8308
+ splitX: { type: "number", label: "Split X (px)", min: 0, max: 50, default: 8, step: 0.5 },
8309
+ splitY: { type: "number", label: "Split Y (px)", min: 0, max: 50, default: 8, step: 0.5 }
9895
8310
  },
9896
- "outline": (ctx, params, intensity) => {
9897
- ctx.save();
9898
- ctx.strokeStyle = params.color || "#7C6FFF";
9899
- ctx.lineWidth = Number(params.thickness ?? 3) * intensity;
9900
- ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);
9901
- ctx.restore();
8311
+ tags: ["glitch", "rgb", "split", "color", "shift"]
8312
+ },
8313
+ FilmGrain: {
8314
+ id: "FilmGrain",
8315
+ name: "Film Grain",
8316
+ category: "retro",
8317
+ description: "Procedural cinematic film grain with adjustable size and intensity",
8318
+ defaultParams: {
8319
+ grainIntensity: 0.15,
8320
+ grainSize: 1,
8321
+ grainSeed: 0,
8322
+ animated: true
9902
8323
  },
9903
- "grayscale": (ctx, params, intensity) => {
9904
- ctx.save();
9905
- ctx.globalCompositeOperation = "luminosity";
9906
- ctx.fillStyle = "#ffffff";
9907
- ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
9908
- ctx.restore();
8324
+ parameterSchema: {
8325
+ grainIntensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.15, step: 0.01 },
8326
+ grainSize: { type: "number", label: "Grain Size", min: 0.1, max: 5, default: 1, step: 0.1 },
8327
+ grainSeed: { type: "number", label: "Grain Seed", min: 0, max: 100, default: 0, step: 0.1 },
8328
+ animated: { type: "boolean", label: "Animated", default: true }
9909
8329
  },
9910
- "dot": (ctx, params, intensity) => {
9911
- const width = ctx.canvas.width;
9912
- const height = ctx.canvas.height;
9913
- ctx.save();
9914
- ctx.fillStyle = "rgba(0,0,0,0.15)";
9915
- const step = Math.max(4, Math.floor(10 * Number(params.scale ?? 1)));
9916
- for (let x = 0; x < width; x += step) {
9917
- for (let y = 0; y < height; y += step) {
9918
- ctx.beginPath();
9919
- ctx.arc(x, y, 1.5 * intensity, 0, Math.PI * 2);
9920
- ctx.fill();
9921
- }
9922
- }
9923
- ctx.restore();
8330
+ tags: ["retro", "film", "grain", "noise", "cinematic", "texture"]
8331
+ },
8332
+ Scanlines: {
8333
+ id: "Scanlines",
8334
+ name: "Scanlines",
8335
+ category: "retro",
8336
+ description: "CRT raster scanlines with controllable count and intensity",
8337
+ defaultParams: {
8338
+ scanlineCount: 120,
8339
+ scanlineIntensity: 0.5
9924
8340
  },
9925
- "emboss": (ctx, params, intensity) => {
9926
- ctx.save();
9927
- ctx.globalAlpha = 0.3 * intensity;
9928
- ctx.drawImage(ctx.canvas, 1, 1);
9929
- ctx.restore();
8341
+ parameterSchema: {
8342
+ scanlineCount: { type: "number", label: "Line Count", min: 10, max: 1e3, default: 120, step: 10 },
8343
+ scanlineIntensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.5, step: 0.05 }
9930
8344
  },
9931
- "cross-hatch": (ctx, params, intensity) => {
9932
- const width = ctx.canvas.width;
9933
- const height = ctx.canvas.height;
9934
- ctx.save();
9935
- ctx.strokeStyle = `rgba(0,0,0,${0.15 * intensity})`;
9936
- ctx.lineWidth = 1;
9937
- for (let i = 0; i < width; i += 20) {
9938
- ctx.beginPath();
9939
- ctx.moveTo(i, 0);
9940
- ctx.lineTo(i + height, height);
9941
- ctx.stroke();
9942
- }
9943
- ctx.restore();
8345
+ tags: ["retro", "crt", "scanlines", "tv", "vhs", "analog"]
8346
+ },
8347
+ Pixelate: {
8348
+ id: "Pixelate",
8349
+ name: "Pixelate",
8350
+ category: "retro",
8351
+ description: "Mosaic pixelation with adjustable block size",
8352
+ defaultParams: {
8353
+ pixelSize: 18
9944
8354
  },
9945
- "pixelate": (ctx, params, intensity) => {
9946
- const width = ctx.canvas.width;
9947
- const height = ctx.canvas.height;
9948
- const cellW = Math.max(2, Math.floor(Number(params.sizeX ?? 10) * intensity));
9949
- const cellH = Math.max(2, Math.floor(Number(params.sizeY ?? 10) * intensity));
9950
- ctx.save();
9951
- ctx.imageSmoothingEnabled = false;
9952
- const tempCanvas = document.createElement("canvas");
9953
- tempCanvas.width = Math.max(4, Math.floor(width / cellW));
9954
- tempCanvas.height = Math.max(4, Math.floor(height / cellH));
9955
- const tempCtx = tempCanvas.getContext("2d");
9956
- tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
9957
- ctx.clearRect(0, 0, width, height);
9958
- ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
9959
- ctx.restore();
8355
+ parameterSchema: {
8356
+ pixelSize: { type: "number", label: "Block Size (px)", min: 1, max: 100, default: 18, step: 1 }
9960
8357
  },
9961
- "ascii": (ctx, params, intensity) => {
8358
+ tags: ["retro", "pixelate", "mosaic", "8bit", "censorship"]
8359
+ }
8360
+ };
8361
+ function getEffectMetadata(id) {
8362
+ return EFFECTS_REGISTRY[id];
8363
+ }
8364
+ function getEffectsByCategory(category) {
8365
+ return Object.values(EFFECTS_REGISTRY).filter((effect) => effect.category === category);
8366
+ }
8367
+ function getEffectRenderer(id) {
8368
+ if (id === "shockwave") {
8369
+ return (ctx, _params, intensity, time) => {
9962
8370
  const width = ctx.canvas.width;
9963
8371
  const height = ctx.canvas.height;
9964
- const size = Math.max(4, Math.floor(Number(params.size ?? 8) * intensity));
9965
8372
  ctx.save();
9966
- ctx.imageSmoothingEnabled = false;
9967
- const tempCanvas = document.createElement("canvas");
9968
- tempCanvas.width = Math.max(4, Math.floor(width / size));
9969
- tempCanvas.height = Math.max(4, Math.floor(height / size));
9970
- const tempCtx = tempCanvas.getContext("2d");
9971
- tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
9972
- ctx.clearRect(0, 0, width, height);
9973
- ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
8373
+ ctx.strokeStyle = `rgba(255, 255, 255, ${intensity * 0.25})`;
8374
+ ctx.lineWidth = 6;
8375
+ ctx.beginPath();
8376
+ ctx.arc(width / 2, height / 2, time * 160 % (width / 2 + 50), 0, Math.PI * 2);
8377
+ ctx.stroke();
9974
8378
  ctx.restore();
9975
- }
9976
- };
9977
- return renderers[id] || null;
8379
+ };
8380
+ }
8381
+ return null;
9978
8382
  }
9979
8383
  function searchEffects(query) {
9980
8384
  const lowerQuery = query.toLowerCase();
9981
- 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)));
8385
+ return Object.values(EFFECTS_REGISTRY).filter(
8386
+ (effect) => effect.name.toLowerCase().includes(lowerQuery) || effect.description.toLowerCase().includes(lowerQuery) || effect.tags.some((tag) => tag.toLowerCase().includes(lowerQuery))
8387
+ );
9982
8388
  }
9983
8389
 
9984
8390
  // src/videoEffects/EffectRenderer.ts
@@ -10265,6 +8671,36 @@ var EffectEngine = class {
10265
8671
  }
10266
8672
  };
10267
8673
 
8674
+ // src/videoEffects/utils/colorUtils.ts
8675
+ function hexToRgba(hex, alpha2) {
8676
+ hex = hex.replace("#", "");
8677
+ const r = parseInt(hex.substring(0, 2), 16);
8678
+ const g = parseInt(hex.substring(2, 4), 16);
8679
+ const b = parseInt(hex.substring(4, 6), 16);
8680
+ return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
8681
+ }
8682
+ function rgbaToComponents(rgba) {
8683
+ const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
8684
+ if (!match) {
8685
+ return { r: 0, g: 0, b: 0, a: 1 };
8686
+ }
8687
+ return {
8688
+ r: parseInt(match[1]),
8689
+ g: parseInt(match[2]),
8690
+ b: parseInt(match[3]),
8691
+ a: match[4] ? parseFloat(match[4]) : 1
8692
+ };
8693
+ }
8694
+ function blendColors(color1, color2, ratio) {
8695
+ const c1 = rgbaToComponents(color1);
8696
+ const c2 = rgbaToComponents(color2);
8697
+ const r = Math.round(c1.r * (1 - ratio) + c2.r * ratio);
8698
+ const g = Math.round(c1.g * (1 - ratio) + c2.g * ratio);
8699
+ const b = Math.round(c1.b * (1 - ratio) + c2.b * ratio);
8700
+ const a = c1.a * (1 - ratio) + c2.a * ratio;
8701
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
8702
+ }
8703
+
10268
8704
  // src/videoEffects/utils/canvasUtils.ts
10269
8705
  function addNoise(ctx, amount) {
10270
8706
  const width = ctx.canvas.width;
@@ -10387,59 +8823,6 @@ function generateEffectsManifest() {
10387
8823
  };
10388
8824
  }
10389
8825
 
10390
- // src/videoEffects/renderers/camera/index.ts
10391
- var camera_exports = {};
10392
- __export(camera_exports, {
10393
- renderDolly: () => renderDolly,
10394
- renderPan: () => renderPan,
10395
- renderRotate: () => renderRotate,
10396
- renderShake: () => renderShake,
10397
- renderZoom: () => renderZoom
10398
- });
10399
-
10400
- // src/videoEffects/renderers/camera/shake.ts
10401
- function renderShake(ctx, params, intensity, time) {
10402
- const shakeIntensity = (params.intensity || 50) * intensity;
10403
- const frequency = params.frequency || 10;
10404
- const offsetX = Math.sin(time * frequency) * shakeIntensity;
10405
- const offsetY = Math.cos(time * frequency * 1.3) * shakeIntensity;
10406
- ctx.translate(offsetX, offsetY);
10407
- }
10408
-
10409
- // src/videoEffects/renderers/camera/zoom.ts
10410
- function renderZoom(ctx, params, intensity, time) {
10411
- const scale = 1 + (params.scale || 0.2) * intensity;
10412
- const centerX = params.centerX || 0.5;
10413
- const centerY = params.centerY || 0.5;
10414
- const width = ctx.canvas.width;
10415
- const height = ctx.canvas.height;
10416
- ctx.translate(width * centerX, height * centerY);
10417
- ctx.scale(scale, scale);
10418
- ctx.translate(-width * centerX, -height * centerY);
10419
- }
10420
-
10421
- // src/videoEffects/renderers/camera/pan.ts
10422
- function renderPan(ctx, params, intensity, time) {
10423
- const panX = (params.panX || 0) * intensity;
10424
- const panY = (params.panY || 0) * intensity;
10425
- ctx.translate(panX, panY);
10426
- }
10427
-
10428
- // src/videoEffects/renderers/camera/rotate.ts
10429
- function renderRotate(ctx, params, intensity, time) {
10430
- const angle = (params.angle || 0) * intensity * (Math.PI / 180);
10431
- const width = ctx.canvas.width;
10432
- const height = ctx.canvas.height;
10433
- ctx.translate(width / 2, height / 2);
10434
- ctx.rotate(angle);
10435
- ctx.translate(-width / 2, -height / 2);
10436
- }
10437
-
10438
- // src/videoEffects/renderers/camera/dolly.ts
10439
- function renderDolly(ctx, params, intensity, time) {
10440
- renderZoom(ctx, params, intensity, time);
10441
- }
10442
-
10443
8826
  // src/transitions/TransitionRenderer.ts
10444
8827
  var TransitionRenderer = class {
10445
8828
  /**
@@ -26106,6 +24489,170 @@ function renderEvaluatedSceneToCanvas(scene, ctx, options = {}) {
26106
24489
  scene.nodes.forEach((node) => drawNode(ctx, node, scene.time));
26107
24490
  }
26108
24491
 
24492
+ // src/stickers/stickerScanner.ts
24493
+ var MAX_LOTTIE_BYTES = 300 * 1024;
24494
+ var MAX_ASSET_BYTES = 2 * 1024 * 1024;
24495
+ function scanLottieNodes(node, found = { expressions: 0, remoteUrls: 0 }) {
24496
+ if (Array.isArray(node)) {
24497
+ for (const item of node) {
24498
+ scanLottieNodes(item, found);
24499
+ }
24500
+ } else if (node && typeof node === "object") {
24501
+ if (typeof node.x === "string" && node.x.trim() !== "" && "k" in node) {
24502
+ found.expressions++;
24503
+ }
24504
+ for (const value of Object.values(node)) {
24505
+ scanLottieNodes(value, found);
24506
+ }
24507
+ } else if (typeof node === "string" && /^https?:\/\//i.test(node)) {
24508
+ found.remoteUrls++;
24509
+ }
24510
+ return found;
24511
+ }
24512
+ function inspectLottieJson(jsonOrString) {
24513
+ const errors = [];
24514
+ let json;
24515
+ if (typeof jsonOrString === "string") {
24516
+ try {
24517
+ json = JSON.parse(jsonOrString);
24518
+ } catch (err) {
24519
+ return { valid: false, errors: [`Lottie file is not valid JSON: ${err.message}`] };
24520
+ }
24521
+ } else {
24522
+ json = jsonOrString;
24523
+ }
24524
+ if (!json || typeof json !== "object") {
24525
+ return { valid: false, errors: ["Lottie data must be a JSON object"] };
24526
+ }
24527
+ for (const field of ["v", "fr", "ip", "op", "w", "h", "layers"]) {
24528
+ if (!(field in json)) {
24529
+ errors.push(`Lottie header missing required field "${field}"`);
24530
+ }
24531
+ }
24532
+ const found = scanLottieNodes(json);
24533
+ if (found.expressions > 0) {
24534
+ errors.push(`Lottie contains ${found.expressions} expression(s); expressions are strictly forbidden`);
24535
+ }
24536
+ if (found.remoteUrls > 0) {
24537
+ errors.push(`Lottie references ${found.remoteUrls} remote URL(s); all assets must be embedded`);
24538
+ }
24539
+ const fps = typeof json.fr === "number" && json.fr > 0 ? json.fr : 30;
24540
+ const ip = typeof json.ip === "number" ? json.ip : 0;
24541
+ const op = typeof json.op === "number" ? json.op : ip;
24542
+ const durationMs = Math.round((op - ip) / fps * 1e3);
24543
+ const layerCount = Array.isArray(json.layers) ? json.layers.length : 0;
24544
+ const width = Math.round(Number(json.w || 0));
24545
+ const height = Math.round(Number(json.h || 0));
24546
+ if (width < 16 || width > 2048) {
24547
+ errors.push(`Lottie width ${width} is outside permitted range [16, 2048]`);
24548
+ }
24549
+ if (height < 16 || height > 2048) {
24550
+ errors.push(`Lottie height ${height} is outside permitted range [16, 2048]`);
24551
+ }
24552
+ return {
24553
+ valid: errors.length === 0,
24554
+ errors,
24555
+ dimensions: { width, height },
24556
+ animation: {
24557
+ durationMs: Math.max(1, durationMs),
24558
+ fps,
24559
+ loop: true,
24560
+ lottie: {
24561
+ layerCount,
24562
+ hasExpressions: false
24563
+ }
24564
+ }
24565
+ };
24566
+ }
24567
+ function inspectStickerAsset(data, filenameHint = "") {
24568
+ const errors = [];
24569
+ let u8;
24570
+ if (typeof data === "string") {
24571
+ u8 = new TextEncoder().encode(data);
24572
+ } else if (data instanceof Uint8Array) {
24573
+ u8 = data;
24574
+ } else {
24575
+ u8 = new Uint8Array(data);
24576
+ }
24577
+ const bytes = u8.length;
24578
+ const isPng = u8.length >= 8 && u8[0] === 137 && u8[1] === 80 && u8[2] === 78 && u8[3] === 71 && u8[4] === 13 && u8[5] === 10 && u8[6] === 26 && u8[7] === 10;
24579
+ const isWebp = u8.length >= 12 && u8[0] === 82 && u8[1] === 73 && u8[2] === 70 && u8[3] === 70 && u8[8] === 87 && u8[9] === 69 && u8[10] === 66 && u8[11] === 80;
24580
+ const isJson = !isPng && !isWebp && (filenameHint.toLowerCase().endsWith(".json") || u8[0] === 123);
24581
+ const isSvg = !isPng && !isWebp && !isJson && (filenameHint.toLowerCase().endsWith(".svg") || u8[0] === 60);
24582
+ if (isJson) {
24583
+ if (bytes > MAX_LOTTIE_BYTES) {
24584
+ errors.push(`Lottie file size (${bytes} bytes) exceeds maximum limit of ${MAX_LOTTIE_BYTES} bytes (300 KB)`);
24585
+ }
24586
+ const text = new TextDecoder("utf8").decode(u8);
24587
+ const lottieScan = inspectLottieJson(text);
24588
+ if (!lottieScan.valid) {
24589
+ errors.push(...lottieScan.errors);
24590
+ }
24591
+ return {
24592
+ valid: errors.length === 0,
24593
+ errors,
24594
+ bytes,
24595
+ mime: "application/json",
24596
+ dimensions: lottieScan.dimensions,
24597
+ animation: lottieScan.animation
24598
+ };
24599
+ }
24600
+ if (bytes > MAX_ASSET_BYTES) {
24601
+ errors.push(`Asset file size (${bytes} bytes) exceeds maximum limit of ${MAX_ASSET_BYTES} bytes (2 MB)`);
24602
+ }
24603
+ if (isPng) {
24604
+ let width = 0;
24605
+ let height = 0;
24606
+ if (u8.length >= 24) {
24607
+ const view = new DataView(u8.buffer, u8.byteOffset, u8.byteLength);
24608
+ width = view.getUint32(16);
24609
+ height = view.getUint32(20);
24610
+ }
24611
+ return {
24612
+ valid: errors.length === 0,
24613
+ errors,
24614
+ bytes,
24615
+ mime: "image/png",
24616
+ dimensions: width > 0 && height > 0 ? { width, height } : void 0
24617
+ };
24618
+ }
24619
+ if (isWebp) {
24620
+ return {
24621
+ valid: errors.length === 0,
24622
+ errors,
24623
+ bytes,
24624
+ mime: "image/webp"
24625
+ };
24626
+ }
24627
+ if (isSvg) {
24628
+ return {
24629
+ valid: errors.length === 0,
24630
+ errors,
24631
+ bytes,
24632
+ mime: "image/svg+xml"
24633
+ };
24634
+ }
24635
+ return {
24636
+ valid: false,
24637
+ errors: ["Unsupported file format; allowed formats are Lottie JSON, WebP, PNG, and SVG"],
24638
+ bytes,
24639
+ mime: "application/octet-stream"
24640
+ };
24641
+ }
24642
+ async function calculateSha256(data) {
24643
+ const u8 = typeof data === "string" ? new TextEncoder().encode(data) : data instanceof Uint8Array ? data : new Uint8Array(data);
24644
+ if (typeof crypto !== "undefined" && crypto.subtle) {
24645
+ const hashBuf = await crypto.subtle.digest("SHA-256", u8);
24646
+ return Array.from(new Uint8Array(hashBuf)).map((b) => b.toString(16).padStart(2, "0")).join("");
24647
+ }
24648
+ try {
24649
+ const nodeCrypto = await import("crypto");
24650
+ return nodeCrypto.createHash("sha256").update(u8).digest("hex");
24651
+ } catch {
24652
+ throw new Error("No cryptographic hash implementation available");
24653
+ }
24654
+ }
24655
+
26109
24656
  // src/index.ts
26110
24657
  var VERSION = "1.4.0";
26111
24658
  // Annotate the CommonJS export names for ESM import in node:
@@ -26122,7 +24669,6 @@ var VERSION = "1.4.0";
26122
24669
  CANONICAL_RENDERER_VERSION,
26123
24670
  CANONICAL_SCHEMA_VERSION,
26124
24671
  COMPOSITION_PRESETS,
26125
- CameraEffects,
26126
24672
  CanvasDevice,
26127
24673
  CommandBufferBuilder,
26128
24674
  CommandExecutor,
@@ -26174,8 +24720,9 @@ var VERSION = "1.4.0";
26174
24720
  LOTTIE_TEMPLATE_PRESETS,
26175
24721
  LayerAnimationSchema,
26176
24722
  LayoutEngine,
26177
- LightEffects,
26178
24723
  LiveBroadcastBridge,
24724
+ MAX_ASSET_BYTES,
24725
+ MAX_LOTTIE_BYTES,
26179
24726
  MediaEncoderRegistry,
26180
24727
  MediaImageEngine,
26181
24728
  MetricEngine,
@@ -26265,6 +24812,7 @@ var VERSION = "1.4.0";
26265
24812
  calculateMediaFit,
26266
24813
  calculateResizeBounds,
26267
24814
  calculateRotationAngle,
24815
+ calculateSha256,
26268
24816
  canonicalContentHash,
26269
24817
  canonicalTemplateHash,
26270
24818
  canonicalizeSceneDocument,
@@ -26381,6 +24929,8 @@ var VERSION = "1.4.0";
26381
24929
  injectSolidColor,
26382
24930
  injectText,
26383
24931
  injectTextStyle,
24932
+ inspectLottieJson,
24933
+ inspectStickerAsset,
26384
24934
  interpolateColorString,
26385
24935
  interpolateValue,
26386
24936
  isKeyframed,
@@ -26448,6 +24998,7 @@ var VERSION = "1.4.0";
26448
24998
  runtimeAssetResolver,
26449
24999
  sampleVideoContextAtTime,
26450
25000
  scanLottieFonts,
25001
+ scanLottieNodes,
26451
25002
  scanTextLayers,
26452
25003
  sceneToConfig,
26453
25004
  searchEffects,