@silentstatestudio/perseon 0.1.0 → 0.1.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +31 -4
  2. package/LICENSE.md +61 -18
  3. package/README.md +9 -8
  4. package/dist/authoring/index.cjs +7 -2
  5. package/dist/authoring/index.d.cts +102 -4
  6. package/dist/authoring/index.d.ts +102 -4
  7. package/dist/authoring/index.js +6 -1
  8. package/dist/authoring/index.js.map +1 -1
  9. package/dist/{chunk-PT7F7TTB.cjs → chunk-443SQYAB.cjs} +216 -179
  10. package/dist/{chunk-ON4JV4BI.js → chunk-AVYXWDFD.js} +39 -2
  11. package/dist/chunk-AVYXWDFD.js.map +1 -0
  12. package/dist/{chunk-GDXCMDJ6.js → chunk-BEDH7OYG.js} +25 -3
  13. package/dist/chunk-BEDH7OYG.js.map +1 -0
  14. package/dist/{chunk-Q2HLLGJ7.cjs → chunk-WEQPSGPS.cjs} +23 -2
  15. package/dist/chunk-ZIMCQTYK.cjs +5 -0
  16. package/dist/chunk-ZTG42LPX.js +6 -0
  17. package/dist/{colors-CUEeQ78V.d.cts → colors-CCeWL9q4.d.cts} +362 -12
  18. package/dist/{colors-pshUJaKB.d.ts → colors-CGWrMf4V.d.ts} +362 -12
  19. package/dist/core/index.cjs +8 -3
  20. package/dist/core/index.d.cts +4 -3
  21. package/dist/core/index.d.ts +4 -3
  22. package/dist/core/index.js +8 -3
  23. package/dist/index.cjs +8 -3
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +8 -3
  27. package/dist/pixi-v7/index.cjs +79 -5
  28. package/dist/pixi-v7/index.d.cts +106 -7
  29. package/dist/pixi-v7/index.d.ts +106 -7
  30. package/dist/pixi-v7/index.js +77 -3
  31. package/dist/pixi-v7/index.js.map +1 -1
  32. package/dist/pixi-v8/index.cjs +78 -7
  33. package/dist/pixi-v8/index.d.cts +81 -9
  34. package/dist/pixi-v8/index.d.ts +81 -9
  35. package/dist/pixi-v8/index.js +76 -5
  36. package/dist/pixi-v8/index.js.map +1 -1
  37. package/dist/{rendering-DeUo1BsK.d.cts → rendering-dYQXmGTV.d.cts} +29 -2
  38. package/dist/{rendering-DeUo1BsK.d.ts → rendering-dYQXmGTV.d.ts} +29 -2
  39. package/dist/testing/index.cjs +23 -0
  40. package/dist/testing/index.d.cts +19 -1
  41. package/dist/testing/index.d.ts +19 -1
  42. package/dist/testing/index.js +24 -0
  43. package/dist/testing/index.js.map +1 -1
  44. package/package.json +145 -148
  45. package/dist/chunk-GDXCMDJ6.js.map +0 -1
  46. package/dist/chunk-ON4JV4BI.js.map +0 -1
  47. package/dist/chunk-SVI6WUOB.js +0 -1
  48. /package/dist/{chunk-SVI6WUOB.js.map → chunk-ZTG42LPX.js.map} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { ParticleContainer, Filter, Particle, Container, Ticker, ApplicationOptions, Application, Texture, Spritesheet, SpritesheetData } from 'pixi.js';
2
- import { I as IParticleGroup, b as IParticleVisualState, a as IParticleGroupOptions, c as IRenderRootNode, d as IRenderNode, f as IRenderer, e as ITicker, h as IRendererCapabilities, g as ITextureRef, P as ParticleBlendMode, B as BlendModeSupport } from '../rendering-DeUo1BsK.cjs';
3
- export { i as IShape } from '../rendering-DeUo1BsK.cjs';
4
- import { P as PerseonIntegration } from '../colors-CUEeQ78V.cjs';
5
- export { A as AnimationDescription, a as AnimationPlayOptions, b as AnimationRandomnessOptions, C as CapacityOptions, c as CapsuleArea, d as CircleArea, e as ColorGradientDefinition, f as ColorOptions, g as ColorRandomRange, h as ColorStop, i as CurveDefinition, j as CustomParameterOption, k as CustomParameterSampleScope, l as CustomParameterType, m as CustomParameterValue, D as DiagnosticsPolicy, E as EmissionOptions, n as EmissionTransform, o as Emitter, p as EmitterEventBinding, q as EmitterEventBindings, r as EmitterEventTrigger, s as EmitterEventsByTrigger, t as EmitterOptionPath, u as EmitterOptionType, v as EmitterOptions, w as EventTrigger, x as ExternalForcesFactorOptions, y as ExternalForcesForEmitterUse, z as ExternalForcesOptions, B as ExternalForcesTypes, G as GlobalParameterOption, I as InitialStateOptions, K as KineticsOptions, L as LayerOptionPath, F as LayerOptionType, H as LocalDefaultHandle, J as LocalParameterHandle, M as ModifierBlendMode, N as ModulatableNumber, O as ModulatedValue, Q as ModulatorOptions, R as ModulatorShape, S as NumberOptions, T as NumericDomain, U as OptionNodeKind, V as OptionStage, W as OptionStrategy, X as ParameterDescription, Y as ParameterHandle, Z as ParameterInitOptions, _ as ParameterLinkRelation, $ as ParameterModifier, a0 as ParameterModifierSource, a1 as ParameterUpdateOptions, a2 as ParticleAnimationOptions, a3 as ParticleEventBinding, a4 as ParticleEventBindings, a5 as ParticleEventTrigger, a6 as ParticleEventsByTrigger, a7 as ParticleHookEmitter, a8 as ParticleHookPlayback, a9 as ParticleHookRandom, aa as ParticleItem, ab as ParticleLayer, ac as ParticleLayerOptions, ad as ParticleLimitStrategy, ae as ParticleRegionRef, af as ParticleSnapshot, ag as ParticleSnapshotObject, ah as ParticleSpawnStrategy, ai as ParticleSpriteAnimationParameters, aj as PerformanceOptions, ak as PerseonAnimation, al as PerseonEvent, am as PerseonPlayback, an as PlaybackFinishedReason, ao as PlaybackFinishedResult, ap as PlaybackHost, aq as PlaybackOptionPath, ar as PlaybackOptionType, as as PlaybackOptions, at as PointForceConfig, au as PointForceFalloff, av as PointForceMode, aw as PointValue, ax as PolygonArea, ay as ProbabilityCurveKind, az as ProbabilityCurvePreset, aA as ProbabilityCurvePresetId, aB as RandomListState, aC as RandomValueList, aD as RandomValueListMode, aE as RandomValueRange, aF as RandomnessOptions, aG as RandomnessSeedMode, aH as RectangleArea, aI as RegionBehavior, aJ as RegionOptions, aK as RingArea, aL as ScaleOptions, aM as ShapeArea, aN as SingleTextureOption, aO as SpawnColor, aP as SpawnNumber, aQ as SpawnPoint, aR as SpawnPosition, aS as SpawnVector, aT as SpriteAnimationOptions, aU as SpriteAnimationTexturesOptions, aV as TextDomain, aW as TextureElement, aX as Unsubscribe, aY as ValueProbability, aZ as VectorValue } from '../colors-CUEeQ78V.cjs';
2
+ import { I as IParticleGroup, b as IParticleVisualState, a as IParticleGroupOptions, c as IRenderRootNode, d as IRenderNode, f as IRenderer, e as ITicker, h as IRendererCapabilities, g as ITextureRef, P as ParticleBlendMode, B as BlendModeSupport } from '../rendering-dYQXmGTV.cjs';
3
+ export { i as IShape } from '../rendering-dYQXmGTV.cjs';
4
+ import { P as PerseonIntegration } from '../colors-CCeWL9q4.cjs';
5
+ export { A as AnimationDescription, a as AnimationPlayOptions, b as AnimationRandomnessOptions, C as CapacityOptions, c as CapsuleArea, d as CircleArea, e as ColorGradientDefinition, f as ColorOptions, g as ColorRandomRange, h as ColorStop, i as CurveDefinition, j as CustomParameterOption, k as CustomParameterSampleScope, l as CustomParameterType, m as CustomParameterValue, D as DiagnosticsPolicy, E as EmissionOptions, n as EmissionTransform, o as Emitter, p as EmitterEventBinding, q as EmitterEventBindings, r as EmitterEventTrigger, s as EmitterEventsByTrigger, t as EmitterOptionPath, u as EmitterOptionType, v as EmitterOptions, w as EventTrigger, x as ExternalForcesFactorOptions, y as ExternalForcesOptions, z as ExternalForcesTypes, G as GlobalParameterOption, I as InitialStateOptions, K as KineticsOptions, L as LayerOptionPath, B as LayerOptionType, F as LocalDefaultHandle, H as LocalParameterHandle, M as ModifierBlendMode, J as ModulatableNumber, N as ModulatedValue, O as ModulatorOptions, Q as ModulatorShape, R as NumberOptions, S as NumericDomain, T as OptionNodeKind, U as OptionStage, V as OptionStrategy, W as ParameterDescription, X as ParameterHandle, Y as ParameterInitOptions, Z as ParameterLinkRelation, _ as ParameterModifier, $ as ParameterModifierSource, a0 as ParameterUpdateOptions, a1 as ParticleAnimationOptions, a2 as ParticleEventBinding, a3 as ParticleEventBindings, a4 as ParticleEventTrigger, a5 as ParticleEventsByTrigger, a6 as ParticleHookEmitter, a7 as ParticleHookPlayback, a8 as ParticleHookRandom, a9 as ParticleItem, aa as ParticleLayer, ab as ParticleLayerOptions, ac as ParticleLimitStrategy, ad as ParticleRegionRef, ae as ParticleSnapshot, af as ParticleSnapshotObject, ag as ParticleSpawnStrategy, ah as ParticleSpriteAnimationParameters, ai as PerformanceOptions, aj as PerseonAnimation, ak as PerseonEvent, al as PerseonPlayback, am as PlaybackFinishedReason, an as PlaybackFinishedResult, ao as PlaybackHost, ap as PlaybackOptionPath, aq as PlaybackOptionType, ar as PlaybackOptions, as as PointForceConfig, at as PointForceFalloff, au as PointForceMode, av as PointValue, aw as PolygonArea, ax as ProbabilityCurveKind, ay as ProbabilityCurvePreset, az as ProbabilityCurvePresetId, aA as RandomListState, aB as RandomValueList, aC as RandomValueListMode, aD as RandomValueRange, aE as RandomnessOptions, aF as RandomnessSeedMode, aG as RectangleArea, aH as RegionBehavior, aI as RegionOptions, aJ as RingArea, aK as ScaleOptions, aL as ShapeArea, aM as SingleTextureOption, aN as SpawnColor, aO as SpawnNumber, aP as SpawnPoint, aQ as SpawnPosition, aR as SpawnVector, aS as SpriteAnimationOptions, aT as SpriteAnimationTexturesOptions, aU as TextDomain, aV as TextureElement, aW as Unsubscribe, aX as ValueProbability, aY as VectorValue } from '../colors-CCeWL9q4.cjs';
6
6
  export { PerseonConfigError, parseAnimationOptions } from '../core/index.cjs';
7
7
 
8
8
  /**
@@ -16,6 +16,9 @@ export { PerseonConfigError, parseAnimationOptions } from '../core/index.cjs';
16
16
  * is dominated by GPU rasterization at any realistic particle count.
17
17
  */
18
18
  declare class PixiV8ParticleGroup implements IParticleGroup {
19
+ /**
20
+ * The Pixi `ParticleContainer` that draws this layer's particles. The render node that created the group adds it to its own container; `destroy` destroys it.
21
+ */
19
22
  readonly container: ParticleContainer;
20
23
  /**
21
24
  * Engine particles mirrored by this group, in the same order as the
@@ -31,6 +34,11 @@ declare class PixiV8ParticleGroup implements IParticleGroup {
31
34
  */
32
35
  get visible(): boolean;
33
36
  set visible(value: boolean);
37
+ /**
38
+ * Creates the `ParticleContainer` with `options.dynamicProperties` (position stays dynamic, Pixi's default) and applies `options.blendMode` (`normal` when omitted). Fixed-function modes are set as the container's blend mode; every other mode puts a blend filter on the container itself.
39
+ *
40
+ * @param options - The layer's dynamic properties and blend mode.
41
+ */
34
42
  constructor(options: IParticleGroupOptions);
35
43
  get size(): number;
36
44
  addParticle(particle: IParticleVisualState, index: number): void;
@@ -50,6 +58,9 @@ declare class PixiV8ParticleGroup implements IParticleGroup {
50
58
  * skips a filter stack whose filters are all disabled.
51
59
  */
52
60
  protected _syncBlendPass(): void;
61
+ /**
62
+ * Copies the engine particle's position, scale, rotation, alpha, tint, anchor and texture onto its Pixi `Particle`.
63
+ */
53
64
  protected _writeState(p: IParticleVisualState, pixi: Particle): void;
54
65
  }
55
66
 
@@ -62,18 +73,34 @@ declare class PixiV8ParticleGroup implements IParticleGroup {
62
73
  * a renderer tearing down after the engine already did must be a no-op.
63
74
  */
64
75
  declare class PixiV8RenderNode implements IRenderRootNode<Container> {
76
+ /**
77
+ * The Pixi `Container` this node wraps. It is created with the node and destroyed when the node is destroyed.
78
+ */
65
79
  readonly container: Container;
80
+ /** The particle groups created through this node and not yet removed with `destroyParticleGroup`. They are destroyed with it. */
66
81
  protected _groups: PixiV8ParticleGroup[];
67
82
  /** Child nodes (an emitter's, when this is a playback root). */
68
83
  protected _children: PixiV8RenderNode[];
84
+ /**
85
+ * Callback run once, from `destroy`, so whoever created this node (the renderer for a root, the parent node for a child) stops tracking it.
86
+ */
69
87
  protected _release: (node: PixiV8RenderNode) => void;
88
+ /** Set by the first `destroy`, so that later calls do nothing. */
70
89
  protected _destroyed: boolean;
90
+ /**
91
+ * Creates the node with an empty Pixi container.
92
+ *
93
+ * @param release - Called with this node when it is destroyed, so its creator can drop it.
94
+ */
71
95
  constructor(release: (node: PixiV8RenderNode) => void);
72
96
  get hostDestroyed(): boolean;
97
+ /** Whether the node's container is shown. Hidden, Pixi draws neither it nor anything under it. */
73
98
  get visible(): boolean;
74
99
  set visible(value: boolean);
100
+ /** Horizontal position of the node's container, in its parent's local coordinates. */
75
101
  get x(): number;
76
102
  set x(value: number);
103
+ /** Vertical position of the node's container, in its parent's local coordinates. */
77
104
  get y(): number;
78
105
  set y(value: number);
79
106
  /**
@@ -87,6 +114,9 @@ declare class PixiV8RenderNode implements IRenderRootNode<Container> {
87
114
  mount(parent: Container): void;
88
115
  unmount(): void;
89
116
  createChildNode(): IRenderNode;
117
+ /**
118
+ * Drops a destroyed child node from this node's list. It is the release callback `createChildNode` hands to each child.
119
+ */
90
120
  protected _releaseChild(node: PixiV8RenderNode): void;
91
121
  createParticleGroup(options: IParticleGroupOptions): IParticleGroup;
92
122
  setGroupIndex(group: IParticleGroup, index: number): void;
@@ -94,6 +124,7 @@ declare class PixiV8RenderNode implements IRenderRootNode<Container> {
94
124
  destroy(): void;
95
125
  }
96
126
 
127
+ /** Options for `PixiV8Renderer`. */
97
128
  interface PixiV8RendererOptions {
98
129
  /**
99
130
  * Optional Pixi v8 `Ticker` to drive engine updates. When omitted,
@@ -111,9 +142,19 @@ declare class PixiV8Renderer implements IRenderer<Container> {
111
142
  readonly ticker: ITicker;
112
143
  /** What this backend does with each blend mode — see `IRendererCapabilities`. */
113
144
  readonly capabilities: IRendererCapabilities;
145
+ /**
146
+ * Textures already resolved, keyed by the `source` value given to `resolveTexture`. Emptied by `clearTextureCache` and `destroy`.
147
+ */
114
148
  protected _textureCache: Map<unknown, ITextureRef>;
149
+ /**
150
+ * The root nodes this renderer created and that are still alive, so `destroy` can tear them down. A node leaves the list when it is destroyed.
151
+ */
115
152
  protected _nodes: PixiV8RenderNode[];
116
- /** @param options - Optional settings; see `PixiV8RendererOptions`. */
153
+ /**
154
+ * Creates the renderer, wrapping `options.ticker` (or Pixi's shared ticker) in an adapter.
155
+ *
156
+ * @param options - Optional settings; see `PixiV8RendererOptions`.
157
+ */
117
158
  constructor(options?: PixiV8RendererOptions);
118
159
  /** Detached: the caller mounts it where the animation should appear. */
119
160
  createRootNode(): IRenderRootNode<Container>;
@@ -123,7 +164,8 @@ declare class PixiV8Renderer implements IRenderer<Container> {
123
164
  * The texture a scene's `texture.source` names. The id must have been published to
124
165
  * Pixi's `Assets.cache` beforehand (see `PixiV8ParticleAtlas`); an unknown id, or a
125
166
  * source that is not a string, resolves to an empty texture. Answers are memoized
126
- * until `clearTextureCache`.
167
+ * until `clearTextureCache`, so an id resolved before it was published stays empty
168
+ * until then.
127
169
  */
128
170
  resolveTexture(source: unknown): ITextureRef;
129
171
  /** See `IRenderer.clearTextureCache` — what a host calls after republishing an atlas. */
@@ -132,6 +174,7 @@ declare class PixiV8Renderer implements IRenderer<Container> {
132
174
  destroy(): void;
133
175
  }
134
176
 
177
+ /** Options for the `Perseon` constructor. Both are optional, so `new Perseon()` works with Pixi's shared ticker. */
135
178
  interface PerseonOptions {
136
179
  /**
137
180
  * What every animation runs off: the Pixi v8 `Ticker` — `app.ticker`,
@@ -183,11 +226,18 @@ declare class Perseon extends PerseonIntegration<Container> {
183
226
  * actually is — its atlas-facing methods included.
184
227
  */
185
228
  readonly renderer: PixiV8Renderer;
229
+ /**
230
+ * Creates the integration for PixiJS v8. A Pixi `Ticker` is wrapped by the renderer this builds; any other
231
+ * `ITicker` is used as the frame source as it is.
232
+ *
233
+ * @param options - Optional settings; see `PerseonOptions`.
234
+ */
186
235
  constructor(options?: PerseonOptions);
187
236
  }
188
237
 
189
238
  /** The rendering backend Pixi resolved to. */
190
239
  type RendererBackend = 'webgpu' | 'webgl';
240
+ /** Options for `createPixiApplication`: any Pixi `ApplicationOptions`, all optional, plus `preferWebGPU`. */
191
241
  interface CreatePixiApplicationOptions extends Partial<ApplicationOptions> {
192
242
  /**
193
243
  * Prefer the WebGPU rendering backend. Defaults to `true`.
@@ -204,7 +254,9 @@ interface CreatePixiApplicationOptions extends Partial<ApplicationOptions> {
204
254
  */
205
255
  preferWebGPU?: boolean;
206
256
  }
257
+ /** What `createPixiApplication` resolves to. */
207
258
  interface CreatedPixiApplication {
259
+ /** The initialized Pixi `Application`. The caller owns it and is the one to destroy it. */
208
260
  app: Application;
209
261
  /**
210
262
  * The backend Pixi actually resolved to after `init`. May differ from the
@@ -232,8 +284,18 @@ declare function resolveRendererBackend(app: Application): RendererBackend;
232
284
  * wrapper that `add(fn)` previously registered with the Pixi ticker.
233
285
  */
234
286
  declare class PixiV8TickerAdapter implements ITicker {
287
+ /** The Pixi ticker being wrapped. */
235
288
  protected _ticker: Ticker;
289
+ /**
290
+ * Pairs each function given to `add` with the wrapper registered on the Pixi ticker, so `remove` can unregister that same wrapper.
291
+ */
236
292
  protected _wrapped: Map<(deltaMS: number) => void, (ticker: Ticker) => void>;
293
+ /**
294
+ * Wraps a Pixi ticker. The constructor neither starts nor stops it, but Pixi starts a ticker whose
295
+ * `autoStart` is set (such as `Ticker.shared`) when `add` registers the first function.
296
+ *
297
+ * @param ticker - The Pixi `Ticker` whose frames drive the functions added to this adapter.
298
+ */
237
299
  constructor(ticker: Ticker);
238
300
  add(fn: (deltaMS: number) => void): void;
239
301
  remove(fn: (deltaMS: number) => void): void;
@@ -247,6 +309,9 @@ declare class PixiV8TickerAdapter implements ITicker {
247
309
  * what a host is told so it can say it.
248
310
  */
249
311
  declare class PixiV8RendererCapabilities implements IRendererCapabilities {
312
+ /**
313
+ * Registers the advanced blend filters with Pixi the first time any instance is created; later instances reuse that registration.
314
+ */
250
315
  constructor();
251
316
  blendModeSupport(mode: ParticleBlendMode): BlendModeSupport;
252
317
  }
@@ -283,8 +348,9 @@ declare const PARTICLE_ATLAS_CACHE_KEY = "perseon:particle-atlas";
283
348
  * `texture.source` names a frame the host is expected to have registered
284
349
  * beforehand, which is what lets one atlas serve every particle in the scene
285
350
  * instead of embedding the same image once per use. This class is the other
286
- * half of that contract — give it the `.png` + `.json` pair the editor exports
287
- * and the ids in the scene file resolve.
351
+ * half of that contract — give it the `.png` + `.json` pair that Perseon
352
+ * Particle Studio exports, or any Pixi spritesheet, and the ids in the scene
353
+ * file resolve.
288
354
  *
289
355
  * Registering the spritesheet in `Assets.cache` is what publishes the frames:
290
356
  * Pixi's cache parser for spritesheets adds one entry per frame name, which is
@@ -310,7 +376,9 @@ declare const PARTICLE_ATLAS_CACHE_KEY = "perseon:particle-atlas";
310
376
  * object URL must be read into a data URL (or a `Texture`) first.
311
377
  */
312
378
  declare class PixiV8ParticleAtlas {
379
+ /** The key the spritesheet is published under in `Assets.cache`. */
313
380
  protected _cacheKey: string;
381
+ /** The sheet published by the last successful `load`; cleared by `destroy`. */
314
382
  protected _spritesheet?: Spritesheet;
315
383
  /** URL this instance acquired through `Assets`, so it releases exactly what it took. */
316
384
  protected _loadedImageUrl?: string;
@@ -320,7 +388,11 @@ declare class PixiV8ParticleAtlas {
320
388
  * publish its sheet over the winner's and leak the winner's.
321
389
  */
322
390
  protected _loadToken: number;
323
- /** @param cacheKey - The key the spritesheet is registered under in `Assets.cache`; give distinct keys to atlases that coexist. */
391
+ /**
392
+ * Creates an empty atlas; nothing is published until `load`.
393
+ *
394
+ * @param cacheKey - The key the spritesheet is registered under in `Assets.cache`; give distinct keys to atlases that coexist.
395
+ */
324
396
  constructor(cacheKey?: string);
325
397
  /** The spritesheet published by the last successful `load`, or `undefined` before one or after `destroy`. */
326
398
  get spritesheet(): Spritesheet | undefined;
@@ -1,8 +1,8 @@
1
1
  import { ParticleContainer, Filter, Particle, Container, Ticker, ApplicationOptions, Application, Texture, Spritesheet, SpritesheetData } from 'pixi.js';
2
- import { I as IParticleGroup, b as IParticleVisualState, a as IParticleGroupOptions, c as IRenderRootNode, d as IRenderNode, f as IRenderer, e as ITicker, h as IRendererCapabilities, g as ITextureRef, P as ParticleBlendMode, B as BlendModeSupport } from '../rendering-DeUo1BsK.js';
3
- export { i as IShape } from '../rendering-DeUo1BsK.js';
4
- import { P as PerseonIntegration } from '../colors-pshUJaKB.js';
5
- export { A as AnimationDescription, a as AnimationPlayOptions, b as AnimationRandomnessOptions, C as CapacityOptions, c as CapsuleArea, d as CircleArea, e as ColorGradientDefinition, f as ColorOptions, g as ColorRandomRange, h as ColorStop, i as CurveDefinition, j as CustomParameterOption, k as CustomParameterSampleScope, l as CustomParameterType, m as CustomParameterValue, D as DiagnosticsPolicy, E as EmissionOptions, n as EmissionTransform, o as Emitter, p as EmitterEventBinding, q as EmitterEventBindings, r as EmitterEventTrigger, s as EmitterEventsByTrigger, t as EmitterOptionPath, u as EmitterOptionType, v as EmitterOptions, w as EventTrigger, x as ExternalForcesFactorOptions, y as ExternalForcesForEmitterUse, z as ExternalForcesOptions, B as ExternalForcesTypes, G as GlobalParameterOption, I as InitialStateOptions, K as KineticsOptions, L as LayerOptionPath, F as LayerOptionType, H as LocalDefaultHandle, J as LocalParameterHandle, M as ModifierBlendMode, N as ModulatableNumber, O as ModulatedValue, Q as ModulatorOptions, R as ModulatorShape, S as NumberOptions, T as NumericDomain, U as OptionNodeKind, V as OptionStage, W as OptionStrategy, X as ParameterDescription, Y as ParameterHandle, Z as ParameterInitOptions, _ as ParameterLinkRelation, $ as ParameterModifier, a0 as ParameterModifierSource, a1 as ParameterUpdateOptions, a2 as ParticleAnimationOptions, a3 as ParticleEventBinding, a4 as ParticleEventBindings, a5 as ParticleEventTrigger, a6 as ParticleEventsByTrigger, a7 as ParticleHookEmitter, a8 as ParticleHookPlayback, a9 as ParticleHookRandom, aa as ParticleItem, ab as ParticleLayer, ac as ParticleLayerOptions, ad as ParticleLimitStrategy, ae as ParticleRegionRef, af as ParticleSnapshot, ag as ParticleSnapshotObject, ah as ParticleSpawnStrategy, ai as ParticleSpriteAnimationParameters, aj as PerformanceOptions, ak as PerseonAnimation, al as PerseonEvent, am as PerseonPlayback, an as PlaybackFinishedReason, ao as PlaybackFinishedResult, ap as PlaybackHost, aq as PlaybackOptionPath, ar as PlaybackOptionType, as as PlaybackOptions, at as PointForceConfig, au as PointForceFalloff, av as PointForceMode, aw as PointValue, ax as PolygonArea, ay as ProbabilityCurveKind, az as ProbabilityCurvePreset, aA as ProbabilityCurvePresetId, aB as RandomListState, aC as RandomValueList, aD as RandomValueListMode, aE as RandomValueRange, aF as RandomnessOptions, aG as RandomnessSeedMode, aH as RectangleArea, aI as RegionBehavior, aJ as RegionOptions, aK as RingArea, aL as ScaleOptions, aM as ShapeArea, aN as SingleTextureOption, aO as SpawnColor, aP as SpawnNumber, aQ as SpawnPoint, aR as SpawnPosition, aS as SpawnVector, aT as SpriteAnimationOptions, aU as SpriteAnimationTexturesOptions, aV as TextDomain, aW as TextureElement, aX as Unsubscribe, aY as ValueProbability, aZ as VectorValue } from '../colors-pshUJaKB.js';
2
+ import { I as IParticleGroup, b as IParticleVisualState, a as IParticleGroupOptions, c as IRenderRootNode, d as IRenderNode, f as IRenderer, e as ITicker, h as IRendererCapabilities, g as ITextureRef, P as ParticleBlendMode, B as BlendModeSupport } from '../rendering-dYQXmGTV.js';
3
+ export { i as IShape } from '../rendering-dYQXmGTV.js';
4
+ import { P as PerseonIntegration } from '../colors-CGWrMf4V.js';
5
+ export { A as AnimationDescription, a as AnimationPlayOptions, b as AnimationRandomnessOptions, C as CapacityOptions, c as CapsuleArea, d as CircleArea, e as ColorGradientDefinition, f as ColorOptions, g as ColorRandomRange, h as ColorStop, i as CurveDefinition, j as CustomParameterOption, k as CustomParameterSampleScope, l as CustomParameterType, m as CustomParameterValue, D as DiagnosticsPolicy, E as EmissionOptions, n as EmissionTransform, o as Emitter, p as EmitterEventBinding, q as EmitterEventBindings, r as EmitterEventTrigger, s as EmitterEventsByTrigger, t as EmitterOptionPath, u as EmitterOptionType, v as EmitterOptions, w as EventTrigger, x as ExternalForcesFactorOptions, y as ExternalForcesOptions, z as ExternalForcesTypes, G as GlobalParameterOption, I as InitialStateOptions, K as KineticsOptions, L as LayerOptionPath, B as LayerOptionType, F as LocalDefaultHandle, H as LocalParameterHandle, M as ModifierBlendMode, J as ModulatableNumber, N as ModulatedValue, O as ModulatorOptions, Q as ModulatorShape, R as NumberOptions, S as NumericDomain, T as OptionNodeKind, U as OptionStage, V as OptionStrategy, W as ParameterDescription, X as ParameterHandle, Y as ParameterInitOptions, Z as ParameterLinkRelation, _ as ParameterModifier, $ as ParameterModifierSource, a0 as ParameterUpdateOptions, a1 as ParticleAnimationOptions, a2 as ParticleEventBinding, a3 as ParticleEventBindings, a4 as ParticleEventTrigger, a5 as ParticleEventsByTrigger, a6 as ParticleHookEmitter, a7 as ParticleHookPlayback, a8 as ParticleHookRandom, a9 as ParticleItem, aa as ParticleLayer, ab as ParticleLayerOptions, ac as ParticleLimitStrategy, ad as ParticleRegionRef, ae as ParticleSnapshot, af as ParticleSnapshotObject, ag as ParticleSpawnStrategy, ah as ParticleSpriteAnimationParameters, ai as PerformanceOptions, aj as PerseonAnimation, ak as PerseonEvent, al as PerseonPlayback, am as PlaybackFinishedReason, an as PlaybackFinishedResult, ao as PlaybackHost, ap as PlaybackOptionPath, aq as PlaybackOptionType, ar as PlaybackOptions, as as PointForceConfig, at as PointForceFalloff, au as PointForceMode, av as PointValue, aw as PolygonArea, ax as ProbabilityCurveKind, ay as ProbabilityCurvePreset, az as ProbabilityCurvePresetId, aA as RandomListState, aB as RandomValueList, aC as RandomValueListMode, aD as RandomValueRange, aE as RandomnessOptions, aF as RandomnessSeedMode, aG as RectangleArea, aH as RegionBehavior, aI as RegionOptions, aJ as RingArea, aK as ScaleOptions, aL as ShapeArea, aM as SingleTextureOption, aN as SpawnColor, aO as SpawnNumber, aP as SpawnPoint, aQ as SpawnPosition, aR as SpawnVector, aS as SpriteAnimationOptions, aT as SpriteAnimationTexturesOptions, aU as TextDomain, aV as TextureElement, aW as Unsubscribe, aX as ValueProbability, aY as VectorValue } from '../colors-CGWrMf4V.js';
6
6
  export { PerseonConfigError, parseAnimationOptions } from '../core/index.js';
7
7
 
8
8
  /**
@@ -16,6 +16,9 @@ export { PerseonConfigError, parseAnimationOptions } from '../core/index.js';
16
16
  * is dominated by GPU rasterization at any realistic particle count.
17
17
  */
18
18
  declare class PixiV8ParticleGroup implements IParticleGroup {
19
+ /**
20
+ * The Pixi `ParticleContainer` that draws this layer's particles. The render node that created the group adds it to its own container; `destroy` destroys it.
21
+ */
19
22
  readonly container: ParticleContainer;
20
23
  /**
21
24
  * Engine particles mirrored by this group, in the same order as the
@@ -31,6 +34,11 @@ declare class PixiV8ParticleGroup implements IParticleGroup {
31
34
  */
32
35
  get visible(): boolean;
33
36
  set visible(value: boolean);
37
+ /**
38
+ * Creates the `ParticleContainer` with `options.dynamicProperties` (position stays dynamic, Pixi's default) and applies `options.blendMode` (`normal` when omitted). Fixed-function modes are set as the container's blend mode; every other mode puts a blend filter on the container itself.
39
+ *
40
+ * @param options - The layer's dynamic properties and blend mode.
41
+ */
34
42
  constructor(options: IParticleGroupOptions);
35
43
  get size(): number;
36
44
  addParticle(particle: IParticleVisualState, index: number): void;
@@ -50,6 +58,9 @@ declare class PixiV8ParticleGroup implements IParticleGroup {
50
58
  * skips a filter stack whose filters are all disabled.
51
59
  */
52
60
  protected _syncBlendPass(): void;
61
+ /**
62
+ * Copies the engine particle's position, scale, rotation, alpha, tint, anchor and texture onto its Pixi `Particle`.
63
+ */
53
64
  protected _writeState(p: IParticleVisualState, pixi: Particle): void;
54
65
  }
55
66
 
@@ -62,18 +73,34 @@ declare class PixiV8ParticleGroup implements IParticleGroup {
62
73
  * a renderer tearing down after the engine already did must be a no-op.
63
74
  */
64
75
  declare class PixiV8RenderNode implements IRenderRootNode<Container> {
76
+ /**
77
+ * The Pixi `Container` this node wraps. It is created with the node and destroyed when the node is destroyed.
78
+ */
65
79
  readonly container: Container;
80
+ /** The particle groups created through this node and not yet removed with `destroyParticleGroup`. They are destroyed with it. */
66
81
  protected _groups: PixiV8ParticleGroup[];
67
82
  /** Child nodes (an emitter's, when this is a playback root). */
68
83
  protected _children: PixiV8RenderNode[];
84
+ /**
85
+ * Callback run once, from `destroy`, so whoever created this node (the renderer for a root, the parent node for a child) stops tracking it.
86
+ */
69
87
  protected _release: (node: PixiV8RenderNode) => void;
88
+ /** Set by the first `destroy`, so that later calls do nothing. */
70
89
  protected _destroyed: boolean;
90
+ /**
91
+ * Creates the node with an empty Pixi container.
92
+ *
93
+ * @param release - Called with this node when it is destroyed, so its creator can drop it.
94
+ */
71
95
  constructor(release: (node: PixiV8RenderNode) => void);
72
96
  get hostDestroyed(): boolean;
97
+ /** Whether the node's container is shown. Hidden, Pixi draws neither it nor anything under it. */
73
98
  get visible(): boolean;
74
99
  set visible(value: boolean);
100
+ /** Horizontal position of the node's container, in its parent's local coordinates. */
75
101
  get x(): number;
76
102
  set x(value: number);
103
+ /** Vertical position of the node's container, in its parent's local coordinates. */
77
104
  get y(): number;
78
105
  set y(value: number);
79
106
  /**
@@ -87,6 +114,9 @@ declare class PixiV8RenderNode implements IRenderRootNode<Container> {
87
114
  mount(parent: Container): void;
88
115
  unmount(): void;
89
116
  createChildNode(): IRenderNode;
117
+ /**
118
+ * Drops a destroyed child node from this node's list. It is the release callback `createChildNode` hands to each child.
119
+ */
90
120
  protected _releaseChild(node: PixiV8RenderNode): void;
91
121
  createParticleGroup(options: IParticleGroupOptions): IParticleGroup;
92
122
  setGroupIndex(group: IParticleGroup, index: number): void;
@@ -94,6 +124,7 @@ declare class PixiV8RenderNode implements IRenderRootNode<Container> {
94
124
  destroy(): void;
95
125
  }
96
126
 
127
+ /** Options for `PixiV8Renderer`. */
97
128
  interface PixiV8RendererOptions {
98
129
  /**
99
130
  * Optional Pixi v8 `Ticker` to drive engine updates. When omitted,
@@ -111,9 +142,19 @@ declare class PixiV8Renderer implements IRenderer<Container> {
111
142
  readonly ticker: ITicker;
112
143
  /** What this backend does with each blend mode — see `IRendererCapabilities`. */
113
144
  readonly capabilities: IRendererCapabilities;
145
+ /**
146
+ * Textures already resolved, keyed by the `source` value given to `resolveTexture`. Emptied by `clearTextureCache` and `destroy`.
147
+ */
114
148
  protected _textureCache: Map<unknown, ITextureRef>;
149
+ /**
150
+ * The root nodes this renderer created and that are still alive, so `destroy` can tear them down. A node leaves the list when it is destroyed.
151
+ */
115
152
  protected _nodes: PixiV8RenderNode[];
116
- /** @param options - Optional settings; see `PixiV8RendererOptions`. */
153
+ /**
154
+ * Creates the renderer, wrapping `options.ticker` (or Pixi's shared ticker) in an adapter.
155
+ *
156
+ * @param options - Optional settings; see `PixiV8RendererOptions`.
157
+ */
117
158
  constructor(options?: PixiV8RendererOptions);
118
159
  /** Detached: the caller mounts it where the animation should appear. */
119
160
  createRootNode(): IRenderRootNode<Container>;
@@ -123,7 +164,8 @@ declare class PixiV8Renderer implements IRenderer<Container> {
123
164
  * The texture a scene's `texture.source` names. The id must have been published to
124
165
  * Pixi's `Assets.cache` beforehand (see `PixiV8ParticleAtlas`); an unknown id, or a
125
166
  * source that is not a string, resolves to an empty texture. Answers are memoized
126
- * until `clearTextureCache`.
167
+ * until `clearTextureCache`, so an id resolved before it was published stays empty
168
+ * until then.
127
169
  */
128
170
  resolveTexture(source: unknown): ITextureRef;
129
171
  /** See `IRenderer.clearTextureCache` — what a host calls after republishing an atlas. */
@@ -132,6 +174,7 @@ declare class PixiV8Renderer implements IRenderer<Container> {
132
174
  destroy(): void;
133
175
  }
134
176
 
177
+ /** Options for the `Perseon` constructor. Both are optional, so `new Perseon()` works with Pixi's shared ticker. */
135
178
  interface PerseonOptions {
136
179
  /**
137
180
  * What every animation runs off: the Pixi v8 `Ticker` — `app.ticker`,
@@ -183,11 +226,18 @@ declare class Perseon extends PerseonIntegration<Container> {
183
226
  * actually is — its atlas-facing methods included.
184
227
  */
185
228
  readonly renderer: PixiV8Renderer;
229
+ /**
230
+ * Creates the integration for PixiJS v8. A Pixi `Ticker` is wrapped by the renderer this builds; any other
231
+ * `ITicker` is used as the frame source as it is.
232
+ *
233
+ * @param options - Optional settings; see `PerseonOptions`.
234
+ */
186
235
  constructor(options?: PerseonOptions);
187
236
  }
188
237
 
189
238
  /** The rendering backend Pixi resolved to. */
190
239
  type RendererBackend = 'webgpu' | 'webgl';
240
+ /** Options for `createPixiApplication`: any Pixi `ApplicationOptions`, all optional, plus `preferWebGPU`. */
191
241
  interface CreatePixiApplicationOptions extends Partial<ApplicationOptions> {
192
242
  /**
193
243
  * Prefer the WebGPU rendering backend. Defaults to `true`.
@@ -204,7 +254,9 @@ interface CreatePixiApplicationOptions extends Partial<ApplicationOptions> {
204
254
  */
205
255
  preferWebGPU?: boolean;
206
256
  }
257
+ /** What `createPixiApplication` resolves to. */
207
258
  interface CreatedPixiApplication {
259
+ /** The initialized Pixi `Application`. The caller owns it and is the one to destroy it. */
208
260
  app: Application;
209
261
  /**
210
262
  * The backend Pixi actually resolved to after `init`. May differ from the
@@ -232,8 +284,18 @@ declare function resolveRendererBackend(app: Application): RendererBackend;
232
284
  * wrapper that `add(fn)` previously registered with the Pixi ticker.
233
285
  */
234
286
  declare class PixiV8TickerAdapter implements ITicker {
287
+ /** The Pixi ticker being wrapped. */
235
288
  protected _ticker: Ticker;
289
+ /**
290
+ * Pairs each function given to `add` with the wrapper registered on the Pixi ticker, so `remove` can unregister that same wrapper.
291
+ */
236
292
  protected _wrapped: Map<(deltaMS: number) => void, (ticker: Ticker) => void>;
293
+ /**
294
+ * Wraps a Pixi ticker. The constructor neither starts nor stops it, but Pixi starts a ticker whose
295
+ * `autoStart` is set (such as `Ticker.shared`) when `add` registers the first function.
296
+ *
297
+ * @param ticker - The Pixi `Ticker` whose frames drive the functions added to this adapter.
298
+ */
237
299
  constructor(ticker: Ticker);
238
300
  add(fn: (deltaMS: number) => void): void;
239
301
  remove(fn: (deltaMS: number) => void): void;
@@ -247,6 +309,9 @@ declare class PixiV8TickerAdapter implements ITicker {
247
309
  * what a host is told so it can say it.
248
310
  */
249
311
  declare class PixiV8RendererCapabilities implements IRendererCapabilities {
312
+ /**
313
+ * Registers the advanced blend filters with Pixi the first time any instance is created; later instances reuse that registration.
314
+ */
250
315
  constructor();
251
316
  blendModeSupport(mode: ParticleBlendMode): BlendModeSupport;
252
317
  }
@@ -283,8 +348,9 @@ declare const PARTICLE_ATLAS_CACHE_KEY = "perseon:particle-atlas";
283
348
  * `texture.source` names a frame the host is expected to have registered
284
349
  * beforehand, which is what lets one atlas serve every particle in the scene
285
350
  * instead of embedding the same image once per use. This class is the other
286
- * half of that contract — give it the `.png` + `.json` pair the editor exports
287
- * and the ids in the scene file resolve.
351
+ * half of that contract — give it the `.png` + `.json` pair that Perseon
352
+ * Particle Studio exports, or any Pixi spritesheet, and the ids in the scene
353
+ * file resolve.
288
354
  *
289
355
  * Registering the spritesheet in `Assets.cache` is what publishes the frames:
290
356
  * Pixi's cache parser for spritesheets adds one entry per frame name, which is
@@ -310,7 +376,9 @@ declare const PARTICLE_ATLAS_CACHE_KEY = "perseon:particle-atlas";
310
376
  * object URL must be read into a data URL (or a `Texture`) first.
311
377
  */
312
378
  declare class PixiV8ParticleAtlas {
379
+ /** The key the spritesheet is published under in `Assets.cache`. */
313
380
  protected _cacheKey: string;
381
+ /** The sheet published by the last successful `load`; cleared by `destroy`. */
314
382
  protected _spritesheet?: Spritesheet;
315
383
  /** URL this instance acquired through `Assets`, so it releases exactly what it took. */
316
384
  protected _loadedImageUrl?: string;
@@ -320,7 +388,11 @@ declare class PixiV8ParticleAtlas {
320
388
  * publish its sheet over the winner's and leak the winner's.
321
389
  */
322
390
  protected _loadToken: number;
323
- /** @param cacheKey - The key the spritesheet is registered under in `Assets.cache`; give distinct keys to atlases that coexist. */
391
+ /**
392
+ * Creates an empty atlas; nothing is published until `load`.
393
+ *
394
+ * @param cacheKey - The key the spritesheet is registered under in `Assets.cache`; give distinct keys to atlases that coexist.
395
+ */
324
396
  constructor(cacheKey?: string);
325
397
  /** The spritesheet published by the last successful `load`, or `undefined` before one or after `destroy`. */
326
398
  get spritesheet(): Spritesheet | undefined;