pixi-effects 0.12.0 → 0.13.1

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.
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, d as LoaderOption, M as MotionBlurOptions, e as MotionBlurSpec, f as Movie, g as MovieErrorEvent, h as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, i as SoundMeasure, j as StopEvent, k as StopImage, l as StopImagesOptions, T as TimelineData, m as TimelineHtmlOptions, n as TimelineRow, o as TimelineSvgOptions, p as TimelineTransition, V as VolumeEvent, q as dismissLoader, r as failLoader, s as resolveLoader } from './Movie-CY2QPVVM.cjs';
2
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-mpqQO8MJ.cjs';
3
- export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioSequenceSpec, h as AudioSfxSpec, i as ChromaKeyFilterSpec, j as CircleShapeSpec, k as CompositionSequenceSpec, l as CrossfadeTransition, m as CustomFilterSpec, D as DipTransition, n as DissolveTransition, E as EllipseShapeSpec, o as Expr, F as FilterSpec, G as GradientSpec, p as IrisTransition, L as LineShapeSpec, N as NullSequenceSpec, q as PathShapeSpec, r as PolygonShapeSpec, s as PropValue, R as RectShapeSpec, t as SfxKnobs, u as SfxOptions, v as SfxPreset, w as SfxVoice, x as ShapeSequenceSpec, y as SlideTransition, z as Stop, B as StopSpec, H as TransitionCommon, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition, J as normalizeStops } from './types-mpqQO8MJ.cjs';
4
- import { S as Sequence } from './Base-W3sQzGPO.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, d as LoaderOption, M as MotionBlurOptions, e as MotionBlurSpec, f as Movie, g as MovieErrorEvent, h as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, i as SoundMeasure, j as StopEvent, k as StopImage, l as StopImagesOptions, T as TimelineData, m as TimelineHtmlOptions, n as TimelineRow, o as TimelineSvgOptions, p as TimelineTransition, V as VolumeEvent, q as dismissLoader, r as failLoader, s as resolveLoader } from './Movie-Tl5dRLJl.cjs';
2
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-CBSiUKau.cjs';
3
+ export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioSequenceSpec, h as AudioSfxSpec, i as ChromaKeyFilterSpec, j as CircleShapeSpec, k as CompositionSequenceSpec, l as CrossfadeTransition, m as CustomFilterSpec, D as DipTransition, n as DissolveTransition, E as EllipseShapeSpec, o as Expr, F as FilterSpec, G as GradientSpec, p as IrisTransition, L as LineShapeSpec, N as NullSequenceSpec, q as PathShapeSpec, r as PolygonShapeSpec, s as PropValue, R as RectShapeSpec, t as SfxKnobs, u as SfxOptions, v as SfxPreset, w as SfxVoice, x as ShapeSequenceSpec, y as SlideTransition, z as Stop, B as StopSpec, H as TransitionCommon, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition, J as normalizeStops, M as pictureStops } from './types-CBSiUKau.cjs';
4
+ import { S as Sequence } from './Base-C6ZnJ9pD.cjs';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
@@ -531,7 +531,10 @@ interface DeckPage {
531
531
  /** The page's layers, written in the page's own time (`at: 0` is the start of the page). */
532
532
  sequences: SequenceSpec[];
533
533
  /** Where the page stops, in the page's own time: the first is the page settled, the rest are steps (a bullet appears, a chart grows). Default: where the transition into the next page begins (the end for the last page). */
534
- stops?: number[];
534
+ stops?: Array<number | {
535
+ at: number;
536
+ pdf?: boolean;
537
+ }>;
535
538
  /** Speaker notes (kept on the page's first stop). */
536
539
  notes?: string;
537
540
  /** Move on by itself this many seconds after the page's last stop (kiosk mode). */
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, d as LoaderOption, M as MotionBlurOptions, e as MotionBlurSpec, f as Movie, g as MovieErrorEvent, h as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, i as SoundMeasure, j as StopEvent, k as StopImage, l as StopImagesOptions, T as TimelineData, m as TimelineHtmlOptions, n as TimelineRow, o as TimelineSvgOptions, p as TimelineTransition, V as VolumeEvent, q as dismissLoader, r as failLoader, s as resolveLoader } from './Movie-EBF6_RfX.js';
2
- import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-mpqQO8MJ.js';
3
- export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioSequenceSpec, h as AudioSfxSpec, i as ChromaKeyFilterSpec, j as CircleShapeSpec, k as CompositionSequenceSpec, l as CrossfadeTransition, m as CustomFilterSpec, D as DipTransition, n as DissolveTransition, E as EllipseShapeSpec, o as Expr, F as FilterSpec, G as GradientSpec, p as IrisTransition, L as LineShapeSpec, N as NullSequenceSpec, q as PathShapeSpec, r as PolygonShapeSpec, s as PropValue, R as RectShapeSpec, t as SfxKnobs, u as SfxOptions, v as SfxPreset, w as SfxVoice, x as ShapeSequenceSpec, y as SlideTransition, z as Stop, B as StopSpec, H as TransitionCommon, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition, J as normalizeStops } from './types-mpqQO8MJ.js';
4
- import { S as Sequence } from './Base-CYH9vPCH.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, d as LoaderOption, M as MotionBlurOptions, e as MotionBlurSpec, f as Movie, g as MovieErrorEvent, h as MovieOptions, P as ProgressEvent, R as RenderOptions, S as SnapshotOptions, i as SoundMeasure, j as StopEvent, k as StopImage, l as StopImagesOptions, T as TimelineData, m as TimelineHtmlOptions, n as TimelineRow, o as TimelineSvgOptions, p as TimelineTransition, V as VolumeEvent, q as dismissLoader, r as failLoader, s as resolveLoader } from './Movie-DnR4H1OO.js';
2
+ import { S as SequenceSpec, C as CompositionShape, I as ImageSequenceSpec, a as CameraSequenceSpec, K as Keyframe, T as TextSequenceSpec, P as Props, b as TransitionSpec, c as CompositionSpec, d as SequenceCommon } from './types-CBSiUKau.js';
3
+ export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioSequenceSpec, h as AudioSfxSpec, i as ChromaKeyFilterSpec, j as CircleShapeSpec, k as CompositionSequenceSpec, l as CrossfadeTransition, m as CustomFilterSpec, D as DipTransition, n as DissolveTransition, E as EllipseShapeSpec, o as Expr, F as FilterSpec, G as GradientSpec, p as IrisTransition, L as LineShapeSpec, N as NullSequenceSpec, q as PathShapeSpec, r as PolygonShapeSpec, s as PropValue, R as RectShapeSpec, t as SfxKnobs, u as SfxOptions, v as SfxPreset, w as SfxVoice, x as ShapeSequenceSpec, y as SlideTransition, z as Stop, B as StopSpec, H as TransitionCommon, V as VideoSequenceSpec, W as WipeTransition, Z as ZoomTransition, J as normalizeStops, M as pictureStops } from './types-CBSiUKau.js';
4
+ import { S as Sequence } from './Base-CQOlB2VH.js';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
@@ -531,7 +531,10 @@ interface DeckPage {
531
531
  /** The page's layers, written in the page's own time (`at: 0` is the start of the page). */
532
532
  sequences: SequenceSpec[];
533
533
  /** Where the page stops, in the page's own time: the first is the page settled, the rest are steps (a bullet appears, a chart grows). Default: where the transition into the next page begins (the end for the last page). */
534
- stops?: number[];
534
+ stops?: Array<number | {
535
+ at: number;
536
+ pdf?: boolean;
537
+ }>;
535
538
  /** Speaker notes (kept on the page's first stop). */
536
539
  notes?: string;
537
540
  /** Move on by itself this many seconds after the page's last stop (kiosk mode). */
package/dist/index.js CHANGED
@@ -1549,7 +1549,7 @@ ${offset}
1549
1549
  }
1550
1550
 
1551
1551
  // src/core/stops.ts
1552
- var KEYS = ["at", "page", "notes", "advance"];
1552
+ var KEYS = ["at", "page", "notes", "advance", "pdf"];
1553
1553
  function normalizeStops(raw, duration, frameRate) {
1554
1554
  if (!raw || raw.length === 0) return [];
1555
1555
  const total = Math.round(duration * frameRate);
@@ -1557,7 +1557,7 @@ function normalizeStops(raw, duration, frameRate) {
1557
1557
  raw.forEach((r, i) => {
1558
1558
  const spec = typeof r === "number" ? { at: r } : r && typeof r === "object" ? r : null;
1559
1559
  if (!spec || typeof spec.at !== "number" || !Number.isFinite(spec.at)) {
1560
- console.warn(`pixi-effects: stops[${i}] ${JSON.stringify(r)} is not a time in seconds (or { at, page?, notes?, advance? }); ignored`);
1560
+ console.warn(`pixi-effects: stops[${i}] ${JSON.stringify(r)} is not a time in seconds (or { at, page?, notes?, advance?, pdf? }); ignored`);
1561
1561
  return;
1562
1562
  }
1563
1563
  if (typeof r === "object") warnUnknownOptions(`stops[${i}]`, r, KEYS);
@@ -1593,6 +1593,10 @@ function normalizeStops(raw, duration, frameRate) {
1593
1593
  if (typeof s.advance === "number" && Number.isFinite(s.advance) && s.advance >= 0) stop.advance = s.advance;
1594
1594
  else console.warn(`pixi-effects: stops[${index}] advance must be a number of seconds >= 0, got ${JSON.stringify(s.advance)}; ignored`);
1595
1595
  }
1596
+ if (s.pdf !== void 0) {
1597
+ if (typeof s.pdf === "boolean") stop.pdf = s.pdf;
1598
+ else console.warn(`pixi-effects: stops[${index}] pdf must be true or false, got ${JSON.stringify(s.pdf)}; ignored`);
1599
+ }
1596
1600
  return stop;
1597
1601
  });
1598
1602
  }
@@ -1610,6 +1614,20 @@ function stopAtOrBefore(stops, frame) {
1610
1614
  function pageStarts(stops) {
1611
1615
  return stops.filter((s) => s.pageStart);
1612
1616
  }
1617
+ function pictureStops(stops, opts = {}) {
1618
+ if (opts.which === "stops") return opts.pdf ? stops.filter((s) => s.pdf !== false) : [...stops];
1619
+ const byPage = /* @__PURE__ */ new Map();
1620
+ for (const s of stops) byPage.set(s.pageIndex, [...byPage.get(s.pageIndex) ?? [], s]);
1621
+ const take = (list) => opts.pick === "first" ? list[0] : list[list.length - 1];
1622
+ const picks = [];
1623
+ for (const list of byPage.values()) {
1624
+ const flagged = list.filter((s) => s.pdf === true);
1625
+ const usable = list.filter((s) => s.pdf !== false);
1626
+ const one = take(flagged.length ? flagged : usable.length ? usable : opts.pdf ? [] : list);
1627
+ if (one) picks.push(one);
1628
+ }
1629
+ return picks;
1630
+ }
1613
1631
 
1614
1632
  // src/core/loader.ts
1615
1633
  var FADE_FALLBACK_MS = 900;
@@ -1912,16 +1930,10 @@ var Movie = class {
1912
1930
  return encodeCanvas(out, o.type, o.as, o.quality);
1913
1931
  }
1914
1932
  async stopImages(opts = {}) {
1915
- warnUnknownOptions("movie.stopImages()", opts, ["which", "pick", "scale", "type", "quality", "as", "motionBlur", "onImage"]);
1933
+ warnUnknownOptions("movie.stopImages()", opts, ["which", "pick", "scale", "type", "quality", "as", "motionBlur", "pdf", "onImage"]);
1916
1934
  this._requireReady("stopImages");
1917
1935
  if (this.stops.length === 0) return [];
1918
- let picks;
1919
- if (opts.which === "stops") picks = this.stops;
1920
- else {
1921
- const byPage = /* @__PURE__ */ new Map();
1922
- for (const s of this.stops) byPage.set(s.pageIndex, [...byPage.get(s.pageIndex) ?? [], s]);
1923
- picks = [...byPage.values()].map((list) => opts.pick === "first" ? list[0] : list[list.length - 1]);
1924
- }
1936
+ const picks = pictureStops(this.stops, { which: opts.which, pick: opts.pick, pdf: opts.pdf });
1925
1937
  this.pause();
1926
1938
  const back = this.currentFrame, wasAtPoster = this._atPoster;
1927
1939
  const out = [];
@@ -1945,7 +1957,8 @@ var Movie = class {
1945
1957
  return out;
1946
1958
  }
1947
1959
  /**
1948
- * The deck as a PDF: one page per page of the talk (the page's last stop, fully built; `which: 'stops'` makes a page of every stop), each a
1960
+ * The deck as a PDF: one page per page of the talk (the page's last stop, fully built, unless a stop says `pdf: true` or `pdf: false`;
1961
+ * `which: 'stops'` makes a page of every stop that is not `pdf: false`), each a
1949
1962
  * JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
1950
1963
  */
1951
1964
  async exportPDF(opts = {}) {
@@ -1961,6 +1974,7 @@ var Movie = class {
1961
1974
  quality: opts.quality ?? 0.92,
1962
1975
  as: "blob",
1963
1976
  motionBlur: opts.motionBlur,
1977
+ pdf: true,
1964
1978
  onImage: opts.onImage
1965
1979
  });
1966
1980
  const pages = await Promise.all(images.map(async (i) => ({
@@ -3195,7 +3209,11 @@ function deck(options) {
3195
3209
  const id = `page-${i + 1}`;
3196
3210
  const label = page.name ? `"${page.name}"` : `pages[${i}]`;
3197
3211
  const isLast = i === pages.length - 1;
3198
- const local = page.stops ?? [isLast ? page.duration : page.duration - overlap];
3212
+ const entries = (page.stops ?? [isLast ? page.duration : page.duration - overlap]).map((e, k) => {
3213
+ if (e && typeof e === "object") warnUnknownOptions(`deck() page ${label} stops[${k}]`, e, ["at", "pdf"]);
3214
+ return typeof e === "object" && e !== null ? e : { at: e };
3215
+ });
3216
+ const local = entries.map((e) => e.at);
3199
3217
  local.forEach((s, k) => {
3200
3218
  if (!(typeof s === "number" && Number.isFinite(s) && s > 0 && s <= page.duration + 1e-9)) throw new Error(`deck(): page ${label} has stop ${String(s)}, outside the page (0 to ${page.duration} s)`);
3201
3219
  if (k > 0 && s <= local[k - 1]) throw new Error(`deck(): page ${label} stops must be in order, earliest first (got ${local.join(", ")})`);
@@ -3209,6 +3227,7 @@ function deck(options) {
3209
3227
  if (page.notes !== void 0) stop.notes = page.notes;
3210
3228
  }
3211
3229
  if (k === local.length - 1 && page.advance !== void 0) stop.advance = page.advance;
3230
+ if (entries[k].pdf !== void 0) stop.pdf = entries[k].pdf;
3212
3231
  stops.push(stop);
3213
3232
  });
3214
3233
  if (transition && !isLast) {
@@ -3243,6 +3262,6 @@ function withFade(spec, opts) {
3243
3262
  return spec;
3244
3263
  }
3245
3264
 
3246
- export { Movie, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, dismissLoader, failLoader, followPath, kenBurns, measureText, normalizeStops, orbit, particles, react, resolveLoader, splitText, stagger, wiggle, withFade };
3265
+ export { Movie, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, dismissLoader, failLoader, followPath, kenBurns, measureText, normalizeStops, orbit, particles, pictureStops, react, resolveLoader, splitText, stagger, wiggle, withFade };
3247
3266
  //# sourceMappingURL=index.js.map
3248
3267
  //# sourceMappingURL=index.js.map