@clypra-studio/engine 0.1.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TransitionDefinition-CQoSb4ZB.d.cts +158 -0
- package/dist/TransitionDefinition-CQoSb4ZB.d.ts +158 -0
- package/dist/{chunk-CJRH4PAV.js → chunk-2VGI6ZB7.js} +289 -63
- package/dist/chunk-2VGI6ZB7.js.map +1 -0
- package/dist/chunk-4PKBLJ34.js +667 -0
- package/dist/chunk-4PKBLJ34.js.map +1 -0
- package/dist/chunk-FIJBB3MH.js +2990 -0
- package/dist/chunk-FIJBB3MH.js.map +1 -0
- package/dist/{chunk-EVQAI3P3.js → chunk-S24UVNPZ.js} +5 -1
- package/dist/{chunk-EVQAI3P3.js.map → chunk-S24UVNPZ.js.map} +1 -1
- package/dist/{index-BWo6qV_z.d.cts → index-Da47I6aX.d.cts} +5 -5
- package/dist/{index-BWo6qV_z.d.ts → index-Da47I6aX.d.ts} +5 -5
- package/dist/index.cjs +3906 -1371
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +437 -3807
- package/dist/index.d.ts +437 -3807
- package/dist/index.js +1310 -1411
- package/dist/index.js.map +1 -1
- package/dist/textEffects/index.cjs.map +1 -1
- package/dist/textEffects/index.js +1 -1
- package/dist/transitions/index.cjs +2207 -3
- package/dist/transitions/index.cjs.map +1 -1
- package/dist/transitions/index.d.cts +58 -9
- package/dist/transitions/index.d.ts +58 -9
- package/dist/transitions/index.js +53 -3
- package/dist/v2/backends/index.cjs +246 -33
- package/dist/v2/backends/index.cjs.map +1 -1
- package/dist/v2/backends/index.d.cts +1 -1
- package/dist/v2/backends/index.d.ts +1 -1
- package/dist/v2/backends/index.js +1 -1
- package/dist/v2/contract/index.d.cts +12 -12
- package/dist/v2/contract/index.d.ts +12 -12
- package/dist/videoEffects/index.cjs +284 -64
- package/dist/videoEffects/index.cjs.map +1 -1
- package/dist/videoEffects/index.d.cts +34 -138
- package/dist/videoEffects/index.d.ts +34 -138
- package/dist/videoEffects/index.js +1 -1
- package/package.json +12 -12
- package/LICENSE +0 -9
- package/dist/chunk-5JOAEDIQ.js +0 -446
- package/dist/chunk-5JOAEDIQ.js.map +0 -1
- package/dist/chunk-CJRH4PAV.js.map +0 -1
- package/dist/chunk-QMRMNH52.js +0 -811
- package/dist/chunk-QMRMNH52.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as EffectDefinition, e as ParamValues, i as TransitionDefinition, P as PixiEffectDefinition } from '../TransitionDefinition-CQoSb4ZB.cjs';
|
|
2
|
+
export { C as Canvas2DEffectDefinition, a as Canvas2DEngine, b as Canvas2DEngineConstructor, c as ParamSchema, d as ParamType, f as PixiEffectContext, g as PixiEffectSubtype, h as PixiFilterSpec, j as isCanvas2DEffect, k as isCompositeEffect, l as isFilterEffect, m as isMotionEffect, n as isPixiEffect } from '../TransitionDefinition-CQoSb4ZB.cjs';
|
|
3
|
+
import { Application, Sprite, Container, Texture } from 'pixi.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Video Effects Type System
|
|
@@ -9,7 +11,7 @@ import { Filter, Application, Container, Ticker, Sprite } from 'pixi.js';
|
|
|
9
11
|
*
|
|
10
12
|
* NOTE: Transitions have been moved to @clypra/engine/transitions
|
|
11
13
|
*/
|
|
12
|
-
type EffectCategory
|
|
14
|
+
type EffectCategory = "overlay" | "effect" | "filter";
|
|
13
15
|
interface OverlayAsset {
|
|
14
16
|
id: string;
|
|
15
17
|
name: string;
|
|
@@ -94,7 +96,6 @@ interface FilterAsset {
|
|
|
94
96
|
category: string;
|
|
95
97
|
description: string;
|
|
96
98
|
thumbnail: string;
|
|
97
|
-
swatch?: string;
|
|
98
99
|
status?: string;
|
|
99
100
|
intensity: {
|
|
100
101
|
min: number;
|
|
@@ -107,7 +108,7 @@ type VideoEffectItem = OverlayAsset | EffectPreset | FilterAsset;
|
|
|
107
108
|
interface VideoEffectCategory {
|
|
108
109
|
id: string;
|
|
109
110
|
name: string;
|
|
110
|
-
type: EffectCategory
|
|
111
|
+
type: EffectCategory;
|
|
111
112
|
description: string;
|
|
112
113
|
thumbnail: string;
|
|
113
114
|
itemCount: number;
|
|
@@ -178,132 +179,7 @@ declare class EffectRenderer {
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/**
|
|
181
|
-
* @clypra/engine —
|
|
182
|
-
*
|
|
183
|
-
* Unified type system for all Clypra video effects.
|
|
184
|
-
* Supports two rendering backends:
|
|
185
|
-
* - 'canvas2d' → existing text/overlay effects (EffectEngine class pattern)
|
|
186
|
-
* - 'pixi' → new GPU-accelerated video/motion/filter effects (PixiJS)
|
|
187
|
-
*
|
|
188
|
-
* Both backends are consumed identically by EffectGraph and EffectRenderer.
|
|
189
|
-
* The Studio and Desktop Editor import from this single package — same code, same output.
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
type ParamType = 'range' | 'color' | 'toggle' | 'select' | 'text';
|
|
193
|
-
interface ParamSchema {
|
|
194
|
-
key: string;
|
|
195
|
-
label: string;
|
|
196
|
-
type: ParamType;
|
|
197
|
-
value: number | string | boolean;
|
|
198
|
-
min?: number;
|
|
199
|
-
max?: number;
|
|
200
|
-
step?: number;
|
|
201
|
-
options?: string[];
|
|
202
|
-
}
|
|
203
|
-
type ParamValues = Record<string, number | string | boolean>;
|
|
204
|
-
type EffectCategory = 'light' | 'glitch' | 'cinematic' | 'neon' | 'retro' | 'motion' | 'color' | 'blur' | 'distortion' | 'particle' | 'custom';
|
|
205
|
-
interface Canvas2DEngine {
|
|
206
|
-
/** Advance internal animation state by N steps */
|
|
207
|
-
advanceSteps(steps: number): void;
|
|
208
|
-
/** Draw one frame onto the provided context */
|
|
209
|
-
drawFrame(ctx: CanvasRenderingContext2D, ghostFrames?: ImageData[]): void;
|
|
210
|
-
}
|
|
211
|
-
type Canvas2DEngineConstructor = new (config: ParamValues) => Canvas2DEngine;
|
|
212
|
-
interface Canvas2DEffectDefinition {
|
|
213
|
-
backend: 'canvas2d';
|
|
214
|
-
id: string;
|
|
215
|
-
name: string;
|
|
216
|
-
category: EffectCategory;
|
|
217
|
-
description: string;
|
|
218
|
-
tags: string[];
|
|
219
|
-
thumbnail?: string;
|
|
220
|
-
/** Static param schema — parsed by Studio to build sliders */
|
|
221
|
-
params: ParamSchema[];
|
|
222
|
-
/** The engine class that renders this effect */
|
|
223
|
-
engineClass: Canvas2DEngineConstructor;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* PixiJS effect subtypes:
|
|
227
|
-
*
|
|
228
|
-
* 'filter' — one or more GLSL shaders applied as a filter chain on a sprite/container.
|
|
229
|
-
* Pure GPU, no per-frame JS. Uniform values are updated from param changes.
|
|
230
|
-
*
|
|
231
|
-
* 'motion' — animated overlay managed via PixiJS Ticker. Particles, sweeps, pulses.
|
|
232
|
-
* Has full scene-graph access (can add/remove children).
|
|
233
|
-
*
|
|
234
|
-
* 'composite' — combines filter + motion in one effect (e.g. neon glow + particle burst).
|
|
235
|
-
*/
|
|
236
|
-
type PixiEffectSubtype = 'filter' | 'motion' | 'composite';
|
|
237
|
-
/** Context passed to every PixiJS effect lifecycle method */
|
|
238
|
-
interface PixiEffectContext {
|
|
239
|
-
/** The PixiJS Application instance (shared, do not destroy) */
|
|
240
|
-
app: Application;
|
|
241
|
-
/** The container to attach overlays or receive filters */
|
|
242
|
-
container: Container;
|
|
243
|
-
/** PixiJS ticker — subscribe for per-frame updates */
|
|
244
|
-
ticker: Ticker;
|
|
245
|
-
/** Current param values (updated when user moves a slider) */
|
|
246
|
-
params: ParamValues;
|
|
247
|
-
/** Canvas dimensions */
|
|
248
|
-
width: number;
|
|
249
|
-
height: number;
|
|
250
|
-
}
|
|
251
|
-
/** A single PixiJS Filter definition (for 'filter' and 'composite' subtypes) */
|
|
252
|
-
interface PixiFilterSpec {
|
|
253
|
-
/**
|
|
254
|
-
* Factory that returns a configured PixiJS Filter.
|
|
255
|
-
* Called once on mount, and again when params change significantly.
|
|
256
|
-
* Import Filter types lazily inside the factory to keep the engine tree-shakeable.
|
|
257
|
-
*/
|
|
258
|
-
create: (params: ParamValues) => Filter | Filter[];
|
|
259
|
-
/**
|
|
260
|
-
* Called every frame (if the filter has animated uniforms).
|
|
261
|
-
* Mutate filter.resources / uniforms here instead of re-creating the filter.
|
|
262
|
-
* Return false to skip uniform update this frame (for static filters).
|
|
263
|
-
*/
|
|
264
|
-
updateUniforms?: (filter: Filter | Filter[], params: ParamValues, elapsed: number) => void;
|
|
265
|
-
}
|
|
266
|
-
interface PixiEffectDefinition {
|
|
267
|
-
backend: 'pixi';
|
|
268
|
-
subtype: PixiEffectSubtype;
|
|
269
|
-
id: string;
|
|
270
|
-
name: string;
|
|
271
|
-
category: EffectCategory;
|
|
272
|
-
description: string;
|
|
273
|
-
tags: string[];
|
|
274
|
-
thumbnail?: string;
|
|
275
|
-
/** Static param schema — same shape as Canvas2D, drives Studio sliders */
|
|
276
|
-
params: ParamSchema[];
|
|
277
|
-
/**
|
|
278
|
-
* Filter spec — required for 'filter' and 'composite' subtypes.
|
|
279
|
-
* For 'motion' only, omit this.
|
|
280
|
-
*/
|
|
281
|
-
filterSpec?: PixiFilterSpec;
|
|
282
|
-
/**
|
|
283
|
-
* Lifecycle hooks for motion and composite subtypes.
|
|
284
|
-
* mount → called once when effect is activated (add sprites, subscribe ticker)
|
|
285
|
-
* unmount → called when effect is removed (clean up ALL resources — critical)
|
|
286
|
-
* update → called when param values change (slider moved)
|
|
287
|
-
*/
|
|
288
|
-
mount?: (ctx: PixiEffectContext) => void;
|
|
289
|
-
unmount?: (ctx: PixiEffectContext) => void;
|
|
290
|
-
onParamChange?: (ctx: PixiEffectContext, key: string, value: ParamValues[string]) => void;
|
|
291
|
-
}
|
|
292
|
-
type EffectDefinition = Canvas2DEffectDefinition | PixiEffectDefinition;
|
|
293
|
-
declare function isCanvas2DEffect(e: EffectDefinition): e is Canvas2DEffectDefinition;
|
|
294
|
-
declare function isPixiEffect(e: EffectDefinition): e is PixiEffectDefinition;
|
|
295
|
-
declare function isFilterEffect(e: EffectDefinition): e is PixiEffectDefinition & {
|
|
296
|
-
subtype: 'filter';
|
|
297
|
-
};
|
|
298
|
-
declare function isMotionEffect(e: EffectDefinition): e is PixiEffectDefinition & {
|
|
299
|
-
subtype: 'motion';
|
|
300
|
-
};
|
|
301
|
-
declare function isCompositeEffect(e: EffectDefinition): e is PixiEffectDefinition & {
|
|
302
|
-
subtype: 'composite';
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* @clypra/engine — EffectGraph
|
|
182
|
+
* @clypra-studio/engine — EffectGraph
|
|
307
183
|
*
|
|
308
184
|
* Directed Acyclic Graph evaluator for effect chains.
|
|
309
185
|
* Uses Kahn's algorithm for topological ordering.
|
|
@@ -586,7 +462,7 @@ declare function generateEffectsManifest(): {
|
|
|
586
462
|
};
|
|
587
463
|
|
|
588
464
|
/**
|
|
589
|
-
* @clypra/engine — PixiRenderer
|
|
465
|
+
* @clypra-studio/engine — PixiRenderer
|
|
590
466
|
*
|
|
591
467
|
* Manages a single shared PixiJS Application instance.
|
|
592
468
|
* Handles three effect subtypes:
|
|
@@ -605,9 +481,20 @@ declare function generateEffectsManifest(): {
|
|
|
605
481
|
declare class PixiRenderer {
|
|
606
482
|
private app;
|
|
607
483
|
private videoSprite;
|
|
484
|
+
private transitionSprite;
|
|
485
|
+
private _activeTransition;
|
|
486
|
+
private fromRenderTexture;
|
|
487
|
+
private toRenderTexture;
|
|
488
|
+
private blitSprite;
|
|
489
|
+
private _transitionFromTex;
|
|
490
|
+
private _transitionToTex;
|
|
608
491
|
private overlayContainer;
|
|
492
|
+
private baseMediaContainer;
|
|
609
493
|
private mounted;
|
|
610
494
|
private initialized;
|
|
495
|
+
private initializing;
|
|
496
|
+
private _activeSource;
|
|
497
|
+
private _fitMode;
|
|
611
498
|
/**
|
|
612
499
|
* Initialize the PixiJS Application.
|
|
613
500
|
* Call once, reuse across effect changes.
|
|
@@ -617,12 +504,8 @@ declare class PixiRenderer {
|
|
|
617
504
|
* @param height Canvas height in pixels
|
|
618
505
|
*/
|
|
619
506
|
init(canvas: HTMLCanvasElement, width: number, height: number): Promise<void>;
|
|
620
|
-
/**
|
|
621
|
-
* Point the video sprite at a live HTMLVideoElement.
|
|
622
|
-
* PixiJS polls the video element each frame automatically.
|
|
623
|
-
*/
|
|
624
507
|
setVideoSource(video: HTMLVideoElement): void;
|
|
625
|
-
setImageSource(image: HTMLImageElement): void;
|
|
508
|
+
setImageSource(image: HTMLImageElement | HTMLCanvasElement): void;
|
|
626
509
|
/**
|
|
627
510
|
* Mount a resolved set of PixiJS graph nodes.
|
|
628
511
|
* Builds filter chains and initialises motion effects.
|
|
@@ -651,6 +534,10 @@ declare class PixiRenderer {
|
|
|
651
534
|
* Resize the renderer (e.g. when project resolution changes).
|
|
652
535
|
*/
|
|
653
536
|
resize(width: number, height: number): void;
|
|
537
|
+
setFitMode(mode: "stretch" | "fit" | "crop"): void;
|
|
538
|
+
resizeSprites(): void;
|
|
539
|
+
private _getElementDimensions;
|
|
540
|
+
private _resizeSprite;
|
|
654
541
|
/**
|
|
655
542
|
* Full teardown — unmounts all effects, destroys the PixiJS Application.
|
|
656
543
|
* Call when the editor session ends or the Studio workspace unmounts.
|
|
@@ -660,11 +547,20 @@ declare class PixiRenderer {
|
|
|
660
547
|
private _defaultParams;
|
|
661
548
|
getApp(): Application | null;
|
|
662
549
|
getVideoSprite(): Sprite | null;
|
|
550
|
+
getTransitionSprite(): Sprite | null;
|
|
551
|
+
getBaseMediaContainer(): Container | null;
|
|
552
|
+
getOverlayContainer(): Container | null;
|
|
663
553
|
get isReady(): boolean;
|
|
554
|
+
private _ensureRenderTextures;
|
|
555
|
+
private _blitTransitionFrames;
|
|
556
|
+
mountTransition(definition: TransitionDefinition, fromTexture: Texture, toTexture: Texture, params: ParamValues): void;
|
|
557
|
+
getActiveTransitionId(): string | null;
|
|
558
|
+
updateTransitionProgress(id: string, progress: number, params?: ParamValues): void;
|
|
559
|
+
unmountTransition(): void;
|
|
664
560
|
}
|
|
665
561
|
|
|
666
562
|
/**
|
|
667
|
-
* @clypra/engine — example effects
|
|
563
|
+
* @clypra-studio/engine — example effects
|
|
668
564
|
*
|
|
669
565
|
* Three fully-worked examples covering every PixiJS subtype.
|
|
670
566
|
* Copy these as templates when authoring new effects.
|
|
@@ -798,4 +694,4 @@ declare namespace index {
|
|
|
798
694
|
export { index_renderDustParticles as renderDustParticles, index_renderFire as renderFire, index_renderFlash as renderFlash, index_renderFlicker as renderFlicker, index_renderGlow as renderGlow, index_renderLightLeak as renderLightLeak, index_renderLightLeak2 as renderLightLeak2, index_renderParticles as renderParticles, index_renderVignette as renderVignette };
|
|
799
695
|
}
|
|
800
696
|
|
|
801
|
-
export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects,
|
|
697
|
+
export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects, EFFECTS_REGISTRY, type EffectCategory, EffectDefinition, EffectEngine, EffectGraph, type EffectMetadata, type EffectParameters, type EffectPreset, EffectRenderer, type EffectRenderer$1 as EffectRendererType, example as ExamplePixiEffects, type FilterAsset, type GraphDefinition, index as LightEffects, type OverlayAsset, ParamValues, PixiEffectDefinition, PixiRenderer, type VideoEffectApiDefinition, type VideoEffectCategory, type VideoEffectItem, type VideoEffectManifest, type VideoEffectState, addNoise, blendColors, clearCanvas, effectMetadataToApi, generateEffectsManifest, getAllEffectsForApi, getEffectByIdForApi, getEffectCategoriesSummary, getEffectMetadata, getEffectPreviewUrl, getEffectRenderer, getEffectsByCategory, getEffectsByCategoryForApi, hexToRgba, rgbaToComponents, searchEffects, searchEffectsForApi, withContext };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as EffectDefinition, e as ParamValues, i as TransitionDefinition, P as PixiEffectDefinition } from '../TransitionDefinition-CQoSb4ZB.js';
|
|
2
|
+
export { C as Canvas2DEffectDefinition, a as Canvas2DEngine, b as Canvas2DEngineConstructor, c as ParamSchema, d as ParamType, f as PixiEffectContext, g as PixiEffectSubtype, h as PixiFilterSpec, j as isCanvas2DEffect, k as isCompositeEffect, l as isFilterEffect, m as isMotionEffect, n as isPixiEffect } from '../TransitionDefinition-CQoSb4ZB.js';
|
|
3
|
+
import { Application, Sprite, Container, Texture } from 'pixi.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Video Effects Type System
|
|
@@ -9,7 +11,7 @@ import { Filter, Application, Container, Ticker, Sprite } from 'pixi.js';
|
|
|
9
11
|
*
|
|
10
12
|
* NOTE: Transitions have been moved to @clypra/engine/transitions
|
|
11
13
|
*/
|
|
12
|
-
type EffectCategory
|
|
14
|
+
type EffectCategory = "overlay" | "effect" | "filter";
|
|
13
15
|
interface OverlayAsset {
|
|
14
16
|
id: string;
|
|
15
17
|
name: string;
|
|
@@ -94,7 +96,6 @@ interface FilterAsset {
|
|
|
94
96
|
category: string;
|
|
95
97
|
description: string;
|
|
96
98
|
thumbnail: string;
|
|
97
|
-
swatch?: string;
|
|
98
99
|
status?: string;
|
|
99
100
|
intensity: {
|
|
100
101
|
min: number;
|
|
@@ -107,7 +108,7 @@ type VideoEffectItem = OverlayAsset | EffectPreset | FilterAsset;
|
|
|
107
108
|
interface VideoEffectCategory {
|
|
108
109
|
id: string;
|
|
109
110
|
name: string;
|
|
110
|
-
type: EffectCategory
|
|
111
|
+
type: EffectCategory;
|
|
111
112
|
description: string;
|
|
112
113
|
thumbnail: string;
|
|
113
114
|
itemCount: number;
|
|
@@ -178,132 +179,7 @@ declare class EffectRenderer {
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/**
|
|
181
|
-
* @clypra/engine —
|
|
182
|
-
*
|
|
183
|
-
* Unified type system for all Clypra video effects.
|
|
184
|
-
* Supports two rendering backends:
|
|
185
|
-
* - 'canvas2d' → existing text/overlay effects (EffectEngine class pattern)
|
|
186
|
-
* - 'pixi' → new GPU-accelerated video/motion/filter effects (PixiJS)
|
|
187
|
-
*
|
|
188
|
-
* Both backends are consumed identically by EffectGraph and EffectRenderer.
|
|
189
|
-
* The Studio and Desktop Editor import from this single package — same code, same output.
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
type ParamType = 'range' | 'color' | 'toggle' | 'select' | 'text';
|
|
193
|
-
interface ParamSchema {
|
|
194
|
-
key: string;
|
|
195
|
-
label: string;
|
|
196
|
-
type: ParamType;
|
|
197
|
-
value: number | string | boolean;
|
|
198
|
-
min?: number;
|
|
199
|
-
max?: number;
|
|
200
|
-
step?: number;
|
|
201
|
-
options?: string[];
|
|
202
|
-
}
|
|
203
|
-
type ParamValues = Record<string, number | string | boolean>;
|
|
204
|
-
type EffectCategory = 'light' | 'glitch' | 'cinematic' | 'neon' | 'retro' | 'motion' | 'color' | 'blur' | 'distortion' | 'particle' | 'custom';
|
|
205
|
-
interface Canvas2DEngine {
|
|
206
|
-
/** Advance internal animation state by N steps */
|
|
207
|
-
advanceSteps(steps: number): void;
|
|
208
|
-
/** Draw one frame onto the provided context */
|
|
209
|
-
drawFrame(ctx: CanvasRenderingContext2D, ghostFrames?: ImageData[]): void;
|
|
210
|
-
}
|
|
211
|
-
type Canvas2DEngineConstructor = new (config: ParamValues) => Canvas2DEngine;
|
|
212
|
-
interface Canvas2DEffectDefinition {
|
|
213
|
-
backend: 'canvas2d';
|
|
214
|
-
id: string;
|
|
215
|
-
name: string;
|
|
216
|
-
category: EffectCategory;
|
|
217
|
-
description: string;
|
|
218
|
-
tags: string[];
|
|
219
|
-
thumbnail?: string;
|
|
220
|
-
/** Static param schema — parsed by Studio to build sliders */
|
|
221
|
-
params: ParamSchema[];
|
|
222
|
-
/** The engine class that renders this effect */
|
|
223
|
-
engineClass: Canvas2DEngineConstructor;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* PixiJS effect subtypes:
|
|
227
|
-
*
|
|
228
|
-
* 'filter' — one or more GLSL shaders applied as a filter chain on a sprite/container.
|
|
229
|
-
* Pure GPU, no per-frame JS. Uniform values are updated from param changes.
|
|
230
|
-
*
|
|
231
|
-
* 'motion' — animated overlay managed via PixiJS Ticker. Particles, sweeps, pulses.
|
|
232
|
-
* Has full scene-graph access (can add/remove children).
|
|
233
|
-
*
|
|
234
|
-
* 'composite' — combines filter + motion in one effect (e.g. neon glow + particle burst).
|
|
235
|
-
*/
|
|
236
|
-
type PixiEffectSubtype = 'filter' | 'motion' | 'composite';
|
|
237
|
-
/** Context passed to every PixiJS effect lifecycle method */
|
|
238
|
-
interface PixiEffectContext {
|
|
239
|
-
/** The PixiJS Application instance (shared, do not destroy) */
|
|
240
|
-
app: Application;
|
|
241
|
-
/** The container to attach overlays or receive filters */
|
|
242
|
-
container: Container;
|
|
243
|
-
/** PixiJS ticker — subscribe for per-frame updates */
|
|
244
|
-
ticker: Ticker;
|
|
245
|
-
/** Current param values (updated when user moves a slider) */
|
|
246
|
-
params: ParamValues;
|
|
247
|
-
/** Canvas dimensions */
|
|
248
|
-
width: number;
|
|
249
|
-
height: number;
|
|
250
|
-
}
|
|
251
|
-
/** A single PixiJS Filter definition (for 'filter' and 'composite' subtypes) */
|
|
252
|
-
interface PixiFilterSpec {
|
|
253
|
-
/**
|
|
254
|
-
* Factory that returns a configured PixiJS Filter.
|
|
255
|
-
* Called once on mount, and again when params change significantly.
|
|
256
|
-
* Import Filter types lazily inside the factory to keep the engine tree-shakeable.
|
|
257
|
-
*/
|
|
258
|
-
create: (params: ParamValues) => Filter | Filter[];
|
|
259
|
-
/**
|
|
260
|
-
* Called every frame (if the filter has animated uniforms).
|
|
261
|
-
* Mutate filter.resources / uniforms here instead of re-creating the filter.
|
|
262
|
-
* Return false to skip uniform update this frame (for static filters).
|
|
263
|
-
*/
|
|
264
|
-
updateUniforms?: (filter: Filter | Filter[], params: ParamValues, elapsed: number) => void;
|
|
265
|
-
}
|
|
266
|
-
interface PixiEffectDefinition {
|
|
267
|
-
backend: 'pixi';
|
|
268
|
-
subtype: PixiEffectSubtype;
|
|
269
|
-
id: string;
|
|
270
|
-
name: string;
|
|
271
|
-
category: EffectCategory;
|
|
272
|
-
description: string;
|
|
273
|
-
tags: string[];
|
|
274
|
-
thumbnail?: string;
|
|
275
|
-
/** Static param schema — same shape as Canvas2D, drives Studio sliders */
|
|
276
|
-
params: ParamSchema[];
|
|
277
|
-
/**
|
|
278
|
-
* Filter spec — required for 'filter' and 'composite' subtypes.
|
|
279
|
-
* For 'motion' only, omit this.
|
|
280
|
-
*/
|
|
281
|
-
filterSpec?: PixiFilterSpec;
|
|
282
|
-
/**
|
|
283
|
-
* Lifecycle hooks for motion and composite subtypes.
|
|
284
|
-
* mount → called once when effect is activated (add sprites, subscribe ticker)
|
|
285
|
-
* unmount → called when effect is removed (clean up ALL resources — critical)
|
|
286
|
-
* update → called when param values change (slider moved)
|
|
287
|
-
*/
|
|
288
|
-
mount?: (ctx: PixiEffectContext) => void;
|
|
289
|
-
unmount?: (ctx: PixiEffectContext) => void;
|
|
290
|
-
onParamChange?: (ctx: PixiEffectContext, key: string, value: ParamValues[string]) => void;
|
|
291
|
-
}
|
|
292
|
-
type EffectDefinition = Canvas2DEffectDefinition | PixiEffectDefinition;
|
|
293
|
-
declare function isCanvas2DEffect(e: EffectDefinition): e is Canvas2DEffectDefinition;
|
|
294
|
-
declare function isPixiEffect(e: EffectDefinition): e is PixiEffectDefinition;
|
|
295
|
-
declare function isFilterEffect(e: EffectDefinition): e is PixiEffectDefinition & {
|
|
296
|
-
subtype: 'filter';
|
|
297
|
-
};
|
|
298
|
-
declare function isMotionEffect(e: EffectDefinition): e is PixiEffectDefinition & {
|
|
299
|
-
subtype: 'motion';
|
|
300
|
-
};
|
|
301
|
-
declare function isCompositeEffect(e: EffectDefinition): e is PixiEffectDefinition & {
|
|
302
|
-
subtype: 'composite';
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* @clypra/engine — EffectGraph
|
|
182
|
+
* @clypra-studio/engine — EffectGraph
|
|
307
183
|
*
|
|
308
184
|
* Directed Acyclic Graph evaluator for effect chains.
|
|
309
185
|
* Uses Kahn's algorithm for topological ordering.
|
|
@@ -586,7 +462,7 @@ declare function generateEffectsManifest(): {
|
|
|
586
462
|
};
|
|
587
463
|
|
|
588
464
|
/**
|
|
589
|
-
* @clypra/engine — PixiRenderer
|
|
465
|
+
* @clypra-studio/engine — PixiRenderer
|
|
590
466
|
*
|
|
591
467
|
* Manages a single shared PixiJS Application instance.
|
|
592
468
|
* Handles three effect subtypes:
|
|
@@ -605,9 +481,20 @@ declare function generateEffectsManifest(): {
|
|
|
605
481
|
declare class PixiRenderer {
|
|
606
482
|
private app;
|
|
607
483
|
private videoSprite;
|
|
484
|
+
private transitionSprite;
|
|
485
|
+
private _activeTransition;
|
|
486
|
+
private fromRenderTexture;
|
|
487
|
+
private toRenderTexture;
|
|
488
|
+
private blitSprite;
|
|
489
|
+
private _transitionFromTex;
|
|
490
|
+
private _transitionToTex;
|
|
608
491
|
private overlayContainer;
|
|
492
|
+
private baseMediaContainer;
|
|
609
493
|
private mounted;
|
|
610
494
|
private initialized;
|
|
495
|
+
private initializing;
|
|
496
|
+
private _activeSource;
|
|
497
|
+
private _fitMode;
|
|
611
498
|
/**
|
|
612
499
|
* Initialize the PixiJS Application.
|
|
613
500
|
* Call once, reuse across effect changes.
|
|
@@ -617,12 +504,8 @@ declare class PixiRenderer {
|
|
|
617
504
|
* @param height Canvas height in pixels
|
|
618
505
|
*/
|
|
619
506
|
init(canvas: HTMLCanvasElement, width: number, height: number): Promise<void>;
|
|
620
|
-
/**
|
|
621
|
-
* Point the video sprite at a live HTMLVideoElement.
|
|
622
|
-
* PixiJS polls the video element each frame automatically.
|
|
623
|
-
*/
|
|
624
507
|
setVideoSource(video: HTMLVideoElement): void;
|
|
625
|
-
setImageSource(image: HTMLImageElement): void;
|
|
508
|
+
setImageSource(image: HTMLImageElement | HTMLCanvasElement): void;
|
|
626
509
|
/**
|
|
627
510
|
* Mount a resolved set of PixiJS graph nodes.
|
|
628
511
|
* Builds filter chains and initialises motion effects.
|
|
@@ -651,6 +534,10 @@ declare class PixiRenderer {
|
|
|
651
534
|
* Resize the renderer (e.g. when project resolution changes).
|
|
652
535
|
*/
|
|
653
536
|
resize(width: number, height: number): void;
|
|
537
|
+
setFitMode(mode: "stretch" | "fit" | "crop"): void;
|
|
538
|
+
resizeSprites(): void;
|
|
539
|
+
private _getElementDimensions;
|
|
540
|
+
private _resizeSprite;
|
|
654
541
|
/**
|
|
655
542
|
* Full teardown — unmounts all effects, destroys the PixiJS Application.
|
|
656
543
|
* Call when the editor session ends or the Studio workspace unmounts.
|
|
@@ -660,11 +547,20 @@ declare class PixiRenderer {
|
|
|
660
547
|
private _defaultParams;
|
|
661
548
|
getApp(): Application | null;
|
|
662
549
|
getVideoSprite(): Sprite | null;
|
|
550
|
+
getTransitionSprite(): Sprite | null;
|
|
551
|
+
getBaseMediaContainer(): Container | null;
|
|
552
|
+
getOverlayContainer(): Container | null;
|
|
663
553
|
get isReady(): boolean;
|
|
554
|
+
private _ensureRenderTextures;
|
|
555
|
+
private _blitTransitionFrames;
|
|
556
|
+
mountTransition(definition: TransitionDefinition, fromTexture: Texture, toTexture: Texture, params: ParamValues): void;
|
|
557
|
+
getActiveTransitionId(): string | null;
|
|
558
|
+
updateTransitionProgress(id: string, progress: number, params?: ParamValues): void;
|
|
559
|
+
unmountTransition(): void;
|
|
664
560
|
}
|
|
665
561
|
|
|
666
562
|
/**
|
|
667
|
-
* @clypra/engine — example effects
|
|
563
|
+
* @clypra-studio/engine — example effects
|
|
668
564
|
*
|
|
669
565
|
* Three fully-worked examples covering every PixiJS subtype.
|
|
670
566
|
* Copy these as templates when authoring new effects.
|
|
@@ -798,4 +694,4 @@ declare namespace index {
|
|
|
798
694
|
export { index_renderDustParticles as renderDustParticles, index_renderFire as renderFire, index_renderFlash as renderFlash, index_renderFlicker as renderFlicker, index_renderGlow as renderGlow, index_renderLightLeak as renderLightLeak, index_renderLightLeak2 as renderLightLeak2, index_renderParticles as renderParticles, index_renderVignette as renderVignette };
|
|
799
695
|
}
|
|
800
696
|
|
|
801
|
-
export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects,
|
|
697
|
+
export { type AppliedEffect, type AppliedOverlay, type BlendMode, index$1 as CameraEffects, EFFECTS_REGISTRY, type EffectCategory, EffectDefinition, EffectEngine, EffectGraph, type EffectMetadata, type EffectParameters, type EffectPreset, EffectRenderer, type EffectRenderer$1 as EffectRendererType, example as ExamplePixiEffects, type FilterAsset, type GraphDefinition, index as LightEffects, type OverlayAsset, ParamValues, PixiEffectDefinition, PixiRenderer, type VideoEffectApiDefinition, type VideoEffectCategory, type VideoEffectItem, type VideoEffectManifest, type VideoEffectState, addNoise, blendColors, clearCanvas, effectMetadataToApi, generateEffectsManifest, getAllEffectsForApi, getEffectByIdForApi, getEffectCategoriesSummary, getEffectMetadata, getEffectPreviewUrl, getEffectRenderer, getEffectsByCategory, getEffectsByCategoryForApi, hexToRgba, rgbaToComponents, searchEffects, searchEffectsForApi, withContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clypra-studio/engine",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -60,13 +60,21 @@
|
|
|
60
60
|
"bugs": {
|
|
61
61
|
"url": "https://github.com/AIEraDev/clypra-studio/issues"
|
|
62
62
|
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsup",
|
|
65
|
+
"dev": "tsup --watch",
|
|
66
|
+
"clean": "rm -rf dist",
|
|
67
|
+
"lint": "tsc --noEmit",
|
|
68
|
+
"typecheck": "tsc --noEmit",
|
|
69
|
+
"test": "vitest run"
|
|
70
|
+
},
|
|
63
71
|
"dependencies": {
|
|
72
|
+
"@clypra-studio/types": "workspace:^",
|
|
64
73
|
"jszip": "^3.10.1",
|
|
65
74
|
"lottie-web": "^5.13.0",
|
|
66
75
|
"pixi-filters": "^6.0.0",
|
|
67
76
|
"pixi.js": "^8.0.0",
|
|
68
|
-
"zod": "^4.4.3"
|
|
69
|
-
"@clypra-studio/types": "^0.1.1"
|
|
77
|
+
"zod": "^4.4.3"
|
|
70
78
|
},
|
|
71
79
|
"devDependencies": {
|
|
72
80
|
"@napi-rs/canvas": "^0.1.70",
|
|
@@ -106,13 +114,5 @@
|
|
|
106
114
|
],
|
|
107
115
|
"@semantic-release/github"
|
|
108
116
|
]
|
|
109
|
-
},
|
|
110
|
-
"scripts": {
|
|
111
|
-
"build": "tsup",
|
|
112
|
-
"dev": "tsup --watch",
|
|
113
|
-
"clean": "rm -rf dist",
|
|
114
|
-
"lint": "tsc --noEmit",
|
|
115
|
-
"typecheck": "tsc --noEmit",
|
|
116
|
-
"test": "vitest run"
|
|
117
117
|
}
|
|
118
|
-
}
|
|
118
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Abdulkabir Musa(AIEraDev)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|