pixi-effects 0.49.0 → 0.50.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 (80) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +8 -7
  3. package/ai/chat-template.html +4 -4
  4. package/ai/tools/check.mjs +6 -6
  5. package/dist/3d.cjs +17 -13
  6. package/dist/3d.cjs.map +1 -1
  7. package/dist/3d.d.cts +3 -1
  8. package/dist/3d.d.ts +3 -1
  9. package/dist/3d.js +9 -5
  10. package/dist/3d.js.map +1 -1
  11. package/dist/Composition-47U5U637.cjs +16 -0
  12. package/dist/{Composition-464AWDV6.cjs.map → Composition-47U5U637.cjs.map} +1 -1
  13. package/dist/Composition-GVWWLFDL.js +7 -0
  14. package/dist/{Composition-5U63LMPX.js.map → Composition-GVWWLFDL.js.map} +1 -1
  15. package/dist/Controller.d.cts +2 -2
  16. package/dist/Controller.d.ts +2 -2
  17. package/dist/{Movie-BxB7bauG.d.cts → Movie-DogzDBuW.d.cts} +20 -5
  18. package/dist/{Movie-6EWOz6Yw.d.ts → Movie-Y7iHg2V8.d.ts} +20 -5
  19. package/dist/{Spans-W5VJRMGC.js → Spans-3SEZSTQV.js} +6 -6
  20. package/dist/{Spans-W5VJRMGC.js.map → Spans-3SEZSTQV.js.map} +1 -1
  21. package/dist/{Spans-DUR2W5EH.cjs → Spans-R426NVY3.cjs} +11 -11
  22. package/dist/{Spans-DUR2W5EH.cjs.map → Spans-R426NVY3.cjs.map} +1 -1
  23. package/dist/{blendModes-NC76DNVX.cjs → blendModes-2IDILRN6.cjs} +5 -5
  24. package/dist/{blendModes-NC76DNVX.cjs.map → blendModes-2IDILRN6.cjs.map} +1 -1
  25. package/dist/{blendModes-ZOBLPSR3.js → blendModes-4QH44GOL.js} +4 -4
  26. package/dist/{blendModes-ZOBLPSR3.js.map → blendModes-4QH44GOL.js.map} +1 -1
  27. package/dist/{chunk-ABWRISRK.cjs → chunk-3FCDRLW3.cjs} +4 -3
  28. package/dist/chunk-3FCDRLW3.cjs.map +1 -0
  29. package/dist/{chunk-MXACRKAN.js → chunk-C2HL5236.js} +4 -4
  30. package/dist/{chunk-MXACRKAN.js.map → chunk-C2HL5236.js.map} +1 -1
  31. package/dist/{chunk-5YNME6AH.cjs → chunk-GXGIISFS.cjs} +5 -5
  32. package/dist/{chunk-5YNME6AH.cjs.map → chunk-GXGIISFS.cjs.map} +1 -1
  33. package/dist/{chunk-H363KMJR.js → chunk-J4ZP76IL.js} +4 -3
  34. package/dist/chunk-J4ZP76IL.js.map +1 -0
  35. package/dist/{chunk-BSFWVTSR.cjs → chunk-O2MD3L4J.cjs} +92 -92
  36. package/dist/{chunk-BSFWVTSR.cjs.map → chunk-O2MD3L4J.cjs.map} +1 -1
  37. package/dist/{chunk-DOGY3EAW.js → chunk-SSVHAF3Q.js} +470 -17
  38. package/dist/chunk-SSVHAF3Q.js.map +1 -0
  39. package/dist/{chunk-USUUAYTE.js → chunk-TXNQLMRT.js} +5 -5
  40. package/dist/{chunk-USUUAYTE.js.map → chunk-TXNQLMRT.js.map} +1 -1
  41. package/dist/{chunk-PBMDZT2T.js → chunk-UTUUOQ47.js} +39 -16
  42. package/dist/chunk-UTUUOQ47.js.map +1 -0
  43. package/dist/{chunk-33USHRV5.cjs → chunk-VVUSZVP7.cjs} +493 -39
  44. package/dist/chunk-VVUSZVP7.cjs.map +1 -0
  45. package/dist/{chunk-GUDLIAIG.cjs → chunk-YOKRPAKA.cjs} +82 -59
  46. package/dist/chunk-YOKRPAKA.cjs.map +1 -0
  47. package/dist/index.cjs +35 -35
  48. package/dist/index.d.cts +3 -3
  49. package/dist/index.d.ts +3 -3
  50. package/dist/index.js +5 -5
  51. package/dist/loader.css +1 -1
  52. package/dist/present.cjs +5 -5
  53. package/dist/present.d.cts +2 -2
  54. package/dist/present.d.ts +2 -2
  55. package/dist/present.js +5 -5
  56. package/dist/three.cjs +13 -9
  57. package/dist/three.cjs.map +1 -1
  58. package/dist/three.d.cts +3 -1
  59. package/dist/three.d.ts +3 -1
  60. package/dist/three.js +8 -4
  61. package/dist/three.js.map +1 -1
  62. package/dist/{types-kt7DQKfO.d.cts → types-BZngm4nT.d.cts} +48 -5
  63. package/dist/{types-kt7DQKfO.d.ts → types-BZngm4nT.d.ts} +48 -5
  64. package/docs/api.md +4 -1
  65. package/docs/dsl.md +35 -1
  66. package/llms-full.txt +91 -3
  67. package/package.json +1 -1
  68. package/skills/pixi-effects/SKILL.md +2 -1
  69. package/skills/pixi-effects/reference/cheatsheet.md +2 -0
  70. package/skills/pixi-effects/reference/pitfalls.md +6 -0
  71. package/skills/pixi-effects/reference/recipes.md +42 -0
  72. package/skills/pixi-effects/template.html +8 -7
  73. package/dist/Composition-464AWDV6.cjs +0 -16
  74. package/dist/Composition-5U63LMPX.js +0 -7
  75. package/dist/chunk-33USHRV5.cjs.map +0 -1
  76. package/dist/chunk-ABWRISRK.cjs.map +0 -1
  77. package/dist/chunk-DOGY3EAW.js.map +0 -1
  78. package/dist/chunk-GUDLIAIG.cjs.map +0 -1
  79. package/dist/chunk-H363KMJR.js.map +0 -1
  80. package/dist/chunk-PBMDZT2T.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { CompositionSequence, maskSourceOf } from './chunk-USUUAYTE.js';
1
+ import { CompositionSequence, maskSourceOf } from './chunk-TXNQLMRT.js';
2
2
  import { loadMediabunny } from './chunk-K3XOEC3C.js';
3
- import { EXPRESSION_NAMES, createTimeline, lengthen, ensureFilterLibrary, checkEase, parseEase, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, trimPolylines, rand, DEG, timeRemapOf, contentLength, resolveAt, parseSpring, springDuration, spansMeta } from './chunk-DOGY3EAW.js';
3
+ import { EXPRESSION_NAMES, createTimeline, lengthen, ensureFilterLibrary, checkEase, parseEase, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, trimPolylines, rand, DEG, timeRemapOf, contentLength, resolveAt, parseSpring, springDuration, spansMeta } from './chunk-SSVHAF3Q.js';
4
4
  import { analyzeAudio, fft, resampleThrough, playSpan, measureLoudness } from './chunk-G4PXCV2B.js';
5
- import { usesAdvancedBlend, enableAdvancedBlend } from './chunk-MXACRKAN.js';
6
- import { describeLayer } from './chunk-H363KMJR.js';
5
+ import { usesAdvancedBlend, enableAdvancedBlend } from './chunk-C2HL5236.js';
6
+ import { describeLayer } from './chunk-J4ZP76IL.js';
7
7
  import { warnUnknownOptions, suggestName } from './chunk-WGRWFQOB.js';
8
8
  import { extensions, CullerPlugin, Application, Container, Rectangle, Culler, BindGroup, CanvasTextMetrics, TextStyle, Assets, ExtensionType, Filter, Texture, UniformGroup, GpuProgram, GlProgram, defaultFilterVert, Text, CanvasTextGenerator, CanvasPool } from 'pixi.js';
9
9
 
@@ -1671,9 +1671,9 @@ function canvasReport(root) {
1671
1671
  const { differs, drawMs, threw } = seq.checkDeterminism(moments);
1672
1672
  const name = describeLayer(seq.spec);
1673
1673
  const type = seq.spec.type;
1674
- const kind = type === "three" ? "three" : type === "scene3d" ? "scene3d" : "canvas";
1674
+ const kind = type === "three" ? "three" : type === "scene3d" ? "scene3d" : type === "scene2d" ? "scene2d" : "canvas";
1675
1675
  const drawn = kind === "canvas" ? "draw threw" : "update or render threw";
1676
- const problem = threw.length ? `${name} could not draw at ${threw.map((t) => `${t} s`).join(", ")} (its ${drawn}, or the layer failed to build): ${kind === "canvas" ? "it shows a magenta checkerboard there; the warning above says why" : "the warning above says why"}, so the layer cannot be called deterministic` : differs.length ? `${name} does not draw the same picture for the same time (checked at ${differs.map(describeDiff).join(", ")}; drawn in two orders after one draw that was thrown away): ` + (kind === "three" ? "usually its update uses Math.random, Date.now, a clock, or state that builds up from call to call: a mixer advanced with mixer.update(dt) is one (pose a clip with mixer.setTime(t), or threeGltf(url).pose(t)), and so is a value moved by the time since the last call. A skinned model of your own (not loaded by threeGltf) that moves and casts a shadow does it too: three culls a skinned mesh by a bounding sphere that does not follow it, so set mesh.frustumCulled = false. Set every object from t, so playback, a seek and an export agree" : kind === "scene3d" ? "usually its update keeps state from call to call (a value moved by the time since the last call), uses Math.random or a clock, or a model's player or a particle system runs on its own clock (pose a clip with model.player.getState(name).gotoAndStop(t)), or a MotionBlurEffect reads the camera of the frame drawn before. Set every object from t, so playback, a seek and an export agree" : "usually its draw uses Math.random, Date.now or state that outlives the call (a value it keeps from the last call), so playback, a seek and an export would not agree: use info.random() (seeded) and derive everything from t. If it uses none of these, look at the canvases it draws from: make sprites and masks with info.canvas(w, h) (not document.createElement) and draw them into the picture before the strokes that depend on them") : "";
1676
+ const problem = threw.length ? `${name} could not draw at ${threw.map((t) => `${t} s`).join(", ")} (its ${drawn}, or the layer failed to build): ${kind === "canvas" ? "it shows a magenta checkerboard there; the warning above says why" : "the warning above says why"}, so the layer cannot be called deterministic` : differs.length ? `${name} does not draw the same picture for the same time (checked at ${differs.map(describeDiff).join(", ")}; drawn in two orders after one draw that was thrown away): ` + (kind === "three" ? "usually its update uses Math.random, Date.now, a clock, or state that builds up from call to call: a mixer advanced with mixer.update(dt) is one (pose a clip with mixer.setTime(t), or threeGltf(url).pose(t)), and so is a value moved by the time since the last call. A skinned model of your own (not loaded by threeGltf) that moves and casts a shadow does it too: three culls a skinned mesh by a bounding sphere that does not follow it, so set mesh.frustumCulled = false. Set every object from t, so playback, a seek and an export agree" : kind === "scene3d" ? "usually its update keeps state from call to call (a value moved by the time since the last call), uses Math.random or a clock, or a model's player or a particle system runs on its own clock (pose a clip with model.player.getState(name).gotoAndStop(t)), or a MotionBlurEffect reads the camera of the frame drawn before. Set every object from t, so playback, a seek and an export agree" : kind === "scene2d" ? "usually its update keeps state from call to call (a value moved by the time since the last call, a position added to instead of set), uses Math.random or a clock, or something runs on PixiJS's ticker (a Ticker.shared.add of your own, a video texture). Set every object from t, so playback, a seek and an export agree" : "usually its draw uses Math.random, Date.now or state that outlives the call (a value it keeps from the last call), so playback, a seek and an export would not agree: use info.random() (seeded) and derive everything from t. If it uses none of these, look at the canvases it draws from: make sprites and masks with info.canvas(w, h) (not document.createElement) and draw them into the picture before the strokes that depend on them") : "";
1677
1677
  out.push({ name: seq.spec.name ?? name, moments, drawMs, ok: !differs.length && !threw.length, problem, kind });
1678
1678
  }
1679
1679
  if (seq instanceof CompositionSequence) walk3(seq);
@@ -2009,7 +2009,14 @@ function pickScene(root, x, y, opts = {}, deps = {}) {
2009
2009
  }
2010
2010
  const point = at;
2011
2011
  let hit = null;
2012
- if (threeD) {
2012
+ const scene2d = seq.pick2d;
2013
+ if (typeof scene2d === "function" && !threeD) {
2014
+ const found2 = scene2d.call(seq, point);
2015
+ if (found2) {
2016
+ const s2 = seq;
2017
+ hit = { name, path, type: seq.spec.type, kind: "scene2d", point, scene2d: { object: found2.object, node: found2.node, point: found2.point, grab: () => ({ move: s2.dragFrom(found2.node, point) }) } };
2018
+ }
2019
+ } else if (threeD) {
2013
2020
  if (quad && pointInQuad(quad, d.toLocal(point).x, d.toLocal(point).y)) hit = { name, path, type: seq.spec.type, kind: "card", point };
2014
2021
  } else {
2015
2022
  const local = d.toLocal(point);
@@ -2108,12 +2115,26 @@ function reusePoolOf(old) {
2108
2115
  const key = seq.reuseKey();
2109
2116
  if (key !== null) free.set(key, [...free.get(key) ?? [], seq]);
2110
2117
  });
2111
- return { claim: (key) => free.get(key)?.shift() ?? null };
2118
+ const borrowers = [];
2119
+ return {
2120
+ claim: (key, by) => {
2121
+ const d = free.get(key)?.shift() ?? null;
2122
+ if (d && by) borrowers.push(by);
2123
+ return d;
2124
+ },
2125
+ borrowers
2126
+ };
2112
2127
  }
2113
- function commitReuse(root) {
2114
- walk(root, (seq) => {
2115
- if (borrower(seq)) seq.commitReuse();
2116
- });
2128
+ function commitReuse(root, pool) {
2129
+ const done = /* @__PURE__ */ new Set();
2130
+ const commit = (seq) => {
2131
+ if (!done.has(seq) && borrower(seq)) {
2132
+ done.add(seq);
2133
+ seq.commitReuse();
2134
+ }
2135
+ };
2136
+ walk(root, commit);
2137
+ for (const seq of pool?.borrowers ?? []) commit(seq);
2117
2138
  }
2118
2139
 
2119
2140
  // src/core/hover.ts
@@ -3141,6 +3162,7 @@ var Movie = class {
3141
3162
  if (!root || !app) throw new Error("pixi-effects: movie.rebuild() needs a ready movie \u2014 await movie.init(...) first");
3142
3163
  const who = `movie.${reason === "vars" ? "setVars" : "rebuild"}()`;
3143
3164
  let sequence = null;
3165
+ let reusePool = null;
3144
3166
  const alive = () => {
3145
3167
  if (this._initState !== "ready") throw new Error("pixi-effects: the movie was destroyed while it was being rebuilt");
3146
3168
  };
@@ -3170,7 +3192,8 @@ var Movie = class {
3170
3192
  if (change.composition !== void 0) for (const w of lintVars(change.composition, vars)) console.warn(w);
3171
3193
  changed = changed || sizeChanged || change.composition !== void 0 || reason === "rebuild";
3172
3194
  if (!changed) return { reason, ms: 0, audio: "none", frame: this.currentFrame, playing: this.isPlaying, unchanged: true };
3173
- sequence = await this._construct(composition, vars, width, height, void 0, this._resized || sizeChanged, reusePoolOf(this._rootSequence));
3195
+ reusePool = reusePoolOf(this._rootSequence);
3196
+ sequence = await this._construct(composition, vars, width, height, void 0, this._resized || sizeChanged, reusePool);
3174
3197
  alive();
3175
3198
  const timeline = createTimeline({ paused: true, defaults: { ease: "none" } });
3176
3199
  lengthen(timeline, this.duration);
@@ -3210,7 +3233,7 @@ var Movie = class {
3210
3233
  if (old?.target) root.removeChild(old.target);
3211
3234
  if (sequence.target) root.addChild(sequence.target);
3212
3235
  this._rootSequence = sequence;
3213
- commitReuse(sequence);
3236
+ commitReuse(sequence, reusePool);
3214
3237
  this.timeline = timeline;
3215
3238
  this._timeFilters = collectTimeFilters(sequence);
3216
3239
  const loud = quietUnbind();
@@ -5051,5 +5074,5 @@ function withFade(spec, opts) {
5051
5074
  }
5052
5075
 
5053
5076
  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 };
5054
- //# sourceMappingURL=chunk-PBMDZT2T.js.map
5055
- //# sourceMappingURL=chunk-PBMDZT2T.js.map
5077
+ //# sourceMappingURL=chunk-UTUUOQ47.js.map
5078
+ //# sourceMappingURL=chunk-UTUUOQ47.js.map