pixi-effects 0.7.0 → 0.8.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +7 -6
  3. package/ai/reference/cheatsheet.md +5 -1
  4. package/ai/template.html +3 -3
  5. package/dist/Composition-CM62XJKT.cjs +14 -0
  6. package/dist/{Composition-3KHQPRBA.cjs.map → Composition-CM62XJKT.cjs.map} +1 -1
  7. package/dist/Composition-RJDSQYTV.js +5 -0
  8. package/dist/{Composition-DT657FO5.js.map → Composition-RJDSQYTV.js.map} +1 -1
  9. package/dist/Controller.cjs +55 -20
  10. package/dist/Controller.cjs.map +1 -1
  11. package/dist/Controller.d.cts +31 -2
  12. package/dist/Controller.d.ts +31 -2
  13. package/dist/Controller.js +55 -21
  14. package/dist/Controller.js.map +1 -1
  15. package/dist/{Movie-BK9daiTt.d.cts → Movie-CQOhUmko.d.cts} +24 -1
  16. package/dist/{Movie-B0OUKlZI.d.ts → Movie-HF3pSGjQ.d.ts} +24 -1
  17. package/dist/{chunk-6I55T4OH.cjs → chunk-AGMNSJJH.cjs} +13 -4
  18. package/dist/chunk-AGMNSJJH.cjs.map +1 -0
  19. package/dist/{chunk-4O2NYDJG.js → chunk-FNKSXBKB.js} +13 -4
  20. package/dist/chunk-FNKSXBKB.js.map +1 -0
  21. package/dist/{chunk-36Z4RIRK.js → chunk-O4AJYUPK.js} +3 -3
  22. package/dist/{chunk-36Z4RIRK.js.map → chunk-O4AJYUPK.js.map} +1 -1
  23. package/dist/{chunk-4VSIJLU3.cjs → chunk-PDBDDGG5.cjs} +21 -21
  24. package/dist/{chunk-4VSIJLU3.cjs.map → chunk-PDBDDGG5.cjs.map} +1 -1
  25. package/dist/index.cjs +82 -23
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +71 -12
  30. package/dist/index.js.map +1 -1
  31. package/dist/three.cjs +5 -5
  32. package/dist/three.js +1 -1
  33. package/docs/api.md +51 -0
  34. package/docs/dsl.md +14 -2
  35. package/llms-full.txt +70 -3
  36. package/package.json +1 -1
  37. package/dist/Composition-3KHQPRBA.cjs +0 -14
  38. package/dist/Composition-DT657FO5.js +0 -5
  39. package/dist/chunk-4O2NYDJG.js.map +0 -1
  40. package/dist/chunk-6I55T4OH.cjs.map +0 -1
@@ -182,6 +182,17 @@ interface ProgressEvent {
182
182
  frame: number;
183
183
  totalFrames: number;
184
184
  }
185
+ /** `volumechange`: the values after the change. */
186
+ interface VolumeEvent {
187
+ volume: number;
188
+ muted: boolean;
189
+ }
190
+ /** `error`: something failed in `init()`, `render()` or during playback. The call that failed still rejects / warns as before. */
191
+ interface MovieErrorEvent {
192
+ where: 'init' | 'render' | 'playback';
193
+ message: string;
194
+ error: unknown;
195
+ }
185
196
  type Listener = (...args: any[]) => void;
186
197
  declare class Movie {
187
198
  private _events;
@@ -192,6 +203,8 @@ declare class Movie {
192
203
  audioSource: AudioBufferSourceNode | null;
193
204
  gainNode: GainNode | null;
194
205
  private _cancelAudioStart;
206
+ /** > 0 while the movie moves its own playhead (playback, render, snapshot, contactSheet): those are not the seeks `seeking` / `seeked` report. */
207
+ private _quiet;
195
208
  private _volume;
196
209
  private _muted;
197
210
  isPlaying: boolean;
@@ -211,6 +224,12 @@ declare class Movie {
211
224
  private _mixStats;
212
225
  on(event: 'ready', fn: () => void): this;
213
226
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
227
+ /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
228
+ on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
229
+ /** Playback ran off the end (after `pause`). Pausing by hand does not emit it. */
230
+ on(event: 'ended', fn: () => void): this;
231
+ on(event: 'volumechange', fn: (e: VolumeEvent) => void): this;
232
+ on(event: 'error', fn: (e: MovieErrorEvent) => void): this;
214
233
  on(event: 'progress', fn: (e: ProgressEvent) => void): this;
215
234
  on(event: 'play', fn: () => void): this;
216
235
  on(event: 'pause', fn: () => void): this;
@@ -220,6 +239,10 @@ declare class Movie {
220
239
  private _ensureAudioContext;
221
240
  init(options?: MovieOptions): Promise<void>;
222
241
  gotoFrame(frame: number, force?: boolean): Promise<void>;
242
+ /** Run `fn` with `seeking` / `seeked` silenced: the movie is moving its own playhead, not answering a seek. */
243
+ private _quietly;
244
+ private _emitError;
245
+ private _goto;
223
246
  private _awaitVideoFrames;
224
247
  /**
225
248
  * A picture of one frame (the canvas only: the player bar is not included). Seeks there first and
@@ -282,4 +305,4 @@ declare class Movie {
282
305
  destroy(): Promise<void>;
283
306
  }
284
307
 
285
- export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, Movie as M, type ProgressEvent as P, type RenderOptions as R, type SnapshotOptions as S, type TimelineData as T, type AudioReport as a, type AudioSourceReport as b, type InspectReport as c, type MovieOptions as d, type SoundMeasure as e, type TimelineHtmlOptions as f, type TimelineRow as g, type TimelineSvgOptions as h, type TimelineTransition as i };
308
+ export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, Movie as M, type ProgressEvent as P, type RenderOptions as R, type SnapshotOptions as S, type TimelineData as T, type VolumeEvent as V, type AudioReport as a, type AudioSourceReport as b, type InspectReport as c, type MovieErrorEvent as d, type MovieOptions as e, type SoundMeasure as f, type TimelineHtmlOptions as g, type TimelineRow as h, type TimelineSvgOptions as i, type TimelineTransition as j };
@@ -182,6 +182,17 @@ interface ProgressEvent {
182
182
  frame: number;
183
183
  totalFrames: number;
184
184
  }
185
+ /** `volumechange`: the values after the change. */
186
+ interface VolumeEvent {
187
+ volume: number;
188
+ muted: boolean;
189
+ }
190
+ /** `error`: something failed in `init()`, `render()` or during playback. The call that failed still rejects / warns as before. */
191
+ interface MovieErrorEvent {
192
+ where: 'init' | 'render' | 'playback';
193
+ message: string;
194
+ error: unknown;
195
+ }
185
196
  type Listener = (...args: any[]) => void;
186
197
  declare class Movie {
187
198
  private _events;
@@ -192,6 +203,8 @@ declare class Movie {
192
203
  audioSource: AudioBufferSourceNode | null;
193
204
  gainNode: GainNode | null;
194
205
  private _cancelAudioStart;
206
+ /** > 0 while the movie moves its own playhead (playback, render, snapshot, contactSheet): those are not the seeks `seeking` / `seeked` report. */
207
+ private _quiet;
195
208
  private _volume;
196
209
  private _muted;
197
210
  isPlaying: boolean;
@@ -211,6 +224,12 @@ declare class Movie {
211
224
  private _mixStats;
212
225
  on(event: 'ready', fn: () => void): this;
213
226
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
227
+ /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
228
+ on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
229
+ /** Playback ran off the end (after `pause`). Pausing by hand does not emit it. */
230
+ on(event: 'ended', fn: () => void): this;
231
+ on(event: 'volumechange', fn: (e: VolumeEvent) => void): this;
232
+ on(event: 'error', fn: (e: MovieErrorEvent) => void): this;
214
233
  on(event: 'progress', fn: (e: ProgressEvent) => void): this;
215
234
  on(event: 'play', fn: () => void): this;
216
235
  on(event: 'pause', fn: () => void): this;
@@ -220,6 +239,10 @@ declare class Movie {
220
239
  private _ensureAudioContext;
221
240
  init(options?: MovieOptions): Promise<void>;
222
241
  gotoFrame(frame: number, force?: boolean): Promise<void>;
242
+ /** Run `fn` with `seeking` / `seeked` silenced: the movie is moving its own playhead, not answering a seek. */
243
+ private _quietly;
244
+ private _emitError;
245
+ private _goto;
223
246
  private _awaitVideoFrames;
224
247
  /**
225
248
  * A picture of one frame (the canvas only: the player bar is not included). Seeks there first and
@@ -282,4 +305,4 @@ declare class Movie {
282
305
  destroy(): Promise<void>;
283
306
  }
284
307
 
285
- export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, Movie as M, type ProgressEvent as P, type RenderOptions as R, type SnapshotOptions as S, type TimelineData as T, type AudioReport as a, type AudioSourceReport as b, type InspectReport as c, type MovieOptions as d, type SoundMeasure as e, type TimelineHtmlOptions as f, type TimelineRow as g, type TimelineSvgOptions as h, type TimelineTransition as i };
308
+ export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, Movie as M, type ProgressEvent as P, type RenderOptions as R, type SnapshotOptions as S, type TimelineData as T, type VolumeEvent as V, type AudioReport as a, type AudioSourceReport as b, type InspectReport as c, type MovieErrorEvent as d, type MovieOptions as e, type SoundMeasure as f, type TimelineHtmlOptions as g, type TimelineRow as h, type TimelineSvgOptions as i, type TimelineTransition as j };
@@ -825,6 +825,14 @@ function colorMatrix(params) {
825
825
  if (Array.isArray(params.matrix)) f.matrix = params.matrix;
826
826
  return f;
827
827
  }
828
+ var GRADIENT_TYPES = ["linear", "radial", "conic"];
829
+ function colorGradientParams(params) {
830
+ const { gradientType, ...rest } = params;
831
+ if (gradientType === void 0) return rest;
832
+ const i = GRADIENT_TYPES.indexOf(String(gradientType));
833
+ if (i < 0) throw new Error(`pixi-effects: colorGradient gradientType "${gradientType}" is not one of linear, radial or conic`);
834
+ return { ...rest, type: i };
835
+ }
828
836
  function createNamedFilter(type, params) {
829
837
  if (lower(type) === "colormatrix") return colorMatrix(params);
830
838
  const core = Object.entries(CORE).find(([k]) => lower(k) === lower(type));
@@ -833,7 +841,8 @@ function createNamedFilter(type, params) {
833
841
  const Ctor = library?.get(lower(type));
834
842
  if (!Ctor) throw MISSING(type, library ? "not found in the loaded package" : "not loaded yet");
835
843
  const single = SINGLE_VALUE[Object.keys(SINGLE_VALUE).find((k) => lower(k) === lower(type)) ?? ""];
836
- return single ? new Ctor(params[single]) : new Ctor(params);
844
+ if (single) return new Ctor(params[single]);
845
+ return new Ctor(lower(type) === "colorgradient" ? colorGradientParams(params) : params);
837
846
  }
838
847
 
839
848
  // src/filters/index.ts
@@ -2525,7 +2534,7 @@ function numOrZero(v, scope) {
2525
2534
  var _CompositionSequence = null;
2526
2535
  async function getCompositionSequence() {
2527
2536
  if (!_CompositionSequence) {
2528
- _CompositionSequence = (await import('./Composition-3KHQPRBA.cjs')).CompositionSequence;
2537
+ _CompositionSequence = (await import('./Composition-CM62XJKT.cjs')).CompositionSequence;
2529
2538
  }
2530
2539
  return _CompositionSequence;
2531
2540
  }
@@ -2582,5 +2591,5 @@ exports.projectLayer = projectLayer;
2582
2591
  exports.registerSequenceType = registerSequenceType;
2583
2592
  exports.resolveAt = resolveAt;
2584
2593
  exports.summarizeWarnings = summarizeWarnings;
2585
- //# sourceMappingURL=chunk-6I55T4OH.cjs.map
2586
- //# sourceMappingURL=chunk-6I55T4OH.cjs.map
2594
+ //# sourceMappingURL=chunk-AGMNSJJH.cjs.map
2595
+ //# sourceMappingURL=chunk-AGMNSJJH.cjs.map