laymur 0.27.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +99 -5
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +14 -3
  3. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +40 -6
  4. package/dist/core/constraints/UICustomConstraint.js +2 -2
  5. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +3 -2
  6. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +3 -2
  7. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +3 -2
  8. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +3 -2
  9. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +6 -0
  10. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +8 -0
  11. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +3 -2
  12. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +3 -2
  13. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +3 -2
  14. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +3 -2
  15. package/dist/core/constraints/constraintAsserts.d.ts +41 -0
  16. package/dist/core/constraints/constraintAsserts.js +171 -0
  17. package/dist/core/elements/UICanvasElement/UICanvasElement.d.ts +54 -0
  18. package/dist/core/elements/UICanvasElement/UICanvasElement.js +70 -0
  19. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +2 -0
  20. package/dist/core/elements/UIDummy/UIDummy.d.ts +8 -5
  21. package/dist/core/elements/UIDummy/UIDummy.js +24 -11
  22. package/dist/core/elements/UIElement/UIElement.Internal.d.ts +6 -5
  23. package/dist/core/elements/UIElement/UIElement.Internal.js +0 -4
  24. package/dist/core/elements/UIElement/UIElement.d.ts +12 -6
  25. package/dist/core/elements/UIElement/UIElement.js +14 -7
  26. package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +42 -2
  27. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +2 -2
  28. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +48 -34
  29. package/dist/core/elements/UIGraphics/UIGraphics.js +196 -93
  30. package/dist/core/elements/UIImage/UIImage.d.ts +11 -1
  31. package/dist/core/elements/UIImage/UIImage.js +14 -0
  32. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +10 -1
  33. package/dist/core/elements/UIScene/UIScene.Internal.js +1 -0
  34. package/dist/core/elements/UIScene/UIScene.d.ts +11 -1
  35. package/dist/core/elements/UIScene/UIScene.js +29 -5
  36. package/dist/core/elements/UIText/UIText.Interfaces.d.ts +2 -2
  37. package/dist/core/elements/UIText/UIText.Internal.d.ts +14 -1
  38. package/dist/core/elements/UIText/UIText.Internal.js +12 -0
  39. package/dist/core/elements/UIText/UIText.Measuring.d.ts +9 -4
  40. package/dist/core/elements/UIText/UIText.Measuring.js +17 -6
  41. package/dist/core/elements/UIText/UIText.Rendering.d.ts +7 -16
  42. package/dist/core/elements/UIText/UIText.Rendering.js +212 -46
  43. package/dist/core/elements/UIText/UIText.d.ts +64 -29
  44. package/dist/core/elements/UIText/UIText.js +134 -149
  45. package/dist/core/index.d.ts +10 -4
  46. package/dist/core/index.js +5 -1
  47. package/dist/core/layers/UILayer/UILayer.d.ts +17 -3
  48. package/dist/core/layers/UILayer/UILayer.js +35 -4
  49. package/dist/core/layers/UIViewportLayer/UIViewportLayer.d.ts +2 -0
  50. package/dist/core/layers/UIViewportLayer/UIViewportLayer.js +4 -1
  51. package/dist/core/miscellaneous/UIBlendMode.d.ts +5 -0
  52. package/dist/core/miscellaneous/UIBlendMode.js +7 -0
  53. package/dist/core/miscellaneous/asserts.d.ts +0 -41
  54. package/dist/core/miscellaneous/asserts.js +0 -170
  55. package/dist/core/miscellaneous/canvas-surface/UICanvasSurface.d.ts +46 -0
  56. package/dist/core/miscellaneous/canvas-surface/UICanvasSurface.js +86 -0
  57. package/dist/core/miscellaneous/color/UIColor.d.ts +17 -0
  58. package/dist/core/miscellaneous/color/UIColor.js +22 -0
  59. package/dist/core/miscellaneous/color/canvasColor.d.ts +9 -0
  60. package/dist/core/miscellaneous/color/canvasColor.js +15 -0
  61. package/dist/core/miscellaneous/insets/UIInsets.d.ts +3 -0
  62. package/dist/core/miscellaneous/insets/UIInsets.js +15 -0
  63. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +10 -7
  64. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +11 -8
  65. package/dist/core/miscellaneous/paint/UIGradient.Internal.d.ts +37 -0
  66. package/dist/core/miscellaneous/paint/UIGradient.Internal.js +14 -0
  67. package/dist/core/miscellaneous/paint/UIGradient.d.ts +18 -0
  68. package/dist/core/miscellaneous/paint/UIGradient.js +35 -0
  69. package/dist/core/miscellaneous/paint/UILinearGradient.d.ts +14 -0
  70. package/dist/core/miscellaneous/paint/UILinearGradient.js +22 -0
  71. package/dist/core/miscellaneous/paint/UIPaint.Internal.d.ts +21 -0
  72. package/dist/core/miscellaneous/paint/UIPaint.Internal.js +1 -0
  73. package/dist/core/miscellaneous/paint/UIPaint.d.ts +17 -0
  74. package/dist/core/miscellaneous/paint/UIPaint.js +21 -0
  75. package/dist/core/miscellaneous/paint/UIRadialGradient.d.ts +18 -0
  76. package/dist/core/miscellaneous/paint/UIRadialGradient.js +33 -0
  77. package/dist/core/miscellaneous/shared.d.ts +14 -0
  78. package/dist/core/miscellaneous/shared.js +11 -0
  79. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +91 -30
  80. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +12 -8
  81. package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +41 -63
  82. package/dist/core/miscellaneous/text-style/UITextStyle.js +165 -291
  83. package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +2 -1
  84. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +12 -3
  85. package/dist/core/shaders/UIProgressMaskFunctionCircular.js +1 -2
  86. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +7 -3
  87. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +2 -1
  88. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +19 -10
  89. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +6 -2
  90. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +41 -9
  91. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +97 -35
  92. package/dist/particles/behaviorModules/UIBehaviorAlignToVelocity.d.ts +44 -0
  93. package/dist/particles/behaviorModules/UIBehaviorAlignToVelocity.js +75 -0
  94. package/dist/particles/behaviorModules/UIBehaviorBounce.d.ts +51 -0
  95. package/dist/particles/behaviorModules/UIBehaviorBounce.js +107 -0
  96. package/dist/particles/behaviorModules/UIBehaviorOrbit.d.ts +39 -0
  97. package/dist/particles/behaviorModules/UIBehaviorOrbit.js +73 -0
  98. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +7 -2
  99. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +9 -5
  100. package/dist/particles/behaviorModules/UIBehaviorSeek.d.ts +38 -0
  101. package/dist/particles/behaviorModules/UIBehaviorSeek.js +75 -0
  102. package/dist/particles/elements/UIEmitter.Internal.d.ts +48 -1
  103. package/dist/particles/elements/UIEmitter.Internal.js +26 -1
  104. package/dist/particles/elements/UIEmitter.Schedule.d.ts +31 -0
  105. package/dist/particles/elements/UIEmitter.Schedule.js +81 -0
  106. package/dist/particles/elements/UIEmitter.d.ts +79 -9
  107. package/dist/particles/elements/UIEmitter.js +241 -83
  108. package/dist/particles/index.d.ts +13 -1
  109. package/dist/particles/index.js +11 -1
  110. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +6 -0
  111. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +27 -0
  112. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +7 -1
  113. package/dist/particles/instancedParticle/UIInstancedParticle.js +12 -1
  114. package/dist/particles/miscellaneous/miscellaneous.d.ts +22 -0
  115. package/dist/particles/miscellaneous/miscellaneous.js +38 -0
  116. package/dist/particles/renderingModules/UIRenderingFlipbook.d.ts +41 -0
  117. package/dist/particles/renderingModules/UIRenderingFlipbook.js +70 -0
  118. package/dist/particles/renderingModules/UIRenderingModule.d.ts +2 -1
  119. package/dist/particles/renderingModules/UIRenderingModule.js +2 -1
  120. package/dist/particles/renderingModules/UIRenderingRandomColor.d.ts +19 -0
  121. package/dist/particles/renderingModules/UIRenderingRandomColor.js +28 -0
  122. package/dist/particles/renderingModules/UIRenderingShape.d.ts +31 -0
  123. package/dist/particles/renderingModules/UIRenderingShape.js +54 -0
  124. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +1 -1
  125. package/dist/particles/renderingModules/UIRenderingTexture.js +4 -28
  126. package/dist/particles/shaders/UIRenderingFlipbook.d.ts +5 -0
  127. package/dist/particles/shaders/UIRenderingFlipbook.js +19 -0
  128. package/dist/particles/shaders/UIRenderingRandomColor.d.ts +2 -0
  129. package/dist/particles/shaders/UIRenderingRandomColor.js +10 -0
  130. package/dist/particles/shaders/UIRenderingShape.d.ts +6 -0
  131. package/dist/particles/shaders/UIRenderingShape.js +15 -0
  132. package/dist/particles/shaders/UIRenderingTexture.d.ts +4 -2
  133. package/dist/particles/shaders/UIRenderingTexture.js +27 -2
  134. package/dist/particles/spawnModules/UISpawnCircle.d.ts +44 -0
  135. package/dist/particles/spawnModules/UISpawnCircle.js +81 -0
  136. package/dist/particles/spawnModules/UISpawnRadialVelocity.d.ts +37 -0
  137. package/dist/particles/spawnModules/UISpawnRadialVelocity.js +75 -0
  138. package/package.json +1 -1
@@ -1,13 +1,17 @@
1
+ import type { FerrsignView2 } from "ferrsign";
1
2
  import { UIAnchor } from "../../core/elements/UIAnchor/UIAnchor.js";
2
- import type { UILayer } from "../../core/index.js";
3
+ import type { UIBlendMode, UILayer } from "../../core/index.js";
3
4
  import type { UIBehaviorModule } from "../behaviorModules/UIBehaviorModule.js";
4
5
  import type { UIRenderingModule } from "../renderingModules/UIRenderingModule.js";
5
6
  import type { UISpawnModule } from "../spawnModules/UISpawnModule.js";
6
7
  import type { UIEmitterMode, UIEmitterOptions, UIEmitterPlayOptions } from "./UIEmitter.Internal.js";
8
+ import { UIEmitterSpace } from "./UIEmitter.Internal.js";
7
9
  /**
8
10
  * Particle emitter element.
9
11
  *
10
- * Spawns, updates, and renders particles using modular spawn/behavior/rendering pipeline.
12
+ * Spawns, updates, and renders particles using modular spawn/behavior/rendering pipeline. Each
13
+ * frame ages the particles and removes the dead ones, spawns the particles due, runs the behavior
14
+ * modules and moves the particles along their velocity.
11
15
  */
12
16
  export declare class UIEmitter extends UIAnchor {
13
17
  private readonly spawnSequence;
@@ -17,15 +21,26 @@ export declare class UIEmitter extends UIAnchor {
17
21
  automaticallyDestroyModules: boolean;
18
22
  private readonly mesh;
19
23
  private readonly catcherHandler;
20
- private emissionRate;
21
- private emissionAccumulator;
22
- private emissionDuration;
23
- private emissionElapsed;
24
+ private readonly emission;
25
+ /** Path of the emitter over the current frame, along which emission places particles */
26
+ private readonly framePath;
27
+ /** Path of a single point and moment, for bursts */
28
+ private readonly pointPath;
29
+ /** Layer positions of the particles that died this frame, x and y in turn */
30
+ private readonly deadPositions;
31
+ private readonly signalParticleDiedInternal;
24
32
  private modeInternal;
33
+ private blendModeInternal;
34
+ private spaceInternal;
25
35
  private maxDeltaTimeInternal;
26
36
  private seedInternal;
27
37
  /** Particles spawned since the seed was set; picks the seed of the next particle */
28
38
  private spawnedCount;
39
+ /** Emitter position at the end of the last frame, where the emission of this frame starts */
40
+ private previousX;
41
+ private previousY;
42
+ /** Whether `play` was called since the last frame: its emission starts at the current position */
43
+ private emissionStarted;
29
44
  /**
30
45
  * @param layer - Layer containing this emitter
31
46
  * @param spawnSequence - Modules that initialize new particles
@@ -34,19 +49,38 @@ export declare class UIEmitter extends UIAnchor {
34
49
  * @param options - Configuration options
35
50
  */
36
51
  constructor(layer: UILayer, spawnSequence: UISpawnModule[], behaviorSequence: readonly UIBehaviorModule[], renderingSequence: readonly UIRenderingModule[], options?: Partial<UIEmitterOptions>);
52
+ /**
53
+ * Fires for every particle that dies, with its position in layer coordinates. Fires after the
54
+ * frame removed its dead particles, so a callback may spawn particles, also on this emitter.
55
+ */
56
+ get signalParticleDied(): FerrsignView2<number, number>;
37
57
  /** Seed of the random values */
38
58
  get seed(): number;
39
59
  /** Longest frame step in seconds; longer frames are clamped */
40
60
  get maxDeltaTime(): number;
41
61
  /** Visibility mode */
42
62
  get mode(): UIEmitterMode;
63
+ /** Color blending of the particles with what is drawn under them */
64
+ get blendMode(): UIBlendMode;
65
+ /** Coordinate space of particle positions */
66
+ get space(): UIEmitterSpace;
43
67
  /**
44
68
  * Rendering order among the elements of the layer. Higher values on top; elements with equal
45
69
  * values keep the order of creation, a later one on top.
46
70
  */
47
71
  get zIndex(): number;
72
+ /**
73
+ * Layer point particle positions are relative to: the emitter in LOCAL space, where live
74
+ * particles move with it, the layer origin in WORLD space
75
+ */
76
+ private get originX();
77
+ private get originY();
48
78
  /** Visibility mode */
49
79
  set mode(value: UIEmitterMode);
80
+ /** Color blending of the particles with what is drawn under them */
81
+ set blendMode(value: UIBlendMode);
82
+ /** Coordinate space of particle positions. Live particles keep their place on the layer. */
83
+ set space(value: UIEmitterSpace);
50
84
  /** Longest frame step in seconds; longer frames are clamped */
51
85
  set maxDeltaTime(value: number);
52
86
  /**
@@ -66,18 +100,54 @@ export declare class UIEmitter extends UIAnchor {
66
100
  * @param count - Number of particles to create, a non-negative integer
67
101
  */
68
102
  burst(count: number): void;
103
+ /**
104
+ * Spawns particles immediately as if the emitter stood at a point, such as where a particle of
105
+ * another emitter died
106
+ *
107
+ * @param count - Number of particles to create, a non-negative integer
108
+ * @param x - Point in layer coordinates
109
+ * @param y - Point in layer coordinates
110
+ */
111
+ burstAt(count: number, x: number, y: number): void;
112
+ /**
113
+ * Runs the simulation ahead without drawing, so that an emission started with `play` shows
114
+ * its particles in full from the first frame. The emitter stays where it is meanwhile.
115
+ *
116
+ * @param duration - Seconds to simulate
117
+ * @param step - Simulation step in seconds; the last step is shorter if needed
118
+ */
119
+ prewarm(duration: number, step?: number): void;
69
120
  /** Removes all active particles */
70
121
  clear(): void;
71
122
  /**
72
- * Starts continuous particle emission.
123
+ * Starts particle emission: a stream by time and by distance moved, and bursts. Particles due
124
+ * within a frame are spread over it.
73
125
  *
74
126
  * @param rate - Particles per second
75
- * @param options - Emission duration and other settings
127
+ * @param options - Duration, particles per distance and bursts
76
128
  */
77
129
  play(rate: number, options?: Partial<UIEmitterPlayOptions>): void;
78
- /** Stops continuous particle emission */
130
+ /** Stops particle emission; live particles play out */
79
131
  stop(): void;
80
132
  /** Frees the particles and the input catcher, optionally destroys modules */
81
133
  protected destroyInternal(): void;
134
+ /** Sets the point path to a point at the end of the last frame */
135
+ private setPointPath;
136
+ /**
137
+ * Spawns particles at moments `firstMoment + k * interval` seconds from the start of a frame.
138
+ * Spawn modules write a particle relative to the emitter; it is then placed at the point of the
139
+ * path at its moment and aged by the rest of the frame.
140
+ */
141
+ private spawnParticles;
142
+ /** Spawns the particles the emission schedule hands out, along the frame path */
143
+ private readonly spawnDue;
144
+ /** Spawns the particles of the emission due within a frame of `deltaTime` seconds */
145
+ private emit;
146
+ /** Removes the dead particles and reports them through the signal */
147
+ private removeDeadParticles;
148
+ /** Records the layer position of a dead particle */
149
+ private readonly collectDeadParticle;
150
+ /** Advances the particles and the emission by `deltaTime` seconds */
151
+ private simulate;
82
152
  private readonly onRendering;
83
153
  }
@@ -1,12 +1,15 @@
1
+ import { Ferrsign2 } from "ferrsign";
1
2
  import { Vector2 } from "three";
2
3
  import { UIAnchor } from "../../core/elements/UIAnchor/UIAnchor.js";
3
- import { assertValidNumber, assertValidPositiveNumber } from "../../core/miscellaneous/asserts.js";
4
+ import { assertValidNonNegativeNumber, assertValidNumber, assertValidPositiveNumber, } from "../../core/miscellaneous/asserts.js";
4
5
  import { resolveGLSLTypeInfo } from "../../core/miscellaneous/generic-plane/shared.js";
6
+ import { blendModeToFactor } from "../../core/miscellaneous/UIBlendMode.js";
5
7
  import { isUIModeVisible } from "../../core/miscellaneous/UIMode.js";
6
- import { collectProperties, collectRenderingUniforms, } from "../instancedParticle/UIInstancedParticle.Internal.js";
8
+ import { assignRenderingRandomValues, collectProperties, collectRenderingUniforms, } from "../instancedParticle/UIInstancedParticle.Internal.js";
7
9
  import { UIInstancedParticle } from "../instancedParticle/UIInstancedParticle.js";
8
- import { assertValidNonNegativeInteger, BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_D, BUILTIN_OFFSET_RANDOM_E, BUILTIN_OFFSET_ROTATION, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y, BUILTIN_OFFSET_TORQUE, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, computeParticleSeed, particleRandom, particleRandomStream, writeParticleSeed, } from "../miscellaneous/miscellaneous.js";
9
- import { EMITTER_BEHAVIOR_SALT_BASE, EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_LIFETIME, EMITTER_DEFAULT_MAX_DELTA_TIME, EMITTER_DEFAULT_MODE, EMITTER_SHADER_SALT, EMITTER_SPAWN_SALT_BASE, ignoreInput, } from "./UIEmitter.Internal.js";
10
+ import { assertValidNonNegativeInteger, BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_D, BUILTIN_OFFSET_RANDOM_E, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y, computeParticleSeed, particleRandom, particleRandomStream, writeParticleSeed, } from "../miscellaneous/miscellaneous.js";
11
+ import { advanceParticle, EMITTER_BEHAVIOR_SALT_BASE, EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_BLEND_MODE, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_LIFETIME, EMITTER_DEFAULT_MAX_DELTA_TIME, EMITTER_DEFAULT_MODE, EMITTER_DEFAULT_PREWARM_STEP, EMITTER_DEFAULT_SPACE, EMITTER_DEFAULT_Z_INDEX, EMITTER_SHADER_SALT, EMITTER_SPAWN_SALT_BASE, ignoreInput, UIEmitterSpace, } from "./UIEmitter.Internal.js";
12
+ import { UIEmissionSchedule } from "./UIEmitter.Schedule.js";
10
13
  /** Builtin slots of the random values the shaders read, each with its stream */
11
14
  const SHADER_RANDOM_SLOTS = [
12
15
  BUILTIN_OFFSET_RANDOM_A,
@@ -21,7 +24,9 @@ const SHADER_RANDOM_SLOTS = [
21
24
  /**
22
25
  * Particle emitter element.
23
26
  *
24
- * Spawns, updates, and renders particles using modular spawn/behavior/rendering pipeline.
27
+ * Spawns, updates, and renders particles using modular spawn/behavior/rendering pipeline. Each
28
+ * frame ages the particles and removes the dead ones, spawns the particles due, runs the behavior
29
+ * modules and moves the particles along their velocity.
25
30
  */
26
31
  export class UIEmitter extends UIAnchor {
27
32
  /**
@@ -36,58 +41,34 @@ export class UIEmitter extends UIAnchor {
36
41
  this.spawnSequence = spawnSequence;
37
42
  this.behaviorSequence = behaviorSequence;
38
43
  this.renderingSequence = renderingSequence;
39
- this.emissionRate = 0;
40
- this.emissionAccumulator = 0;
41
- this.emissionDuration = Infinity;
42
- this.emissionElapsed = 0;
44
+ this.emission = new UIEmissionSchedule();
45
+ /** Path of the emitter over the current frame, along which emission places particles */
46
+ this.framePath = { time: 0, fromX: 0, fromY: 0, toX: 0, toY: 0 };
47
+ /** Path of a single point and moment, for bursts */
48
+ this.pointPath = { time: 0, fromX: 0, fromY: 0, toX: 0, toY: 0 };
49
+ /** Layer positions of the particles that died this frame, x and y in turn */
50
+ this.deadPositions = [];
51
+ this.signalParticleDiedInternal = new Ferrsign2();
43
52
  /** Particles spawned since the seed was set; picks the seed of the next particle */
44
53
  this.spawnedCount = 0;
54
+ /** Whether `play` was called since the last frame: its emission starts at the current position */
55
+ this.emissionStarted = false;
56
+ /** Spawns the particles the emission schedule hands out, along the frame path */
57
+ this.spawnDue = (count, firstMoment, interval) => {
58
+ this.spawnParticles(count, firstMoment, interval, this.framePath);
59
+ };
60
+ /** Records the layer position of a dead particle */
61
+ this.collectDeadParticle = (array, itemOffset) => {
62
+ this.deadPositions.push(array[itemOffset + BUILTIN_OFFSET_POSITION_X] + this.originX, array[itemOffset + BUILTIN_OFFSET_POSITION_Y] + this.originY);
63
+ };
45
64
  this.onRendering = (renderer, rawDeltaTime) => {
46
65
  this.layer.sceneWrapper.setOrderedObjectDepth(this.mesh, this.layer.inputWrapper.getDepth(this.catcherHandler));
47
- const deltaTime = Math.min(rawDeltaTime, this.maxDeltaTimeInternal);
48
- if (this.mesh.instanceCount > 0) {
49
- const { array, itemSize } = this.mesh.propertyBuffers.builtin;
50
- for (let i = 0; i < this.mesh.instanceCount; i++) {
51
- array[i * itemSize + BUILTIN_OFFSET_AGE] += deltaTime;
52
- }
53
- this.mesh.removeDeadParticles();
54
- }
55
- if (this.emissionRate > 0) {
56
- const emittedBefore = this.emissionElapsed;
57
- this.emissionElapsed += deltaTime;
58
- this.emissionAccumulator +=
59
- this.emissionRate * (Math.min(this.emissionElapsed, this.emissionDuration) - emittedBefore);
60
- const particlesToSpawn = Math.floor(this.emissionAccumulator);
61
- if (particlesToSpawn > 0) {
62
- this.burst(particlesToSpawn);
63
- this.emissionAccumulator -= particlesToSpawn;
64
- }
65
- if (this.emissionElapsed >= this.emissionDuration) {
66
- this.stop();
67
- }
68
- }
66
+ this.simulate(Math.min(rawDeltaTime, this.maxDeltaTimeInternal));
69
67
  if (this.mesh.instanceCount === 0) {
70
68
  return;
71
69
  }
72
- this.mesh.setOrigin(this.x, this.y);
73
- {
74
- const { propertyBuffers, instanceCount } = this.mesh;
75
- for (let index = 0; index < this.behaviorSequence.length; index++) {
76
- this.behaviorSequence[index].update(propertyBuffers, instanceCount, deltaTime, EMITTER_BEHAVIOR_SALT_BASE + index);
77
- }
78
- }
79
- const { builtin } = this.mesh.propertyBuffers;
80
- const { array, itemSize } = builtin;
81
- for (let i = 0; i < this.mesh.instanceCount; i++) {
82
- const itemOffset = i * itemSize;
83
- array[itemOffset + BUILTIN_OFFSET_POSITION_X] +=
84
- array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] * deltaTime;
85
- array[itemOffset + BUILTIN_OFFSET_POSITION_Y] +=
86
- array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] * deltaTime;
87
- array[itemOffset + BUILTIN_OFFSET_ROTATION] +=
88
- array[itemOffset + BUILTIN_OFFSET_TORQUE] * deltaTime;
89
- }
90
- builtin.needsUpdate = true;
70
+ this.mesh.setOrigin(this.originX, this.originY);
71
+ // The only upload of a frame: bursts and prewarm between frames are drawn by the next one.
91
72
  this.mesh.limitUploadToLiveInstances();
92
73
  };
93
74
  const collectedProperties = {
@@ -103,11 +84,17 @@ export class UIEmitter extends UIAnchor {
103
84
  collectProperties(collectedProperties, spawnSequence, "UIEmitter.constructor.spawnSequence");
104
85
  collectProperties(collectedProperties, behaviorSequence, "UIEmitter.constructor.behaviorSequence");
105
86
  collectProperties(collectedProperties, renderingSequence, "UIEmitter.constructor.renderingSequence");
87
+ this.blendModeInternal = options.blendMode ?? EMITTER_DEFAULT_BLEND_MODE;
106
88
  const collectedUniforms = {
107
89
  origin: { value: new Vector2(), glslTypeInfo: resolveGLSLTypeInfo("Vector2") },
90
+ blendFactor: {
91
+ value: blendModeToFactor(this.blendModeInternal),
92
+ glslTypeInfo: resolveGLSLTypeInfo("number"),
93
+ },
108
94
  };
109
- const renderingSources = collectRenderingUniforms(collectedUniforms, renderingSequence, "UIEmitter.constructor.renderingSequence");
110
- const zIndex = 0;
95
+ const renderingSources = assignRenderingRandomValues(collectRenderingUniforms(collectedUniforms, renderingSequence, "UIEmitter.constructor.renderingSequence"), "UIEmitter.constructor.renderingSequence");
96
+ const zIndex = options.zIndex ?? EMITTER_DEFAULT_Z_INDEX;
97
+ assertValidNumber(zIndex, "UIEmitter.constructor.options.zIndex");
111
98
  this.catcherHandler = this.layer.inputWrapper.createInputCatcher({
112
99
  catchPointerDown: ignoreInput,
113
100
  catchPointerMove: ignoreInput,
@@ -121,11 +108,21 @@ export class UIEmitter extends UIAnchor {
121
108
  options.automaticallyDestroyModules ?? EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES;
122
109
  this.modeInternal = options.mode ?? EMITTER_DEFAULT_MODE;
123
110
  this.mesh.visible = isUIModeVisible(this.modeInternal);
111
+ this.spaceInternal = options.space ?? EMITTER_DEFAULT_SPACE;
112
+ this.previousX = this.x;
113
+ this.previousY = this.y;
124
114
  this.maxDeltaTimeInternal = options.maxDeltaTime ?? EMITTER_DEFAULT_MAX_DELTA_TIME;
125
115
  assertValidPositiveNumber(this.maxDeltaTimeInternal, "UIEmitter.constructor.maxDeltaTime");
126
116
  this.seedInternal = options.seed ?? Math.floor(Math.random() * 0x100000000);
127
117
  assertValidNonNegativeInteger(this.seedInternal, "UIEmitter.constructor.seed");
128
118
  }
119
+ /**
120
+ * Fires for every particle that dies, with its position in layer coordinates. Fires after the
121
+ * frame removed its dead particles, so a callback may spawn particles, also on this emitter.
122
+ */
123
+ get signalParticleDied() {
124
+ return this.signalParticleDiedInternal;
125
+ }
129
126
  /** Seed of the random values */
130
127
  get seed() {
131
128
  return this.seedInternal;
@@ -138,6 +135,14 @@ export class UIEmitter extends UIAnchor {
138
135
  get mode() {
139
136
  return this.modeInternal;
140
137
  }
138
+ /** Color blending of the particles with what is drawn under them */
139
+ get blendMode() {
140
+ return this.blendModeInternal;
141
+ }
142
+ /** Coordinate space of particle positions */
143
+ get space() {
144
+ return this.spaceInternal;
145
+ }
141
146
  /**
142
147
  * Rendering order among the elements of the layer. Higher values on top; elements with equal
143
148
  * values keep the order of creation, a later one on top.
@@ -145,6 +150,16 @@ export class UIEmitter extends UIAnchor {
145
150
  get zIndex() {
146
151
  return this.layer.inputWrapper.getZIndex(this.catcherHandler);
147
152
  }
153
+ /**
154
+ * Layer point particle positions are relative to: the emitter in LOCAL space, where live
155
+ * particles move with it, the layer origin in WORLD space
156
+ */
157
+ get originX() {
158
+ return this.spaceInternal === UIEmitterSpace.WORLD ? 0 : this.x;
159
+ }
160
+ get originY() {
161
+ return this.spaceInternal === UIEmitterSpace.WORLD ? 0 : this.y;
162
+ }
148
163
  /** Visibility mode */
149
164
  set mode(value) {
150
165
  this.assertNotDestroyed("UIEmitter.mode");
@@ -153,6 +168,31 @@ export class UIEmitter extends UIAnchor {
153
168
  this.mesh.visible = isUIModeVisible(value);
154
169
  }
155
170
  }
171
+ /** Color blending of the particles with what is drawn under them */
172
+ set blendMode(value) {
173
+ this.assertNotDestroyed("UIEmitter.blendMode");
174
+ this.blendModeInternal = value;
175
+ this.mesh.setBlendFactor(blendModeToFactor(value));
176
+ }
177
+ /** Coordinate space of particle positions. Live particles keep their place on the layer. */
178
+ set space(value) {
179
+ this.assertNotDestroyed("UIEmitter.space");
180
+ if (this.spaceInternal === value) {
181
+ return;
182
+ }
183
+ const previousOriginX = this.originX;
184
+ const previousOriginY = this.originY;
185
+ this.spaceInternal = value;
186
+ const shiftX = previousOriginX - this.originX;
187
+ const shiftY = previousOriginY - this.originY;
188
+ const { builtin } = this.mesh.propertyBuffers;
189
+ const { array, itemSize } = builtin;
190
+ for (let i = 0; i < this.mesh.instanceCount; i++) {
191
+ array[i * itemSize + BUILTIN_OFFSET_POSITION_X] += shiftX;
192
+ array[i * itemSize + BUILTIN_OFFSET_POSITION_Y] += shiftY;
193
+ }
194
+ builtin.needsUpdate = true;
195
+ }
156
196
  /** Longest frame step in seconds; longer frames are clamped */
157
197
  set maxDeltaTime(value) {
158
198
  this.assertNotDestroyed("UIEmitter.maxDeltaTime");
@@ -190,28 +230,40 @@ export class UIEmitter extends UIAnchor {
190
230
  if (count === 0) {
191
231
  return;
192
232
  }
193
- const instanceBegin = this.mesh.instanceCount;
194
- this.mesh.createInstances(count);
195
- const instanceEnd = this.mesh.instanceCount;
196
- // A slot may hold a dead particle's values.
197
- this.mesh.resetInstances(instanceBegin, instanceEnd);
198
- {
199
- const { array, itemSize } = this.mesh.propertyBuffers.builtin;
200
- for (let i = instanceBegin; i < instanceEnd; i++) {
201
- const itemOffset = i * itemSize;
202
- array[itemOffset + BUILTIN_OFFSET_SCALE_X] = 1;
203
- array[itemOffset + BUILTIN_OFFSET_SCALE_Y] = 1;
204
- array[itemOffset + BUILTIN_OFFSET_LIFETIME] = EMITTER_DEFAULT_LIFETIME;
205
- writeParticleSeed(array, itemOffset, computeParticleSeed(this.seedInternal, this.spawnedCount++));
206
- for (const { offset, stream } of SHADER_RANDOM_SLOTS) {
207
- array[itemOffset + offset] = particleRandom(array, itemOffset, stream);
208
- }
209
- }
233
+ this.spawnParticles(count, 0, 0, this.setPointPath(this.x, this.y));
234
+ }
235
+ /**
236
+ * Spawns particles immediately as if the emitter stood at a point, such as where a particle of
237
+ * another emitter died
238
+ *
239
+ * @param count - Number of particles to create, a non-negative integer
240
+ * @param x - Point in layer coordinates
241
+ * @param y - Point in layer coordinates
242
+ */
243
+ burstAt(count, x, y) {
244
+ this.assertNotDestroyed("UIEmitter.burstAt");
245
+ assertValidNonNegativeInteger(count, "UIEmitter.burstAt.count");
246
+ assertValidNumber(x, "UIEmitter.burstAt.x");
247
+ assertValidNumber(y, "UIEmitter.burstAt.y");
248
+ if (count === 0) {
249
+ return;
210
250
  }
211
- for (let index = 0; index < this.spawnSequence.length; index++) {
212
- this.spawnSequence[index].spawn(this.mesh.propertyBuffers, instanceBegin, instanceEnd, EMITTER_SPAWN_SALT_BASE + index);
251
+ this.spawnParticles(count, 0, 0, this.setPointPath(x, y));
252
+ }
253
+ /**
254
+ * Runs the simulation ahead without drawing, so that an emission started with `play` shows
255
+ * its particles in full from the first frame. The emitter stays where it is meanwhile.
256
+ *
257
+ * @param duration - Seconds to simulate
258
+ * @param step - Simulation step in seconds; the last step is shorter if needed
259
+ */
260
+ prewarm(duration, step = EMITTER_DEFAULT_PREWARM_STEP) {
261
+ this.assertNotDestroyed("UIEmitter.prewarm");
262
+ assertValidNonNegativeNumber(duration, "UIEmitter.prewarm.duration");
263
+ assertValidPositiveNumber(step, "UIEmitter.prewarm.step");
264
+ for (let elapsed = 0; elapsed < duration; elapsed += step) {
265
+ this.simulate(Math.min(step, duration - elapsed));
213
266
  }
214
- this.mesh.limitUploadToLiveInstances();
215
267
  }
216
268
  /** Removes all active particles */
217
269
  clear() {
@@ -219,25 +271,21 @@ export class UIEmitter extends UIAnchor {
219
271
  this.mesh.drop();
220
272
  }
221
273
  /**
222
- * Starts continuous particle emission.
274
+ * Starts particle emission: a stream by time and by distance moved, and bursts. Particles due
275
+ * within a frame are spread over it.
223
276
  *
224
277
  * @param rate - Particles per second
225
- * @param options - Emission duration and other settings
278
+ * @param options - Duration, particles per distance and bursts
226
279
  */
227
280
  play(rate, options = {}) {
228
281
  this.assertNotDestroyed("UIEmitter.play");
229
- this.emissionRate = rate;
230
- this.emissionAccumulator = 0;
231
- this.emissionDuration = options.duration ?? Infinity;
232
- this.emissionElapsed = 0;
282
+ this.emission.start(rate, options);
283
+ this.emissionStarted = true;
233
284
  }
234
- /** Stops continuous particle emission */
285
+ /** Stops particle emission; live particles play out */
235
286
  stop() {
236
287
  this.assertNotDestroyed("UIEmitter.stop");
237
- this.emissionRate = 0;
238
- this.emissionAccumulator = 0;
239
- this.emissionDuration = Infinity;
240
- this.emissionElapsed = 0;
288
+ this.emission.stop();
241
289
  }
242
290
  /** Frees the particles and the input catcher, optionally destroys modules */
243
291
  destroyInternal() {
@@ -258,4 +306,114 @@ export class UIEmitter extends UIAnchor {
258
306
  }
259
307
  super.destroyInternal();
260
308
  }
309
+ /** Sets the point path to a point at the end of the last frame */
310
+ setPointPath(x, y) {
311
+ const path = this.pointPath;
312
+ path.time = 0;
313
+ path.fromX = path.toX = x;
314
+ path.fromY = path.toY = y;
315
+ return path;
316
+ }
317
+ /**
318
+ * Spawns particles at moments `firstMoment + k * interval` seconds from the start of a frame.
319
+ * Spawn modules write a particle relative to the emitter; it is then placed at the point of the
320
+ * path at its moment and aged by the rest of the frame.
321
+ */
322
+ spawnParticles(count, firstMoment, interval, path) {
323
+ const instanceBegin = this.mesh.instanceCount;
324
+ this.mesh.createInstances(count);
325
+ const instanceEnd = this.mesh.instanceCount;
326
+ // A slot may hold a dead particle's values.
327
+ this.mesh.resetInstances(instanceBegin, instanceEnd);
328
+ const { array, itemSize } = this.mesh.propertyBuffers.builtin;
329
+ for (let i = instanceBegin; i < instanceEnd; i++) {
330
+ const itemOffset = i * itemSize;
331
+ array[itemOffset + BUILTIN_OFFSET_SCALE_X] = 1;
332
+ array[itemOffset + BUILTIN_OFFSET_SCALE_Y] = 1;
333
+ array[itemOffset + BUILTIN_OFFSET_LIFETIME] = EMITTER_DEFAULT_LIFETIME;
334
+ writeParticleSeed(array, itemOffset, computeParticleSeed(this.seedInternal, this.spawnedCount++));
335
+ for (const { offset, stream } of SHADER_RANDOM_SLOTS) {
336
+ array[itemOffset + offset] = particleRandom(array, itemOffset, stream);
337
+ }
338
+ }
339
+ for (let index = 0; index < this.spawnSequence.length; index++) {
340
+ this.spawnSequence[index].spawn(this.mesh.propertyBuffers, instanceBegin, instanceEnd, EMITTER_SPAWN_SALT_BASE + index);
341
+ }
342
+ const { time: frameTime, fromX, fromY, toX, toY } = path;
343
+ const { originX, originY } = this;
344
+ for (let i = instanceBegin; i < instanceEnd; i++) {
345
+ const itemOffset = i * itemSize;
346
+ // Rounding can put the last moment just past the frame, and the age below 0.
347
+ const moment = Math.min(firstMoment + (i - instanceBegin) * interval, frameTime);
348
+ const t = frameTime > 0 ? moment / frameTime : 1;
349
+ array[itemOffset + BUILTIN_OFFSET_POSITION_X] += fromX + (toX - fromX) * t - originX;
350
+ array[itemOffset + BUILTIN_OFFSET_POSITION_Y] += fromY + (toY - fromY) * t - originY;
351
+ // Moved back by its moment, the particle is advanced by the whole frame with the live
352
+ // ones and ends it at p + v * (frameTime - moment), with that age.
353
+ advanceParticle(array, itemOffset, -moment);
354
+ array[itemOffset + BUILTIN_OFFSET_AGE] = frameTime - moment;
355
+ }
356
+ this.mesh.propertyBuffers.builtin.needsUpdate = true;
357
+ }
358
+ /** Spawns the particles of the emission due within a frame of `deltaTime` seconds */
359
+ emit(deltaTime) {
360
+ if (!this.emission.isPlaying) {
361
+ return;
362
+ }
363
+ const x = this.x;
364
+ const y = this.y;
365
+ const started = this.emissionStarted;
366
+ this.emissionStarted = false;
367
+ const path = this.framePath;
368
+ path.time = deltaTime;
369
+ path.toX = x;
370
+ path.toY = y;
371
+ // In LOCAL space live particles move with the emitter, so its path is not traced.
372
+ if (started || this.spaceInternal === UIEmitterSpace.LOCAL) {
373
+ path.fromX = x;
374
+ path.fromY = y;
375
+ }
376
+ else {
377
+ path.fromX = this.previousX;
378
+ path.fromY = this.previousY;
379
+ }
380
+ const distance = started ? 0 : Math.hypot(x - this.previousX, y - this.previousY);
381
+ this.emission.advance(deltaTime, distance, this.spawnDue);
382
+ }
383
+ /** Removes the dead particles and reports them through the signal */
384
+ removeDeadParticles() {
385
+ const positions = this.deadPositions;
386
+ positions.length = 0;
387
+ this.mesh.removeDeadParticles(this.collectDeadParticle);
388
+ // After the removal: a callback may spawn particles, which would disturb it.
389
+ for (let i = 0; i < positions.length; i += 2) {
390
+ this.signalParticleDiedInternal.emit(positions[i], positions[i + 1]);
391
+ }
392
+ }
393
+ /** Advances the particles and the emission by `deltaTime` seconds */
394
+ simulate(deltaTime) {
395
+ if (this.mesh.instanceCount > 0) {
396
+ const { array, itemSize } = this.mesh.propertyBuffers.builtin;
397
+ for (let i = 0; i < this.mesh.instanceCount; i++) {
398
+ array[i * itemSize + BUILTIN_OFFSET_AGE] += deltaTime;
399
+ }
400
+ this.removeDeadParticles();
401
+ }
402
+ this.emit(deltaTime);
403
+ this.previousX = this.x;
404
+ this.previousY = this.y;
405
+ const { propertyBuffers, instanceCount } = this.mesh;
406
+ if (instanceCount === 0) {
407
+ return;
408
+ }
409
+ for (let index = 0; index < this.behaviorSequence.length; index++) {
410
+ this.behaviorSequence[index].update(propertyBuffers, instanceCount, deltaTime, EMITTER_BEHAVIOR_SALT_BASE + index);
411
+ }
412
+ const { builtin } = propertyBuffers;
413
+ const { array, itemSize } = builtin;
414
+ for (let i = 0; i < instanceCount; i++) {
415
+ advanceParticle(array, i * itemSize, deltaTime);
416
+ }
417
+ builtin.needsUpdate = true;
418
+ }
261
419
  }
@@ -1,23 +1,35 @@
1
+ export { UIBehaviorAlignToVelocity } from "./behaviorModules/UIBehaviorAlignToVelocity.js";
2
+ export { UIBehaviorBounce } from "./behaviorModules/UIBehaviorBounce.js";
1
3
  export { UIBehaviorDirectionalGravity } from "./behaviorModules/UIBehaviorDirectionalGravity.js";
2
4
  export { UIBehaviorModule } from "./behaviorModules/UIBehaviorModule.js";
5
+ export { UIBehaviorOrbit } from "./behaviorModules/UIBehaviorOrbit.js";
3
6
  export { UIBehaviorPointGravity } from "./behaviorModules/UIBehaviorPointGravity.js";
4
7
  export type { UIScaleOscillationAxis } from "./behaviorModules/UIBehaviorScaleOscillation.js";
5
8
  export { UIBehaviorScaleOscillation } from "./behaviorModules/UIBehaviorScaleOscillation.js";
6
9
  export { UIBehaviorScaleOverLife } from "./behaviorModules/UIBehaviorScaleOverLife.js";
10
+ export { UIBehaviorSeek } from "./behaviorModules/UIBehaviorSeek.js";
7
11
  export { UIBehaviorTorqueDamping } from "./behaviorModules/UIBehaviorTorqueDamping.js";
8
12
  export { UIBehaviorTorqueNoise } from "./behaviorModules/UIBehaviorTorqueNoise.js";
9
13
  export { UIBehaviorVelocityDamping } from "./behaviorModules/UIBehaviorVelocityDamping.js";
10
14
  export { UIBehaviorVelocityNoise } from "./behaviorModules/UIBehaviorVelocityNoise.js";
11
15
  export type { UIEmitterMode, UIEmitterOptions, UIEmitterPlayOptions, } from "./elements/UIEmitter.Internal.js";
16
+ export { UIEmitterSpace } from "./elements/UIEmitter.Internal.js";
12
17
  export { UIEmitter } from "./elements/UIEmitter.js";
13
18
  export type { UIAspectConfig, UIRange, UIRangeConfig, UIVector2Config, } from "./miscellaneous/miscellaneous.js";
14
- export { particleRandom, particleRandomStream } from "./miscellaneous/miscellaneous.js";
19
+ export { particleRandom, particleRandomStream, UIEasing } from "./miscellaneous/miscellaneous.js";
15
20
  export { UIRenderingColorOverLife } from "./renderingModules/UIRenderingColorOverLife.js";
16
21
  export { UIRenderingColorOverVelocity } from "./renderingModules/UIRenderingColorOverVelocity.js";
22
+ export type { UIRenderingFlipbookOptions } from "./renderingModules/UIRenderingFlipbook.js";
23
+ export { UIFlipbookMode, UIRenderingFlipbook } from "./renderingModules/UIRenderingFlipbook.js";
17
24
  export { UIRenderingModule } from "./renderingModules/UIRenderingModule.js";
25
+ export { UIRenderingRandomColor } from "./renderingModules/UIRenderingRandomColor.js";
26
+ export type { UIRenderingShapeOptions } from "./renderingModules/UIRenderingShape.js";
27
+ export { UIParticleShape, UIRenderingShape } from "./renderingModules/UIRenderingShape.js";
18
28
  export { UIRenderingTexture } from "./renderingModules/UIRenderingTexture.js";
29
+ export { UICircleDistribution, UISpawnCircle } from "./spawnModules/UISpawnCircle.js";
19
30
  export { UISpawnModule } from "./spawnModules/UISpawnModule.js";
20
31
  export { UISpawnOffset } from "./spawnModules/UISpawnOffset.js";
32
+ export { UISpawnRadialVelocity } from "./spawnModules/UISpawnRadialVelocity.js";
21
33
  export { UISpawnRandomLifetime } from "./spawnModules/UISpawnRandomLifetime.js";
22
34
  export { UISpawnRandomRotation } from "./spawnModules/UISpawnRandomRotation.js";
23
35
  export { UISpawnRandomScale } from "./spawnModules/UISpawnRandomScale.js";
@@ -1,20 +1,30 @@
1
+ export { UIBehaviorAlignToVelocity } from "./behaviorModules/UIBehaviorAlignToVelocity.js";
2
+ export { UIBehaviorBounce } from "./behaviorModules/UIBehaviorBounce.js";
1
3
  export { UIBehaviorDirectionalGravity } from "./behaviorModules/UIBehaviorDirectionalGravity.js";
2
4
  export { UIBehaviorModule } from "./behaviorModules/UIBehaviorModule.js";
5
+ export { UIBehaviorOrbit } from "./behaviorModules/UIBehaviorOrbit.js";
3
6
  export { UIBehaviorPointGravity } from "./behaviorModules/UIBehaviorPointGravity.js";
4
7
  export { UIBehaviorScaleOscillation } from "./behaviorModules/UIBehaviorScaleOscillation.js";
5
8
  export { UIBehaviorScaleOverLife } from "./behaviorModules/UIBehaviorScaleOverLife.js";
9
+ export { UIBehaviorSeek } from "./behaviorModules/UIBehaviorSeek.js";
6
10
  export { UIBehaviorTorqueDamping } from "./behaviorModules/UIBehaviorTorqueDamping.js";
7
11
  export { UIBehaviorTorqueNoise } from "./behaviorModules/UIBehaviorTorqueNoise.js";
8
12
  export { UIBehaviorVelocityDamping } from "./behaviorModules/UIBehaviorVelocityDamping.js";
9
13
  export { UIBehaviorVelocityNoise } from "./behaviorModules/UIBehaviorVelocityNoise.js";
14
+ export { UIEmitterSpace } from "./elements/UIEmitter.Internal.js";
10
15
  export { UIEmitter } from "./elements/UIEmitter.js";
11
- export { particleRandom, particleRandomStream } from "./miscellaneous/miscellaneous.js";
16
+ export { particleRandom, particleRandomStream, UIEasing } from "./miscellaneous/miscellaneous.js";
12
17
  export { UIRenderingColorOverLife } from "./renderingModules/UIRenderingColorOverLife.js";
13
18
  export { UIRenderingColorOverVelocity } from "./renderingModules/UIRenderingColorOverVelocity.js";
19
+ export { UIFlipbookMode, UIRenderingFlipbook } from "./renderingModules/UIRenderingFlipbook.js";
14
20
  export { UIRenderingModule } from "./renderingModules/UIRenderingModule.js";
21
+ export { UIRenderingRandomColor } from "./renderingModules/UIRenderingRandomColor.js";
22
+ export { UIParticleShape, UIRenderingShape } from "./renderingModules/UIRenderingShape.js";
15
23
  export { UIRenderingTexture } from "./renderingModules/UIRenderingTexture.js";
24
+ export { UICircleDistribution, UISpawnCircle } from "./spawnModules/UISpawnCircle.js";
16
25
  export { UISpawnModule } from "./spawnModules/UISpawnModule.js";
17
26
  export { UISpawnOffset } from "./spawnModules/UISpawnOffset.js";
27
+ export { UISpawnRadialVelocity } from "./spawnModules/UISpawnRadialVelocity.js";
18
28
  export { UISpawnRandomLifetime } from "./spawnModules/UISpawnRandomLifetime.js";
19
29
  export { UISpawnRandomRotation } from "./spawnModules/UISpawnRandomRotation.js";
20
30
  export { UISpawnRandomScale } from "./spawnModules/UISpawnRandomScale.js";
@@ -1,6 +1,12 @@
1
1
  import { InstancedBufferGeometry, ShaderMaterial } from "three";
2
2
  import type { GLProperty, GLTypeInfo, UIProperty, UIPropertyName } from "../../core/miscellaneous/generic-plane/shared.js";
3
3
  export declare const INSTANCED_PARTICLE_GEOMETRY: InstancedBufferGeometry;
4
+ /**
5
+ * Gives each rendering module that reads `PARTICLE_RANDOM` a random value of its own, the next of
6
+ * `PARTICLE_RANDOM_A`-`E` in module order, so two modules do not pick alike
7
+ * @returns Sources with `PARTICLE_RANDOM` renamed accordingly
8
+ */
9
+ export declare function assignRenderingRandomValues(sources: string[], debugContext: string): string[];
4
10
  export declare function collectProperties(keeper: Record<string, GLTypeInfo>, modules: readonly {
5
11
  requiredProperties?: Record<string, UIPropertyName>;
6
12
  }[], debugContext: string): void;