pixi-effects 0.42.0 → 0.43.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 (37) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +5 -5
  3. package/ai/chat-template.html +3 -3
  4. package/dist/{Base-Jgkud1Aw.d.ts → Base-DKFQtqzW.d.ts} +1 -1
  5. package/dist/{Base-DQWIJ6bJ.d.cts → Base-lb5Uhaqu.d.cts} +1 -1
  6. package/dist/Controller.d.cts +2 -2
  7. package/dist/Controller.d.ts +2 -2
  8. package/dist/{Movie-CBVFZ1kg.d.ts → Movie-B_qQIYV6.d.ts} +3 -1
  9. package/dist/{Movie-BHGhg-fJ.d.cts → Movie-BdUm2Mc9.d.cts} +3 -1
  10. package/dist/{chunk-NFJKBWYO.js → chunk-6N5ZBUOU.js} +21 -2
  11. package/dist/chunk-6N5ZBUOU.js.map +1 -0
  12. package/dist/{chunk-WVZLAIKK.cjs → chunk-BEGOKE7Q.cjs} +21 -2
  13. package/dist/chunk-BEGOKE7Q.cjs.map +1 -0
  14. package/dist/index.cjs +25 -25
  15. package/dist/index.d.cts +4 -4
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +1 -1
  18. package/dist/loader.css +1 -1
  19. package/dist/present.cjs +1 -1
  20. package/dist/present.d.cts +2 -2
  21. package/dist/present.d.ts +2 -2
  22. package/dist/present.js +1 -1
  23. package/dist/three.cjs +81 -23
  24. package/dist/three.cjs.map +1 -1
  25. package/dist/three.d.cts +17 -2
  26. package/dist/three.d.ts +17 -2
  27. package/dist/three.js +83 -25
  28. package/dist/three.js.map +1 -1
  29. package/dist/{types-DIh93lFb.d.cts → types-DiNHtdrS.d.cts} +19 -0
  30. package/dist/{types-DIh93lFb.d.ts → types-DiNHtdrS.d.ts} +19 -0
  31. package/docs/dsl.md +3 -2
  32. package/llms-full.txt +4 -3
  33. package/package.json +2 -1
  34. package/skills/pixi-effects/SKILL.md +1 -1
  35. package/skills/pixi-effects/template.html +6 -6
  36. package/dist/chunk-NFJKBWYO.js.map +0 -1
  37. package/dist/chunk-WVZLAIKK.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.43.0
4
+
5
+ A `three` layer on WebGPU shares PixiJS's GPU device, and the tests stop depending on the gallery. Nothing breaks.
6
+
7
+ - **Changed (tests, nothing for users): no library test uses a gallery piece as its subject.** The tests whose subject is the gallery or the site are in `tests/site/` (`npm run test:site`); the pages made for the tests, formerly `examples/_checks/`, are in `tests/films/`; the player and the timeline viewer have films of their own; `noFalseWarnings` runs every test film.
8
+ - **New: a `three` layer with `renderer: 'webgpu'` draws on PixiJS's own GPU device (`shareGpu`, default `true`).** In a movie PixiJS draws on WebGPU, the layer renders into a texture that PixiJS samples directly: no canvas of its own, no copy. The picture is the same (0 of 255 different in every channel of nine pictures, with antialias, fog and tone mapping), it is faster (spike: 0.7 against 1.1 ms for one layer, 1.6 against 5.7 ms for ten), and the browser's limit of about 32 WebGPU canvases no longer applies (a 60-layer film draws every layer; such a layer is not counted by the "too many three layers" warning). `shareGpu: false` keeps a canvas of its own; PixiJS on WebGL or any failure of the shared route does the same (one warning, before `setup`). `movie.inspect()` shows `sharedGpu`. The default `renderer` stays `'webgl'`. `tests/films/three-renderers`, `three-budget`, `tests/core/gpuShare.test.ts`.
9
+
3
10
  ## 0.42.0
4
11
 
5
12
  Interaction on top of `pick`: hover, dragging, a hit that looks at the picture, and a fix for a false warning that every rebuilt page with a `three` layer showed since 0.40.0. Nothing breaks.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pixi-effects
2
2
 
3
- > **Status**: experimental — current release `0.42.0`. The API may still change between minor versions; see the [CHANGELOG](./CHANGELOG.md) for what each release changed.
3
+ > **Status**: experimental — current release `0.43.0`. The API may still change between minor versions; see the [CHANGELOG](./CHANGELOG.md) for what each release changed.
4
4
 
5
5
  **[Gallery →](https://yjmtmtk.github.io/pixi-effects/examples/gallery/)** · 43 pieces written as plain data by AI models · **[For AI →](https://yjmtmtk.github.io/pixi-effects/for-ai.html)** · what an AI reads and runs · **[Playground →](https://yjmtmtk.github.io/pixi-effects/examples/playground.html)** in the browser.
6
6
 
@@ -49,8 +49,8 @@ Drop the imports into an [importmap](https://developer.mozilla.org/docs/Web/HTML
49
49
  "imports": {
50
50
  "pixi.js": "https://esm.sh/pixi.js@8.22.0?bundle-deps",
51
51
  "mediabunny": "https://esm.sh/mediabunny",
52
- "pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.42.0/dist/index.js",
53
- "pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.42.0/dist/Controller.js"
52
+ "pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.43.0/dist/index.js",
53
+ "pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.43.0/dist/Controller.js"
54
54
  }
55
55
  }
56
56
  </script>
@@ -61,7 +61,7 @@ Drop the imports into an [importmap](https://developer.mozilla.org/docs/Web/HTML
61
61
  </script>
62
62
  ```
63
63
 
64
- Load the `dist/` files **as they are** (jsDelivr's `/npm/…/dist/…`, or unpkg's `https://unpkg.com/pixi-effects@0.42.0/dist/index.js`) rather than a CDN-rebundled build such as `esm.sh/pixi-effects` or jsDelivr's `+esm`: the entries (`pixi-effects`, `…/controller`, `…/three`) share internal chunks, which only works when each file is served untouched.
64
+ Load the `dist/` files **as they are** (jsDelivr's `/npm/…/dist/…`, or unpkg's `https://unpkg.com/pixi-effects@0.43.0/dist/index.js`) rather than a CDN-rebundled build such as `esm.sh/pixi-effects` or jsDelivr's `+esm`: the entries (`pixi-effects`, `…/controller`, `…/three`) share internal chunks, which only works when each file is served untouched.
65
65
 
66
66
  > **Using three.js?** Add two more entries (`three` and `pixi-effects/three`) to this importmap — see [Adding three.js](#adding-threejs-optional) below.
67
67
  >
@@ -78,7 +78,7 @@ Add two more entries to the importmap above: three.js itself, and the `pixi-effe
78
78
  "...": "(everything from the importmap above)",
79
79
  "three": "https://esm.sh/three@0.178.0",
80
80
  "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.178.0/examples/jsm/",
81
- "pixi-effects/three": "https://cdn.jsdelivr.net/npm/pixi-effects@0.42.0/dist/three.js"
81
+ "pixi-effects/three": "https://cdn.jsdelivr.net/npm/pixi-effects@0.43.0/dist/three.js"
82
82
  }
83
83
  }
84
84
  </script>
@@ -59,9 +59,9 @@
59
59
  "imports": {
60
60
  "pixi.js": "https://cdn.jsdelivr.net/npm/pixi.js@8.22.0/dist/pixi.min.mjs",
61
61
  "mediabunny": "https://cdn.jsdelivr.net/npm/mediabunny@1.61.3/+esm",
62
- "pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.42.0/dist/index.js",
63
- "pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.42.0/dist/Controller.js",
64
- "pixi-effects/present": "https://cdn.jsdelivr.net/npm/pixi-effects@0.42.0/dist/present.js"
62
+ "pixi-effects": "https://cdn.jsdelivr.net/npm/pixi-effects@0.43.0/dist/index.js",
63
+ "pixi-effects/controller": "https://cdn.jsdelivr.net/npm/pixi-effects@0.43.0/dist/Controller.js",
64
+ "pixi-effects/present": "https://cdn.jsdelivr.net/npm/pixi-effects@0.43.0/dist/present.js"
65
65
  }
66
66
  }
67
67
  </script>
@@ -1,5 +1,5 @@
1
1
  import { Container } from 'pixi.js';
2
- import { S as SequenceSpec, C as CompositionShape } from './types-DIh93lFb.js';
2
+ import { S as SequenceSpec, C as CompositionShape } from './types-DiNHtdrS.js';
3
3
 
4
4
  /**
5
5
  * Resolves a routed keyframe path to a concrete tween target.
@@ -1,5 +1,5 @@
1
1
  import { Container } from 'pixi.js';
2
- import { S as SequenceSpec, C as CompositionShape } from './types-DIh93lFb.cjs';
2
+ import { S as SequenceSpec, C as CompositionShape } from './types-DiNHtdrS.cjs';
3
3
 
4
4
  /**
5
5
  * Resolves a routed keyframe path to a concrete tween target.
@@ -1,7 +1,7 @@
1
- import { M as Movie } from './Movie-BHGhg-fJ.cjs';
1
+ import { M as Movie } from './Movie-BdUm2Mc9.cjs';
2
2
  import 'pixi.js';
3
3
  import './soundEntry-DT13DNt8.cjs';
4
- import './types-DIh93lFb.cjs';
4
+ import './types-DiNHtdrS.cjs';
5
5
 
6
6
  /**
7
7
  * The look of the bar. Each key sets a CSS custom property on the bar (so you can also set `--mc-accent` … in your own CSS, on the
@@ -1,7 +1,7 @@
1
- import { M as Movie } from './Movie-CBVFZ1kg.js';
1
+ import { M as Movie } from './Movie-B_qQIYV6.js';
2
2
  import 'pixi.js';
3
3
  import './soundEntry-DT13DNt8.js';
4
- import './types-DIh93lFb.js';
4
+ import './types-DiNHtdrS.js';
5
5
 
6
6
  /**
7
7
  * The look of the bar. Each key sets a CSS custom property on the bar (so you can also set `--mc-accent` … in your own CSS, on the
@@ -1,6 +1,6 @@
1
1
  import { Application } from 'pixi.js';
2
2
  import { A as AudioReport, a as AudioInspectOptions } from './soundEntry-DT13DNt8.js';
3
- import { b as Stop, A as AssetSpec, a as CompositionSpec } from './types-DIh93lFb.js';
3
+ import { b as Stop, A as AssetSpec, a as CompositionSpec } from './types-DiNHtdrS.js';
4
4
 
5
5
  type EaseFn = (p: number) => number;
6
6
 
@@ -213,6 +213,8 @@ interface LayerInfo {
213
213
  /** A `three` layer: the renderer it draws with (`'webgl'` / `'webgpu'`) and the backend under it (`'webgl2'`: three's WebGPURenderer found no WebGPU and used its own WebGL2 backend: the same picture). */
214
214
  renderer?: 'webgl' | 'webgpu';
215
215
  backend?: 'webgl' | 'webgpu' | 'webgl2';
216
+ /** A `three` layer with `renderer: 'webgpu'`: true when it draws on PixiJS's own GPU device (no canvas of its own); false when it has a canvas of its own (`shareGpu: false`, or PixiJS is on WebGL). */
217
+ sharedGpu?: boolean;
216
218
  }
217
219
  interface InspectReport {
218
220
  frame: number;
@@ -1,6 +1,6 @@
1
1
  import { Application } from 'pixi.js';
2
2
  import { A as AudioReport, a as AudioInspectOptions } from './soundEntry-DT13DNt8.cjs';
3
- import { b as Stop, A as AssetSpec, a as CompositionSpec } from './types-DIh93lFb.cjs';
3
+ import { b as Stop, A as AssetSpec, a as CompositionSpec } from './types-DiNHtdrS.cjs';
4
4
 
5
5
  type EaseFn = (p: number) => number;
6
6
 
@@ -213,6 +213,8 @@ interface LayerInfo {
213
213
  /** A `three` layer: the renderer it draws with (`'webgl'` / `'webgpu'`) and the backend under it (`'webgl2'`: three's WebGPURenderer found no WebGPU and used its own WebGL2 backend: the same picture). */
214
214
  renderer?: 'webgl' | 'webgpu';
215
215
  backend?: 'webgl' | 'webgpu' | 'webgl2';
216
+ /** A `three` layer with `renderer: 'webgpu'`: true when it draws on PixiJS's own GPU device (no canvas of its own); false when it has a canvas of its own (`shareGpu: false`, or PixiJS is on WebGL). */
217
+ sharedGpu?: boolean;
216
218
  }
217
219
  interface InspectReport {
218
220
  frame: number;
@@ -7,6 +7,21 @@ import { warnUnknownOptions, suggestName } from './chunk-BXOCEZ4U.js';
7
7
  import { extensions, CullerPlugin, Application, Container, Rectangle, Culler, CanvasTextMetrics, TextStyle, Assets, ExtensionType, Filter, Texture, UniformGroup, GpuProgram, GlProgram, defaultFilterVert } from 'pixi.js';
8
8
  import { Output, BufferTarget, CanvasSource, AudioBufferSource, Input, ALL_FORMATS, BlobSource, WavOutputFormat, Conversion, VideoSampleSink, OggOutputFormat, QUALITY_VERY_HIGH, QUALITY_HIGH, QUALITY_MEDIUM, QUALITY_LOW, QUALITY_VERY_LOW, MkvOutputFormat, WebMOutputFormat, MovOutputFormat, Mp4OutputFormat, canEncodeVideo, getFirstEncodableAudioCodec } from 'mediabunny';
9
9
 
10
+ // src/core/gpuShare.ts
11
+ function sharedGpuOf(renderer) {
12
+ const r = renderer;
13
+ if (!r || r.name !== "webgpu" || !r.gpu?.device) return void 0;
14
+ const uid = r.uid;
15
+ return {
16
+ device: r.gpu.device,
17
+ adopt(source, texture) {
18
+ const data = source._gpuData;
19
+ if (!data || typeof data !== "object") throw new Error("this PixiJS keeps no _gpuData on its texture sources");
20
+ data[uid] = { textureView: null, textureViews: /* @__PURE__ */ Object.create(null), gpuTexture: texture, destroy() {
21
+ } };
22
+ }
23
+ };
24
+ }
10
25
  var registered = false;
11
26
  function ensureLoadersRegistered(audioContext) {
12
27
  if (registered) return;
@@ -1634,6 +1649,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
1634
1649
  if (typeof drawn.renderer === "string") {
1635
1650
  info.renderer = drawn.renderer;
1636
1651
  if (typeof drawn.backend === "string") info.backend = drawn.backend;
1652
+ if (info.renderer === "webgpu") info.sharedGpu = drawn.sharedGpu === true;
1637
1653
  }
1638
1654
  layers.push(info);
1639
1655
  chainAlpha.set(info, parentAlpha * alpha);
@@ -2727,12 +2743,15 @@ var Movie = class {
2727
2743
  */
2728
2744
  async _construct(composition, vars, width, height, lp, sizeWins = this._resized) {
2729
2745
  const spec = applyVars(composition, vars);
2746
+ const gpu = sharedGpuOf(this.app?.renderer);
2747
+ const gpuField = gpu ? { gpu } : {};
2730
2748
  const rootShape = {
2731
2749
  width,
2732
2750
  height,
2733
2751
  duration: this.duration,
2734
2752
  frameRate: this.frameRate,
2735
2753
  vars: numericVars(vars),
2754
+ ...gpuField,
2736
2755
  ...lp ? { onLayerBuilt: async () => {
2737
2756
  lp.tick();
2738
2757
  await lp.yieldIfDue();
@@ -4724,5 +4743,5 @@ function withFade(spec, opts) {
4724
4743
  }
4725
4744
 
4726
4745
  export { Movie, animateText, audioEnvelope, bpmEnvelope, cameraPath, computeEnvelope, dismissLoader, failLoader, followPath, kenBurns, measureText, musicBuffer, musicEnvelope, musicEvents, orbit, parseEase2 as parseEase, particles, react, resolveLoader, samplePath, splitText, stagger, wiggle, withFade };
4727
- //# sourceMappingURL=chunk-NFJKBWYO.js.map
4728
- //# sourceMappingURL=chunk-NFJKBWYO.js.map
4746
+ //# sourceMappingURL=chunk-6N5ZBUOU.js.map
4747
+ //# sourceMappingURL=chunk-6N5ZBUOU.js.map