pixi-effects 0.27.0 → 0.27.2

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 (50) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +9 -5
  3. package/ai/chat-template.html +3 -3
  4. package/dist/{Base-CVezIEdo.d.ts → Base-CKGl6jCo.d.ts} +1 -1
  5. package/dist/{Base-DzC3i919.d.cts → Base-DjhdL8B1.d.cts} +1 -1
  6. package/dist/Composition-DRCTWIYH.cjs +16 -0
  7. package/dist/{Composition-QCOWQSDB.cjs.map → Composition-DRCTWIYH.cjs.map} +1 -1
  8. package/dist/Composition-TZHVYIGH.js +7 -0
  9. package/dist/{Composition-4TYDRRRY.js.map → Composition-TZHVYIGH.js.map} +1 -1
  10. package/dist/Controller.d.cts +2 -2
  11. package/dist/Controller.d.ts +2 -2
  12. package/dist/{Movie-CQ0Nz62a.d.cts → Movie-CbYwTs6U.d.cts} +1 -1
  13. package/dist/{Movie-M9dKm9dI.d.ts → Movie-ILKq2fw_.d.ts} +1 -1
  14. package/dist/Presenter.d.cts +2 -2
  15. package/dist/Presenter.d.ts +2 -2
  16. package/dist/{chunk-TGJACVLD.js → chunk-BQNNZEAX.js} +5 -5
  17. package/dist/chunk-BQNNZEAX.js.map +1 -0
  18. package/dist/{chunk-NDR2VQFV.cjs → chunk-C7HJJ7MZ.cjs} +61 -61
  19. package/dist/{chunk-NDR2VQFV.cjs.map → chunk-C7HJJ7MZ.cjs.map} +1 -1
  20. package/dist/{chunk-CKTS6G6I.js → chunk-K3F2YKL4.js} +3 -3
  21. package/dist/{chunk-CKTS6G6I.js.map → chunk-K3F2YKL4.js.map} +1 -1
  22. package/dist/{chunk-RQMI7EJT.cjs → chunk-YOV6MEXH.cjs} +5 -5
  23. package/dist/chunk-YOV6MEXH.cjs.map +1 -0
  24. package/dist/index.cjs +58 -40
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +4 -4
  27. package/dist/index.d.ts +4 -4
  28. package/dist/index.js +31 -13
  29. package/dist/index.js.map +1 -1
  30. package/dist/loader.css +1 -1
  31. package/dist/{music-4O367SPR.cjs → music-6MTHQEXS.cjs} +297 -99
  32. package/dist/music-6MTHQEXS.cjs.map +1 -0
  33. package/dist/{music-3O5MDQXY.js → music-72YJAMXH.js} +297 -100
  34. package/dist/music-72YJAMXH.js.map +1 -0
  35. package/dist/three.cjs +5 -5
  36. package/dist/three.d.cts +2 -2
  37. package/dist/three.d.ts +2 -2
  38. package/dist/three.js +1 -1
  39. package/dist/{types-DUVefWiB.d.cts → types-BNVsBBZf.d.cts} +2 -0
  40. package/dist/{types-DUVefWiB.d.ts → types-BNVsBBZf.d.ts} +2 -0
  41. package/llms-full.txt +1 -1
  42. package/package.json +2 -2
  43. package/skills/pixi-effects/SKILL.md +1 -1
  44. package/skills/pixi-effects/template.html +6 -6
  45. package/dist/Composition-4TYDRRRY.js +0 -7
  46. package/dist/Composition-QCOWQSDB.cjs +0 -16
  47. package/dist/chunk-RQMI7EJT.cjs.map +0 -1
  48. package/dist/chunk-TGJACVLD.js.map +0 -1
  49. package/dist/music-3O5MDQXY.js.map +0 -1
  50. package/dist/music-4O367SPR.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-CQ0Nz62a.cjs';
2
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-DUVefWiB.cjs';
3
- export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-DUVefWiB.cjs';
4
- import { S as Sequence } from './Base-DzC3i919.cjs';
1
+ export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-CbYwTs6U.cjs';
2
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-BNVsBBZf.cjs';
3
+ export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-BNVsBBZf.cjs';
4
+ import { S as Sequence } from './Base-DjhdL8B1.cjs';
5
5
  import 'pixi.js';
6
6
 
7
7
  /** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-M9dKm9dI.js';
2
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-DUVefWiB.js';
3
- export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-DUVefWiB.js';
4
- import { S as Sequence } from './Base-CVezIEdo.js';
1
+ export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FontReport, c as FrameEvent, I as InspectOptions, d as InspectReport, e as IssueGroup, L as LayerInfo, f as LoadProgressState, g as LoadStage, h as LoaderOption, M as MotionBlurOptions, i as MotionBlurSpec, j as Movie, k as MovieErrorEvent, l as MovieOptions, O as OnionSkinOptions, P as ProgressEvent, R as RenderOptions, m as ReviewOptions, n as ReviewReport, S as SnapshotOptions, o as SoundMeasure, p as StopEvent, q as StopImage, r as StopImagesOptions, T as TimelineData, s as TimelineHtmlOptions, t as TimelineRow, u as TimelineSvgOptions, v as TimelineTransition, V as VolumeEvent, w as dismissLoader, x as failLoader, y as resolveLoader } from './Movie-ILKq2fw_.js';
2
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, M as MusicOptions, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-BNVsBBZf.js';
3
+ export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, B as BlendModeName, j as ChromaKeyFilterSpec, k as CircleShapeSpec, l as CompositionSequenceSpec, m as CrossfadeTransition, n as CustomFilterSpec, D as DipTransition, o as DissolveTransition, E as EllipseShapeSpec, p as Expr, F as FilterSpec, G as GradientSpec, q as IrisTransition, L as LightSequenceSpec, r as LineShapeSpec, s as LumaTransition, t as MaskRefSpec, u as MatteRefSpec, v as MusicDrum, w as MusicDrums, x as MusicInstrument, y as MusicLevel, z as MusicTrack, N as NullSequenceSpec, H as PathShapeSpec, J as PolygonShapeSpec, O as PropValue, R as RectShapeSpec, Q as SfxKnobs, U as SfxOptions, V as SfxPreset, W as SfxVoice, X as ShaderSequenceSpec, Y as ShapeSequenceSpec, Z as SlideTransition, _ as Stop, $ as StopSpec, a0 as TransitionCommon, a1 as VideoSequenceSpec, a2 as WipeTransition, a3 as ZoomTransition, a4 as normalizeStops, a5 as pictureStops } from './types-BNVsBBZf.js';
4
+ import { S as Sequence } from './Base-CKGl6jCo.js';
5
5
  import 'pixi.js';
6
6
 
7
7
  /** A text style as written in a `text` layer's `style` (numbers, not expressions, for the fields that size the text). */
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { CompositionSequence, maskSourceOf } from './chunk-CKTS6G6I.js';
2
- import { createTimeline, lengthen, ensureFilterLibrary, checkEase, parseEase, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, rand, DEG, timeRemapOf, contentLength, resolveAt } from './chunk-TGJACVLD.js';
3
- export { noise, rand, random, registerSequenceType } from './chunk-TGJACVLD.js';
1
+ import { CompositionSequence, maskSourceOf } from './chunk-K3F2YKL4.js';
2
+ import { createTimeline, lengthen, ensureFilterLibrary, checkEase, parseEase, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, rand, DEG, timeRemapOf, contentLength, resolveAt } from './chunk-BQNNZEAX.js';
3
+ export { noise, rand, random, registerSequenceType } from './chunk-BQNNZEAX.js';
4
4
  import { usesAdvancedBlend, enableAdvancedBlend } from './chunk-TYWFKCPY.js';
5
5
  import { collectPropKeys } from './chunk-45QKLD6M.js';
6
6
  import { warnUnknownOptions, suggestName } from './chunk-BXOCEZ4U.js';
@@ -144,16 +144,19 @@ function clockReach(a, total) {
144
144
  }
145
145
 
146
146
  // src/core/AudioMixer.ts
147
- async function mixdown(audios, totalDuration, sampleRate = 44100) {
147
+ async function mixdown(audios, totalDuration, sampleRate = 44100, pace) {
148
148
  if (audios.length === 0) return null;
149
+ const weight = (a) => a.synth ? Math.max(1, a.end - a.start) : 0.2;
150
+ const all = audios.reduce((s, a) => s + weight(a), 0) + 0.5;
151
+ let made = 0;
149
152
  const ctx = new OfflineAudioContext(2, Math.ceil(sampleRate * totalDuration), sampleRate);
150
153
  const synthesised = /* @__PURE__ */ new Map();
151
- const bufferOf = (a) => {
154
+ const bufferOf = async (a, inner) => {
152
155
  if (a.buffer) return a.buffer;
153
156
  if (!a.synth) return null;
154
157
  let buf = synthesised.get(a.synth.key);
155
158
  if (!buf) {
156
- const [left, right] = a.synth.render(sampleRate);
159
+ const [left, right] = a.synth.renderAsync ? await a.synth.renderAsync(sampleRate, inner) : a.synth.render(sampleRate);
157
160
  buf = ctx.createBuffer(2, left.length, sampleRate);
158
161
  buf.getChannelData(0).set(left);
159
162
  buf.getChannelData(1).set(right);
@@ -162,7 +165,10 @@ async function mixdown(audios, totalDuration, sampleRate = 44100) {
162
165
  return buf;
163
166
  };
164
167
  for (const a of audios) {
165
- const buffer = bufferOf(a);
168
+ const w = weight(a), base = made;
169
+ const buffer = await bufferOf(a, pace ? (f) => pace((base + w * f) / all) : void 0);
170
+ made += w;
171
+ if (pace) await pace(made / all);
166
172
  if (!buffer) continue;
167
173
  if (a.warp || a.sourceMap) {
168
174
  const r = resampleThrough(a, buffer.getChannelData(0), buffer.numberOfChannels > 1 ? buffer.getChannelData(1) : buffer.getChannelData(0), buffer.sampleRate, sampleRate, totalDuration);
@@ -2406,6 +2412,7 @@ var LoadProgress = class {
2406
2412
  _onChange;
2407
2413
  _stage = null;
2408
2414
  _loaded = 0;
2415
+ _part = 0;
2409
2416
  _total = 0;
2410
2417
  _high = 0;
2411
2418
  _started = 0;
@@ -2423,6 +2430,7 @@ var LoadProgress = class {
2423
2430
  this._closeTiming();
2424
2431
  this._stage = stage;
2425
2432
  this._loaded = 0;
2433
+ this._part = 0;
2426
2434
  this._total = Math.max(0, total);
2427
2435
  this._started = this._now();
2428
2436
  this._emit();
@@ -2430,6 +2438,13 @@ var LoadProgress = class {
2430
2438
  tick(n = 1) {
2431
2439
  if (!this._stage) return;
2432
2440
  this._loaded = Math.min(this._total, this._loaded + n);
2441
+ this._part = 0;
2442
+ this._emit();
2443
+ }
2444
+ /** How much of the item being worked on is done (0..1), for an item that takes long: the number moves between two `tick`s. */
2445
+ part(done) {
2446
+ if (!this._stage) return;
2447
+ this._part = Math.min(1, Math.max(0, done));
2433
2448
  this._emit();
2434
2449
  }
2435
2450
  /** Everything is done: 1, whatever stage it was in. */
@@ -2461,7 +2476,7 @@ var LoadProgress = class {
2461
2476
  if (s === stage) break;
2462
2477
  done += WEIGHT[s];
2463
2478
  }
2464
- const within = this._total > 0 ? this._loaded / this._total : 1;
2479
+ const within = this._total > 0 ? Math.min(1, (this._loaded + this._part) / this._total) : 1;
2465
2480
  this._high = Math.min(1, Math.max(this._high, done + WEIGHT[stage] * within));
2466
2481
  this._onChange({ stage, loaded: this._loaded, total: this._total, progress: this._high });
2467
2482
  }
@@ -2734,10 +2749,13 @@ var Movie = class {
2734
2749
  this._timeFilters = collectTimeFilters(composition);
2735
2750
  const audios = [];
2736
2751
  composition.collectAudio(audios, 0);
2737
- lp.begin("sound", audios.length);
2752
+ lp.begin("sound", 1);
2738
2753
  if (audios.length > 0) {
2739
- this.audioBuffer = await mixdown(audios, this.duration, audioContext.sampleRate);
2740
- lp.tick(audios.length);
2754
+ this.audioBuffer = await mixdown(audios, this.duration, audioContext.sampleRate, async (done) => {
2755
+ lp.part(done);
2756
+ await lp.yieldIfDue();
2757
+ });
2758
+ lp.tick();
2741
2759
  if (this.audioBuffer) this._mixStats = limitMix(this.audioBuffer, audios);
2742
2760
  }
2743
2761
  this._audioSources = audios;
@@ -4314,7 +4332,7 @@ async function audioEnvelope(source, options = {}) {
4314
4332
 
4315
4333
  // src/audio/musicEnvelope.ts
4316
4334
  async function musicEnvelope(music, options = {}) {
4317
- const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-3O5MDQXY.js');
4335
+ const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-72YJAMXH.js');
4318
4336
  const messages = [];
4319
4337
  const m = resolveMusic(music, "musicEnvelope()", (msg) => messages.push(msg));
4320
4338
  if (!m) throw new Error(`pixi-effects: musicEnvelope(): ${messages.join(" ") || "the music has nothing to play"}`);
@@ -4327,7 +4345,7 @@ async function musicEnvelope(music, options = {}) {
4327
4345
 
4328
4346
  // src/audio/musicBuffer.ts
4329
4347
  async function musicBuffer(music, options = {}) {
4330
- const { resolveMusic, renderMusic, musicLength } = await import('./music-3O5MDQXY.js');
4348
+ const { resolveMusic, renderMusic, musicLength } = await import('./music-72YJAMXH.js');
4331
4349
  const messages = [];
4332
4350
  const m = resolveMusic(music, "musicBuffer()", (msg) => messages.push(msg));
4333
4351
  if (!m) throw new Error(`pixi-effects: musicBuffer(): ${messages.join(" ") || "the music has nothing to play"}`);