@tsparticles/engine 3.0.0-beta.2 → 3.0.0-beta.4

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 (186) hide show
  1. package/browser/Core/Canvas.js +2 -2
  2. package/browser/Core/Container.js +39 -24
  3. package/browser/Core/Engine.js +26 -53
  4. package/browser/Core/Particle.js +88 -53
  5. package/browser/Core/Particles.js +51 -26
  6. package/browser/Core/Retina.js +0 -2
  7. package/browser/Core/Utils/QuadTree.js +1 -1
  8. package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
  9. package/browser/Options/Classes/ColorAnimation.js +4 -24
  10. package/browser/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
  11. package/browser/Options/Classes/Particles/Effect/Effect.js +32 -0
  12. package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -5
  13. package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +17 -0
  14. package/browser/Options/Classes/Particles/Opacity/Opacity.js +2 -3
  15. package/browser/Options/Classes/Particles/ParticlesOptions.js +3 -0
  16. package/browser/Options/Classes/Particles/Size/Size.js +2 -3
  17. package/browser/Options/Classes/ValueWithRandom.js +1 -10
  18. package/browser/Utils/CanvasUtils.js +29 -21
  19. package/browser/Utils/ColorUtils.js +24 -38
  20. package/browser/Utils/NumberUtils.js +7 -16
  21. package/browser/Utils/Utils.js +13 -7
  22. package/browser/export-types.js +4 -2
  23. package/browser/exports.js +2 -3
  24. package/cjs/Core/Canvas.js +2 -2
  25. package/cjs/Core/Container.js +39 -24
  26. package/cjs/Core/Engine.js +25 -52
  27. package/cjs/Core/Particle.js +87 -52
  28. package/cjs/Core/Particles.js +51 -26
  29. package/cjs/Core/Retina.js +0 -2
  30. package/cjs/Core/Utils/QuadTree.js +1 -1
  31. package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
  32. package/cjs/Options/Classes/ColorAnimation.js +4 -24
  33. package/cjs/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
  34. package/cjs/Options/Classes/Particles/Effect/Effect.js +36 -0
  35. package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -5
  36. package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +21 -0
  37. package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -2
  38. package/cjs/Options/Classes/Particles/ParticlesOptions.js +3 -0
  39. package/cjs/Options/Classes/Particles/Size/Size.js +2 -3
  40. package/cjs/Options/Classes/ValueWithRandom.js +1 -10
  41. package/cjs/Utils/CanvasUtils.js +32 -24
  42. package/cjs/Utils/ColorUtils.js +24 -38
  43. package/cjs/Utils/NumberUtils.js +8 -18
  44. package/cjs/Utils/Utils.js +14 -7
  45. package/cjs/export-types.js +4 -2
  46. package/cjs/exports.js +2 -3
  47. package/esm/Core/Canvas.js +2 -2
  48. package/esm/Core/Container.js +39 -24
  49. package/esm/Core/Engine.js +26 -53
  50. package/esm/Core/Particle.js +88 -53
  51. package/esm/Core/Particles.js +51 -26
  52. package/esm/Core/Retina.js +0 -2
  53. package/esm/Core/Utils/QuadTree.js +1 -1
  54. package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
  55. package/esm/Options/Classes/ColorAnimation.js +4 -24
  56. package/esm/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
  57. package/esm/Options/Classes/Particles/Effect/Effect.js +32 -0
  58. package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -5
  59. package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +17 -0
  60. package/esm/Options/Classes/Particles/Opacity/Opacity.js +2 -3
  61. package/esm/Options/Classes/Particles/ParticlesOptions.js +3 -0
  62. package/esm/Options/Classes/Particles/Size/Size.js +2 -3
  63. package/esm/Options/Classes/ValueWithRandom.js +1 -10
  64. package/esm/Utils/CanvasUtils.js +29 -21
  65. package/esm/Utils/ColorUtils.js +24 -38
  66. package/esm/Utils/NumberUtils.js +7 -16
  67. package/esm/Utils/Utils.js +13 -7
  68. package/esm/export-types.js +4 -2
  69. package/esm/exports.js +2 -3
  70. package/package.json +1 -1
  71. package/report.html +4 -22
  72. package/tsparticles.engine.js +461 -347
  73. package/tsparticles.engine.min.js +1 -1
  74. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  75. package/types/Core/Canvas.d.ts +0 -1
  76. package/types/Core/Container.d.ts +9 -8
  77. package/types/Core/Engine.d.ts +9 -5
  78. package/types/Core/Interfaces/IContainerPlugin.d.ts +2 -3
  79. package/types/Core/Interfaces/IEffectDrawer.d.ts +10 -0
  80. package/types/Core/Interfaces/IExternalInteractor.d.ts +3 -4
  81. package/types/Core/Interfaces/IInteractor.d.ts +3 -3
  82. package/types/Core/Interfaces/IParticleRetinaProps.d.ts +0 -1
  83. package/types/Core/Interfaces/IParticlesInteractor.d.ts +3 -3
  84. package/types/Core/Interfaces/IShapeDrawData.d.ts +10 -0
  85. package/types/Core/Interfaces/IShapeDrawer.d.ts +11 -9
  86. package/types/Core/Particle.d.ts +7 -5
  87. package/types/Core/Particles.d.ts +10 -7
  88. package/types/Core/Retina.d.ts +0 -1
  89. package/types/Core/Utils/ExternalInteractorBase.d.ts +4 -4
  90. package/types/Core/Utils/InteractionManager.d.ts +1 -2
  91. package/types/Core/Utils/ParticlesInteractorBase.d.ts +5 -5
  92. package/types/Enums/Modes/LimitMode.d.ts +4 -0
  93. package/types/Enums/Types/EasingType.d.ts +3 -0
  94. package/types/Enums/Types/EventType.d.ts +1 -0
  95. package/types/Options/Classes/BackgroundMask/BackgroundMask.d.ts +1 -1
  96. package/types/Options/Classes/ColorAnimation.d.ts +2 -7
  97. package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +1 -2
  98. package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +1 -2
  99. package/types/Options/Classes/Interactivity/Events/Events.d.ts +3 -3
  100. package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +2 -3
  101. package/types/Options/Classes/Interactivity/Interactivity.d.ts +2 -2
  102. package/types/Options/Classes/Options.d.ts +6 -6
  103. package/types/Options/Classes/Particles/Bounce/ParticlesBounce.d.ts +2 -2
  104. package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +3 -3
  105. package/types/Options/Classes/Particles/Effect/Effect.d.ts +13 -0
  106. package/types/Options/Classes/Particles/Move/Move.d.ts +8 -8
  107. package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +1 -1
  108. package/types/Options/Classes/Particles/Number/ParticlesNumber.d.ts +3 -2
  109. package/types/Options/Classes/Particles/Number/ParticlesNumberLimit.d.ts +10 -0
  110. package/types/Options/Classes/Particles/Opacity/Opacity.d.ts +3 -3
  111. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +12 -10
  112. package/types/Options/Classes/Particles/Size/Size.d.ts +3 -3
  113. package/types/Options/Classes/Theme/Theme.d.ts +1 -1
  114. package/types/Options/Classes/ValueWithRandom.d.ts +2 -4
  115. package/types/Options/Interfaces/IValueWithRandom.d.ts +0 -2
  116. package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +1 -2
  117. package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +1 -2
  118. package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +1 -2
  119. package/types/Options/Interfaces/Particles/Effect/IEffect.d.ts +8 -0
  120. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -0
  121. package/types/Options/Interfaces/Particles/Number/IParticlesNumber.d.ts +2 -1
  122. package/types/Options/Interfaces/Particles/Number/IParticlesNumberLimit.d.ts +5 -0
  123. package/types/Types/CustomEventArgs.d.ts +1 -1
  124. package/types/Utils/CanvasUtils.d.ts +12 -3
  125. package/types/Utils/ColorUtils.d.ts +2 -2
  126. package/types/Utils/NumberUtils.d.ts +0 -2
  127. package/types/Utils/Utils.d.ts +6 -6
  128. package/types/export-types.d.ts +5 -2
  129. package/types/exports.d.ts +2 -3
  130. package/umd/Core/Canvas.js +2 -2
  131. package/umd/Core/Container.js +40 -25
  132. package/umd/Core/Engine.js +25 -52
  133. package/umd/Core/Particle.js +87 -52
  134. package/umd/Core/Particles.js +51 -26
  135. package/umd/Core/Retina.js +0 -2
  136. package/umd/Core/Utils/QuadTree.js +1 -1
  137. package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +1 -2
  138. package/umd/Options/Classes/ColorAnimation.js +5 -25
  139. package/umd/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +0 -1
  140. package/umd/Options/Classes/Particles/Effect/Effect.js +46 -0
  141. package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +4 -6
  142. package/umd/Options/Classes/{Random.js → Particles/Number/ParticlesNumberLimit.js} +9 -9
  143. package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -2
  144. package/umd/Options/Classes/Particles/ParticlesOptions.js +4 -1
  145. package/umd/Options/Classes/Particles/Size/Size.js +3 -4
  146. package/umd/Options/Classes/ValueWithRandom.js +2 -11
  147. package/umd/Utils/CanvasUtils.js +32 -24
  148. package/umd/Utils/ColorUtils.js +24 -38
  149. package/umd/Utils/NumberUtils.js +9 -19
  150. package/umd/Utils/Utils.js +14 -7
  151. package/umd/export-types.js +5 -3
  152. package/umd/exports.js +3 -4
  153. package/browser/Options/Classes/Random.js +0 -17
  154. package/cjs/Options/Classes/Random.js +0 -21
  155. package/cjs/Types/ShapeDrawerFunctions.js +0 -2
  156. package/esm/Options/Classes/Random.js +0 -17
  157. package/esm/Options/Interfaces/IRandom.js +0 -1
  158. package/esm/Types/ShapeDrawerFunctions.js +0 -1
  159. package/types/Core/Interfaces/IParticle.d.ts +0 -48
  160. package/types/Enums/Modes/ClickMode.d.ts +0 -9
  161. package/types/Enums/Modes/DivMode.d.ts +0 -5
  162. package/types/Enums/Modes/HoverMode.d.ts +0 -11
  163. package/types/Options/Classes/Random.d.ts +0 -9
  164. package/types/Options/Interfaces/IRandom.d.ts +0 -4
  165. package/types/Types/ShapeDrawerFunctions.d.ts +0 -10
  166. package/umd/Types/ShapeDrawerFunctions.js +0 -12
  167. /package/browser/Core/Interfaces/{IParticle.js → IEffectDrawer.js} +0 -0
  168. /package/browser/{Enums/Modes/ClickMode.js → Core/Interfaces/IShapeDrawData.js} +0 -0
  169. /package/browser/Enums/Modes/{DivMode.js → LimitMode.js} +0 -0
  170. /package/browser/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
  171. /package/browser/Options/Interfaces/{IRandom.js → Particles/Number/IParticlesNumberLimit.js} +0 -0
  172. /package/cjs/Core/Interfaces/{IParticle.js → IEffectDrawer.js} +0 -0
  173. /package/cjs/{Enums/Modes/ClickMode.js → Core/Interfaces/IShapeDrawData.js} +0 -0
  174. /package/cjs/Enums/Modes/{DivMode.js → LimitMode.js} +0 -0
  175. /package/cjs/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
  176. /package/cjs/Options/Interfaces/{IRandom.js → Particles/Number/IParticlesNumberLimit.js} +0 -0
  177. /package/{browser/Types/ShapeDrawerFunctions.js → esm/Core/Interfaces/IEffectDrawer.js} +0 -0
  178. /package/esm/Core/Interfaces/{IParticle.js → IShapeDrawData.js} +0 -0
  179. /package/esm/Enums/Modes/{ClickMode.js → LimitMode.js} +0 -0
  180. /package/esm/{Enums/Modes/DivMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
  181. /package/esm/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Number/IParticlesNumberLimit.js} +0 -0
  182. /package/umd/Core/Interfaces/{IParticle.js → IEffectDrawer.js} +0 -0
  183. /package/umd/{Enums/Modes/ClickMode.js → Core/Interfaces/IShapeDrawData.js} +0 -0
  184. /package/umd/Enums/Modes/{DivMode.js → LimitMode.js} +0 -0
  185. /package/umd/{Enums/Modes/HoverMode.js → Options/Interfaces/Particles/Effect/IEffect.js} +0 -0
  186. /package/umd/Options/Interfaces/{IRandom.js → Particles/Number/IParticlesNumberLimit.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, getValue, randomInRange, } from "./NumberUtils.js";
1
+ import { collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, randomInRange, } from "./NumberUtils.js";
2
2
  import { Vector } from "../Core/Utils/Vector.js";
3
3
  const _logger = {
4
4
  debug: console.debug,
@@ -27,8 +27,8 @@ function rectSideBounce(data) {
27
27
  pOtherSide.max > rectOtherSide.max) {
28
28
  return res;
29
29
  }
30
- if ((pSide.max >= rectSide.min && pSide.max <= (rectSide.max + rectSide.min) / 2 && velocity > 0) ||
31
- (pSide.min <= rectSide.max && pSide.min > (rectSide.max + rectSide.min) / 2 && velocity < 0)) {
30
+ if ((pSide.max >= rectSide.min && pSide.max <= (rectSide.max + rectSide.min) * 0.5 && velocity > 0) ||
31
+ (pSide.min <= rectSide.max && pSide.min > (rectSide.max + rectSide.min) * 0.5 && velocity < 0)) {
32
32
  res.velocity = velocity * -factor;
33
33
  res.bounced = true;
34
34
  }
@@ -52,6 +52,12 @@ export function safeMatchMedia(query) {
52
52
  }
53
53
  return matchMedia(query);
54
54
  }
55
+ export function safeIntersectionObserver(callback) {
56
+ if (isSsr() || typeof IntersectionObserver === "undefined") {
57
+ return;
58
+ }
59
+ return new IntersectionObserver(callback);
60
+ }
55
61
  export function safeMutationObserver(callback) {
56
62
  if (isSsr() || typeof MutationObserver === "undefined") {
57
63
  return;
@@ -161,7 +167,7 @@ export function circleBounceDataFromParticle(p) {
161
167
  radius: p.getRadius(),
162
168
  mass: p.getMass(),
163
169
  velocity: p.velocity,
164
- factor: Vector.create(getValue(p.options.bounce.horizontal), getValue(p.options.bounce.vertical)),
170
+ factor: Vector.create(getRangeValue(p.options.bounce.horizontal.value), getRangeValue(p.options.bounce.vertical.value)),
165
171
  };
166
172
  }
167
173
  export function circleBounce(p1, p2) {
@@ -176,7 +182,7 @@ export function circleBounce(p1, p2) {
176
182
  p2.velocity.y = vFinal2.y * p2.factor.y;
177
183
  }
178
184
  export function rectBounce(particle, divBounds) {
179
- const pPos = particle.getPosition(), size = particle.getRadius(), bounds = calculateBounds(pPos, size), resH = rectSideBounce({
185
+ const pPos = particle.getPosition(), size = particle.getRadius(), bounds = calculateBounds(pPos, size), bounceOptions = particle.options.bounce, resH = rectSideBounce({
180
186
  pSide: {
181
187
  min: bounds.left,
182
188
  max: bounds.right,
@@ -194,7 +200,7 @@ export function rectBounce(particle, divBounds) {
194
200
  max: divBounds.bottom,
195
201
  },
196
202
  velocity: particle.velocity.x,
197
- factor: getValue(particle.options.bounce.horizontal),
203
+ factor: getRangeValue(bounceOptions.horizontal.value),
198
204
  });
199
205
  if (resH.bounced) {
200
206
  if (resH.velocity !== undefined) {
@@ -222,7 +228,7 @@ export function rectBounce(particle, divBounds) {
222
228
  max: divBounds.right,
223
229
  },
224
230
  velocity: particle.velocity.y,
225
- factor: getValue(particle.options.bounce.vertical),
231
+ factor: getRangeValue(bounceOptions.vertical.value),
226
232
  });
227
233
  if (resV.bounced) {
228
234
  if (resV.velocity !== undefined) {
@@ -10,12 +10,12 @@ export * from "./Core/Interfaces/IDelta.js";
10
10
  export * from "./Core/Interfaces/IDimension.js";
11
11
  export * from "./Core/Interfaces/IDistance.js";
12
12
  export * from "./Core/Interfaces/IDrawParticleParams.js";
13
+ export * from "./Core/Interfaces/IEffectDrawer.js";
13
14
  export * from "./Core/Interfaces/IExternalInteractor.js";
14
15
  export * from "./Core/Interfaces/IInteractor.js";
15
16
  export * from "./Core/Interfaces/ILoadParams.js";
16
17
  export * from "./Core/Interfaces/IMouseData.js";
17
18
  export * from "./Core/Interfaces/IMovePathGenerator.js";
18
- export * from "./Core/Interfaces/IParticle.js";
19
19
  export * from "./Core/Interfaces/IParticleColorStyle.js";
20
20
  export * from "./Core/Interfaces/IParticleHslAnimation.js";
21
21
  export * from "./Core/Interfaces/IParticleLife.js";
@@ -30,6 +30,7 @@ export * from "./Core/Interfaces/IPlugin.js";
30
30
  export * from "./Core/Interfaces/IPositionFromSizeParams.js";
31
31
  export * from "./Core/Interfaces/IRangeValue.js";
32
32
  export * from "./Core/Interfaces/IRectSideResult.js";
33
+ export * from "./Core/Interfaces/IShapeDrawData.js";
33
34
  export * from "./Core/Interfaces/IShapeDrawer.js";
34
35
  export * from "./Core/Interfaces/IShapeValues.js";
35
36
  export * from "./Core/Interfaces/ISlowParticleData.js";
@@ -62,6 +63,7 @@ export * from "./Options/Interfaces/Particles/Bounce/IParticlesBounce.js";
62
63
  export * from "./Options/Interfaces/Particles/Collisions/ICollisions.js";
63
64
  export * from "./Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js";
64
65
  export * from "./Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js";
66
+ export * from "./Options/Interfaces/Particles/Effect/IEffect.js";
65
67
  export * from "./Options/Interfaces/Particles/IParticlesOptions.js";
66
68
  export * from "./Options/Interfaces/Particles/IShadow.js";
67
69
  export * from "./Options/Interfaces/Particles/IStroke.js";
@@ -76,6 +78,7 @@ export * from "./Options/Interfaces/Particles/Move/ISpin.js";
76
78
  export * from "./Options/Interfaces/Particles/Move/IMoveTrail.js";
77
79
  export * from "./Options/Interfaces/Particles/Number/IParticlesDensity.js";
78
80
  export * from "./Options/Interfaces/Particles/Number/IParticlesNumber.js";
81
+ export * from "./Options/Interfaces/Particles/Number/IParticlesNumberLimit.js";
79
82
  export * from "./Options/Interfaces/Particles/Opacity/IOpacity.js";
80
83
  export * from "./Options/Interfaces/Particles/Opacity/IOpacityAnimation.js";
81
84
  export * from "./Options/Interfaces/Particles/Shape/IShape.js";
@@ -93,5 +96,4 @@ export * from "./Types/PathOptions.js";
93
96
  export * from "./Types/RangeValue.js";
94
97
  export * from "./Types/RecursivePartial.js";
95
98
  export * from "./Types/ShapeData.js";
96
- export * from "./Types/ShapeDrawerFunctions.js";
97
99
  export * from "./Types/SingleOrMultiple.js";
@@ -11,10 +11,8 @@ export * from "./Enums/Directions/MoveDirection.js";
11
11
  export * from "./Enums/Directions/RotateDirection.js";
12
12
  export * from "./Enums/Directions/OutModeDirection.js";
13
13
  export * from "./Enums/Modes/AnimationMode.js";
14
- export * from "./Enums/Modes/ClickMode.js";
15
- export * from "./Enums/Modes/DivMode.js";
16
- export * from "./Enums/Modes/HoverMode.js";
17
14
  export * from "./Enums/Modes/CollisionMode.js";
15
+ export * from "./Enums/Modes/LimitMode.js";
18
16
  export * from "./Enums/Modes/OutMode.js";
19
17
  export * from "./Enums/Modes/PixelMode.js";
20
18
  export * from "./Enums/Modes/ThemeMode.js";
@@ -69,6 +67,7 @@ export * from "./Options/Classes/Particles/Move/Path/MovePath.js";
69
67
  export * from "./Options/Classes/Particles/Move/Spin.js";
70
68
  export * from "./Options/Classes/Particles/Move/MoveTrail.js";
71
69
  export * from "./Options/Classes/Particles/Number/ParticlesNumber.js";
70
+ export * from "./Options/Classes/Particles/Number/ParticlesNumberLimit.js";
72
71
  export * from "./Options/Classes/Particles/Number/ParticlesDensity.js";
73
72
  export * from "./Options/Classes/Particles/Opacity/Opacity.js";
74
73
  export * from "./Options/Classes/Particles/Opacity/OpacityAnimation.js";
@@ -405,10 +405,10 @@ class Canvas {
405
405
  this.element.width = size.width = this.element.offsetWidth * pxRatio;
406
406
  this.element.height = size.height = this.element.offsetHeight * pxRatio;
407
407
  if (this.container.started) {
408
- this.resizeFactor = {
408
+ container.particles.setResizeFactor({
409
409
  width: size.width / oldSize.width,
410
410
  height: size.height / oldSize.height,
411
- };
411
+ });
412
412
  }
413
413
  return true;
414
414
  }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Container = void 0;
4
+ const Utils_js_1 = require("../Utils/Utils.js");
4
5
  const Canvas_js_1 = require("./Canvas.js");
5
6
  const EventListeners_js_1 = require("./Utils/EventListeners.js");
6
7
  const Options_js_1 = require("../Options/Classes/Options.js");
7
8
  const Particles_js_1 = require("./Particles.js");
8
9
  const Retina_js_1 = require("./Retina.js");
9
10
  const Constants_js_1 = require("./Utils/Constants.js");
10
- const Utils_js_1 = require("../Utils/Utils.js");
11
11
  const NumberUtils_js_1 = require("../Utils/NumberUtils.js");
12
12
  const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
13
13
  function guardCheck(container) {
@@ -26,7 +26,6 @@ function loadContainerOptions(engine, container, ...sourceOptionsArr) {
26
26
  }
27
27
  class Container {
28
28
  constructor(engine, id, sourceOptions) {
29
- this.id = id;
30
29
  this._intersectionManager = (entries) => {
31
30
  if (!guardCheck(this) || !this.actualOptions.pauseOnOutsideViewport) {
32
31
  return;
@@ -40,16 +39,16 @@ class Container {
40
39
  };
41
40
  this._nextFrame = async (timestamp) => {
42
41
  try {
43
- if (!this.smooth &&
44
- this.lastFrameTime !== undefined &&
45
- timestamp < this.lastFrameTime + 1000 / this.fpsLimit) {
42
+ if (!this._smooth &&
43
+ this._lastFrameTime !== undefined &&
44
+ timestamp < this._lastFrameTime + 1000 / this.fpsLimit) {
46
45
  this.draw(false);
47
46
  return;
48
47
  }
49
- this.lastFrameTime ??= timestamp;
50
- const delta = initDelta(timestamp - this.lastFrameTime, this.fpsLimit, this.smooth);
48
+ this._lastFrameTime ??= timestamp;
49
+ const delta = initDelta(timestamp - this._lastFrameTime, this.fpsLimit, this._smooth);
51
50
  this.addLifeTime(delta.value);
52
- this.lastFrameTime = timestamp;
51
+ this._lastFrameTime = timestamp;
53
52
  if (delta.value > 1000) {
54
53
  this.draw(false);
55
54
  return;
@@ -68,8 +67,9 @@ class Container {
68
67
  }
69
68
  };
70
69
  this._engine = engine;
70
+ this.id = Symbol(id);
71
71
  this.fpsLimit = 120;
72
- this.smooth = false;
72
+ this._smooth = false;
73
73
  this._delay = 0;
74
74
  this._duration = 0;
75
75
  this._lifeTime = 0;
@@ -77,7 +77,7 @@ class Container {
77
77
  this.started = false;
78
78
  this.destroyed = false;
79
79
  this._paused = true;
80
- this.lastFrameTime = 0;
80
+ this._lastFrameTime = 0;
81
81
  this.zLayers = 100;
82
82
  this.pageHidden = false;
83
83
  this._sourceOptions = sourceOptions;
@@ -93,13 +93,12 @@ class Container {
93
93
  },
94
94
  };
95
95
  this.plugins = new Map();
96
- this.drawers = new Map();
96
+ this.effectDrawers = new Map();
97
+ this.shapeDrawers = new Map();
97
98
  this._options = loadContainerOptions(this._engine, this);
98
99
  this.actualOptions = loadContainerOptions(this._engine, this);
99
100
  this._eventListeners = new EventListeners_js_1.EventListeners(this);
100
- if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
101
- this._intersectionObserver = new IntersectionObserver((entries) => this._intersectionManager(entries));
102
- }
101
+ this._intersectionObserver = (0, Utils_js_1.safeIntersectionObserver)((entries) => this._intersectionManager(entries));
103
102
  this._engine.dispatchEvent("containerBuilt", { container: this });
104
103
  }
105
104
  get options() {
@@ -205,11 +204,17 @@ class Container {
205
204
  this.stop();
206
205
  this.particles.destroy();
207
206
  this.canvas.destroy();
208
- for (const [, drawer] of this.drawers) {
209
- drawer.destroy && drawer.destroy(this);
207
+ for (const [, effectDrawer] of this.effectDrawers) {
208
+ effectDrawer.destroy && effectDrawer.destroy(this);
209
+ }
210
+ for (const [, shapeDrawer] of this.shapeDrawers) {
211
+ shapeDrawer.destroy && shapeDrawer.destroy(this);
212
+ }
213
+ for (const key of this.effectDrawers.keys()) {
214
+ this.effectDrawers.delete(key);
210
215
  }
211
- for (const key of this.drawers.keys()) {
212
- this.drawers.delete(key);
216
+ for (const key of this.shapeDrawers.keys()) {
217
+ this.shapeDrawers.delete(key);
213
218
  }
214
219
  this._engine.clearPlugins(this);
215
220
  this.destroyed = true;
@@ -226,7 +231,7 @@ class Container {
226
231
  let refreshTime = force;
227
232
  this._drawAnimationFrame = requestAnimationFrame(async (timestamp) => {
228
233
  if (refreshTime) {
229
- this.lastFrameTime = undefined;
234
+ this._lastFrameTime = undefined;
230
235
  refreshTime = false;
231
236
  }
232
237
  await this._nextFrame(timestamp);
@@ -261,11 +266,18 @@ class Container {
261
266
  if (!guardCheck(this)) {
262
267
  return;
263
268
  }
269
+ const effects = this._engine.getSupportedEffects();
270
+ for (const type of effects) {
271
+ const drawer = this._engine.getEffectDrawer(type);
272
+ if (drawer) {
273
+ this.effectDrawers.set(type, drawer);
274
+ }
275
+ }
264
276
  const shapes = this._engine.getSupportedShapes();
265
277
  for (const type of shapes) {
266
278
  const drawer = this._engine.getShapeDrawer(type);
267
279
  if (drawer) {
268
- this.drawers.set(type, drawer);
280
+ this.shapeDrawers.set(type, drawer);
269
281
  }
270
282
  }
271
283
  this._options = loadContainerOptions(this._engine, this, this._initialSourceOptions, this.sourceOptions);
@@ -284,8 +296,11 @@ class Container {
284
296
  this._delay = (0, NumberUtils_js_1.getRangeValue)(this.actualOptions.delay) * 1000;
285
297
  this._lifeTime = 0;
286
298
  this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
287
- this.smooth = this.actualOptions.smooth;
288
- for (const [, drawer] of this.drawers) {
299
+ this._smooth = this.actualOptions.smooth;
300
+ for (const [, drawer] of this.effectDrawers) {
301
+ drawer.init && (await drawer.init(this));
302
+ }
303
+ for (const [, drawer] of this.shapeDrawers) {
289
304
  drawer.init && (await drawer.init(this));
290
305
  }
291
306
  for (const [, plugin] of this.plugins) {
@@ -414,10 +429,10 @@ class Container {
414
429
  this.actualOptions.responsive = [];
415
430
  const newMaxWidth = this.actualOptions.setResponsive(this.canvas.size.width, this.retina.pixelRatio, this._options);
416
431
  this.actualOptions.setTheme(this._currentTheme);
417
- if (this.responsiveMaxWidth === newMaxWidth) {
432
+ if (this._responsiveMaxWidth === newMaxWidth) {
418
433
  return false;
419
434
  }
420
- this.responsiveMaxWidth = newMaxWidth;
435
+ this._responsiveMaxWidth = newMaxWidth;
421
436
  return true;
422
437
  }
423
438
  }
@@ -42,7 +42,8 @@ class Engine {
42
42
  this.movers = new Map();
43
43
  this.updaters = new Map();
44
44
  this.presets = new Map();
45
- this.drawers = new Map();
45
+ this.effectDrawers = new Map();
46
+ this.shapeDrawers = new Map();
46
47
  this.pathGenerators = new Map();
47
48
  }
48
49
  get configs() {
@@ -53,18 +54,18 @@ class Engine {
53
54
  return res;
54
55
  }
55
56
  get version() {
56
- return "3.0.0-beta.2";
57
+ return "3.0.0-beta.4";
57
58
  }
58
- addConfig(nameOrConfig, config) {
59
- if ((0, Utils_js_1.isString)(nameOrConfig)) {
60
- if (config) {
61
- config.name = nameOrConfig;
62
- this._configs.set(nameOrConfig, config);
63
- }
64
- }
65
- else {
66
- this._configs.set(nameOrConfig.name ?? "default", nameOrConfig);
67
- }
59
+ addConfig(config) {
60
+ const name = config.name ?? "default";
61
+ this._configs.set(name, config);
62
+ this._eventDispatcher.dispatchEvent("configAdded", { data: { name, config } });
63
+ }
64
+ async addEffect(effect, drawer, refresh = true) {
65
+ (0, Utils_js_1.executeOnSingleOrMultiple)(effect, (type) => {
66
+ !this.getEffectDrawer(type) && this.effectDrawers.set(type, drawer);
67
+ });
68
+ await this.refresh(refresh);
68
69
  }
69
70
  addEventListener(type, listener) {
70
71
  this._eventDispatcher.addEventListener(type, listener);
@@ -93,45 +94,11 @@ class Engine {
93
94
  (override || !this.getPreset(preset)) && this.presets.set(preset, options);
94
95
  await this.refresh(refresh);
95
96
  }
96
- async addShape(shape, drawer, initOrRefresh, afterEffectOrRefresh, destroyOrRefresh, refresh = true) {
97
- let customDrawer;
98
- let realRefresh = refresh, realInit, realAfterEffect, realDestroy;
99
- if ((0, Utils_js_1.isBoolean)(initOrRefresh)) {
100
- realRefresh = initOrRefresh;
101
- realInit = undefined;
102
- }
103
- else {
104
- realInit = initOrRefresh;
105
- }
106
- if ((0, Utils_js_1.isBoolean)(afterEffectOrRefresh)) {
107
- realRefresh = afterEffectOrRefresh;
108
- realAfterEffect = undefined;
109
- }
110
- else {
111
- realAfterEffect = afterEffectOrRefresh;
112
- }
113
- if ((0, Utils_js_1.isBoolean)(destroyOrRefresh)) {
114
- realRefresh = destroyOrRefresh;
115
- realDestroy = undefined;
116
- }
117
- else {
118
- realDestroy = destroyOrRefresh;
119
- }
120
- if ((0, Utils_js_1.isFunction)(drawer)) {
121
- customDrawer = {
122
- afterEffect: realAfterEffect,
123
- destroy: realDestroy,
124
- draw: drawer,
125
- init: realInit,
126
- };
127
- }
128
- else {
129
- customDrawer = drawer;
130
- }
97
+ async addShape(shape, drawer, refresh = true) {
131
98
  (0, Utils_js_1.executeOnSingleOrMultiple)(shape, (type) => {
132
- !this.getShapeDrawer(type) && this.drawers.set(type, customDrawer);
99
+ !this.getShapeDrawer(type) && this.shapeDrawers.set(type, drawer);
133
100
  });
134
- await this.refresh(realRefresh);
101
+ await this.refresh(refresh);
135
102
  }
136
103
  clearPlugins(container) {
137
104
  this.updaters.delete(container);
@@ -159,6 +126,9 @@ class Engine {
159
126
  }
160
127
  return res;
161
128
  }
129
+ getEffectDrawer(type) {
130
+ return this.effectDrawers.get(type);
131
+ }
162
132
  getInteractors(container, force = false) {
163
133
  return getItemsFromInitializer(container, this.interactors, this._initializers.interactors, force);
164
134
  }
@@ -175,10 +145,13 @@ class Engine {
175
145
  return this.presets.get(preset);
176
146
  }
177
147
  getShapeDrawer(type) {
178
- return this.drawers.get(type);
148
+ return this.shapeDrawers.get(type);
149
+ }
150
+ getSupportedEffects() {
151
+ return this.effectDrawers.keys();
179
152
  }
180
153
  getSupportedShapes() {
181
- return this.drawers.keys();
154
+ return this.shapeDrawers.keys();
182
155
  }
183
156
  getUpdaters(container, force = false) {
184
157
  return getItemsFromInitializer(container, this.updaters, this._initializers.updaters, force);
@@ -197,7 +170,7 @@ class Engine {
197
170
  domContainer.id = id;
198
171
  document.body.append(domContainer);
199
172
  }
200
- const currentOptions = (0, Utils_js_1.itemFromSingleOrMultiple)(options, index), dom = this.dom(), oldIndex = dom.findIndex((v) => v.id === id);
173
+ const currentOptions = (0, Utils_js_1.itemFromSingleOrMultiple)(options, index), dom = this.dom(), oldIndex = dom.findIndex((v) => v.id.description === id);
201
174
  if (oldIndex >= 0) {
202
175
  const old = this.domItem(oldIndex);
203
176
  if (old && !old.destroyed) {
@@ -10,7 +10,27 @@ const Vector3d_js_1 = require("./Utils/Vector3d.js");
10
10
  const CanvasUtils_js_1 = require("../Utils/CanvasUtils.js");
11
11
  const Constants_js_1 = require("./Utils/Constants.js");
12
12
  const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
13
- const fixOutMode = (data) => {
13
+ function loadEffectData(effect, effectOptions, id, reduceDuplicates) {
14
+ const effectData = effectOptions.options[effect];
15
+ if (!effectData) {
16
+ return;
17
+ }
18
+ return (0, Utils_js_1.deepExtend)({
19
+ close: effectOptions.close,
20
+ fill: effectOptions.fill,
21
+ }, (0, Utils_js_1.itemFromSingleOrMultiple)(effectData, id, reduceDuplicates));
22
+ }
23
+ function loadShapeData(shape, shapeOptions, id, reduceDuplicates) {
24
+ const shapeData = shapeOptions.options[shape];
25
+ if (!shapeData) {
26
+ return;
27
+ }
28
+ return (0, Utils_js_1.deepExtend)({
29
+ close: shapeOptions.close,
30
+ fill: shapeOptions.fill,
31
+ }, (0, Utils_js_1.itemFromSingleOrMultiple)(shapeData, id, reduceDuplicates));
32
+ }
33
+ function fixOutMode(data) {
14
34
  if (!(0, Utils_js_1.isInArray)(data.outMode, data.checkModes)) {
15
35
  return;
16
36
  }
@@ -21,7 +41,7 @@ const fixOutMode = (data) => {
21
41
  else if (data.coord < diameter) {
22
42
  data.setCb(data.radius);
23
43
  }
24
- };
44
+ }
25
45
  class Particle {
26
46
  constructor(engine, id, container, position, overrideOptions, group) {
27
47
  this.container = container;
@@ -69,8 +89,8 @@ class Particle {
69
89
  return res;
70
90
  }
71
91
  const rad = (Math.PI / 180) * (0, NumberUtils_js_1.getRangeValue)(moveOptions.angle.value), radOffset = (Math.PI / 180) * (0, NumberUtils_js_1.getRangeValue)(moveOptions.angle.offset), range = {
72
- left: radOffset - rad / 2,
73
- right: radOffset + rad / 2,
92
+ left: radOffset - rad * 0.5,
93
+ right: radOffset + rad * 0.5,
74
94
  };
75
95
  if (!moveOptions.straight) {
76
96
  res.angle += (0, NumberUtils_js_1.randomInRange)((0, NumberUtils_js_1.setRangeValue)(range.left, range.right));
@@ -99,7 +119,7 @@ class Particle {
99
119
  if (!color || !this.roll || (!this.backColor && !this.roll.alter)) {
100
120
  return color;
101
121
  }
102
- const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1, backSum = this.roll.horizontal ? Math.PI / 2 : 0, rolled = Math.floor(((this.roll.angle ?? 0) + backSum) / (Math.PI / backFactor)) % 2;
122
+ const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1, backSum = this.roll.horizontal ? Math.PI * 0.5 : 0, rolled = Math.floor(((this.roll.angle ?? 0) + backSum) / (Math.PI / backFactor)) % 2;
103
123
  if (!rolled) {
104
124
  return color;
105
125
  }
@@ -132,16 +152,6 @@ class Particle {
132
152
  }
133
153
  this.offset = Vector_js_1.Vector.origin;
134
154
  };
135
- this._loadShapeData = (shapeOptions, reduceDuplicates) => {
136
- const shapeData = shapeOptions.options[this.shape];
137
- if (!shapeData) {
138
- return;
139
- }
140
- return (0, Utils_js_1.deepExtend)({
141
- close: shapeOptions.close,
142
- fill: shapeOptions.fill,
143
- }, (0, Utils_js_1.itemFromSingleOrMultiple)(shapeData, this.id, reduceDuplicates));
144
- };
145
155
  this._engine = engine;
146
156
  this.init(id, position, overrideOptions, group);
147
157
  }
@@ -154,18 +164,12 @@ class Particle {
154
164
  this.slow.inRange = false;
155
165
  const container = this.container, pathGenerator = this.pathGenerator;
156
166
  for (const [, plugin] of container.plugins) {
157
- if (plugin.particleDestroyed) {
158
- plugin.particleDestroyed(this, override);
159
- }
167
+ plugin.particleDestroyed && plugin.particleDestroyed(this, override);
160
168
  }
161
169
  for (const updater of container.particles.updaters) {
162
- if (updater.particleDestroyed) {
163
- updater.particleDestroyed(this, override);
164
- }
165
- }
166
- if (pathGenerator) {
167
- pathGenerator.reset(this);
170
+ updater.particleDestroyed && updater.particleDestroyed(this, override);
168
171
  }
172
+ pathGenerator && pathGenerator.reset(this);
169
173
  }
170
174
  draw(delta) {
171
175
  const container = this.container, canvas = container.canvas;
@@ -178,7 +182,7 @@ class Particle {
178
182
  return this._getRollColor(this.bubble.color ?? (0, ColorUtils_js_1.getHslFromAnimation)(this.color));
179
183
  }
180
184
  getMass() {
181
- return (this.getRadius() ** 2 * Math.PI) / 2;
185
+ return this.getRadius() ** 2 * Math.PI * 0.5;
182
186
  }
183
187
  getPosition() {
184
188
  return {
@@ -197,9 +201,11 @@ class Particle {
197
201
  const container = this.container, engine = this._engine;
198
202
  this.id = id;
199
203
  this.group = group;
200
- this.fill = true;
204
+ this.effectClose = true;
205
+ this.effectFill = true;
206
+ this.shapeClose = true;
207
+ this.shapeFill = true;
201
208
  this.pathRotation = false;
202
- this.close = true;
203
209
  this.lastPathTime = 0;
204
210
  this.destroyed = false;
205
211
  this.unbreakable = false;
@@ -210,18 +216,33 @@ class Particle {
210
216
  };
211
217
  this.outType = "normal";
212
218
  this.ignoresResizeRatio = true;
213
- const pxRatio = container.retina.pixelRatio, mainOptions = container.actualOptions, particlesOptions = (0, OptionsUtils_js_1.loadParticlesOptions)(this._engine, container, mainOptions.particles), shapeType = particlesOptions.shape.type, { reduceDuplicates } = particlesOptions;
219
+ const pxRatio = container.retina.pixelRatio, mainOptions = container.actualOptions, particlesOptions = (0, OptionsUtils_js_1.loadParticlesOptions)(this._engine, container, mainOptions.particles), effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type, { reduceDuplicates } = particlesOptions;
220
+ this.effect = (0, Utils_js_1.itemFromSingleOrMultiple)(effectType, this.id, reduceDuplicates);
214
221
  this.shape = (0, Utils_js_1.itemFromSingleOrMultiple)(shapeType, this.id, reduceDuplicates);
215
- const shapeOptions = particlesOptions.shape;
216
- if (overrideOptions && overrideOptions.shape && overrideOptions.shape.type) {
217
- const overrideShapeType = overrideOptions.shape.type, shape = (0, Utils_js_1.itemFromSingleOrMultiple)(overrideShapeType, this.id, reduceDuplicates);
218
- if (shape) {
219
- this.shape = shape;
220
- shapeOptions.load(overrideOptions.shape);
222
+ const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;
223
+ if (overrideOptions) {
224
+ if (overrideOptions.effect && overrideOptions.effect.type) {
225
+ const overrideEffectType = overrideOptions.effect.type, effect = (0, Utils_js_1.itemFromSingleOrMultiple)(overrideEffectType, this.id, reduceDuplicates);
226
+ if (effect) {
227
+ this.effect = effect;
228
+ effectOptions.load(overrideOptions.effect);
229
+ }
230
+ }
231
+ if (overrideOptions.shape && overrideOptions.shape.type) {
232
+ const overrideShapeType = overrideOptions.shape.type, shape = (0, Utils_js_1.itemFromSingleOrMultiple)(overrideShapeType, this.id, reduceDuplicates);
233
+ if (shape) {
234
+ this.shape = shape;
235
+ shapeOptions.load(overrideOptions.shape);
236
+ }
221
237
  }
222
238
  }
223
- this.shapeData = this._loadShapeData(shapeOptions, reduceDuplicates);
239
+ this.effectData = loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates);
240
+ this.shapeData = loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates);
224
241
  particlesOptions.load(overrideOptions);
242
+ const effectData = this.effectData;
243
+ if (effectData) {
244
+ particlesOptions.load(effectData.particles);
245
+ }
225
246
  const shapeData = this.shapeData;
226
247
  if (shapeData) {
227
248
  particlesOptions.load(shapeData.particles);
@@ -230,11 +251,13 @@ class Particle {
230
251
  interactivity.load(container.actualOptions.interactivity);
231
252
  interactivity.load(particlesOptions.interactivity);
232
253
  this.interactivity = interactivity;
233
- this.fill = shapeData?.fill ?? particlesOptions.shape.fill;
234
- this.close = shapeData?.close ?? particlesOptions.shape.close;
254
+ this.effectFill = effectData?.fill ?? particlesOptions.effect.fill;
255
+ this.effectClose = effectData?.close ?? particlesOptions.effect.close;
256
+ this.shapeFill = shapeData?.fill ?? particlesOptions.shape.fill;
257
+ this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;
235
258
  this.options = particlesOptions;
236
259
  const pathOptions = this.options.move.path;
237
- this.pathDelay = (0, NumberUtils_js_1.getValue)(pathOptions.delay) * 1000;
260
+ this.pathDelay = (0, NumberUtils_js_1.getRangeValue)(pathOptions.delay.value) * 1000;
238
261
  if (pathOptions.generator) {
239
262
  this.pathGenerator = this._engine.getPathGenerator(pathOptions.generator);
240
263
  if (this.pathGenerator && container.addPath(pathOptions.generator, this.pathGenerator)) {
@@ -255,34 +278,46 @@ class Particle {
255
278
  this.velocity = this.initialVelocity.copy();
256
279
  this.moveDecay = 1 - (0, NumberUtils_js_1.getRangeValue)(this.options.move.decay);
257
280
  const particles = container.particles;
258
- particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
259
- particles.lastZIndex = this.position.z;
281
+ particles.setLastZIndex(this.position.z);
260
282
  this.zIndexFactor = this.position.z / container.zLayers;
261
283
  this.sides = 24;
262
- let drawer = container.drawers.get(this.shape);
263
- if (!drawer) {
264
- drawer = this._engine.getShapeDrawer(this.shape);
265
- if (drawer) {
266
- container.drawers.set(this.shape, drawer);
284
+ let effectDrawer = container.effectDrawers.get(this.effect);
285
+ if (!effectDrawer) {
286
+ effectDrawer = this._engine.getEffectDrawer(this.effect);
287
+ if (effectDrawer) {
288
+ container.effectDrawers.set(this.effect, effectDrawer);
267
289
  }
268
290
  }
269
- if (drawer && drawer.loadShape) {
270
- drawer.loadShape(this);
291
+ if (effectDrawer && effectDrawer.loadEffect) {
292
+ effectDrawer.loadEffect(this);
271
293
  }
272
- const sideCountFunc = drawer?.getSidesCount;
294
+ let shapeDrawer = container.shapeDrawers.get(this.shape);
295
+ if (!shapeDrawer) {
296
+ shapeDrawer = this._engine.getShapeDrawer(this.shape);
297
+ if (shapeDrawer) {
298
+ container.shapeDrawers.set(this.shape, shapeDrawer);
299
+ }
300
+ }
301
+ if (shapeDrawer && shapeDrawer.loadShape) {
302
+ shapeDrawer.loadShape(this);
303
+ }
304
+ const sideCountFunc = shapeDrawer?.getSidesCount;
273
305
  if (sideCountFunc) {
274
306
  this.sides = sideCountFunc(this);
275
307
  }
276
308
  this.spawning = false;
277
309
  this.shadowColor = (0, ColorUtils_js_1.rangeColorToRgb)(this.options.shadow.color);
278
- for (const updater of container.particles.updaters) {
310
+ for (const updater of particles.updaters) {
279
311
  updater.init(this);
280
312
  }
281
- for (const mover of container.particles.movers) {
313
+ for (const mover of particles.movers) {
282
314
  mover.init && mover.init(this);
283
315
  }
284
- if (drawer && drawer.particleInit) {
285
- drawer.particleInit(container, this);
316
+ if (effectDrawer && effectDrawer.particleInit) {
317
+ effectDrawer.particleInit(container, this);
318
+ }
319
+ if (shapeDrawer && shapeDrawer.particleInit) {
320
+ shapeDrawer.particleInit(container, this);
286
321
  }
287
322
  for (const [, plugin] of container.plugins) {
288
323
  plugin.particleCreated && plugin.particleCreated(this);