@clypra-studio/engine 0.1.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/LICENSE +9 -0
- package/README.md +677 -0
- package/dist/chunk-5JOAEDIQ.js +446 -0
- package/dist/chunk-5JOAEDIQ.js.map +1 -0
- package/dist/chunk-CJRH4PAV.js +2826 -0
- package/dist/chunk-CJRH4PAV.js.map +1 -0
- package/dist/chunk-EVQAI3P3.js +3725 -0
- package/dist/chunk-EVQAI3P3.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-QMRMNH52.js +811 -0
- package/dist/chunk-QMRMNH52.js.map +1 -0
- package/dist/index-BWo6qV_z.d.cts +139 -0
- package/dist/index-BWo6qV_z.d.ts +139 -0
- package/dist/index-lNWEWqab.d.cts +633 -0
- package/dist/index-lNWEWqab.d.ts +633 -0
- package/dist/index.cjs +21232 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +12254 -0
- package/dist/index.d.ts +12254 -0
- package/dist/index.js +13320 -0
- package/dist/index.js.map +1 -0
- package/dist/textEffects/index.cjs +3341 -0
- package/dist/textEffects/index.cjs.map +1 -0
- package/dist/textEffects/index.d.cts +1 -0
- package/dist/textEffects/index.d.ts +1 -0
- package/dist/textEffects/index.js +30 -0
- package/dist/textEffects/index.js.map +1 -0
- package/dist/transitions/index.cjs +848 -0
- package/dist/transitions/index.cjs.map +1 -0
- package/dist/transitions/index.d.cts +170 -0
- package/dist/transitions/index.d.ts +170 -0
- package/dist/transitions/index.js +32 -0
- package/dist/transitions/index.js.map +1 -0
- package/dist/v2/backends/index.cjs +480 -0
- package/dist/v2/backends/index.cjs.map +1 -0
- package/dist/v2/backends/index.d.cts +3 -0
- package/dist/v2/backends/index.d.ts +3 -0
- package/dist/v2/backends/index.js +8 -0
- package/dist/v2/backends/index.js.map +1 -0
- package/dist/v2/contract/index.cjs +18 -0
- package/dist/v2/contract/index.cjs.map +1 -0
- package/dist/v2/contract/index.d.cts +165 -0
- package/dist/v2/contract/index.d.ts +165 -0
- package/dist/v2/contract/index.js +1 -0
- package/dist/v2/contract/index.js.map +1 -0
- package/dist/videoEffects/index.cjs +2883 -0
- package/dist/videoEffects/index.cjs.map +1 -0
- package/dist/videoEffects/index.d.cts +801 -0
- package/dist/videoEffects/index.d.ts +801 -0
- package/dist/videoEffects/index.js +68 -0
- package/dist/videoEffects/index.js.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,2883 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
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
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/videoEffects/index.ts
|
|
30
|
+
var videoEffects_exports = {};
|
|
31
|
+
__export(videoEffects_exports, {
|
|
32
|
+
CameraEffects: () => camera_exports,
|
|
33
|
+
EFFECTS_REGISTRY: () => EFFECTS_REGISTRY,
|
|
34
|
+
EffectEngine: () => EffectEngine,
|
|
35
|
+
EffectGraph: () => EffectGraph,
|
|
36
|
+
EffectRenderer: () => EffectRenderer,
|
|
37
|
+
ExamplePixiEffects: () => example_exports,
|
|
38
|
+
LightEffects: () => light_exports,
|
|
39
|
+
PixiRenderer: () => PixiRenderer,
|
|
40
|
+
addNoise: () => addNoise,
|
|
41
|
+
blendColors: () => blendColors,
|
|
42
|
+
clearCanvas: () => clearCanvas,
|
|
43
|
+
effectMetadataToApi: () => effectMetadataToApi,
|
|
44
|
+
generateEffectsManifest: () => generateEffectsManifest,
|
|
45
|
+
getAllEffectsForApi: () => getAllEffectsForApi,
|
|
46
|
+
getEffectByIdForApi: () => getEffectByIdForApi,
|
|
47
|
+
getEffectCategoriesSummary: () => getEffectCategoriesSummary,
|
|
48
|
+
getEffectMetadata: () => getEffectMetadata,
|
|
49
|
+
getEffectPreviewUrl: () => getEffectPreviewUrl,
|
|
50
|
+
getEffectRenderer: () => getEffectRenderer,
|
|
51
|
+
getEffectsByCategory: () => getEffectsByCategory,
|
|
52
|
+
getEffectsByCategoryForApi: () => getEffectsByCategoryForApi,
|
|
53
|
+
hexToRgba: () => hexToRgba,
|
|
54
|
+
isCanvas2DEffect: () => isCanvas2DEffect,
|
|
55
|
+
isCompositeEffect: () => isCompositeEffect,
|
|
56
|
+
isFilterEffect: () => isFilterEffect,
|
|
57
|
+
isMotionEffect: () => isMotionEffect,
|
|
58
|
+
isPixiEffect: () => isPixiEffect,
|
|
59
|
+
rgbaToComponents: () => rgbaToComponents,
|
|
60
|
+
searchEffects: () => searchEffects,
|
|
61
|
+
searchEffectsForApi: () => searchEffectsForApi,
|
|
62
|
+
withContext: () => withContext
|
|
63
|
+
});
|
|
64
|
+
module.exports = __toCommonJS(videoEffects_exports);
|
|
65
|
+
|
|
66
|
+
// src/videoEffects/renderers/light/index.ts
|
|
67
|
+
var light_exports = {};
|
|
68
|
+
__export(light_exports, {
|
|
69
|
+
renderDustParticles: () => renderDustParticles,
|
|
70
|
+
renderFire: () => renderFire,
|
|
71
|
+
renderFlash: () => renderFlash,
|
|
72
|
+
renderFlicker: () => renderFlicker,
|
|
73
|
+
renderGlow: () => renderGlow,
|
|
74
|
+
renderLightLeak: () => renderLightLeak,
|
|
75
|
+
renderLightLeak2: () => renderLightLeak2,
|
|
76
|
+
renderParticles: () => renderParticles,
|
|
77
|
+
renderVignette: () => renderVignette
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// src/videoEffects/renderers/light/lightLeak.ts
|
|
81
|
+
function renderLightLeak(ctx, params, intensity, time) {
|
|
82
|
+
const width = ctx.canvas.width;
|
|
83
|
+
const height = ctx.canvas.height;
|
|
84
|
+
const gradient = ctx.createLinearGradient(0, 0, width, height);
|
|
85
|
+
gradient.addColorStop(0, `rgba(255, 200, 100, ${intensity * 0.3})`);
|
|
86
|
+
gradient.addColorStop(1, "rgba(255, 200, 100, 0)");
|
|
87
|
+
ctx.globalCompositeOperation = "screen";
|
|
88
|
+
ctx.fillStyle = gradient;
|
|
89
|
+
ctx.fillRect(0, 0, width, height);
|
|
90
|
+
ctx.globalCompositeOperation = "source-over";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/videoEffects/utils/colorUtils.ts
|
|
94
|
+
function hexToRgba(hex, alpha) {
|
|
95
|
+
hex = hex.replace("#", "");
|
|
96
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
97
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
98
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
99
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
100
|
+
}
|
|
101
|
+
function rgbaToComponents(rgba) {
|
|
102
|
+
const match = rgba.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
|
|
103
|
+
if (!match) {
|
|
104
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
r: parseInt(match[1]),
|
|
108
|
+
g: parseInt(match[2]),
|
|
109
|
+
b: parseInt(match[3]),
|
|
110
|
+
a: match[4] ? parseFloat(match[4]) : 1
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function blendColors(color1, color2, ratio) {
|
|
114
|
+
const c1 = rgbaToComponents(color1);
|
|
115
|
+
const c2 = rgbaToComponents(color2);
|
|
116
|
+
const r = Math.round(c1.r * (1 - ratio) + c2.r * ratio);
|
|
117
|
+
const g = Math.round(c1.g * (1 - ratio) + c2.g * ratio);
|
|
118
|
+
const b = Math.round(c1.b * (1 - ratio) + c2.b * ratio);
|
|
119
|
+
const a = c1.a * (1 - ratio) + c2.a * ratio;
|
|
120
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/videoEffects/renderers/light/lightLeak2.ts
|
|
124
|
+
function renderLightLeak2(ctx, params, intensity, time) {
|
|
125
|
+
const width = ctx.canvas.width;
|
|
126
|
+
const height = ctx.canvas.height;
|
|
127
|
+
const duration = params.duration || 3;
|
|
128
|
+
const progress = time % duration / duration;
|
|
129
|
+
let x, y;
|
|
130
|
+
let fadeMultiplier = 1;
|
|
131
|
+
if (progress < 0.4) {
|
|
132
|
+
const phase1Progress = progress / 0.4;
|
|
133
|
+
x = width * phase1Progress;
|
|
134
|
+
y = height;
|
|
135
|
+
} else if (progress < 0.8) {
|
|
136
|
+
const phase2Progress = (progress - 0.4) / 0.4;
|
|
137
|
+
x = width;
|
|
138
|
+
y = height * (1 - phase2Progress);
|
|
139
|
+
} else {
|
|
140
|
+
const phase3Progress = (progress - 0.8) / 0.2;
|
|
141
|
+
x = width;
|
|
142
|
+
y = 0;
|
|
143
|
+
fadeMultiplier = 1 - phase3Progress;
|
|
144
|
+
}
|
|
145
|
+
const leakSize = Math.min(width, height) * (params.size || 0.8);
|
|
146
|
+
const gradient = ctx.createRadialGradient(x, y, 0, x, y, leakSize);
|
|
147
|
+
const color1 = params.color1 || "#FF6B35";
|
|
148
|
+
const color2 = params.color2 || "#FF8C42";
|
|
149
|
+
const color3 = params.color3 || "#FFA500";
|
|
150
|
+
const alpha = intensity * fadeMultiplier;
|
|
151
|
+
gradient.addColorStop(0, hexToRgba(color1, alpha * 0.9));
|
|
152
|
+
gradient.addColorStop(0.2, hexToRgba(color2, alpha * 0.7));
|
|
153
|
+
gradient.addColorStop(0.5, hexToRgba(color3, alpha * 0.4));
|
|
154
|
+
gradient.addColorStop(0.8, hexToRgba(color3, alpha * 0.1));
|
|
155
|
+
gradient.addColorStop(1, "rgba(255, 165, 0, 0)");
|
|
156
|
+
ctx.globalCompositeOperation = "screen";
|
|
157
|
+
ctx.fillStyle = gradient;
|
|
158
|
+
ctx.fillRect(0, 0, width, height);
|
|
159
|
+
ctx.globalCompositeOperation = "source-over";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/videoEffects/renderers/light/flash.ts
|
|
163
|
+
function renderFlash(ctx, params, intensity, time) {
|
|
164
|
+
const flashColor = params.flashColor || "#ffffff";
|
|
165
|
+
const flashIntensity = (params.flashIntensity || 1) * intensity;
|
|
166
|
+
ctx.globalCompositeOperation = "screen";
|
|
167
|
+
ctx.fillStyle = flashColor;
|
|
168
|
+
ctx.globalAlpha = flashIntensity;
|
|
169
|
+
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
170
|
+
ctx.globalAlpha = 1;
|
|
171
|
+
ctx.globalCompositeOperation = "source-over";
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/videoEffects/renderers/light/flicker.ts
|
|
175
|
+
function renderFlicker(ctx, params, intensity, time) {
|
|
176
|
+
const flickerAmount = Math.random() * intensity;
|
|
177
|
+
ctx.globalAlpha = 1 - flickerAmount * 0.5;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/videoEffects/renderers/light/vignette.ts
|
|
181
|
+
function renderVignette(ctx, params, intensity, time) {
|
|
182
|
+
const width = ctx.canvas.width;
|
|
183
|
+
const height = ctx.canvas.height;
|
|
184
|
+
const radius = params.radius || 0.7;
|
|
185
|
+
const gradient = ctx.createRadialGradient(width / 2, height / 2, Math.min(width, height) * radius, width / 2, height / 2, Math.max(width, height));
|
|
186
|
+
gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
|
|
187
|
+
gradient.addColorStop(1, `rgba(0, 0, 0, ${intensity * 0.7})`);
|
|
188
|
+
ctx.fillStyle = gradient;
|
|
189
|
+
ctx.fillRect(0, 0, width, height);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/videoEffects/renderers/light/glow.ts
|
|
193
|
+
function renderGlow(ctx, params, intensity, time) {
|
|
194
|
+
const glowAmount = (params.glowAmount || 10) * intensity;
|
|
195
|
+
ctx.shadowBlur = glowAmount;
|
|
196
|
+
ctx.shadowColor = params.glowColor || "#ffffff";
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/videoEffects/renderers/light/fire.ts
|
|
200
|
+
function renderFire(ctx, params, intensity, time) {
|
|
201
|
+
const width = ctx.canvas.width;
|
|
202
|
+
const height = ctx.canvas.height;
|
|
203
|
+
const fireHeight = (params.fireHeight ?? 0.4) * height;
|
|
204
|
+
const particleCount = Math.floor((params.particleCount ?? 50) * intensity);
|
|
205
|
+
const fireColor1 = params.fireColor1 ?? "#FF4500";
|
|
206
|
+
const fireColor2 = params.fireColor2 ?? "#FFA500";
|
|
207
|
+
const fireColor3 = params.fireColor3 ?? "#FFD700";
|
|
208
|
+
const gradient = ctx.createLinearGradient(0, height, 0, height - fireHeight);
|
|
209
|
+
gradient.addColorStop(0, fireColor1);
|
|
210
|
+
gradient.addColorStop(0.5, fireColor2);
|
|
211
|
+
gradient.addColorStop(1, fireColor3);
|
|
212
|
+
ctx.globalAlpha = 0.6 * intensity;
|
|
213
|
+
ctx.fillStyle = gradient;
|
|
214
|
+
ctx.beginPath();
|
|
215
|
+
ctx.moveTo(0, height);
|
|
216
|
+
const waveCount = 8;
|
|
217
|
+
const waveAmplitude = 40;
|
|
218
|
+
const waveSpeed = time * 3;
|
|
219
|
+
for (let i = 0; i <= width; i += width / 100) {
|
|
220
|
+
const waveOffset = Math.sin(i / width * waveCount + waveSpeed) * waveAmplitude;
|
|
221
|
+
ctx.lineTo(i, height - fireHeight + waveOffset);
|
|
222
|
+
}
|
|
223
|
+
ctx.lineTo(width, height);
|
|
224
|
+
ctx.closePath();
|
|
225
|
+
ctx.fill();
|
|
226
|
+
ctx.globalAlpha = 0.8 * intensity;
|
|
227
|
+
for (let i = 0; i < particleCount; i++) {
|
|
228
|
+
const x = (Math.sin(time * 2 + i * 0.5) * 0.5 + 0.5) * width;
|
|
229
|
+
const particleProgress = (time * 0.5 + i * 0.1) % 1;
|
|
230
|
+
const y = height - particleProgress * fireHeight * 1.2;
|
|
231
|
+
const size = (1 - particleProgress) * 8 * intensity;
|
|
232
|
+
const alpha = (1 - particleProgress) * intensity;
|
|
233
|
+
ctx.globalAlpha = alpha;
|
|
234
|
+
ctx.fillStyle = i % 3 === 0 ? fireColor1 : i % 3 === 1 ? fireColor2 : fireColor3;
|
|
235
|
+
ctx.beginPath();
|
|
236
|
+
ctx.arc(x, y, size, 0, Math.PI * 2);
|
|
237
|
+
ctx.fill();
|
|
238
|
+
}
|
|
239
|
+
ctx.globalAlpha = 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// src/videoEffects/renderers/light/particles.ts
|
|
243
|
+
function renderParticles(ctx, params, intensity, time) {
|
|
244
|
+
const width = ctx.canvas.width;
|
|
245
|
+
const height = ctx.canvas.height;
|
|
246
|
+
const particleCount = Math.floor((params.particleCount ?? 100) * intensity);
|
|
247
|
+
const particleSize = (params.particleSize ?? 3) * intensity;
|
|
248
|
+
const particleColor = params.particleColor ?? "#FFFFFF";
|
|
249
|
+
const driftSpeed = params.driftSpeed ?? 1;
|
|
250
|
+
const fadeEffect = params.fadeEffect ?? true;
|
|
251
|
+
ctx.globalCompositeOperation = "screen";
|
|
252
|
+
for (let i = 0; i < particleCount; i++) {
|
|
253
|
+
const seed = i * 0.1;
|
|
254
|
+
const x = (Math.sin(time * driftSpeed * 0.5 + seed) * 0.5 + 0.5) * width;
|
|
255
|
+
const y = (time * driftSpeed * 20 + i * 15) % (height + 100) - 50;
|
|
256
|
+
const sizeVariation = Math.sin(time * 2 + seed) * 0.3 + 0.7;
|
|
257
|
+
const size = particleSize * sizeVariation;
|
|
258
|
+
let alpha = intensity * 0.8;
|
|
259
|
+
if (fadeEffect) {
|
|
260
|
+
if (y < 100) {
|
|
261
|
+
alpha *= y / 100;
|
|
262
|
+
} else if (y > height - 100) {
|
|
263
|
+
alpha *= (height - y) / 100;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
ctx.globalAlpha = Math.max(0, alpha);
|
|
267
|
+
ctx.fillStyle = particleColor;
|
|
268
|
+
ctx.beginPath();
|
|
269
|
+
ctx.arc(x, y, size, 0, Math.PI * 2);
|
|
270
|
+
ctx.fill();
|
|
271
|
+
}
|
|
272
|
+
ctx.globalAlpha = 1;
|
|
273
|
+
ctx.globalCompositeOperation = "source-over";
|
|
274
|
+
}
|
|
275
|
+
function renderDustParticles(ctx, params, intensity, time) {
|
|
276
|
+
const width = ctx.canvas.width;
|
|
277
|
+
const height = ctx.canvas.height;
|
|
278
|
+
const particleCount = Math.floor((params.particleCount ?? 60) * intensity);
|
|
279
|
+
const particleSize = (params.particleSize ?? 2) * intensity;
|
|
280
|
+
const particleColor = params.particleColor ?? "#E0E0E0";
|
|
281
|
+
ctx.globalCompositeOperation = "screen";
|
|
282
|
+
ctx.globalAlpha = 0.3 * intensity;
|
|
283
|
+
for (let i = 0; i < particleCount; i++) {
|
|
284
|
+
const seed = i * 0.05;
|
|
285
|
+
const x = (Math.sin(time * 0.2 + seed) * 0.5 + 0.5) * width;
|
|
286
|
+
const y = (Math.cos(time * 0.15 + seed * 2) * 0.5 + 0.5) * height;
|
|
287
|
+
const sizePulse = Math.sin(time + seed * 3) * 0.2 + 0.8;
|
|
288
|
+
const size = particleSize * sizePulse;
|
|
289
|
+
const alphaVariation = Math.sin(time * 0.5 + seed * 5) * 0.3 + 0.7;
|
|
290
|
+
ctx.globalAlpha = 0.2 * intensity * alphaVariation;
|
|
291
|
+
ctx.fillStyle = particleColor;
|
|
292
|
+
ctx.beginPath();
|
|
293
|
+
ctx.arc(x, y, size, 0, Math.PI * 2);
|
|
294
|
+
ctx.fill();
|
|
295
|
+
}
|
|
296
|
+
ctx.globalAlpha = 1;
|
|
297
|
+
ctx.globalCompositeOperation = "source-over";
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// src/videoEffects/effectsRegistry.ts
|
|
301
|
+
var EFFECTS_REGISTRY = {
|
|
302
|
+
// ==================== LIGHT EFFECTS ====================
|
|
303
|
+
light_leak: {
|
|
304
|
+
id: "light_leak",
|
|
305
|
+
name: "Light Leak",
|
|
306
|
+
category: "light",
|
|
307
|
+
description: "Classic light leak effect",
|
|
308
|
+
defaultParams: {},
|
|
309
|
+
parameterSchema: {},
|
|
310
|
+
tags: ["light", "vintage", "film"]
|
|
311
|
+
},
|
|
312
|
+
light_leak_2: {
|
|
313
|
+
id: "light_leak_2",
|
|
314
|
+
name: "Leak 2",
|
|
315
|
+
category: "light",
|
|
316
|
+
description: "Animated red/orange light moving across the frame",
|
|
317
|
+
defaultParams: {
|
|
318
|
+
duration: 3,
|
|
319
|
+
size: 0.8,
|
|
320
|
+
color1: "#FF6B35",
|
|
321
|
+
color2: "#FF8C42",
|
|
322
|
+
color3: "#FFA500"
|
|
323
|
+
},
|
|
324
|
+
parameterSchema: {
|
|
325
|
+
duration: {
|
|
326
|
+
type: "number",
|
|
327
|
+
label: "Duration",
|
|
328
|
+
min: 1,
|
|
329
|
+
max: 10,
|
|
330
|
+
default: 3,
|
|
331
|
+
step: 0.5
|
|
332
|
+
},
|
|
333
|
+
size: {
|
|
334
|
+
type: "number",
|
|
335
|
+
label: "Size",
|
|
336
|
+
min: 0.1,
|
|
337
|
+
max: 1.5,
|
|
338
|
+
default: 0.8,
|
|
339
|
+
step: 0.1
|
|
340
|
+
},
|
|
341
|
+
color1: {
|
|
342
|
+
type: "color",
|
|
343
|
+
label: "Primary Color",
|
|
344
|
+
default: "#FF6B35"
|
|
345
|
+
},
|
|
346
|
+
color2: {
|
|
347
|
+
type: "color",
|
|
348
|
+
label: "Secondary Color",
|
|
349
|
+
default: "#FF8C42"
|
|
350
|
+
},
|
|
351
|
+
color3: {
|
|
352
|
+
type: "color",
|
|
353
|
+
label: "Tertiary Color",
|
|
354
|
+
default: "#FFA500"
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
tags: ["light", "animated", "cinematic", "warm"]
|
|
358
|
+
},
|
|
359
|
+
flash: {
|
|
360
|
+
id: "flash",
|
|
361
|
+
name: "Flash",
|
|
362
|
+
category: "light",
|
|
363
|
+
description: "Bright flash effect",
|
|
364
|
+
defaultParams: { flashColor: "#ffffff", flashIntensity: 1 },
|
|
365
|
+
parameterSchema: {
|
|
366
|
+
flashColor: {
|
|
367
|
+
type: "color",
|
|
368
|
+
label: "Flash Color",
|
|
369
|
+
default: "#ffffff"
|
|
370
|
+
},
|
|
371
|
+
flashIntensity: {
|
|
372
|
+
type: "number",
|
|
373
|
+
label: "Intensity",
|
|
374
|
+
min: 0,
|
|
375
|
+
max: 1,
|
|
376
|
+
default: 1,
|
|
377
|
+
step: 0.1
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
tags: ["light", "bright", "instant"]
|
|
381
|
+
},
|
|
382
|
+
flicker: {
|
|
383
|
+
id: "flicker",
|
|
384
|
+
name: "Flicker",
|
|
385
|
+
category: "light",
|
|
386
|
+
description: "Random light flickering effect",
|
|
387
|
+
defaultParams: {},
|
|
388
|
+
parameterSchema: {},
|
|
389
|
+
tags: ["light", "flicker", "dynamic"]
|
|
390
|
+
},
|
|
391
|
+
vignette: {
|
|
392
|
+
id: "vignette",
|
|
393
|
+
name: "Vignette",
|
|
394
|
+
category: "light",
|
|
395
|
+
description: "Darkens the edges of the frame",
|
|
396
|
+
defaultParams: { radius: 0.7 },
|
|
397
|
+
parameterSchema: {
|
|
398
|
+
radius: {
|
|
399
|
+
type: "number",
|
|
400
|
+
label: "Radius",
|
|
401
|
+
min: 0.1,
|
|
402
|
+
max: 1,
|
|
403
|
+
default: 0.7,
|
|
404
|
+
step: 0.05
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
tags: ["light", "vintage", "cinematic"]
|
|
408
|
+
},
|
|
409
|
+
glow: {
|
|
410
|
+
id: "glow",
|
|
411
|
+
name: "Glow",
|
|
412
|
+
category: "light",
|
|
413
|
+
description: "Adds a glow effect",
|
|
414
|
+
defaultParams: { glowAmount: 10, glowColor: "#ffffff" },
|
|
415
|
+
parameterSchema: {
|
|
416
|
+
glowAmount: {
|
|
417
|
+
type: "number",
|
|
418
|
+
label: "Amount",
|
|
419
|
+
min: 0,
|
|
420
|
+
max: 50,
|
|
421
|
+
default: 10,
|
|
422
|
+
step: 1
|
|
423
|
+
},
|
|
424
|
+
glowColor: {
|
|
425
|
+
type: "color",
|
|
426
|
+
label: "Color",
|
|
427
|
+
default: "#ffffff"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
tags: ["light", "soft", "dreamy"]
|
|
431
|
+
},
|
|
432
|
+
fire: {
|
|
433
|
+
id: "fire",
|
|
434
|
+
name: "Fire",
|
|
435
|
+
category: "light",
|
|
436
|
+
description: "Animated fire effect with particles",
|
|
437
|
+
defaultParams: {
|
|
438
|
+
fireHeight: 0.4,
|
|
439
|
+
particleCount: 50,
|
|
440
|
+
fireColor1: "#FF4500",
|
|
441
|
+
fireColor2: "#FFA500",
|
|
442
|
+
fireColor3: "#FFD700"
|
|
443
|
+
},
|
|
444
|
+
parameterSchema: {
|
|
445
|
+
fireHeight: {
|
|
446
|
+
type: "number",
|
|
447
|
+
label: "Fire Height",
|
|
448
|
+
min: 0.1,
|
|
449
|
+
max: 0.8,
|
|
450
|
+
default: 0.4,
|
|
451
|
+
step: 0.05
|
|
452
|
+
},
|
|
453
|
+
particleCount: {
|
|
454
|
+
type: "number",
|
|
455
|
+
label: "Particle Count",
|
|
456
|
+
min: 10,
|
|
457
|
+
max: 100,
|
|
458
|
+
default: 50,
|
|
459
|
+
step: 5
|
|
460
|
+
},
|
|
461
|
+
fireColor1: {
|
|
462
|
+
type: "color",
|
|
463
|
+
label: "Base Color",
|
|
464
|
+
default: "#FF4500"
|
|
465
|
+
},
|
|
466
|
+
fireColor2: {
|
|
467
|
+
type: "color",
|
|
468
|
+
label: "Mid Color",
|
|
469
|
+
default: "#FFA500"
|
|
470
|
+
},
|
|
471
|
+
fireColor3: {
|
|
472
|
+
type: "color",
|
|
473
|
+
label: "Top Color",
|
|
474
|
+
default: "#FFD700"
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
tags: ["light", "animated", "fire", "particles"]
|
|
478
|
+
},
|
|
479
|
+
particles: {
|
|
480
|
+
id: "particles",
|
|
481
|
+
name: "Particles",
|
|
482
|
+
category: "light",
|
|
483
|
+
description: "Floating particle effect",
|
|
484
|
+
defaultParams: {
|
|
485
|
+
particleCount: 100,
|
|
486
|
+
particleSize: 3,
|
|
487
|
+
particleColor: "#FFFFFF",
|
|
488
|
+
driftSpeed: 1,
|
|
489
|
+
fadeEffect: true
|
|
490
|
+
},
|
|
491
|
+
parameterSchema: {
|
|
492
|
+
particleCount: {
|
|
493
|
+
type: "number",
|
|
494
|
+
label: "Particle Count",
|
|
495
|
+
min: 20,
|
|
496
|
+
max: 200,
|
|
497
|
+
default: 100,
|
|
498
|
+
step: 10
|
|
499
|
+
},
|
|
500
|
+
particleSize: {
|
|
501
|
+
type: "number",
|
|
502
|
+
label: "Particle Size",
|
|
503
|
+
min: 1,
|
|
504
|
+
max: 10,
|
|
505
|
+
default: 3,
|
|
506
|
+
step: 0.5
|
|
507
|
+
},
|
|
508
|
+
particleColor: {
|
|
509
|
+
type: "color",
|
|
510
|
+
label: "Color",
|
|
511
|
+
default: "#FFFFFF"
|
|
512
|
+
},
|
|
513
|
+
driftSpeed: {
|
|
514
|
+
type: "number",
|
|
515
|
+
label: "Drift Speed",
|
|
516
|
+
min: 0.1,
|
|
517
|
+
max: 3,
|
|
518
|
+
default: 1,
|
|
519
|
+
step: 0.1
|
|
520
|
+
},
|
|
521
|
+
fadeEffect: {
|
|
522
|
+
type: "boolean",
|
|
523
|
+
label: "Fade at Edges",
|
|
524
|
+
default: true
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
tags: ["light", "animated", "particles", "floating"]
|
|
528
|
+
},
|
|
529
|
+
dust_particles: {
|
|
530
|
+
id: "dust_particles",
|
|
531
|
+
name: "Dust Particles",
|
|
532
|
+
category: "light",
|
|
533
|
+
description: "Slow drifting dust particles",
|
|
534
|
+
defaultParams: {
|
|
535
|
+
particleCount: 60,
|
|
536
|
+
particleSize: 2,
|
|
537
|
+
particleColor: "#E0E0E0"
|
|
538
|
+
},
|
|
539
|
+
parameterSchema: {
|
|
540
|
+
particleCount: {
|
|
541
|
+
type: "number",
|
|
542
|
+
label: "Particle Count",
|
|
543
|
+
min: 20,
|
|
544
|
+
max: 150,
|
|
545
|
+
default: 60,
|
|
546
|
+
step: 10
|
|
547
|
+
},
|
|
548
|
+
particleSize: {
|
|
549
|
+
type: "number",
|
|
550
|
+
label: "Particle Size",
|
|
551
|
+
min: 1,
|
|
552
|
+
max: 5,
|
|
553
|
+
default: 2,
|
|
554
|
+
step: 0.5
|
|
555
|
+
},
|
|
556
|
+
particleColor: {
|
|
557
|
+
type: "color",
|
|
558
|
+
label: "Color",
|
|
559
|
+
default: "#E0E0E0"
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
tags: ["light", "particles", "dust", "subtle"]
|
|
563
|
+
},
|
|
564
|
+
// ==================== BODY EFFECTS ====================
|
|
565
|
+
body_glow: {
|
|
566
|
+
id: "body_glow",
|
|
567
|
+
name: "Body Glow",
|
|
568
|
+
category: "body",
|
|
569
|
+
description: "Adds a soft neon glow around the body silhouette",
|
|
570
|
+
defaultParams: { glowColor: "#7C6FFF", glowRadius: 20, glowIntensity: 0.8 },
|
|
571
|
+
parameterSchema: {
|
|
572
|
+
glowColor: { type: "color", label: "Glow Color", default: "#7C6FFF" },
|
|
573
|
+
glowRadius: { type: "number", label: "Glow Radius", min: 5, max: 50, default: 20, step: 1 },
|
|
574
|
+
glowIntensity: { type: "number", label: "Glow Intensity", min: 0.1, max: 1, default: 0.8, step: 0.05 }
|
|
575
|
+
},
|
|
576
|
+
tags: ["body", "neon", "glow"]
|
|
577
|
+
},
|
|
578
|
+
body_outline: {
|
|
579
|
+
id: "body_outline",
|
|
580
|
+
name: "Body Outline",
|
|
581
|
+
category: "body",
|
|
582
|
+
description: "Traces the outline of the body with a glowing line",
|
|
583
|
+
defaultParams: { outlineColor: "#00E5FF", outlineWidth: 6, feather: 15 },
|
|
584
|
+
parameterSchema: {
|
|
585
|
+
outlineColor: { type: "color", label: "Outline Color", default: "#00E5FF" },
|
|
586
|
+
outlineWidth: { type: "number", label: "Outline Width", min: 2, max: 20, default: 6, step: 1 },
|
|
587
|
+
feather: { type: "number", label: "Feather", min: 0, max: 30, default: 15, step: 1 }
|
|
588
|
+
},
|
|
589
|
+
tags: ["body", "outline", "glowing"]
|
|
590
|
+
},
|
|
591
|
+
body_particles: {
|
|
592
|
+
id: "body_particles",
|
|
593
|
+
name: "Body Particles",
|
|
594
|
+
category: "body",
|
|
595
|
+
description: "Emits floating particles tracing the body shape",
|
|
596
|
+
defaultParams: { particleColor: "#FF2A85", particleCount: 60, particleSize: 3, drift: 8 },
|
|
597
|
+
parameterSchema: {
|
|
598
|
+
particleColor: { type: "color", label: "Particle Color", default: "#FF2A85" },
|
|
599
|
+
particleCount: { type: "number", label: "Particle Count", min: 10, max: 150, default: 60, step: 5 },
|
|
600
|
+
particleSize: { type: "number", label: "Particle Size", min: 1, max: 8, default: 3, step: 0.5 },
|
|
601
|
+
drift: { type: "number", label: "Drift", min: 2, max: 20, default: 8, step: 1 }
|
|
602
|
+
},
|
|
603
|
+
tags: ["body", "particles", "floating"]
|
|
604
|
+
},
|
|
605
|
+
"body-segmentation-glow": {
|
|
606
|
+
id: "body-segmentation-glow",
|
|
607
|
+
name: "Segmentation Glow",
|
|
608
|
+
category: "body",
|
|
609
|
+
description: "Glow overlay matching body segmentation mask",
|
|
610
|
+
defaultParams: { glowColor: "#FFD700", glowRadius: 25 },
|
|
611
|
+
parameterSchema: {
|
|
612
|
+
glowColor: { type: "color", label: "Color", default: "#FFD700" },
|
|
613
|
+
glowRadius: { type: "number", label: "Radius", min: 5, max: 50, default: 25, step: 1 }
|
|
614
|
+
},
|
|
615
|
+
tags: ["body", "segmentation", "glow"]
|
|
616
|
+
},
|
|
617
|
+
// PixiJS Video Filter Effects (Unified Registry Metadata)
|
|
618
|
+
"light-leak": {
|
|
619
|
+
id: "light-leak",
|
|
620
|
+
name: "Light Leak",
|
|
621
|
+
category: "light",
|
|
622
|
+
description: "Classic cinematic light sweep across the frame",
|
|
623
|
+
defaultParams: { gain: 0.6, lacunarity: 2.5, alpha: 0.8, angle: 30, speed: 1, animated: true },
|
|
624
|
+
parameterSchema: {
|
|
625
|
+
gain: { type: "number", label: "Gain", min: 0, max: 1, default: 0.6, step: 0.05 },
|
|
626
|
+
lacunarity: { type: "number", label: "Lacunarity", min: 0, max: 5, default: 2.5, step: 0.1 },
|
|
627
|
+
alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.8, step: 0.05 },
|
|
628
|
+
angle: { type: "number", label: "Angle", min: -180, max: 180, default: 30, step: 5 },
|
|
629
|
+
speed: { type: "number", label: "Speed", min: 0, max: 5, default: 1, step: 0.1 }
|
|
630
|
+
},
|
|
631
|
+
tags: ["light", "vintage", "film"]
|
|
632
|
+
},
|
|
633
|
+
"lens-flare": {
|
|
634
|
+
id: "lens-flare",
|
|
635
|
+
name: "Lens Flare",
|
|
636
|
+
category: "light",
|
|
637
|
+
description: "Double-stage lens flare: Godray filter coupled with an animated GPU starburst shader.",
|
|
638
|
+
defaultParams: { godrayGain: 0.4, godrayAlpha: 0.5, flareIntensity: 0.8, flareColor: "#7C6FFF", speed: 1, animated: true },
|
|
639
|
+
parameterSchema: {
|
|
640
|
+
godrayGain: { type: "number", label: "Rays Gain", min: 0, max: 1, default: 0.4, step: 0.05 },
|
|
641
|
+
godrayAlpha: { type: "number", label: "Rays Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
642
|
+
flareIntensity: { type: "number", label: "Intensity", min: 0, max: 3, default: 0.8, step: 0.05 },
|
|
643
|
+
flareColor: { type: "color", label: "Color", default: "#7C6FFF" },
|
|
644
|
+
speed: { type: "number", label: "Speed", min: 0, max: 4, default: 1, step: 0.1 }
|
|
645
|
+
},
|
|
646
|
+
tags: ["light", "flare", "cinematic"]
|
|
647
|
+
},
|
|
648
|
+
"rgb-split": {
|
|
649
|
+
id: "rgb-split",
|
|
650
|
+
name: "RGB Split",
|
|
651
|
+
category: "glitch",
|
|
652
|
+
description: "Split red, green, and blue channels",
|
|
653
|
+
defaultParams: { redX: 4, redY: 0, blueX: -4, blueY: 0, greenX: 0, greenY: 0, speed: 1.5, animated: true },
|
|
654
|
+
parameterSchema: {
|
|
655
|
+
redX: { type: "number", label: "Red X", min: -50, max: 50, default: 4, step: 0.5 },
|
|
656
|
+
redY: { type: "number", label: "Red Y", min: -50, max: 50, default: 0, step: 0.5 },
|
|
657
|
+
blueX: { type: "number", label: "Blue X", min: -50, max: 50, default: -4, step: 0.5 },
|
|
658
|
+
blueY: { type: "number", label: "Blue Y", min: -50, max: 50, default: 0, step: 0.5 },
|
|
659
|
+
greenX: { type: "number", label: "Green X", min: -50, max: 50, default: 0, step: 0.5 },
|
|
660
|
+
greenY: { type: "number", label: "Green Y", min: -50, max: 50, default: 0, step: 0.5 },
|
|
661
|
+
speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
|
|
662
|
+
},
|
|
663
|
+
tags: ["glitch", "rgb", "chromatic"]
|
|
664
|
+
},
|
|
665
|
+
"vhs": {
|
|
666
|
+
id: "vhs",
|
|
667
|
+
name: "VHS",
|
|
668
|
+
category: "glitch",
|
|
669
|
+
description: "Vintage tape tracking lines and phosphor noise",
|
|
670
|
+
defaultParams: { noise: 0.08, scanlines: true, lineAlpha: 0.25, hShift: 3e-3, bandSpeed: 1.2, bandAlpha: 0.35 },
|
|
671
|
+
parameterSchema: {
|
|
672
|
+
noise: { type: "number", label: "Noise", min: 0, max: 0.3, default: 0.08, step: 0.01 },
|
|
673
|
+
scanlines: { type: "boolean", label: "Scanlines", default: true },
|
|
674
|
+
lineAlpha: { type: "number", label: "Line Alpha", min: 0, max: 1, default: 0.25, step: 0.05 },
|
|
675
|
+
hShift: { type: "number", label: "H-Shift", min: 0, max: 0.02, default: 3e-3, step: 1e-3 },
|
|
676
|
+
bandSpeed: { type: "number", label: "Band Speed", min: 0.1, max: 5, default: 1.2, step: 0.1 },
|
|
677
|
+
bandAlpha: { type: "number", label: "Band Alpha", min: 0, max: 1, default: 0.35, step: 0.05 }
|
|
678
|
+
},
|
|
679
|
+
tags: ["glitch", "retro", "vhs", "tape"]
|
|
680
|
+
},
|
|
681
|
+
"glitch-band": {
|
|
682
|
+
id: "glitch-band",
|
|
683
|
+
name: "Glitch Band",
|
|
684
|
+
category: "glitch",
|
|
685
|
+
description: "Digital glitch slices running dynamically",
|
|
686
|
+
defaultParams: { slices: 15, offset: 80, direction: 0, redX: -3, redY: 0, blueX: 3, blueY: 0, animated: true },
|
|
687
|
+
parameterSchema: {
|
|
688
|
+
slices: { type: "number", label: "Slices", min: 2, max: 80, default: 15, step: 1 },
|
|
689
|
+
offset: { type: "number", label: "Offset", min: 0, max: 400, default: 80, step: 5 },
|
|
690
|
+
direction: { type: "number", label: "Direction", min: 0, max: 360, default: 0, step: 5 },
|
|
691
|
+
redX: { type: "number", label: "Red X", min: -20, max: 20, default: -3, step: 1 },
|
|
692
|
+
redY: { type: "number", label: "Red Y", min: -20, max: 20, default: 0, step: 1 },
|
|
693
|
+
blueX: { type: "number", label: "Blue X", min: -20, max: 20, default: 3, step: 1 },
|
|
694
|
+
blueY: { type: "number", label: "Blue Y", min: -20, max: 20, default: 0, step: 1 }
|
|
695
|
+
},
|
|
696
|
+
tags: ["glitch", "digital", "distortion"]
|
|
697
|
+
},
|
|
698
|
+
"crt": {
|
|
699
|
+
id: "crt",
|
|
700
|
+
name: "CRT Monitor",
|
|
701
|
+
category: "glitch",
|
|
702
|
+
description: "Old television curve display and phosphor noise",
|
|
703
|
+
defaultParams: { curvature: 1, lineWidth: 1, lineContrast: 0.25, noise: 0.15, vignetting: 0.3, flicker: 0.15, animated: true },
|
|
704
|
+
parameterSchema: {
|
|
705
|
+
curvature: { type: "number", label: "Curvature", min: 0, max: 6, default: 1, step: 0.1 },
|
|
706
|
+
lineWidth: { type: "number", label: "Line Width", min: 0, max: 5, default: 1, step: 0.5 },
|
|
707
|
+
lineContrast: { type: "number", label: "Line Contrast", min: 0, max: 1, default: 0.25, step: 0.05 },
|
|
708
|
+
noise: { type: "number", label: "Noise", min: 0, max: 0.8, default: 0.15, step: 0.05 },
|
|
709
|
+
vignetting: { type: "number", label: "Vignette Size", min: 0, max: 0.8, default: 0.3, step: 0.05 },
|
|
710
|
+
flicker: { type: "number", label: "Flicker", min: 0, max: 0.5, default: 0.15, step: 0.05 }
|
|
711
|
+
},
|
|
712
|
+
tags: ["glitch", "retro", "tv"]
|
|
713
|
+
},
|
|
714
|
+
"film-grain": {
|
|
715
|
+
id: "film-grain",
|
|
716
|
+
name: "Film Grain",
|
|
717
|
+
category: "cinematic",
|
|
718
|
+
description: "Real organic analog movie grain",
|
|
719
|
+
defaultParams: { intensity: 0.25, size: 2, animated: true },
|
|
720
|
+
parameterSchema: {
|
|
721
|
+
intensity: { type: "number", label: "Intensity", min: 0, max: 1, default: 0.25, step: 0.05 },
|
|
722
|
+
size: { type: "number", label: "Grain Size", min: 0.5, max: 6, default: 2, step: 0.1 }
|
|
723
|
+
},
|
|
724
|
+
tags: ["cinematic", "film", "grain"]
|
|
725
|
+
},
|
|
726
|
+
"tilt-shift": {
|
|
727
|
+
id: "tilt-shift",
|
|
728
|
+
name: "Tilt Shift",
|
|
729
|
+
category: "cinematic",
|
|
730
|
+
description: "Miniature belt blur focus effect",
|
|
731
|
+
defaultParams: { blur: 40, gradientBlur: 300, focusY: 0.5, focusRange: 0.15 },
|
|
732
|
+
parameterSchema: {
|
|
733
|
+
blur: { type: "number", label: "Edge Blur", min: 0, max: 100, default: 40, step: 1 },
|
|
734
|
+
gradientBlur: { type: "number", label: "Gradient Blur", min: 50, max: 800, default: 300, step: 10 },
|
|
735
|
+
focusY: { type: "number", label: "Focus Position", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
736
|
+
focusRange: { type: "number", label: "Focus Range", min: 0.05, max: 0.4, default: 0.15, step: 0.05 }
|
|
737
|
+
},
|
|
738
|
+
tags: ["cinematic", "blur", "miniature"]
|
|
739
|
+
},
|
|
740
|
+
"cinematic-lut": {
|
|
741
|
+
id: "cinematic-lut",
|
|
742
|
+
name: "Cinematic LUT",
|
|
743
|
+
category: "cinematic",
|
|
744
|
+
description: "Orange and Teal cinematic lookup table filter",
|
|
745
|
+
defaultParams: { lutIntensity: 0.8, brightness: 1, contrast: 1, saturation: 1 },
|
|
746
|
+
parameterSchema: {
|
|
747
|
+
lutIntensity: { type: "number", label: "LUT Intensity", min: 0, max: 1, default: 0.8, step: 0.05 },
|
|
748
|
+
brightness: { type: "number", label: "Brightness", min: 0.5, max: 1.5, default: 1, step: 0.05 },
|
|
749
|
+
contrast: { type: "number", label: "Contrast", min: 0.5, max: 1.5, default: 1, step: 0.05 },
|
|
750
|
+
saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 }
|
|
751
|
+
},
|
|
752
|
+
tags: ["cinematic", "color", "lut"]
|
|
753
|
+
},
|
|
754
|
+
"motion-blur": {
|
|
755
|
+
id: "motion-blur",
|
|
756
|
+
name: "Motion Blur",
|
|
757
|
+
category: "cinematic",
|
|
758
|
+
description: "Speed-based directional camera blur",
|
|
759
|
+
defaultParams: { velocityX: 20, velocityY: 0, kernelSize: 9, offset: 0 },
|
|
760
|
+
parameterSchema: {
|
|
761
|
+
velocityX: { type: "number", label: "Velocity X", min: -80, max: 80, default: 20, step: 1 },
|
|
762
|
+
velocityY: { type: "number", label: "Velocity Y", min: -80, max: 80, default: 0, step: 1 },
|
|
763
|
+
kernelSize: { type: "number", label: "Kernel Size", min: 5, max: 25, default: 9, step: 2 },
|
|
764
|
+
offset: { type: "number", label: "Offset", min: 0, max: 10, default: 0, step: 1 }
|
|
765
|
+
},
|
|
766
|
+
tags: ["cinematic", "blur", "motion"]
|
|
767
|
+
},
|
|
768
|
+
"shockwave": {
|
|
769
|
+
id: "shockwave",
|
|
770
|
+
name: "Shockwave",
|
|
771
|
+
category: "distortion",
|
|
772
|
+
description: "Expanding shockwave wave refraction",
|
|
773
|
+
defaultParams: { centerX: 0.5, centerY: 0.5, speed: 1.5, amplitude: 30, wavelength: 160, brightness: 1, radius: 600, animated: true },
|
|
774
|
+
parameterSchema: {
|
|
775
|
+
centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
776
|
+
centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
777
|
+
speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 },
|
|
778
|
+
amplitude: { type: "number", label: "Amplitude", min: 1, max: 100, default: 30, step: 1 },
|
|
779
|
+
wavelength: { type: "number", label: "Wavelength", min: 10, max: 300, default: 160, step: 5 },
|
|
780
|
+
brightness: { type: "number", label: "Brightness", min: 0.5, max: 2, default: 1, step: 0.05 },
|
|
781
|
+
radius: { type: "number", label: "Max Radius", min: 100, max: 1e3, default: 600, step: 10 }
|
|
782
|
+
},
|
|
783
|
+
tags: ["distortion", "ripple", "shockwave"]
|
|
784
|
+
},
|
|
785
|
+
"bulge-pinch": {
|
|
786
|
+
id: "bulge-pinch",
|
|
787
|
+
name: "Bulge Pinch",
|
|
788
|
+
category: "distortion",
|
|
789
|
+
description: "Spherical bulge or pinch warp",
|
|
790
|
+
defaultParams: { centerX: 0.5, centerY: 0.5, radius: 200, strength: 0.5, speed: 1.5, animated: true },
|
|
791
|
+
parameterSchema: {
|
|
792
|
+
centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
793
|
+
centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
794
|
+
radius: { type: "number", label: "Warp Radius", min: 10, max: 600, default: 200, step: 10 },
|
|
795
|
+
strength: { type: "number", label: "Warp Strength", min: -1, max: 1, default: 0.5, step: 0.05 },
|
|
796
|
+
speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1.5, step: 0.1 }
|
|
797
|
+
},
|
|
798
|
+
tags: ["distortion", "bulge", "pinch"]
|
|
799
|
+
},
|
|
800
|
+
"twist": {
|
|
801
|
+
id: "twist",
|
|
802
|
+
name: "Twist Twirl",
|
|
803
|
+
category: "distortion",
|
|
804
|
+
description: "Warp frame in a spiral twirl",
|
|
805
|
+
defaultParams: { centerX: 0.5, centerY: 0.5, radius: 300, angle: 4, speed: 1, animated: true },
|
|
806
|
+
parameterSchema: {
|
|
807
|
+
centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
808
|
+
centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
809
|
+
radius: { type: "number", label: "Twirl Radius", min: 50, max: 800, default: 300, step: 10 },
|
|
810
|
+
angle: { type: "number", label: "Angle", min: -15, max: 15, default: 4, step: 0.5 },
|
|
811
|
+
speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
|
|
812
|
+
},
|
|
813
|
+
tags: ["distortion", "twist", "twirl"]
|
|
814
|
+
},
|
|
815
|
+
"reflection": {
|
|
816
|
+
id: "reflection",
|
|
817
|
+
name: "Reflection",
|
|
818
|
+
category: "distortion",
|
|
819
|
+
description: "Water mirror ripple reflection",
|
|
820
|
+
defaultParams: { boundary: 0.5, amplitudeStart: 0, amplitudeEnd: 20, wavelengthStart: 30, wavelengthEnd: 100, alphaStart: 1, alphaEnd: 1, speed: 1, mirror: true, animated: true },
|
|
821
|
+
parameterSchema: {
|
|
822
|
+
boundary: { type: "number", label: "Boundary", min: 0.1, max: 0.9, default: 0.5, step: 0.05 },
|
|
823
|
+
amplitudeStart: { type: "number", label: "Amp Start", min: 0, max: 50, default: 0, step: 1 },
|
|
824
|
+
amplitudeEnd: { type: "number", label: "Amp End", min: 0, max: 100, default: 20, step: 1 },
|
|
825
|
+
wavelengthStart: { type: "number", label: "Wavelength Start", min: 10, max: 100, default: 30, step: 5 },
|
|
826
|
+
wavelengthEnd: { type: "number", label: "Wavelength End", min: 10, max: 300, default: 100, step: 5 },
|
|
827
|
+
alphaStart: { type: "number", label: "Alpha Start", min: 0, max: 1, default: 1, step: 0.05 },
|
|
828
|
+
alphaEnd: { type: "number", label: "Alpha End", min: 0, max: 1, default: 1, step: 0.05 },
|
|
829
|
+
speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
|
|
830
|
+
},
|
|
831
|
+
tags: ["distortion", "reflection", "water"]
|
|
832
|
+
},
|
|
833
|
+
"color-gradient": {
|
|
834
|
+
id: "color-gradient",
|
|
835
|
+
name: "Color Gradient",
|
|
836
|
+
category: "light",
|
|
837
|
+
description: "Overlay a linear or radial multi-stop color gradient.",
|
|
838
|
+
defaultParams: { gradientType: 0, color1: "#7C6FFF", color2: "#0E0E12", alpha: 0.5 },
|
|
839
|
+
parameterSchema: {
|
|
840
|
+
gradientType: { type: "number", label: "Type (0:Lin, 1:Rad)", min: 0, max: 1, default: 0, step: 1 },
|
|
841
|
+
color1: { type: "color", label: "Start Color", default: "#7C6FFF" },
|
|
842
|
+
color2: { type: "color", label: "End Color", default: "#0E0E12" },
|
|
843
|
+
alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 0.5, step: 0.05 }
|
|
844
|
+
},
|
|
845
|
+
tags: ["light", "color", "gradient"]
|
|
846
|
+
},
|
|
847
|
+
"color-overlay": {
|
|
848
|
+
id: "color-overlay",
|
|
849
|
+
name: "Color Overlay",
|
|
850
|
+
category: "light",
|
|
851
|
+
description: "Overlay a solid tint color onto the frame.",
|
|
852
|
+
defaultParams: { color: "#7C6FFF", alpha: 0.3 },
|
|
853
|
+
parameterSchema: {
|
|
854
|
+
color: { type: "color", label: "Color", default: "#7C6FFF" },
|
|
855
|
+
alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 0.3, step: 0.05 }
|
|
856
|
+
},
|
|
857
|
+
tags: ["light", "color", "overlay"]
|
|
858
|
+
},
|
|
859
|
+
"color-adjustments": {
|
|
860
|
+
id: "color-adjustments",
|
|
861
|
+
name: "Color Adjustments",
|
|
862
|
+
category: "light",
|
|
863
|
+
description: "Adjust exposure, brightness, contrast, saturation, temperature, tint, sepia, grayscale, hue, invert, and vignette.",
|
|
864
|
+
defaultParams: {
|
|
865
|
+
exposure: 0,
|
|
866
|
+
brightness: 0,
|
|
867
|
+
contrast: 0,
|
|
868
|
+
saturation: 0,
|
|
869
|
+
temperature: 0,
|
|
870
|
+
tint: 0,
|
|
871
|
+
sepia: 0,
|
|
872
|
+
grayscale: 0,
|
|
873
|
+
hueRotate: 0,
|
|
874
|
+
vignette: 0,
|
|
875
|
+
invert: 0,
|
|
876
|
+
blur: 0
|
|
877
|
+
},
|
|
878
|
+
parameterSchema: {
|
|
879
|
+
exposure: { type: "number", label: "Exposure", min: -1, max: 1, default: 0, step: 0.01 },
|
|
880
|
+
brightness: { type: "number", label: "Brightness", min: -1, max: 1, default: 0, step: 0.01 },
|
|
881
|
+
contrast: { type: "number", label: "Contrast", min: -1, max: 1, default: 0, step: 0.01 },
|
|
882
|
+
saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.01 },
|
|
883
|
+
temperature: { type: "number", label: "Temperature", min: -1, max: 1, default: 0, step: 0.01 },
|
|
884
|
+
tint: { type: "number", label: "Tint", min: -1, max: 1, default: 0, step: 0.01 },
|
|
885
|
+
sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0, step: 0.01 },
|
|
886
|
+
grayscale: { type: "number", label: "Grayscale", min: 0, max: 1, default: 0, step: 0.01 },
|
|
887
|
+
hueRotate: { type: "number", label: "Hue Rotate", min: 0, max: 6.28318, default: 0, step: 0.01 },
|
|
888
|
+
vignette: { type: "number", label: "Vignette", min: 0, max: 1, default: 0, step: 0.01 },
|
|
889
|
+
invert: { type: "number", label: "Invert", min: 0, max: 1, default: 0, step: 0.01 },
|
|
890
|
+
blur: { type: "number", label: "Blur", min: 0, max: 15, default: 0, step: 0.5 }
|
|
891
|
+
},
|
|
892
|
+
tags: ["color", "adjustments", "light", "vignette"]
|
|
893
|
+
},
|
|
894
|
+
"hsl-adjustment": {
|
|
895
|
+
id: "hsl-adjustment",
|
|
896
|
+
name: "HSL Adjustment",
|
|
897
|
+
category: "light",
|
|
898
|
+
description: "Adjust hue, saturation, and lightness of the video.",
|
|
899
|
+
defaultParams: { hue: 0, saturation: 0, lightness: 0, colorize: false, alpha: 1 },
|
|
900
|
+
parameterSchema: {
|
|
901
|
+
hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 1 },
|
|
902
|
+
saturation: { type: "number", label: "Saturation", min: -1, max: 1, default: 0, step: 0.05 },
|
|
903
|
+
lightness: { type: "number", label: "Lightness", min: -1, max: 1, default: 0, step: 0.05 },
|
|
904
|
+
colorize: { type: "boolean", label: "Colorize", default: false },
|
|
905
|
+
alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
|
|
906
|
+
},
|
|
907
|
+
tags: ["light", "color", "hsl", "hue"]
|
|
908
|
+
},
|
|
909
|
+
"alpha": {
|
|
910
|
+
id: "alpha",
|
|
911
|
+
name: "Opacity (Alpha)",
|
|
912
|
+
category: "light",
|
|
913
|
+
description: "Adjust layer opacity / alpha transparency.",
|
|
914
|
+
defaultParams: { alpha: 1 },
|
|
915
|
+
parameterSchema: {
|
|
916
|
+
alpha: { type: "number", label: "Opacity", min: 0, max: 1, default: 1, step: 0.05 }
|
|
917
|
+
},
|
|
918
|
+
tags: ["light", "alpha", "opacity"]
|
|
919
|
+
},
|
|
920
|
+
"color-matrix": {
|
|
921
|
+
id: "color-matrix",
|
|
922
|
+
name: "Color Matrix Presets",
|
|
923
|
+
category: "light",
|
|
924
|
+
description: "Color grading adjustments and retro filter presets.",
|
|
925
|
+
defaultParams: { brightness: 1, contrast: 1, saturation: 1, hue: 0, mode: "none" },
|
|
926
|
+
parameterSchema: {
|
|
927
|
+
brightness: { type: "number", label: "Brightness", min: 0, max: 2, default: 1, step: 0.05 },
|
|
928
|
+
contrast: { type: "number", label: "Contrast", min: 0, max: 2, default: 1, step: 0.05 },
|
|
929
|
+
saturation: { type: "number", label: "Saturation", min: 0, max: 2, default: 1, step: 0.05 },
|
|
930
|
+
hue: { type: "number", label: "Hue", min: -180, max: 180, default: 0, step: 2 },
|
|
931
|
+
mode: { type: "string", label: "Preset", default: "none" }
|
|
932
|
+
},
|
|
933
|
+
tags: ["light", "color", "presets", "vintage"]
|
|
934
|
+
},
|
|
935
|
+
"neon-glow": {
|
|
936
|
+
id: "neon-glow",
|
|
937
|
+
name: "Neon Glow (Community)",
|
|
938
|
+
category: "light",
|
|
939
|
+
description: "Wrap your visual features in a premium neon glow outline.",
|
|
940
|
+
defaultParams: { distance: 15, innerStrength: 1, outerStrength: 2, color: "#7C6FFF", quality: 0.1, knockout: false },
|
|
941
|
+
parameterSchema: {
|
|
942
|
+
distance: { type: "number", label: "Distance", min: 1, max: 100, default: 15, step: 1 },
|
|
943
|
+
innerStrength: { type: "number", label: "Inner Strength", min: 0, max: 10, default: 1, step: 0.2 },
|
|
944
|
+
outerStrength: { type: "number", label: "Outer Strength", min: 0, max: 10, default: 2, step: 0.2 },
|
|
945
|
+
color: { type: "color", label: "Glow Color", default: "#7C6FFF" },
|
|
946
|
+
quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
|
|
947
|
+
knockout: { type: "boolean", label: "Knockout", default: false }
|
|
948
|
+
},
|
|
949
|
+
tags: ["light", "glow", "neon", "outline"]
|
|
950
|
+
},
|
|
951
|
+
"gaussian-blur": {
|
|
952
|
+
id: "gaussian-blur",
|
|
953
|
+
name: "Gaussian Blur",
|
|
954
|
+
category: "cinematic",
|
|
955
|
+
description: "Classic high-fidelity Gaussian blur filter.",
|
|
956
|
+
defaultParams: { blur: 8, quality: 4 },
|
|
957
|
+
parameterSchema: {
|
|
958
|
+
blur: { type: "number", label: "Blur Strength", min: 0, max: 100, default: 8, step: 0.5 },
|
|
959
|
+
quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
|
|
960
|
+
},
|
|
961
|
+
tags: ["cinematic", "blur", "gaussian"]
|
|
962
|
+
},
|
|
963
|
+
"kawase-blur": {
|
|
964
|
+
id: "kawase-blur",
|
|
965
|
+
name: "Kawase Blur",
|
|
966
|
+
category: "cinematic",
|
|
967
|
+
description: "Fast, high-quality multi-pass Kawase blur.",
|
|
968
|
+
defaultParams: { blur: 8, quality: 4 },
|
|
969
|
+
parameterSchema: {
|
|
970
|
+
blur: { type: "number", label: "Blur Radius", min: 0, max: 100, default: 8, step: 0.5 },
|
|
971
|
+
quality: { type: "number", label: "Quality passes", min: 1, max: 15, default: 4, step: 1 }
|
|
972
|
+
},
|
|
973
|
+
tags: ["cinematic", "blur", "kawase"]
|
|
974
|
+
},
|
|
975
|
+
"zoom-blur": {
|
|
976
|
+
id: "zoom-blur",
|
|
977
|
+
name: "Zoom Blur",
|
|
978
|
+
category: "cinematic",
|
|
979
|
+
description: "Radial focal zoom blur emanating from a point.",
|
|
980
|
+
defaultParams: { strength: 0.15, centerX: 0.5, centerY: 0.5, innerRadius: 0, radius: 400 },
|
|
981
|
+
parameterSchema: {
|
|
982
|
+
strength: { type: "number", label: "Blur Strength", min: 0, max: 1, default: 0.15, step: 0.02 },
|
|
983
|
+
centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
984
|
+
centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
985
|
+
innerRadius: { type: "number", label: "Inner Rad", min: 0, max: 600, default: 0, step: 10 },
|
|
986
|
+
radius: { type: "number", label: "Outer Rad", min: 50, max: 1200, default: 400, step: 10 }
|
|
987
|
+
},
|
|
988
|
+
tags: ["cinematic", "blur", "zoom", "focus"]
|
|
989
|
+
},
|
|
990
|
+
"radial-blur": {
|
|
991
|
+
id: "radial-blur",
|
|
992
|
+
name: "Radial Blur",
|
|
993
|
+
category: "cinematic",
|
|
994
|
+
description: "Radial spin blur around a focal center point.",
|
|
995
|
+
defaultParams: { angle: 10, centerX: 0.5, centerY: 0.5, kernelSize: 9, radius: -1 },
|
|
996
|
+
parameterSchema: {
|
|
997
|
+
angle: { type: "number", label: "Spin Angle", min: -180, max: 180, default: 10, step: 1 },
|
|
998
|
+
centerX: { type: "number", label: "Center X", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
999
|
+
centerY: { type: "number", label: "Center Y", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
1000
|
+
kernelSize: { type: "number", label: "Kernel Size", min: 3, max: 25, default: 9, step: 2 },
|
|
1001
|
+
radius: { type: "number", label: "Max Radius", min: -1, max: 1200, default: -1, step: 10 }
|
|
1002
|
+
},
|
|
1003
|
+
tags: ["cinematic", "blur", "radial", "spin"]
|
|
1004
|
+
},
|
|
1005
|
+
"drop-shadow": {
|
|
1006
|
+
id: "drop-shadow",
|
|
1007
|
+
name: "Drop Shadow",
|
|
1008
|
+
category: "cinematic",
|
|
1009
|
+
description: "Apply an adjustable drop shadow overlay onto your layer.",
|
|
1010
|
+
defaultParams: { blur: 4, alpha: 0.5, offsetX: 4, offsetY: 4, color: "#000000", shadowOnly: false },
|
|
1011
|
+
parameterSchema: {
|
|
1012
|
+
blur: { type: "number", label: "Shadow Blur", min: 0, max: 50, default: 4, step: 0.5 },
|
|
1013
|
+
alpha: { type: "number", label: "Shadow Alpha", min: 0, max: 1, default: 0.5, step: 0.05 },
|
|
1014
|
+
offsetX: { type: "number", label: "Offset X", min: -100, max: 100, default: 4, step: 1 },
|
|
1015
|
+
offsetY: { type: "number", label: "Offset Y", min: -100, max: 100, default: 4, step: 1 },
|
|
1016
|
+
color: { type: "color", label: "Shadow Color", default: "#000000" },
|
|
1017
|
+
shadowOnly: { type: "boolean", label: "Shadow Only", default: false }
|
|
1018
|
+
},
|
|
1019
|
+
tags: ["cinematic", "shadow", "drop"]
|
|
1020
|
+
},
|
|
1021
|
+
"static-noise": {
|
|
1022
|
+
id: "static-noise",
|
|
1023
|
+
name: "Static Noise",
|
|
1024
|
+
category: "glitch",
|
|
1025
|
+
description: "Classic static analog noise/grain filter.",
|
|
1026
|
+
defaultParams: { noise: 0.15, animated: true },
|
|
1027
|
+
parameterSchema: {
|
|
1028
|
+
noise: { type: "number", label: "Noise Density", min: 0, max: 1, default: 0.15, step: 0.02 },
|
|
1029
|
+
animated: { type: "boolean", label: "Animated Seed", default: true }
|
|
1030
|
+
},
|
|
1031
|
+
tags: ["glitch", "noise", "grain", "static"]
|
|
1032
|
+
},
|
|
1033
|
+
"old-film": {
|
|
1034
|
+
id: "old-film",
|
|
1035
|
+
name: "Old Film",
|
|
1036
|
+
category: "cinematic",
|
|
1037
|
+
description: "Simulates vintage cinema projector noise, sepia tint, vignette, and scratches.",
|
|
1038
|
+
defaultParams: { sepia: 0.3, noise: 0.15, noiseSize: 1, scratchDensity: 0.3, scratchWidth: 1, vignetting: 0.3, vignettingAlpha: 1, vignettingBlur: 0.3 },
|
|
1039
|
+
parameterSchema: {
|
|
1040
|
+
sepia: { type: "number", label: "Sepia", min: 0, max: 1, default: 0.3, step: 0.05 },
|
|
1041
|
+
noise: { type: "number", label: "Noise", min: 0, max: 1, default: 0.15, step: 0.05 },
|
|
1042
|
+
noiseSize: { type: "number", label: "Noise Size", min: 0.2, max: 5, default: 1, step: 0.1 },
|
|
1043
|
+
scratchDensity: { type: "number", label: "Scratch Density", min: 0, max: 1, default: 0.3, step: 0.05 },
|
|
1044
|
+
scratchWidth: { type: "number", label: "Scratch Width", min: 0.5, max: 6, default: 1, step: 0.2 },
|
|
1045
|
+
vignetting: { type: "number", label: "Vignette", min: 0, max: 1, default: 0.3, step: 0.05 },
|
|
1046
|
+
vignettingAlpha: { type: "number", label: "Vignette Alpha", min: 0, max: 1, default: 1, step: 0.05 },
|
|
1047
|
+
vignettingBlur: { type: "number", label: "Vignette Blur", min: 0, max: 1, default: 0.3, step: 0.05 }
|
|
1048
|
+
},
|
|
1049
|
+
tags: ["cinematic", "film", "vintage", "retro", "scratches"]
|
|
1050
|
+
},
|
|
1051
|
+
"displacement": {
|
|
1052
|
+
id: "displacement",
|
|
1053
|
+
name: "Displacement Map",
|
|
1054
|
+
category: "distortion",
|
|
1055
|
+
description: "Warp and distort the frame using a procedural noise displacement sprite.",
|
|
1056
|
+
defaultParams: { scaleX: 20, scaleY: 20, animated: true, speed: 1 },
|
|
1057
|
+
parameterSchema: {
|
|
1058
|
+
scaleX: { type: "number", label: "Scale X", min: -200, max: 200, default: 20, step: 1 },
|
|
1059
|
+
scaleY: { type: "number", label: "Scale Y", min: -200, max: 200, default: 20, step: 1 },
|
|
1060
|
+
animated: { type: "boolean", label: "Flow Motion", default: true },
|
|
1061
|
+
speed: { type: "number", label: "Speed", min: 0.1, max: 5, default: 1, step: 0.1 }
|
|
1062
|
+
},
|
|
1063
|
+
tags: ["distortion", "displacement", "warp", "liquid"]
|
|
1064
|
+
},
|
|
1065
|
+
"outline": {
|
|
1066
|
+
id: "outline",
|
|
1067
|
+
name: "Outline Overlay",
|
|
1068
|
+
category: "distortion",
|
|
1069
|
+
description: "Draws a solid colored outline around the non-transparent boundaries.",
|
|
1070
|
+
defaultParams: { thickness: 3, color: "#7C6FFF", quality: 0.1, alpha: 1 },
|
|
1071
|
+
parameterSchema: {
|
|
1072
|
+
thickness: { type: "number", label: "Thickness", min: 0, max: 20, default: 3, step: 1 },
|
|
1073
|
+
color: { type: "color", label: "Color", default: "#7C6FFF" },
|
|
1074
|
+
quality: { type: "number", label: "Quality", min: 0.01, max: 1, default: 0.1, step: 0.05 },
|
|
1075
|
+
alpha: { type: "number", label: "Alpha", min: 0, max: 1, default: 1, step: 0.05 }
|
|
1076
|
+
},
|
|
1077
|
+
tags: ["distortion", "outline", "stroke", "border"]
|
|
1078
|
+
},
|
|
1079
|
+
"grayscale": {
|
|
1080
|
+
id: "grayscale",
|
|
1081
|
+
name: "Grayscale",
|
|
1082
|
+
category: "cinematic",
|
|
1083
|
+
description: "Converts the layer to monochrome black and white.",
|
|
1084
|
+
defaultParams: {},
|
|
1085
|
+
parameterSchema: {},
|
|
1086
|
+
tags: ["cinematic", "grayscale", "monochrome", "bw"]
|
|
1087
|
+
},
|
|
1088
|
+
"dot": {
|
|
1089
|
+
id: "dot",
|
|
1090
|
+
name: "Halftone Dots",
|
|
1091
|
+
category: "distortion",
|
|
1092
|
+
description: "Halftone dot raster pattern, simulating newspaper or comic book prints.",
|
|
1093
|
+
defaultParams: { scale: 1, angle: 1, grayscale: true },
|
|
1094
|
+
parameterSchema: {
|
|
1095
|
+
scale: { type: "number", label: "Dot Scale", min: 0.1, max: 10, default: 1, step: 0.1 },
|
|
1096
|
+
angle: { type: "number", label: "Angle", min: 0, max: 6.28, default: 1, step: 0.05 },
|
|
1097
|
+
grayscale: { type: "boolean", label: "Grayscale", default: true }
|
|
1098
|
+
},
|
|
1099
|
+
tags: ["distortion", "dot", "halftone", "comic"]
|
|
1100
|
+
},
|
|
1101
|
+
"emboss": {
|
|
1102
|
+
id: "emboss",
|
|
1103
|
+
name: "Emboss Relief",
|
|
1104
|
+
category: "distortion",
|
|
1105
|
+
description: "Simulates an embossed 3D relief depth on the frame.",
|
|
1106
|
+
defaultParams: { strength: 5 },
|
|
1107
|
+
parameterSchema: {
|
|
1108
|
+
strength: { type: "number", label: "Strength", min: 0, max: 20, default: 5, step: 0.5 }
|
|
1109
|
+
},
|
|
1110
|
+
tags: ["distortion", "emboss", "relief"]
|
|
1111
|
+
},
|
|
1112
|
+
"cross-hatch": {
|
|
1113
|
+
id: "cross-hatch",
|
|
1114
|
+
name: "Cross Hatch Sketch",
|
|
1115
|
+
category: "distortion",
|
|
1116
|
+
description: "Simulates a crosshatched pencil sketch on paper.",
|
|
1117
|
+
defaultParams: {},
|
|
1118
|
+
parameterSchema: {},
|
|
1119
|
+
tags: ["distortion", "sketch", "drawing", "hatch"]
|
|
1120
|
+
},
|
|
1121
|
+
"pixelate": {
|
|
1122
|
+
id: "pixelate",
|
|
1123
|
+
name: "Pixelate Mosaic",
|
|
1124
|
+
category: "distortion",
|
|
1125
|
+
description: "Pixelate the video frame into large blocky mosaic cells.",
|
|
1126
|
+
defaultParams: { sizeX: 10, sizeY: 10 },
|
|
1127
|
+
parameterSchema: {
|
|
1128
|
+
sizeX: { type: "number", label: "Cell Width", min: 1, max: 200, default: 10, step: 1 },
|
|
1129
|
+
sizeY: { type: "number", label: "Cell Height", min: 1, max: 200, default: 10, step: 1 }
|
|
1130
|
+
},
|
|
1131
|
+
tags: ["distortion", "pixelate", "mosaic", "8bit"]
|
|
1132
|
+
},
|
|
1133
|
+
"ascii": {
|
|
1134
|
+
id: "ascii",
|
|
1135
|
+
name: "ASCII Art",
|
|
1136
|
+
category: "distortion",
|
|
1137
|
+
description: "Converts the video frame into interactive retro matrix ASCII text characters.",
|
|
1138
|
+
defaultParams: { size: 8, replaceColor: false },
|
|
1139
|
+
parameterSchema: {
|
|
1140
|
+
size: { type: "number", label: "Char Size", min: 2, max: 50, default: 8, step: 1 },
|
|
1141
|
+
replaceColor: { type: "boolean", label: "Replace Color", default: false }
|
|
1142
|
+
},
|
|
1143
|
+
tags: ["distortion", "ascii", "text", "terminal"]
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
function drawBodySilhouette(ctx, cx, cy, w, h) {
|
|
1147
|
+
ctx.beginPath();
|
|
1148
|
+
ctx.ellipse(cx, cy - h * 0.22, w * 0.28, w * 0.28, 0, 0, Math.PI * 2);
|
|
1149
|
+
ctx.rect(cx - w * 0.08, cy - h * 0.1, w * 0.16, h * 0.06);
|
|
1150
|
+
ctx.moveTo(cx - w * 0.5, cy - h * 0.04);
|
|
1151
|
+
ctx.quadraticCurveTo(cx - w * 0.4, cy - h * 0.08, cx, cy - h * 0.08);
|
|
1152
|
+
ctx.quadraticCurveTo(cx + w * 0.4, cy - h * 0.08, cx + w * 0.5, cy - h * 0.04);
|
|
1153
|
+
ctx.lineTo(cx + w * 0.45, cy + h * 0.4);
|
|
1154
|
+
ctx.lineTo(cx - w * 0.45, cy + h * 0.4);
|
|
1155
|
+
ctx.closePath();
|
|
1156
|
+
}
|
|
1157
|
+
function imageDataToCanvas(imageData) {
|
|
1158
|
+
const canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(imageData.width, imageData.height) : document.createElement("canvas");
|
|
1159
|
+
if (canvas instanceof HTMLCanvasElement) {
|
|
1160
|
+
canvas.width = imageData.width;
|
|
1161
|
+
canvas.height = imageData.height;
|
|
1162
|
+
}
|
|
1163
|
+
const ctx = canvas.getContext("2d");
|
|
1164
|
+
if (ctx) {
|
|
1165
|
+
ctx.putImageData(imageData, 0, 0);
|
|
1166
|
+
}
|
|
1167
|
+
return canvas;
|
|
1168
|
+
}
|
|
1169
|
+
function pseudoRandom(seed) {
|
|
1170
|
+
const x = Math.sin(seed * 12.9898) * 43758.5453;
|
|
1171
|
+
return x - Math.floor(x);
|
|
1172
|
+
}
|
|
1173
|
+
function renderBodyGlow(ctx, params, intensity, time, bodyMask) {
|
|
1174
|
+
const canvas = ctx.canvas;
|
|
1175
|
+
const glowColor = params.glowColor || "#7C6FFF";
|
|
1176
|
+
const glowRadius = (params.glowRadius ?? 20) * intensity * (1 + Math.sin(time * 3) * 0.2);
|
|
1177
|
+
const glowIntensity = (params.glowIntensity ?? 0.8) * intensity * 0.18;
|
|
1178
|
+
ctx.save();
|
|
1179
|
+
ctx.globalCompositeOperation = "screen";
|
|
1180
|
+
ctx.shadowColor = glowColor;
|
|
1181
|
+
ctx.shadowBlur = glowRadius;
|
|
1182
|
+
ctx.fillStyle = glowColor;
|
|
1183
|
+
ctx.strokeStyle = glowColor;
|
|
1184
|
+
ctx.lineWidth = 2;
|
|
1185
|
+
ctx.globalAlpha = glowIntensity;
|
|
1186
|
+
if (bodyMask) {
|
|
1187
|
+
const maskCanvas = imageDataToCanvas(bodyMask);
|
|
1188
|
+
ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
|
|
1189
|
+
} else {
|
|
1190
|
+
const cx = canvas.width / 2;
|
|
1191
|
+
const cy = canvas.height * 0.5;
|
|
1192
|
+
const w = canvas.width * 0.28;
|
|
1193
|
+
const h = canvas.height * 0.52;
|
|
1194
|
+
drawBodySilhouette(ctx, cx, cy, w, h);
|
|
1195
|
+
ctx.fill();
|
|
1196
|
+
ctx.stroke();
|
|
1197
|
+
}
|
|
1198
|
+
ctx.restore();
|
|
1199
|
+
}
|
|
1200
|
+
function renderBodyOutline(ctx, params, intensity, time, bodyMask) {
|
|
1201
|
+
const canvas = ctx.canvas;
|
|
1202
|
+
const outlineColor = params.outlineColor || "#00E5FF";
|
|
1203
|
+
const pulseWidth = (params.outlineWidth ?? 6) * intensity * (1 + Math.sin(time * 2.5) * 0.15);
|
|
1204
|
+
const feather = (params.feather ?? 15) * (1 + Math.sin(time * 2) * 0.15);
|
|
1205
|
+
ctx.save();
|
|
1206
|
+
ctx.globalCompositeOperation = "screen";
|
|
1207
|
+
ctx.globalAlpha = Math.min(1, intensity);
|
|
1208
|
+
if (bodyMask) {
|
|
1209
|
+
const maskCanvas = imageDataToCanvas(bodyMask);
|
|
1210
|
+
const maskCtx = maskCanvas.getContext("2d");
|
|
1211
|
+
if (maskCtx) {
|
|
1212
|
+
maskCtx.save();
|
|
1213
|
+
maskCtx.globalCompositeOperation = "source-in";
|
|
1214
|
+
maskCtx.fillStyle = outlineColor;
|
|
1215
|
+
maskCtx.fillRect(0, 0, maskCanvas.width, maskCanvas.height);
|
|
1216
|
+
maskCtx.restore();
|
|
1217
|
+
}
|
|
1218
|
+
ctx.filter = `blur(${pulseWidth}px)`;
|
|
1219
|
+
ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
|
|
1220
|
+
ctx.filter = "none";
|
|
1221
|
+
ctx.drawImage(maskCanvas, -pulseWidth * 0.5, 0, canvas.width, canvas.height);
|
|
1222
|
+
ctx.drawImage(maskCanvas, pulseWidth * 0.5, 0, canvas.width, canvas.height);
|
|
1223
|
+
ctx.drawImage(maskCanvas, 0, -pulseWidth * 0.5, canvas.width, canvas.height);
|
|
1224
|
+
ctx.drawImage(maskCanvas, 0, pulseWidth * 0.5, canvas.width, canvas.height);
|
|
1225
|
+
} else {
|
|
1226
|
+
ctx.strokeStyle = outlineColor;
|
|
1227
|
+
ctx.lineWidth = Math.max(1, pulseWidth);
|
|
1228
|
+
ctx.shadowColor = outlineColor;
|
|
1229
|
+
ctx.shadowBlur = feather;
|
|
1230
|
+
const cx = canvas.width / 2;
|
|
1231
|
+
const cy = canvas.height * 0.5;
|
|
1232
|
+
const w = canvas.width * 0.28;
|
|
1233
|
+
const h = canvas.height * 0.52;
|
|
1234
|
+
drawBodySilhouette(ctx, cx, cy, w, h);
|
|
1235
|
+
ctx.stroke();
|
|
1236
|
+
}
|
|
1237
|
+
ctx.restore();
|
|
1238
|
+
}
|
|
1239
|
+
function renderBodyParticles(ctx, params, intensity, time, bodyMask) {
|
|
1240
|
+
const canvas = ctx.canvas;
|
|
1241
|
+
const particleColor = params.particleColor || "#FF2A85";
|
|
1242
|
+
const count = Math.min(150, (params.particleCount ?? 60) * intensity);
|
|
1243
|
+
const size = params.particleSize ?? 3;
|
|
1244
|
+
const drift = params.drift ?? 8;
|
|
1245
|
+
ctx.save();
|
|
1246
|
+
ctx.globalCompositeOperation = "screen";
|
|
1247
|
+
ctx.fillStyle = particleColor;
|
|
1248
|
+
if (bodyMask) {
|
|
1249
|
+
ctx.globalAlpha = Math.min(0.85, 0.25 + intensity * 0.6);
|
|
1250
|
+
const seed = Math.floor(time * 24);
|
|
1251
|
+
for (let i = 0; i < count; i++) {
|
|
1252
|
+
const x = Math.floor(pseudoRandom(seed + i * 37) * canvas.width);
|
|
1253
|
+
const y = Math.floor(pseudoRandom(seed + i * 43) * canvas.height);
|
|
1254
|
+
const maskIdx = (Math.floor(y * bodyMask.height / canvas.height) * bodyMask.width + Math.floor(x * bodyMask.width / canvas.width)) * 4 + 3;
|
|
1255
|
+
if (bodyMask.data[maskIdx] < 64) continue;
|
|
1256
|
+
const xDrift = Math.sin((time + i) * 2.1) * drift * intensity;
|
|
1257
|
+
const pSize = 1 + pseudoRandom(seed + i * 53) * (size - 1);
|
|
1258
|
+
ctx.beginPath();
|
|
1259
|
+
ctx.arc(x + xDrift, y - pseudoRandom(seed + i * 59) * 20 * intensity, pSize, 0, Math.PI * 2);
|
|
1260
|
+
ctx.fill();
|
|
1261
|
+
}
|
|
1262
|
+
} else {
|
|
1263
|
+
const cx = canvas.width / 2;
|
|
1264
|
+
const cy = canvas.height * 0.5;
|
|
1265
|
+
const w = canvas.width * 0.28;
|
|
1266
|
+
const h = canvas.height * 0.52;
|
|
1267
|
+
for (let i = 0; i < count; i++) {
|
|
1268
|
+
const angle = i / count * Math.PI * 2;
|
|
1269
|
+
const radius = 0.8 + Math.sin(angle * 3) * 0.15;
|
|
1270
|
+
const px = cx + Math.cos(angle + time * 0.2) * w * radius;
|
|
1271
|
+
const py = cy + Math.sin(angle + time * 0.2) * h * radius;
|
|
1272
|
+
const dy = -((time * 25 + i * 4) % 35);
|
|
1273
|
+
const dx = Math.sin(time * 1.5 + i * 0.6) * drift;
|
|
1274
|
+
ctx.globalAlpha = 0.2 + 0.6 * (0.5 + 0.5 * Math.sin(time * 3 + i));
|
|
1275
|
+
ctx.beginPath();
|
|
1276
|
+
ctx.arc(px + dx, py + dy, size, 0, Math.PI * 2);
|
|
1277
|
+
ctx.fill();
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
ctx.restore();
|
|
1281
|
+
}
|
|
1282
|
+
function renderBodySegmentationGlow(ctx, params, intensity, time, bodyMask) {
|
|
1283
|
+
const canvas = ctx.canvas;
|
|
1284
|
+
const glowColor = params.glowColor || "#FFD700";
|
|
1285
|
+
const glowRadius = (params.glowRadius ?? 25) * intensity;
|
|
1286
|
+
ctx.save();
|
|
1287
|
+
ctx.globalCompositeOperation = "source-over";
|
|
1288
|
+
ctx.shadowColor = glowColor;
|
|
1289
|
+
ctx.shadowBlur = glowRadius;
|
|
1290
|
+
ctx.fillStyle = glowColor;
|
|
1291
|
+
ctx.globalAlpha = 0.12 * intensity;
|
|
1292
|
+
if (bodyMask) {
|
|
1293
|
+
const maskCanvas = imageDataToCanvas(bodyMask);
|
|
1294
|
+
ctx.drawImage(maskCanvas, 0, 0, canvas.width, canvas.height);
|
|
1295
|
+
} else {
|
|
1296
|
+
const cx = canvas.width / 2;
|
|
1297
|
+
const cy = canvas.height * 0.5;
|
|
1298
|
+
const w = canvas.width * 0.28;
|
|
1299
|
+
const h = canvas.height * 0.52;
|
|
1300
|
+
drawBodySilhouette(ctx, cx, cy, w, h);
|
|
1301
|
+
ctx.fill();
|
|
1302
|
+
}
|
|
1303
|
+
ctx.restore();
|
|
1304
|
+
}
|
|
1305
|
+
function getEffectMetadata(id) {
|
|
1306
|
+
return EFFECTS_REGISTRY[id];
|
|
1307
|
+
}
|
|
1308
|
+
function getEffectsByCategory(category) {
|
|
1309
|
+
return Object.values(EFFECTS_REGISTRY).filter((effect) => effect.category === category);
|
|
1310
|
+
}
|
|
1311
|
+
function getEffectRenderer(id) {
|
|
1312
|
+
const renderers = {
|
|
1313
|
+
// Light
|
|
1314
|
+
flash: renderFlash,
|
|
1315
|
+
flicker: renderFlicker,
|
|
1316
|
+
vignette: renderVignette,
|
|
1317
|
+
glow: renderGlow,
|
|
1318
|
+
light_leak: renderLightLeak,
|
|
1319
|
+
light_leak_2: renderLightLeak2,
|
|
1320
|
+
fire: renderFire,
|
|
1321
|
+
particles: renderParticles,
|
|
1322
|
+
dust_particles: renderDustParticles,
|
|
1323
|
+
// Body
|
|
1324
|
+
body_glow: renderBodyGlow,
|
|
1325
|
+
body_outline: renderBodyOutline,
|
|
1326
|
+
body_particles: renderBodyParticles,
|
|
1327
|
+
"body-segmentation-glow": renderBodySegmentationGlow,
|
|
1328
|
+
// PixiJS variant fallbacks (supporting both kebab-case and underscore normalized variants)
|
|
1329
|
+
"light-leak": renderLightLeak,
|
|
1330
|
+
"lens-flare": renderLightLeak2,
|
|
1331
|
+
"lens_flare": renderLightLeak2,
|
|
1332
|
+
"rgb-split": (ctx, params, intensity) => {
|
|
1333
|
+
const shift = Math.floor(Number(params.redX ?? 4) * intensity);
|
|
1334
|
+
if (shift === 0) return;
|
|
1335
|
+
ctx.save();
|
|
1336
|
+
ctx.globalCompositeOperation = "screen";
|
|
1337
|
+
ctx.globalAlpha = 0.4 * intensity;
|
|
1338
|
+
ctx.drawImage(ctx.canvas, -shift, 0);
|
|
1339
|
+
ctx.drawImage(ctx.canvas, shift, 0);
|
|
1340
|
+
ctx.restore();
|
|
1341
|
+
},
|
|
1342
|
+
"rgb_split": (ctx, params, intensity) => {
|
|
1343
|
+
const shift = Math.floor(Number(params.redX ?? 4) * intensity);
|
|
1344
|
+
if (shift === 0) return;
|
|
1345
|
+
ctx.save();
|
|
1346
|
+
ctx.globalCompositeOperation = "screen";
|
|
1347
|
+
ctx.globalAlpha = 0.4 * intensity;
|
|
1348
|
+
ctx.drawImage(ctx.canvas, -shift, 0);
|
|
1349
|
+
ctx.drawImage(ctx.canvas, shift, 0);
|
|
1350
|
+
ctx.restore();
|
|
1351
|
+
},
|
|
1352
|
+
"vhs": (ctx, params, intensity) => {
|
|
1353
|
+
const width = ctx.canvas.width;
|
|
1354
|
+
const height = ctx.canvas.height;
|
|
1355
|
+
ctx.save();
|
|
1356
|
+
ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.15})`;
|
|
1357
|
+
for (let y = 0; y < height; y += 4) {
|
|
1358
|
+
ctx.fillRect(0, y, width, 1.5);
|
|
1359
|
+
}
|
|
1360
|
+
ctx.restore();
|
|
1361
|
+
},
|
|
1362
|
+
"glitch-band": (ctx, params, intensity) => {
|
|
1363
|
+
const width = ctx.canvas.width;
|
|
1364
|
+
const height = ctx.canvas.height;
|
|
1365
|
+
const y = Math.floor(Math.random() * height);
|
|
1366
|
+
ctx.save();
|
|
1367
|
+
ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
|
|
1368
|
+
ctx.fillRect(0, y, width, 8);
|
|
1369
|
+
ctx.restore();
|
|
1370
|
+
},
|
|
1371
|
+
"glitch_band": (ctx, params, intensity) => {
|
|
1372
|
+
const width = ctx.canvas.width;
|
|
1373
|
+
const height = ctx.canvas.height;
|
|
1374
|
+
const y = Math.floor(Math.random() * height);
|
|
1375
|
+
ctx.save();
|
|
1376
|
+
ctx.fillStyle = `rgba(255, 255, 255, ${intensity * 0.35})`;
|
|
1377
|
+
ctx.fillRect(0, y, width, 8);
|
|
1378
|
+
ctx.restore();
|
|
1379
|
+
},
|
|
1380
|
+
"crt": (ctx, params, intensity) => {
|
|
1381
|
+
const width = ctx.canvas.width;
|
|
1382
|
+
const height = ctx.canvas.height;
|
|
1383
|
+
ctx.save();
|
|
1384
|
+
ctx.fillStyle = `rgba(0, 0, 0, ${intensity * 0.12})`;
|
|
1385
|
+
for (let y = 0; y < height; y += 3) {
|
|
1386
|
+
ctx.fillRect(0, y, width, 1);
|
|
1387
|
+
}
|
|
1388
|
+
ctx.restore();
|
|
1389
|
+
},
|
|
1390
|
+
"film-grain": (ctx, params, intensity) => {
|
|
1391
|
+
const width = ctx.canvas.width;
|
|
1392
|
+
const height = ctx.canvas.height;
|
|
1393
|
+
ctx.save();
|
|
1394
|
+
for (let i = 0; i < 120 * intensity; i++) {
|
|
1395
|
+
const x = Math.random() * width;
|
|
1396
|
+
const y = Math.random() * height;
|
|
1397
|
+
const alpha = 0.04 + Math.random() * 0.05;
|
|
1398
|
+
ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha})` : `rgba(0, 0, 0, ${alpha})`;
|
|
1399
|
+
ctx.fillRect(x, y, 2, 2);
|
|
1400
|
+
}
|
|
1401
|
+
ctx.restore();
|
|
1402
|
+
},
|
|
1403
|
+
"film_grain": (ctx, params, intensity) => {
|
|
1404
|
+
const width = ctx.canvas.width;
|
|
1405
|
+
const height = ctx.canvas.height;
|
|
1406
|
+
ctx.save();
|
|
1407
|
+
for (let i = 0; i < 120 * intensity; i++) {
|
|
1408
|
+
const x = Math.random() * width;
|
|
1409
|
+
const y = Math.random() * height;
|
|
1410
|
+
const alpha = 0.04 + Math.random() * 0.05;
|
|
1411
|
+
ctx.fillStyle = Math.random() > 0.5 ? `rgba(255, 255, 255, ${alpha})` : `rgba(0, 0, 0, ${alpha})`;
|
|
1412
|
+
ctx.fillRect(x, y, 2, 2);
|
|
1413
|
+
}
|
|
1414
|
+
ctx.restore();
|
|
1415
|
+
},
|
|
1416
|
+
"tilt-shift": (ctx, params, intensity) => {
|
|
1417
|
+
ctx.save();
|
|
1418
|
+
try {
|
|
1419
|
+
ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
|
|
1420
|
+
ctx.drawImage(ctx.canvas, 0, 0);
|
|
1421
|
+
} catch {
|
|
1422
|
+
}
|
|
1423
|
+
ctx.restore();
|
|
1424
|
+
},
|
|
1425
|
+
"tilt_shift": (ctx, params, intensity) => {
|
|
1426
|
+
ctx.save();
|
|
1427
|
+
try {
|
|
1428
|
+
ctx.filter = `blur(${Math.max(1, Math.floor(6 * intensity))}px)`;
|
|
1429
|
+
ctx.drawImage(ctx.canvas, 0, 0);
|
|
1430
|
+
} catch {
|
|
1431
|
+
}
|
|
1432
|
+
ctx.restore();
|
|
1433
|
+
},
|
|
1434
|
+
"cinematic-lut": (ctx, params, intensity) => {
|
|
1435
|
+
const width = ctx.canvas.width;
|
|
1436
|
+
const height = ctx.canvas.height;
|
|
1437
|
+
ctx.save();
|
|
1438
|
+
ctx.globalCompositeOperation = "color";
|
|
1439
|
+
ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
|
|
1440
|
+
ctx.fillRect(0, 0, width, height);
|
|
1441
|
+
ctx.restore();
|
|
1442
|
+
},
|
|
1443
|
+
"cinematic_lut": (ctx, params, intensity) => {
|
|
1444
|
+
const width = ctx.canvas.width;
|
|
1445
|
+
const height = ctx.canvas.height;
|
|
1446
|
+
ctx.save();
|
|
1447
|
+
ctx.globalCompositeOperation = "color";
|
|
1448
|
+
ctx.fillStyle = `rgba(255, 140, 0, ${intensity * 0.18})`;
|
|
1449
|
+
ctx.fillRect(0, 0, width, height);
|
|
1450
|
+
ctx.restore();
|
|
1451
|
+
},
|
|
1452
|
+
"motion-blur": (ctx, params, intensity) => {
|
|
1453
|
+
ctx.save();
|
|
1454
|
+
ctx.globalAlpha = 0.4 * intensity;
|
|
1455
|
+
const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
|
|
1456
|
+
const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
|
|
1457
|
+
ctx.drawImage(ctx.canvas, shiftX, shiftY);
|
|
1458
|
+
ctx.restore();
|
|
1459
|
+
},
|
|
1460
|
+
"motion_blur": (ctx, params, intensity) => {
|
|
1461
|
+
ctx.save();
|
|
1462
|
+
ctx.globalAlpha = 0.4 * intensity;
|
|
1463
|
+
const shiftX = Math.floor(Number(params.velocityX ?? 20) * intensity * 0.2);
|
|
1464
|
+
const shiftY = Math.floor(Number(params.velocityY ?? 0) * intensity * 0.2);
|
|
1465
|
+
ctx.drawImage(ctx.canvas, shiftX, shiftY);
|
|
1466
|
+
ctx.restore();
|
|
1467
|
+
},
|
|
1468
|
+
"shockwave": (ctx, params, intensity, time) => {
|
|
1469
|
+
const width = ctx.canvas.width;
|
|
1470
|
+
const height = ctx.canvas.height;
|
|
1471
|
+
ctx.save();
|
|
1472
|
+
ctx.strokeStyle = `rgba(255, 255, 255, ${intensity * 0.25})`;
|
|
1473
|
+
ctx.lineWidth = 6;
|
|
1474
|
+
ctx.beginPath();
|
|
1475
|
+
ctx.arc(width / 2, height / 2, time * 160 % (width / 2 + 50), 0, Math.PI * 2);
|
|
1476
|
+
ctx.stroke();
|
|
1477
|
+
ctx.restore();
|
|
1478
|
+
},
|
|
1479
|
+
"bulge-pinch": (ctx, params, intensity) => {
|
|
1480
|
+
const width = ctx.canvas.width;
|
|
1481
|
+
const height = ctx.canvas.height;
|
|
1482
|
+
ctx.save();
|
|
1483
|
+
ctx.translate(width / 2, height / 2);
|
|
1484
|
+
const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
|
|
1485
|
+
ctx.scale(scale, scale);
|
|
1486
|
+
ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
|
|
1487
|
+
ctx.restore();
|
|
1488
|
+
},
|
|
1489
|
+
"bulge_pinch": (ctx, params, intensity) => {
|
|
1490
|
+
const width = ctx.canvas.width;
|
|
1491
|
+
const height = ctx.canvas.height;
|
|
1492
|
+
ctx.save();
|
|
1493
|
+
ctx.translate(width / 2, height / 2);
|
|
1494
|
+
const scale = 1 + Number(params.strength ?? 0.5) * intensity * 0.08;
|
|
1495
|
+
ctx.scale(scale, scale);
|
|
1496
|
+
ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
|
|
1497
|
+
ctx.restore();
|
|
1498
|
+
},
|
|
1499
|
+
"twist": (ctx, params, intensity) => {
|
|
1500
|
+
const width = ctx.canvas.width;
|
|
1501
|
+
const height = ctx.canvas.height;
|
|
1502
|
+
ctx.save();
|
|
1503
|
+
ctx.translate(width / 2, height / 2);
|
|
1504
|
+
ctx.rotate(Number(params.angle ?? 4) * intensity * 0.02);
|
|
1505
|
+
ctx.drawImage(ctx.canvas, -width / 2, -height / 2);
|
|
1506
|
+
ctx.restore();
|
|
1507
|
+
},
|
|
1508
|
+
"reflection": (ctx, params, intensity) => {
|
|
1509
|
+
const width = ctx.canvas.width;
|
|
1510
|
+
const height = ctx.canvas.height;
|
|
1511
|
+
const boundaryY = Number(params.boundary ?? 0.5) * height;
|
|
1512
|
+
ctx.save();
|
|
1513
|
+
ctx.translate(0, boundaryY * 2);
|
|
1514
|
+
ctx.scale(1, -1);
|
|
1515
|
+
ctx.globalAlpha = 0.7 * intensity;
|
|
1516
|
+
ctx.drawImage(ctx.canvas, 0, boundaryY, width, height - boundaryY, 0, boundaryY, width, height - boundaryY);
|
|
1517
|
+
ctx.restore();
|
|
1518
|
+
},
|
|
1519
|
+
"color-gradient": (ctx, params, intensity) => {
|
|
1520
|
+
const width = ctx.canvas.width;
|
|
1521
|
+
const height = ctx.canvas.height;
|
|
1522
|
+
ctx.save();
|
|
1523
|
+
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);
|
|
1524
|
+
grad.addColorStop(0, params.color1 || "#7C6FFF");
|
|
1525
|
+
grad.addColorStop(1, params.color2 || "#0E0E12");
|
|
1526
|
+
ctx.fillStyle = grad;
|
|
1527
|
+
ctx.globalAlpha = Number(params.alpha ?? 0.5) * intensity;
|
|
1528
|
+
ctx.fillRect(0, 0, width, height);
|
|
1529
|
+
ctx.restore();
|
|
1530
|
+
},
|
|
1531
|
+
"color-overlay": (ctx, params, intensity) => {
|
|
1532
|
+
const width = ctx.canvas.width;
|
|
1533
|
+
const height = ctx.canvas.height;
|
|
1534
|
+
ctx.save();
|
|
1535
|
+
ctx.fillStyle = params.color || "#7C6FFF";
|
|
1536
|
+
ctx.globalAlpha = Number(params.alpha ?? 0.3) * intensity;
|
|
1537
|
+
ctx.fillRect(0, 0, width, height);
|
|
1538
|
+
ctx.restore();
|
|
1539
|
+
},
|
|
1540
|
+
"color-adjustments": (ctx, params, intensity) => {
|
|
1541
|
+
const width = ctx.canvas.width;
|
|
1542
|
+
const height = ctx.canvas.height;
|
|
1543
|
+
const f = intensity;
|
|
1544
|
+
const exp = Number(params.exposure ?? 0) * f;
|
|
1545
|
+
const brightnessVal = 1 + Number(params.brightness ?? 0) * f + exp;
|
|
1546
|
+
const contrastVal = 1 + Number(params.contrast ?? 0) * f;
|
|
1547
|
+
const saturationVal = 1 + Number(params.saturation ?? 0) * f;
|
|
1548
|
+
const sepiaVal = Number(params.sepia ?? 0) * f;
|
|
1549
|
+
const grayscaleVal = Number(params.grayscale ?? 0) * f;
|
|
1550
|
+
const hueVal = Number(params.hueRotate ?? 0) * f;
|
|
1551
|
+
const invertVal = Number(params.invert ?? 0) * f;
|
|
1552
|
+
const blurVal = Number(params.blur ?? 0) * f;
|
|
1553
|
+
const filterParts = [];
|
|
1554
|
+
if (brightnessVal !== 1) filterParts.push(`brightness(${brightnessVal})`);
|
|
1555
|
+
if (contrastVal !== 1) filterParts.push(`contrast(${contrastVal})`);
|
|
1556
|
+
if (saturationVal !== 1) filterParts.push(`saturate(${saturationVal})`);
|
|
1557
|
+
if (sepiaVal > 0) filterParts.push(`sepia(${sepiaVal * 100}%)`);
|
|
1558
|
+
if (grayscaleVal > 0) filterParts.push(`grayscale(${grayscaleVal * 100}%)`);
|
|
1559
|
+
if (hueVal !== 0) filterParts.push(`hue-rotate(${hueVal * 180 / Math.PI}deg)`);
|
|
1560
|
+
if (invertVal > 0) filterParts.push(`invert(${invertVal * 100}%)`);
|
|
1561
|
+
if (blurVal > 0) filterParts.push(`blur(${blurVal}px)`);
|
|
1562
|
+
if (filterParts.length > 0) {
|
|
1563
|
+
ctx.save();
|
|
1564
|
+
const temp = document.createElement("canvas");
|
|
1565
|
+
temp.width = width;
|
|
1566
|
+
temp.height = height;
|
|
1567
|
+
const tempCtx = temp.getContext("2d");
|
|
1568
|
+
if (tempCtx) {
|
|
1569
|
+
tempCtx.drawImage(ctx.canvas, 0, 0);
|
|
1570
|
+
ctx.clearRect(0, 0, width, height);
|
|
1571
|
+
ctx.filter = filterParts.join(" ");
|
|
1572
|
+
ctx.drawImage(temp, 0, 0);
|
|
1573
|
+
ctx.filter = "none";
|
|
1574
|
+
}
|
|
1575
|
+
ctx.restore();
|
|
1576
|
+
}
|
|
1577
|
+
const tempVal = Number(params.temperature ?? 0) * f;
|
|
1578
|
+
if (tempVal !== 0) {
|
|
1579
|
+
ctx.save();
|
|
1580
|
+
ctx.globalCompositeOperation = "soft-light";
|
|
1581
|
+
if (tempVal > 0) {
|
|
1582
|
+
ctx.fillStyle = `rgba(255, 140, 40, ${tempVal})`;
|
|
1583
|
+
} else {
|
|
1584
|
+
ctx.fillStyle = `rgba(40, 120, 255, ${-tempVal})`;
|
|
1585
|
+
}
|
|
1586
|
+
ctx.fillRect(0, 0, width, height);
|
|
1587
|
+
ctx.restore();
|
|
1588
|
+
}
|
|
1589
|
+
const tintVal = Number(params.tint ?? 0) * f;
|
|
1590
|
+
if (tintVal !== 0) {
|
|
1591
|
+
ctx.save();
|
|
1592
|
+
ctx.globalCompositeOperation = "soft-light";
|
|
1593
|
+
if (tintVal > 0) {
|
|
1594
|
+
ctx.fillStyle = `rgba(255, 40, 180, ${tintVal})`;
|
|
1595
|
+
} else {
|
|
1596
|
+
ctx.fillStyle = `rgba(40, 255, 100, ${-tintVal})`;
|
|
1597
|
+
}
|
|
1598
|
+
ctx.fillRect(0, 0, width, height);
|
|
1599
|
+
ctx.restore();
|
|
1600
|
+
}
|
|
1601
|
+
const vignetteVal = Number(params.vignette ?? 0) * f;
|
|
1602
|
+
if (vignetteVal > 0) {
|
|
1603
|
+
ctx.save();
|
|
1604
|
+
ctx.globalCompositeOperation = "multiply";
|
|
1605
|
+
const cx = width / 2;
|
|
1606
|
+
const cy = height / 2;
|
|
1607
|
+
const maxRadius = Math.sqrt(cx * cx + cy * cy);
|
|
1608
|
+
const gradient = ctx.createRadialGradient(cx, cy, maxRadius * 0.45, cx, cy, maxRadius * 1);
|
|
1609
|
+
gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
|
|
1610
|
+
gradient.addColorStop(0.5, `rgba(0, 0, 0, ${vignetteVal * 0.15})`);
|
|
1611
|
+
gradient.addColorStop(0.8, `rgba(0, 0, 0, ${vignetteVal * 0.55})`);
|
|
1612
|
+
gradient.addColorStop(1, `rgba(0, 0, 0, ${vignetteVal * 0.9})`);
|
|
1613
|
+
ctx.fillStyle = gradient;
|
|
1614
|
+
ctx.fillRect(0, 0, width, height);
|
|
1615
|
+
ctx.restore();
|
|
1616
|
+
}
|
|
1617
|
+
},
|
|
1618
|
+
"hsl-adjustment": (ctx, params, intensity) => {
|
|
1619
|
+
if (params.colorize) {
|
|
1620
|
+
ctx.save();
|
|
1621
|
+
ctx.fillStyle = "rgba(124, 111, 255, 0.2)";
|
|
1622
|
+
ctx.globalAlpha = Number(params.alpha ?? 1) * intensity;
|
|
1623
|
+
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1624
|
+
ctx.restore();
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
"alpha": (ctx, params, intensity) => {
|
|
1628
|
+
ctx.save();
|
|
1629
|
+
ctx.globalAlpha = 1 - (1 - Number(params.alpha ?? 1)) * intensity;
|
|
1630
|
+
ctx.restore();
|
|
1631
|
+
},
|
|
1632
|
+
"color-matrix": (ctx, params, intensity) => {
|
|
1633
|
+
ctx.save();
|
|
1634
|
+
ctx.globalCompositeOperation = "color";
|
|
1635
|
+
ctx.fillStyle = `rgba(255, 120, 0, ${0.1 * intensity})`;
|
|
1636
|
+
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1637
|
+
ctx.restore();
|
|
1638
|
+
},
|
|
1639
|
+
"neon-glow": (ctx, params, intensity) => {
|
|
1640
|
+
ctx.save();
|
|
1641
|
+
ctx.shadowBlur = Number(params.distance ?? 15) * intensity;
|
|
1642
|
+
ctx.shadowColor = params.color || "#7C6FFF";
|
|
1643
|
+
ctx.restore();
|
|
1644
|
+
},
|
|
1645
|
+
"gaussian-blur": (ctx, params, intensity) => {
|
|
1646
|
+
ctx.save();
|
|
1647
|
+
try {
|
|
1648
|
+
ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
|
|
1649
|
+
ctx.drawImage(ctx.canvas, 0, 0);
|
|
1650
|
+
} catch {
|
|
1651
|
+
}
|
|
1652
|
+
ctx.restore();
|
|
1653
|
+
},
|
|
1654
|
+
"kawase-blur": (ctx, params, intensity) => {
|
|
1655
|
+
ctx.save();
|
|
1656
|
+
try {
|
|
1657
|
+
ctx.filter = `blur(${Math.max(1, Math.floor(Number(params.blur ?? 8) * intensity))}px)`;
|
|
1658
|
+
ctx.drawImage(ctx.canvas, 0, 0);
|
|
1659
|
+
} catch {
|
|
1660
|
+
}
|
|
1661
|
+
ctx.restore();
|
|
1662
|
+
},
|
|
1663
|
+
"zoom-blur": (ctx, params, intensity) => {
|
|
1664
|
+
ctx.save();
|
|
1665
|
+
try {
|
|
1666
|
+
ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
|
|
1667
|
+
ctx.drawImage(ctx.canvas, 0, 0);
|
|
1668
|
+
} catch {
|
|
1669
|
+
}
|
|
1670
|
+
ctx.restore();
|
|
1671
|
+
},
|
|
1672
|
+
"radial-blur": (ctx, params, intensity) => {
|
|
1673
|
+
ctx.save();
|
|
1674
|
+
try {
|
|
1675
|
+
ctx.filter = `blur(${Math.max(1, Math.floor(4 * intensity))}px)`;
|
|
1676
|
+
ctx.drawImage(ctx.canvas, 0, 0);
|
|
1677
|
+
} catch {
|
|
1678
|
+
}
|
|
1679
|
+
ctx.restore();
|
|
1680
|
+
},
|
|
1681
|
+
"drop-shadow": (ctx, params, intensity) => {
|
|
1682
|
+
ctx.save();
|
|
1683
|
+
ctx.shadowBlur = Number(params.blur ?? 4) * intensity;
|
|
1684
|
+
ctx.shadowColor = params.color || "#000000";
|
|
1685
|
+
ctx.shadowOffsetX = Number(params.offsetX ?? 4) * intensity;
|
|
1686
|
+
ctx.shadowOffsetY = Number(params.offsetY ?? 4) * intensity;
|
|
1687
|
+
ctx.restore();
|
|
1688
|
+
},
|
|
1689
|
+
"static-noise": (ctx, params, intensity) => {
|
|
1690
|
+
const width = ctx.canvas.width;
|
|
1691
|
+
const height = ctx.canvas.height;
|
|
1692
|
+
ctx.save();
|
|
1693
|
+
const density = Number(params.noise ?? 0.15) * intensity;
|
|
1694
|
+
for (let i = 0; i < 200 * density; i++) {
|
|
1695
|
+
const x = Math.random() * width;
|
|
1696
|
+
const y = Math.random() * height;
|
|
1697
|
+
ctx.fillStyle = `rgba(255, 255, 255, ${0.1 + Math.random() * 0.15})`;
|
|
1698
|
+
ctx.fillRect(x, y, 2, 2);
|
|
1699
|
+
}
|
|
1700
|
+
ctx.restore();
|
|
1701
|
+
},
|
|
1702
|
+
"old-film": (ctx, params, intensity) => {
|
|
1703
|
+
const width = ctx.canvas.width;
|
|
1704
|
+
const height = ctx.canvas.height;
|
|
1705
|
+
ctx.save();
|
|
1706
|
+
ctx.globalCompositeOperation = "color";
|
|
1707
|
+
ctx.fillStyle = `rgba(139, 69, 19, ${Number(params.sepia ?? 0.3) * intensity})`;
|
|
1708
|
+
ctx.fillRect(0, 0, width, height);
|
|
1709
|
+
ctx.globalCompositeOperation = "source-over";
|
|
1710
|
+
for (let i = 0; i < 50 * intensity; i++) {
|
|
1711
|
+
ctx.fillStyle = "rgba(255,255,255,0.06)";
|
|
1712
|
+
ctx.fillRect(Math.random() * width, Math.random() * height, 2, 2);
|
|
1713
|
+
}
|
|
1714
|
+
ctx.restore();
|
|
1715
|
+
},
|
|
1716
|
+
"displacement": (ctx, params, intensity) => {
|
|
1717
|
+
ctx.save();
|
|
1718
|
+
const shiftX = Number(params.scaleX ?? 20) * intensity * 0.1;
|
|
1719
|
+
const shiftY = Number(params.scaleY ?? 20) * intensity * 0.1;
|
|
1720
|
+
ctx.drawImage(ctx.canvas, shiftX, shiftY);
|
|
1721
|
+
ctx.restore();
|
|
1722
|
+
},
|
|
1723
|
+
"outline": (ctx, params, intensity) => {
|
|
1724
|
+
ctx.save();
|
|
1725
|
+
ctx.strokeStyle = params.color || "#7C6FFF";
|
|
1726
|
+
ctx.lineWidth = Number(params.thickness ?? 3) * intensity;
|
|
1727
|
+
ctx.strokeRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1728
|
+
ctx.restore();
|
|
1729
|
+
},
|
|
1730
|
+
"grayscale": (ctx, params, intensity) => {
|
|
1731
|
+
ctx.save();
|
|
1732
|
+
ctx.globalCompositeOperation = "luminosity";
|
|
1733
|
+
ctx.fillStyle = "#ffffff";
|
|
1734
|
+
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1735
|
+
ctx.restore();
|
|
1736
|
+
},
|
|
1737
|
+
"dot": (ctx, params, intensity) => {
|
|
1738
|
+
const width = ctx.canvas.width;
|
|
1739
|
+
const height = ctx.canvas.height;
|
|
1740
|
+
ctx.save();
|
|
1741
|
+
ctx.fillStyle = "rgba(0,0,0,0.15)";
|
|
1742
|
+
const step = Math.max(4, Math.floor(10 * Number(params.scale ?? 1)));
|
|
1743
|
+
for (let x = 0; x < width; x += step) {
|
|
1744
|
+
for (let y = 0; y < height; y += step) {
|
|
1745
|
+
ctx.beginPath();
|
|
1746
|
+
ctx.arc(x, y, 1.5 * intensity, 0, Math.PI * 2);
|
|
1747
|
+
ctx.fill();
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
ctx.restore();
|
|
1751
|
+
},
|
|
1752
|
+
"emboss": (ctx, params, intensity) => {
|
|
1753
|
+
ctx.save();
|
|
1754
|
+
ctx.globalAlpha = 0.3 * intensity;
|
|
1755
|
+
ctx.drawImage(ctx.canvas, 1, 1);
|
|
1756
|
+
ctx.restore();
|
|
1757
|
+
},
|
|
1758
|
+
"cross-hatch": (ctx, params, intensity) => {
|
|
1759
|
+
const width = ctx.canvas.width;
|
|
1760
|
+
const height = ctx.canvas.height;
|
|
1761
|
+
ctx.save();
|
|
1762
|
+
ctx.strokeStyle = `rgba(0,0,0,${0.15 * intensity})`;
|
|
1763
|
+
ctx.lineWidth = 1;
|
|
1764
|
+
for (let i = 0; i < width; i += 20) {
|
|
1765
|
+
ctx.beginPath();
|
|
1766
|
+
ctx.moveTo(i, 0);
|
|
1767
|
+
ctx.lineTo(i + height, height);
|
|
1768
|
+
ctx.stroke();
|
|
1769
|
+
}
|
|
1770
|
+
ctx.restore();
|
|
1771
|
+
},
|
|
1772
|
+
"pixelate": (ctx, params, intensity) => {
|
|
1773
|
+
const width = ctx.canvas.width;
|
|
1774
|
+
const height = ctx.canvas.height;
|
|
1775
|
+
const cellW = Math.max(2, Math.floor(Number(params.sizeX ?? 10) * intensity));
|
|
1776
|
+
const cellH = Math.max(2, Math.floor(Number(params.sizeY ?? 10) * intensity));
|
|
1777
|
+
ctx.save();
|
|
1778
|
+
ctx.imageSmoothingEnabled = false;
|
|
1779
|
+
const tempCanvas = document.createElement("canvas");
|
|
1780
|
+
tempCanvas.width = Math.max(4, Math.floor(width / cellW));
|
|
1781
|
+
tempCanvas.height = Math.max(4, Math.floor(height / cellH));
|
|
1782
|
+
const tempCtx = tempCanvas.getContext("2d");
|
|
1783
|
+
tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
|
|
1784
|
+
ctx.clearRect(0, 0, width, height);
|
|
1785
|
+
ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
|
|
1786
|
+
ctx.restore();
|
|
1787
|
+
},
|
|
1788
|
+
"ascii": (ctx, params, intensity) => {
|
|
1789
|
+
const width = ctx.canvas.width;
|
|
1790
|
+
const height = ctx.canvas.height;
|
|
1791
|
+
const size = Math.max(4, Math.floor(Number(params.size ?? 8) * intensity));
|
|
1792
|
+
ctx.save();
|
|
1793
|
+
ctx.imageSmoothingEnabled = false;
|
|
1794
|
+
const tempCanvas = document.createElement("canvas");
|
|
1795
|
+
tempCanvas.width = Math.max(4, Math.floor(width / size));
|
|
1796
|
+
tempCanvas.height = Math.max(4, Math.floor(height / size));
|
|
1797
|
+
const tempCtx = tempCanvas.getContext("2d");
|
|
1798
|
+
tempCtx.drawImage(ctx.canvas, 0, 0, tempCanvas.width, tempCanvas.height);
|
|
1799
|
+
ctx.clearRect(0, 0, width, height);
|
|
1800
|
+
ctx.drawImage(tempCanvas, 0, 0, tempCanvas.width, tempCanvas.height, 0, 0, width, height);
|
|
1801
|
+
ctx.restore();
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
return renderers[id] || null;
|
|
1805
|
+
}
|
|
1806
|
+
function searchEffects(query) {
|
|
1807
|
+
const lowerQuery = query.toLowerCase();
|
|
1808
|
+
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)));
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// src/videoEffects/EffectRenderer.ts
|
|
1812
|
+
var EffectRenderer = class {
|
|
1813
|
+
/**
|
|
1814
|
+
* Apply an effect to a canvas context
|
|
1815
|
+
*
|
|
1816
|
+
* @param ctx - Canvas 2D context
|
|
1817
|
+
* @param renderer - Effect type
|
|
1818
|
+
* @param params - Effect parameters
|
|
1819
|
+
* @param intensity - Effect intensity (0-1)
|
|
1820
|
+
* @param time - Current time for animated effects
|
|
1821
|
+
*/
|
|
1822
|
+
static apply(ctx, renderer, params, intensity = 1, time = 0, bodyMask) {
|
|
1823
|
+
const method = getEffectRenderer(renderer);
|
|
1824
|
+
if (method) {
|
|
1825
|
+
method.call(this, ctx, params, intensity, time, bodyMask);
|
|
1826
|
+
} else {
|
|
1827
|
+
console.warn(`Unknown effect renderer: ${renderer}`);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
// src/videoEffects/EffectGraph.ts
|
|
1833
|
+
var EffectGraph = class {
|
|
1834
|
+
schemaVersion;
|
|
1835
|
+
graphId;
|
|
1836
|
+
name;
|
|
1837
|
+
nodes = /* @__PURE__ */ new Map();
|
|
1838
|
+
edges = [];
|
|
1839
|
+
connections = [];
|
|
1840
|
+
constructor(definition) {
|
|
1841
|
+
if (definition) {
|
|
1842
|
+
this.schemaVersion = definition.schemaVersion;
|
|
1843
|
+
this.graphId = definition.graphId;
|
|
1844
|
+
this.name = definition.name;
|
|
1845
|
+
for (const node of definition.nodes) {
|
|
1846
|
+
this.nodes.set(node.id, node);
|
|
1847
|
+
}
|
|
1848
|
+
this.connections = [...definition.connections];
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
addNode(node) {
|
|
1852
|
+
if (this.nodes.has(node.id)) {
|
|
1853
|
+
throw new Error(`[EffectGraph] Node "${node.id}" already exists`);
|
|
1854
|
+
}
|
|
1855
|
+
this.nodes.set(node.id, node);
|
|
1856
|
+
return this;
|
|
1857
|
+
}
|
|
1858
|
+
addEdge(from, to) {
|
|
1859
|
+
if (!this.nodes.has(from)) throw new Error(`[EffectGraph] Unknown node "${from}"`);
|
|
1860
|
+
if (!this.nodes.has(to)) throw new Error(`[EffectGraph] Unknown node "${to}"`);
|
|
1861
|
+
this.edges.push({ from, to });
|
|
1862
|
+
return this;
|
|
1863
|
+
}
|
|
1864
|
+
removeNode(id) {
|
|
1865
|
+
this.nodes.delete(id);
|
|
1866
|
+
this.edges = this.edges.filter((e) => e.from !== id && e.to !== id);
|
|
1867
|
+
this.connections = this.connections.filter((c) => c.fromNode !== id && c.toNode !== id);
|
|
1868
|
+
return this;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Topological sort via Kahn's algorithm.
|
|
1872
|
+
* Returns nodes in render order or throws on circular dependency.
|
|
1873
|
+
*/
|
|
1874
|
+
resolve() {
|
|
1875
|
+
const inDegree = /* @__PURE__ */ new Map();
|
|
1876
|
+
const adjList = /* @__PURE__ */ new Map();
|
|
1877
|
+
for (const id of this.nodes.keys()) {
|
|
1878
|
+
inDegree.set(id, 0);
|
|
1879
|
+
adjList.set(id, []);
|
|
1880
|
+
}
|
|
1881
|
+
for (const edge of this.edges) {
|
|
1882
|
+
inDegree.set(edge.to, (inDegree.get(edge.to) ?? 0) + 1);
|
|
1883
|
+
adjList.get(edge.from).push(edge.to);
|
|
1884
|
+
}
|
|
1885
|
+
for (const conn of this.connections) {
|
|
1886
|
+
if (this.nodes.has(conn.fromNode) && this.nodes.has(conn.toNode)) {
|
|
1887
|
+
const neighbors = adjList.get(conn.fromNode) || [];
|
|
1888
|
+
if (!neighbors.includes(conn.toNode)) {
|
|
1889
|
+
neighbors.push(conn.toNode);
|
|
1890
|
+
adjList.set(conn.fromNode, neighbors);
|
|
1891
|
+
inDegree.set(conn.toNode, (inDegree.get(conn.toNode) ?? 0) + 1);
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
for (const [id, node] of this.nodes.entries()) {
|
|
1896
|
+
if (node.dependencies) {
|
|
1897
|
+
for (const depId of node.dependencies) {
|
|
1898
|
+
if (this.nodes.has(depId)) {
|
|
1899
|
+
const neighbors = adjList.get(depId) || [];
|
|
1900
|
+
if (!neighbors.includes(id)) {
|
|
1901
|
+
neighbors.push(id);
|
|
1902
|
+
adjList.set(depId, neighbors);
|
|
1903
|
+
inDegree.set(id, (inDegree.get(id) ?? 0) + 1);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
const queue = [];
|
|
1910
|
+
for (const [id, degree] of inDegree) {
|
|
1911
|
+
if (degree === 0) queue.push(id);
|
|
1912
|
+
}
|
|
1913
|
+
const sorted = [];
|
|
1914
|
+
while (queue.length > 0) {
|
|
1915
|
+
const id = queue.shift();
|
|
1916
|
+
sorted.push(this.nodes.get(id));
|
|
1917
|
+
for (const neighbour of adjList.get(id) ?? []) {
|
|
1918
|
+
const deg = (inDegree.get(neighbour) ?? 1) - 1;
|
|
1919
|
+
inDegree.set(neighbour, deg);
|
|
1920
|
+
if (deg === 0) queue.push(neighbour);
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
if (sorted.length !== this.nodes.size) {
|
|
1924
|
+
const cycle = [...this.nodes.keys()].filter((id) => (inDegree.get(id) ?? 0) > 0);
|
|
1925
|
+
throw new Error(`[EffectGraph] Circular dependency detected in nodes: ${cycle.join(", ")}`);
|
|
1926
|
+
}
|
|
1927
|
+
return sorted;
|
|
1928
|
+
}
|
|
1929
|
+
getExecutionOrder() {
|
|
1930
|
+
return this.resolve().map((node) => node.id);
|
|
1931
|
+
}
|
|
1932
|
+
getUpstreamNodes(nodeId) {
|
|
1933
|
+
const node = this.nodes.get(nodeId);
|
|
1934
|
+
const deps = node?.dependencies || [];
|
|
1935
|
+
const connected = this.connections.filter((conn) => conn.toNode === nodeId).map((conn) => conn.fromNode);
|
|
1936
|
+
return Array.from(/* @__PURE__ */ new Set([...deps, ...connected]));
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Returns only the PixiJS nodes in resolved order.
|
|
1940
|
+
* Used by EffectRenderer to build the PixiJS filter + motion pipeline.
|
|
1941
|
+
*/
|
|
1942
|
+
resolvePixi() {
|
|
1943
|
+
return this.resolve().filter((n) => n.effect?.backend === "pixi");
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Returns only the Canvas2D nodes in resolved order.
|
|
1947
|
+
* Used by EffectRenderer for text effect overlays.
|
|
1948
|
+
*/
|
|
1949
|
+
resolveCanvas2D() {
|
|
1950
|
+
return this.resolve().filter((n) => n.effect?.backend === "canvas2d");
|
|
1951
|
+
}
|
|
1952
|
+
get size() {
|
|
1953
|
+
return this.nodes.size;
|
|
1954
|
+
}
|
|
1955
|
+
clear() {
|
|
1956
|
+
this.nodes.clear();
|
|
1957
|
+
this.edges = [];
|
|
1958
|
+
this.connections = [];
|
|
1959
|
+
return this;
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1963
|
+
// src/videoEffects/EffectEngine.ts
|
|
1964
|
+
var EffectEngine = class {
|
|
1965
|
+
activeGraph = null;
|
|
1966
|
+
canvasPool = /* @__PURE__ */ new Map();
|
|
1967
|
+
constructor() {
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Set the active effect graph to execute
|
|
1971
|
+
*/
|
|
1972
|
+
loadGraph(graph) {
|
|
1973
|
+
this.activeGraph = graph;
|
|
1974
|
+
this.clearPool();
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Clear active graph and associated canvases
|
|
1978
|
+
*/
|
|
1979
|
+
unloadGraph() {
|
|
1980
|
+
this.activeGraph = null;
|
|
1981
|
+
this.clearPool();
|
|
1982
|
+
}
|
|
1983
|
+
/**
|
|
1984
|
+
* Evaluate node parameters at specific timestamp `t`
|
|
1985
|
+
*/
|
|
1986
|
+
evaluateParameters(node, time) {
|
|
1987
|
+
const params = { ...node.params };
|
|
1988
|
+
if (!node.keyframes) return params;
|
|
1989
|
+
for (const [key, track] of Object.entries(node.keyframes)) {
|
|
1990
|
+
if (!track || track.length === 0) continue;
|
|
1991
|
+
const sortedKeys = [...track].sort((a, b) => a.time - b.time);
|
|
1992
|
+
if (time <= sortedKeys[0].time) {
|
|
1993
|
+
params[key] = sortedKeys[0].value;
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
if (time >= sortedKeys[sortedKeys.length - 1].time) {
|
|
1997
|
+
params[key] = sortedKeys[sortedKeys.length - 1].value;
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
for (let i = 0; i < sortedKeys.length - 1; i++) {
|
|
2001
|
+
const k0 = sortedKeys[i];
|
|
2002
|
+
const k1 = sortedKeys[i + 1];
|
|
2003
|
+
if (time >= k0.time && time <= k1.time) {
|
|
2004
|
+
const tRange = k1.time - k0.time;
|
|
2005
|
+
const tProgress = tRange === 0 ? 0 : (time - k0.time) / tRange;
|
|
2006
|
+
const easedProgress = this.applyEasing(k0.easing, tProgress);
|
|
2007
|
+
params[key] = this.interpolate(k0.value, k1.value, easedProgress);
|
|
2008
|
+
break;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
return params;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Render the active graph onto a Canvas 2D Context
|
|
2016
|
+
*
|
|
2017
|
+
* @param ctx Target canvas context
|
|
2018
|
+
* @param time Timestamp relative to effect start
|
|
2019
|
+
* @param sourceTexture Optional raw image source
|
|
2020
|
+
*/
|
|
2021
|
+
render(ctx, time, sourceTexture) {
|
|
2022
|
+
if (!this.activeGraph) return;
|
|
2023
|
+
const width = ctx.canvas.width;
|
|
2024
|
+
const height = ctx.canvas.height;
|
|
2025
|
+
const execOrder = this.activeGraph.getExecutionOrder();
|
|
2026
|
+
const outputs = /* @__PURE__ */ new Map();
|
|
2027
|
+
for (const nodeId of execOrder) {
|
|
2028
|
+
const node = this.activeGraph.nodes.get(nodeId);
|
|
2029
|
+
const upstreams = this.activeGraph.getUpstreamNodes(nodeId);
|
|
2030
|
+
const buffer = this.acquireCanvas(nodeId, width, height);
|
|
2031
|
+
const bufferCtx = buffer.getContext("2d");
|
|
2032
|
+
bufferCtx.clearRect(0, 0, width, height);
|
|
2033
|
+
if (node.type === "source") {
|
|
2034
|
+
if (sourceTexture) {
|
|
2035
|
+
bufferCtx.drawImage(sourceTexture, 0, 0, width, height);
|
|
2036
|
+
}
|
|
2037
|
+
outputs.set(nodeId, buffer);
|
|
2038
|
+
} else {
|
|
2039
|
+
const evaluatedParams = this.evaluateParameters(node, time);
|
|
2040
|
+
const intensity = evaluatedParams.intensity ?? 1;
|
|
2041
|
+
if (upstreams.length > 0) {
|
|
2042
|
+
const mainInput = outputs.get(upstreams[0]);
|
|
2043
|
+
if (mainInput) {
|
|
2044
|
+
bufferCtx.drawImage(mainInput, 0, 0, width, height);
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
EffectRenderer.apply(bufferCtx, node.type, evaluatedParams, intensity, time);
|
|
2048
|
+
outputs.set(nodeId, buffer);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
const finalNodeId = execOrder[execOrder.length - 1];
|
|
2052
|
+
const finalFrame = outputs.get(finalNodeId);
|
|
2053
|
+
if (finalFrame) {
|
|
2054
|
+
ctx.drawImage(finalFrame, 0, 0, width, height);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Interpolate values (numbers or colors)
|
|
2059
|
+
*/
|
|
2060
|
+
interpolate(val0, val1, progress) {
|
|
2061
|
+
if (typeof val0 === "number" && typeof val1 === "number") {
|
|
2062
|
+
return val0 + (val1 - val0) * progress;
|
|
2063
|
+
}
|
|
2064
|
+
return progress < 0.5 ? val0 : val1;
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Easing curves mapping
|
|
2068
|
+
*/
|
|
2069
|
+
applyEasing(easing, t) {
|
|
2070
|
+
switch (easing) {
|
|
2071
|
+
case "ease-in":
|
|
2072
|
+
case "ease-in-quad":
|
|
2073
|
+
return t * t;
|
|
2074
|
+
case "ease-out":
|
|
2075
|
+
case "ease-out-quad":
|
|
2076
|
+
return t * (2 - t);
|
|
2077
|
+
case "ease-in-out":
|
|
2078
|
+
case "ease-in-out-quad":
|
|
2079
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
2080
|
+
case "linear":
|
|
2081
|
+
default:
|
|
2082
|
+
return t;
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Acquire Offscreen Canvas context from reuse pool
|
|
2087
|
+
*/
|
|
2088
|
+
acquireCanvas(nodeId, w, h) {
|
|
2089
|
+
let canvas = this.canvasPool.get(nodeId);
|
|
2090
|
+
if (!canvas) {
|
|
2091
|
+
canvas = document.createElement("canvas");
|
|
2092
|
+
this.canvasPool.set(nodeId, canvas);
|
|
2093
|
+
}
|
|
2094
|
+
if (canvas.width !== w || canvas.height !== h) {
|
|
2095
|
+
canvas.width = w;
|
|
2096
|
+
canvas.height = h;
|
|
2097
|
+
}
|
|
2098
|
+
return canvas;
|
|
2099
|
+
}
|
|
2100
|
+
clearPool() {
|
|
2101
|
+
this.canvasPool.clear();
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2104
|
+
|
|
2105
|
+
// src/videoEffects/utils/canvasUtils.ts
|
|
2106
|
+
function addNoise(ctx, amount) {
|
|
2107
|
+
const width = ctx.canvas.width;
|
|
2108
|
+
const height = ctx.canvas.height;
|
|
2109
|
+
const imageData = ctx.getImageData(0, 0, width, height);
|
|
2110
|
+
const data = imageData.data;
|
|
2111
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
2112
|
+
const noise = (Math.random() - 0.5) * 255 * amount;
|
|
2113
|
+
data[i] += noise;
|
|
2114
|
+
data[i + 1] += noise;
|
|
2115
|
+
data[i + 2] += noise;
|
|
2116
|
+
}
|
|
2117
|
+
ctx.putImageData(imageData, 0, 0);
|
|
2118
|
+
}
|
|
2119
|
+
function clearCanvas(ctx, color) {
|
|
2120
|
+
if (color) {
|
|
2121
|
+
ctx.fillStyle = color;
|
|
2122
|
+
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
2123
|
+
} else {
|
|
2124
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
function withContext(ctx, fn) {
|
|
2128
|
+
ctx.save();
|
|
2129
|
+
try {
|
|
2130
|
+
return fn(ctx);
|
|
2131
|
+
} finally {
|
|
2132
|
+
ctx.restore();
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// src/videoEffects/api.ts
|
|
2137
|
+
function getEffectPreviewUrl(effectId, category) {
|
|
2138
|
+
return `https://raw.githubusercontent.com/AIEraDev/clypra-api/main/public/effect-previews/${category}/${effectId}.webm`;
|
|
2139
|
+
}
|
|
2140
|
+
function effectMetadataToApi(metadata) {
|
|
2141
|
+
const previewUrl = getEffectPreviewUrl(metadata.id, metadata.category);
|
|
2142
|
+
return {
|
|
2143
|
+
id: metadata.id,
|
|
2144
|
+
name: metadata.name,
|
|
2145
|
+
type: "effect",
|
|
2146
|
+
category: metadata.category,
|
|
2147
|
+
description: metadata.description,
|
|
2148
|
+
thumbnail: generateThumbnailUrl(metadata.id),
|
|
2149
|
+
renderer: metadata.id,
|
|
2150
|
+
params: metadata.defaultParams,
|
|
2151
|
+
parameterSchema: metadata.parameterSchema,
|
|
2152
|
+
tags: metadata.tags,
|
|
2153
|
+
isPremium: metadata.premium,
|
|
2154
|
+
intensity: {
|
|
2155
|
+
min: 0,
|
|
2156
|
+
max: 1,
|
|
2157
|
+
default: 0.8,
|
|
2158
|
+
step: 0.01
|
|
2159
|
+
},
|
|
2160
|
+
previewUrl,
|
|
2161
|
+
previewDuration: 3,
|
|
2162
|
+
thumbnailUrl: generateThumbnailUrl(metadata.id)
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
function generateThumbnailUrl(effectId) {
|
|
2166
|
+
return `https://raw.githubusercontent.com/AIEraDev/clypra-api/main/public/effect-thumbnails/${effectId}.jpg`;
|
|
2167
|
+
}
|
|
2168
|
+
function getAllEffectsForApi() {
|
|
2169
|
+
return Object.values(EFFECTS_REGISTRY).map((metadata) => effectMetadataToApi(metadata));
|
|
2170
|
+
}
|
|
2171
|
+
function getEffectsByCategoryForApi(category) {
|
|
2172
|
+
const effects = getEffectsByCategory(category);
|
|
2173
|
+
return effects.map((metadata) => effectMetadataToApi(metadata));
|
|
2174
|
+
}
|
|
2175
|
+
function searchEffectsForApi(query) {
|
|
2176
|
+
const results = searchEffects(query);
|
|
2177
|
+
return results.map((metadata) => effectMetadataToApi(metadata));
|
|
2178
|
+
}
|
|
2179
|
+
function getEffectByIdForApi(id) {
|
|
2180
|
+
const metadata = getEffectMetadata(id);
|
|
2181
|
+
if (!metadata) return null;
|
|
2182
|
+
return effectMetadataToApi(metadata);
|
|
2183
|
+
}
|
|
2184
|
+
function getEffectCategoriesSummary() {
|
|
2185
|
+
const categories = /* @__PURE__ */ new Map();
|
|
2186
|
+
Object.values(EFFECTS_REGISTRY).forEach((effect) => {
|
|
2187
|
+
const cat = effect.category;
|
|
2188
|
+
if (!categories.has(cat)) {
|
|
2189
|
+
categories.set(cat, {
|
|
2190
|
+
count: 0,
|
|
2191
|
+
description: getCategoryDescription(cat)
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
categories.get(cat).count++;
|
|
2195
|
+
});
|
|
2196
|
+
return Array.from(categories.entries()).map(([id, data]) => ({
|
|
2197
|
+
id,
|
|
2198
|
+
name: capitalizeCategory(id),
|
|
2199
|
+
count: data.count,
|
|
2200
|
+
description: data.description
|
|
2201
|
+
}));
|
|
2202
|
+
}
|
|
2203
|
+
function getCategoryDescription(category) {
|
|
2204
|
+
const descriptions = {
|
|
2205
|
+
essentials: "Essential visual enhancements",
|
|
2206
|
+
glitch: "Digital glitches and VHS noise",
|
|
2207
|
+
retro: "Vintage film and nostalgic looks",
|
|
2208
|
+
light: "Lighting flares, glow, and leaks",
|
|
2209
|
+
motion: "Blur, camera movement, and speed",
|
|
2210
|
+
color: "Color corrections and grading",
|
|
2211
|
+
body: "Body tracking and segmentation effects"
|
|
2212
|
+
};
|
|
2213
|
+
return descriptions[category] || "";
|
|
2214
|
+
}
|
|
2215
|
+
function capitalizeCategory(category) {
|
|
2216
|
+
return category.charAt(0).toUpperCase() + category.slice(1);
|
|
2217
|
+
}
|
|
2218
|
+
function generateEffectsManifest() {
|
|
2219
|
+
return {
|
|
2220
|
+
version: "1.0.0",
|
|
2221
|
+
totalCount: Object.keys(EFFECTS_REGISTRY).length,
|
|
2222
|
+
categories: getEffectCategoriesSummary(),
|
|
2223
|
+
effects: getAllEffectsForApi()
|
|
2224
|
+
};
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
// src/videoEffects/EffectDefinition.ts
|
|
2228
|
+
function isCanvas2DEffect(e) {
|
|
2229
|
+
return e.backend === "canvas2d";
|
|
2230
|
+
}
|
|
2231
|
+
function isPixiEffect(e) {
|
|
2232
|
+
return e.backend === "pixi";
|
|
2233
|
+
}
|
|
2234
|
+
function isFilterEffect(e) {
|
|
2235
|
+
return isPixiEffect(e) && e.subtype === "filter";
|
|
2236
|
+
}
|
|
2237
|
+
function isMotionEffect(e) {
|
|
2238
|
+
return isPixiEffect(e) && e.subtype === "motion";
|
|
2239
|
+
}
|
|
2240
|
+
function isCompositeEffect(e) {
|
|
2241
|
+
return isPixiEffect(e) && e.subtype === "composite";
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
// src/videoEffects/PixiRenderer.ts
|
|
2245
|
+
var import_pixi = require("pixi.js");
|
|
2246
|
+
var PixiRenderer = class {
|
|
2247
|
+
app = null;
|
|
2248
|
+
videoSprite = null;
|
|
2249
|
+
overlayContainer = null;
|
|
2250
|
+
mounted = /* @__PURE__ */ new Map();
|
|
2251
|
+
initialized = false;
|
|
2252
|
+
/**
|
|
2253
|
+
* Initialize the PixiJS Application.
|
|
2254
|
+
* Call once, reuse across effect changes.
|
|
2255
|
+
*
|
|
2256
|
+
* @param canvas The target HTMLCanvasElement (Studio preview or rasterizer offscreen canvas)
|
|
2257
|
+
* @param width Canvas width in pixels
|
|
2258
|
+
* @param height Canvas height in pixels
|
|
2259
|
+
*/
|
|
2260
|
+
async init(canvas, width, height) {
|
|
2261
|
+
if (this.initialized) return;
|
|
2262
|
+
this.app = new import_pixi.Application();
|
|
2263
|
+
await this.app.init({
|
|
2264
|
+
canvas,
|
|
2265
|
+
width,
|
|
2266
|
+
height,
|
|
2267
|
+
backgroundAlpha: 0,
|
|
2268
|
+
// transparent — composited over video below
|
|
2269
|
+
antialias: true,
|
|
2270
|
+
preference: "webgl",
|
|
2271
|
+
// WebGL for production stability; swap to 'webgpu' later
|
|
2272
|
+
resolution: typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1,
|
|
2273
|
+
autoDensity: true,
|
|
2274
|
+
preserveDrawingBuffer: true
|
|
2275
|
+
});
|
|
2276
|
+
this.videoSprite = new import_pixi.Sprite();
|
|
2277
|
+
this.videoSprite.width = width;
|
|
2278
|
+
this.videoSprite.height = height;
|
|
2279
|
+
this.overlayContainer = new import_pixi.Container();
|
|
2280
|
+
this.app.stage.addChild(this.videoSprite);
|
|
2281
|
+
this.app.stage.addChild(this.overlayContainer);
|
|
2282
|
+
this.initialized = true;
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Point the video sprite at a live HTMLVideoElement.
|
|
2286
|
+
* PixiJS polls the video element each frame automatically.
|
|
2287
|
+
*/
|
|
2288
|
+
setVideoSource(video) {
|
|
2289
|
+
if (!this.videoSprite || !this.app) return;
|
|
2290
|
+
import("pixi.js").then(({ VideoSource, Texture }) => {
|
|
2291
|
+
const source = new VideoSource({ resource: video, autoPlay: false });
|
|
2292
|
+
const texture = new Texture({ source });
|
|
2293
|
+
this.videoSprite.texture = texture;
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
setImageSource(image) {
|
|
2297
|
+
if (!this.videoSprite || !this.app) return;
|
|
2298
|
+
import("pixi.js").then(({ Texture }) => {
|
|
2299
|
+
const texture = Texture.from(image);
|
|
2300
|
+
this.videoSprite.texture = texture;
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
// -------------------------------------------------------------------------
|
|
2304
|
+
// Effect lifecycle
|
|
2305
|
+
// -------------------------------------------------------------------------
|
|
2306
|
+
/**
|
|
2307
|
+
* Mount a resolved set of PixiJS graph nodes.
|
|
2308
|
+
* Builds filter chains and initialises motion effects.
|
|
2309
|
+
* Previously mounted effects NOT in the new list are unmounted.
|
|
2310
|
+
*/
|
|
2311
|
+
applyNodes(nodes, globalParams) {
|
|
2312
|
+
if (!this.app || !this.videoSprite || !this.overlayContainer) {
|
|
2313
|
+
throw new Error("[PixiRenderer] call init() before applyNodes()");
|
|
2314
|
+
}
|
|
2315
|
+
const incomingIds = new Set(nodes.map((n) => n.id));
|
|
2316
|
+
for (const [id, mounted] of this.mounted) {
|
|
2317
|
+
if (!incomingIds.has(id)) {
|
|
2318
|
+
this._unmount(mounted);
|
|
2319
|
+
this.mounted.delete(id);
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
const filterChain = [];
|
|
2323
|
+
for (const node of nodes) {
|
|
2324
|
+
const def = node.effect;
|
|
2325
|
+
if (!isPixiEffect(def)) continue;
|
|
2326
|
+
const params = globalParams?.get(node.id) ?? this._defaultParams(def);
|
|
2327
|
+
if (this.mounted.has(node.id)) {
|
|
2328
|
+
const m = this.mounted.get(node.id);
|
|
2329
|
+
Object.assign(m.params, params);
|
|
2330
|
+
Object.assign(m.ctx.params, params);
|
|
2331
|
+
if (m.filters && m.definition.filterSpec?.updateUniforms) {
|
|
2332
|
+
m.definition.filterSpec.updateUniforms(
|
|
2333
|
+
m.filters.length === 1 ? m.filters[0] : m.filters,
|
|
2334
|
+
m.params,
|
|
2335
|
+
0
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
if (m.filters) filterChain.push(...m.filters);
|
|
2339
|
+
continue;
|
|
2340
|
+
}
|
|
2341
|
+
const ctx = {
|
|
2342
|
+
app: this.app,
|
|
2343
|
+
container: this.overlayContainer,
|
|
2344
|
+
ticker: this.app.ticker,
|
|
2345
|
+
params,
|
|
2346
|
+
width: this.app.screen.width,
|
|
2347
|
+
height: this.app.screen.height
|
|
2348
|
+
};
|
|
2349
|
+
let filters = null;
|
|
2350
|
+
let tickerFn = void 0;
|
|
2351
|
+
if ((isFilterEffect(def) || isCompositeEffect(def)) && def.filterSpec) {
|
|
2352
|
+
const result = def.filterSpec.create(params);
|
|
2353
|
+
filters = Array.isArray(result) ? result : [result];
|
|
2354
|
+
filterChain.push(...filters);
|
|
2355
|
+
if (def.filterSpec.updateUniforms) {
|
|
2356
|
+
const spec = def.filterSpec;
|
|
2357
|
+
const elapsed = { value: 0 };
|
|
2358
|
+
tickerFn = (ticker) => {
|
|
2359
|
+
elapsed.value += ticker.deltaMS;
|
|
2360
|
+
if (filters) {
|
|
2361
|
+
spec.updateUniforms(
|
|
2362
|
+
filters.length === 1 ? filters[0] : filters,
|
|
2363
|
+
params,
|
|
2364
|
+
elapsed.value
|
|
2365
|
+
);
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
this.app.ticker.add(tickerFn);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
if ((isMotionEffect(def) || isCompositeEffect(def)) && def.mount) {
|
|
2372
|
+
def.mount(ctx);
|
|
2373
|
+
}
|
|
2374
|
+
this.mounted.set(node.id, { node, definition: def, params, filters, ctx, tickerFn });
|
|
2375
|
+
}
|
|
2376
|
+
this.videoSprite.filters = filterChain.length > 0 ? filterChain : null;
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Update multiple params on a mounted effect in one pass.
|
|
2380
|
+
*/
|
|
2381
|
+
updateParams(nodeId, params) {
|
|
2382
|
+
const m = this.mounted.get(nodeId);
|
|
2383
|
+
if (!m) return;
|
|
2384
|
+
Object.assign(m.params, params);
|
|
2385
|
+
Object.assign(m.ctx.params, params);
|
|
2386
|
+
if (m.filters && m.definition.filterSpec?.updateUniforms) {
|
|
2387
|
+
m.definition.filterSpec.updateUniforms(
|
|
2388
|
+
m.filters.length === 1 ? m.filters[0] : m.filters,
|
|
2389
|
+
m.params,
|
|
2390
|
+
0
|
|
2391
|
+
);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
/**
|
|
2395
|
+
* Force a render pass (required for static image previews after uniform changes).
|
|
2396
|
+
*/
|
|
2397
|
+
render() {
|
|
2398
|
+
if (!this.app) return;
|
|
2399
|
+
this.app.renderer.render({ container: this.app.stage });
|
|
2400
|
+
}
|
|
2401
|
+
/**
|
|
2402
|
+
* Update a single param on a mounted effect.
|
|
2403
|
+
* Triggers uniform refresh and calls onParamChange lifecycle hook.
|
|
2404
|
+
*/
|
|
2405
|
+
updateParam(nodeId, key, value) {
|
|
2406
|
+
const m = this.mounted.get(nodeId);
|
|
2407
|
+
if (!m) return;
|
|
2408
|
+
m.params[key] = value;
|
|
2409
|
+
m.ctx.params[key] = value;
|
|
2410
|
+
if (m.filters && m.definition.filterSpec?.updateUniforms) {
|
|
2411
|
+
m.definition.filterSpec.updateUniforms(
|
|
2412
|
+
m.filters.length === 1 ? m.filters[0] : m.filters,
|
|
2413
|
+
m.params,
|
|
2414
|
+
0
|
|
2415
|
+
);
|
|
2416
|
+
}
|
|
2417
|
+
m.definition.onParamChange?.(m.ctx, key, value);
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Capture the current rendered frame as an ImageData.
|
|
2421
|
+
* Used by the Desktop rasterizer to extract pixels for FFmpeg.
|
|
2422
|
+
*/
|
|
2423
|
+
captureFrame() {
|
|
2424
|
+
if (!this.app) return null;
|
|
2425
|
+
const canvas = this.app.canvas;
|
|
2426
|
+
const ctx = canvas.getContext("2d");
|
|
2427
|
+
if (!ctx) return null;
|
|
2428
|
+
return ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
2429
|
+
}
|
|
2430
|
+
/**
|
|
2431
|
+
* Resize the renderer (e.g. when project resolution changes).
|
|
2432
|
+
*/
|
|
2433
|
+
resize(width, height) {
|
|
2434
|
+
if (!this.app) return;
|
|
2435
|
+
this.app.renderer.resize(width, height);
|
|
2436
|
+
if (this.videoSprite) {
|
|
2437
|
+
this.videoSprite.width = width;
|
|
2438
|
+
this.videoSprite.height = height;
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
/**
|
|
2442
|
+
* Full teardown — unmounts all effects, destroys the PixiJS Application.
|
|
2443
|
+
* Call when the editor session ends or the Studio workspace unmounts.
|
|
2444
|
+
*/
|
|
2445
|
+
destroy() {
|
|
2446
|
+
for (const mounted of this.mounted.values()) {
|
|
2447
|
+
this._unmount(mounted);
|
|
2448
|
+
}
|
|
2449
|
+
this.mounted.clear();
|
|
2450
|
+
this.app?.destroy(false, { children: true, texture: true });
|
|
2451
|
+
this.app = null;
|
|
2452
|
+
this.videoSprite = null;
|
|
2453
|
+
this.overlayContainer = null;
|
|
2454
|
+
this.initialized = false;
|
|
2455
|
+
}
|
|
2456
|
+
// -------------------------------------------------------------------------
|
|
2457
|
+
// Private helpers
|
|
2458
|
+
// -------------------------------------------------------------------------
|
|
2459
|
+
_unmount(m) {
|
|
2460
|
+
if ((isMotionEffect(m.definition) || isCompositeEffect(m.definition)) && m.definition.unmount) {
|
|
2461
|
+
m.definition.unmount(m.ctx);
|
|
2462
|
+
}
|
|
2463
|
+
if (m.tickerFn && this.app) {
|
|
2464
|
+
this.app.ticker.remove(m.tickerFn);
|
|
2465
|
+
}
|
|
2466
|
+
if (m.filters) {
|
|
2467
|
+
for (const f of m.filters) f.destroy();
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
_defaultParams(def) {
|
|
2471
|
+
return Object.fromEntries(def.params.map((p) => [p.key, p.value]));
|
|
2472
|
+
}
|
|
2473
|
+
getApp() {
|
|
2474
|
+
return this.app;
|
|
2475
|
+
}
|
|
2476
|
+
getVideoSprite() {
|
|
2477
|
+
return this.videoSprite;
|
|
2478
|
+
}
|
|
2479
|
+
get isReady() {
|
|
2480
|
+
return this.initialized;
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
|
|
2484
|
+
// src/videoEffects/example.ts
|
|
2485
|
+
var example_exports = {};
|
|
2486
|
+
__export(example_exports, {
|
|
2487
|
+
NeonGlowEffect: () => NeonGlowEffect,
|
|
2488
|
+
ParticleBurstEffect: () => ParticleBurstEffect,
|
|
2489
|
+
VHSCompositeEffect: () => VHSCompositeEffect
|
|
2490
|
+
});
|
|
2491
|
+
var import_pixi2 = require("pixi.js");
|
|
2492
|
+
var hexToRgb = (hex) => {
|
|
2493
|
+
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
2494
|
+
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
2495
|
+
const b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
2496
|
+
return [r, g, b];
|
|
2497
|
+
};
|
|
2498
|
+
var hexToDec = (hex) => parseInt(hex.replace("#", ""), 16);
|
|
2499
|
+
var DEFAULT_VERTEX_SHADER = `
|
|
2500
|
+
in vec2 aPosition;
|
|
2501
|
+
out vec2 vTextureCoord;
|
|
2502
|
+
|
|
2503
|
+
uniform vec4 uInputSize;
|
|
2504
|
+
uniform vec4 uOutputFrame;
|
|
2505
|
+
|
|
2506
|
+
vec4 filterVertexPosition(void) {
|
|
2507
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
2508
|
+
return vec4(position * uInputSize.zw * 2.0 - 1.0, 0.0, 1.0);
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
vec2 filterTextureCoord(void) {
|
|
2512
|
+
return aPosition * (uOutputFrame.zw * uInputSize.xy);
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
void main(void) {
|
|
2516
|
+
gl_Position = filterVertexPosition();
|
|
2517
|
+
vTextureCoord = filterTextureCoord();
|
|
2518
|
+
}
|
|
2519
|
+
`;
|
|
2520
|
+
var NeonGlowEffect = {
|
|
2521
|
+
backend: "pixi",
|
|
2522
|
+
subtype: "filter",
|
|
2523
|
+
id: "neon-glow",
|
|
2524
|
+
name: "Neon Glow",
|
|
2525
|
+
category: "neon",
|
|
2526
|
+
description: "GPU chromatic aberration with pulsing glow. Zero CPU cost per frame.",
|
|
2527
|
+
tags: ["glow", "neon", "chromatic", "aberration", "rgb"],
|
|
2528
|
+
thumbnail: "https://clypra-worker-api.abdulkabirmusa.com/thumbnails/neon-glow.webp",
|
|
2529
|
+
params: [
|
|
2530
|
+
{ key: "spread", label: "Spread", type: "range", value: 4, min: 0, max: 20, step: 0.5 },
|
|
2531
|
+
{ key: "strength", label: "Glow strength", type: "range", value: 0.6, min: 0, max: 1, step: 0.01 },
|
|
2532
|
+
{ key: "color", label: "Glow color", type: "color", value: "#7C6FFF" },
|
|
2533
|
+
{ key: "pulse", label: "Pulse", type: "toggle", value: true },
|
|
2534
|
+
{ key: "pulseSpeed", label: "Pulse speed", type: "range", value: 1.5, min: 0.1, max: 5, step: 0.1 }
|
|
2535
|
+
],
|
|
2536
|
+
filterSpec: {
|
|
2537
|
+
create(params) {
|
|
2538
|
+
const fragment = `
|
|
2539
|
+
in vec2 vTextureCoord;
|
|
2540
|
+
out vec4 finalColor;
|
|
2541
|
+
|
|
2542
|
+
uniform sampler2D uTexture;
|
|
2543
|
+
uniform float uSpread;
|
|
2544
|
+
uniform float uStrength;
|
|
2545
|
+
uniform vec3 uGlowColor;
|
|
2546
|
+
uniform float uTime;
|
|
2547
|
+
uniform bool uPulse;
|
|
2548
|
+
uniform float uPulseSpeed;
|
|
2549
|
+
|
|
2550
|
+
void main(void) {
|
|
2551
|
+
vec2 uv = vTextureCoord;
|
|
2552
|
+
|
|
2553
|
+
// Chromatic aberration \u2014 shift R and B channels outward from center
|
|
2554
|
+
vec2 dir = uv - 0.5;
|
|
2555
|
+
float dist = length(dir) * uSpread * 0.01;
|
|
2556
|
+
vec2 redUV = uv + dir * dist;
|
|
2557
|
+
vec2 blueUV = uv - dir * dist;
|
|
2558
|
+
|
|
2559
|
+
float r = texture(uTexture, redUV).r;
|
|
2560
|
+
float g = texture(uTexture, uv).g;
|
|
2561
|
+
float b = texture(uTexture, blueUV).b;
|
|
2562
|
+
float a = texture(uTexture, uv).a;
|
|
2563
|
+
|
|
2564
|
+
vec4 base = vec4(r, g, b, a);
|
|
2565
|
+
|
|
2566
|
+
// Soft glow overlay \u2014 animated pulse
|
|
2567
|
+
float pulse = uPulse
|
|
2568
|
+
? 0.5 + 0.5 * sin(uTime * uPulseSpeed * 6.28318)
|
|
2569
|
+
: 1.0;
|
|
2570
|
+
float glow = uStrength * pulse;
|
|
2571
|
+
|
|
2572
|
+
// Additive blend of glow color onto base
|
|
2573
|
+
vec3 glowContrib = uGlowColor * glow * base.a;
|
|
2574
|
+
finalColor = vec4(base.rgb + glowContrib, base.a);
|
|
2575
|
+
}
|
|
2576
|
+
`;
|
|
2577
|
+
const rgb = hexToRgb(params.color);
|
|
2578
|
+
return import_pixi2.Filter.from({
|
|
2579
|
+
gl: { vertex: DEFAULT_VERTEX_SHADER, fragment },
|
|
2580
|
+
resources: {
|
|
2581
|
+
uniforms: {
|
|
2582
|
+
uSpread: { value: params.spread, type: "f32" },
|
|
2583
|
+
uStrength: { value: params.strength, type: "f32" },
|
|
2584
|
+
uGlowColor: { value: rgb, type: "vec3<f32>" },
|
|
2585
|
+
uTime: { value: 0, type: "f32" },
|
|
2586
|
+
uPulse: { value: params.pulse, type: "bool" },
|
|
2587
|
+
uPulseSpeed: { value: params.pulseSpeed, type: "f32" }
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2591
|
+
},
|
|
2592
|
+
updateUniforms(filter, params, elapsed) {
|
|
2593
|
+
const uniforms = filter.resources?.uniforms?.uniforms;
|
|
2594
|
+
if (!uniforms) return;
|
|
2595
|
+
uniforms.uTime = elapsed / 1e3;
|
|
2596
|
+
uniforms.uSpread = params.spread;
|
|
2597
|
+
uniforms.uStrength = params.strength;
|
|
2598
|
+
uniforms.uPulse = params.pulse;
|
|
2599
|
+
uniforms.uPulseSpeed = params.pulseSpeed;
|
|
2600
|
+
const hex = params.color;
|
|
2601
|
+
uniforms.uGlowColor = hexToRgb(hex);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
};
|
|
2605
|
+
var ParticleBurstEffect = {
|
|
2606
|
+
backend: "pixi",
|
|
2607
|
+
subtype: "motion",
|
|
2608
|
+
id: "particle-burst",
|
|
2609
|
+
name: "Particle Burst",
|
|
2610
|
+
category: "particle",
|
|
2611
|
+
description: "Ticker-driven particle system. Emits from center, fades out on edges.",
|
|
2612
|
+
tags: ["particle", "burst", "motion", "overlay"],
|
|
2613
|
+
thumbnail: "https://clypra-worker-api.abdulkabirmusa.com/thumbnails/particle-burst.webp",
|
|
2614
|
+
params: [
|
|
2615
|
+
{ key: "count", label: "Particle count", type: "range", value: 80, min: 10, max: 300, step: 10 },
|
|
2616
|
+
{ key: "speed", label: "Speed", type: "range", value: 2, min: 0.5, max: 8, step: 0.5 },
|
|
2617
|
+
{ key: "size", label: "Size", type: "range", value: 4, min: 1, max: 12, step: 1 },
|
|
2618
|
+
{ key: "color", label: "Particle color", type: "color", value: "#7C6FFF" },
|
|
2619
|
+
{ key: "fade", label: "Fade out", type: "toggle", value: true }
|
|
2620
|
+
],
|
|
2621
|
+
mount(ctx) {
|
|
2622
|
+
;
|
|
2623
|
+
ctx._particleContainer = new import_pixi2.Container();
|
|
2624
|
+
ctx.container.addChild(ctx._particleContainer);
|
|
2625
|
+
const particles = [];
|
|
2626
|
+
ctx._particles = particles;
|
|
2627
|
+
const emit = () => {
|
|
2628
|
+
const count = ctx.params.count;
|
|
2629
|
+
while (particles.length < count) {
|
|
2630
|
+
const angle = Math.random() * Math.PI * 2;
|
|
2631
|
+
const speed = ctx.params.speed * (0.5 + Math.random());
|
|
2632
|
+
const gfx = new import_pixi2.Graphics();
|
|
2633
|
+
gfx.circle(0, 0, ctx.params.size);
|
|
2634
|
+
gfx.fill({ color: hexToDec(ctx.params.color), alpha: 0.9 });
|
|
2635
|
+
gfx.x = ctx.width / 2 + (Math.random() - 0.5) * ctx.width * 0.3;
|
|
2636
|
+
gfx.y = ctx.height / 2 + (Math.random() - 0.5) * ctx.height * 0.3;
|
|
2637
|
+
ctx._particleContainer.addChild(gfx);
|
|
2638
|
+
const maxLife = 60 + Math.random() * 60;
|
|
2639
|
+
particles.push({ gfx, vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed, life: maxLife, maxLife });
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
ctx._tickerFn = (ticker) => {
|
|
2643
|
+
emit();
|
|
2644
|
+
for (let i = particles.length - 1; i >= 0; i--) {
|
|
2645
|
+
const p = particles[i];
|
|
2646
|
+
p.gfx.x += p.vx;
|
|
2647
|
+
p.gfx.y += p.vy;
|
|
2648
|
+
p.life -= ticker.deltaTime;
|
|
2649
|
+
if (ctx.params.fade) {
|
|
2650
|
+
p.gfx.alpha = Math.max(0, p.life / p.maxLife);
|
|
2651
|
+
}
|
|
2652
|
+
if (p.life <= 0 || p.gfx.x < -20 || p.gfx.x > ctx.width + 20 || p.gfx.y < -20 || p.gfx.y > ctx.height + 20) {
|
|
2653
|
+
p.life = p.maxLife;
|
|
2654
|
+
p.gfx.x = ctx.width / 2 + (Math.random() - 0.5) * ctx.width * 0.3;
|
|
2655
|
+
p.gfx.y = ctx.height / 2 + (Math.random() - 0.5) * ctx.height * 0.3;
|
|
2656
|
+
p.gfx.alpha = 1;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
ctx.ticker.add(ctx._tickerFn);
|
|
2661
|
+
},
|
|
2662
|
+
unmount(ctx) {
|
|
2663
|
+
if (ctx._tickerFn) {
|
|
2664
|
+
ctx.ticker.remove(ctx._tickerFn);
|
|
2665
|
+
}
|
|
2666
|
+
if (ctx._particleContainer) {
|
|
2667
|
+
ctx.container.removeChild(ctx._particleContainer);
|
|
2668
|
+
ctx._particleContainer.destroy({ children: true });
|
|
2669
|
+
}
|
|
2670
|
+
},
|
|
2671
|
+
onParamChange(ctx, key, value) {
|
|
2672
|
+
if (key === "color") {
|
|
2673
|
+
for (const p of ctx._particles ?? []) {
|
|
2674
|
+
p.gfx.clear();
|
|
2675
|
+
p.gfx.circle(0, 0, ctx.params.size);
|
|
2676
|
+
p.gfx.fill({ color: hexToDec(value), alpha: 0.9 });
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
};
|
|
2681
|
+
var VHSCompositeEffect = {
|
|
2682
|
+
backend: "pixi",
|
|
2683
|
+
subtype: "composite",
|
|
2684
|
+
id: "vhs-composite",
|
|
2685
|
+
name: "VHS",
|
|
2686
|
+
category: "retro",
|
|
2687
|
+
description: "Classic VHS look: scanlines + noise shader with animated glitch band overlay.",
|
|
2688
|
+
tags: ["vhs", "retro", "glitch", "scanlines", "noise", "composite"],
|
|
2689
|
+
thumbnail: "https://clypra-worker-api.abdulkabirmusa.com/thumbnails/vhs-composite.webp",
|
|
2690
|
+
params: [
|
|
2691
|
+
{ key: "noise", label: "Noise", type: "range", value: 0.08, min: 0, max: 0.3, step: 0.01 },
|
|
2692
|
+
{ key: "scanlines", label: "Scanlines", type: "toggle", value: true },
|
|
2693
|
+
{ key: "lineAlpha", label: "Line alpha", type: "range", value: 0.25, min: 0, max: 1, step: 0.05 },
|
|
2694
|
+
{ key: "hShift", label: "H-shift", type: "range", value: 3e-3, min: 0, max: 0.02, step: 1e-3 },
|
|
2695
|
+
{ key: "bandSpeed", label: "Band speed", type: "range", value: 1.2, min: 0.1, max: 5, step: 0.1 },
|
|
2696
|
+
{ key: "bandAlpha", label: "Band alpha", type: "range", value: 0.35, min: 0, max: 1, step: 0.05 }
|
|
2697
|
+
],
|
|
2698
|
+
// ── Filter part ──────────────────────────────────────────────────────────
|
|
2699
|
+
filterSpec: {
|
|
2700
|
+
create(params) {
|
|
2701
|
+
const fragment = `
|
|
2702
|
+
in vec2 vTextureCoord;
|
|
2703
|
+
out vec4 finalColor;
|
|
2704
|
+
|
|
2705
|
+
uniform sampler2D uTexture;
|
|
2706
|
+
uniform float uNoise;
|
|
2707
|
+
uniform bool uScanlines;
|
|
2708
|
+
uniform float uLineAlpha;
|
|
2709
|
+
uniform float uHShift;
|
|
2710
|
+
uniform float uTime;
|
|
2711
|
+
|
|
2712
|
+
float rand(vec2 co) {
|
|
2713
|
+
return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
void main(void) {
|
|
2717
|
+
vec2 uv = vTextureCoord;
|
|
2718
|
+
|
|
2719
|
+
// Horizontal shift on random bands
|
|
2720
|
+
float bandY = floor(uv.y * 240.0) / 240.0;
|
|
2721
|
+
float shift = (rand(vec2(bandY, floor(uTime * 15.0))) - 0.5) * uHShift;
|
|
2722
|
+
uv.x += shift;
|
|
2723
|
+
|
|
2724
|
+
vec4 color = texture(uTexture, clamp(uv, 0.0, 1.0));
|
|
2725
|
+
|
|
2726
|
+
// Noise grain
|
|
2727
|
+
float grain = rand(uv + uTime) * uNoise;
|
|
2728
|
+
color.rgb += grain;
|
|
2729
|
+
|
|
2730
|
+
// Scanlines
|
|
2731
|
+
if (uScanlines) {
|
|
2732
|
+
float line = step(0.5, fract(vTextureCoord.y * 240.0));
|
|
2733
|
+
color.rgb = mix(color.rgb, color.rgb * 0.7, line * uLineAlpha);
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
// Slight desaturation for the washed-out VHS look
|
|
2737
|
+
float luma = dot(color.rgb, vec3(0.299, 0.587, 0.114));
|
|
2738
|
+
color.rgb = mix(vec3(luma), color.rgb, 0.75);
|
|
2739
|
+
|
|
2740
|
+
finalColor = color;
|
|
2741
|
+
}
|
|
2742
|
+
`;
|
|
2743
|
+
return import_pixi2.Filter.from({
|
|
2744
|
+
gl: { vertex: DEFAULT_VERTEX_SHADER, fragment },
|
|
2745
|
+
resources: {
|
|
2746
|
+
uniforms: {
|
|
2747
|
+
uNoise: { value: params.noise, type: "f32" },
|
|
2748
|
+
uScanlines: { value: params.scanlines, type: "bool" },
|
|
2749
|
+
uLineAlpha: { value: params.lineAlpha, type: "f32" },
|
|
2750
|
+
uHShift: { value: params.hShift, type: "f32" },
|
|
2751
|
+
uTime: { value: 0, type: "f32" }
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
},
|
|
2756
|
+
updateUniforms(filter, params, elapsed) {
|
|
2757
|
+
const uniforms = filter.resources?.uniforms?.uniforms;
|
|
2758
|
+
if (!uniforms) return;
|
|
2759
|
+
uniforms.uTime = elapsed / 1e3;
|
|
2760
|
+
uniforms.uNoise = params.noise;
|
|
2761
|
+
uniforms.uScanlines = params.scanlines;
|
|
2762
|
+
uniforms.uLineAlpha = params.lineAlpha;
|
|
2763
|
+
uniforms.uHShift = params.hShift;
|
|
2764
|
+
}
|
|
2765
|
+
},
|
|
2766
|
+
// ── Motion part (animated glitch band) ───────────────────────────────────
|
|
2767
|
+
mount(ctx) {
|
|
2768
|
+
const band = new import_pixi2.Graphics();
|
|
2769
|
+
ctx._vhsBand = band;
|
|
2770
|
+
ctx._bandY = Math.random() * ctx.height;
|
|
2771
|
+
const draw = () => {
|
|
2772
|
+
band.clear();
|
|
2773
|
+
band.rect(0, ctx._bandY, ctx.width, 8);
|
|
2774
|
+
band.fill({ color: 16777215, alpha: ctx.params.bandAlpha });
|
|
2775
|
+
};
|
|
2776
|
+
draw();
|
|
2777
|
+
ctx.container.addChild(band);
|
|
2778
|
+
ctx._tickerFn = (ticker) => {
|
|
2779
|
+
;
|
|
2780
|
+
ctx._bandY += ctx.params.bandSpeed * ticker.deltaTime;
|
|
2781
|
+
if (ctx._bandY > ctx.height + 20) ctx._bandY = -20;
|
|
2782
|
+
draw();
|
|
2783
|
+
};
|
|
2784
|
+
ctx.ticker.add(ctx._tickerFn);
|
|
2785
|
+
},
|
|
2786
|
+
unmount(ctx) {
|
|
2787
|
+
if (ctx._tickerFn) ctx.ticker.remove(ctx._tickerFn);
|
|
2788
|
+
if (ctx._vhsBand) {
|
|
2789
|
+
ctx.container.removeChild(ctx._vhsBand);
|
|
2790
|
+
ctx._vhsBand.destroy();
|
|
2791
|
+
}
|
|
2792
|
+
},
|
|
2793
|
+
onParamChange(ctx, key) {
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
|
|
2797
|
+
// src/videoEffects/renderers/camera/index.ts
|
|
2798
|
+
var camera_exports = {};
|
|
2799
|
+
__export(camera_exports, {
|
|
2800
|
+
renderDolly: () => renderDolly,
|
|
2801
|
+
renderPan: () => renderPan,
|
|
2802
|
+
renderRotate: () => renderRotate,
|
|
2803
|
+
renderShake: () => renderShake,
|
|
2804
|
+
renderZoom: () => renderZoom
|
|
2805
|
+
});
|
|
2806
|
+
|
|
2807
|
+
// src/videoEffects/renderers/camera/shake.ts
|
|
2808
|
+
function renderShake(ctx, params, intensity, time) {
|
|
2809
|
+
const shakeIntensity = (params.intensity || 50) * intensity;
|
|
2810
|
+
const frequency = params.frequency || 10;
|
|
2811
|
+
const offsetX = Math.sin(time * frequency) * shakeIntensity;
|
|
2812
|
+
const offsetY = Math.cos(time * frequency * 1.3) * shakeIntensity;
|
|
2813
|
+
ctx.translate(offsetX, offsetY);
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
// src/videoEffects/renderers/camera/zoom.ts
|
|
2817
|
+
function renderZoom(ctx, params, intensity, time) {
|
|
2818
|
+
const scale = 1 + (params.scale || 0.2) * intensity;
|
|
2819
|
+
const centerX = params.centerX || 0.5;
|
|
2820
|
+
const centerY = params.centerY || 0.5;
|
|
2821
|
+
const width = ctx.canvas.width;
|
|
2822
|
+
const height = ctx.canvas.height;
|
|
2823
|
+
ctx.translate(width * centerX, height * centerY);
|
|
2824
|
+
ctx.scale(scale, scale);
|
|
2825
|
+
ctx.translate(-width * centerX, -height * centerY);
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
// src/videoEffects/renderers/camera/pan.ts
|
|
2829
|
+
function renderPan(ctx, params, intensity, time) {
|
|
2830
|
+
const panX = (params.panX || 0) * intensity;
|
|
2831
|
+
const panY = (params.panY || 0) * intensity;
|
|
2832
|
+
ctx.translate(panX, panY);
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
// src/videoEffects/renderers/camera/rotate.ts
|
|
2836
|
+
function renderRotate(ctx, params, intensity, time) {
|
|
2837
|
+
const angle = (params.angle || 0) * intensity * (Math.PI / 180);
|
|
2838
|
+
const width = ctx.canvas.width;
|
|
2839
|
+
const height = ctx.canvas.height;
|
|
2840
|
+
ctx.translate(width / 2, height / 2);
|
|
2841
|
+
ctx.rotate(angle);
|
|
2842
|
+
ctx.translate(-width / 2, -height / 2);
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
// src/videoEffects/renderers/camera/dolly.ts
|
|
2846
|
+
function renderDolly(ctx, params, intensity, time) {
|
|
2847
|
+
renderZoom(ctx, params, intensity, time);
|
|
2848
|
+
}
|
|
2849
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2850
|
+
0 && (module.exports = {
|
|
2851
|
+
CameraEffects,
|
|
2852
|
+
EFFECTS_REGISTRY,
|
|
2853
|
+
EffectEngine,
|
|
2854
|
+
EffectGraph,
|
|
2855
|
+
EffectRenderer,
|
|
2856
|
+
ExamplePixiEffects,
|
|
2857
|
+
LightEffects,
|
|
2858
|
+
PixiRenderer,
|
|
2859
|
+
addNoise,
|
|
2860
|
+
blendColors,
|
|
2861
|
+
clearCanvas,
|
|
2862
|
+
effectMetadataToApi,
|
|
2863
|
+
generateEffectsManifest,
|
|
2864
|
+
getAllEffectsForApi,
|
|
2865
|
+
getEffectByIdForApi,
|
|
2866
|
+
getEffectCategoriesSummary,
|
|
2867
|
+
getEffectMetadata,
|
|
2868
|
+
getEffectPreviewUrl,
|
|
2869
|
+
getEffectRenderer,
|
|
2870
|
+
getEffectsByCategory,
|
|
2871
|
+
getEffectsByCategoryForApi,
|
|
2872
|
+
hexToRgba,
|
|
2873
|
+
isCanvas2DEffect,
|
|
2874
|
+
isCompositeEffect,
|
|
2875
|
+
isFilterEffect,
|
|
2876
|
+
isMotionEffect,
|
|
2877
|
+
isPixiEffect,
|
|
2878
|
+
rgbaToComponents,
|
|
2879
|
+
searchEffects,
|
|
2880
|
+
searchEffectsForApi,
|
|
2881
|
+
withContext
|
|
2882
|
+
});
|
|
2883
|
+
//# sourceMappingURL=index.cjs.map
|