pixi-effects 0.14.0 → 0.16.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 (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +13 -6
  3. package/ai/CHAT.md +103 -0
  4. package/ai/SKILL.md +2 -1
  5. package/ai/chat-template.html +113 -0
  6. package/ai/reference/cheatsheet.md +2 -1
  7. package/ai/reference/pitfalls.md +6 -0
  8. package/ai/reference/recipes.md +25 -0
  9. package/ai/template.html +5 -5
  10. package/dist/{Base-CQOlB2VH.d.ts → Base-DPEqyeB0.d.cts} +1 -1
  11. package/dist/{Base-C6ZnJ9pD.d.cts → Base-qvqNxvyt.d.ts} +1 -1
  12. package/dist/Composition-X2VZSVPD.js +5 -0
  13. package/dist/{Composition-HIISJAX2.js.map → Composition-X2VZSVPD.js.map} +1 -1
  14. package/dist/Composition-ZZGSMQ4E.cjs +14 -0
  15. package/dist/{Composition-7TEKHZNQ.cjs.map → Composition-ZZGSMQ4E.cjs.map} +1 -1
  16. package/dist/Controller.d.cts +2 -2
  17. package/dist/Controller.d.ts +2 -2
  18. package/dist/{Movie-BwT6XtGz.d.ts → Movie-BIGDIla0.d.ts} +1 -1
  19. package/dist/{Movie-qmgOU4in.d.cts → Movie-CJMfAizW.d.cts} +1 -1
  20. package/dist/Presenter.d.cts +2 -2
  21. package/dist/Presenter.d.ts +2 -2
  22. package/dist/{chunk-C6QHKYC5.js → chunk-7D7RAQWM.js} +29 -4
  23. package/dist/chunk-7D7RAQWM.js.map +1 -0
  24. package/dist/{chunk-3IPDNC3E.js → chunk-I2YXLHIU.js} +3 -3
  25. package/dist/{chunk-3IPDNC3E.js.map → chunk-I2YXLHIU.js.map} +1 -1
  26. package/dist/{chunk-6NWJLVCA.cjs → chunk-SPPNTV7E.cjs} +29 -4
  27. package/dist/chunk-SPPNTV7E.cjs.map +1 -0
  28. package/dist/{chunk-F7NCHS6Q.cjs → chunk-V54NBCWG.cjs} +26 -26
  29. package/dist/{chunk-F7NCHS6Q.cjs.map → chunk-V54NBCWG.cjs.map} +1 -1
  30. package/dist/index.cjs +40 -25
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +18 -5
  33. package/dist/index.d.ts +18 -5
  34. package/dist/index.js +18 -4
  35. package/dist/index.js.map +1 -1
  36. package/dist/loader.css +1 -1
  37. package/dist/music-3OF5C6X5.cjs +826 -0
  38. package/dist/music-3OF5C6X5.cjs.map +1 -0
  39. package/dist/music-4HDFULNR.js +809 -0
  40. package/dist/music-4HDFULNR.js.map +1 -0
  41. package/dist/three.cjs +5 -5
  42. package/dist/three.d.cts +2 -2
  43. package/dist/three.d.ts +2 -2
  44. package/dist/three.js +1 -1
  45. package/dist/{types-CBSiUKau.d.cts → types-C8XEUoqe.d.cts} +76 -2
  46. package/dist/{types-CBSiUKau.d.ts → types-C8XEUoqe.d.ts} +76 -2
  47. package/docs/api.md +10 -0
  48. package/docs/dsl.md +39 -0
  49. package/llms-full.txt +83 -2
  50. package/llms.txt +3 -2
  51. package/package.json +1 -1
  52. package/dist/Composition-7TEKHZNQ.cjs +0 -14
  53. package/dist/Composition-HIISJAX2.js +0 -5
  54. package/dist/chunk-6NWJLVCA.cjs.map +0 -1
  55. package/dist/chunk-C6QHKYC5.js.map +0 -1
@@ -1020,7 +1020,7 @@ function lintTiming(spec, parentDuration, warn = defaultWarn) {
1020
1020
  if (at >= parentDuration) {
1021
1021
  warn(`pixi-effects: ${who} starts at ${at}s, after its composition ends (${parentDuration}s), so it is never visible`);
1022
1022
  }
1023
- if (spec.type === "audio" && spec.sfx !== void 0 && spec.duration === void 0) return;
1023
+ if (spec.type === "audio" && (spec.sfx !== void 0 || spec.music !== void 0) && spec.duration === void 0) return;
1024
1024
  const duration = spec.duration ?? parentDuration;
1025
1025
  (spec.keyframes ?? []).forEach((kf, i) => {
1026
1026
  const kat = kf.at ?? 0;
@@ -1723,6 +1723,7 @@ var AudioSequence = class extends Sequence {
1723
1723
  _source = "";
1724
1724
  async build() {
1725
1725
  this.target = null;
1726
+ if (this.spec.music !== void 0) return this._buildMusic(this.spec);
1726
1727
  if (this.spec.sfx !== void 0) return this._buildSfx(this.spec);
1727
1728
  const spec = this.spec;
1728
1729
  this._source = `asset "${spec.asset}"`;
@@ -1757,6 +1758,30 @@ var AudioSequence = class extends Sequence {
1757
1758
  }
1758
1759
  });
1759
1760
  }
1761
+ async _buildMusic(spec) {
1762
+ const who = describeLayer(spec);
1763
+ const raw = spec;
1764
+ if (raw.asset !== void 0) console.warn(`pixi-effects: ${who}: has both asset and music \u2014 the music plays; remove one`);
1765
+ if (raw.sfx !== void 0) console.warn(`pixi-effects: ${who}: has both sfx and music \u2014 the music plays; remove one`);
1766
+ const { resolveMusic, renderMusic, musicLength, musicKey } = await import('./music-4HDFULNR.js');
1767
+ const music = resolveMusic(spec.music, who);
1768
+ if (!music) return;
1769
+ const natural = musicLength(music);
1770
+ const rest = Math.max(0, (this.parent?.duration ?? this.root.duration) - this.at);
1771
+ let length = natural;
1772
+ if (spec.duration !== void 0) {
1773
+ if (typeof spec.duration === "number" && Number.isFinite(spec.duration) && spec.duration > 0) length = spec.duration;
1774
+ else console.warn(`pixi-effects: ${who}: duration must be a positive number of seconds (got ${JSON.stringify(spec.duration)}); using the music's own length, ${natural.toFixed(1)}s`);
1775
+ } else if (spec.loop) length = rest || natural;
1776
+ else if (rest > 0) length = Math.min(natural, rest);
1777
+ if (!spec.loop && spec.duration !== void 0 && length > natural + 0.05) {
1778
+ console.warn(`pixi-effects: ${who}: the music is ${natural.toFixed(1)}s (with its tail) but the layer lasts ${length.toFixed(1)}s, so it goes silent after ${natural.toFixed(1)}s. Add loop: true, or shorten the layer's duration.`);
1779
+ }
1780
+ this.duration = length;
1781
+ const loop = !!spec.loop;
1782
+ this._source = "music";
1783
+ this._synth = { key: musicKey(music, length, loop), render: (sr) => renderMusic(music, sr, length, loop) };
1784
+ }
1760
1785
  bindTimeline(_timeline) {
1761
1786
  }
1762
1787
  collectAudio(out, baseTime) {
@@ -2691,7 +2716,7 @@ function numOrZero(v, scope) {
2691
2716
  var _CompositionSequence = null;
2692
2717
  async function getCompositionSequence() {
2693
2718
  if (!_CompositionSequence) {
2694
- _CompositionSequence = (await import('./Composition-HIISJAX2.js')).CompositionSequence;
2719
+ _CompositionSequence = (await import('./Composition-X2VZSVPD.js')).CompositionSequence;
2695
2720
  }
2696
2721
  return _CompositionSequence;
2697
2722
  }
@@ -2730,5 +2755,5 @@ async function buildSequenceTree(specs, parent, root) {
2730
2755
  }
2731
2756
 
2732
2757
  export { CameraSequence, DEFAULT_FOV, DEG, NEAR, NullSequence, Sequence, buildScope, buildSequenceTree, cameraBasis, collectPropKeys, describeLayer, ensureFilterLibrary, evaluateExpr, flattenSvgPath, homeCamera, homeDistance, lintText, lintTiming, noise, projectLayer, rand, random, registerSequenceType, resolveAt, summarizeWarnings };
2733
- //# sourceMappingURL=chunk-C6QHKYC5.js.map
2734
- //# sourceMappingURL=chunk-C6QHKYC5.js.map
2758
+ //# sourceMappingURL=chunk-7D7RAQWM.js.map
2759
+ //# sourceMappingURL=chunk-7D7RAQWM.js.map