@tsparticles/engine 3.2.1 → 3.3.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 (144) hide show
  1. package/174.min.js +2 -0
  2. package/174.min.js.LICENSE.txt +1 -0
  3. package/browser/Core/Canvas.js +9 -9
  4. package/browser/Core/Container.js +7 -7
  5. package/browser/Core/Engine.js +1 -1
  6. package/browser/Core/Particle.js +12 -13
  7. package/browser/Core/Particles.js +30 -30
  8. package/browser/Core/Utils/EventListeners.js +4 -3
  9. package/browser/Core/Utils/InteractionManager.js +4 -4
  10. package/browser/Core/Utils/QuadTree.js +4 -5
  11. package/browser/Core/Utils/Ranges.js +55 -0
  12. package/browser/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
  13. package/browser/Options/Classes/AnimatableColor.js +1 -1
  14. package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
  15. package/browser/Options/Classes/Options.js +2 -1
  16. package/browser/Options/Classes/OptionsColor.js +1 -1
  17. package/browser/Options/Classes/Particles/Move/Move.js +1 -1
  18. package/browser/Types/RangeType.js +1 -0
  19. package/browser/Utils/CanvasUtils.js +14 -14
  20. package/browser/Utils/ColorUtils.js +2 -1
  21. package/browser/Utils/NumberUtils.js +2 -2
  22. package/browser/Utils/TypeUtils.js +18 -0
  23. package/browser/Utils/Utils.js +2 -19
  24. package/browser/exports.js +3 -5
  25. package/cjs/Core/Canvas.js +9 -9
  26. package/cjs/Core/Container.js +7 -7
  27. package/cjs/Core/Engine.js +2 -25
  28. package/cjs/Core/Particle.js +15 -16
  29. package/cjs/Core/Particles.js +32 -55
  30. package/cjs/Core/Utils/EventListeners.js +4 -3
  31. package/cjs/Core/Utils/InteractionManager.js +4 -4
  32. package/cjs/Core/Utils/QuadTree.js +7 -8
  33. package/cjs/Core/Utils/Ranges.js +61 -0
  34. package/cjs/Core/Utils/{Vector3d.js → Vectors.js} +18 -3
  35. package/cjs/Options/Classes/AnimatableColor.js +2 -2
  36. package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +2 -2
  37. package/cjs/Options/Classes/Options.js +2 -1
  38. package/cjs/Options/Classes/OptionsColor.js +2 -2
  39. package/cjs/Options/Classes/Particles/Move/Move.js +4 -4
  40. package/cjs/Types/RangeType.js +2 -0
  41. package/cjs/Utils/CanvasUtils.js +14 -14
  42. package/cjs/Utils/ColorUtils.js +9 -8
  43. package/cjs/Utils/NumberUtils.js +9 -9
  44. package/cjs/Utils/TypeUtils.js +27 -0
  45. package/cjs/Utils/Utils.js +13 -36
  46. package/cjs/exports.js +3 -5
  47. package/dist_browser_Core_Container_js.js +17 -7
  48. package/esm/Core/Canvas.js +9 -9
  49. package/esm/Core/Container.js +7 -7
  50. package/esm/Core/Engine.js +1 -1
  51. package/esm/Core/Particle.js +12 -13
  52. package/esm/Core/Particles.js +30 -30
  53. package/esm/Core/Utils/EventListeners.js +4 -3
  54. package/esm/Core/Utils/InteractionManager.js +4 -4
  55. package/esm/Core/Utils/QuadTree.js +4 -5
  56. package/esm/Core/Utils/Ranges.js +55 -0
  57. package/esm/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
  58. package/esm/Options/Classes/AnimatableColor.js +1 -1
  59. package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
  60. package/esm/Options/Classes/Options.js +2 -1
  61. package/esm/Options/Classes/OptionsColor.js +1 -1
  62. package/esm/Options/Classes/Particles/Move/Move.js +1 -1
  63. package/esm/Types/RangeType.js +1 -0
  64. package/esm/Utils/CanvasUtils.js +14 -14
  65. package/esm/Utils/ColorUtils.js +2 -1
  66. package/esm/Utils/NumberUtils.js +2 -2
  67. package/esm/Utils/TypeUtils.js +18 -0
  68. package/esm/Utils/Utils.js +2 -19
  69. package/esm/exports.js +3 -5
  70. package/package.json +1 -1
  71. package/report.html +1 -1
  72. package/tsparticles.engine.js +32 -52
  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 +4 -4
  76. package/types/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  77. package/types/Core/Interfaces/IContainerPlugin.d.ts +4 -4
  78. package/types/Core/Interfaces/IEffectDrawer.d.ts +3 -3
  79. package/types/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  80. package/types/Core/Interfaces/IMovePathGenerator.d.ts +3 -3
  81. package/types/Core/Interfaces/IParticleMover.d.ts +2 -2
  82. package/types/Core/Interfaces/IParticleUpdater.d.ts +2 -2
  83. package/types/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
  84. package/types/Core/Interfaces/IShapeDrawer.d.ts +4 -4
  85. package/types/Core/Particle.d.ts +3 -4
  86. package/types/Core/Particles.d.ts +7 -7
  87. package/types/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  88. package/types/Core/Utils/InteractionManager.d.ts +2 -2
  89. package/types/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  90. package/types/Core/Utils/QuadTree.d.ts +2 -3
  91. package/types/Core/Utils/Ranges.d.ts +21 -0
  92. package/types/Core/Utils/{Vector3d.d.ts → Vectors.d.ts} +6 -0
  93. package/types/Types/RangeType.d.ts +4 -0
  94. package/types/Utils/CanvasUtils.d.ts +6 -6
  95. package/types/Utils/NumberUtils.d.ts +1 -1
  96. package/types/Utils/TypeUtils.d.ts +6 -0
  97. package/types/Utils/Utils.d.ts +0 -6
  98. package/types/exports.d.ts +3 -5
  99. package/umd/Core/Canvas.js +9 -9
  100. package/umd/Core/Container.js +7 -7
  101. package/umd/Core/Engine.js +1 -1
  102. package/umd/Core/Particle.js +16 -17
  103. package/umd/Core/Particles.js +33 -57
  104. package/umd/Core/Utils/EventListeners.js +5 -4
  105. package/umd/Core/Utils/InteractionManager.js +4 -4
  106. package/umd/Core/Utils/QuadTree.js +8 -9
  107. package/umd/Core/Utils/Ranges.js +71 -0
  108. package/umd/Core/Utils/{Vector3d.js → Vectors.js} +19 -4
  109. package/umd/Options/Classes/AnimatableColor.js +3 -3
  110. package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +3 -3
  111. package/umd/Options/Classes/Options.js +3 -2
  112. package/umd/Options/Classes/OptionsColor.js +3 -3
  113. package/umd/Options/Classes/Particles/Move/Move.js +5 -5
  114. package/umd/{Core/Utils/Range.js → Types/RangeType.js} +0 -10
  115. package/umd/Utils/CanvasUtils.js +14 -14
  116. package/umd/Utils/ColorUtils.js +10 -9
  117. package/umd/Utils/NumberUtils.js +10 -10
  118. package/umd/Utils/TypeUtils.js +37 -0
  119. package/umd/Utils/Utils.js +14 -37
  120. package/umd/exports.js +4 -6
  121. package/373.min.js +0 -2
  122. package/373.min.js.LICENSE.txt +0 -1
  123. package/438.min.js +0 -2
  124. package/438.min.js.LICENSE.txt +0 -1
  125. package/browser/Core/Utils/Circle.js +0 -28
  126. package/browser/Core/Utils/Range.js +0 -8
  127. package/browser/Core/Utils/Rectangle.js +0 -22
  128. package/browser/Core/Utils/Vector.js +0 -20
  129. package/cjs/Core/Utils/Circle.js +0 -32
  130. package/cjs/Core/Utils/Range.js +0 -12
  131. package/cjs/Core/Utils/Rectangle.js +0 -26
  132. package/cjs/Core/Utils/Vector.js +0 -24
  133. package/dist_browser_Core_Particle_js.js +0 -32
  134. package/esm/Core/Utils/Circle.js +0 -28
  135. package/esm/Core/Utils/Range.js +0 -8
  136. package/esm/Core/Utils/Rectangle.js +0 -22
  137. package/esm/Core/Utils/Vector.js +0 -20
  138. package/types/Core/Utils/Circle.d.ts +0 -8
  139. package/types/Core/Utils/Range.d.ts +0 -7
  140. package/types/Core/Utils/Rectangle.d.ts +0 -9
  141. package/types/Core/Utils/Vector.d.ts +0 -8
  142. package/umd/Core/Utils/Circle.js +0 -42
  143. package/umd/Core/Utils/Rectangle.js +0 -36
  144. package/umd/Core/Utils/Vector.js +0 -34
@@ -1,4 +1,4 @@
1
- import { deepExtend, executeOnSingleOrMultiple, isBoolean, safeMatchMedia } from "../../Utils/Utils.js";
1
+ import { deepExtend, executeOnSingleOrMultiple, safeMatchMedia } from "../../Utils/Utils.js";
2
2
  import { Background } from "./Background/Background.js";
3
3
  import { BackgroundMask } from "./BackgroundMask/BackgroundMask.js";
4
4
  import { FullScreen } from "./FullScreen/FullScreen.js";
@@ -6,6 +6,7 @@ import { Interactivity } from "./Interactivity/Interactivity.js";
6
6
  import { ManualParticle } from "./ManualParticle.js";
7
7
  import { Responsive } from "./Responsive.js";
8
8
  import { Theme } from "./Theme/Theme.js";
9
+ import { isBoolean } from "../../Utils/TypeUtils.js";
9
10
  import { loadParticlesOptions } from "../../Utils/OptionsUtils.js";
10
11
  import { setRangeValue } from "../../Utils/NumberUtils.js";
11
12
  export class Options {
@@ -1,4 +1,4 @@
1
- import { isArray, isString } from "../../Utils/Utils.js";
1
+ import { isArray, isString } from "../../Utils/TypeUtils.js";
2
2
  export class OptionsColor {
3
3
  constructor() {
4
4
  this.value = "";
@@ -1,4 +1,4 @@
1
- import { isNumber, isObject } from "../../../../Utils/Utils.js";
1
+ import { isNumber, isObject } from "../../../../Utils/TypeUtils.js";
2
2
  import { MoveAngle } from "./MoveAngle.js";
3
3
  import { MoveAttract } from "./MoveAttract.js";
4
4
  import { MoveCenter } from "./MoveCenter.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -21,7 +21,7 @@ export function paintImage(context, dimension, image, opacity) {
21
21
  export function clear(context, dimension) {
22
22
  context.clearRect(origin.x, origin.y, dimension.width, dimension.height);
23
23
  }
24
- export async function drawParticle(data) {
24
+ export function drawParticle(data) {
25
25
  const { container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow, transform, } = data, pos = particle.getPosition(), defaultAngle = 0, angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : defaultAngle), rotateData = {
26
26
  sin: Math.sin(angle),
27
27
  cos: Math.cos(angle),
@@ -60,13 +60,13 @@ export async function drawParticle(data) {
60
60
  transformData,
61
61
  strokeWidth,
62
62
  };
63
- await drawShape(drawData);
64
- await drawShapeAfterDraw(drawData);
65
- await drawEffect(drawData);
63
+ drawShape(drawData);
64
+ drawShapeAfterDraw(drawData);
65
+ drawEffect(drawData);
66
66
  context.globalCompositeOperation = "source-over";
67
67
  context.resetTransform();
68
68
  }
69
- export async function drawEffect(data) {
69
+ export function drawEffect(data) {
70
70
  const { container, context, particle, radius, opacity, delta, transformData } = data;
71
71
  if (!particle.effect) {
72
72
  return;
@@ -75,7 +75,7 @@ export async function drawEffect(data) {
75
75
  if (!drawer) {
76
76
  return;
77
77
  }
78
- await drawer.draw({
78
+ drawer.draw({
79
79
  context,
80
80
  particle,
81
81
  radius,
@@ -85,7 +85,7 @@ export async function drawEffect(data) {
85
85
  transformData: { ...transformData },
86
86
  });
87
87
  }
88
- export async function drawShape(data) {
88
+ export function drawShape(data) {
89
89
  const { container, context, particle, radius, opacity, delta, strokeWidth, transformData } = data, minStrokeWidth = 0;
90
90
  if (!particle.shape) {
91
91
  return;
@@ -95,7 +95,7 @@ export async function drawShape(data) {
95
95
  return;
96
96
  }
97
97
  context.beginPath();
98
- await drawer.draw({
98
+ drawer.draw({
99
99
  context,
100
100
  particle,
101
101
  radius,
@@ -114,7 +114,7 @@ export async function drawShape(data) {
114
114
  context.fill();
115
115
  }
116
116
  }
117
- export async function drawShapeAfterDraw(data) {
117
+ export function drawShapeAfterDraw(data) {
118
118
  const { container, context, particle, radius, opacity, delta, transformData } = data;
119
119
  if (!particle.shape) {
120
120
  return;
@@ -123,7 +123,7 @@ export async function drawShapeAfterDraw(data) {
123
123
  if (!drawer?.afterDraw) {
124
124
  return;
125
125
  }
126
- await drawer.afterDraw({
126
+ drawer.afterDraw({
127
127
  context,
128
128
  particle,
129
129
  radius,
@@ -133,17 +133,17 @@ export async function drawShapeAfterDraw(data) {
133
133
  transformData: { ...transformData },
134
134
  });
135
135
  }
136
- export async function drawPlugin(context, plugin, delta) {
136
+ export function drawPlugin(context, plugin, delta) {
137
137
  if (!plugin.draw) {
138
138
  return;
139
139
  }
140
- await plugin.draw(context, delta);
140
+ plugin.draw(context, delta);
141
141
  }
142
- export async function drawParticlePlugin(context, plugin, particle, delta) {
142
+ export function drawParticlePlugin(context, plugin, particle, delta) {
143
143
  if (!plugin.drawParticle) {
144
144
  return;
145
145
  }
146
- await plugin.drawParticle(context, particle, delta);
146
+ plugin.drawParticle(context, particle, delta);
147
147
  }
148
148
  export function alterHsl(color, type, value) {
149
149
  const lFactor = 1;
@@ -1,6 +1,7 @@
1
1
  import { clamp, getRandom, getRangeMax, getRangeMin, getRangeValue, mix, randomInRange, setRangeValue, } from "./NumberUtils.js";
2
- import { isArray, isString, itemFromArray } from "./Utils.js";
2
+ import { isArray, isString } from "./TypeUtils.js";
3
3
  import { millisecondsToSeconds, percentDenominator } from "../Core/Utils/Constants.js";
4
+ import { itemFromArray } from "./Utils.js";
4
5
  const randomColorValue = "random", midColorValue = "mid", colorManagers = new Map();
5
6
  export function addColorManager(manager) {
6
7
  colorManagers.set(manager.key, manager);
@@ -1,5 +1,5 @@
1
- import { Vector } from "../Core/Utils/Vector.js";
2
- import { isNumber } from "./Utils.js";
1
+ import { Vector } from "../Core/Utils/Vectors.js";
2
+ import { isNumber } from "./TypeUtils.js";
3
3
  import { percentDenominator } from "../Core/Utils/Constants.js";
4
4
  let _random = Math.random;
5
5
  const easings = new Map(), double = 2, doublePI = Math.PI * double;
@@ -0,0 +1,18 @@
1
+ export function isBoolean(arg) {
2
+ return typeof arg === "boolean";
3
+ }
4
+ export function isString(arg) {
5
+ return typeof arg === "string";
6
+ }
7
+ export function isNumber(arg) {
8
+ return typeof arg === "number";
9
+ }
10
+ export function isFunction(arg) {
11
+ return typeof arg === "function";
12
+ }
13
+ export function isObject(arg) {
14
+ return typeof arg === "object" && arg !== null;
15
+ }
16
+ export function isArray(arg) {
17
+ return Array.isArray(arg);
18
+ }
@@ -1,6 +1,7 @@
1
1
  import { clamp, collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, randomInRange, } from "./NumberUtils.js";
2
2
  import { halfRandom, millisecondsToSeconds, percentDenominator } from "../Core/Utils/Constants.js";
3
- import { Vector } from "../Core/Utils/Vector.js";
3
+ import { isArray, isObject } from "./TypeUtils.js";
4
+ import { Vector } from "../Core/Utils/Vectors.js";
4
5
  const _logger = {
5
6
  debug: console.debug,
6
7
  error: console.error,
@@ -332,24 +333,6 @@ export function getPosition(position, canvasSize) {
332
333
  export function getSize(size, canvasSize) {
333
334
  return getPositionOrSize(size, canvasSize);
334
335
  }
335
- export function isBoolean(arg) {
336
- return typeof arg === "boolean";
337
- }
338
- export function isString(arg) {
339
- return typeof arg === "string";
340
- }
341
- export function isNumber(arg) {
342
- return typeof arg === "number";
343
- }
344
- export function isFunction(arg) {
345
- return typeof arg === "function";
346
- }
347
- export function isObject(arg) {
348
- return typeof arg === "object" && arg !== null;
349
- }
350
- export function isArray(arg) {
351
- return Array.isArray(arg);
352
- }
353
336
  function checkDestroy(particle, destroyType, value, minValue, maxValue) {
354
337
  switch (destroyType) {
355
338
  case "max":
@@ -1,12 +1,9 @@
1
- export * from "./Core/Utils/Circle.js";
2
1
  export * from "./Core/Utils/Constants.js";
3
2
  export * from "./Core/Utils/ExternalInteractorBase.js";
4
3
  export * from "./Core/Utils/ParticlesInteractorBase.js";
5
4
  export * from "./Core/Utils/Point.js";
6
- export * from "./Core/Utils/Range.js";
7
- export * from "./Core/Utils/Rectangle.js";
8
- export * from "./Core/Utils/Vector.js";
9
- export * from "./Core/Utils/Vector3d.js";
5
+ export * from "./Core/Utils/Ranges.js";
6
+ export * from "./Core/Utils/Vectors.js";
10
7
  export * from "./Enums/Directions/MoveDirection.js";
11
8
  export * from "./Enums/Directions/RotateDirection.js";
12
9
  export * from "./Enums/Directions/OutModeDirection.js";
@@ -86,3 +83,4 @@ export * from "./Utils/NumberUtils.js";
86
83
  export * from "./Utils/OptionsUtils.js";
87
84
  export * from "./Utils/RgbColorManager.js";
88
85
  export * from "./Utils/Utils.js";
86
+ export * from "./Utils/TypeUtils.js";
@@ -273,11 +273,11 @@ class Canvas {
273
273
  drawAsync(cb) {
274
274
  const ctx = this._context;
275
275
  if (!ctx) {
276
- return Promise.resolve(undefined);
276
+ return undefined;
277
277
  }
278
278
  return cb(ctx);
279
279
  }
280
- async drawParticle(particle, delta) {
280
+ drawParticle(particle, delta) {
281
281
  if (particle.spawning || particle.destroyed) {
282
282
  return;
283
283
  }
@@ -296,13 +296,13 @@ class Canvas {
296
296
  if (!fColor && !sColor) {
297
297
  return;
298
298
  }
299
- await this.drawAsync(async (ctx) => {
299
+ this.draw((ctx) => {
300
300
  const container = this.container, options = container.actualOptions, zIndexOptions = particle.options.zIndex, zIndexFactorOffset = 1, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, defaultOpacity = 1, opacity = particle.bubble.opacity ?? particle.opacity?.value ?? defaultOpacity, strokeOpacity = particle.strokeOpacity ?? opacity, zOpacity = opacity * zOpacityFactor, zStrokeOpacity = strokeOpacity * zOpacityFactor, transform = {}, colorStyles = {
301
301
  fill: fColor ? (0, ColorUtils_js_1.getStyleFromHsl)(fColor, zOpacity) : undefined,
302
302
  };
303
303
  colorStyles.stroke = sColor ? (0, ColorUtils_js_1.getStyleFromHsl)(sColor, zStrokeOpacity) : colorStyles.fill;
304
304
  this._applyPreDrawUpdaters(ctx, particle, radius, zOpacity, colorStyles, transform);
305
- await (0, CanvasUtils_js_1.drawParticle)({
305
+ (0, CanvasUtils_js_1.drawParticle)({
306
306
  container,
307
307
  context: ctx,
308
308
  particle,
@@ -318,11 +318,11 @@ class Canvas {
318
318
  this._applyPostDrawUpdaters(particle);
319
319
  });
320
320
  }
321
- async drawParticlePlugin(plugin, particle, delta) {
322
- await this.drawAsync((ctx) => (0, CanvasUtils_js_1.drawParticlePlugin)(ctx, plugin, particle, delta));
321
+ drawParticlePlugin(plugin, particle, delta) {
322
+ this.draw((ctx) => (0, CanvasUtils_js_1.drawParticlePlugin)(ctx, plugin, particle, delta));
323
323
  }
324
- async drawPlugin(plugin, delta) {
325
- await this.drawAsync((ctx) => (0, CanvasUtils_js_1.drawPlugin)(ctx, plugin, delta));
324
+ drawPlugin(plugin, delta) {
325
+ this.draw((ctx) => (0, CanvasUtils_js_1.drawPlugin)(ctx, plugin, delta));
326
326
  }
327
327
  async init() {
328
328
  this._safeMutationObserver((obs) => obs.disconnect());
@@ -475,7 +475,7 @@ class Canvas {
475
475
  return;
476
476
  }
477
477
  const container = this.container, needsRefresh = container.updateActualOptions();
478
- await container.particles.setDensity();
478
+ container.particles.setDensity();
479
479
  this._applyResizePlugins();
480
480
  if (needsRefresh) {
481
481
  await container.refresh();
@@ -36,14 +36,14 @@ class Container {
36
36
  continue;
37
37
  }
38
38
  if (entry.isIntersecting) {
39
- this.play();
39
+ void this.play();
40
40
  }
41
41
  else {
42
42
  this.pause();
43
43
  }
44
44
  }
45
45
  };
46
- this._nextFrame = async (timestamp) => {
46
+ this._nextFrame = (timestamp) => {
47
47
  try {
48
48
  if (!this._smooth &&
49
49
  this._lastFrameTime !== undefined &&
@@ -59,7 +59,7 @@ class Container {
59
59
  this.draw(false);
60
60
  return;
61
61
  }
62
- await this.particles.draw(delta);
62
+ this.particles.draw(delta);
63
63
  if (!this.alive()) {
64
64
  this.destroy();
65
65
  return;
@@ -240,14 +240,14 @@ class Container {
240
240
  return;
241
241
  }
242
242
  let refreshTime = force;
243
- const frame = async (timestamp) => {
243
+ const frame = (timestamp) => {
244
244
  if (refreshTime) {
245
245
  this._lastFrameTime = undefined;
246
246
  refreshTime = false;
247
247
  }
248
- await this._nextFrame(timestamp);
248
+ this._nextFrame(timestamp);
249
249
  };
250
- this._drawAnimationFrame = requestAnimationFrame((timestamp) => void frame(timestamp));
250
+ this._drawAnimationFrame = requestAnimationFrame((timestamp) => frame(timestamp));
251
251
  }
252
252
  async export(type, options = {}) {
253
253
  for (const [, plugin] of this.plugins) {
@@ -319,7 +319,7 @@ class Container {
319
319
  }
320
320
  this._engine.dispatchEvent("containerInit", { container: this });
321
321
  await this.particles.init();
322
- await this.particles.setDensity();
322
+ this.particles.setDensity();
323
323
  for (const [, plugin] of this.plugins) {
324
324
  plugin.particlesSetup?.();
325
325
  }
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.Engine = void 0;
27
4
  const Constants_js_1 = require("./Utils/Constants.js");
@@ -76,7 +53,7 @@ class Engine {
76
53
  return res;
77
54
  }
78
55
  get version() {
79
- return "3.2.1";
56
+ return "3.3.0";
80
57
  }
81
58
  addConfig(config) {
82
59
  const key = config.key ?? config.name ?? "default";
@@ -238,7 +215,7 @@ class Engine {
238
215
  if (!canvasEl.style.height) {
239
216
  canvasEl.style.height = "100%";
240
217
  }
241
- const { Container } = await Promise.resolve().then(() => __importStar(require("./Container.js"))), newItem = new Container(this, id, currentOptions);
218
+ const { Container } = await import("./Container.js"), newItem = new Container(this, id, currentOptions);
242
219
  if (oldIndex >= minIndex) {
243
220
  const deleteCount = 0;
244
221
  dom.splice(oldIndex, deleteCount, newItem);
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Particle = void 0;
4
+ const Vectors_js_1 = require("./Utils/Vectors.js");
4
5
  const NumberUtils_js_1 = require("../Utils/NumberUtils.js");
5
6
  const Utils_js_1 = require("../Utils/Utils.js");
6
7
  const Constants_js_1 = require("./Utils/Constants.js");
7
8
  const ColorUtils_js_1 = require("../Utils/ColorUtils.js");
8
9
  const Interactivity_js_1 = require("../Options/Classes/Interactivity/Interactivity.js");
9
- const Vector_js_1 = require("./Utils/Vector.js");
10
- const Vector3d_js_1 = require("./Utils/Vector3d.js");
11
10
  const CanvasUtils_js_1 = require("../Utils/CanvasUtils.js");
12
11
  const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
13
12
  const defaultRetryCount = 0, double = 2, half = 0.5, squareExp = 2;
@@ -50,13 +49,13 @@ class Particle {
50
49
  for (const [, plugin] of container.plugins) {
51
50
  const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
52
51
  if (pluginPos) {
53
- return Vector3d_js_1.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
52
+ return Vectors_js_1.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
54
53
  }
55
54
  }
56
55
  const canvasSize = container.canvas.size, exactPosition = (0, NumberUtils_js_1.calcExactPositionOrRandomFromSize)({
57
56
  size: canvasSize,
58
57
  position: position,
59
- }), pos = Vector3d_js_1.Vector3d.create(exactPosition.x, exactPosition.y, zIndex), radius = this.getRadius(), outModes = this.options.move.outModes, fixHorizontal = (outMode) => {
58
+ }), pos = Vectors_js_1.Vector3d.create(exactPosition.x, exactPosition.y, zIndex), radius = this.getRadius(), outModes = this.options.move.outModes, fixHorizontal = (outMode) => {
60
59
  fixOutMode({
61
60
  outMode,
62
61
  checkModes: ["bounce"],
@@ -152,7 +151,7 @@ class Particle {
152
151
  this.outType = "outside";
153
152
  break;
154
153
  }
155
- this.offset = Vector_js_1.Vector.origin;
154
+ this.offset = Vectors_js_1.Vector.origin;
156
155
  };
157
156
  this._engine = engine;
158
157
  }
@@ -179,12 +178,12 @@ class Particle {
179
178
  },
180
179
  });
181
180
  }
182
- async draw(delta) {
181
+ draw(delta) {
183
182
  const container = this.container, canvas = container.canvas;
184
183
  for (const [, plugin] of container.plugins) {
185
- await canvas.drawParticlePlugin(plugin, this, delta);
184
+ canvas.drawParticlePlugin(plugin, this, delta);
186
185
  }
187
- await canvas.drawParticle(this, delta);
186
+ canvas.drawParticle(this, delta);
188
187
  }
189
188
  getFillColor() {
190
189
  return this._getRollColor(this.bubble.color ?? (0, ColorUtils_js_1.getHslFromAnimation)(this.color));
@@ -205,7 +204,7 @@ class Particle {
205
204
  getStrokeColor() {
206
205
  return this._getRollColor(this.bubble.color ?? (0, ColorUtils_js_1.getHslFromAnimation)(this.strokeColor));
207
206
  }
208
- async init(id, position, overrideOptions, group) {
207
+ init(id, position, overrideOptions, group) {
209
208
  const container = this.container, engine = this._engine;
210
209
  this.id = id;
211
210
  this.group = group;
@@ -269,7 +268,7 @@ class Particle {
269
268
  if (pathOptions.generator) {
270
269
  this.pathGenerator = this._engine.getPathGenerator(pathOptions.generator);
271
270
  if (this.pathGenerator && container.addPath(pathOptions.generator, this.pathGenerator)) {
272
- await this.pathGenerator.init(container);
271
+ this.pathGenerator.init(container);
273
272
  }
274
273
  }
275
274
  container.retina.initParticle(this);
@@ -298,7 +297,7 @@ class Particle {
298
297
  }
299
298
  }
300
299
  if (effectDrawer?.loadEffect) {
301
- await effectDrawer.loadEffect(this);
300
+ effectDrawer.loadEffect(this);
302
301
  }
303
302
  let shapeDrawer = container.shapeDrawers.get(this.shape);
304
303
  if (!shapeDrawer) {
@@ -308,7 +307,7 @@ class Particle {
308
307
  }
309
308
  }
310
309
  if (shapeDrawer?.loadShape) {
311
- await shapeDrawer.loadShape(this);
310
+ shapeDrawer.loadShape(this);
312
311
  }
313
312
  const sideCountFunc = shapeDrawer?.getSidesCount;
314
313
  if (sideCountFunc) {
@@ -317,13 +316,13 @@ class Particle {
317
316
  this.spawning = false;
318
317
  this.shadowColor = (0, ColorUtils_js_1.rangeColorToRgb)(this.options.shadow.color);
319
318
  for (const updater of particles.updaters) {
320
- await updater.init(this);
319
+ updater.init(this);
321
320
  }
322
321
  for (const mover of particles.movers) {
323
- await mover.init?.(this);
322
+ mover.init?.(this);
324
323
  }
325
- await effectDrawer?.particleInit?.(container, this);
326
- await shapeDrawer?.particleInit?.(container, this);
324
+ effectDrawer?.particleInit?.(container, this);
325
+ shapeDrawer?.particleInit?.(container, this);
327
326
  for (const [, plugin] of container.plugins) {
328
327
  plugin.particleCreated?.(this);
329
328
  }