pixi-effects 0.7.0 → 0.9.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 (42) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +8 -7
  3. package/ai/SKILL.md +6 -5
  4. package/ai/reference/cheatsheet.md +9 -1
  5. package/ai/template.html +4 -3
  6. package/ai/tools/check.mjs +8 -0
  7. package/dist/Composition-CM62XJKT.cjs +14 -0
  8. package/dist/{Composition-3KHQPRBA.cjs.map → Composition-CM62XJKT.cjs.map} +1 -1
  9. package/dist/Composition-RJDSQYTV.js +5 -0
  10. package/dist/{Composition-DT657FO5.js.map → Composition-RJDSQYTV.js.map} +1 -1
  11. package/dist/Controller.cjs +55 -20
  12. package/dist/Controller.cjs.map +1 -1
  13. package/dist/Controller.d.cts +31 -2
  14. package/dist/Controller.d.ts +31 -2
  15. package/dist/Controller.js +55 -21
  16. package/dist/Controller.js.map +1 -1
  17. package/dist/{Movie-B0OUKlZI.d.ts → Movie-QMlFyHkf.d.ts} +49 -1
  18. package/dist/{Movie-BK9daiTt.d.cts → Movie-qGHp15c_.d.cts} +49 -1
  19. package/dist/{chunk-6I55T4OH.cjs → chunk-AGMNSJJH.cjs} +13 -4
  20. package/dist/chunk-AGMNSJJH.cjs.map +1 -0
  21. package/dist/{chunk-4O2NYDJG.js → chunk-FNKSXBKB.js} +13 -4
  22. package/dist/chunk-FNKSXBKB.js.map +1 -0
  23. package/dist/{chunk-36Z4RIRK.js → chunk-O4AJYUPK.js} +3 -3
  24. package/dist/{chunk-36Z4RIRK.js.map → chunk-O4AJYUPK.js.map} +1 -1
  25. package/dist/{chunk-4VSIJLU3.cjs → chunk-PDBDDGG5.cjs} +21 -21
  26. package/dist/{chunk-4VSIJLU3.cjs.map → chunk-PDBDDGG5.cjs.map} +1 -1
  27. package/dist/index.cjs +141 -26
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +130 -15
  32. package/dist/index.js.map +1 -1
  33. package/dist/three.cjs +5 -5
  34. package/dist/three.js +1 -1
  35. package/docs/api.md +67 -0
  36. package/docs/dsl.md +14 -2
  37. package/llms-full.txt +96 -8
  38. package/package.json +4 -1
  39. package/dist/Composition-3KHQPRBA.cjs +0 -14
  40. package/dist/Composition-DT657FO5.js +0 -5
  41. package/dist/chunk-4O2NYDJG.js.map +0 -1
  42. package/dist/chunk-6I55T4OH.cjs.map +0 -1
@@ -140,6 +140,12 @@ interface MovieOptions {
140
140
  canvas?: HTMLCanvasElement;
141
141
  assets?: AssetSpec[];
142
142
  composition?: CompositionSpec;
143
+ /**
144
+ * The poster time in seconds: the moment that stands for the movie before it plays. The canvas shows that frame once the movie is
145
+ * ready, the playhead stays at 0 and play starts from 0 (like `<video poster>`); `movie.posterImage()` is that picture. A negative
146
+ * value counts back from the end. Default: none (the first frame).
147
+ */
148
+ poster?: number;
143
149
  }
144
150
  interface RenderOptions {
145
151
  format?: 'mp4' | 'mov' | 'webm' | 'mkv';
@@ -182,6 +188,17 @@ interface ProgressEvent {
182
188
  frame: number;
183
189
  totalFrames: number;
184
190
  }
191
+ /** `volumechange`: the values after the change. */
192
+ interface VolumeEvent {
193
+ volume: number;
194
+ muted: boolean;
195
+ }
196
+ /** `error`: something failed in `init()`, `render()` or during playback. The call that failed still rejects / warns as before. */
197
+ interface MovieErrorEvent {
198
+ where: 'init' | 'render' | 'playback';
199
+ message: string;
200
+ error: unknown;
201
+ }
185
202
  type Listener = (...args: any[]) => void;
186
203
  declare class Movie {
187
204
  private _events;
@@ -192,6 +209,13 @@ declare class Movie {
192
209
  audioSource: AudioBufferSourceNode | null;
193
210
  gainNode: GainNode | null;
194
211
  private _cancelAudioStart;
212
+ /** The poster time in seconds (`movie.init({ poster })`), or null. */
213
+ poster: number | null;
214
+ private _posterFrame;
215
+ /** The canvas shows the poster picture while the playhead is still at frame 0 (like `<video poster>`): the first seek or play replaces it. */
216
+ private _atPoster;
217
+ /** > 0 while the movie moves its own playhead (playback, render, snapshot, contactSheet): those are not the seeks `seeking` / `seeked` report. */
218
+ private _quiet;
195
219
  private _volume;
196
220
  private _muted;
197
221
  isPlaying: boolean;
@@ -211,15 +235,39 @@ declare class Movie {
211
235
  private _mixStats;
212
236
  on(event: 'ready', fn: () => void): this;
213
237
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
238
+ /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
239
+ on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
240
+ /** Playback ran off the end (after `pause`). Pausing by hand does not emit it. */
241
+ on(event: 'ended', fn: () => void): this;
242
+ on(event: 'volumechange', fn: (e: VolumeEvent) => void): this;
243
+ on(event: 'error', fn: (e: MovieErrorEvent) => void): this;
214
244
  on(event: 'progress', fn: (e: ProgressEvent) => void): this;
215
245
  on(event: 'play', fn: () => void): this;
216
246
  on(event: 'pause', fn: () => void): this;
217
247
  off(event: string, fn: Listener): this;
218
248
  emit(event: string, ...args: unknown[]): void;
219
249
  get isReady(): boolean;
250
+ /** The poster time as a frame number, or null. */
251
+ get posterFrame(): number | null;
252
+ /** Draw the poster frame on the canvas and leave the playhead where it is (frame 0): the picture before the movie plays. */
253
+ private _showPoster;
254
+ /**
255
+ * The picture at the poster time (frame 0 if the movie has none), as `snapshot()` returns it, and the movie is left as it was:
256
+ * still showing the poster, or back at the frame it was at.
257
+ */
258
+ posterImage(opts?: SnapshotOptions & {
259
+ as?: 'blob';
260
+ }): Promise<Blob>;
261
+ posterImage(opts: SnapshotOptions & {
262
+ as: 'dataURL';
263
+ }): Promise<string>;
220
264
  private _ensureAudioContext;
221
265
  init(options?: MovieOptions): Promise<void>;
222
266
  gotoFrame(frame: number, force?: boolean): Promise<void>;
267
+ /** Run `fn` with `seeking` / `seeked` silenced: the movie is moving its own playhead, not answering a seek. */
268
+ private _quietly;
269
+ private _emitError;
270
+ private _goto;
223
271
  private _awaitVideoFrames;
224
272
  /**
225
273
  * A picture of one frame (the canvas only: the player bar is not included). Seeks there first and
@@ -282,4 +330,4 @@ declare class Movie {
282
330
  destroy(): Promise<void>;
283
331
  }
284
332
 
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 };
333
+ 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 };
@@ -140,6 +140,12 @@ interface MovieOptions {
140
140
  canvas?: HTMLCanvasElement;
141
141
  assets?: AssetSpec[];
142
142
  composition?: CompositionSpec;
143
+ /**
144
+ * The poster time in seconds: the moment that stands for the movie before it plays. The canvas shows that frame once the movie is
145
+ * ready, the playhead stays at 0 and play starts from 0 (like `<video poster>`); `movie.posterImage()` is that picture. A negative
146
+ * value counts back from the end. Default: none (the first frame).
147
+ */
148
+ poster?: number;
143
149
  }
144
150
  interface RenderOptions {
145
151
  format?: 'mp4' | 'mov' | 'webm' | 'mkv';
@@ -182,6 +188,17 @@ interface ProgressEvent {
182
188
  frame: number;
183
189
  totalFrames: number;
184
190
  }
191
+ /** `volumechange`: the values after the change. */
192
+ interface VolumeEvent {
193
+ volume: number;
194
+ muted: boolean;
195
+ }
196
+ /** `error`: something failed in `init()`, `render()` or during playback. The call that failed still rejects / warns as before. */
197
+ interface MovieErrorEvent {
198
+ where: 'init' | 'render' | 'playback';
199
+ message: string;
200
+ error: unknown;
201
+ }
185
202
  type Listener = (...args: any[]) => void;
186
203
  declare class Movie {
187
204
  private _events;
@@ -192,6 +209,13 @@ declare class Movie {
192
209
  audioSource: AudioBufferSourceNode | null;
193
210
  gainNode: GainNode | null;
194
211
  private _cancelAudioStart;
212
+ /** The poster time in seconds (`movie.init({ poster })`), or null. */
213
+ poster: number | null;
214
+ private _posterFrame;
215
+ /** The canvas shows the poster picture while the playhead is still at frame 0 (like `<video poster>`): the first seek or play replaces it. */
216
+ private _atPoster;
217
+ /** > 0 while the movie moves its own playhead (playback, render, snapshot, contactSheet): those are not the seeks `seeking` / `seeked` report. */
218
+ private _quiet;
195
219
  private _volume;
196
220
  private _muted;
197
221
  isPlaying: boolean;
@@ -211,15 +235,39 @@ declare class Movie {
211
235
  private _mixStats;
212
236
  on(event: 'ready', fn: () => void): this;
213
237
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
238
+ /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
239
+ on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
240
+ /** Playback ran off the end (after `pause`). Pausing by hand does not emit it. */
241
+ on(event: 'ended', fn: () => void): this;
242
+ on(event: 'volumechange', fn: (e: VolumeEvent) => void): this;
243
+ on(event: 'error', fn: (e: MovieErrorEvent) => void): this;
214
244
  on(event: 'progress', fn: (e: ProgressEvent) => void): this;
215
245
  on(event: 'play', fn: () => void): this;
216
246
  on(event: 'pause', fn: () => void): this;
217
247
  off(event: string, fn: Listener): this;
218
248
  emit(event: string, ...args: unknown[]): void;
219
249
  get isReady(): boolean;
250
+ /** The poster time as a frame number, or null. */
251
+ get posterFrame(): number | null;
252
+ /** Draw the poster frame on the canvas and leave the playhead where it is (frame 0): the picture before the movie plays. */
253
+ private _showPoster;
254
+ /**
255
+ * The picture at the poster time (frame 0 if the movie has none), as `snapshot()` returns it, and the movie is left as it was:
256
+ * still showing the poster, or back at the frame it was at.
257
+ */
258
+ posterImage(opts?: SnapshotOptions & {
259
+ as?: 'blob';
260
+ }): Promise<Blob>;
261
+ posterImage(opts: SnapshotOptions & {
262
+ as: 'dataURL';
263
+ }): Promise<string>;
220
264
  private _ensureAudioContext;
221
265
  init(options?: MovieOptions): Promise<void>;
222
266
  gotoFrame(frame: number, force?: boolean): Promise<void>;
267
+ /** Run `fn` with `seeking` / `seeked` silenced: the movie is moving its own playhead, not answering a seek. */
268
+ private _quietly;
269
+ private _emitError;
270
+ private _goto;
223
271
  private _awaitVideoFrames;
224
272
  /**
225
273
  * A picture of one frame (the canvas only: the player bar is not included). Seeks there first and
@@ -282,4 +330,4 @@ declare class Movie {
282
330
  destroy(): Promise<void>;
283
331
  }
284
332
 
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 };
333
+ 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