pixi-effects 0.3.0 → 0.4.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 (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -6
  3. package/ai/SKILL.md +3 -1
  4. package/ai/reference/cheatsheet.md +6 -5
  5. package/ai/reference/pitfalls.md +24 -3
  6. package/ai/template.html +3 -3
  7. package/dist/{Base-Ba4Ta4ap.d.ts → Base-5R7C5pHR.d.cts} +7 -1
  8. package/dist/{Base-BDw6dKRB.d.cts → Base-DhY9oMxr.d.ts} +7 -1
  9. package/dist/Composition-D7RCAGEA.cjs +13 -0
  10. package/dist/{Composition-6FDH5OPM.cjs.map → Composition-D7RCAGEA.cjs.map} +1 -1
  11. package/dist/Composition-RGTRZ2JX.js +4 -0
  12. package/dist/{Composition-FEYAUMFI.js.map → Composition-RGTRZ2JX.js.map} +1 -1
  13. package/dist/Controller.d.cts +2 -2
  14. package/dist/Controller.d.ts +2 -2
  15. package/dist/{Movie-W8ISiEBB.d.cts → Movie-CghFXprP.d.cts} +1 -1
  16. package/dist/{Movie-DMpaT67V.d.ts → Movie-DRZtIGU7.d.ts} +1 -1
  17. package/dist/{chunk-SIRVULFF.cjs → chunk-6BQ6IEW2.cjs} +119 -36
  18. package/dist/chunk-6BQ6IEW2.cjs.map +1 -0
  19. package/dist/{chunk-DIJG2RSF.js → chunk-A574IA4F.js} +44 -6
  20. package/dist/chunk-A574IA4F.js.map +1 -0
  21. package/dist/{chunk-ZL262ZRM.cjs → chunk-QGBOC5YL.cjs} +56 -18
  22. package/dist/chunk-QGBOC5YL.cjs.map +1 -0
  23. package/dist/{chunk-PN5A6QA7.js → chunk-ZQX7WIYL.js} +119 -37
  24. package/dist/chunk-ZQX7WIYL.js.map +1 -0
  25. package/dist/index.cjs +58 -16
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +4 -4
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +50 -8
  30. package/dist/index.js.map +1 -1
  31. package/dist/three.cjs +5 -5
  32. package/dist/three.d.cts +2 -2
  33. package/dist/three.d.ts +2 -2
  34. package/dist/three.js +1 -1
  35. package/dist/{types-3c8Vymgw.d.cts → types-CRE9WKd4.d.cts} +6 -0
  36. package/dist/{types-3c8Vymgw.d.ts → types-CRE9WKd4.d.ts} +6 -0
  37. package/docs/dsl.md +12 -1
  38. package/llms-full.txt +45 -10
  39. package/package.json +2 -1
  40. package/dist/Composition-6FDH5OPM.cjs +0 -13
  41. package/dist/Composition-FEYAUMFI.js +0 -4
  42. package/dist/chunk-DIJG2RSF.js.map +0 -1
  43. package/dist/chunk-PN5A6QA7.js.map +0 -1
  44. package/dist/chunk-SIRVULFF.cjs.map +0 -1
  45. package/dist/chunk-ZL262ZRM.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- export { C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, a as InspectReport, L as LayerInfo, M as Movie, b as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions } from './Movie-W8ISiEBB.cjs';
2
- import { S as Sequence } from './Base-BDw6dKRB.cjs';
3
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-3c8Vymgw.cjs';
4
- export { A as AssetSpec, c as AudioSequenceSpec, d as ChromaKeyFilterSpec, e as CircleShapeSpec, f as CompositionSequenceSpec, g as CompositionSpec, h as CrossfadeTransition, i as CustomFilterSpec, D as DipTransition, j as DissolveTransition, E as EllipseShapeSpec, k as Expr, F as FilterSpec, G as GradientSpec, l as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, m as PolygonShapeSpec, n as PropValue, o as Props, R as RectShapeSpec, p as ShapeSequenceSpec, q as SlideTransition, T as TextSequenceSpec, r as TransitionCommon, s as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-3c8Vymgw.cjs';
1
+ export { C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, a as InspectReport, L as LayerInfo, M as Movie, b as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions } from './Movie-CghFXprP.cjs';
2
+ import { S as Sequence } from './Base-5R7C5pHR.cjs';
3
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-CRE9WKd4.cjs';
4
+ export { A as AssetSpec, c as AudioSequenceSpec, d as ChromaKeyFilterSpec, e as CircleShapeSpec, f as CompositionSequenceSpec, g as CompositionSpec, h as CrossfadeTransition, i as CustomFilterSpec, D as DipTransition, j as DissolveTransition, E as EllipseShapeSpec, k as Expr, F as FilterSpec, G as GradientSpec, l as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, m as PolygonShapeSpec, n as PropValue, o as Props, R as RectShapeSpec, p as ShapeSequenceSpec, q as SlideTransition, T as TextSequenceSpec, r as TransitionCommon, s as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-CRE9WKd4.cjs';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, a as InspectReport, L as LayerInfo, M as Movie, b as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions } from './Movie-DMpaT67V.js';
2
- import { S as Sequence } from './Base-Ba4Ta4ap.js';
3
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-3c8Vymgw.js';
4
- export { A as AssetSpec, c as AudioSequenceSpec, d as ChromaKeyFilterSpec, e as CircleShapeSpec, f as CompositionSequenceSpec, g as CompositionSpec, h as CrossfadeTransition, i as CustomFilterSpec, D as DipTransition, j as DissolveTransition, E as EllipseShapeSpec, k as Expr, F as FilterSpec, G as GradientSpec, l as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, m as PolygonShapeSpec, n as PropValue, o as Props, R as RectShapeSpec, p as ShapeSequenceSpec, q as SlideTransition, T as TextSequenceSpec, r as TransitionCommon, s as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-3c8Vymgw.js';
1
+ export { C as ContactSheetOptions, F as FrameEvent, I as InspectOptions, a as InspectReport, L as LayerInfo, M as Movie, b as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions } from './Movie-DRZtIGU7.js';
2
+ import { S as Sequence } from './Base-DhY9oMxr.js';
3
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, b as SequenceCommon } from './types-CRE9WKd4.js';
4
+ export { A as AssetSpec, c as AudioSequenceSpec, d as ChromaKeyFilterSpec, e as CircleShapeSpec, f as CompositionSequenceSpec, g as CompositionSpec, h as CrossfadeTransition, i as CustomFilterSpec, D as DipTransition, j as DissolveTransition, E as EllipseShapeSpec, k as Expr, F as FilterSpec, G as GradientSpec, l as IrisTransition, K as Keyframe, L as LineShapeSpec, P as PathShapeSpec, m as PolygonShapeSpec, n as PropValue, o as Props, R as RectShapeSpec, p as ShapeSequenceSpec, q as SlideTransition, T as TextSequenceSpec, r as TransitionCommon, s as TransitionSpec, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition } from './types-CRE9WKd4.js';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { CompositionSequence } from './chunk-DIJG2RSF.js';
2
- import { homeDistance, DEFAULT_FOV, DEG, resolveAt, collectPropKeys } from './chunk-PN5A6QA7.js';
3
- export { registerSequenceType } from './chunk-PN5A6QA7.js';
1
+ import { CompositionSequence } from './chunk-A574IA4F.js';
2
+ import { homeDistance, DEFAULT_FOV, DEG, resolveAt, collectPropKeys } from './chunk-ZQX7WIYL.js';
3
+ export { registerSequenceType } from './chunk-ZQX7WIYL.js';
4
4
  import * as PIXI from 'pixi.js';
5
5
  import { extensions, CullerPlugin, Application, Container, Rectangle, Culler, Assets, ExtensionType, Filter, UniformGroup, GpuProgram, GlProgram, defaultFilterVert } from 'pixi.js';
6
6
  import { gsap } from 'gsap';
@@ -501,6 +501,15 @@ var TransitionMaskFilter = class extends Filter {
501
501
  };
502
502
 
503
503
  // src/core/Transitions.ts
504
+ var windows = /* @__PURE__ */ new WeakMap();
505
+ function transitionWindowsOf(spec) {
506
+ return windows.get(spec) ?? [];
507
+ }
508
+ function carryTransitionWindows(from, to) {
509
+ const w = windows.get(from);
510
+ if (w) windows.set(to, w);
511
+ return to;
512
+ }
504
513
  function expandTransitions(spec) {
505
514
  const out = {
506
515
  ...spec,
@@ -611,6 +620,9 @@ function expandTransitions(spec) {
611
620
  if (tStart < toStart || tEnd > toEnd) {
612
621
  throw new Error(`pixi-effects: ${tag} window [${tStart}, ${tEnd}] is not covered by \`to\` "${t.to}" (lives [${toStart}, ${toEnd}], so it starts at ${toStart})`);
613
622
  }
623
+ const record = windows.get(out) ?? [];
624
+ record.push({ from: t.from, to: t.to, start: tStart, end: tEnd });
625
+ windows.set(out, record);
614
626
  const abs = { ...t, at: tStart };
615
627
  const nFrom = keyframeCount(fromEntry.seq);
616
628
  const nTo = keyframeCount(toEntry.seq);
@@ -904,10 +916,25 @@ var intersection = (a, b) => {
904
916
  const h = Math.min(a.y + a.height, b.y + b.height) - Math.max(a.y, b.y);
905
917
  return w > 0 && h > 0 ? w * h : 0;
906
918
  };
919
+ var clip = (a, b) => {
920
+ const x = Math.max(a.x, b.x), y = Math.max(a.y, b.y);
921
+ const w = Math.min(a.x + a.width, b.x + b.width) - x, h = Math.min(a.y + a.height, b.y + b.height) - y;
922
+ return w > 0 && h > 0 ? { x, y, width: w, height: h } : null;
923
+ };
907
924
  function inspectScene(root, frame, time, canvas, opts = {}) {
908
925
  const layers = [];
909
926
  const view = { x: 0, y: 0, width: canvas.width, height: canvas.height };
910
- const walk = (comp, prefix, insideThreeD, parentVisible) => {
927
+ const seen = /* @__PURE__ */ new Map();
928
+ const scene = /* @__PURE__ */ new Map();
929
+ const walk = (comp, prefix, insideThreeD, parentVisible, parentScene) => {
930
+ const blending = /* @__PURE__ */ new Set();
931
+ for (const w of transitionWindowsOf(comp.spec)) {
932
+ const start = (comp.absoluteStart ?? 0) + w.start, end = (comp.absoluteStart ?? 0) + w.end;
933
+ if (time >= start - 1e-9 && time <= end + 1e-9) {
934
+ blending.add(w.from);
935
+ blending.add(w.to);
936
+ }
937
+ }
911
938
  comp.layers().forEach(({ seq, display, threeD }, i) => {
912
939
  const t = seq.target;
913
940
  const name = seq.spec.name;
@@ -929,8 +956,18 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
929
956
  }
930
957
  const keys = collectPropKeys(seq.spec);
931
958
  const moving = (seq.spec.keyframes ?? []).length > 0 && (keys.has("x") || keys.has("y"));
932
- layers.push({ path: prefix + label, name, type: seq.spec.type, threeD, visible, alpha, moving, bounds, onCanvas });
933
- if (seq instanceof CompositionSequence) walk(seq, prefix + label + "/", insideThreeD || threeD, visible);
959
+ const info = { path: prefix + label, name, type: seq.spec.type, threeD, visible, alpha, moving, bounds, onCanvas };
960
+ layers.push(info);
961
+ let shown = bounds ? clip(bounds, view) : null;
962
+ const maskTarget = seq.maskSequence?.target;
963
+ if (shown && maskTarget && !seq.spec.maskInverted) {
964
+ const m = maskTarget.getBounds();
965
+ shown = clip(shown, { x: m.x, y: m.y, width: m.width, height: m.height });
966
+ }
967
+ seen.set(info, shown);
968
+ const group = parentScene ?? (name !== void 0 && blending.has(name) ? name : void 0);
969
+ if (group) scene.set(info, group);
970
+ if (seq instanceof CompositionSequence) walk(seq, prefix + label + "/", insideThreeD || threeD, visible, group);
934
971
  });
935
972
  };
936
973
  walk(root, "", false, true);
@@ -941,7 +978,7 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
941
978
  const who = `text layer "${l.path}"`;
942
979
  if (b.width < 1 || b.height < 1) {
943
980
  issues.push(`${who} has no size (empty text, or not drawn yet)`);
944
- } else if (l.moving) ; else if (l.onCanvas === "none") {
981
+ } else if (l.moving || scene.has(l)) ; else if (l.onCanvas === "none") {
945
982
  issues.push(`${who} is entirely outside the canvas (at ${Math.round(b.x)},${Math.round(b.y)}, ${Math.round(b.width)}\xD7${Math.round(b.height)})`);
946
983
  } else if (l.onCanvas === "partial") {
947
984
  const over = [];
@@ -954,7 +991,10 @@ function inspectScene(root, frame, time, canvas, opts = {}) {
954
991
  }
955
992
  for (let i = 0; i < texts.length; i++) {
956
993
  for (let j = i + 1; j < texts.length; j++) {
957
- const a = texts[i].bounds, b = texts[j].bounds;
994
+ const a = seen.get(texts[i]), b = seen.get(texts[j]);
995
+ if (!a || !b) continue;
996
+ const sa = scene.get(texts[i]), sb = scene.get(texts[j]);
997
+ if (sa && sb && sa !== sb) continue;
958
998
  const smaller = Math.min(a.width * a.height, b.width * b.height);
959
999
  if (smaller <= 0) continue;
960
1000
  const share = intersection(a, b) / smaller;
@@ -1154,6 +1194,7 @@ var Movie = class {
1154
1194
  duration: this.duration,
1155
1195
  ...userComposition
1156
1196
  };
1197
+ if (userComposition) carryTransitionWindows(userComposition, rootSeqSpec);
1157
1198
  const composition = new CompositionSequence(rootSeqSpec, null, rootShape);
1158
1199
  await composition.build();
1159
1200
  this._rootSequence = composition;
@@ -1261,6 +1302,7 @@ var Movie = class {
1261
1302
  _renderNow() {
1262
1303
  const app = this.app;
1263
1304
  if (!app?.renderer) return;
1305
+ this._rootSequence?.syncFrame();
1264
1306
  Culler.shared.cull(app.stage, app.renderer.screen, false);
1265
1307
  app.renderer.render({ container: app.stage });
1266
1308
  }