pixi-effects 0.11.0 → 0.12.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 (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +11 -8
  3. package/ai/SKILL.md +2 -1
  4. package/ai/reference/cheatsheet.md +12 -1
  5. package/ai/reference/pitfalls.md +4 -0
  6. package/ai/reference/recipes.md +57 -0
  7. package/ai/template.html +8 -4
  8. package/ai/tools/check.mjs +17 -1
  9. package/ai/tools/render.mjs +13 -9
  10. package/dist/{Base-CyvSLoCP.d.ts → Base-CYH9vPCH.d.ts} +1 -1
  11. package/dist/{Base-CwUxTfja.d.cts → Base-W3sQzGPO.d.cts} +1 -1
  12. package/dist/Controller.cjs +58 -0
  13. package/dist/Controller.cjs.map +1 -1
  14. package/dist/Controller.d.cts +13 -3
  15. package/dist/Controller.d.ts +13 -3
  16. package/dist/Controller.js +58 -0
  17. package/dist/Controller.js.map +1 -1
  18. package/dist/{Movie-nzmWsxWX.d.ts → Movie-CY2QPVVM.d.cts} +90 -2
  19. package/dist/{Movie-DSSNOF3T.d.cts → Movie-EBF6_RfX.d.ts} +90 -2
  20. package/dist/Presenter.cjs +671 -0
  21. package/dist/Presenter.cjs.map +1 -0
  22. package/dist/Presenter.d.cts +123 -0
  23. package/dist/Presenter.d.ts +123 -0
  24. package/dist/Presenter.js +669 -0
  25. package/dist/Presenter.js.map +1 -0
  26. package/dist/index.cjs +645 -36
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +162 -5
  29. package/dist/index.d.ts +162 -5
  30. package/dist/index.js +640 -37
  31. package/dist/index.js.map +1 -1
  32. package/dist/loader.css +1 -1
  33. package/dist/three.d.cts +2 -2
  34. package/dist/three.d.ts +2 -2
  35. package/dist/{types-BXu28nJj.d.cts → types-mpqQO8MJ.d.cts} +39 -1
  36. package/dist/{types-BXu28nJj.d.ts → types-mpqQO8MJ.d.ts} +39 -1
  37. package/docs/api.md +79 -0
  38. package/docs/dsl.md +48 -0
  39. package/llms-full.txt +202 -2
  40. package/llms.txt +3 -3
  41. package/package.json +5 -1
@@ -1,6 +1,6 @@
1
1
  import { Application } from 'pixi.js';
2
2
  import { gsap } from 'gsap';
3
- import { c as AssetSpec, j as CompositionSpec } from './types-BXu28nJj.js';
3
+ import { z as Stop, e as AssetSpec, c as CompositionSpec } from './types-mpqQO8MJ.cjs';
4
4
 
5
5
  interface AudioInspectOptions {
6
6
  /** Width of each loudness window in seconds. Default 0.1. */
@@ -207,6 +207,30 @@ interface SnapshotOptions {
207
207
  /** Return a `data:` URL string instead of a Blob (handy for scripts that can only return text). */
208
208
  as?: 'blob' | 'dataURL';
209
209
  }
210
+ /** One picture of a stop (see `movie.stopImages()`). */
211
+ interface StopImage {
212
+ stop: Stop; /** The page it belongs to (0-based). */
213
+ page: number;
214
+ image: Blob | string;
215
+ }
216
+ interface StopImagesOptions {
217
+ /** One picture per page (default) or one per stop. */
218
+ which?: 'pages' | 'stops';
219
+ /** With `which: 'pages'`: the page's last stop (default: the page fully built) or its first. */
220
+ pick?: 'last' | 'first';
221
+ /** Output size relative to the canvas. Default 1. */
222
+ scale?: number;
223
+ /** `'image/png'` (default) or `'image/jpeg'`. */
224
+ type?: 'image/png' | 'image/jpeg';
225
+ /** JPEG quality, 0–1. */
226
+ quality?: number;
227
+ /** Return `data:` URLs instead of Blobs. */
228
+ as?: 'blob' | 'dataURL';
229
+ /** Motion blur for the pictures (off unless you ask: they are usually for looking at). */
230
+ motionBlur?: MotionBlurSpec;
231
+ /** Called as each picture is ready, in order. */
232
+ onImage?: (image: StopImage) => void;
233
+ }
210
234
  interface ContactSheetOptions {
211
235
  /** Motion blur for these pictures (see `MovieOptions.motionBlur`); overrides the movie's own setting, `false` turns it off. */
212
236
  motionBlur?: MotionBlurSpec;
@@ -226,6 +250,12 @@ interface FrameEvent {
226
250
  frame: number;
227
251
  totalFrames: number;
228
252
  }
253
+ /** A presentation reached a stop (`movie.next()` played to it, or `prev()` / `goToStop()` / `goToPage()` jumped to it). */
254
+ interface StopEvent {
255
+ index: number;
256
+ stop: Stop;
257
+ pageIndex: number;
258
+ }
229
259
  interface ProgressEvent {
230
260
  progress: number;
231
261
  frame: number;
@@ -254,6 +284,12 @@ declare class Movie {
254
284
  private _cancelAudioStart;
255
285
  /** The poster time in seconds (`movie.init({ poster })`), or null. */
256
286
  poster: number | null;
287
+ /** The stops of the composition (`composition.stops`), checked and in order: where `next()` pauses. Empty for an ordinary movie. */
288
+ stops: Stop[];
289
+ /** The frame `next()` is playing toward, or null. */
290
+ private _stopAt;
291
+ private _stopWaiters;
292
+ private _arriving;
257
293
  /** The motion blur `render()`, `snapshot()` and `contactSheet()` apply unless told otherwise (`movie.init({ motionBlur })`), or null. */
258
294
  motionBlur: ResolvedMotionBlur | null;
259
295
  private _posterFrame;
@@ -279,6 +315,8 @@ declare class Movie {
279
315
  private _audioSources;
280
316
  private _mixStats;
281
317
  on(event: 'ready', fn: () => void): this;
318
+ /** A presentation is now on a stop (see `stops` in the composition, `next()`, `prev()`). */
319
+ on(event: 'stop', fn: (e: StopEvent) => void): this;
282
320
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
283
321
  /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
284
322
  on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
@@ -330,6 +368,31 @@ declare class Movie {
330
368
  snapshot(frame: number | undefined, opts: SnapshotOptions & {
331
369
  as: 'dataURL';
332
370
  }): Promise<string>;
371
+ /** Seek to `frame` (quietly, and stay there) and encode the canvas as a picture. */
372
+ private _captureFrame;
373
+ /**
374
+ * A picture of the settled state of each page (default: the page's last stop, fully built) or of every stop, for a page list, an
375
+ * overview, an export. Pauses the movie, and leaves the playhead where it was. `onImage` is called as each picture is ready.
376
+ */
377
+ stopImages(opts: StopImagesOptions & {
378
+ as: 'dataURL';
379
+ }): Promise<Array<StopImage & {
380
+ image: string;
381
+ }>>;
382
+ stopImages(opts?: StopImagesOptions): Promise<StopImage[]>;
383
+ /**
384
+ * The deck as a PDF: one page per page of the talk (the page's last stop, fully built; `which: 'stops'` makes a page of every stop), each a
385
+ * JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
386
+ */
387
+ exportPDF(opts?: {
388
+ which?: 'pages' | 'stops';
389
+ pick?: 'last' | 'first';
390
+ scale?: number;
391
+ quality?: number;
392
+ title?: string;
393
+ motionBlur?: MotionBlurSpec;
394
+ onImage?: (image: StopImage) => void;
395
+ }): Promise<Blob>;
333
396
  /**
334
397
  * Several frames on ONE image, each labelled with its frame number and time — the cheapest way to
335
398
  * check a whole animation by eye. Restores the current frame afterwards.
@@ -378,6 +441,31 @@ declare class Movie {
378
441
  */
379
442
  _exposeFrame(frame: number, mb: ResolvedMotionBlur, target: HTMLCanvasElement, settle: boolean): Promise<void>;
380
443
  private _blurCanvas;
444
+ /** Which stop the playhead is on or has passed (-1 before the first). */
445
+ get stopIndex(): number;
446
+ /** The stop the playhead is on or has passed, or null. */
447
+ get currentStop(): Stop | null;
448
+ /** Which page the playhead is in (0-based), -1 before the first stop. */
449
+ get pageIndex(): number;
450
+ /** How many pages the stops make. */
451
+ get pageCount(): number;
452
+ private _cancelStop;
453
+ private _settleStopWaiters;
454
+ private _emitStop;
455
+ /** Land exactly on a stop's frame, pause, and say so. */
456
+ private _arriveAtStop;
457
+ /**
458
+ * Play to the next stop and pause exactly there (a presentation's "next"). Pressed again while it is playing toward a stop, it skips the
459
+ * rest of the animation and lands on that stop at once. After the last stop it plays to the end. Resolves when it has landed (or
460
+ * stopped for another reason). An ordinary `play()` ignores the stops.
461
+ */
462
+ next(): Promise<void>;
463
+ /** Jump back to the previous stop at once (no reverse playback); from the first stop, to the start. */
464
+ prev(): Promise<void>;
465
+ /** Jump to stop `index` (0-based). */
466
+ goToStop(index: number): Promise<void>;
467
+ /** Jump to the first stop of page `page` (0-based). */
468
+ goToPage(page: number): Promise<void>;
381
469
  play(): void;
382
470
  pause(): void;
383
471
  set volume(v: number);
@@ -389,4 +477,4 @@ declare class Movie {
389
477
  destroy(): Promise<void>;
390
478
  }
391
479
 
392
- export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, type MotionBlurOptions 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 LoaderOption as d, type MotionBlurSpec as e, Movie as f, type MovieErrorEvent as g, type MovieOptions as h, type SoundMeasure as i, type TimelineHtmlOptions as j, type TimelineRow as k, type TimelineSvgOptions as l, type TimelineTransition as m, dismissLoader as n, failLoader as o, resolveLoader as r };
480
+ export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, type MotionBlurOptions 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 LoaderOption as d, type MotionBlurSpec as e, Movie as f, type MovieErrorEvent as g, type MovieOptions as h, type SoundMeasure as i, type StopEvent as j, type StopImage as k, type StopImagesOptions as l, type TimelineHtmlOptions as m, type TimelineRow as n, type TimelineSvgOptions as o, type TimelineTransition as p, dismissLoader as q, failLoader as r, resolveLoader as s };
@@ -1,6 +1,6 @@
1
1
  import { Application } from 'pixi.js';
2
2
  import { gsap } from 'gsap';
3
- import { c as AssetSpec, j as CompositionSpec } from './types-BXu28nJj.cjs';
3
+ import { z as Stop, e as AssetSpec, c as CompositionSpec } from './types-mpqQO8MJ.js';
4
4
 
5
5
  interface AudioInspectOptions {
6
6
  /** Width of each loudness window in seconds. Default 0.1. */
@@ -207,6 +207,30 @@ interface SnapshotOptions {
207
207
  /** Return a `data:` URL string instead of a Blob (handy for scripts that can only return text). */
208
208
  as?: 'blob' | 'dataURL';
209
209
  }
210
+ /** One picture of a stop (see `movie.stopImages()`). */
211
+ interface StopImage {
212
+ stop: Stop; /** The page it belongs to (0-based). */
213
+ page: number;
214
+ image: Blob | string;
215
+ }
216
+ interface StopImagesOptions {
217
+ /** One picture per page (default) or one per stop. */
218
+ which?: 'pages' | 'stops';
219
+ /** With `which: 'pages'`: the page's last stop (default: the page fully built) or its first. */
220
+ pick?: 'last' | 'first';
221
+ /** Output size relative to the canvas. Default 1. */
222
+ scale?: number;
223
+ /** `'image/png'` (default) or `'image/jpeg'`. */
224
+ type?: 'image/png' | 'image/jpeg';
225
+ /** JPEG quality, 0–1. */
226
+ quality?: number;
227
+ /** Return `data:` URLs instead of Blobs. */
228
+ as?: 'blob' | 'dataURL';
229
+ /** Motion blur for the pictures (off unless you ask: they are usually for looking at). */
230
+ motionBlur?: MotionBlurSpec;
231
+ /** Called as each picture is ready, in order. */
232
+ onImage?: (image: StopImage) => void;
233
+ }
210
234
  interface ContactSheetOptions {
211
235
  /** Motion blur for these pictures (see `MovieOptions.motionBlur`); overrides the movie's own setting, `false` turns it off. */
212
236
  motionBlur?: MotionBlurSpec;
@@ -226,6 +250,12 @@ interface FrameEvent {
226
250
  frame: number;
227
251
  totalFrames: number;
228
252
  }
253
+ /** A presentation reached a stop (`movie.next()` played to it, or `prev()` / `goToStop()` / `goToPage()` jumped to it). */
254
+ interface StopEvent {
255
+ index: number;
256
+ stop: Stop;
257
+ pageIndex: number;
258
+ }
229
259
  interface ProgressEvent {
230
260
  progress: number;
231
261
  frame: number;
@@ -254,6 +284,12 @@ declare class Movie {
254
284
  private _cancelAudioStart;
255
285
  /** The poster time in seconds (`movie.init({ poster })`), or null. */
256
286
  poster: number | null;
287
+ /** The stops of the composition (`composition.stops`), checked and in order: where `next()` pauses. Empty for an ordinary movie. */
288
+ stops: Stop[];
289
+ /** The frame `next()` is playing toward, or null. */
290
+ private _stopAt;
291
+ private _stopWaiters;
292
+ private _arriving;
257
293
  /** The motion blur `render()`, `snapshot()` and `contactSheet()` apply unless told otherwise (`movie.init({ motionBlur })`), or null. */
258
294
  motionBlur: ResolvedMotionBlur | null;
259
295
  private _posterFrame;
@@ -279,6 +315,8 @@ declare class Movie {
279
315
  private _audioSources;
280
316
  private _mixStats;
281
317
  on(event: 'ready', fn: () => void): this;
318
+ /** A presentation is now on a stop (see `stops` in the composition, `next()`, `prev()`). */
319
+ on(event: 'stop', fn: (e: StopEvent) => void): this;
282
320
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
283
321
  /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
284
322
  on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
@@ -330,6 +368,31 @@ declare class Movie {
330
368
  snapshot(frame: number | undefined, opts: SnapshotOptions & {
331
369
  as: 'dataURL';
332
370
  }): Promise<string>;
371
+ /** Seek to `frame` (quietly, and stay there) and encode the canvas as a picture. */
372
+ private _captureFrame;
373
+ /**
374
+ * A picture of the settled state of each page (default: the page's last stop, fully built) or of every stop, for a page list, an
375
+ * overview, an export. Pauses the movie, and leaves the playhead where it was. `onImage` is called as each picture is ready.
376
+ */
377
+ stopImages(opts: StopImagesOptions & {
378
+ as: 'dataURL';
379
+ }): Promise<Array<StopImage & {
380
+ image: string;
381
+ }>>;
382
+ stopImages(opts?: StopImagesOptions): Promise<StopImage[]>;
383
+ /**
384
+ * The deck as a PDF: one page per page of the talk (the page's last stop, fully built; `which: 'stops'` makes a page of every stop), each a
385
+ * JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
386
+ */
387
+ exportPDF(opts?: {
388
+ which?: 'pages' | 'stops';
389
+ pick?: 'last' | 'first';
390
+ scale?: number;
391
+ quality?: number;
392
+ title?: string;
393
+ motionBlur?: MotionBlurSpec;
394
+ onImage?: (image: StopImage) => void;
395
+ }): Promise<Blob>;
333
396
  /**
334
397
  * Several frames on ONE image, each labelled with its frame number and time — the cheapest way to
335
398
  * check a whole animation by eye. Restores the current frame afterwards.
@@ -378,6 +441,31 @@ declare class Movie {
378
441
  */
379
442
  _exposeFrame(frame: number, mb: ResolvedMotionBlur, target: HTMLCanvasElement, settle: boolean): Promise<void>;
380
443
  private _blurCanvas;
444
+ /** Which stop the playhead is on or has passed (-1 before the first). */
445
+ get stopIndex(): number;
446
+ /** The stop the playhead is on or has passed, or null. */
447
+ get currentStop(): Stop | null;
448
+ /** Which page the playhead is in (0-based), -1 before the first stop. */
449
+ get pageIndex(): number;
450
+ /** How many pages the stops make. */
451
+ get pageCount(): number;
452
+ private _cancelStop;
453
+ private _settleStopWaiters;
454
+ private _emitStop;
455
+ /** Land exactly on a stop's frame, pause, and say so. */
456
+ private _arriveAtStop;
457
+ /**
458
+ * Play to the next stop and pause exactly there (a presentation's "next"). Pressed again while it is playing toward a stop, it skips the
459
+ * rest of the animation and lands on that stop at once. After the last stop it plays to the end. Resolves when it has landed (or
460
+ * stopped for another reason). An ordinary `play()` ignores the stops.
461
+ */
462
+ next(): Promise<void>;
463
+ /** Jump back to the previous stop at once (no reverse playback); from the first stop, to the start. */
464
+ prev(): Promise<void>;
465
+ /** Jump to stop `index` (0-based). */
466
+ goToStop(index: number): Promise<void>;
467
+ /** Jump to the first stop of page `page` (0-based). */
468
+ goToPage(page: number): Promise<void>;
381
469
  play(): void;
382
470
  pause(): void;
383
471
  set volume(v: number);
@@ -389,4 +477,4 @@ declare class Movie {
389
477
  destroy(): Promise<void>;
390
478
  }
391
479
 
392
- export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, type MotionBlurOptions 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 LoaderOption as d, type MotionBlurSpec as e, Movie as f, type MovieErrorEvent as g, type MovieOptions as h, type SoundMeasure as i, type TimelineHtmlOptions as j, type TimelineRow as k, type TimelineSvgOptions as l, type TimelineTransition as m, dismissLoader as n, failLoader as o, resolveLoader as r };
480
+ export { type AudioInspectOptions as A, type ContactSheetOptions as C, type FrameEvent as F, type InspectOptions as I, type LayerInfo as L, type MotionBlurOptions 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 LoaderOption as d, type MotionBlurSpec as e, Movie as f, type MovieErrorEvent as g, type MovieOptions as h, type SoundMeasure as i, type StopEvent as j, type StopImage as k, type StopImagesOptions as l, type TimelineHtmlOptions as m, type TimelineRow as n, type TimelineSvgOptions as o, type TimelineTransition as p, dismissLoader as q, failLoader as r, resolveLoader as s };