@silentstatestudio/perseon 0.0.0-stage → 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 (47) hide show
  1. package/CHANGELOG.md +219 -0
  2. package/LICENSE.md +73 -0
  3. package/README.md +849 -2
  4. package/dist/authoring/index.cjs +218 -0
  5. package/dist/authoring/index.d.cts +964 -0
  6. package/dist/authoring/index.d.ts +964 -0
  7. package/dist/authoring/index.js +219 -0
  8. package/dist/authoring/index.js.map +1 -0
  9. package/dist/chunk-443SQYAB.cjs +8468 -0
  10. package/dist/chunk-AVYXWDFD.js +8469 -0
  11. package/dist/chunk-AVYXWDFD.js.map +1 -0
  12. package/dist/chunk-BEDH7OYG.js +5484 -0
  13. package/dist/chunk-BEDH7OYG.js.map +1 -0
  14. package/dist/chunk-WEQPSGPS.cjs +5482 -0
  15. package/dist/chunk-ZIMCQTYK.cjs +6 -0
  16. package/dist/chunk-ZTG42LPX.js +6 -0
  17. package/dist/chunk-ZTG42LPX.js.map +1 -0
  18. package/dist/colors-CCeWL9q4.d.cts +2597 -0
  19. package/dist/colors-CGWrMf4V.d.ts +2597 -0
  20. package/dist/core/index.cjs +34 -0
  21. package/dist/core/index.d.cts +40 -0
  22. package/dist/core/index.d.ts +40 -0
  23. package/dist/core/index.js +35 -0
  24. package/dist/core/index.js.map +1 -0
  25. package/dist/index.cjs +34 -0
  26. package/dist/index.d.cts +3 -0
  27. package/dist/index.d.ts +3 -0
  28. package/dist/index.js +35 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/pixi-v7/index.cjs +587 -0
  31. package/dist/pixi-v7/index.d.cts +471 -0
  32. package/dist/pixi-v7/index.d.ts +471 -0
  33. package/dist/pixi-v7/index.js +588 -0
  34. package/dist/pixi-v7/index.js.map +1 -0
  35. package/dist/pixi-v8/index.cjs +679 -0
  36. package/dist/pixi-v8/index.d.cts +452 -0
  37. package/dist/pixi-v8/index.d.ts +452 -0
  38. package/dist/pixi-v8/index.js +680 -0
  39. package/dist/pixi-v8/index.js.map +1 -0
  40. package/dist/rendering-dYQXmGTV.d.cts +264 -0
  41. package/dist/rendering-dYQXmGTV.d.ts +264 -0
  42. package/dist/testing/index.cjs +182 -0
  43. package/dist/testing/index.d.cts +103 -0
  44. package/dist/testing/index.d.ts +103 -0
  45. package/dist/testing/index.js +184 -0
  46. package/dist/testing/index.js.map +1 -0
  47. package/package.json +144 -5
@@ -0,0 +1,2597 @@
1
+ import { b as IParticleVisualState, g as ITextureRef, i as IShape, f as IRenderer, P as ParticleBlendMode, e as ITicker } from './rendering-dYQXmGTV.js';
2
+
3
+ /** A point, in pixels. */
4
+ type PointValue = {
5
+ /** Horizontal coordinate, in pixels. */
6
+ x: number;
7
+ /** Vertical coordinate, in pixels. It grows downward on screen. */
8
+ y: number;
9
+ };
10
+ /** A direction and a size. */
11
+ interface VectorValue {
12
+ /** In radians: 0 points along +x, and a positive angle turns toward +y (down, on screen). */
13
+ angle: number;
14
+ /** The size of the vector, in the unit of the field that holds it (for example pixels per second for a velocity). */
15
+ magnitude: number;
16
+ }
17
+ /** A rectangle given by its center, its size and an optional rotation about the center. */
18
+ interface RectangleArea {
19
+ /** Center of the rectangle, in pixels. */
20
+ center: PointValue;
21
+ /** Size along the rectangle's own x axis, in pixels. */
22
+ width: number;
23
+ /** Size along the rectangle's own y axis, in pixels. */
24
+ height: number;
25
+ /** In radians. */
26
+ rotation?: number;
27
+ }
28
+ /** A filled circle. */
29
+ interface CircleArea {
30
+ /** Center of the circle, in pixels. */
31
+ center: PointValue;
32
+ /** Radius, in pixels, 0 or more. In a config a negative radius is a `PerseonConfigError`; through `option().set` it is clipped to 0. */
33
+ radius: number;
34
+ }
35
+ /** A ring: the band between two concentric circles. */
36
+ interface RingArea {
37
+ /** Center of the ring, in pixels. */
38
+ center: PointValue;
39
+ /** Radius of the empty middle, in pixels, 0 or more. It must not exceed `outerRadius`. */
40
+ innerRadius: number;
41
+ /** Radius of the outer edge, in pixels. It must be at least `innerRadius`. */
42
+ outerRadius: number;
43
+ }
44
+ /** A capsule (pill): a segment widened by `radius`, with a round cap at each end. */
45
+ interface CapsuleArea {
46
+ /** Center of the capsule, in pixels. */
47
+ center: PointValue;
48
+ /** Radius of the round ends and half the width of the body, in pixels. */
49
+ radius: number;
50
+ /** Total length from end to end, caps included, in pixels. At `2 * radius` or less it is a circle. */
51
+ length: number;
52
+ /** In radians. */
53
+ rotation?: number;
54
+ }
55
+ /** A closed polygon of at least 3 points. */
56
+ interface PolygonArea {
57
+ /** The vertices, in pixels, in order around the outline. */
58
+ points: PointValue[];
59
+ }
60
+ /** An area: a rectangle, a circle, a ring, a capsule or a polygon, told apart by their fields. */
61
+ type ShapeArea = RectangleArea | CircleArea | RingArea | CapsuleArea | PolygonArea;
62
+
63
+ /**
64
+ * A curve through points: for an x, it gives a y. What x and y measure depends
65
+ * on where the curve is used (a transfer function, a probability, a waveform).
66
+ */
67
+ interface CurveDefinition {
68
+ /** The points the curve passes through. Read in order of x. */
69
+ points: {
70
+ /** Position along the curve's horizontal axis: the input. */
71
+ x: number;
72
+ /** The curve's value at `x`: the output. */
73
+ y: number;
74
+ }[];
75
+ /**
76
+ * One number per segment between two consecutive points, from -1 to 1: 0 is
77
+ * a straight line, and the sign says to which side the segment bends.
78
+ */
79
+ segmentBends: number[];
80
+ }
81
+ /**
82
+ * The built-in probability curves, from the range's `min` side (x = 0) to its
83
+ * `max` side (x = 1): `'uniform'` (equal everywhere), `'lowBias'` (likelier near
84
+ * `min`), `'highBias'` (likelier near `max`), `'centerBias'` (likelier in the
85
+ * middle), `'edgeBias'` (likelier near both ends), `'bell'` (a narrow central
86
+ * bell) and `'doublePeak'` (two peaks).
87
+ */
88
+ type ProbabilityCurvePresetId = 'uniform' | 'lowBias' | 'highBias' | 'centerBias' | 'edgeBias' | 'bell' | 'doublePeak';
89
+ /** Which probability curve a distribution is: one of the built-in presets, or a custom curve. */
90
+ type ProbabilityCurveKind = {
91
+ /** `'preset'`: the curve is the built-in one named by `presetId`. */
92
+ type: 'preset';
93
+ /** Which built-in curve, by its id in `PROBABILITY_CURVE_PRESETS`. */
94
+ presetId: ProbabilityCurvePresetId;
95
+ } | {
96
+ /** `'custom'`: the curve was drawn by hand rather than taken from a preset. */
97
+ type: 'custom';
98
+ };
99
+ /** A built-in probability curve, with the text and icon a tool shows for it. */
100
+ interface ProbabilityCurvePreset {
101
+ /** Which preset this is. */
102
+ id: ProbabilityCurvePresetId;
103
+ /** Short display name, in English. */
104
+ label: string;
105
+ /** One-line explanation of the shape, in English. */
106
+ description: string;
107
+ /** The curve itself, with x from 0 to 1 across the range and y the relative probability. */
108
+ curve: CurveDefinition;
109
+ /** Name of the icon a tool draws for the preset. */
110
+ iconKey?: string;
111
+ }
112
+
113
+ /**
114
+ * Events — named hooks the host declares once on the engine and binds to
115
+ * lifecycle moments of emitters and particles.
116
+ *
117
+ * An event is just a unique name. Emitters and particles bind that name to a
118
+ * trigger; when the trigger fires, the engine hands a `PerseonEvent` describing
119
+ * who fired it to the listeners of `on`, in three levels: the playback, its
120
+ * animation and `Perseon`. The engine never interprets an
121
+ * event — it only routes it — so hosts are free to give names any meaning they
122
+ * want (spawn a sound, chain another emitter, score a hit).
123
+ *
124
+ * Names are the identity: `ParticleAnimationOptions.events` registers them and both
125
+ * binding maps are keyed by them. A name that is not registered does not fire.
126
+ */
127
+
128
+ /** Lifecycle moments a particle can bind an event to. */
129
+ declare const PARTICLE_EVENT_TRIGGERS: readonly ["onSpawn", "onDeath", "onRegionEnter", "onRegionExit"];
130
+ /**
131
+ * Lifecycle moments an emitter can bind an event to.
132
+ *
133
+ * `onFinished` is the one that describes the emitter rather than its emission:
134
+ * it has run its cycles out **and** the last particle it spawned has died. The
135
+ * other two straddle that moment — emission stops while the particles it made
136
+ * are still on screen — so neither of them says "this emitter is done".
137
+ */
138
+ declare const EMITTER_EVENT_TRIGGERS: readonly ["onEmitStart", "onEmitStop", "onFinished"];
139
+ /** A lifecycle moment a particle can bind an event to: one of `PARTICLE_EVENT_TRIGGERS`. */
140
+ type ParticleEventTrigger = (typeof PARTICLE_EVENT_TRIGGERS)[number];
141
+ /** A lifecycle moment an emitter can bind an event to: one of `EMITTER_EVENT_TRIGGERS`. */
142
+ type EmitterEventTrigger = (typeof EMITTER_EVENT_TRIGGERS)[number];
143
+ /** Any lifecycle moment an event can be bound to, on a particle or on an emitter. */
144
+ type EventTrigger = ParticleEventTrigger | EmitterEventTrigger;
145
+ /** Whether `value` can be an event name: a string with at least one non-whitespace character. */
146
+ declare function isValidEventName(value: unknown): value is string;
147
+ /** Whether `value` is one of the particle triggers in `PARTICLE_EVENT_TRIGGERS`. */
148
+ declare function isParticleEventTrigger(value: unknown): value is ParticleEventTrigger;
149
+ /** Whether `value` is one of the emitter triggers in `EMITTER_EVENT_TRIGGERS`. */
150
+ declare function isEmitterEventTrigger(value: unknown): value is EmitterEventTrigger;
151
+ /** Whether `value` is a particle trigger or an emitter trigger. */
152
+ declare function isEventTrigger(value: unknown): value is EventTrigger;
153
+
154
+ /**
155
+ * Renderer-agnostic particle. Holds physics, lifecycle, and visual state as
156
+ * plain fields. The render adapter mirrors these fields to its backend each
157
+ * frame via `IParticleGroup.syncFrame`.
158
+ *
159
+ * A host extends it to give its particles state and behavior of their own, and
160
+ * hands the subclass to an emitter as `EmitterOptions.ParticleClass`: the hooks
161
+ * are `onInit` and `onUpdate`, and an override of `reset` that calls
162
+ * `super.reset()` clears its own state when the particle goes back to the pool.
163
+ *
164
+ * The engine pools its particles and calls `reset` and `destroy` on them; the
165
+ * setup of a recycled particle and its step on every tick are the engine's own
166
+ * and not part of this class's public surface.
167
+ *
168
+ * Names reserved for the engine, which a subclass cannot declare (doing so is a
169
+ * compile error):
170
+ * - `init`, `updatePhysics`, `updateEnvironment`, `updateTexture`: what the
171
+ * engine does with a particle, declared here as reserved methods.
172
+ * - `layer`, `mem`, `bornX`, `bornY`: the engine's per-particle state,
173
+ * declared here as private members.
174
+ *
175
+ * The rest of the public fields are the particle's state, which the engine
176
+ * writes as it simulates it: a hook may read them and write the visual and
177
+ * physical ones (`x`, `velocityX`, `alpha`, `tint`…); a subclass must not
178
+ * redeclare them with another meaning.
179
+ */
180
+ declare class ParticleItem implements IParticleVisualState {
181
+ /** Horizontal position, in pixels, in the space its emitter draws in. */
182
+ x: number;
183
+ /** Vertical position, in pixels, in the same space as `x`. */
184
+ y: number;
185
+ /** Horizontal scale factor: 1 draws the texture at its own width. */
186
+ scaleX: number;
187
+ /** Vertical scale factor: 1 draws the texture at its own height. */
188
+ scaleY: number;
189
+ /** Rotation, in radians, around the anchor. */
190
+ rotation: number;
191
+ /** Opacity, from 0 (invisible) to 1 (opaque). */
192
+ alpha: number;
193
+ /** Color multiplied over the texture, as a `0xRRGGBB` number; `0xffffff` leaves it as it is. */
194
+ tint: number;
195
+ /** Horizontal anchor as a fraction of the texture's width; 0.5 is the center. */
196
+ anchorX: number;
197
+ /** Vertical anchor as a fraction of the texture's height; 0.5 is the center. */
198
+ anchorY: number;
199
+ /** The texture drawn now; the sprite-sheet animation swaps it as frames advance. */
200
+ texture: ITextureRef;
201
+ /**
202
+ * Opaque backend slot (see `IParticleVisualState.renderHandle`). The render
203
+ * adapter stashes this particle's mirror object here so its per-frame sync
204
+ * skips a map lookup. Cleared on `reset()` before the item is recycled.
205
+ */
206
+ renderHandle: unknown;
207
+ /** Whether the particle is waiting in its pool rather than alive. Written by the engine; a host only reads it. */
208
+ inPool: boolean;
209
+ /**
210
+ * Id of the particle type this instance was spawned from
211
+ * (`ParticleLayerOptions.id`). `undefined` when the host supplied no id. The
212
+ * engine reads this on kill to keep its per-type alive counts accurate.
213
+ */
214
+ sourceParticleId: string | undefined;
215
+ /**
216
+ * The Particle Layer this instance was spawned from, or `null` while it is
217
+ * in the pool. The engine reads it on add/kill to route the particle to its
218
+ * own render group (one group per layer) — the layer itself rather than an
219
+ * index into its emitter, because a layer added or removed at runtime
220
+ * renumbers that index under every particle already alive.
221
+ *
222
+ * Reserved for the engine: private so a subclass cannot declare the name,
223
+ * and read by the engine's other classes as `particle['layer']`.
224
+ */
225
+ private layer;
226
+ /**
227
+ * The layer's list memory, captured at spawn so the update path points the
228
+ * context at it without going through the layer.
229
+ */
230
+ protected _listState: RandomListState;
231
+ /** The random value drawn at birth; read through `seed`. */
232
+ protected _seed: number;
233
+ /** The state of the particle's texture-frame animation, or `null` when it has none or it has ended. */
234
+ protected _spriteAnimation: ParticleSpriteAnimationParameters | null;
235
+ /**
236
+ * The state the layer's program keeps per particle: frozen
237
+ * bases of modulated values, the polar components of a recomposed vector,
238
+ * point-force factors, the `'particle'` locals it reads. Indexed by the
239
+ * layout of the program its layer runs (`compiledParameters.layout`), and only written by that program.
240
+ *
241
+ * Sized once to the most any layer of the emitter needs, so the pool can
242
+ * hand the same particle to any of them without allocating at birth;
243
+ * zeroed when the particle goes back to the pool.
244
+ *
245
+ * Reserved for the engine, as `layer`: the compiled operations reach it as `particle['mem']`.
246
+ */
247
+ private mem;
248
+ /**
249
+ * The emission transform it was born with: the layer's,
250
+ * its emitter's and the playback's, summed at birth. A position the layer
251
+ * writes live (Linked or modulated) is written over it, so a change of
252
+ * transform never moves a live particle.
253
+ *
254
+ * Reserved for the engine, as `layer`: the compiled operations reach it as `particle['bornX']`.
255
+ */
256
+ private bornX;
257
+ /** Reserved for the engine, as `bornX`. */
258
+ private bornY;
259
+ /** Horizontal velocity, in pixels per second. */
260
+ velocityX: number;
261
+ /** Vertical velocity, in pixels per second. */
262
+ velocityY: number;
263
+ /** Horizontal acceleration, in pixels per second squared. */
264
+ accelerationX: number;
265
+ /** Vertical acceleration, in pixels per second squared. */
266
+ accelerationY: number;
267
+ /** Rate of change of `scaleX`, per second. */
268
+ scaleVelocityX: number;
269
+ /** Rate of change of `scaleY`, per second. */
270
+ scaleVelocityY: number;
271
+ /** Rate of change of `scaleVelocityX`, per second squared. */
272
+ scaleAccelerationX: number;
273
+ /** Rate of change of `scaleVelocityY`, per second squared. */
274
+ scaleAccelerationY: number;
275
+ /** Rate of change of `rotation`, in radians per second. */
276
+ rotationVelocity: number;
277
+ /** Rate of change of `rotationVelocity`, in radians per second squared. */
278
+ rotationAcceleration: number;
279
+ /** Rate of change of `alpha`, per second. */
280
+ alphaVelocity: number;
281
+ /** Rate of change of `alphaVelocity`, per second squared. */
282
+ alphaAcceleration: number;
283
+ /** Cap on the absolute value of `velocityX`, in pixels per second; negative means no cap. */
284
+ maxVelocityX: number;
285
+ /** Cap on the absolute value of `velocityY`, in pixels per second; negative means no cap. */
286
+ maxVelocityY: number;
287
+ /** Cap on the absolute value of `scaleVelocityX`; negative means no cap. */
288
+ maxScaleVelocityX: number;
289
+ /** Cap on the absolute value of `scaleVelocityY`; negative means no cap. */
290
+ maxScaleVelocityY: number;
291
+ /** Cap on the absolute value of `rotationVelocity`, in radians per second; negative means no cap. */
292
+ maxRotationVelocity: number;
293
+ /** Cap on the absolute value of `alphaVelocity`; negative means no cap. */
294
+ maxAlphaVelocity: number;
295
+ /** How long the particle lives, in seconds; `Infinity` until its layer gives it one. */
296
+ lifetime: number;
297
+ /** Seconds lived so far. */
298
+ currentLife: number;
299
+ /** Fraction of the lifetime lived, from 0 to 1; 0 while `lifetime` is 0. */
300
+ lifeProgress: number;
301
+ /** How strongly the playback's gravity pulls this particle; 0 leaves it unaffected. */
302
+ gravityFactor: number;
303
+ /** How strongly the playback's damping slows this particle; 0 leaves it unaffected. */
304
+ dampingFactor: number;
305
+ /** How strongly the playback's wind pushes this particle; 0 leaves it unaffected. */
306
+ windFactor: number;
307
+ /** The shape of the region this particle is bound to, or `null` when it has none. */
308
+ regionShape: IShape | null;
309
+ /** Whether its region kills the particle inside it (`killInside`) or outside it (`killOutside`); `null` when it has none. */
310
+ regionBehavior: RegionBehavior | null;
311
+ /** Id of the assigned region, carried so region events can name it in their payload. */
312
+ regionId: string | null;
313
+ /**
314
+ * Which side of the region the particle was on last frame. `onRegionEnter` /
315
+ * `onRegionExit` fire on the change of side, so this is seeded at spawn with
316
+ * the particle's actual containment — being born inside is not an entry.
317
+ * Written by the engine; a host only reads it.
318
+ */
319
+ wasInsideRegion: boolean;
320
+ /**
321
+ * Event names bound to this particle's triggers, copied from its compiled
322
+ * parameters at spawn. The particle carries them because its triggers fire
323
+ * from the engine's update loop, far from the compiler that grouped them.
324
+ *
325
+ * Read-only for the particle's whole life: it points at the compiled group
326
+ * (shared by every particle of the type) or at the shared empty one.
327
+ * Written by the engine at birth and when the particle goes back to its pool.
328
+ */
329
+ events: Readonly<Record<ParticleEventTrigger, readonly string[]>>;
330
+ /**
331
+ * Time elapsed since the particle was born, in seconds. Alias of currentLife.
332
+ * When used as a linked-parameter source, particles with no configured lifetime
333
+ * (lifetime = Infinity) feed Infinity into the transfer function curve, which
334
+ * clamps to the curve's last y-value for the entire particle lifetime.
335
+ */
336
+ get lifeElapsed(): number;
337
+ /** The random value drawn for this particle at birth, from its emitter's generator. */
338
+ get seed(): number;
339
+ /** Same as `x`. */
340
+ get positionX(): number;
341
+ /** Same as `y`. */
342
+ get positionY(): number;
343
+ /** Speed, in pixels per second: the length of the velocity vector. */
344
+ get velocityMagnitude(): number;
345
+ /** Direction of the velocity vector, in radians, as `Math.atan2(velocityY, velocityX)`. */
346
+ get velocityAngle(): number;
347
+ /** Length of the acceleration vector, in pixels per second squared. */
348
+ get accelerationMagnitude(): number;
349
+ /** Direction of the acceleration vector, in radians, as `Math.atan2(accelerationY, accelerationX)`. */
350
+ get accelerationAngle(): number;
351
+ /**
352
+ * Per-particle sensitivity to each global point force that acts on it,
353
+ * keyed by force id. A new map on each read, built from the state the
354
+ * engine keeps for the particle: a factor of 0 — declared so, or cleared
355
+ * because the force was removed — leaves the force out, as the particle is
356
+ * unaffected by it.
357
+ */
358
+ get pointForceFactors(): ReadonlyMap<string, number>;
359
+ /**
360
+ * Configures sprite-sheet animation for this particle. All source ids are
361
+ * pre-resolved to `ITextureRef` via the renderer's cache here, so the hot
362
+ * update loop only indexes into the resolved array — no per-frame lookups.
363
+ */
364
+ setSpriteAnimation(options: SpriteAnimationTexturesOptions, renderer: IRenderer, rng?: {
365
+ next(): number;
366
+ }): void;
367
+ /**
368
+ * Reserved for the engine, which sets up through it every particle it takes
369
+ * from its pool. A subclass does its own setup in `onInit`: declaring a
370
+ * member of this name is a compile error, and there is nothing to call.
371
+ */
372
+ init(...reserved: never[]): never;
373
+ /**
374
+ * Reserved for the engine, which advances the particle's sprite-sheet
375
+ * animation through it on every tick. Declaring a member of this name is a
376
+ * compile error, and there is nothing to call.
377
+ */
378
+ updateTexture(...reserved: never[]): never;
379
+ /**
380
+ * Reserved for the engine, which steps every live particle through it on
381
+ * every tick. A subclass does its own step in `onUpdate`: declaring a member
382
+ * of this name is a compile error, and there is nothing to call.
383
+ */
384
+ updatePhysics(...reserved: never[]): never;
385
+ /**
386
+ * Reserved for the engine, which adds the playback's gravity, damping and
387
+ * wind through it. Declaring a member of this name is a compile error, and
388
+ * there is nothing to call.
389
+ */
390
+ updateEnvironment(...reserved: never[]): never;
391
+ /**
392
+ * Called once when the particle is born, after the engine has set it up and
393
+ * after its layer's `ParticleLayerOptions.onInit`. Empty here: a
394
+ * `ParticleClass` overrides it, as a method or as an arrow-function field.
395
+ * @param _options the particle, its emitter and the emitter's random generator.
396
+ */
397
+ onInit(_options: ParameterInitOptions): void;
398
+ /**
399
+ * Called on every tick the particle lives, after the engine has stepped it
400
+ * and after its layer's `ParticleLayerOptions.onUpdate`. Empty here, as `onInit`.
401
+ * @param _options the seconds elapsed in this step, the particle, its emitter and the emitter's random generator.
402
+ */
403
+ onUpdate(_options: ParameterUpdateOptions): void;
404
+ /**
405
+ * Reset all particle values to defaults. Called when the particle goes back to its pool.
406
+ * A `ParticleClass` with state of its own overrides it, calls `super.reset()`, and clears that state.
407
+ */
408
+ reset(): void;
409
+ /** Called when the engine discards the particle; clears it like `reset`. */
410
+ destroy(): void;
411
+ }
412
+
413
+ /**
414
+ * The default of one of an animation's locals: the only thing of the template
415
+ * the API changes. A table of values, not a configuration: it compiles nothing
416
+ * and the data is never written. Each instance copies the table when it is prepared, as
417
+ * pinned values, so a default reaches only the instances prepared after it:
418
+ * a Range, a List or a `'particle'` local stops being drawn in them, for the
419
+ * whole session and for every particle. An instance draws again with
420
+ * `pb.param(id).set(config)`.
421
+ *
422
+ * Built by `PerseonAnimation.param(id)`.
423
+ */
424
+ declare class LocalDefaultHandle {
425
+ /** The local's id, as `param` was given it. */
426
+ readonly id: string;
427
+ /** Built by the engine; a host gets it from `PerseonAnimation.param(id)`. */
428
+ private constructor();
429
+ /** The default, as it was set (a number clipped to the domain, or a label); `undefined` without one. */
430
+ get(): number | string | undefined;
431
+ /**
432
+ * Set the default to a number, clipped to the local's domain with a
433
+ * warning, or to one of its labels. A strategy is not a default: it is
434
+ * set on an instance. A rejected value throws a `PerseonConfigError` and
435
+ * leaves the entry as it was.
436
+ */
437
+ set(value: number | string): void;
438
+ /** Erase the entry: the instances prepared after it start from the data. */
439
+ reset(): void;
440
+ }
441
+
442
+ /**
443
+ * The addressable nodes of each scope: what
444
+ * `option(path)` reaches, the node type, when the engine reads it, and
445
+ * how a value for it is checked and clipped. The paths are those of the
446
+ * format, relative to the scope; `<id>` stands for the one open
447
+ * segment a point force, a region or a point force factor has.
448
+ *
449
+ * Left out, each for its own reason: identities (`id`), structure the
450
+ * editor rebuilds (`emitters`, `particles`), the lists changed by
451
+ * their own methods (`pointForces`, `regions`, `events`), the parameters
452
+ * (`param()`), functions and constructors, the animation's
453
+ * `randomness.seed` (a play option) and the inside of a node replaced whole
454
+ * (a texture's sprite fields, an event binding's trigger).
455
+ */
456
+ type OptionScope = 'playback' | 'emitter' | 'layer';
457
+ /** The four node types. */
458
+ type OptionNodeKind = 'value' | 'composite' | 'record' | 'constant';
459
+ /** When the engine reads a node; `ParameterDescription.stage`. */
460
+ type OptionStage = 'construction' | 'session' | 'cycle' | 'birth' | 'tick' | 'immediate';
461
+ /** A value's strategy; `ParameterDescription.strategy`. */
462
+ type OptionStrategy = 'fixed' | 'range' | 'list' | 'linked' | 'modulated';
463
+ /**
464
+ * One addressable node of a scope: its path, what kind of node it is, when the engine reads it,
465
+ * and the functions that check and clip a value for it.
466
+ */
467
+ interface OptionPathEntry {
468
+ /** As the dev writes it, with `<id>` for an open segment. */
469
+ readonly path: string;
470
+ /** What kind of node it is: a value, a composite, a record or a constant. */
471
+ readonly kind: OptionNodeKind;
472
+ /** When the engine reads the node. */
473
+ readonly stage: OptionStage;
474
+ /**
475
+ * The strategies read at another stage than `stage`: a Fixed or Linked
476
+ * `rate` in the tick, a layer value in the tick when Linked or
477
+ * modulated. A composite that can be a single value (`scale.value`
478
+ * uniform, `color.value` as a live gradient) carries it too.
479
+ */
480
+ readonly stageByStrategy?: Readonly<Partial<Record<OptionStrategy, OptionStage>>>;
481
+ /**
482
+ * Throws on a shape the format does not have, a wrong type or a number that
483
+ * is not finite. A number out of the node's domain is not an error: it is
484
+ * `sanitize`'s to clip. `path` is the concrete path the
485
+ * errors name (`'regions.water.area'`); by default, the catalog's.
486
+ */
487
+ readonly validate: (value: unknown, path?: string) => void;
488
+ /**
489
+ * Every number clipped to its domain. The input is not touched: what it
490
+ * clips is rebuilt, but the rest may be the input's own objects (a node
491
+ * with nothing to clip, an event binding, a region reference, comes back
492
+ * as the same reference). `set` takes its own deep copy of the config before it sanitizes it.
493
+ */
494
+ readonly sanitize: (value: unknown) => unknown;
495
+ /**
496
+ * The domain a plain number of this node is clipped to, when one is all
497
+ * `validate` and `sanitize` do with it (a constant number, an emitter
498
+ * value): a shortcut checks and clips it in place, with nothing built.
499
+ */
500
+ readonly numberDomain?: NumericDomain;
501
+ /** The same for each number of a node that is a pair of them (the wind). */
502
+ readonly pairDomains?: Readonly<Record<string, NumericDomain>>;
503
+ }
504
+ /** The addressable nodes of each scope (`playback`, `emitter`, `layer`), as `OptionPathEntry` lists. */
505
+ declare const OPTION_PATH_CATALOG: Readonly<Record<OptionScope, readonly OptionPathEntry[]>>;
506
+ /**
507
+ * The entry of a concrete path (`'pointForces.toCounter.position'`), or
508
+ * `undefined` if the scope has no such node. The id is a single segment, as
509
+ * the names of emitters, regions and point forces take no dot:
510
+ * `'pointForces.a.position'` is the `position` of the force `'a'`, and
511
+ * `'pointForces.a.b'` names no node. Whether the id exists is the caller's to
512
+ * check, against the ids it has.
513
+ */
514
+ declare const findOptionPathEntry: (scope: OptionScope, path: string) => OptionPathEntry | undefined;
515
+
516
+ /**
517
+ * What a recoverable misuse does (`PerseonOptions.diagnostics`):
518
+ * `'warn'` prints it once, `'throw'` turns it into an error, `'silent'` drops it.
519
+ */
520
+ type DiagnosticsPolicy = 'warn' | 'throw' | 'silent';
521
+
522
+ /**
523
+ * The handle of one of the animation's locals in one instance: the pair
524
+ * (instance, id), which holds nothing of the local. Two handles of one id are
525
+ * two views of it; what they read and write is the instance's: its pins and
526
+ * its overlay.
527
+ *
528
+ * - `set(number | label)` pins the value, clipped to the declared domain, in
529
+ * every store of the local's scope, and drops a substituted strategy. No
530
+ * draw or Linked evaluation overwrites it, and each node that reads it
531
+ * notices it at its stage: a Linked of the tick at once, what
532
+ * is read at birth in the particles born after. A `'particle'` local is
533
+ * the particle's own: those alive keep theirs. Nothing is
534
+ * built nor allocated: it is the game loop's call.
535
+ * - `set(config)` substitutes the local's strategy, in this instance only,
536
+ * with copy-on-write units, and unpins it. It takes effect at the scope's
537
+ * next draw: the next session, the next cycle, or the particles born after;
538
+ * until then the local keeps its value. A unit that starts reading a local through it draws that local in
539
+ * the act, unless it is pinned.
540
+ * - The last call wins. `reset()` drops both and goes back to the value the
541
+ * instance started from: the template's default it copied, or the data.
542
+ *
543
+ * Built by `PerseonPlayback.param(id)`, with the generation of that playback:
544
+ * once it is over, `set` and `reset` change nothing and say so, as a node's handle does.
545
+ */
546
+ declare class LocalParameterHandle {
547
+ /** The local's id, as `param` was given it. */
548
+ readonly path: string;
549
+ /** Always `'value'`: a local is a single value, whatever strategy it holds. */
550
+ readonly kind = "value";
551
+ /** Built by the engine; a host gets it from `PerseonPlayback.param(id)`. */
552
+ private constructor();
553
+ /** A local is always there: it has no parent whose mode could leave it out. */
554
+ get active(): boolean;
555
+ /** Whether the instance set the local: a pin of its own or a strategy it substituted, not a default it copied. */
556
+ get overridden(): boolean;
557
+ /** Whether no draw or evaluation overwrites the local: the instance set a number, or copied a default. */
558
+ get pinned(): boolean;
559
+ /**
560
+ * The local's value in this instance, the label in a `'label'` local. A
561
+ * `'playback'` one has one value, whatever its strategy. An `'emitter'` or
562
+ * `'particle'` one has a value per emitter or per particle, so it has none
563
+ * of its own unless it is pinned: then `undefined`.
564
+ */
565
+ get current(): number | string | undefined;
566
+ /**
567
+ * A copy of the local's config in this instance: the number it is pinned
568
+ * to (a label's index, as the format holds it), the strategy it
569
+ * substituted, or the data's.
570
+ */
571
+ get(): CustomParameterValue;
572
+ /**
573
+ * A number or a label pins the local; a config (Fixed, Range, List,
574
+ * Linked) substitutes its strategy. A rejected one throws a
575
+ * `PerseonConfigError` and leaves the instance as it was.
576
+ */
577
+ set(value: CustomParameterValue | string): void;
578
+ /**
579
+ * Drop the pin and the substitution: the local goes back to the default
580
+ * the instance copied from the template, if any, and if not to the data.
581
+ * On a local the instance never touched it does nothing.
582
+ */
583
+ reset(): void;
584
+ /**
585
+ * What the local is in this instance: a pinned one takes
586
+ * effect at once; a Linked one is read in each tick; any other, at its
587
+ * scope's draw. A read of shape, allowed in a dead handle.
588
+ */
589
+ describe(): ParameterDescription;
590
+ }
591
+
592
+ /**
593
+ * Why a play session ended: it ran its course (`'completed'`), or
594
+ * a host called `stop()`, `release()` or `destroy()`, or destroyed the
595
+ * container it draws under (`'hostDestroyed'`).
596
+ */
597
+ type PlaybackFinishedReason = 'completed' | 'stopped' | 'released' | 'destroyed' | 'hostDestroyed';
598
+ /** How a play session ended, handed to `finished` and to the `onFinished` listeners alike. */
599
+ interface PlaybackFinishedResult {
600
+ /** Why it ended: `'completed'` (it ran its course), `'stopped'`, `'released'` or `'destroyed'` (the host's call), or `'hostDestroyed'` (its container was destroyed). */
601
+ readonly reason: PlaybackFinishedReason;
602
+ }
603
+
604
+ /** What `describe()` tells of a node. */
605
+ interface ParameterDescription {
606
+ /** The node's path from its owner, as `option` was given it. */
607
+ path: string;
608
+ /** The kind of node: a value, a composite, a record or a constant. */
609
+ kind: OptionNodeKind;
610
+ /** When the engine reads the node with the strategy it has now. */
611
+ stage: OptionStage;
612
+ /** A value's strategy, and a composite's when it is a single value. */
613
+ strategy?: OptionStrategy;
614
+ /** A composite's mode: `'axes'`, `'polar'`, `'area'`, `'list'`, `'uniform'`, `'gradient'`. */
615
+ mode?: string;
616
+ /** The range a number of the node is clipped to; not in a node without a single one (a record, the wind's pair). */
617
+ domain?: NumericDomain;
618
+ /** Whether the instance sets this node, or a node that holds it or that it holds. */
619
+ overridden: boolean;
620
+ /** Only a local is pinned (`param(id)`): never a node of `option()`. */
621
+ pinned: boolean;
622
+ /** `false` while the node's parent is in a mode without it. */
623
+ active: boolean;
624
+ /**
625
+ * In a record, the stage of each field it holds, by the field's strategy:
626
+ * a block (`kinetics`, `alpha`…) is read at birth, but its `maxVelocity`
627
+ * is read in the tick, and so is a Linked or modulated value.
628
+ */
629
+ fields?: Record<string, OptionStage>;
630
+ }
631
+ /**
632
+ * The handle of one node of an instance: the pair (owner, path), which no
633
+ * change of strategy or mode invalidates. It holds nothing of the node: two
634
+ * handles of one path are two views of the same node, and what they read and
635
+ * write is the instance's overlay: one holder per node set, the playback's
636
+ * nodes and the emitter's fields included.
637
+ *
638
+ * `set` validates the whole config against what the instance runs, copies,
639
+ * clips with a warning and freezes it, and takes effect the
640
+ * next time the engine reads the node. Without a change of shape it
641
+ * rebuilds only the unit that holds the node. Never in the tick.
642
+ *
643
+ * Built by `option(path)` of the playback, an emitter or a layer. It carries
644
+ * the generation of the playback that handed it out: once
645
+ * that playback is over, `set`, `reset` and the rest change nothing and say
646
+ * so, by the animation's diagnostics policy, even if the instance has a new
647
+ * owner by then. What it reads is the instance's, as it is.
648
+ */
649
+ declare class ParameterHandle<T> {
650
+ /** The node's path from its owner, as `option` was given it. */
651
+ readonly path: string;
652
+ /** Built by the engine; a host gets it from `option(path)` of a playback, an emitter or a layer. */
653
+ private constructor();
654
+ /** The kind of node this handle points at: a value, a composite, a record or a constant. */
655
+ get kind(): OptionNodeKind;
656
+ /** false while its parent is in a mode without this node: then `get`, `set` and `current` throw. */
657
+ get active(): boolean;
658
+ /** Whether the instance sets this node, or a node that holds it or that it holds. */
659
+ get overridden(): boolean;
660
+ /** Always `false`: only a local, through `param(id)`, is pinned. */
661
+ get pinned(): boolean;
662
+ /**
663
+ * The value in force, in a node of the playback or an emitter: the number
664
+ * or label of a Fixed or constant node, what a drawn or Linked value
665
+ * holds now (`spawnRate`…). `undefined` in a layer, whose values are each
666
+ * particle's, and in a node that is not a number nor a label.
667
+ */
668
+ get current(): number | string | undefined;
669
+ /** A copy of the config in force: the instance's, or the data's. */
670
+ get(): T;
671
+ /**
672
+ * The node's whole config, in the shape of the format. Validated
673
+ * against what the instance runs before anything changes: a rejected one
674
+ * throws a `PerseonConfigError` and leaves the instance as it was.
675
+ */
676
+ set(config: T | number | string): void;
677
+ /**
678
+ * Take the node back to the data: drop what the instance set at
679
+ * it and under it. A node it holds through a node above it (a field of a
680
+ * block set whole) takes the data's value there. On a node never set, or
681
+ * inactive, it does nothing.
682
+ */
683
+ reset(): void;
684
+ /** Describe the node: its kind, the stage the engine reads it at, its strategy and mode, and whether the instance overrides it. */
685
+ describe(): ParameterDescription;
686
+ }
687
+
688
+ /** Translation of the emission coordinates. */
689
+ interface EmissionTransform {
690
+ /** Offset added to the horizontal origin of what is born afterwards. */
691
+ x: number;
692
+ /** Offset added to the vertical origin of what is born afterwards. */
693
+ y: number;
694
+ }
695
+
696
+ /**
697
+ * One layer of an emitter of a playback, as the host sees it: the
698
+ * host's view of one layer of the emitter, made by the emitter the first time
699
+ * it is asked and kept there. It answers for its playback's generation, as the
700
+ * emitter does: once it is over, what it is asked to change does nothing and
701
+ * its counts are 0.
702
+ */
703
+ declare class ParticleLayerView {
704
+ /** Host-supplied id (`ParticleLayerOptions.id`); `undefined` when not given. */
705
+ readonly id: string | undefined;
706
+ /**
707
+ * How the layer's particles blend with what is behind them, as `ParticleLayerOptions.blendMode` declared;
708
+ * fixed for the playback.
709
+ */
710
+ readonly blendMode: ParticleBlendMode;
711
+ /** Built by the engine; a host gets it from `Emitter.layers`. */
712
+ private constructor();
713
+ /** Draw order among the layers of its emitter; higher draws on top. */
714
+ get zIndex(): number;
715
+ /** Set the draw order among the layers of its emitter. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
716
+ set zIndex(value: number);
717
+ /**
718
+ * Whether this layer is drawn; drawn only while its emitter is drawn too.
719
+ * Hidden, it still spawns, simulates, counts and fires its events.
720
+ * Starts as `ParticleLayerOptions.visible` and goes back to it in the pool.
721
+ */
722
+ get visible(): boolean;
723
+ /** Show or hide this layer; a hidden layer still spawns and simulates. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
724
+ set visible(value: boolean);
725
+ /** Live particles spawned from this layer; 0 once its playback is over. */
726
+ get aliveCount(): number;
727
+ /** Particles currently drawn by this layer; 0 once its playback is over. */
728
+ get size(): number;
729
+ /**
730
+ * The handle of one of this layer's nodes, by its
731
+ * path from the layer: `'alpha.value'`, `'kinetics.position'`. It answers
732
+ * for this view's playback.
733
+ */
734
+ option<P extends LayerOptionPath>(path: P): ParameterHandle<LayerOptionType<P>>;
735
+ /**
736
+ * This layer's emission transform: added, with its
737
+ * emitter's and the playback's, to where each of its particles is born. The same
738
+ * object every time it is asked.
739
+ */
740
+ get transform(): EmissionTransform;
741
+ }
742
+
743
+ /**
744
+ * One emitter of a playback, as the host sees it: the host's view
745
+ * of one emitter of the playback, made by the playback the first time it is
746
+ * asked and kept there. It answers for that playback's generation: once the
747
+ * playback is over, what it is asked to change does nothing and says so, as
748
+ * the playback does, and what it reads of the session answers for the
749
+ * generation that ended (not emitting, finished, no particles). What it reads
750
+ * of its shape and config is the emitter's, as it is.
751
+ *
752
+ * It only stands between the host and the emitter: the tick never goes
753
+ * through it.
754
+ */
755
+ declare class EmitterView {
756
+ /** Host-supplied id (`EmitterOptions.id`); `undefined` when not given. */
757
+ readonly id: string | undefined;
758
+ /** Built by the engine; a host gets it from `PerseonPlayback.emitters` or `getEmitter(id)`. */
759
+ private constructor();
760
+ /** The playback this view belongs to. */
761
+ get playback(): PerseonPlayback;
762
+ /** Whether the emission is open. Setting it opens or closes it; set from inside an update, it applies when that tick ends. */
763
+ get spawn(): boolean;
764
+ /** Open or close the emission. Called from inside an update, it takes effect when that tick ends. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
765
+ set spawn(value: boolean);
766
+ /** Particles of a burst, born in one frame. 0 when the emitter emits at a rate instead. Read at the next cycle. */
767
+ get spawnCount(): number;
768
+ /** Set the number of particles of a burst. Read at the next cycle. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
769
+ set spawnCount(value: number);
770
+ /** Particles per second while a rate emission runs. 0 means no rate emission. */
771
+ get spawnRate(): number;
772
+ /** Set the particles per second of a rate emission; 0 means no rate emission. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
773
+ set spawnRate(value: number);
774
+ /** Seconds a rate emission lasts per cycle; 0 means it never ends. */
775
+ get spawnDuration(): number;
776
+ /** Set the seconds a rate emission lasts per cycle; 0 means it never ends. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
777
+ set spawnDuration(value: number);
778
+ /** Seconds the emitter waits after a session starts before it begins to emit. */
779
+ get startDelay(): number;
780
+ /** Set the seconds the emitter waits after a session starts before it begins to emit. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
781
+ set startDelay(value: number);
782
+ /** How many times the emission cycle repeats after the first. The highest value allowed means forever. */
783
+ get repeat(): number;
784
+ /** Set how many times the emission cycle repeats after the first; the highest value allowed means forever. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
785
+ set repeat(value: number);
786
+ /** Seconds between the end of one emission cycle and the start of the next. */
787
+ get repeatInterval(): number;
788
+ /** Set the seconds between the end of one emission cycle and the start of the next. Read when the next cycle is armed. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
789
+ set repeatInterval(value: number);
790
+ /** Seconds of simulation run when a session starts (warm-up), so the emitter begins already populated. Capped by `effectiveWarmUpMaxTicks`. */
791
+ get simulateTime(): number;
792
+ /** Set the seconds of simulation run as warm-up when a session starts. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
793
+ set simulateTime(value: number);
794
+ /** Minimum number of live particles to have once the warm-up ends; the emitter spawns up to it, within `maxPoolSize`. */
795
+ get ensureAliveCount(): number;
796
+ /** Set the minimum number of live particles the emitter spawns up to once the warm-up ends. Read when the next session starts. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
797
+ set ensureAliveCount(value: number);
798
+ /** Shortcut of `option('capacity.maxAlive')`, read at the next birth. */
799
+ get maxPoolSize(): number;
800
+ /** Set the maximum number of live particles of the emitter; read at the next birth. A value that is not a finite number throws a `PerseonConfigError`; one out of its domain is clipped, with a warning. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
801
+ set maxPoolSize(value: number);
802
+ /** Shortcut of `option('capacity.limitStrategy')`, read at the next birth. */
803
+ get particleLimitStrategy(): ParticleLimitStrategy;
804
+ /** Set what happens when the emitter is at its particle limit; read at the next birth. A value that is not one of the strategies throws a `PerseonConfigError`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
805
+ set particleLimitStrategy(value: ParticleLimitStrategy);
806
+ /** Shortcut of `option('emission.spawnStrategy')`, read at the next birth. */
807
+ get particleSpawnStrategy(): ParticleSpawnStrategy;
808
+ /** Set where a new particle is drawn among the live ones of its layer; read at the next birth. A value that is not one of the strategies throws a `PerseonConfigError`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
809
+ set particleSpawnStrategy(value: ParticleSpawnStrategy);
810
+ /**
811
+ * Warm-up tick budget: the animation's is the default and the ceiling.
812
+ * Only `undefined` inherits it; the getter gives what was assigned, or
813
+ * `undefined` when inheriting.
814
+ */
815
+ get warmUpMaxTicks(): number | undefined;
816
+ /** The warm-up tick budget in force: the lower of this emitter's and the animation's. */
817
+ get effectiveWarmUpMaxTicks(): number;
818
+ /** Set this emitter's warm-up tick budget, capped by the animation's. `undefined` inherits the animation's; any other value that is not a positive number is not applied and is reported by the diagnostics policy. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
819
+ set warmUpMaxTicks(value: number | undefined);
820
+ /** Simulation rate, like `warmUpMaxTicks`: the animation's is the default and the ceiling. */
821
+ get maxUpdateRate(): number | undefined;
822
+ /** The simulation rate in force: the lower of this emitter's and the animation's. */
823
+ get effectiveMaxUpdateRate(): number;
824
+ /** Set this emitter's simulation rate in steps per second, capped by the animation's. `undefined` inherits the animation's; any other value that is not a positive number is not applied and is reported by the diagnostics policy. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
825
+ set maxUpdateRate(value: number | undefined);
826
+ /** Whether the emission is open (`spawn`) while the playback is running; false once the playback is over. */
827
+ get isEmitting(): boolean;
828
+ /** Whether this emitter can never spawn again before a reset. */
829
+ get isExhausted(): boolean;
830
+ /** Whether it can never spawn again and nothing it spawned is alive. */
831
+ get isFinished(): boolean;
832
+ /** Live particles of this emitter, across all its layers; 0 once its playback is over. */
833
+ get numberOfParticles(): number;
834
+ /** Live particles spawned from the given particle-type id. 0 for unknown ids. */
835
+ getParticlesAliveById(particleId: string): number;
836
+ /** Its layers, in compiled order: views of this playback, the same objects every time. */
837
+ get layers(): readonly ParticleLayerView[];
838
+ /** A layer by its host-supplied id (`ParticleLayerOptions.id`), or `undefined` when unknown. */
839
+ getLayer(id: string): ParticleLayerView | undefined;
840
+ /**
841
+ * Re-sequence the draw order of this emitter's layers, bottom to top;
842
+ * layers left out keep their relative order after the listed ones.
843
+ */
844
+ setLayerOrder(layerIndices: number[]): void;
845
+ /**
846
+ * The handle of one of this emitter's nodes, by its
847
+ * path from the emitter: `'emission.rate'`, `'playback.startDelay'`. It
848
+ * answers for this view's playback.
849
+ */
850
+ option<P extends EmitterOptionPath>(path: P): ParameterHandle<EmitterOptionType<P>>;
851
+ /** Whether this emitter (and its layers) are drawn. */
852
+ get visible(): boolean;
853
+ /** Show or hide this emitter and its layers. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
854
+ set visible(value: boolean);
855
+ /**
856
+ * This emitter's emission transform: added, with its layer's and the
857
+ * playback's, to where each of its particles is born. It moves no node and
858
+ * no live particle. The same object every time it is asked.
859
+ */
860
+ get transform(): EmissionTransform;
861
+ }
862
+
863
+ /**
864
+ * What every integration is, minus the host.
865
+ *
866
+ * `@silentstatestudio/perseon/pixi-v8` and `@silentstatestudio/perseon/pixi-v7` each export a `Perseon` — same name, one
867
+ * import path apart — and both are this class plus a constructor that turns
868
+ * their host's objects into a renderer. That split is the whole argument for a
869
+ * class per integration: what a host needs cannot be unified without lying
870
+ * (Pixi hands over a ticker, Three has none and steps the world itself, Canvas
871
+ * 2D has a context and no scene graph at all), while what happens above the
872
+ * renderer is identical everywhere and belongs here, once.
873
+ *
874
+ * So a backend is an `IRenderer` plus a constructor. Everything below — pooling,
875
+ * seeding, the single frame callback, teardown — comes for free, and none of it
876
+ * can drift between backends.
877
+ *
878
+ * The ticker is optional for the same reason. Given one, every playback shares a
879
+ * single subscription to it; given none, they share the renderer's. A host that
880
+ * does not run on a Pixi ticker, and steps the world from its own loop, passes an
881
+ * `ITicker` of its own and calls its listeners with each frame's delta.
882
+ */
883
+ declare class PerseonIntegration<TParent = unknown> {
884
+ /**
885
+ * The renderer every animation is built with. Public because a host that
886
+ * needs the layer below — resolving a texture by hand, dropping the texture
887
+ * cache after republishing an atlas, or driving a `PerseonPlayback` of its
888
+ * own, as the editor does — should not have to build a second one.
889
+ */
890
+ readonly renderer: IRenderer<TParent>;
891
+ /**
892
+ * Build an integration over a renderer. Backends call this from their own constructor; a host rarely does.
893
+ *
894
+ * @param renderer the backend, built by the integration from its host's own
895
+ * objects.
896
+ * @param ticker the host's frame source. Optional because the renderer
897
+ * usually carries it already; pass one only to override that.
898
+ *
899
+ * Whether an integration is manual is therefore decided by the **renderer**,
900
+ * which is where the answer actually lives — a Pixi adapter has a ticker, a
901
+ * Three one does not. Deciding it by whether this argument was passed would
902
+ * make a backend author who simply forgot it end up with animations that
903
+ * mount, never advance and report nothing wrong.
904
+ * @param diagnostics what a recoverable misuse (an unresolved source, a
905
+ * clip, a stale handle) does: `'warn'` prints it once per animation,
906
+ * `'throw'` turns it into an error, `'silent'` drops it. `'warn'` by default.
907
+ */
908
+ constructor(renderer: IRenderer<TParent>, ticker?: ITicker, diagnostics?: DiagnosticsPolicy);
909
+ /** Every animation created here and not destroyed. */
910
+ get animations(): readonly PerseonAnimation<TParent>[];
911
+ /**
912
+ * The ticker handed to every playback: one subscription to the host's frame
913
+ * source, fanned out in order. It only listens while something is playing.
914
+ */
915
+ get ticker(): ITicker;
916
+ /** Whether `destroy()` has run. */
917
+ get isDestroyed(): boolean;
918
+ /**
919
+ * Compile one animation config, ready to be played. This is the expensive
920
+ * call — it walks and validates the whole option tree — so it belongs with
921
+ * asset loading, not with the impact that needs the explosion.
922
+ */
923
+ createAnimation(options: ParticleAnimationOptions): PerseonAnimation<TParent>;
924
+ /**
925
+ * The game's value of the global `id` for every animation that declares
926
+ * it, before or after this call. Each one
927
+ * reads it clipped to the domain IT declares (a label, as its index
928
+ * there) from its next tick on. A label an animation does not declare,
929
+ * or a value of the other type (a label for a number global, a number for
930
+ * a label one), leaves that animation's global at its `value`, and that
931
+ * animation says so, once per global.
932
+ *
933
+ * Meant for every frame: nothing is allocated once `id` was set. An id no
934
+ * live animation declares is kept for the animations that come, and not
935
+ * told: who reads the game's state is not the game's business. A number that is not finite throws a `PerseonConfigError`.
936
+ */
937
+ setGlobalParameter(id: string, value: number | string): void;
938
+ /**
939
+ * What the game set for the global `id`, as it set it (not clipped: each
940
+ * animation clips to its own domain), or `undefined` until it does.
941
+ */
942
+ getGlobalParameter(id: string): number | string | undefined;
943
+ /**
944
+ * Listen to an event of every playback of every animation created here,
945
+ * before or after this call: `listener` is handed one
946
+ * `PerseonEvent`, whose `target` and `animation` say who fired it, after
947
+ * the listeners of the playback and of the animation.
948
+ *
949
+ * The name is not checked: an animation that declares it may come later,
950
+ * and a name no animation fires never reaches the listener.
951
+ *
952
+ * @returns an unsubscribe function, which takes out this registration and
953
+ * no other: the same function registered twice is two registrations.
954
+ */
955
+ on(eventName: string, listener: (event: PerseonEvent) => void): Unsubscribe;
956
+ /**
957
+ * Tear the integration down: every animation, every playback of each, the
958
+ * frame subscription and the renderer's own resources. The host's ticker is
959
+ * the host's and is left running.
960
+ */
961
+ destroy(): void;
962
+ }
963
+
964
+ /**
965
+ * What a host passes to a playback it builds without a pool: the `Perseon` whose globals it reads. Without it, every global holds
966
+ * the `value` its config declares.
967
+ */
968
+ interface PlaybackHost {
969
+ /**
970
+ * A `Perseon` (or `PerseonIntegration`) of any parent type: the playback
971
+ * reads only its globals, the values `setGlobalParameter` sets on it. Any
972
+ * other object has none to read: the playback says so through the
973
+ * diagnostics, and every global holds the `value` its config declares.
974
+ */
975
+ globals?: Pick<PerseonIntegration, 'setGlobalParameter' | 'getGlobalParameter'>;
976
+ }
977
+ /**
978
+ * One playback of an animation, as the host holds it: the handle of one
979
+ * generation of an instance the animation pools, with the surface a playback
980
+ * has always had.
981
+ *
982
+ * `animation.play()` and `prepare()` hand out a new one each time. When its
983
+ * instance goes back to the pool (the natural end with `autoRelease`, or
984
+ * `release()`) or is destroyed, the
985
+ * generation of the instance goes up and this handle is over: `alive` is
986
+ * `false`, and whatever is asked of it — or of what it handed out: its
987
+ * `param` and `option` handles, its emitter and layer views, its
988
+ * `Unsubscribe`s — does nothing and says so by the animation's diagnostics
989
+ * policy (`'warn'` once, `'throw'`, `'silent'`). So a late `stop()` cannot
990
+ * stop whoever plays the instance next. What it reads of the session answers
991
+ * for its own generation, which ended: not running, not paused, not
992
+ * emitting, finished, no particles, and `finished` resolved with how it
993
+ * ended. What it reads of its shape and config (`emitters`, `seed`, the
994
+ * forces…) is silent and is the instance's as it is now.
995
+ *
996
+ * A host with no pool builds one directly, as it always could:
997
+ *
998
+ * ```ts
999
+ * const playback = new PerseonPlayback(options, renderer)
1000
+ * ```
1001
+ *
1002
+ * That instance has no pool, so nothing takes it back: its generation is
1003
+ * fixed, it is `alive` until `destroy()`, and what it was set survives
1004
+ * `reset()`, `stop()` and the natural end, which leaves it stopped for
1005
+ * `start()` to play it again. Given `{ globals: perseon }`, it
1006
+ * reads the globals the game sets on that `Perseon`, live:
1007
+ *
1008
+ * ```ts
1009
+ * const playback = new PerseonPlayback(options, renderer, ticker, { globals: perseon })
1010
+ * ```
1011
+ *
1012
+ * The tick runs on the instance, never through the handle: the handle only
1013
+ * stands between the host and the instance.
1014
+ */
1015
+ declare class PerseonPlayback {
1016
+ /**
1017
+ * Build a playback of its own, with no pool: it is `alive` until it is destroyed, by `destroy()` or by `release()`.
1018
+ *
1019
+ * @param config the animation — pure configuration, straight from a scene
1020
+ * file. Holds no live object.
1021
+ * @param renderer the host's renderer, which the animation cannot carry
1022
+ * because it is host infrastructure rather than configuration.
1023
+ * @param ticker optional override. When omitted the renderer's own ticker
1024
+ * drives the playback, which is what a host wants unless it runs the
1025
+ * simulation from its own game loop.
1026
+ * @param host the `Perseon` whose globals it reads (`{ globals }`); without
1027
+ * it, every global holds the `value` its config declares.
1028
+ */
1029
+ constructor(config: ParticleAnimationOptions, renderer: IRenderer, ticker?: ITicker, host?: PlaybackHost);
1030
+ /**
1031
+ * `false` once its instance went back to the pool or was destroyed: from
1032
+ * then on whatever is asked of this playback does nothing.
1033
+ */
1034
+ get alive(): boolean;
1035
+ /** The renderer this playback draws with: its `Perseon`'s, or the one passed to `new PerseonPlayback`. */
1036
+ get renderer(): IRenderer;
1037
+ /**
1038
+ * The handle of one of this playback's nodes, by
1039
+ * its path from the playback: `'externalForces.gravity'`,
1040
+ * `'pointForces.toCounter.position'`, `'regions.water.area'`. Throws a
1041
+ * `PerseonConfigError` for a path a playback does not have. It answers for
1042
+ * this playback: once it is over, it changes nothing.
1043
+ */
1044
+ option<P extends PlaybackOptionPath>(path: P): ParameterHandle<PlaybackOptionType<P>>;
1045
+ /**
1046
+ * The handle of one of the animation's locals in this playback:
1047
+ * `set(number | label)` pins its value, `set(config)`
1048
+ * substitutes its strategy, `reset()` goes back to the template's default
1049
+ * or to the data. Throws a `PerseonConfigError` for an id that is not a
1050
+ * local. It answers for this playback: once it is over, it changes nothing.
1051
+ */
1052
+ param(id: string): LocalParameterHandle;
1053
+ /**
1054
+ * Every emitter of the animation, in declaration order: views of this
1055
+ * playback, the same objects every time it is asked.
1056
+ */
1057
+ get emitters(): readonly EmitterView[];
1058
+ /** An emitter by its host-supplied id, or `undefined` when unknown. */
1059
+ getEmitter(id: string): EmitterView | undefined;
1060
+ /** Live particles across every emitter; 0 once the playback is over. */
1061
+ get numberOfParticles(): number;
1062
+ /** Live particles spawned from the given particle-type id, across every emitter; 0 once it is over. */
1063
+ getParticlesAliveById(particleId: string): number;
1064
+ /** The playback's seed, or `undefined` when it was not given one. */
1065
+ get seed(): number | undefined;
1066
+ /** Total simulated time in seconds. */
1067
+ get elapsedTotal(): number;
1068
+ /** Simulation rate of the whole animation, and the ceiling of every emitter's. */
1069
+ get maxUpdateRate(): number;
1070
+ /** Set the animation's simulation rate, in steps per second. A value that is not a positive number is not applied and is reported by the diagnostics policy; use `Infinity` for no limit. Positive values are clipped to 1–1,000,000, so `Infinity` reads back as 1,000,000. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1071
+ set maxUpdateRate(value: number);
1072
+ /**
1073
+ * The factor of this playback's simulated step, 1 by
1074
+ * default: 0.2 is bullet time, 0 freezes it without pausing. The gate of
1075
+ * `maxUpdateRate` counts real time. Throws a `PerseonConfigError` for a
1076
+ * negative or non-finite value, also in `play`/`prepare`.
1077
+ */
1078
+ get timeScale(): number;
1079
+ /** Set the factor of the simulated step: 1 is real time, 0 freezes the simulation without pausing it. Throws a `PerseonConfigError` for a negative or non-finite value. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1080
+ set timeScale(value: number);
1081
+ /** Warm-up tick budget of the animation: the default and the ceiling of every emitter's. */
1082
+ get warmUpMaxTicks(): number;
1083
+ /** Set the animation's warm-up tick budget. A value that is not a positive number is not applied and is reported by the diagnostics policy. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1084
+ set warmUpMaxTicks(value: number);
1085
+ /**
1086
+ * Whether its instance goes back to the pool at its natural end. `play()` brings it at `true`: fire and forget. `prepare()` at
1087
+ * `false`: the playback is the game's, and at its natural end it is left
1088
+ * stopped (`isRunning` false, `isFinished` true), still alive, and
1089
+ * `start()` plays it again as a new session; it goes back with
1090
+ * `release()`, or by setting this to `true`, which gives it back in the
1091
+ * act if it is already stopped at its end. A `stop()` is the host's and
1092
+ * never gives it back. One built with `new PerseonPlayback` has no pool:
1093
+ * it is `false`, and its natural end always leaves it stopped.
1094
+ */
1095
+ get autoRelease(): boolean;
1096
+ /** Choose whether the instance goes back to the pool at its natural end. Setting `true` on a playback already stopped at its natural end gives it back immediately. A playback with no pool (built with `new PerseonPlayback`) has nowhere to go back to. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1097
+ set autoRelease(value: boolean);
1098
+ /** Whether its session is running; `false` once the playback is over. */
1099
+ get isRunning(): boolean;
1100
+ /** Whether its session is paused; `false` once the playback is over. */
1101
+ get isPaused(): boolean;
1102
+ /**
1103
+ * Put this animation under a container of the host's own graph, or move it
1104
+ * to another one. Nothing is drawn until it is mounted somewhere.
1105
+ */
1106
+ mount(parent: unknown): void;
1107
+ /** Detach without destroying. */
1108
+ unmount(): void;
1109
+ /** Position of the whole animation within its parent. */
1110
+ get x(): number;
1111
+ /** Move the whole animation horizontally within its parent. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1112
+ set x(value: number);
1113
+ /** Vertical position of the whole animation within its parent, like `x`. */
1114
+ get y(): number;
1115
+ /** Move the whole animation vertically within its parent. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1116
+ set y(value: number);
1117
+ /**
1118
+ * The playback's emission transform: added to where every
1119
+ * particle of the animation is born, without moving any node or any live
1120
+ * particle. `x`/`y` place the node; this moves only the origin of what is
1121
+ * born afterwards, which is what a trail writes every frame. The
1122
+ * same object every time it is asked.
1123
+ */
1124
+ get transform(): EmissionTransform;
1125
+ /** Hide or show the whole animation. Hiding does not pause the simulation. */
1126
+ get visible(): boolean;
1127
+ /** Hide or show the whole animation; hiding does not pause the simulation. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1128
+ set visible(value: boolean);
1129
+ /** Whether `destroy()` has run on its instance. */
1130
+ get isDestroyed(): boolean;
1131
+ /** Whether any emitter is currently emitting; `false` once the playback is over. */
1132
+ get isEmitting(): boolean;
1133
+ /**
1134
+ * Whether the animation has run its course: no emitter can emit again and
1135
+ * nothing spawned is still alive. `true`
1136
+ * once the playback is over: its generation ended.
1137
+ */
1138
+ get isFinished(): boolean;
1139
+ /**
1140
+ * Subscribe to the end of a play session of this playback, told with its
1141
+ * `reason`: `'completed'`, `'stopped'`, `'released'`, `'destroyed'` or
1142
+ * `'hostDestroyed'`. Only the ends of this playback's generation reach it.
1143
+ *
1144
+ * @returns an unsubscribe function, which takes out this registration and
1145
+ * no other — never the same function registered by a later owner of the
1146
+ * instance. Calling it once the playback is over is harmless.
1147
+ */
1148
+ onFinished(listener: (result: PlaybackFinishedResult) => void): () => void;
1149
+ /**
1150
+ * The end of this play session, as something a host can `await`. It
1151
+ * resolves and never rejects, with the `{ reason }` the `onFinished`
1152
+ * listeners are told. Once the playback is
1153
+ * over it stays resolved with how its generation ended, whoever plays the
1154
+ * instance afterwards.
1155
+ */
1156
+ get finished(): Promise<PlaybackFinishedResult>;
1157
+ /** Gravitational acceleration applied to the particles whose layer declares a gravity factor. */
1158
+ get gravity(): number;
1159
+ /** Set the gravitational acceleration; a shortcut of `option('externalForces.gravity').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1160
+ set gravity(value: number);
1161
+ /** Movement damping that opposes the particles' velocity, for the layers that declare a damping factor. */
1162
+ get damping(): number;
1163
+ /** Set the movement damping; a shortcut of `option('externalForces.damping').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1164
+ set damping(value: number);
1165
+ /** `damping` scaled to the constant the physics step integrates with; read-only. */
1166
+ get dampingCoefficient(): number;
1167
+ /** A copy: writing to it does not change the wind. */
1168
+ get wind(): PointValue;
1169
+ /** Set the wind from a point; a shortcut of `option('externalForces.wind').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1170
+ set wind(value: PointValue);
1171
+ /** A copy, like `wind`. */
1172
+ get windVector(): VectorValue;
1173
+ /** Set the wind from a vector (angle and magnitude); a shortcut of `option('externalForces.wind').set`. Once the playback is over (`alive` is false), it does nothing and is reported by the diagnostics policy. */
1174
+ set windVector(value: VectorValue);
1175
+ /** Strength of the wind, the `magnitude` of `windVector`; read-only, set it through `windVector`. */
1176
+ get windMagnitude(): number;
1177
+ /** Direction of the wind in radians, the `angle` of `windVector`; read-only, set it through `windVector`. */
1178
+ get windAngle(): number;
1179
+ /** Register a point force, or put it over the one with its id: a shortcut of `set` on `pointForces.<id>`. */
1180
+ addPointForce(config: PointForceConfig): void;
1181
+ /** Patch a point force by id: the patch is merged with the force and the whole of it is `set`. */
1182
+ updatePointForce(id: string, patch: Partial<Omit<PointForceConfig, 'id'>>): void;
1183
+ /** Remove a point force from this instance. No-op for unknown ids. */
1184
+ removePointForce(id: string): void;
1185
+ /** Snapshot of all registered point forces (enabled and disabled). */
1186
+ getPointForces(): PointForceConfig[];
1187
+ /** A single point force config by id, or `undefined` when unknown. */
1188
+ getPointForce(id: string): PointForceConfig | undefined;
1189
+ /** Register a region, or put it over the one with its id: a shortcut of `set` on `regions.<id>`. */
1190
+ addRegion(region: RegionOptions): void;
1191
+ /** Ids of every declared region. */
1192
+ get regionIds(): Set<string>;
1193
+ /**
1194
+ * Listen to an event of this playback: `listener` is
1195
+ * handed one `PerseonEvent`, synchronously, at the point of the loop where
1196
+ * the trigger happens, before the listeners of its animation and of
1197
+ * `Perseon`. The listeners of a playback stay through `stop()` and
1198
+ * `reset()` and go when its instance goes back to the pool.
1199
+ *
1200
+ * Throws for a name the playback does not register (`getEventNames()`),
1201
+ * whatever the diagnostics policy: a typo would otherwise listen forever
1202
+ * to nothing.
1203
+ *
1204
+ * @returns an unsubscribe function, which takes out this registration and
1205
+ * no other: the same function registered twice is two registrations. Once
1206
+ * the playback is over it does nothing and says so by the diagnostics
1207
+ * policy.
1208
+ */
1209
+ on(eventName: string, listener: (event: PerseonEvent) => void): Unsubscribe;
1210
+ /** Whether `eventName` is registered and can therefore fire. */
1211
+ hasEvent(eventName: string): boolean;
1212
+ /** Register an event name. Idempotent; blank names are ignored. */
1213
+ addEventName(eventName: string): void;
1214
+ /**
1215
+ * Unregister an event name and drop its listeners.
1216
+ * @returns whether the name was registered.
1217
+ */
1218
+ removeEventName(eventName: string): boolean;
1219
+ /** Registered event names. */
1220
+ getEventNames(): string[];
1221
+ /**
1222
+ * Start a play session: every emitter is armed, the declared warm-up is
1223
+ * simulated, and the ticker is connected. The second step of `play`, after
1224
+ * `animation.prepare()`. On a paused playback it resumes
1225
+ * it where it was; on one already running it does nothing, and says so.
1226
+ * @param emit whether emitters open their emission immediately; `true` by
1227
+ * default, as in `play`. Pass a predicate to decide per emitter. It only
1228
+ * counts when the session begins from stopped: on a paused playback,
1229
+ * also one a `reset()` left clean, each emitter keeps its `spawn` as it
1230
+ * is, as a `reset()` while running does.
1231
+ */
1232
+ start(emit?: boolean | ((emitter: EmitterView) => boolean)): void;
1233
+ /** Pause a running session: the simulation stops where it is and `start()` resumes it. */
1234
+ pause(): void;
1235
+ /**
1236
+ * Stop the animation, clear its session and tell its end as `'stopped'`.
1237
+ * The playback stays the host's: the pool does not take it back.
1238
+ */
1239
+ stop(): void;
1240
+ /**
1241
+ * Start the session over without ending it: running it goes on, paused it
1242
+ * stays paused, stopped it is only cleared. Keeps what was set on the
1243
+ * playback.
1244
+ */
1245
+ reset(): void;
1246
+ /**
1247
+ * Hand the instance back to its pool in the act, telling its end as
1248
+ * `'released'`; asked from its own tick, at the end of it. One built with `new PerseonPlayback` has
1249
+ * no pool to go back to and its host is its only owner: it is destroyed,
1250
+ * with a diagnostic.
1251
+ */
1252
+ release(): void;
1253
+ /**
1254
+ * Destroy the instance. Once it is destroyed, destroying it again does
1255
+ * nothing, as it always did.
1256
+ */
1257
+ destroy(): void;
1258
+ }
1259
+
1260
+ /** What an animation tells of itself; each list is a copy. */
1261
+ interface AnimationDescription {
1262
+ /** The global parameters the animation declares. */
1263
+ globalParameters: GlobalParameterOption[];
1264
+ /** The locals as declared, with the `sampleScope` resolved and the template's default as `value`. */
1265
+ localParameters: (CustomParameterOption & {
1266
+ /** Where the local is sampled; `'playback'` when the declaration leaves it out. */
1267
+ sampleScope: CustomParameterSampleScope;
1268
+ })[];
1269
+ /** The event names the animation declares. */
1270
+ events: string[];
1271
+ /** The emitters in declaration order. */
1272
+ emitters: {
1273
+ /** Host-supplied id of the emitter; `undefined` when not given. */
1274
+ id: string | undefined;
1275
+ /** The emitter's layers, in declaration order. */
1276
+ layers: {
1277
+ /** Host-supplied id of the layer; `undefined` when not given. */
1278
+ id: string | undefined;
1279
+ }[];
1280
+ }[];
1281
+ /** The ids of the point forces the animation declares. */
1282
+ pointForces: string[];
1283
+ /** The ids of the regions the animation declares. */
1284
+ regions: string[];
1285
+ }
1286
+
1287
+ /** The half of `AnimationPlayOptions` every host shares. */
1288
+ interface AnimationPlacementOptions {
1289
+ /** Position within `parent`. Both default to 0. */
1290
+ x?: number;
1291
+ y?: number;
1292
+ /**
1293
+ * Whether every emitter opens its emission immediately. Default `true`: an
1294
+ * animation played and then sitting still just looks broken. The editor is
1295
+ * the case that wants `false`, gating emission from its own panel. Only
1296
+ * `play` reads it: after `prepare`, `start(emit)` decides.
1297
+ */
1298
+ emit?: boolean;
1299
+ /**
1300
+ * The seed of this playback: the same seed with the
1301
+ * same customization gives the same sequence, whether the instance is new
1302
+ * or recycled. By default, the one the animation derives for each play.
1303
+ */
1304
+ seed?: number;
1305
+ /**
1306
+ * The values of its locals for this playback, by id: each
1307
+ * one pins its local, as `playback.param(id).set(value)` does, on top of
1308
+ * the template's defaults. A number is clipped to the local's domain; a
1309
+ * label is one the local declares.
1310
+ */
1311
+ params?: Record<string, number | string>;
1312
+ /**
1313
+ * The emission transform of this playback, as
1314
+ * `playback.transform` takes it: added to where every particle is born,
1315
+ * without moving the node (that is `x`/`y`). An axis left out is 0.
1316
+ */
1317
+ transform?: {
1318
+ x?: number;
1319
+ y?: number;
1320
+ };
1321
+ /**
1322
+ * The factor of the simulated step of this playback, as
1323
+ * `playback.timeScale` takes it. Default 1.
1324
+ */
1325
+ timeScale?: number;
1326
+ /**
1327
+ * Whether the instance goes back to the pool at its natural end, as
1328
+ * `playback.autoRelease` takes it. Default `true` in `play`
1329
+ * (fire and forget) and `false` in `prepare` (the playback is the game's:
1330
+ * left stopped at its end, `start()` plays it again, `release()` gives it
1331
+ * back).
1332
+ */
1333
+ autoRelease?: boolean;
1334
+ }
1335
+ /**
1336
+ * Whether this host's containers may be `undefined` — which is how a backend
1337
+ * with no scene graph at all (a Canvas 2D one, say) declares itself:
1338
+ * `IRenderer<undefined>`. There is nothing to mount under, so writing
1339
+ * `parent: undefined` at every call site would be ceremony, and the key is
1340
+ * optional instead.
1341
+ *
1342
+ * `unknown` is excluded deliberately: it means "nobody typed this host", not
1343
+ * "this host has no parent", and dropping the requirement there would turn a
1344
+ * forgotten `parent` from a compile error into a crash on `mount`.
1345
+ */
1346
+ type HostMountsWithoutParent<TParent> = unknown extends TParent ? false : undefined extends TParent ? true : false;
1347
+ /**
1348
+ * Where and how one playback of an animation appears.
1349
+ *
1350
+ * `TParent` is the host's container type, carried over from the renderer the
1351
+ * animation was built with — a `Container` for the Pixi adapters. It defaults to
1352
+ * `unknown`, so a reference that does not care about the host stays valid
1353
+ * without an argument (same rule as `IRenderer`).
1354
+ */
1355
+ type AnimationPlayOptions<TParent = unknown> = AnimationPlacementOptions & (HostMountsWithoutParent<TParent> extends true ? {
1356
+ /** The host container this playback mounts under, if it has one. */
1357
+ parent?: TParent;
1358
+ } : {
1359
+ /** The host container this playback mounts under. */
1360
+ parent: TParent;
1361
+ });
1362
+ /**
1363
+ * One particle animation, compiled once and playable many times.
1364
+ *
1365
+ * This is the expensive object and the reusable one. Building it walks the whole
1366
+ * option tree and compiles every parameter into closures; playing it does not.
1367
+ * A game loads its animations when it loads its assets and then plays them for
1368
+ * free — one per thruster, one per impact — which is the whole reason the
1369
+ * compilation was separated from the playback.
1370
+ *
1371
+ * Playbacks are pooled. A one-shot needs no bookkeeping from the host:
1372
+ *
1373
+ * ```ts
1374
+ * explosion.play({ parent: world, x: hit.x, y: hit.y })
1375
+ * ```
1376
+ *
1377
+ * When it runs out it detaches, resets and goes back in the pool, so the next
1378
+ * impact reuses it. A long-lived one is held and stopped by the host instead:
1379
+ *
1380
+ * ```ts
1381
+ * const left = thruster.play({ parent: ship, x: -12, y: 8 })
1382
+ * left.stop()
1383
+ * ```
1384
+ *
1385
+ * A playback the host stopped is NOT reclaimed: `stop()` is the host taking
1386
+ * control of that object, and recycling it out from under the reference it
1387
+ * still holds is the classic pooling surprise. It stays parked and unmounted,
1388
+ * to be destroyed or kept by whoever stopped it. The same goes for
1389
+ * `play({ emit: false })` — an animation that never opened its emission never
1390
+ * runs out, so it is the host's to manage.
1391
+ *
1392
+ * The corollary for a one-shot: **the returned playback is yours only until it
1393
+ * finishes.** After that its instance belongs to the pool and may already be
1394
+ * playing somewhere else under another playback, so the one the host kept is
1395
+ * over (`alive` is `false`) and does nothing it is asked.
1396
+ *
1397
+ * A host that wants to keep one past its end, to play it again, takes it with
1398
+ * `prepare()` (or `play({ autoRelease: false })`) instead: at
1399
+ * its natural end it is left stopped and still the host's, `start()` plays it
1400
+ * again, and `release()` — or `autoRelease = true` — gives it back:
1401
+ *
1402
+ * ```ts
1403
+ * const shot = muzzle.prepare({ parent: gun })
1404
+ * shot.start() // and again at every shot
1405
+ * shot.release() // when the gun goes away
1406
+ * ```
1407
+ */
1408
+ declare class PerseonAnimation<TParent = unknown> {
1409
+ /**
1410
+ * An animation outside any integration, which a host plays and pools itself.
1411
+ * Usually it comes from `perseon.createAnimation(config)` instead, which
1412
+ * also gives it the integration's globals, listeners and diagnostics policy.
1413
+ *
1414
+ * @param config the animation — pure configuration, straight from a scene
1415
+ * file. Copied and frozen here; the host's object is not kept.
1416
+ * @param renderer the host's renderer, shared by every playback.
1417
+ * @param ticker optional override. When omitted the renderer's own ticker
1418
+ * drives every playback.
1419
+ */
1420
+ constructor(config: ParticleAnimationOptions, renderer: IRenderer<TParent>, ticker?: ITicker);
1421
+ /** The animation as it was declared: a frozen copy of the config it was built from. */
1422
+ get options(): ParticleAnimationOptions;
1423
+ /** Playbacks currently parked in the pool. */
1424
+ get idleCount(): number;
1425
+ /**
1426
+ * The playbacks in force of the instances that are not in the pool, in
1427
+ * the order the instances were built: the handles a host was given and
1428
+ * still owns. A new array at each read.
1429
+ */
1430
+ get playbacks(): readonly PerseonPlayback[];
1431
+ /** Whether `destroy()` has run. Mirrors `PerseonPlayback.isDestroyed`. */
1432
+ get isDestroyed(): boolean;
1433
+ /**
1434
+ * The default of one of its locals for the instances prepared after it:
1435
+ * `set(number | label)`, `get()` and `reset()`. Throws a
1436
+ * `PerseonConfigError` for an id that is not a local: a global is the
1437
+ * game's.
1438
+ */
1439
+ param(id: string): LocalDefaultHandle;
1440
+ /**
1441
+ * What this animation declares: globals, locals with
1442
+ * their `sampleScope`, events, emitters and layers, point forces and
1443
+ * regions. Copies of the data and of the template's defaults; nothing
1444
+ * of what an instance does.
1445
+ */
1446
+ describe(): AnimationDescription;
1447
+ /**
1448
+ * Play this animation: `prepare(options).start(options.emit ?? true)`,
1449
+ * with `autoRelease` at `true` unless `options` says
1450
+ * otherwise: at its natural end the instance goes back to the pool.
1451
+ */
1452
+ play(options: AnimationPlayOptions<TParent>): PerseonPlayback;
1453
+ /**
1454
+ * The first step of `play`: take an instance from the
1455
+ * pool (or build one), give it its seed, the template's defaults and
1456
+ * `params`, and put it where the host asked — without drawing anything or
1457
+ * starting the session. What the host customizes then is already there
1458
+ * when `start()` draws the session nodes and runs the warm-up. It returns
1459
+ * a new playback: the handle of this generation of the instance,
1460
+ * with `autoRelease` at `false` unless `options` says otherwise: the
1461
+ * playback is the game's, and at its natural end it is left stopped.
1462
+ *
1463
+ * A local in `params` that the animation does not declare, or a value it
1464
+ * rejects, or a `transform` that is not finite, or a `timeScale` that is negative or not finite, throws a
1465
+ * `PerseonConfigError` before any instance is taken.
1466
+ */
1467
+ prepare(options: AnimationPlayOptions<TParent>): PerseonPlayback;
1468
+ /**
1469
+ * Listen to an event of every playback of this animation:
1470
+ * `listener` is handed one `PerseonEvent`, whose `target` says
1471
+ * which playback fired it, after the listeners of that playback and
1472
+ * before those of `Perseon`. They stay while the animation lives: the pool
1473
+ * does not drop them.
1474
+ *
1475
+ * Throws for a name the animation does not declare
1476
+ * (`options.events`), whatever the diagnostics policy.
1477
+ *
1478
+ * @returns an unsubscribe function, which takes out this registration and
1479
+ * no other: the same function registered twice is two registrations.
1480
+ */
1481
+ on(eventName: string, listener: (event: PerseonEvent) => void): Unsubscribe;
1482
+ /**
1483
+ * Destroy every playback and forget the compilation. The renderer is the
1484
+ * host's and is left alone.
1485
+ */
1486
+ destroy(): void;
1487
+ }
1488
+
1489
+ /** A particle's binding of one registered event name to one of its triggers. */
1490
+ interface ParticleEventBinding {
1491
+ /** The particle lifecycle moment that fires the event. */
1492
+ particleTrigger: ParticleEventTrigger;
1493
+ }
1494
+ /** An emitter's binding of one registered event name to one of its triggers. */
1495
+ interface EmitterEventBinding {
1496
+ /** The emitter lifecycle moment that fires the event: `'onEmitStart'`, `'onEmitStop'` or `'onFinished'`. */
1497
+ emitterTrigger: EmitterEventTrigger;
1498
+ }
1499
+ /** `ParticleLayerOptions.events` — registered event name → the trigger that fires it. */
1500
+ type ParticleEventBindings = Record<string, ParticleEventBinding>;
1501
+ /** `EmitterOptions.eventBindings` — registered event name → the trigger that fires it. */
1502
+ type EmitterEventBindings = Record<string, EmitterEventBinding>;
1503
+ /**
1504
+ * What every listener of an event is handed, at every
1505
+ * level: the playback's (`pb.on`), the animation's (`animation.on`) and
1506
+ * `Perseon`'s (`perseon.on`). One object per event, the same for the three
1507
+ * levels; it holds nothing of the pool: `target` is the handle of the
1508
+ * generation that fired it, and the particle is a copy.
1509
+ */
1510
+ interface PerseonEvent {
1511
+ /** The registered name that fired. */
1512
+ readonly name: string;
1513
+ /** The trigger the name is bound to. */
1514
+ readonly trigger: ParticleEventTrigger | EmitterEventTrigger;
1515
+ /** The playback that fired it: the handle of its generation, over once that generation is. */
1516
+ readonly target: PerseonPlayback;
1517
+ /**
1518
+ * The animation the playback is of. `undefined` only for a playback a
1519
+ * host built with `new PerseonPlayback`, which is of none.
1520
+ */
1521
+ readonly animation: PerseonAnimation | undefined;
1522
+ /** The emitter, by its id and its declaration index. */
1523
+ readonly emitter: {
1524
+ /** The emitter's `id`; `undefined` if it declares none. */
1525
+ readonly id: string | undefined;
1526
+ /** Position of the emitter in the playback's declaration order, from 0. */
1527
+ readonly index: number;
1528
+ };
1529
+ /** The layer of the particle, by its id and its index in the emitter, in a particle trigger; `undefined` in an emitter trigger. */
1530
+ readonly layer: {
1531
+ /** The layer's `id`; `undefined` if it declares none. */
1532
+ readonly id: string | undefined;
1533
+ /** Position of the layer in its emitter, from 0. */
1534
+ readonly index: number;
1535
+ } | undefined;
1536
+ /** The region crossed, in `onRegionEnter` / `onRegionExit`; `undefined` otherwise. */
1537
+ readonly regionId: string | undefined;
1538
+ /** A copy of the particle taken at the trigger, in a particle trigger; `undefined` in an emitter trigger. */
1539
+ readonly particle: ParticleSnapshot | undefined;
1540
+ }
1541
+ /**
1542
+ * A copy of a particle taken at the trigger: numbers
1543
+ * only, so a listener can keep it without holding the pooled particle, which
1544
+ * is another particle's by the next birth.
1545
+ *
1546
+ * One per event, the same object for all its listeners, and read-only for
1547
+ * real: its fields are getters of a class, with no setter, so
1548
+ * assigning one throws a `TypeError` in strict mode. Being getters, they are
1549
+ * not own properties: `{ ...particle }` and `Object.keys` see none of them.
1550
+ * To copy the data, `event.particle.toObject()`; `JSON.stringify` works too
1551
+ * (`toJSON`). Either builds its object only when called: nothing per event.
1552
+ */
1553
+ interface ParticleSnapshot {
1554
+ /** Position in the space of the animation. */
1555
+ readonly x: number;
1556
+ /** Vertical position, in the same space as `x`. */
1557
+ readonly y: number;
1558
+ /** Position in the space of the playback's parent: `x + pb.x`, `y + pb.y`. */
1559
+ readonly parentX: number;
1560
+ /** Vertical position in the space of the playback's parent. */
1561
+ readonly parentY: number;
1562
+ /** Horizontal velocity, in pixels per second. */
1563
+ readonly velocityX: number;
1564
+ /** Vertical velocity, in pixels per second. */
1565
+ readonly velocityY: number;
1566
+ /** Rotation, in radians. */
1567
+ readonly rotation: number;
1568
+ /** Horizontal scale factor: 1 draws the texture at its own width. */
1569
+ readonly scaleX: number;
1570
+ /** Vertical scale factor: 1 draws the texture at its own height. */
1571
+ readonly scaleY: number;
1572
+ /** Opacity, from 0 (invisible) to 1 (opaque). */
1573
+ readonly alpha: number;
1574
+ /** Color multiplied over the texture, as a `0xRRGGBB` number. */
1575
+ readonly tint: number;
1576
+ /** How long the particle lives, in seconds. `Infinity` when none was set. */
1577
+ readonly lifetime: number;
1578
+ /** Seconds elapsed since the particle was born. */
1579
+ readonly currentLife: number;
1580
+ /** A new plain object with every field: a mutable copy, the caller's. */
1581
+ toObject(): ParticleSnapshotObject;
1582
+ /** The same as `toObject()`, so that `JSON.stringify` writes the fields. */
1583
+ toJSON(): ParticleSnapshotObject;
1584
+ }
1585
+ /** The fields of a `ParticleSnapshot` as a plain, mutable object (`toObject()`). */
1586
+ type ParticleSnapshotObject = {
1587
+ -readonly [K in Exclude<keyof ParticleSnapshot, 'toObject' | 'toJSON'>]: ParticleSnapshot[K];
1588
+ };
1589
+ /** Takes out the registration it was handed for, and no other. */
1590
+ type Unsubscribe = () => void;
1591
+ /**
1592
+ * Event names grouped by the trigger that fires them. Produced at compile time
1593
+ * so the hot loop tests `array.length` instead of walking a `Record` and
1594
+ * branching on a trigger string.
1595
+ */
1596
+ type ParticleEventsByTrigger = Record<ParticleEventTrigger, string[]>;
1597
+ /** Event names grouped by the emitter trigger that fires them, as `ParticleEventsByTrigger` does for particles. */
1598
+ type EmitterEventsByTrigger = Record<EmitterEventTrigger, string[]>;
1599
+
1600
+ /**
1601
+ * The uniform forces of a playback: gravity, damping and wind. A particle feels
1602
+ * each one only through the matching factor of its layer
1603
+ * (`ExternalForcesFactorOptions`).
1604
+ */
1605
+ interface ExternalForcesOptions {
1606
+ /** Global gravitational acceleration */
1607
+ gravity?: number;
1608
+ /** Global movement damping coefficient (opposes movement) */
1609
+ damping?: number;
1610
+ /** Global wind force applied to particles */
1611
+ wind?: VectorValue;
1612
+ }
1613
+ /** What a point force does to a particle in reach: `'attract'` pulls it toward the force, `'repel'` pushes it away. */
1614
+ type PointForceMode = 'attract' | 'repel';
1615
+ /**
1616
+ * How a point force's strength changes with distance inside its radius:
1617
+ * `'none'` keeps it constant, `'linear'` fades it from full at the center to
1618
+ * zero at the edge, `'smooth'` does the same along a smoothstep curve.
1619
+ */
1620
+ type PointForceFalloff = 'none' | 'linear' | 'smooth';
1621
+ /**
1622
+ * A reusable positional external force (attractor / repeller). Declared at
1623
+ * engine level (sibling of `regions` / `globalParameters`). The force owns its own
1624
+ * behavior (`mode`); each particle only opts in to it through a
1625
+ * `pointForceFactors[id]` sensitivity factor.
1626
+ *
1627
+ * - `mode`: `attract` pulls particles toward `position`; `repel` pushes them away.
1628
+ * - `strength`: acceleration magnitude at full influence (>= 0).
1629
+ * - `radius`: influence radius in pixels (>= 0). Outside it the contribution is 0.
1630
+ * - `falloff`: how strength decays with distance inside the radius.
1631
+ * - `enabled`: when false the force is inert.
1632
+ */
1633
+ interface PointForceConfig {
1634
+ /** What a layer's `externalForces.pointForceFactors` names it by. */
1635
+ id: string;
1636
+ /** The name a tool shows for it. */
1637
+ name: string;
1638
+ /** Where it is, in the space of the animation. */
1639
+ position: PointValue;
1640
+ /** `'attract'` pulls particles toward `position`; `'repel'` pushes them away. */
1641
+ mode: PointForceMode;
1642
+ /** Acceleration at full influence. */
1643
+ strength: number;
1644
+ /** Reach, in pixels. Beyond it the force does nothing. */
1645
+ radius: number;
1646
+ /**
1647
+ * How the strength fades from `position` to the edge of `radius`:
1648
+ * `'none'` (the same everywhere inside), `'linear'` or `'smooth'`.
1649
+ */
1650
+ falloff: PointForceFalloff;
1651
+ /** `false` switches the force off. */
1652
+ enabled: boolean;
1653
+ }
1654
+ /**
1655
+ * How strongly the particles of a layer feel each external force: a multiplier
1656
+ * per force, each in the value system of any other numeric parameter.
1657
+ */
1658
+ interface ExternalForcesFactorOptions {
1659
+ /** Global gravitational acceleration factor. Without it, 0: the gravity does not reach the particle */
1660
+ gravityFactor?: ModulatableNumber;
1661
+ /** Global movement damping coefficient factor (opposes movement). Without it, 0: no damping */
1662
+ dampingFactor?: ModulatableNumber;
1663
+ /** Global wind force factor applied to particles. Without it, 0: the wind does not reach the particle */
1664
+ windFactor?: ModulatableNumber;
1665
+ /**
1666
+ * Per-particle sensitivity to each global point force, keyed by the point
1667
+ * force's `id`. A particle is affected by a point force only when it carries
1668
+ * a factor entry for it. Uses the same value system as the other factors
1669
+ * (Fixed / Range / List / Linked / Modifiers).
1670
+ */
1671
+ pointForceFactors?: Record<string, ModulatableNumber>;
1672
+ }
1673
+ /** The names of the uniform forces: `'gravity'`, `'damping'` and `'wind'`. */
1674
+ type ExternalForcesTypes = keyof ExternalForcesOptions;
1675
+
1676
+ /**
1677
+ * How a particle assigned to a region is culled relative to that region's area:
1678
+ * - `killOutside`: the particle dies once it is fully outside the area (classic containment).
1679
+ * - `killInside`: the particle dies once it is fully inside the area (a "death zone").
1680
+ */
1681
+ type RegionBehavior = 'killInside' | 'killOutside';
1682
+ /**
1683
+ * A named containment area declared at engine level. Regions are global to the
1684
+ * engine (siblings of `externalForces` / `globalParameters`); particles opt in to
1685
+ * one by referencing its `id` through `ParticleLayerOptions.region`.
1686
+ */
1687
+ interface RegionOptions {
1688
+ /** What a layer's `region.regionId` names it by. */
1689
+ id: string;
1690
+ /** Its shape, in the space of the animation. */
1691
+ area: ShapeArea;
1692
+ }
1693
+ /** Per-particle assignment to a single region plus the kill behavior to apply. */
1694
+ interface ParticleRegionRef {
1695
+ /** The `id` of one of the animation's `regions`. */
1696
+ regionId: string;
1697
+ /** Whether the particles die inside the region or outside it. */
1698
+ behavior: RegionBehavior;
1699
+ }
1700
+
1701
+ /**
1702
+ * Texture source identifier. Strings reference renderer-preloaded resources.
1703
+ * The renderer's `resolveTexture(source)` turns this into an `ITextureRef`.
1704
+ */
1705
+ type SingleTextureOption = string;
1706
+ /** A texture that changes while the particle lives: a list of frames shown one after another. */
1707
+ interface SpriteAnimationOptions {
1708
+ /** The frames, in order, each a texture id. */
1709
+ textures: SingleTextureOption[];
1710
+ /** Frames per second. Defaults to 12. */
1711
+ animationFPS?: number;
1712
+ /** Whether it starts again after the last frame. Defaults to `true`. */
1713
+ animationLoop?: boolean;
1714
+ /**
1715
+ * Starting frame for the animation. Undefined means it will start from the first frame.
1716
+ * Can be set to a random frame by using value of -1.
1717
+ */
1718
+ startFrame?: number;
1719
+ }
1720
+ /** The same fields as `SpriteAnimationOptions`, with `textures` declared as `string[]`. */
1721
+ interface SpriteAnimationTexturesOptions extends Omit<SpriteAnimationOptions, 'textures'> {
1722
+ /** The frames, in order, each a texture id. */
1723
+ textures: string[];
1724
+ }
1725
+ /** What a particle draws: a single texture id, or a sprite animation. */
1726
+ type TextureElement = SingleTextureOption | SpriteAnimationOptions;
1727
+ /**
1728
+ * Runtime state of a sprite-sheet animation on a live particle. Textures are
1729
+ * pre-resolved to renderer-opaque `ITextureRef` so the hot update loop doesn't
1730
+ * touch any string-keyed cache.
1731
+ */
1732
+ interface ParticleSpriteAnimationParameters {
1733
+ /** The frames, in order, as resolved textures. */
1734
+ textures: ITextureRef[];
1735
+ /** Seconds accumulated toward the next frame change. */
1736
+ elapsedTime: number;
1737
+ /** Seconds each frame is shown: 1 divided by the frames per second. */
1738
+ intervalSec: number;
1739
+ /** Index of the frame shown now. */
1740
+ currentIndex: number;
1741
+ /** Whether the animation starts again after the last frame. If not, it stops on the last frame. */
1742
+ loop: boolean;
1743
+ }
1744
+ /** Where a particle is born and how it moves. Distances are pixels in the space of the animation; angles are radians. */
1745
+ interface KineticsOptions {
1746
+ /** Where the particle is born: a point, a point of a list, or anywhere inside an area. */
1747
+ position?: SpawnPosition;
1748
+ /** Its velocity, as an angle and a magnitude in pixels per second. */
1749
+ velocity?: SpawnVector;
1750
+ /** Its acceleration, as an angle and a magnitude in pixels per second squared. */
1751
+ acceleration?: SpawnVector;
1752
+ /** Cap on the speed along each axis, in pixels per second. Absent, no cap. */
1753
+ maxVelocity?: number;
1754
+ }
1755
+ /**
1756
+ * The size of a particle, as a factor of its texture: 1 draws it at its own
1757
+ * size. A single number scales both axes; `{ x, y }` scales each one.
1758
+ */
1759
+ interface ScaleOptions {
1760
+ /** The scale. */
1761
+ value: ModulatableNumber | SpawnPoint;
1762
+ /** Its rate of change, per second. */
1763
+ velocity?: ModulatableNumber | SpawnPoint;
1764
+ /** The rate of change of `velocity`, per second. */
1765
+ acceleration?: ModulatableNumber | SpawnPoint;
1766
+ /** Maximum speed cap applied equally to both X and Y scale velocity components. */
1767
+ maxVelocity?: number;
1768
+ }
1769
+ /**
1770
+ * A number that moves: `rotation` (radians) and `alpha` (0 transparent, 1
1771
+ * opaque) are both written this way.
1772
+ */
1773
+ interface NumberOptions {
1774
+ /** The value. */
1775
+ value: ModulatableNumber;
1776
+ /** Its rate of change, per second. */
1777
+ velocity?: ModulatableNumber;
1778
+ /** The rate of change of `velocity`, per second. */
1779
+ acceleration?: ModulatableNumber;
1780
+ /** Cap on `velocity`, in either direction. Absent, no cap. */
1781
+ maxVelocity?: number;
1782
+ }
1783
+ /** The color of a particle. */
1784
+ interface ColorOptions {
1785
+ /**
1786
+ * The tint, multiplied with the texture: a `0xRRGGBB` number, one of a
1787
+ * list, a random color of a gradient frozen at birth, or a gradient that
1788
+ * follows a parameter such as `lifeProgress`.
1789
+ */
1790
+ value: SpawnColor;
1791
+ }
1792
+ /**
1793
+ * Configuration options for individual particle spawn behavior.
1794
+ * Defines all the visual and physical properties a particle can have when created.
1795
+ */
1796
+ interface ParticleLayerOptions {
1797
+ /**
1798
+ * Stable identifier for this particle type, supplied by the host (e.g. the
1799
+ * editor's particle id). Optional; when present it is stamped onto every
1800
+ * spawned particle (`ParticleItem.sourceParticleId`) so the engine can report
1801
+ * alive counts per type via `getParticlesAliveById`.
1802
+ */
1803
+ id?: string;
1804
+ /**
1805
+ * Whether this layer is drawn when its playback is built or comes back
1806
+ * from its pool. Defaults to `true`. Hidden, it still spawns, simulates,
1807
+ * counts and fires its events. Drawn only while its emitter is drawn too.
1808
+ * Live: `ParticleLayer.visible`.
1809
+ */
1810
+ visible?: boolean;
1811
+ /**
1812
+ * What the particle draws: a texture id, a sprite animation, or a list of
1813
+ * either from which each particle takes one. Mandatory.
1814
+ */
1815
+ texture: TextureElement | RandomValueList<TextureElement>;
1816
+ /** Particle lifetime in seconds */
1817
+ lifetime?: ModulatableNumber;
1818
+ /** Kinetics configuration with physics properties for the particle */
1819
+ kinetics?: KineticsOptions;
1820
+ /** Scale configuration options for the particle */
1821
+ scale?: ScaleOptions;
1822
+ /** Rotation configuration with physics properties for the particle */
1823
+ rotation?: NumberOptions;
1824
+ /** Alpha transparency options for the particle */
1825
+ alpha?: NumberOptions;
1826
+ /** Color tint options for the particle */
1827
+ color?: ColorOptions;
1828
+ /**
1829
+ * Fixed compositing/blend mode for this particle. Defaults to `'normal'`.
1830
+ * This is a static rendering setting, not a dynamic parameter — it does not
1831
+ * support randomness, curves, modifiers, or animation. Applied at the
1832
+ * render-group container level by the renderer adapter.
1833
+ */
1834
+ blendMode?: ParticleBlendMode;
1835
+ /** External forces factors for particle */
1836
+ externalForces?: ExternalForcesFactorOptions;
1837
+ /** Optional assignment to one engine-level region, with a kill behavior. */
1838
+ region?: ParticleRegionRef;
1839
+ /**
1840
+ * This particle type's bindings: registered event name (see
1841
+ * `ParticleAnimationOptions.events`) → the particle trigger that fires it.
1842
+ *
1843
+ * `onRegionEnter` / `onRegionExit` evaluate the region assigned in `region`
1844
+ * above; without one they never fire, since there is nothing to cross.
1845
+ */
1846
+ events?: ParticleEventBindings;
1847
+ /**
1848
+ * Called once for each particle of this layer when it is born, after the
1849
+ * engine has set it up from this config. When the emitter's `ParticleClass`
1850
+ * overrides `ParticleItem.onInit` too, both run: this one first.
1851
+ */
1852
+ onInit?: (options: ParameterInitOptions) => void;
1853
+ /**
1854
+ * Called for each live particle of this layer on every tick, after the
1855
+ * engine has stepped it. Before `ParticleItem.onUpdate`, as `onInit`.
1856
+ */
1857
+ onUpdate?: (options: ParameterUpdateOptions) => void;
1858
+ }
1859
+ /**
1860
+ * The random generator a particle hook draws from: its emitter's, seeded with
1861
+ * the playback. Drawing from it, rather than from `Math.random`, keeps a seeded
1862
+ * animation the same on every replay, hooks included.
1863
+ */
1864
+ interface ParticleHookRandom {
1865
+ /** The next number of the sequence, from 0 (inclusive) to 1 (exclusive). */
1866
+ next(): number;
1867
+ }
1868
+ /**
1869
+ * The playback a particle hook's emitter belongs to: the very `PerseonPlayback`
1870
+ * the host was given for it, seen through the three calls a hook needs. A
1871
+ * `stop()` or `start()` asked from a hook takes effect at the end of the tick,
1872
+ * so every particle of this tick is stepped the same way.
1873
+ *
1874
+ * It answers for that playback only. Kept after the playback is over (back in
1875
+ * its animation's pool, maybe already playing for someone else), it is over
1876
+ * too: what is asked of it does nothing and is reported by the animation's
1877
+ * diagnostics policy, as on any `PerseonPlayback` that is over.
1878
+ */
1879
+ interface ParticleHookPlayback {
1880
+ /** Start the playback again, as `PerseonPlayback.start`: `emit` (default `true`) opens every emitter. */
1881
+ start(emit?: boolean): void;
1882
+ /** Stop the playback, as `PerseonPlayback.stop`. */
1883
+ stop(): void;
1884
+ /** One of the animation's locals in this playback, as `PerseonPlayback.param`. */
1885
+ param(id: string): LocalParameterHandle;
1886
+ }
1887
+ /**
1888
+ * The emitter that spawned the particle a hook is called for. The same object
1889
+ * for every hook of the same playback; kept past that playback, its `playback`
1890
+ * is over as `ParticleHookPlayback` says.
1891
+ */
1892
+ interface ParticleHookEmitter {
1893
+ /** Its `EmitterOptions.id`, or `undefined` when the config gave it none. */
1894
+ readonly id: string | undefined;
1895
+ /** The playback it belongs to. */
1896
+ readonly playback: ParticleHookPlayback;
1897
+ }
1898
+ /**
1899
+ * What an `onInit` receives: the `onInit` of a layer's config
1900
+ * (`ParticleLayerOptions.onInit`) and the one a `ParticleClass` overrides
1901
+ * (`ParticleItem.onInit`). A new object on every call.
1902
+ *
1903
+ * `particle` is the particle only until it dies: the engine pools particles,
1904
+ * and the same object is born again later as another one. Keep what a hook
1905
+ * needs from it, not the particle.
1906
+ */
1907
+ interface ParameterInitOptions {
1908
+ /** The particle being born. */
1909
+ particle: ParticleItem;
1910
+ /** The emitter that spawned it. */
1911
+ emitter: ParticleHookEmitter;
1912
+ /** Its emitter's random generator. */
1913
+ rng: ParticleHookRandom;
1914
+ }
1915
+ /** What an `onUpdate` receives: the same as `onInit`, and the step of the tick. */
1916
+ interface ParameterUpdateOptions extends ParameterInitOptions {
1917
+ /** The simulated time of this step, in seconds. */
1918
+ elapsedSec: number;
1919
+ }
1920
+
1921
+ /**
1922
+ * What an emitter does with a spawn when `maxAlive` particles are already alive:
1923
+ * - `'preventNew'` (default): the new particle is not born.
1924
+ * - `'killOldest'`: the particle that has lived longest dies to make room.
1925
+ * - `'killRandom'`: a random live particle dies to make room.
1926
+ */
1927
+ type ParticleLimitStrategy = 'preventNew' | 'killOldest' | 'killRandom';
1928
+ /** How many particles an emitter may have alive at once, and what happens when it reaches the limit. */
1929
+ interface CapacityOptions {
1930
+ /** Maximum number of particles that can exist simultaneously */
1931
+ maxAlive: number;
1932
+ /** Strategy to apply when the pool is full */
1933
+ limitStrategy?: ParticleLimitStrategy;
1934
+ /** Initial number of particles to create in the pool */
1935
+ initialPoolSize?: number;
1936
+ }
1937
+ /**
1938
+ * Where a new particle is drawn among the live ones of its layer: `'front'` of
1939
+ * them, at the `'back'` (default) or at a `'random'` depth.
1940
+ */
1941
+ type ParticleSpawnStrategy = 'front' | 'back' | 'random';
1942
+ /**
1943
+ * One emission cycle. Two shapes: a burst (`count` above 0) spawns `count`
1944
+ * particles at once and ends; a rate spawns `rate` particles per second for
1945
+ * `duration` seconds. Each number is drawn again when a cycle starts.
1946
+ */
1947
+ interface EmissionOptions {
1948
+ /** Seconds a rate cycle lasts. Absent or 0, it never ends by itself. Not read by a burst. */
1949
+ duration?: SpawnNumber;
1950
+ /** Particles of a burst, all born in the same step. Above 0, the cycle is a burst and `rate` is not read. */
1951
+ count?: SpawnNumber;
1952
+ /** Particles born per second. */
1953
+ rate?: SpawnNumber;
1954
+ /** Where a new particle is drawn among the live ones of its layer. Defaults to `'back'`. */
1955
+ spawnStrategy?: ParticleSpawnStrategy;
1956
+ }
1957
+ /** What an emitter has already done by the time it is first shown. */
1958
+ interface InitialStateOptions {
1959
+ /** Seconds simulated inside `start()`, before the first frame is shown: the warm-up. */
1960
+ simulateTime?: SpawnNumber;
1961
+ /** Least number of live particles after the warm-up: what is missing is spawned at once, up to `maxAlive`. */
1962
+ ensureAliveCount?: SpawnNumber;
1963
+ }
1964
+ /** When an emission cycle starts and how it repeats. Only a cycle that ends (a burst, or a rate with `duration`) repeats. */
1965
+ interface PlaybackOptions {
1966
+ /** Seconds the emitter waits, once started, before its first cycle. */
1967
+ startDelay?: SpawnNumber;
1968
+ /** Seconds between the end of a cycle and the start of the next. */
1969
+ interval?: SpawnNumber;
1970
+ /**
1971
+ * How many more times the cycle runs after the first. Absent or 0, once.
1972
+ * At the top of its domain (`EMITTER_OPTION_DOMAINS.repeat.max`), forever.
1973
+ */
1974
+ repeat?: SpawnNumber;
1975
+ }
1976
+ /**
1977
+ * How an emitter seeds itself when it does not inherit from the animation.
1978
+ * - `'fixed'`: always the same `seed`; `reset()` returns to it, so the emitter
1979
+ * replays even when the animation as a whole does not.
1980
+ * - `'auto'`: a fresh random seed per construction — deliberately unrepeatable,
1981
+ * even inside a seeded animation.
1982
+ */
1983
+ type RandomnessSeedMode = 'fixed' | 'auto';
1984
+ /** The random seed of an emitter. */
1985
+ interface RandomnessOptions {
1986
+ /**
1987
+ * Absent → inherit the animation's seeding: a seed derived from
1988
+ * `ParticleAnimationOptions.randomness.seed`, or none when the animation is
1989
+ * unseeded. Deriving (rather than reusing the animation seed) is what keeps two
1990
+ * emitters of the same animation from running identical streams.
1991
+ */
1992
+ seedMode?: RandomnessSeedMode;
1993
+ /** Only read with `seedMode: 'fixed'`. */
1994
+ seed?: number;
1995
+ }
1996
+ /** Limits on simulation work, for the whole animation (`ParticleAnimationOptions.performance`) or for one emitter, capped by the animation's. */
1997
+ interface PerformanceOptions {
1998
+ /**
1999
+ * Most simulation steps per second. The time of the frames in between
2000
+ * accumulates and is simulated in the next step. Defaults to 60.
2001
+ */
2002
+ maxUpdateRate?: number;
2003
+ /** Most steps the warm-up (`initialState.simulateTime`) may take. */
2004
+ warmUpMaxTicks?: number;
2005
+ }
2006
+ /**
2007
+ * Configuration for one emitter of a `PerseonPlayback`.
2008
+ *
2009
+ * An emitter owns its emission cycle, its particle pool and its Particle
2010
+ * Layers. Everything shared by the animation — regions, event names, point forces,
2011
+ * external forces, global parameters, the renderer and the clock — belongs to
2012
+ * the engine (`ParticleAnimationOptions`).
2013
+ *
2014
+ * Multi-layer: declare one or more particle parameter sets in `particles`. Each
2015
+ * one becomes a `ParticleLayer` with its own render group and blend mode, and on
2016
+ * spawn the `RandomValueList`'s `selectionMode` (`ordered` | `shuffle` |
2017
+ * `random` with optional weights) picks which layer the particle is born into.
2018
+ */
2019
+ interface EmitterOptions {
2020
+ /**
2021
+ * Stable identifier for this emitter, supplied by the host (e.g. the
2022
+ * editor's emitter id). Exposed via `Emitter.id`, and how
2023
+ * `PerseonPlayback.getEmitter` and `randomness.parentEmitterId` address it.
2024
+ */
2025
+ id?: string;
2026
+ /**
2027
+ * Constructor of the particle class. Unique per emitter — its pool is
2028
+ * homogeneous in class.
2029
+ *
2030
+ * Optional, defaulting to `ParticleItem`. A constructor is a live object, so
2031
+ * it cannot travel in an animation file the way the rest of these options
2032
+ * can — it is the one member here a JSON payload never declares. A host
2033
+ * supplies it in code, and only when it extends `ParticleItem` with its own
2034
+ * per-particle state.
2035
+ */
2036
+ ParticleClass?: new () => ParticleItem;
2037
+ /**
2038
+ * Whether this emitter is drawn when its playback is built or comes back
2039
+ * from its pool. Defaults to `true`. Hidden, it still spawns, simulates,
2040
+ * counts and fires its events. Live: `Emitter.visible`.
2041
+ */
2042
+ visible?: boolean;
2043
+ /**
2044
+ * One or more Particle Layers. The pool, live list, and order strategy do
2045
+ * not differentiate between layers — they operate over the union.
2046
+ */
2047
+ particles: RandomValueList<ParticleLayerOptions> | ParticleLayerOptions;
2048
+ /**
2049
+ * This emitter's bindings: registered event name → the emitter trigger that
2050
+ * fires it (`onEmitStart`, `onEmitStop` or `onFinished`). The names themselves are
2051
+ * registered on the engine (`ParticleAnimationOptions.events`).
2052
+ */
2053
+ eventBindings?: EmitterEventBindings;
2054
+ /** Pool capacity for this emitter. Does not differentiate by layer. */
2055
+ capacity?: CapacityOptions;
2056
+ /** How and when the emitter spawns particles: burst or rate, and how long it lasts. */
2057
+ emission?: EmissionOptions;
2058
+ /** What the emitter has already simulated by the time it is first shown: warm-up time and a minimum live count. */
2059
+ initialState?: InitialStateOptions;
2060
+ /** The emitter's cycle: the delay before it starts and how many times, and how often, it repeats. */
2061
+ playback?: PlaybackOptions;
2062
+ /** The emitter's random seed. Absent, it inherits the animation's seeding. */
2063
+ randomness?: RandomnessOptions;
2064
+ /** Limits on how much simulation work the emitter does per second and while warming up. */
2065
+ performance?: PerformanceOptions;
2066
+ }
2067
+
2068
+ /**
2069
+ * The paths `option(path)` takes, per scope, and the type of the format at each.
2070
+ * Each type is read off the format's own types, so a path gives exactly what the
2071
+ * JSON holds there.
2072
+ *
2073
+ * The maps are written out path by path, not derived from the option types: a
2074
+ * recursive path type over the whole format is what makes `tsc` slow, and the
2075
+ * addressable paths are not all the format's paths anyway.
2076
+ *
2077
+ * `${string}` stands only for an id: a point force's, a region's or a point
2078
+ * force factor's, and it is a single segment: those ids take no dot. A path that
2079
+ * ends in a field name is that field (`'pointForces.a.position'`, the force
2080
+ * `'a'`); any other is the whole force (`'pointForces.a'`). A template literal cannot say "no dot", so the types
2081
+ * still let a dotted path through; `findOptionPathEntry` refuses it at run
2082
+ * time, and whether the id exists is for the runtime to find.
2083
+ */
2084
+ type PlaybackOptionTypes = {
2085
+ 'externalForces.gravity': NonNullable<ExternalForcesOptions['gravity']>;
2086
+ 'externalForces.damping': NonNullable<ExternalForcesOptions['damping']>;
2087
+ 'externalForces.wind': NonNullable<ExternalForcesOptions['wind']>;
2088
+ 'performance.maxUpdateRate': NonNullable<PerformanceOptions['maxUpdateRate']>;
2089
+ 'performance.warmUpMaxTicks': NonNullable<PerformanceOptions['warmUpMaxTicks']>;
2090
+ };
2091
+ /** A point force's fields as nodes; its id is the path. */
2092
+ type PointForceField = Exclude<keyof PointForceConfig, 'id'>;
2093
+ /** The field a point force path ends in, or `never` for the whole force. */
2094
+ type PointForceFieldOf<P extends string> = {
2095
+ [F in PointForceField]: P extends `pointForces.${string}.${F}` ? F : never;
2096
+ }[PointForceField];
2097
+ /** The option paths a playback takes: its external forces and performance limits, and its point forces and regions by id (`'pointForces.<id>'`, `'regions.<id>'`) and their fields. */
2098
+ type PlaybackOptionPath = keyof PlaybackOptionTypes | `pointForces.${string}` | `pointForces.${string}.${PointForceField}` | `regions.${string}` | `regions.${string}.area`;
2099
+ /** The type of the value at the playback option path `P`. */
2100
+ type PlaybackOptionType<P extends PlaybackOptionPath> = P extends keyof PlaybackOptionTypes ? PlaybackOptionTypes[P] : P extends `pointForces.${string}` ? [PointForceFieldOf<P>] extends [never] ? PointForceConfig : PointForceConfig[PointForceFieldOf<P>] : P extends `regions.${string}.area` ? RegionOptions['area'] : RegionOptions;
2101
+ type EmitterOptionTypes = {
2102
+ 'emission.rate': NonNullable<EmissionOptions['rate']>;
2103
+ 'emission.duration': NonNullable<EmissionOptions['duration']>;
2104
+ 'emission.count': NonNullable<EmissionOptions['count']>;
2105
+ 'emission.spawnStrategy': NonNullable<EmissionOptions['spawnStrategy']>;
2106
+ 'playback.startDelay': NonNullable<PlaybackOptions['startDelay']>;
2107
+ 'playback.interval': NonNullable<PlaybackOptions['interval']>;
2108
+ 'playback.repeat': NonNullable<PlaybackOptions['repeat']>;
2109
+ 'initialState.simulateTime': NonNullable<InitialStateOptions['simulateTime']>;
2110
+ 'initialState.ensureAliveCount': NonNullable<InitialStateOptions['ensureAliveCount']>;
2111
+ 'capacity.maxAlive': CapacityOptions['maxAlive'];
2112
+ 'capacity.limitStrategy': NonNullable<CapacityOptions['limitStrategy']>;
2113
+ 'capacity.initialPoolSize': NonNullable<CapacityOptions['initialPoolSize']>;
2114
+ 'randomness.seedMode': NonNullable<RandomnessOptions['seedMode']>;
2115
+ 'randomness.seed': NonNullable<RandomnessOptions['seed']>;
2116
+ 'performance.maxUpdateRate': NonNullable<PerformanceOptions['maxUpdateRate']>;
2117
+ 'performance.warmUpMaxTicks': NonNullable<PerformanceOptions['warmUpMaxTicks']>;
2118
+ eventBindings: NonNullable<EmitterOptions['eventBindings']>;
2119
+ };
2120
+ /** The option paths an emitter takes: its emission, playback, initial state, capacity, randomness and performance fields, and its event bindings. */
2121
+ type EmitterOptionPath = keyof EmitterOptionTypes;
2122
+ /** The type of the value at the emitter option path `P`. */
2123
+ type EmitterOptionType<P extends EmitterOptionPath> = EmitterOptionTypes[P];
2124
+ /** One axis of a composite in its split mode: `{x, y}` or `{angle, magnitude}`. */
2125
+ type Axis = ModulatableNumber;
2126
+ type LayerOptionTypes = {
2127
+ lifetime: NonNullable<ParticleLayerOptions['lifetime']>;
2128
+ texture: ParticleLayerOptions['texture'];
2129
+ region: NonNullable<ParticleLayerOptions['region']>;
2130
+ events: NonNullable<ParticleLayerOptions['events']>;
2131
+ blendMode: NonNullable<ParticleLayerOptions['blendMode']>;
2132
+ kinetics: KineticsOptions;
2133
+ 'kinetics.position': NonNullable<KineticsOptions['position']>;
2134
+ 'kinetics.position.x': Axis;
2135
+ 'kinetics.position.y': Axis;
2136
+ 'kinetics.velocity': NonNullable<KineticsOptions['velocity']>;
2137
+ 'kinetics.velocity.angle': Axis;
2138
+ 'kinetics.velocity.magnitude': Axis;
2139
+ 'kinetics.acceleration': NonNullable<KineticsOptions['acceleration']>;
2140
+ 'kinetics.acceleration.angle': Axis;
2141
+ 'kinetics.acceleration.magnitude': Axis;
2142
+ 'kinetics.maxVelocity': NonNullable<KineticsOptions['maxVelocity']>;
2143
+ scale: ScaleOptions;
2144
+ 'scale.value': ScaleOptions['value'];
2145
+ 'scale.value.x': Axis;
2146
+ 'scale.value.y': Axis;
2147
+ 'scale.velocity': NonNullable<ScaleOptions['velocity']>;
2148
+ 'scale.velocity.x': Axis;
2149
+ 'scale.velocity.y': Axis;
2150
+ 'scale.acceleration': NonNullable<ScaleOptions['acceleration']>;
2151
+ 'scale.acceleration.x': Axis;
2152
+ 'scale.acceleration.y': Axis;
2153
+ 'scale.maxVelocity': NonNullable<ScaleOptions['maxVelocity']>;
2154
+ rotation: NumberOptions;
2155
+ 'rotation.value': NumberOptions['value'];
2156
+ 'rotation.velocity': NonNullable<NumberOptions['velocity']>;
2157
+ 'rotation.acceleration': NonNullable<NumberOptions['acceleration']>;
2158
+ 'rotation.maxVelocity': NonNullable<NumberOptions['maxVelocity']>;
2159
+ alpha: NumberOptions;
2160
+ 'alpha.value': NumberOptions['value'];
2161
+ 'alpha.velocity': NonNullable<NumberOptions['velocity']>;
2162
+ 'alpha.acceleration': NonNullable<NumberOptions['acceleration']>;
2163
+ 'alpha.maxVelocity': NonNullable<NumberOptions['maxVelocity']>;
2164
+ 'color.value': ColorOptions['value'];
2165
+ 'externalForces.gravityFactor': NonNullable<ExternalForcesFactorOptions['gravityFactor']>;
2166
+ 'externalForces.dampingFactor': NonNullable<ExternalForcesFactorOptions['dampingFactor']>;
2167
+ 'externalForces.windFactor': NonNullable<ExternalForcesFactorOptions['windFactor']>;
2168
+ 'externalForces.pointForceFactors': NonNullable<ExternalForcesFactorOptions['pointForceFactors']>;
2169
+ };
2170
+ type PointForceFactors = NonNullable<ExternalForcesFactorOptions['pointForceFactors']>;
2171
+ /** The option paths a particle layer takes: its lifetime, texture, region, events, blend mode, kinetics, scale, rotation, alpha, color and external-force factor fields, including each axis of a split position, velocity, acceleration or scale. */
2172
+ type LayerOptionPath = keyof LayerOptionTypes | `externalForces.pointForceFactors.${string}`;
2173
+ /** The type of the value at the layer option path `P`. */
2174
+ type LayerOptionType<P extends LayerOptionPath> = P extends keyof LayerOptionTypes ? LayerOptionTypes[P] : PointForceFactors[string];
2175
+
2176
+ /**
2177
+ * Randomness of the animation itself — what drives the sampling of its
2178
+ * `'playback'` locals.
2179
+ * Emitters seed themselves separately (`EmitterOptions.randomness`).
2180
+ */
2181
+ interface AnimationRandomnessOptions {
2182
+ /**
2183
+ * Fixed seed for animation-scope sampling. With one, the animation replays
2184
+ * identically and `reset()` returns to it; without one, a fresh random seed
2185
+ * is drawn when the engine is constructed and a reset keeps rolling forward.
2186
+ */
2187
+ seed?: number;
2188
+ }
2189
+ /**
2190
+ * An animation: pure configuration, and the whole of it. This is what a
2191
+ * `.json` scene file holds and what `PerseonPlayback` is constructed from —
2192
+ * there is no parallel "serialized" schema to keep in sync, because nothing
2193
+ * here is a live object.
2194
+ *
2195
+ * The host's own infrastructure (its `IRenderer`, its `ITicker`) is *not*
2196
+ * configuration: the host builds it and passes it to the constructor
2197
+ * alongside these options, exactly as `Emitter` receives its playback and
2198
+ * render node.
2199
+ *
2200
+ * Textures travel as ids, not images. A `texture.source` names a resource the
2201
+ * host must have registered with its renderer beforehand (for the Pixi
2202
+ * adapters, anything `Assets.cache` resolves — typically the frames of a
2203
+ * particle atlas). The animation file therefore stays small and shares one
2204
+ * atlas across every particle that uses it.
2205
+ *
2206
+ * Each entry of `emitters` becomes one `Emitter` with its own emission cycle,
2207
+ * pool and Particle Layers; everything else is shared by all of them.
2208
+ */
2209
+ interface ParticleAnimationOptions {
2210
+ /** Format of this file: `ANIMATION_FORMAT_VERSION`. Mandatory. */
2211
+ formatVersion: number;
2212
+ /** One or more emitters, rendered in declaration order. */
2213
+ emitters: EmitterOptions[];
2214
+ /**
2215
+ * Named containment areas, shared by every emitter. A particle opts in to
2216
+ * one via `ParticleLayerOptions.region`, picking a `killInside` /
2217
+ * `killOutside` behavior. Pass a single `RegionOptions` or an array. When
2218
+ * omitted (or when a particle declares no region), only `lifetime` decides
2219
+ * when it dies.
2220
+ */
2221
+ regions?: RegionOptions | RegionOptions[];
2222
+ /**
2223
+ * Event names registered on this engine. Names are unique identities: both
2224
+ * `EmitterOptions.eventBindings` and `ParticleLayerOptions.events` reference
2225
+ * them, and the engine dispatches them to the listeners of `on`.
2226
+ *
2227
+ * Registration is what makes a name live — binding a name absent from this
2228
+ * list is inert. Manage the registry at runtime with `addEventName` /
2229
+ * `removeEventName` / `hasEvent`.
2230
+ */
2231
+ events?: string[];
2232
+ /**
2233
+ * Reusable positional external forces (attractors / repellers). Declared
2234
+ * once for the animation and offered to every particle: a particle is affected
2235
+ * by one only when it carries a matching
2236
+ * `externalForces.pointForceFactors[id]` sensitivity factor.
2237
+ */
2238
+ pointForces?: PointForceConfig[];
2239
+ /** Gravity / damping / wind, shared by every emitter. */
2240
+ externalForces?: ExternalForcesOptions;
2241
+ /** Values the game sets (`setGlobalParameter`). Each one holds its `value` until then. */
2242
+ globalParameters?: GlobalParameterOption[];
2243
+ /**
2244
+ * The animation's locals, declared once for every emitter and layer. Their
2245
+ * `sampleScope` says when they are drawn; names are shared with the globals.
2246
+ */
2247
+ localParameters?: CustomParameterOption[];
2248
+ /** Seeding of the animation's own RNG, which samples the `'playback'` locals. */
2249
+ randomness?: AnimationRandomnessOptions;
2250
+ /** Frame-rate cap for the whole simulation. */
2251
+ performance?: PerformanceOptions;
2252
+ }
2253
+
2254
+ /**
2255
+ * Per-instance memory of every compiled `RandomValueList` an owner holds, one
2256
+ * slot per list, assigned at compile time.
2257
+ *
2258
+ * It lives out here rather than inside the compiled list because **the compiled
2259
+ * tree is immutable and shared between playbacks** while this changes on every
2260
+ * spawn: it is the cursor of `ordered` and the bag of `shuffle`. Sharing it
2261
+ * would correlate every playback of the same animation and break seeded replay.
2262
+ *
2263
+ * `random` needs no memory — it is weighted sampling with no history — so a slot
2264
+ * is created only when first written, and an animation whose lists are all
2265
+ * `random` allocates nothing at all.
2266
+ */
2267
+ type RandomListState = number[][];
2268
+ /**
2269
+ * When a local parameter's Range / Random list value is drawn.
2270
+ *
2271
+ * - `'playback'` (default): once per play session, when the playback starts or
2272
+ * resets, with the playback's RNG.
2273
+ * - `'emitter'`: once per emission cycle, by each emitter that reads it, with
2274
+ * that emitter's RNG.
2275
+ * - `'particle'`: once per particle, at birth, by each layer that reads it.
2276
+ *
2277
+ * Only the emitters and layers that read a local draw it (`readersOf`), so an
2278
+ * unread local consumes no randomness. Has no effect on Fixed or Linked values:
2279
+ * Fixed ones never draw, and Linked ones are evaluated every frame.
2280
+ */
2281
+ type CustomParameterSampleScope = 'playback' | 'emitter' | 'particle';
2282
+
2283
+ /**
2284
+ * The value space a numeric parameter lives in: the range, the step and the
2285
+ * decimals the engine declares for it.
2286
+ */
2287
+ type NumericDomain = {
2288
+ /** Lowest valid value, inclusive. In a config a value below it is a `PerseonConfigError`; through `option().set` it is clipped to it. */
2289
+ min: number;
2290
+ /** Highest valid value, inclusive. In a config a value above it is a `PerseonConfigError`; through `option().set` it is clipped to it. */
2291
+ max: number;
2292
+ /** Increment a control for this value should move by. The engine does not enforce it. */
2293
+ step?: number;
2294
+ /** Number of decimals a control for this value should show. The engine does not round to it. */
2295
+ decimals?: number;
2296
+ };
2297
+ /**
2298
+ * The value space a name-like string lives in — the text counterpart of
2299
+ * `NumericDomain`. `maxLength` bounds it; `minLength` is how short it may be
2300
+ * (0 means "may be empty" — required-ness is enforced by the caller, not here)
2301
+ * `trim` says whether leading/trailing whitespace is stripped before measuring
2302
+ * and sanitizing, so " Fire " and "Fire" are treated as the same name.
2303
+ */
2304
+ type TextDomain = {
2305
+ /** Fewest characters allowed, measured after trimming when `trim` is on. */
2306
+ minLength: number;
2307
+ /** Most characters allowed, measured after trimming when `trim` is on. */
2308
+ maxLength: number;
2309
+ /** Whether leading and trailing whitespace is ignored when measuring. */
2310
+ trim: boolean;
2311
+ };
2312
+
2313
+ /** Range: a number drawn between `min` and `max` each time the value is sampled. */
2314
+ interface RandomValueRange {
2315
+ /** Lower end of the range, inclusive. */
2316
+ min: number;
2317
+ /** Upper end of the range; a uniform draw stays below it. */
2318
+ max: number;
2319
+ /**
2320
+ * How likely each part of the range is: a curve whose x runs from `min` (0)
2321
+ * to `max` (1) and whose y is the relative probability. Absent, every value
2322
+ * is as likely as any other.
2323
+ */
2324
+ distribution?: CurveDefinition;
2325
+ /** Which preset `distribution` is, or `custom`. For the tool that wrote the file: the engine reads `distribution`. */
2326
+ distributionKind?: ProbabilityCurveKind;
2327
+ }
2328
+ /**
2329
+ * How a list hands out its values:
2330
+ * - `'ordered'`: one after another, starting again after the last.
2331
+ * - `'shuffle'`: in a random order, each value once before any repeats.
2332
+ * - `'random'`: any value each time, by `weight`.
2333
+ */
2334
+ type RandomValueListMode = 'ordered' | 'shuffle' | 'random';
2335
+ /** One entry of a list. `weight` (1 when absent) is its share of the draws in `'random'` mode. */
2336
+ type ValueProbability<T> = {
2337
+ /** The value the entry hands out. */
2338
+ value: T;
2339
+ /** Relative share of the draws in `'random'` mode: an entry of weight 2 comes up twice as often as one of weight 1. In `'shuffle'` mode it only makes an entry likelier to come out earlier in each round; `'ordered'` ignores it. At least 1. */
2340
+ weight?: number;
2341
+ };
2342
+ /** List: one of `values`, picked by `selectionMode` each time the value is sampled. */
2343
+ interface RandomValueList<T> {
2344
+ /** The entries to pick from. */
2345
+ values: ValueProbability<T>[];
2346
+ /** How the next entry is chosen. */
2347
+ selectionMode: RandomValueListMode;
2348
+ }
2349
+ /**
2350
+ * Linked: the value follows another parameter. The live value of the source is
2351
+ * passed through `transferFunction` and what comes out is the value.
2352
+ */
2353
+ interface ParameterLinkRelation {
2354
+ /** The source: a built-in parameter of the scope (`lifeProgress`, `spawnRate`…) or the id of a local or a global. */
2355
+ sourceParameterId: string;
2356
+ /**
2357
+ * A curve from source values (x) to values of this parameter (y), both in
2358
+ * their own units. A source below the first point or above the last one
2359
+ * gives the y of that point.
2360
+ */
2361
+ transferFunction: CurveDefinition;
2362
+ }
2363
+ /** A number in any of its four modes: Fixed, Range, List or Linked. */
2364
+ type SpawnNumber = number | RandomValueRange | RandomValueList<number> | ParameterLinkRelation;
2365
+ /**
2366
+ * Blend operations a modifier applies to the running parameter value `v`
2367
+ * with its source sample `s` and signed strength `k`:
2368
+ * - `add`: v_next = v + k * s
2369
+ * - `multiply`: v_next = v * (1 + k * (s - 1))
2370
+ *
2371
+ * The `multiply` form is deliberate (NOT `v * (k * s)`): it keeps `k = 0`
2372
+ * meaning "no effect" in BOTH blends, so a single strength slider reads the
2373
+ * same way for the artist regardless of blend.
2374
+ */
2375
+ type ModifierBlendMode = 'add' | 'multiply';
2376
+ /**
2377
+ * Where a modifier reads its per-tick source value `s` from. Both kinds are
2378
+ * CONTINUOUS — sampled every tick, unlike the (possibly spawn-frozen) base.
2379
+ * - `paramRef`: the live value of another parameter (same resolution as a
2380
+ * Linked relation's source, minus the transfer curve).
2381
+ * - `modulator`: a waveform owned by this modifier, declared inline.
2382
+ */
2383
+ type ParameterModifierSource = {
2384
+ /** `'paramRef'`: the source is another parameter. */
2385
+ type: 'paramRef';
2386
+ /** The parameter to read: a built-in parameter of the scope (`lifeProgress`, `spawnRate`...) or the id of a local or a global. */
2387
+ sourceParameterId: string;
2388
+ } | {
2389
+ /** `'modulator'`: the source is a waveform declared inline. */
2390
+ type: 'modulator';
2391
+ /** The waveform. */
2392
+ modulator: ModulatorOptions;
2393
+ };
2394
+ /**
2395
+ * A single entry in a parameter's ordered modifier stack. Each modifier takes
2396
+ * the previous step's value as its `v`, samples its `source` for `s`, and
2397
+ * blends them by `strength` (`k`), whose range is `MODIFIER_DOMAINS.strength`.
2398
+ */
2399
+ interface ParameterModifier {
2400
+ /** Where the modifier reads its value from, every tick. */
2401
+ source: ParameterModifierSource;
2402
+ /** How the source is combined with the running value: `'add'` or `'multiply'`. */
2403
+ blend: ModifierBlendMode;
2404
+ /** How much the source counts, from -10 to 10. 0 means no effect in both blends; a negative value inverts its direction. */
2405
+ strength: number;
2406
+ }
2407
+ /**
2408
+ * A numeric parameter wrapped with an ordered modifier stack on top of its
2409
+ * base value type. Backwards compatible: a bare `SpawnNumber` (no wrapper) is
2410
+ * unchanged. The base resolves with the usual timing (Range/List frozen at
2411
+ * spawn, Fixed/Linked as before); the modifiers run every tick.
2412
+ */
2413
+ interface ModulatedValue {
2414
+ /** The value before any modifier: a fixed number, a range, a list or a linked parameter. */
2415
+ base: SpawnNumber;
2416
+ /** The modifiers, applied in order: each one takes the value the previous one left. */
2417
+ modifiers: ParameterModifier[];
2418
+ }
2419
+ /** A numeric slot that may optionally carry a modifier stack. */
2420
+ type ModulatableNumber = SpawnNumber | ModulatedValue;
2421
+ /**
2422
+ * Where a particle is born: a point given by `x` and `y`, a random point inside
2423
+ * an area, or a point drawn from a list of points. Coordinates are in pixels.
2424
+ */
2425
+ type SpawnPosition = {
2426
+ /** Horizontal coordinate, in pixels. */
2427
+ x: ModulatableNumber;
2428
+ /** Vertical coordinate, in pixels. */
2429
+ y: ModulatableNumber;
2430
+ } | ShapeArea | RandomValueList<PointValue>;
2431
+ /**
2432
+ * A pair of numbers: `x` and `y` each given as a number in any of its modes, or
2433
+ * a point drawn from a list. The unit is that of the field that holds it.
2434
+ */
2435
+ type SpawnPoint = {
2436
+ /** The horizontal component. */
2437
+ x: ModulatableNumber;
2438
+ /** The vertical component. */
2439
+ y: ModulatableNumber;
2440
+ } | RandomValueList<PointValue>;
2441
+ /**
2442
+ * A direction and a size: `angle` and `magnitude` each given as a number in any
2443
+ * of its modes, or a vector drawn from a list.
2444
+ */
2445
+ type SpawnVector = {
2446
+ /** Direction, in radians: 0 points along +x, and a positive angle turns toward +y (down, on screen). */
2447
+ angle: ModulatableNumber;
2448
+ /** The size of the vector, in the unit of the field that holds it (for example pixels per second for a velocity). */
2449
+ magnitude: ModulatableNumber;
2450
+ } | RandomValueList<VectorValue>;
2451
+ /**
2452
+ * The waveform of a modulator, each normalized to run from -1 to 1 over one
2453
+ * cycle: `'sine'`, `'square'` (1 for the first half of the cycle, -1 for the
2454
+ * second), `'sawtooth'` (a ramp from -1 to 1), `'triangle'`, `'noise'` (smooth
2455
+ * random values) or `'custom'` (drawn with `curve`).
2456
+ */
2457
+ type ModulatorShape = 'sine' | 'square' | 'sawtooth' | 'triangle' | 'noise' | 'custom';
2458
+ /**
2459
+ * A cyclic value source: a waveform owned by a single parameter modifier and
2460
+ * declared inline in its `source`. Sampled every tick against a driving value
2461
+ * `t` chosen by `timeSource`.
2462
+ *
2463
+ * Output per tick: `offset + amplitude * shape(phase + t * frequency)`,
2464
+ * looping indefinitely.
2465
+ *
2466
+ * `'noise'` is smooth value noise that repeats every cycle like the other
2467
+ * shapes: 4 random values per cycle, joined smoothly, the last one back to the
2468
+ * first, so it loops without a jump. It is per particle (derived from the
2469
+ * particle's seed, so a fixed animation seed reproduces it), each particle read
2470
+ * from its own point within the cycle, and stays in `offset ± |amplitude|`.
2471
+ */
2472
+ interface ModulatorOptions {
2473
+ /** The waveform, normalized to run from -1 to 1 before `amplitude` and `offset` apply. */
2474
+ shape: ModulatorShape;
2475
+ /**
2476
+ * What drives the waveform's `t`:
2477
+ * - `'timeElapsed'` (default): the engine's total elapsed seconds — one
2478
+ * shared value per tick, so every particle sees the same output. The
2479
+ * exception is `'noise'`: each particle keeps its own noise.
2480
+ * - any particle parameter path accepted by a `paramRef` source
2481
+ * (`'lifeProgress'`, `'velocity.x'`, a custom local parameter id...):
2482
+ * `t` is that particle's live value, so the output is per-particle.
2483
+ */
2484
+ timeSource?: string;
2485
+ /** Cycles per unit of `timeSource` (per second for `'timeElapsed'`). */
2486
+ frequency: number;
2487
+ /** How far the output swings from `offset`: it stays within `offset ± |amplitude|`. A negative value flips the wave. */
2488
+ amplitude: number;
2489
+ /** Centre value of the oscillation. */
2490
+ offset: number;
2491
+ /** Initial phase as a fraction of one cycle, for every shape (`'noise'` too). */
2492
+ phase: number;
2493
+ /**
2494
+ * Custom waveform — only used when `shape === 'custom'`. The curve maps a
2495
+ * cycle fraction x∈[0,1] to y∈[0,1]; y is remapped to [-1,1] so amplitude
2496
+ * and offset keep the same meaning as the analytic shapes.
2497
+ */
2498
+ curve?: CurveDefinition;
2499
+ }
2500
+ /**
2501
+ * What a custom parameter holds: `'continuous'` (any number of its domain),
2502
+ * `'discrete'` (whole numbers) or `'label'` (one of a list of names).
2503
+ */
2504
+ type CustomParameterType = 'continuous' | 'discrete' | 'label';
2505
+ /**
2506
+ * A value the game sets (`setGlobalParameter`). Just one value, without modes:
2507
+ * anything that draws or follows a source is a local linked to it.
2508
+ */
2509
+ type GlobalParameterOption = {
2510
+ /** Public name: what the game and every `sourceParameterId` address it by. */
2511
+ id: string;
2512
+ /** `'continuous'` (any number of the domain), `'discrete'` (whole numbers) or `'label'` (one of a list of names). */
2513
+ type: CustomParameterType;
2514
+ /** The name a tool shows for it. */
2515
+ label: string;
2516
+ /** The range of a number, or the names of a `'label'` parameter. */
2517
+ domain: NumericDomain | string[];
2518
+ /** Default value; the label index for a `'label'` global. */
2519
+ value: number;
2520
+ };
2521
+ /**
2522
+ * Allowed shapes for `CustomParameterOption.value`.
2523
+ *
2524
+ * - `number` (Fixed): a constant scalar. Backwards-compatible with
2525
+ * the original API; existing callers passing a plain number keep
2526
+ * working unchanged.
2527
+ * - `RandomValueRange` (Range): min / max with optional distribution
2528
+ * curve. Sampled at the scope's re-sample moment (see
2529
+ * `CustomParameterSampleScope`).
2530
+ * - `RandomValueList<number>` (Random list): weighted list with a
2531
+ * selection mode (ordered / shuffle / random). Same sampling
2532
+ * timing as Range.
2533
+ * - `ParameterLinkRelation` (Linked): expression tying this
2534
+ * parameter's value to another source through a transfer curve.
2535
+ * Evaluated per frame against the live source.
2536
+ */
2537
+ type CustomParameterValue = number | RandomValueRange | RandomValueList<number> | ParameterLinkRelation;
2538
+ /** A local parameter: a value declared by the animation that other values can follow. */
2539
+ type CustomParameterOption = {
2540
+ /** Public name, unique among the animation's globals and locals. */
2541
+ id: string;
2542
+ /** `'continuous'` (any number of the domain), `'discrete'` (whole numbers) or `'label'` (one of a list of names). */
2543
+ type: CustomParameterType;
2544
+ /** The name a tool shows for it. */
2545
+ label: string;
2546
+ /** The range of a number, or the names of a `'label'` parameter. */
2547
+ domain: NumericDomain | string[];
2548
+ /** The value, in any of the four modes: Fixed, Range, List or Linked. */
2549
+ value: CustomParameterValue;
2550
+ /** Sampling scope for Range / Random list values. Default `'playback'`. */
2551
+ sampleScope?: CustomParameterSampleScope;
2552
+ };
2553
+
2554
+ /**
2555
+ * One stop of a gradient: `[position, color]`. The color is a `0xRRGGBB` number. The position is from 0 to 1
2556
+ * in a `ColorRandomRange`, and in the source parameter's own units in a `ColorGradientDefinition`. Stops go in
2557
+ * non-decreasing order of position.
2558
+ */
2559
+ type ColorStop = [number, number];
2560
+ /**
2561
+ * A color that follows a parameter: the live value of the source picks a
2562
+ * position on the gradient, on every frame.
2563
+ */
2564
+ interface ColorGradientDefinition {
2565
+ /**
2566
+ * The gradient, as `[position, color]` pairs in non-decreasing order of position: the position is a value
2567
+ * of the source, in its own units, and the color a `0xRRGGBB` number.
2568
+ */
2569
+ stops: ColorStop[];
2570
+ /** The source whose value is the position: `lifeProgress` for a color over the particle's life. */
2571
+ sourceParameterId: string;
2572
+ }
2573
+ /**
2574
+ * A gradient the particle samples ONCE at spawn to freeze a random color for
2575
+ * its whole life. `stops` positions are normalized to [0,1]; a random position
2576
+ * `x∈[0,1]` is drawn (optionally biased by `distribution`) and mapped through
2577
+ * the gradient. Distinguished from `ColorGradientDefinition` by the absence of
2578
+ * `sourceParameterId` (that one re-samples every frame against a live source).
2579
+ */
2580
+ interface ColorRandomRange {
2581
+ /** The gradient to pick from, as `[position, color]` pairs. */
2582
+ stops: ColorStop[];
2583
+ /** How likely each position of the gradient is to be picked: x is the position (0 to 1), y the relative probability. Absent, every position is as likely as any other. */
2584
+ distribution?: CurveDefinition;
2585
+ /** Which preset `distribution` is, or `custom`. The engine reads `distribution`, not this. */
2586
+ distributionKind?: ProbabilityCurveKind;
2587
+ }
2588
+ /**
2589
+ * A color in any of its modes; every color in it is a `0xRRGGBB` number:
2590
+ * - a number: that color, fixed.
2591
+ * - `ColorGradientDefinition`: a gradient that follows a parameter.
2592
+ * - `ColorRandomRange`: a random color of a gradient, frozen at birth.
2593
+ * - `RandomValueList<number>`: one color of a list.
2594
+ */
2595
+ type SpawnColor = number | ColorGradientDefinition | ColorRandomRange | RandomValueList<number>;
2596
+
2597
+ export { type ParameterModifierSource as $, type AnimationDescription as A, type LayerOptionType as B, type CapacityOptions as C, type DiagnosticsPolicy as D, type EmissionOptions as E, LocalDefaultHandle as F, type GlobalParameterOption as G, LocalParameterHandle as H, type InitialStateOptions as I, type ModulatableNumber as J, type KineticsOptions as K, type LayerOptionPath as L, type ModifierBlendMode as M, type ModulatedValue as N, type ModulatorOptions as O, PerseonIntegration as P, type ModulatorShape as Q, type NumberOptions as R, type NumericDomain as S, type OptionNodeKind as T, type OptionStage as U, type OptionStrategy as V, type ParameterDescription as W, ParameterHandle as X, type ParameterInitOptions as Y, type ParameterLinkRelation as Z, type ParameterModifier as _, type AnimationPlayOptions as a, type OptionPathEntry as a$, type ParameterUpdateOptions as a0, type ParticleAnimationOptions as a1, type ParticleEventBinding as a2, type ParticleEventBindings as a3, type ParticleEventTrigger as a4, type ParticleEventsByTrigger as a5, type ParticleHookEmitter as a6, type ParticleHookPlayback as a7, type ParticleHookRandom as a8, ParticleItem as a9, type RandomListState as aA, type RandomValueList as aB, type RandomValueListMode as aC, type RandomValueRange as aD, type RandomnessOptions as aE, type RandomnessSeedMode as aF, type RectangleArea as aG, type RegionBehavior as aH, type RegionOptions as aI, type RingArea as aJ, type ScaleOptions as aK, type ShapeArea as aL, type SingleTextureOption as aM, type SpawnColor as aN, type SpawnNumber as aO, type SpawnPoint as aP, type SpawnPosition as aQ, type SpawnVector as aR, type SpriteAnimationOptions as aS, type SpriteAnimationTexturesOptions as aT, type TextDomain as aU, type TextureElement as aV, type Unsubscribe as aW, type ValueProbability as aX, type VectorValue as aY, EMITTER_EVENT_TRIGGERS as aZ, OPTION_PATH_CATALOG as a_, ParticleLayerView as aa, type ParticleLayerOptions as ab, type ParticleLimitStrategy as ac, type ParticleRegionRef as ad, type ParticleSnapshot as ae, type ParticleSnapshotObject as af, type ParticleSpawnStrategy as ag, type ParticleSpriteAnimationParameters as ah, type PerformanceOptions as ai, PerseonAnimation as aj, type PerseonEvent as ak, PerseonPlayback as al, type PlaybackFinishedReason as am, type PlaybackFinishedResult as an, type PlaybackHost as ao, type PlaybackOptionPath as ap, type PlaybackOptionType as aq, type PlaybackOptions as ar, type PointForceConfig as as, type PointForceFalloff as at, type PointForceMode as au, type PointValue as av, type PolygonArea as aw, type ProbabilityCurveKind as ax, type ProbabilityCurvePreset as ay, type ProbabilityCurvePresetId as az, type AnimationRandomnessOptions as b, type OptionScope as b0, PARTICLE_EVENT_TRIGGERS as b1, findOptionPathEntry as b2, isEmitterEventTrigger as b3, isEventTrigger as b4, isParticleEventTrigger as b5, isValidEventName as b6, type CapsuleArea as c, type CircleArea as d, type ColorGradientDefinition as e, type ColorOptions as f, type ColorRandomRange as g, type ColorStop as h, type CurveDefinition as i, type CustomParameterOption as j, type CustomParameterSampleScope as k, type CustomParameterType as l, type CustomParameterValue as m, type EmissionTransform as n, EmitterView as o, type EmitterEventBinding as p, type EmitterEventBindings as q, type EmitterEventTrigger as r, type EmitterEventsByTrigger as s, type EmitterOptionPath as t, type EmitterOptionType as u, type EmitterOptions as v, type EventTrigger as w, type ExternalForcesFactorOptions as x, type ExternalForcesOptions as y, type ExternalForcesTypes as z };