openvideo 0.1.10 → 0.2.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.
@@ -3,7 +3,7 @@ export interface GsapAnimationParams {
3
3
  /**
4
4
  * Animation presets or custom GSAP vars
5
5
  */
6
- type: "character" | "word" | "line";
6
+ type: 'character' | 'word' | 'line';
7
7
  from: gsap.TweenVars;
8
8
  to: gsap.TweenVars;
9
9
  stagger?: number | gsap.StaggerVars;
@@ -11,6 +11,25 @@ export declare const blurOut: AnimationFactory;
11
11
  export declare const charFadeIn: AnimationFactory;
12
12
  export declare const charSlideUp: AnimationFactory;
13
13
  export declare const charTypewriter: AnimationFactory;
14
+ export declare const fadeByWord: AnimationFactory;
15
+ export declare const slideFadeByWord: AnimationFactory;
16
+ export declare const popByWord: AnimationFactory;
17
+ export declare const scaleFadeByWord: AnimationFactory;
18
+ export declare const bounceByWord: AnimationFactory;
19
+ export declare const rotateInByWord: AnimationFactory;
20
+ export declare const slideRightByWord: AnimationFactory;
21
+ export declare const slideLeftByWord: AnimationFactory;
22
+ export declare const fadeRotateByWord: AnimationFactory;
23
+ export declare const skewByWord: AnimationFactory;
24
+ export declare const waveByWord: AnimationFactory;
25
+ export declare const blurInByWord: AnimationFactory;
26
+ export declare const dropSoftByWord: AnimationFactory;
27
+ export declare const elasticPopByWord: AnimationFactory;
28
+ export declare const flipUpByWord: AnimationFactory;
29
+ export declare const spinInByWord: AnimationFactory;
30
+ export declare const stretchInByWord: AnimationFactory;
31
+ export declare const revealZoomByWord: AnimationFactory;
32
+ export declare const floatWaveByWord: AnimationFactory;
14
33
  export declare const blurSlideRightIn: AnimationFactory;
15
34
  export declare const wobbleZoomIn: AnimationFactory;
16
35
  export declare const spinZoomIn: AnimationFactory;
@@ -101,6 +120,18 @@ export declare const collapseRotateZoomIn: AnimationFactory;
101
120
  export declare const collapseRotateZoomOut: AnimationFactory;
102
121
  export declare const ultraCinematicIn: AnimationFactory;
103
122
  export declare const ultraCinematicOut: AnimationFactory;
123
+ export declare const popCaption: AnimationFactory;
124
+ export declare const bounceCaption: AnimationFactory;
125
+ export declare const scaleCaption: AnimationFactory;
126
+ export declare const slideLeftCaption: AnimationFactory;
127
+ export declare const slideRightCaption: AnimationFactory;
128
+ export declare const slideUpCaption: AnimationFactory;
129
+ export declare const slideDownCaption: AnimationFactory;
130
+ export declare const fadeCaption: AnimationFactory;
131
+ export declare const scaleMidCaption: AnimationFactory;
132
+ export declare const scaleDownCaption: AnimationFactory;
133
+ export declare const upDownCaption: AnimationFactory;
134
+ export declare const upLeftCaption: AnimationFactory;
104
135
  /**
105
136
  * Get the keyframe template for a preset animation
106
137
  * Useful for populating the animation editor UI
@@ -5,6 +5,8 @@ export interface AnimationProps {
5
5
  width?: number;
6
6
  height?: number;
7
7
  scale?: number;
8
+ scaleX?: number;
9
+ scaleY?: number;
8
10
  opacity?: number;
9
11
  angle?: number;
10
12
  blur?: number;
@@ -43,6 +45,8 @@ export interface AnimationTransform {
43
45
  width?: number;
44
46
  height?: number;
45
47
  scale?: number;
48
+ scaleX?: number;
49
+ scaleY?: number;
46
50
  opacity?: number;
47
51
  angle?: number;
48
52
  blur?: number;
@@ -90,6 +94,20 @@ export declare const ANIMATABLE_PROPERTIES: {
90
94
  readonly step: 0.1;
91
95
  readonly default: 1;
92
96
  };
97
+ readonly scaleX: {
98
+ readonly label: "Scale X";
99
+ readonly min: 0;
100
+ readonly max: 3;
101
+ readonly step: 0.1;
102
+ readonly default: 1;
103
+ };
104
+ readonly scaleY: {
105
+ readonly label: "Scale Y";
106
+ readonly min: 0;
107
+ readonly max: 3;
108
+ readonly step: 0.1;
109
+ readonly default: 1;
110
+ };
93
111
  readonly opacity: {
94
112
  readonly label: "Opacity";
95
113
  readonly min: 0;
@@ -0,0 +1,7 @@
1
+ import { e as a, A as e, C as i, a as s, E as t, F as n, D as d } from "./index-DCWl03Hg.js";
2
+ import "./webworkerAll-DY6Fccy4.js";
3
+ a.add(e);
4
+ a.mixin(i, s);
5
+ a.add(t);
6
+ a.mixin(i, n);
7
+ a.add(d);
@@ -22,7 +22,7 @@ export declare abstract class BaseClip<T extends BaseSpriteEvents = BaseSpriteEv
22
22
  abstract tick(time: number): Promise<{
23
23
  video?: VideoFrame | ImageBitmap | null;
24
24
  audio?: Float32Array[];
25
- state: "done" | "success";
25
+ state: 'done' | 'success';
26
26
  }>;
27
27
  ready: Promise<IClipMeta>;
28
28
  abstract readonly meta: IClipMeta;
@@ -92,7 +92,7 @@ export declare abstract class BaseClip<T extends BaseSpriteEvents = BaseSpriteEv
92
92
  * Default implementation returns all handles
93
93
  * Override in subclasses to customize handle visibility (e.g., TextClip)
94
94
  */
95
- getVisibleHandles(): Array<"tl" | "tr" | "bl" | "br" | "ml" | "mr" | "mt" | "mb" | "rot">;
95
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
96
96
  /**
97
97
  * Scale clip to fit within the scene dimensions while maintaining aspect ratio
98
98
  * @param sceneWidth Scene width
@@ -1,6 +1,6 @@
1
1
  import { BaseClip } from './base-clip';
2
2
  import { IClip } from './iclip';
3
- import { CaptionJSON } from '../json-serialization';
3
+ import { CaptionJSON, ICaptionWordAnimation } from '../json-serialization';
4
4
  import { Application, Texture } from 'pixi.js';
5
5
  import { BaseSpriteEvents } from '../sprite/base-sprite';
6
6
  export interface ICaptionStyle {
@@ -8,11 +8,11 @@ export interface ICaptionStyle {
8
8
  fontFamily?: string;
9
9
  fontWeight?: string | number;
10
10
  fontStyle?: string;
11
- color?: ICaptionOpts["fill"];
12
- align?: ICaptionOpts["align"];
13
- textCase?: ICaptionOpts["textCase"];
14
- verticalAlign?: ICaptionOpts["verticalAlign"];
15
- wordsPerLine?: ICaptionOpts["wordsPerLine"];
11
+ color?: ICaptionOpts['fill'];
12
+ align?: ICaptionOpts['align'];
13
+ textCase?: ICaptionOpts['textCase'];
14
+ verticalAlign?: ICaptionOpts['verticalAlign'];
15
+ wordsPerLine?: ICaptionOpts['wordsPerLine'];
16
16
  stroke?: {
17
17
  color: string | number;
18
18
  width: number;
@@ -24,6 +24,7 @@ export interface ICaptionStyle {
24
24
  distance: number;
25
25
  angle: number;
26
26
  };
27
+ wordAnimation?: ICaptionWordAnimation;
27
28
  }
28
29
  export interface ICaptionEvents extends BaseSpriteEvents {
29
30
  propsChange: Partial<{
@@ -36,14 +37,14 @@ export interface ICaptionEvents extends BaseSpriteEvents {
36
37
  opacity: number;
37
38
  volume: number;
38
39
  text: string;
39
- words: ICaptionOpts["words"];
40
- fill: ICaptionOpts["fill"];
41
- align: ICaptionOpts["align"];
42
- textCase: ICaptionOpts["textCase"];
43
- stroke: ICaptionOpts["stroke"];
44
- dropShadow: ICaptionOpts["dropShadow"];
45
- caption: ICaptionOpts["caption"];
46
- wordsPerLine: ICaptionOpts["wordsPerLine"];
40
+ words: ICaptionOpts['words'];
41
+ fill: ICaptionOpts['fill'];
42
+ align: ICaptionOpts['align'];
43
+ textCase: ICaptionOpts['textCase'];
44
+ stroke: ICaptionOpts['stroke'];
45
+ dropShadow: ICaptionOpts['dropShadow'];
46
+ caption: ICaptionOpts['caption'];
47
+ wordsPerLine: ICaptionOpts['wordsPerLine'];
47
48
  }>;
48
49
  }
49
50
  export interface ICaptionOpts {
@@ -73,7 +74,7 @@ export interface ICaptionOpts {
73
74
  * @default '#ffffff'
74
75
  */
75
76
  fill?: string | number | {
76
- type: "gradient";
77
+ type: 'gradient';
77
78
  x0: number;
78
79
  y0: number;
79
80
  x1: number;
@@ -107,6 +108,7 @@ export interface ICaptionOpts {
107
108
  videoHeight?: number;
108
109
  bottomOffset?: number;
109
110
  };
111
+ wordAnimation?: ICaptionWordAnimation;
110
112
  };
111
113
  /**
112
114
  * @deprecated Use caption.words instead
@@ -150,7 +152,7 @@ export interface ICaptionOpts {
150
152
  stroke?: string | number | {
151
153
  color: string | number;
152
154
  width: number;
153
- join?: "miter" | "round" | "bevel";
155
+ join?: 'miter' | 'round' | 'bevel';
154
156
  };
155
157
  /**
156
158
  * Stroke width in pixels (used when stroke is a simple color)
@@ -161,7 +163,7 @@ export interface ICaptionOpts {
161
163
  * Text alignment ('left', 'center', 'right')
162
164
  * @default 'center'
163
165
  */
164
- align?: "left" | "center" | "right";
166
+ align?: 'left' | 'center' | 'right';
165
167
  /**
166
168
  * Drop shadow configuration
167
169
  */
@@ -181,7 +183,7 @@ export interface ICaptionOpts {
181
183
  * Word wrap mode ('break-word' or 'normal')
182
184
  * @default 'break-word'
183
185
  */
184
- wordWrapMode?: "break-word" | "normal";
186
+ wordWrapMode?: 'break-word' | 'normal';
185
187
  /**
186
188
  * Whether to enable word wrap
187
189
  * @default true
@@ -191,7 +193,7 @@ export interface ICaptionOpts {
191
193
  * Vertical alignment ('top', 'center', 'bottom')
192
194
  * @default 'bottom'
193
195
  */
194
- verticalAlign?: "top" | "center" | "bottom";
196
+ verticalAlign?: 'top' | 'center' | 'bottom';
195
197
  /**
196
198
  * Line height (multiplier)
197
199
  * @default 1
@@ -206,7 +208,7 @@ export interface ICaptionOpts {
206
208
  * Text case transformation
207
209
  * @default 'none'
208
210
  */
209
- textCase?: "none" | "uppercase" | "lowercase" | "title";
211
+ textCase?: 'none' | 'uppercase' | 'lowercase' | 'title';
210
212
  /**
211
213
  * Media ID to which the captions were applied
212
214
  */
@@ -219,7 +221,8 @@ export interface ICaptionOpts {
219
221
  * Words per line mode ('single' or 'multiple')
220
222
  * @default 'multiple'
221
223
  */
222
- wordsPerLine?: "single" | "multiple";
224
+ wordsPerLine?: 'single' | 'multiple';
225
+ wordAnimation?: ICaptionWordAnimation;
223
226
  }
224
227
  /**
225
228
  * Caption clip using Canvas 2D for rendering
@@ -238,7 +241,7 @@ export interface ICaptionOpts {
238
241
  */
239
242
  export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
240
243
  readonly type = "Caption";
241
- ready: IClip["ready"];
244
+ ready: IClip['ready'];
242
245
  private _meta;
243
246
  get meta(): {
244
247
  duration: number;
@@ -271,8 +274,8 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
271
274
  set text(v: string);
272
275
  get style(): ICaptionStyle;
273
276
  set style(v: Partial<ICaptionOpts> | ICaptionStyle);
274
- get wordsPerLine(): "single" | "multiple";
275
- set wordsPerLine(v: "single" | "multiple");
277
+ get wordsPerLine(): 'single' | 'multiple';
278
+ set wordsPerLine(v: 'single' | 'multiple');
276
279
  get fontFamily(): string;
277
280
  set fontFamily(v: string);
278
281
  get fontUrl(): string;
@@ -281,20 +284,20 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
281
284
  set fontSize(v: number);
282
285
  get fontWeight(): string | number;
283
286
  set fontWeight(v: string | number);
284
- get fontStyle(): "normal" | "italic" | "oblique";
285
- set fontStyle(v: "normal" | "italic" | "oblique");
286
- get fill(): ICaptionOpts["fill"];
287
- set fill(v: ICaptionOpts["fill"]);
288
- get align(): "left" | "center" | "right";
289
- set align(v: "left" | "center" | "right");
290
- get stroke(): ICaptionOpts["stroke"];
291
- set stroke(v: ICaptionOpts["stroke"]);
287
+ get fontStyle(): 'normal' | 'italic' | 'oblique';
288
+ set fontStyle(v: 'normal' | 'italic' | 'oblique');
289
+ get fill(): ICaptionOpts['fill'];
290
+ set fill(v: ICaptionOpts['fill']);
291
+ get align(): 'left' | 'center' | 'right';
292
+ set align(v: 'left' | 'center' | 'right');
293
+ get stroke(): ICaptionOpts['stroke'];
294
+ set stroke(v: ICaptionOpts['stroke']);
292
295
  get strokeWidth(): number;
293
296
  set strokeWidth(v: number);
294
- get dropShadow(): ICaptionOpts["dropShadow"];
295
- set dropShadow(v: ICaptionOpts["dropShadow"]);
296
- get caption(): ICaptionOpts["caption"];
297
- set caption(v: ICaptionOpts["caption"]);
297
+ get dropShadow(): ICaptionOpts['dropShadow'];
298
+ set dropShadow(v: ICaptionOpts['dropShadow']);
299
+ get caption(): ICaptionOpts['caption'];
300
+ set caption(v: ICaptionOpts['caption']);
298
301
  /**
299
302
  * Bottom offset from video bottom (hybrid JSON structure)
300
303
  */
@@ -303,7 +306,7 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
303
306
  * Text case proxy
304
307
  */
305
308
  get textCase(): string;
306
- set textCase(v: "none" | "uppercase" | "lowercase" | "title");
309
+ set textCase(v: 'none' | 'uppercase' | 'lowercase' | 'title');
307
310
  /**
308
311
  * Unique identifier for this clip instance
309
312
  */
@@ -330,7 +333,7 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
330
333
  /**
331
334
  * Words setter that triggers re-render and ensures consistency
332
335
  */
333
- set words(v: ICaptionOpts["words"]);
336
+ set words(v: ICaptionOpts['words']);
334
337
  private opts;
335
338
  private pixiTextContainer;
336
339
  private renderTexture;
@@ -342,7 +345,7 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
342
345
  private externalRenderer;
343
346
  private pixiApp;
344
347
  private originalOpts;
345
- constructor(text: string, opts?: ICaptionOpts, renderer?: Application["renderer"]);
348
+ constructor(text: string, opts?: ICaptionOpts, renderer?: Application['renderer']);
346
349
  /**
347
350
  * Update text styling options and refresh the caption rendering
348
351
  */
@@ -361,11 +364,11 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
361
364
  /**
362
365
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
363
366
  */
364
- setRenderer(renderer: Application["renderer"]): void;
367
+ setRenderer(renderer: Application['renderer']): void;
365
368
  private getRenderer;
366
369
  tick(time: number): Promise<{
367
370
  video: ImageBitmap;
368
- state: "success";
371
+ state: 'success';
369
372
  }>;
370
373
  split(_time: number): Promise<[this, this]>;
371
374
  addEffect(effect: {
@@ -389,5 +392,5 @@ export declare class Caption extends BaseClip<ICaptionEvents> implements IClip {
389
392
  * @returns Promise that resolves to a Caption instance
390
393
  */
391
394
  static fromObject(json: CaptionJSON): Promise<Caption>;
392
- getVisibleHandles(): Array<"tl" | "tr" | "bl" | "br" | "ml" | "mr" | "mt" | "mb" | "rot">;
395
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
393
396
  }
@@ -14,6 +14,12 @@ export interface ITransitionInfo {
14
14
  start?: number;
15
15
  end?: number;
16
16
  }
17
+ export interface IChromaKeyOpts {
18
+ enabled: boolean;
19
+ color: string;
20
+ similarity: number;
21
+ spill: number;
22
+ }
17
23
  /**
18
24
  * Interface that all clips must implement
19
25
  *
@@ -134,6 +140,10 @@ export interface IClip<T extends BaseSpriteEvents = BaseSpriteEvents> extends Om
134
140
  * List of active animations
135
141
  */
136
142
  readonly animations: any[];
143
+ /**
144
+ * Chroma key settings (green screen removal)
145
+ */
146
+ chromaKey: IChromaKeyOpts;
137
147
  }
138
148
  /**
139
149
  * Optional interface for clips that support HTML media element playback
@@ -33,7 +33,7 @@ export interface ITextOpts {
33
33
  * @default '#ffffff'
34
34
  */
35
35
  fill?: string | number | {
36
- type: "gradient";
36
+ type: 'gradient';
37
37
  x0: number;
38
38
  y0: number;
39
39
  x1: number;
@@ -49,8 +49,8 @@ export interface ITextOpts {
49
49
  stroke?: string | number | {
50
50
  color: string | number;
51
51
  width: number;
52
- join?: "miter" | "round" | "bevel";
53
- cap?: "butt" | "round" | "square";
52
+ join?: 'miter' | 'round' | 'bevel';
53
+ cap?: 'butt' | 'round' | 'square';
54
54
  miterLimit?: number;
55
55
  };
56
56
  /**
@@ -62,16 +62,16 @@ export interface ITextOpts {
62
62
  * Text alignment ('left', 'center', 'right')
63
63
  * @default 'left'
64
64
  */
65
- align?: "left" | "center" | "right";
65
+ align?: 'left' | 'center' | 'right';
66
66
  /**
67
67
  * Alias for align to match UI property naming
68
68
  */
69
- textAlign?: "left" | "center" | "right";
69
+ textAlign?: 'left' | 'center' | 'right';
70
70
  /**
71
71
  * Vertical alignment ('top', 'center', 'bottom')
72
72
  * @default 'top'
73
73
  */
74
- verticalAlign?: "top" | "center" | "bottom" | "underline" | "overline" | "strikethrough";
74
+ verticalAlign?: 'top' | 'center' | 'bottom' | 'underline' | 'overline' | 'strikethrough';
75
75
  /**
76
76
  * Drop shadow configuration
77
77
  */
@@ -106,17 +106,17 @@ export interface ITextOpts {
106
106
  * Text case transformation
107
107
  * @default 'none'
108
108
  */
109
- textCase?: "none" | "uppercase" | "lowercase" | "title";
109
+ textCase?: 'none' | 'uppercase' | 'lowercase' | 'title';
110
110
  /**
111
111
  * Text decoration ('none', 'underline', 'line-through', 'overline')
112
112
  * @default 'none'
113
113
  */
114
- textDecoration?: "none" | "underline" | "line-through" | "overline";
114
+ textDecoration?: 'none' | 'underline' | 'line-through' | 'overline';
115
115
  /**
116
116
  * Words per line mode ('single' or 'multiple')
117
117
  * @default 'multiple'
118
118
  */
119
- wordsPerLine?: "single" | "multiple";
119
+ wordsPerLine?: 'single' | 'multiple';
120
120
  }
121
121
  export interface ITextEvents extends BaseSpriteEvents {
122
122
  propsChange: Partial<{
@@ -152,7 +152,7 @@ export interface ITextEvents extends BaseSpriteEvents {
152
152
  */
153
153
  export declare class Text extends BaseClip<ITextEvents> {
154
154
  readonly type = "Text";
155
- ready: IClip["ready"];
155
+ ready: IClip['ready'];
156
156
  private _meta;
157
157
  get meta(): {
158
158
  duration: number;
@@ -184,8 +184,8 @@ export declare class Text extends BaseClip<ITextEvents> {
184
184
  /**
185
185
  * Text alignment proxy for compatibility with UI
186
186
  */
187
- get textAlign(): "left" | "center" | "right";
188
- set textAlign(v: "left" | "center" | "right");
187
+ get textAlign(): 'left' | 'center' | 'right';
188
+ set textAlign(v: 'left' | 'center' | 'right');
189
189
  /**
190
190
  * Vertical alignment or decoration proxy
191
191
  */
@@ -195,7 +195,7 @@ export declare class Text extends BaseClip<ITextEvents> {
195
195
  * Text case proxy
196
196
  */
197
197
  get textCase(): string;
198
- set textCase(v: "none" | "uppercase" | "lowercase" | "title");
198
+ set textCase(v: 'none' | 'uppercase' | 'lowercase' | 'title');
199
199
  private pixiTextContainer;
200
200
  private wordTexts;
201
201
  private textStyle;
@@ -218,13 +218,13 @@ export declare class Text extends BaseClip<ITextEvents> {
218
218
  startTime: number;
219
219
  duration: number;
220
220
  }>;
221
- constructor(text: string, opts?: ITextOpts, renderer?: Application["renderer"]);
221
+ constructor(text: string, opts?: ITextOpts, renderer?: Application['renderer']);
222
222
  /**
223
223
  * Set an external renderer (e.g., from Studio) to avoid creating our own Pixi App
224
224
  * This is an optimization for Studio preview
225
225
  * Can be called before ready() completes
226
226
  */
227
- setRenderer(renderer: Application["renderer"]): void;
227
+ setRenderer(renderer: Application['renderer']): void;
228
228
  /**
229
229
  * Get the renderer for rendering text to RenderTexture
230
230
  * Creates a minimal renderer as fallback if no external renderer is provided
@@ -239,7 +239,7 @@ export declare class Text extends BaseClip<ITextEvents> {
239
239
  getTexture(): Promise<Texture | null>;
240
240
  tick(_time: number): Promise<{
241
241
  video: ImageBitmap;
242
- state: "success";
242
+ state: 'success';
243
243
  }>;
244
244
  split(_time: number): Promise<[this, this]>;
245
245
  animate(time: number): void;
@@ -283,5 +283,5 @@ export declare class Text extends BaseClip<ITextEvents> {
283
283
  * Text clips should only show: mr (mid-right), mb (mid-bottom), br (bottom-right), and rot (rotation)
284
284
  * This allows resizing width and height independently while preventing corner handles that might distort text
285
285
  */
286
- getVisibleHandles(): Array<"tl" | "tr" | "bl" | "br" | "ml" | "mr" | "mt" | "mb" | "rot">;
286
+ getVisibleHandles(): Array<'tl' | 'tr' | 'bl' | 'br' | 'ml' | 'mr' | 'mt' | 'mb' | 'rot'>;
287
287
  }
@@ -7,11 +7,14 @@ export interface ICompositorOpts {
7
7
  bitrate?: number;
8
8
  fps?: number;
9
9
  bgColor?: string;
10
+ format?: string;
10
11
  videoCodec?: string;
11
12
  /**
12
13
  * If false, exclude audio track from the output video
13
14
  */
14
15
  audio?: false;
16
+ audioCodec?: string;
17
+ audioSampleRate?: number;
15
18
  /**
16
19
  * Write metadata tags to the output video
17
20
  */
@@ -1,6 +1,9 @@
1
- import { Filter, RenderTexture } from 'pixi.js';
1
+ import { Filter, Texture, RenderTexture } from 'pixi.js';
2
2
  import { EffectOptions, EffectRendererOptions } from './types';
3
3
  export declare function makeEffect({ name, renderer }: EffectOptions): {
4
+ filter: null;
5
+ render({ canvasTexture }: EffectRendererOptions): Texture<import('pixi.js').TextureSource<any>>;
6
+ } | {
4
7
  filter: Filter;
5
8
  render({ width, height, canvasTexture, progress }: EffectRendererOptions): RenderTexture;
6
9
  };
@@ -1015,3 +1015,18 @@ export declare const FAST_ZOOM_UNIFORMS: {
1015
1015
  type: string;
1016
1016
  };
1017
1017
  };
1018
+ export declare const CHROMA_KEY_FRAGMENT = "\nprecision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uTexture;\n\nuniform vec3 uKeyColor; \nuniform float uSimilarity; \nuniform float uSpill; \n\nvoid main() {\n vec4 color = texture2D(uTexture, vTextureCoord);\n \n float maxChannel = max(max(uKeyColor.r, uKeyColor.g), uKeyColor.b);\n \n float diff;\n float spillAmount = 0.0;\n \n if (maxChannel == uKeyColor.g && uKeyColor.g > uKeyColor.r && uKeyColor.g > uKeyColor.b) {\n diff = color.g - max(color.r, color.b);\n spillAmount = max(0.0, color.g - max(color.r, color.b));\n color.g -= spillAmount * uSpill;\n \n float avg = (color.r + color.b) * 0.5;\n color.r = mix(color.r, avg, spillAmount);\n color.b = mix(color.b, avg, spillAmount);\n } \n else if (maxChannel == uKeyColor.b && uKeyColor.b > uKeyColor.r && uKeyColor.b > uKeyColor.g) {\n diff = color.b - max(color.r, color.g);\n spillAmount = max(0.0, color.b - max(color.r, color.g));\n color.b -= spillAmount * uSpill;\n \n float avg = (color.r + color.g) * 0.5;\n color.r = mix(color.r, avg, spillAmount);\n color.g = mix(color.g, avg, spillAmount);\n } \n else {\n diff = color.r - max(color.g, color.b);\n spillAmount = max(0.0, color.r - max(color.g, color.b));\n color.r -= spillAmount * uSpill;\n \n float avg = (color.g + color.b) * 0.5;\n color.g = mix(color.g, avg, spillAmount);\n color.b = mix(color.b, avg, spillAmount);\n }\n \n float mask = step(uSimilarity, diff); \n float alpha = 1.0 - mask;\n\n if (diff > uSimilarity) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n return;\n }\n\n gl_FragColor = vec4(color.rgb, color.a * alpha);\n}\n";
1019
+ export declare const CHROMA_KEY_UNIFORMS: {
1020
+ uKeyColor: {
1021
+ value: number[];
1022
+ type: string;
1023
+ };
1024
+ uSimilarity: {
1025
+ value: number;
1026
+ type: string;
1027
+ };
1028
+ uSpill: {
1029
+ value: number;
1030
+ type: string;
1031
+ };
1032
+ };
@@ -1,16 +1,38 @@
1
- export interface GlTransition {
1
+ export interface GlEffect {
2
2
  label: string;
3
3
  fragment: string;
4
4
  uniforms?: Record<string, {
5
5
  value: any;
6
6
  type: string;
7
7
  }>;
8
+ previewStatic?: string;
9
+ previewDynamic?: string;
8
10
  }
9
- export declare const GL_EFFECTS: Record<string, GlTransition>;
10
- export type EffectKey = keyof typeof GL_EFFECTS;
11
- export declare const GL_EFFECT_OPTIONS: Array<{
11
+ /**
12
+ * Register a custom effect at runtime
13
+ */
14
+ export declare function registerCustomEffect(name: string, effect: GlEffect): void;
15
+ /**
16
+ * Unregister a custom effect at runtime
17
+ */
18
+ export declare function unregisterCustomEffect(name: string): void;
19
+ /**
20
+ * Get all available effects, including library and runtime registered ones
21
+ */
22
+ export declare function getAllEffects(): Record<string, GlEffect>;
23
+ export declare const GL_EFFECTS: Record<string, GlEffect>;
24
+ export type EffectKey = string;
25
+ export declare function getEffectOptions(): {
12
26
  key: EffectKey;
13
27
  label: string;
14
- previewStatic: string | undefined;
15
- previewDynamic: string | undefined;
16
- }>;
28
+ isCustom: boolean;
29
+ previewStatic: string;
30
+ previewDynamic: string;
31
+ }[];
32
+ export declare const GL_EFFECT_OPTIONS: {
33
+ key: EffectKey;
34
+ label: string;
35
+ isCustom: boolean;
36
+ previewStatic: string;
37
+ previewDynamic: string;
38
+ }[];