pixi-effects 0.15.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 +8 -0
  2. package/README.md +7 -6
  3. package/ai/CHAT.md +32 -1
  4. package/ai/SKILL.md +1 -1
  5. package/ai/chat-template.html +3 -3
  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 +82 -2
  50. package/llms.txt +2 -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
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-qmgOU4in.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';
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-CJMfAizW.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-C8XEUoqe.cjs';
3
+ export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, 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 LineShapeSpec, r as MusicDrum, s as MusicDrums, t as MusicInstrument, u as MusicLevel, v as MusicTrack, N as NullSequenceSpec, w as PathShapeSpec, x as PolygonShapeSpec, y as PropValue, R as RectShapeSpec, z as SfxKnobs, B as SfxOptions, H as SfxPreset, J as SfxVoice, O as ShapeSequenceSpec, Q as SlideTransition, U as Stop, V as StopSpec, W as TransitionCommon, X as VideoSequenceSpec, Y as WipeTransition, Z as ZoomTransition, _ as normalizeStops, $ as pictureStops } from './types-C8XEUoqe.cjs';
4
+ import { S as Sequence } from './Base-DPEqyeB0.cjs';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
@@ -523,6 +523,19 @@ interface ReactOptions {
523
523
  */
524
524
  declare function react(env: AudioEnvelope, options: ReactOptions): Keyframe[];
525
525
 
526
+ /**
527
+ * What the `music` of an audio layer does over time, as numbers for `react()`: `level`, `bass`, `mid`, `treble` (or your own `bands`), one
528
+ * value per video frame, from analysing the very sound the layer will play. The beats are exact (the kick hits, or every beat when there
529
+ * is no kick) and `bpm` is the starting tempo. Do it before `movie.init`, with the same `music` object the layer uses:
530
+ *
531
+ * ```js
532
+ * const music = { bpm: 96, tracks: [...], drums: {...} };
533
+ * const env = await musicEnvelope(music, { frameRate: 30 });
534
+ * // sequences: [{ type: 'audio', music }, { type: 'shape', ..., keyframes: react(env, { duration, props: { scale: { base: 1, amount: 0.3, band: 'bass' } } }) }]
535
+ * ```
536
+ */
537
+ declare function musicEnvelope(music: MusicOptions, options?: EnvelopeOptions): Promise<AudioEnvelope>;
538
+
526
539
  interface DeckPage {
527
540
  /** The page's name: shown by the Presenter, and in the stops list. */
528
541
  name?: string;
@@ -654,4 +667,4 @@ interface WithFadeOptions {
654
667
  */
655
668
  declare function withFade<T extends SequenceCommon>(spec: T, opts: WithFadeOptions): T;
656
669
 
657
- export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, type OrbitOptions, type ParticlesOptions, Props, type ReactOptions, type ReactProp, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, TransitionSpec, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, followPath, kenBurns, measureText, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
670
+ export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, MusicOptions, type OrbitOptions, type ParticlesOptions, Props, type ReactOptions, type ReactProp, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, TransitionSpec, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, followPath, kenBurns, measureText, musicEnvelope, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
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-BwT6XtGz.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';
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-BIGDIla0.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-C8XEUoqe.js';
3
+ export { A as ArcShapeSpec, e as AssetSpec, f as AudioAssetSpec, g as AudioMusicSpec, h as AudioSequenceSpec, i as AudioSfxSpec, 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 LineShapeSpec, r as MusicDrum, s as MusicDrums, t as MusicInstrument, u as MusicLevel, v as MusicTrack, N as NullSequenceSpec, w as PathShapeSpec, x as PolygonShapeSpec, y as PropValue, R as RectShapeSpec, z as SfxKnobs, B as SfxOptions, H as SfxPreset, J as SfxVoice, O as ShapeSequenceSpec, Q as SlideTransition, U as Stop, V as StopSpec, W as TransitionCommon, X as VideoSequenceSpec, Y as WipeTransition, Z as ZoomTransition, _ as normalizeStops, $ as pictureStops } from './types-C8XEUoqe.js';
4
+ import { S as Sequence } from './Base-qvqNxvyt.js';
5
5
  import 'pixi.js';
6
6
  import 'gsap';
7
7
 
@@ -523,6 +523,19 @@ interface ReactOptions {
523
523
  */
524
524
  declare function react(env: AudioEnvelope, options: ReactOptions): Keyframe[];
525
525
 
526
+ /**
527
+ * What the `music` of an audio layer does over time, as numbers for `react()`: `level`, `bass`, `mid`, `treble` (or your own `bands`), one
528
+ * value per video frame, from analysing the very sound the layer will play. The beats are exact (the kick hits, or every beat when there
529
+ * is no kick) and `bpm` is the starting tempo. Do it before `movie.init`, with the same `music` object the layer uses:
530
+ *
531
+ * ```js
532
+ * const music = { bpm: 96, tracks: [...], drums: {...} };
533
+ * const env = await musicEnvelope(music, { frameRate: 30 });
534
+ * // sequences: [{ type: 'audio', music }, { type: 'shape', ..., keyframes: react(env, { duration, props: { scale: { base: 1, amount: 0.3, band: 'bass' } } }) }]
535
+ * ```
536
+ */
537
+ declare function musicEnvelope(music: MusicOptions, options?: EnvelopeOptions): Promise<AudioEnvelope>;
538
+
526
539
  interface DeckPage {
527
540
  /** The page's name: shown by the Presenter, and in the stops list. */
528
541
  name?: string;
@@ -654,4 +667,4 @@ interface WithFadeOptions {
654
667
  */
655
668
  declare function withFade<T extends SequenceCommon>(spec: T, opts: WithFadeOptions): T;
656
669
 
657
- export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, type OrbitOptions, type ParticlesOptions, Props, type ReactOptions, type ReactProp, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, TransitionSpec, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, followPath, kenBurns, measureText, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
670
+ export { type AnimateTextOptions, type AnimateTextTween, type AudioEnvelope, type AudioEnvelopeSource, CameraSequenceSpec, CompositionSpec, type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type EnvelopeOptions, type FollowPathOptions, ImageSequenceSpec, type KenBurnsOptions, Keyframe, type MeasureStyle, MusicOptions, type OrbitOptions, type ParticlesOptions, Props, type ReactOptions, type ReactProp, SequenceCommon, type SequenceCtor, SequenceSpec, type SplitOptions, type StaggerOptions, type TextPiece, type TextPreset, TextSequenceSpec, type TextSize, TransitionSpec, type WiggleOptions, type WiggleProp, type WithFadeOptions, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, followPath, kenBurns, measureText, musicEnvelope, noise, orbit, particles, rand, random, react, registerSequenceType, splitText, stagger, wiggle, withFade };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { CompositionSequence } from './chunk-3IPDNC3E.js';
2
- import { ensureFilterLibrary, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, rand, DEG, resolveAt, collectPropKeys } from './chunk-C6QHKYC5.js';
3
- export { noise, rand, random, registerSequenceType } from './chunk-C6QHKYC5.js';
1
+ import { CompositionSequence } from './chunk-I2YXLHIU.js';
2
+ import { ensureFilterLibrary, homeDistance, DEFAULT_FOV, random, noise, flattenSvgPath, rand, DEG, resolveAt, collectPropKeys } from './chunk-7D7RAQWM.js';
3
+ export { noise, rand, random, registerSequenceType } from './chunk-7D7RAQWM.js';
4
4
  import { warnUnknownOptions, suggestName } from './chunk-DKGG7WD4.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';
@@ -1270,6 +1270,7 @@ function detailOf(seq) {
1270
1270
  if (typeof s.asset === "string") return `asset \u201C${s.asset}\u201D`;
1271
1271
  if (typeof s.sfx === "string") return `sfx \u201C${s.sfx}\u201D`;
1272
1272
  if (s.sfx && typeof s.sfx === "object") return "sfx (custom)";
1273
+ if (s.music && typeof s.music === "object") return "music";
1273
1274
  return void 0;
1274
1275
  }
1275
1276
  function walk(comp, parentStart, parentEnd, depth, prefix, rows, transitions) {
@@ -3235,6 +3236,19 @@ async function audioEnvelope(source, options = {}) {
3235
3236
  return computeEnvelope(audio, options);
3236
3237
  }
3237
3238
 
3239
+ // src/audio/musicEnvelope.ts
3240
+ async function musicEnvelope(music, options = {}) {
3241
+ const { resolveMusic, renderMusic, musicLength, musicBeatTimes, TempoMap } = await import('./music-4HDFULNR.js');
3242
+ const messages = [];
3243
+ const m = resolveMusic(music, "musicEnvelope()", (msg) => messages.push(msg));
3244
+ if (!m) throw new Error(`pixi-effects: musicEnvelope(): ${messages.join(" ") || "the music has nothing to play"}`);
3245
+ for (const msg of messages) console.warn(msg);
3246
+ const sampleRate = 22050;
3247
+ const [left, right] = renderMusic(m, sampleRate, musicLength(m), false);
3248
+ const env = computeEnvelope({ sampleRate, numberOfChannels: 2, length: left.length, getChannelData: (c) => c === 0 ? left : right }, options);
3249
+ return { ...env, beats: musicBeatTimes(m, env.duration), bpm: Math.round(new TempoMap(m.tempo).bpmAt(0) * 100) / 100 };
3250
+ }
3251
+
3238
3252
  // src/presets/deck.ts
3239
3253
  var PAGE_KEYS = ["name", "duration", "sequences", "stops", "notes", "advance", "initial", "keyframes", "filters", "filterArea", "blendMode", "mask", "maskInverted"];
3240
3254
  var DECK_KEYS = ["pages", "transition", "width", "height", "frameRate", "background", "canvas", "assets", "poster", "motionBlur", "loader"];
@@ -3316,6 +3330,6 @@ function withFade(spec, opts) {
3316
3330
  return spec;
3317
3331
  }
3318
3332
 
3319
- export { Movie, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, dismissLoader, failLoader, followPath, kenBurns, measureText, normalizeStops, orbit, particles, pictureStops, react, resolveLoader, splitText, stagger, wiggle, withFade };
3333
+ export { Movie, animateText, audioEnvelope, bpmEnvelope, computeEnvelope, deck, dismissLoader, failLoader, followPath, kenBurns, measureText, musicEnvelope, normalizeStops, orbit, particles, pictureStops, react, resolveLoader, splitText, stagger, wiggle, withFade };
3320
3334
  //# sourceMappingURL=index.js.map
3321
3335
  //# sourceMappingURL=index.js.map