pixi-effects 0.11.0 → 0.13.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 +28 -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-CwUxTfja.d.cts → Base-C6ZnJ9pD.d.cts} +1 -1
  11. package/dist/{Base-CyvSLoCP.d.ts → Base-CQOlB2VH.d.ts} +1 -1
  12. package/dist/Controller.cjs +132 -15
  13. package/dist/Controller.cjs.map +1 -1
  14. package/dist/Controller.d.cts +25 -3
  15. package/dist/Controller.d.ts +25 -3
  16. package/dist/Controller.js +132 -15
  17. package/dist/Controller.js.map +1 -1
  18. package/dist/{Movie-DSSNOF3T.d.cts → Movie-DnR4H1OO.d.ts} +93 -2
  19. package/dist/{Movie-nzmWsxWX.d.ts → Movie-Tl5dRLJl.d.cts} +93 -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 +665 -36
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +165 -5
  29. package/dist/index.d.ts +165 -5
  30. package/dist/index.js +659 -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-CBSiUKau.d.cts} +56 -1
  36. package/dist/{types-BXu28nJj.d.ts → types-CBSiUKau.d.ts} +56 -1
  37. package/docs/api.md +80 -0
  38. package/docs/dsl.md +48 -0
  39. package/llms-full.txt +203 -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-CBSiUKau.cjs';
4
4
 
5
5
  interface AudioInspectOptions {
6
6
  /** Width of each loudness window in seconds. Default 0.1. */
@@ -207,6 +207,32 @@ 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
+ /** Pictures for a PDF: stops flagged `pdf: false` are left out (a page whose stops are all flagged has no picture). `exportPDF` sets it. */
232
+ pdf?: boolean;
233
+ /** Called as each picture is ready, in order. */
234
+ onImage?: (image: StopImage) => void;
235
+ }
210
236
  interface ContactSheetOptions {
211
237
  /** Motion blur for these pictures (see `MovieOptions.motionBlur`); overrides the movie's own setting, `false` turns it off. */
212
238
  motionBlur?: MotionBlurSpec;
@@ -226,6 +252,12 @@ interface FrameEvent {
226
252
  frame: number;
227
253
  totalFrames: number;
228
254
  }
255
+ /** A presentation reached a stop (`movie.next()` played to it, or `prev()` / `goToStop()` / `goToPage()` jumped to it). */
256
+ interface StopEvent {
257
+ index: number;
258
+ stop: Stop;
259
+ pageIndex: number;
260
+ }
229
261
  interface ProgressEvent {
230
262
  progress: number;
231
263
  frame: number;
@@ -254,6 +286,12 @@ declare class Movie {
254
286
  private _cancelAudioStart;
255
287
  /** The poster time in seconds (`movie.init({ poster })`), or null. */
256
288
  poster: number | null;
289
+ /** The stops of the composition (`composition.stops`), checked and in order: where `next()` pauses. Empty for an ordinary movie. */
290
+ stops: Stop[];
291
+ /** The frame `next()` is playing toward, or null. */
292
+ private _stopAt;
293
+ private _stopWaiters;
294
+ private _arriving;
257
295
  /** The motion blur `render()`, `snapshot()` and `contactSheet()` apply unless told otherwise (`movie.init({ motionBlur })`), or null. */
258
296
  motionBlur: ResolvedMotionBlur | null;
259
297
  private _posterFrame;
@@ -279,6 +317,8 @@ declare class Movie {
279
317
  private _audioSources;
280
318
  private _mixStats;
281
319
  on(event: 'ready', fn: () => void): this;
320
+ /** A presentation is now on a stop (see `stops` in the composition, `next()`, `prev()`). */
321
+ on(event: 'stop', fn: (e: StopEvent) => void): this;
282
322
  on(event: 'frame', fn: (e: FrameEvent) => void): this;
283
323
  /** A jump to another frame (`gotoFrame`, a seek bar) starts / finishes. Not emitted for playback ticks, `render()`, `snapshot()` or `contactSheet()`. */
284
324
  on(event: 'seeking' | 'seeked', fn: (e: FrameEvent) => void): this;
@@ -330,6 +370,32 @@ declare class Movie {
330
370
  snapshot(frame: number | undefined, opts: SnapshotOptions & {
331
371
  as: 'dataURL';
332
372
  }): Promise<string>;
373
+ /** Seek to `frame` (quietly, and stay there) and encode the canvas as a picture. */
374
+ private _captureFrame;
375
+ /**
376
+ * 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
377
+ * overview, an export. Pauses the movie, and leaves the playhead where it was. `onImage` is called as each picture is ready.
378
+ */
379
+ stopImages(opts: StopImagesOptions & {
380
+ as: 'dataURL';
381
+ }): Promise<Array<StopImage & {
382
+ image: string;
383
+ }>>;
384
+ stopImages(opts?: StopImagesOptions): Promise<StopImage[]>;
385
+ /**
386
+ * The deck as a PDF: one page per page of the talk (the page's last stop, fully built, unless a stop says `pdf: true` or `pdf: false`;
387
+ * `which: 'stops'` makes a page of every stop that is not `pdf: false`), each a
388
+ * JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
389
+ */
390
+ exportPDF(opts?: {
391
+ which?: 'pages' | 'stops';
392
+ pick?: 'last' | 'first';
393
+ scale?: number;
394
+ quality?: number;
395
+ title?: string;
396
+ motionBlur?: MotionBlurSpec;
397
+ onImage?: (image: StopImage) => void;
398
+ }): Promise<Blob>;
333
399
  /**
334
400
  * Several frames on ONE image, each labelled with its frame number and time — the cheapest way to
335
401
  * check a whole animation by eye. Restores the current frame afterwards.
@@ -378,6 +444,31 @@ declare class Movie {
378
444
  */
379
445
  _exposeFrame(frame: number, mb: ResolvedMotionBlur, target: HTMLCanvasElement, settle: boolean): Promise<void>;
380
446
  private _blurCanvas;
447
+ /** Which stop the playhead is on or has passed (-1 before the first). */
448
+ get stopIndex(): number;
449
+ /** The stop the playhead is on or has passed, or null. */
450
+ get currentStop(): Stop | null;
451
+ /** Which page the playhead is in (0-based), -1 before the first stop. */
452
+ get pageIndex(): number;
453
+ /** How many pages the stops make. */
454
+ get pageCount(): number;
455
+ private _cancelStop;
456
+ private _settleStopWaiters;
457
+ private _emitStop;
458
+ /** Land exactly on a stop's frame, pause, and say so. */
459
+ private _arriveAtStop;
460
+ /**
461
+ * 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
462
+ * 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
463
+ * stopped for another reason). An ordinary `play()` ignores the stops.
464
+ */
465
+ next(): Promise<void>;
466
+ /** Jump back to the previous stop at once (no reverse playback); from the first stop, to the start. */
467
+ prev(): Promise<void>;
468
+ /** Jump to stop `index` (0-based). */
469
+ goToStop(index: number): Promise<void>;
470
+ /** Jump to the first stop of page `page` (0-based). */
471
+ goToPage(page: number): Promise<void>;
381
472
  play(): void;
382
473
  pause(): void;
383
474
  set volume(v: number);
@@ -389,4 +480,4 @@ declare class Movie {
389
480
  destroy(): Promise<void>;
390
481
  }
391
482
 
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 };
483
+ 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 };