pixi-effects 0.5.0 → 0.6.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 (48) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +7 -6
  3. package/ai/reference/cheatsheet.md +3 -1
  4. package/ai/reference/pitfalls.md +1 -0
  5. package/ai/reference/recipes.md +36 -1
  6. package/ai/template.html +3 -3
  7. package/dist/{Base-DnRAxroQ.d.cts → Base-4vNLl4tH.d.cts} +1 -1
  8. package/dist/{Base-CPSFBkPm.d.ts → Base-CD4AoT5-.d.ts} +1 -1
  9. package/dist/Composition-7SO5WYHU.js +4 -0
  10. package/dist/{Composition-TUCRSMJU.js.map → Composition-7SO5WYHU.js.map} +1 -1
  11. package/dist/Composition-Y5VZSDDP.cjs +13 -0
  12. package/dist/{Composition-63EXHNJJ.cjs.map → Composition-Y5VZSDDP.cjs.map} +1 -1
  13. package/dist/Controller.cjs +10 -2
  14. package/dist/Controller.cjs.map +1 -1
  15. package/dist/Controller.d.cts +3 -2
  16. package/dist/Controller.d.ts +3 -2
  17. package/dist/Controller.js +10 -2
  18. package/dist/Controller.js.map +1 -1
  19. package/dist/{Movie-VyDiUYOj.d.ts → Movie-CADDBfpl.d.cts} +3 -1
  20. package/dist/{Movie-CuU_aaCm.d.cts → Movie-Ch2SUI1h.d.ts} +3 -1
  21. package/dist/{chunk-23M5QTWW.cjs → chunk-4AGJF5RK.cjs} +21 -21
  22. package/dist/{chunk-23M5QTWW.cjs.map → chunk-4AGJF5RK.cjs.map} +1 -1
  23. package/dist/{chunk-UBPZLGLU.js → chunk-7IJHJXDI.js} +241 -37
  24. package/dist/chunk-7IJHJXDI.js.map +1 -0
  25. package/dist/{chunk-5Q5XZG7Z.js → chunk-B2FTJLNB.js} +3 -3
  26. package/dist/{chunk-5Q5XZG7Z.js.map → chunk-B2FTJLNB.js.map} +1 -1
  27. package/dist/{chunk-2RR43OIN.cjs → chunk-KQM2ZZMK.cjs} +241 -37
  28. package/dist/chunk-KQM2ZZMK.cjs.map +1 -0
  29. package/dist/index.cjs +58 -19
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +4 -4
  32. package/dist/index.d.ts +4 -4
  33. package/dist/index.js +49 -10
  34. package/dist/index.js.map +1 -1
  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-7VtTEKUW.d.cts → types-DrW9QeKU.d.cts} +22 -6
  40. package/dist/{types-7VtTEKUW.d.ts → types-DrW9QeKU.d.ts} +22 -6
  41. package/docs/api.md +1 -0
  42. package/docs/dsl.md +26 -7
  43. package/llms-full.txt +67 -9
  44. package/package.json +1 -1
  45. package/dist/Composition-63EXHNJJ.cjs +0 -13
  46. package/dist/Composition-TUCRSMJU.js +0 -4
  47. package/dist/chunk-2RR43OIN.cjs.map +0 -1
  48. package/dist/chunk-UBPZLGLU.js.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 FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, M as Movie, d as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, e as SoundMeasure } from './Movie-CuU_aaCm.cjs';
2
- import { S as Sequence } from './Base-DnRAxroQ.cjs';
3
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-7VtTEKUW.cjs';
4
- export { A as ArcShapeSpec, c as AssetSpec, d as AudioAssetSpec, e as AudioSequenceSpec, f as AudioSfxSpec, g as ChromaKeyFilterSpec, h as CircleShapeSpec, i as CompositionSequenceSpec, j as CompositionSpec, k as CrossfadeTransition, l as CustomFilterSpec, D as DipTransition, m as DissolveTransition, E as EllipseShapeSpec, n as Expr, F as FilterSpec, G as GradientSpec, o as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, p as PolygonShapeSpec, q as PropValue, r as Props, R as RectShapeSpec, s as SfxKnobs, t as SfxOptions, u as SfxPreset, v as SfxVoice, w as ShapeSequenceSpec, x as SlideTransition, T as TextSequenceSpec, y as TransitionCommon, z as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-7VtTEKUW.cjs';
1
+ export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, M as Movie, d as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, e as SoundMeasure } from './Movie-CADDBfpl.cjs';
2
+ import { S as Sequence } from './Base-4vNLl4tH.cjs';
3
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-DrW9QeKU.cjs';
4
+ export { A as ArcShapeSpec, c as AssetSpec, d as AudioAssetSpec, e as AudioSequenceSpec, f as AudioSfxSpec, g as ChromaKeyFilterSpec, h as CircleShapeSpec, i as CompositionSequenceSpec, j as CompositionSpec, k as CrossfadeTransition, l as CustomFilterSpec, D as DipTransition, m as DissolveTransition, E as EllipseShapeSpec, n as Expr, F as FilterSpec, G as GradientSpec, o as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, p as PolygonShapeSpec, q as PropValue, r as Props, R as RectShapeSpec, s as SfxKnobs, t as SfxOptions, u as SfxPreset, v as SfxVoice, w as ShapeSequenceSpec, x as SlideTransition, T as TextSequenceSpec, y as TransitionCommon, z as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-DrW9QeKU.cjs';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
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 FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, M as Movie, d as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, e as SoundMeasure } from './Movie-VyDiUYOj.js';
2
- import { S as Sequence } from './Base-CPSFBkPm.js';
3
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-7VtTEKUW.js';
4
- export { A as ArcShapeSpec, c as AssetSpec, d as AudioAssetSpec, e as AudioSequenceSpec, f as AudioSfxSpec, g as ChromaKeyFilterSpec, h as CircleShapeSpec, i as CompositionSequenceSpec, j as CompositionSpec, k as CrossfadeTransition, l as CustomFilterSpec, D as DipTransition, m as DissolveTransition, E as EllipseShapeSpec, n as Expr, F as FilterSpec, G as GradientSpec, o as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, p as PolygonShapeSpec, q as PropValue, r as Props, R as RectShapeSpec, s as SfxKnobs, t as SfxOptions, u as SfxPreset, v as SfxVoice, w as ShapeSequenceSpec, x as SlideTransition, T as TextSequenceSpec, y as TransitionCommon, z as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-7VtTEKUW.js';
1
+ export { A as AudioInspectOptions, a as AudioReport, b as AudioSourceReport, C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, c as InspectReport, L as LayerInfo, M as Movie, d as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, e as SoundMeasure } from './Movie-Ch2SUI1h.js';
2
+ import { S as Sequence } from './Base-CD4AoT5-.js';
3
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-DrW9QeKU.js';
4
+ export { A as ArcShapeSpec, c as AssetSpec, d as AudioAssetSpec, e as AudioSequenceSpec, f as AudioSfxSpec, g as ChromaKeyFilterSpec, h as CircleShapeSpec, i as CompositionSequenceSpec, j as CompositionSpec, k as CrossfadeTransition, l as CustomFilterSpec, D as DipTransition, m as DissolveTransition, E as EllipseShapeSpec, n as Expr, F as FilterSpec, G as GradientSpec, o as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, p as PolygonShapeSpec, q as PropValue, r as Props, R as RectShapeSpec, s as SfxKnobs, t as SfxOptions, u as SfxPreset, v as SfxVoice, w as ShapeSequenceSpec, x as SlideTransition, T as TextSequenceSpec, y as TransitionCommon, z as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-DrW9QeKU.js';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { warnUnknownOptions, suggestName } from './chunk-DKGG7WD4.js';
2
- import { CompositionSequence } from './chunk-5Q5XZG7Z.js';
3
- import { homeDistance, DEFAULT_FOV, DEG, resolveAt, collectPropKeys } from './chunk-UBPZLGLU.js';
4
- export { registerSequenceType } from './chunk-UBPZLGLU.js';
2
+ import { CompositionSequence } from './chunk-B2FTJLNB.js';
3
+ import { homeDistance, DEFAULT_FOV, DEG, resolveAt, collectPropKeys } from './chunk-7IJHJXDI.js';
4
+ export { registerSequenceType } from './chunk-7IJHJXDI.js';
5
5
  import * as PIXI from 'pixi.js';
6
6
  import { extensions, CullerPlugin, Application, Container, Rectangle, Culler, CanvasTextMetrics, TextStyle, Assets, ExtensionType, Filter, UniformGroup, GpuProgram, GlProgram, defaultFilterVert } from 'pixi.js';
7
7
  import { gsap } from 'gsap';
@@ -1163,7 +1163,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
1163
1163
  seen.set(info, shown);
1164
1164
  const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
1165
1165
  if (group) scene.set(info, group);
1166
- if (zero) scaledToNothing.add(info);
1166
+ if (zero || seq.showsNothingYet) scaledToNothing.add(info);
1167
1167
  if (seq instanceof CompositionSequence) walk(seq, prefix + label + "/", insideThreeD || threeD, visible, group, moving, zero);
1168
1168
  });
1169
1169
  };
@@ -1224,6 +1224,35 @@ function sheetLayout(n, columns, cellW, srcW, srcH, labelH) {
1224
1224
  return { cols, rows, cellW, cellH, width: cols * cellW, height: rows * (cellH + labelH), positions };
1225
1225
  }
1226
1226
 
1227
+ // src/core/startWhenRunning.ts
1228
+ function startWhenRunning(ctx, start, gesture) {
1229
+ if (ctx.state === "running") {
1230
+ start();
1231
+ return () => {
1232
+ };
1233
+ }
1234
+ let done = false;
1235
+ const resume = () => {
1236
+ ctx.resume?.()?.catch(() => {
1237
+ });
1238
+ };
1239
+ const stop = () => {
1240
+ done = true;
1241
+ ctx.removeEventListener("statechange", onState);
1242
+ for (const e of GESTURES) gesture?.removeEventListener(e, resume, true);
1243
+ };
1244
+ const onState = () => {
1245
+ if (done || ctx.state !== "running") return;
1246
+ stop();
1247
+ start();
1248
+ };
1249
+ ctx.addEventListener("statechange", onState);
1250
+ for (const e of GESTURES) gesture?.addEventListener(e, resume, true);
1251
+ resume();
1252
+ return stop;
1253
+ }
1254
+ var GESTURES = ["pointerdown", "mousedown", "touchend", "keydown"];
1255
+
1227
1256
  // src/core/Movie.ts
1228
1257
  extensions.add(CullerPlugin);
1229
1258
  gsap.registerPlugin(PixiPlugin);
@@ -1236,6 +1265,7 @@ var Movie = class {
1236
1265
  audioBuffer = null;
1237
1266
  audioSource = null;
1238
1267
  gainNode = null;
1268
+ _cancelAudioStart = null;
1239
1269
  _volume = 1;
1240
1270
  _muted = false;
1241
1271
  isPlaying = false;
@@ -1473,6 +1503,7 @@ var Movie = class {
1473
1503
  play() {
1474
1504
  if (this._initState !== "ready") return;
1475
1505
  if (this.currentFrame >= this.totalFrames) this.currentFrame = 0;
1506
+ const wasPlaying = this.isPlaying;
1476
1507
  this.isPlaying = true;
1477
1508
  const startTime = performance.now() - this.currentFrame / this.frameRate * 1e3;
1478
1509
  let inFlight = false;
@@ -1502,17 +1533,25 @@ var Movie = class {
1502
1533
  this._raf = requestAnimationFrame(tick);
1503
1534
  if (this.audioBuffer) {
1504
1535
  const ctx = this._ensureAudioContext();
1505
- this.audioSource = ctx.createBufferSource();
1506
- this.audioSource.buffer = this.audioBuffer;
1507
- this.gainNode = ctx.createGain();
1508
- this.gainNode.gain.value = this._muted ? 0 : this._volume;
1509
- this.audioSource.connect(this.gainNode).connect(ctx.destination);
1510
- this.audioSource.start(0, this.currentFrame / this.frameRate);
1536
+ const buffer = this.audioBuffer;
1537
+ this._cancelAudioStart?.();
1538
+ this._cancelAudioStart = startWhenRunning(ctx, () => {
1539
+ if (!this.isPlaying) return;
1540
+ this.audioSource = ctx.createBufferSource();
1541
+ this.audioSource.buffer = buffer;
1542
+ this.gainNode = ctx.createGain();
1543
+ this.gainNode.gain.value = this._muted ? 0 : this._volume;
1544
+ this.audioSource.connect(this.gainNode).connect(ctx.destination);
1545
+ this.audioSource.start(0, Math.min(this.currentFrame / this.frameRate, buffer.duration));
1546
+ }, typeof window !== "undefined" ? window : void 0);
1511
1547
  }
1548
+ if (!wasPlaying) this.emit("play");
1512
1549
  }
1513
1550
  pause() {
1514
1551
  const wasPlaying = this.isPlaying;
1515
1552
  this.isPlaying = false;
1553
+ this._cancelAudioStart?.();
1554
+ this._cancelAudioStart = null;
1516
1555
  if (this._raf) {
1517
1556
  cancelAnimationFrame(this._raf);
1518
1557
  this._raf = null;