tsparticles 1.41.0 → 1.41.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 (205) hide show
  1. package/Core/Container.js +2 -2
  2. package/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  3. package/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
  4. package/Core/Particle.js +2 -2
  5. package/Core/Particles.d.ts +3 -3
  6. package/Core/Particles.js +7 -7
  7. package/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  8. package/Core/Utils/FrameManager.d.ts +1 -1
  9. package/Core/Utils/FrameManager.js +2 -2
  10. package/Core/Utils/InteractionManager.d.ts +2 -2
  11. package/Core/Utils/InteractionManager.js +4 -4
  12. package/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  13. package/Interactions/External/Attract/Attractor.d.ts +1 -1
  14. package/Interactions/External/Attract/Attractor.js +1 -1
  15. package/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  16. package/Interactions/External/Bounce/Bouncer.js +1 -1
  17. package/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  18. package/Interactions/External/Bubble/Bubbler.js +1 -1
  19. package/Interactions/External/Connect/Connector.d.ts +1 -1
  20. package/Interactions/External/Connect/Connector.js +1 -1
  21. package/Interactions/External/Grab/Grabber.d.ts +1 -1
  22. package/Interactions/External/Grab/Grabber.js +1 -1
  23. package/Interactions/External/Repulse/Repulser.d.ts +1 -1
  24. package/Interactions/External/Repulse/Repulser.js +1 -1
  25. package/Interactions/External/Trail/TrailMaker.d.ts +1 -1
  26. package/Interactions/External/Trail/TrailMaker.js +1 -1
  27. package/Interactions/Particles/Attract/Attractor.d.ts +1 -1
  28. package/Interactions/Particles/Attract/Attractor.js +1 -1
  29. package/Interactions/Particles/Collisions/Collider.d.ts +1 -1
  30. package/Interactions/Particles/Collisions/Collider.js +1 -1
  31. package/Interactions/Particles/Links/Linker.d.ts +1 -1
  32. package/Interactions/Particles/Links/Linker.js +1 -1
  33. package/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
  34. package/Updaters/Opacity/OpacityUpdater.js +7 -5
  35. package/Updaters/Size/SizeUpdater.js +6 -5
  36. package/browser/Core/Container.js +2 -2
  37. package/browser/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  38. package/browser/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
  39. package/browser/Core/Particle.js +2 -2
  40. package/browser/Core/Particles.d.ts +3 -3
  41. package/browser/Core/Particles.js +7 -7
  42. package/browser/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  43. package/browser/Core/Utils/FrameManager.d.ts +1 -1
  44. package/browser/Core/Utils/FrameManager.js +2 -2
  45. package/browser/Core/Utils/InteractionManager.d.ts +2 -2
  46. package/browser/Core/Utils/InteractionManager.js +4 -4
  47. package/browser/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  48. package/browser/Interactions/External/Attract/Attractor.d.ts +1 -1
  49. package/browser/Interactions/External/Attract/Attractor.js +1 -1
  50. package/browser/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  51. package/browser/Interactions/External/Bounce/Bouncer.js +1 -1
  52. package/browser/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  53. package/browser/Interactions/External/Bubble/Bubbler.js +1 -1
  54. package/browser/Interactions/External/Connect/Connector.d.ts +1 -1
  55. package/browser/Interactions/External/Connect/Connector.js +1 -1
  56. package/browser/Interactions/External/Grab/Grabber.d.ts +1 -1
  57. package/browser/Interactions/External/Grab/Grabber.js +1 -1
  58. package/browser/Interactions/External/Repulse/Repulser.d.ts +1 -1
  59. package/browser/Interactions/External/Repulse/Repulser.js +1 -1
  60. package/browser/Interactions/External/Trail/TrailMaker.d.ts +1 -1
  61. package/browser/Interactions/External/Trail/TrailMaker.js +1 -1
  62. package/browser/Interactions/Particles/Attract/Attractor.d.ts +1 -1
  63. package/browser/Interactions/Particles/Attract/Attractor.js +1 -1
  64. package/browser/Interactions/Particles/Collisions/Collider.d.ts +1 -1
  65. package/browser/Interactions/Particles/Collisions/Collider.js +1 -1
  66. package/browser/Interactions/Particles/Links/Linker.d.ts +1 -1
  67. package/browser/Interactions/Particles/Links/Linker.js +1 -1
  68. package/browser/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
  69. package/browser/Updaters/Opacity/OpacityUpdater.js +7 -5
  70. package/browser/Updaters/Size/SizeUpdater.js +6 -5
  71. package/esm/Core/Container.js +2 -2
  72. package/esm/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  73. package/esm/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
  74. package/esm/Core/Particle.js +2 -2
  75. package/esm/Core/Particles.d.ts +3 -3
  76. package/esm/Core/Particles.js +7 -7
  77. package/esm/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  78. package/esm/Core/Utils/FrameManager.d.ts +1 -1
  79. package/esm/Core/Utils/FrameManager.js +2 -2
  80. package/esm/Core/Utils/InteractionManager.d.ts +2 -2
  81. package/esm/Core/Utils/InteractionManager.js +4 -4
  82. package/esm/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  83. package/esm/Interactions/External/Attract/Attractor.d.ts +1 -1
  84. package/esm/Interactions/External/Attract/Attractor.js +1 -1
  85. package/esm/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  86. package/esm/Interactions/External/Bounce/Bouncer.js +1 -1
  87. package/esm/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  88. package/esm/Interactions/External/Bubble/Bubbler.js +1 -1
  89. package/esm/Interactions/External/Connect/Connector.d.ts +1 -1
  90. package/esm/Interactions/External/Connect/Connector.js +1 -1
  91. package/esm/Interactions/External/Grab/Grabber.d.ts +1 -1
  92. package/esm/Interactions/External/Grab/Grabber.js +1 -1
  93. package/esm/Interactions/External/Repulse/Repulser.d.ts +1 -1
  94. package/esm/Interactions/External/Repulse/Repulser.js +1 -1
  95. package/esm/Interactions/External/Trail/TrailMaker.d.ts +1 -1
  96. package/esm/Interactions/External/Trail/TrailMaker.js +1 -1
  97. package/esm/Interactions/Particles/Attract/Attractor.d.ts +1 -1
  98. package/esm/Interactions/Particles/Attract/Attractor.js +1 -1
  99. package/esm/Interactions/Particles/Collisions/Collider.d.ts +1 -1
  100. package/esm/Interactions/Particles/Collisions/Collider.js +1 -1
  101. package/esm/Interactions/Particles/Links/Linker.d.ts +1 -1
  102. package/esm/Interactions/Particles/Links/Linker.js +1 -1
  103. package/esm/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
  104. package/esm/Updaters/Opacity/OpacityUpdater.js +7 -5
  105. package/esm/Updaters/Size/SizeUpdater.js +6 -5
  106. package/package.json +1 -1
  107. package/report.html +6 -5
  108. package/report.slim.html +6 -5
  109. package/tsparticles.engine.js +17 -17
  110. package/tsparticles.engine.min.js +2 -2
  111. package/tsparticles.interaction.external.attract.js +16 -16
  112. package/tsparticles.interaction.external.attract.min.js +2 -2
  113. package/tsparticles.interaction.external.bounce.js +16 -16
  114. package/tsparticles.interaction.external.bounce.min.js +2 -2
  115. package/tsparticles.interaction.external.bubble.js +16 -16
  116. package/tsparticles.interaction.external.bubble.min.js +2 -2
  117. package/tsparticles.interaction.external.connect.js +16 -16
  118. package/tsparticles.interaction.external.connect.min.js +2 -2
  119. package/tsparticles.interaction.external.grab.js +16 -16
  120. package/tsparticles.interaction.external.grab.min.js +2 -2
  121. package/tsparticles.interaction.external.repulse.js +16 -16
  122. package/tsparticles.interaction.external.repulse.min.js +2 -2
  123. package/tsparticles.interaction.external.trail.js +16 -16
  124. package/tsparticles.interaction.external.trail.min.js +2 -2
  125. package/tsparticles.interaction.particles.attract.js +16 -16
  126. package/tsparticles.interaction.particles.attract.min.js +2 -2
  127. package/tsparticles.interaction.particles.collisions.js +16 -16
  128. package/tsparticles.interaction.particles.collisions.min.js +2 -2
  129. package/tsparticles.interaction.particles.links.js +16 -16
  130. package/tsparticles.interaction.particles.links.min.js +2 -2
  131. package/tsparticles.js +35 -35
  132. package/tsparticles.min.js +2 -2
  133. package/tsparticles.pathseg.min.js +1 -1
  134. package/tsparticles.plugins.absorbers.js +15 -15
  135. package/tsparticles.plugins.absorbers.min.js +1 -1
  136. package/tsparticles.plugins.emitters.js +15 -15
  137. package/tsparticles.plugins.emitters.min.js +1 -1
  138. package/tsparticles.plugins.polygonMask.js +17 -17
  139. package/tsparticles.plugins.polygonMask.min.js +2 -2
  140. package/tsparticles.shape.circle.min.js +1 -1
  141. package/tsparticles.shape.image.js +15 -15
  142. package/tsparticles.shape.image.min.js +1 -1
  143. package/tsparticles.shape.line.min.js +1 -1
  144. package/tsparticles.shape.polygon.min.js +1 -1
  145. package/tsparticles.shape.square.min.js +1 -1
  146. package/tsparticles.shape.star.min.js +1 -1
  147. package/tsparticles.shape.text.js +15 -15
  148. package/tsparticles.shape.text.min.js +1 -1
  149. package/tsparticles.slim.js +32 -32
  150. package/tsparticles.slim.min.js +2 -2
  151. package/tsparticles.updater.angle.js +15 -15
  152. package/tsparticles.updater.angle.min.js +1 -1
  153. package/tsparticles.updater.color.js +15 -15
  154. package/tsparticles.updater.color.min.js +1 -1
  155. package/tsparticles.updater.life.js +15 -15
  156. package/tsparticles.updater.life.min.js +1 -1
  157. package/tsparticles.updater.opacity.js +18 -18
  158. package/tsparticles.updater.opacity.min.js +2 -2
  159. package/tsparticles.updater.outModes.js +15 -15
  160. package/tsparticles.updater.outModes.min.js +1 -1
  161. package/tsparticles.updater.roll.js +15 -15
  162. package/tsparticles.updater.roll.min.js +1 -1
  163. package/tsparticles.updater.size.js +18 -18
  164. package/tsparticles.updater.size.min.js +2 -2
  165. package/tsparticles.updater.strokeColor.js +15 -15
  166. package/tsparticles.updater.strokeColor.min.js +1 -1
  167. package/tsparticles.updater.tilt.js +15 -15
  168. package/tsparticles.updater.tilt.min.js +1 -1
  169. package/tsparticles.updater.wobble.js +15 -15
  170. package/tsparticles.updater.wobble.min.js +1 -1
  171. package/umd/Core/Container.js +2 -2
  172. package/umd/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  173. package/umd/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
  174. package/umd/Core/Particle.js +2 -2
  175. package/umd/Core/Particles.d.ts +3 -3
  176. package/umd/Core/Particles.js +7 -7
  177. package/umd/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  178. package/umd/Core/Utils/FrameManager.d.ts +1 -1
  179. package/umd/Core/Utils/FrameManager.js +2 -2
  180. package/umd/Core/Utils/InteractionManager.d.ts +2 -2
  181. package/umd/Core/Utils/InteractionManager.js +4 -4
  182. package/umd/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  183. package/umd/Interactions/External/Attract/Attractor.d.ts +1 -1
  184. package/umd/Interactions/External/Attract/Attractor.js +1 -1
  185. package/umd/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  186. package/umd/Interactions/External/Bounce/Bouncer.js +1 -1
  187. package/umd/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  188. package/umd/Interactions/External/Bubble/Bubbler.js +1 -1
  189. package/umd/Interactions/External/Connect/Connector.d.ts +1 -1
  190. package/umd/Interactions/External/Connect/Connector.js +1 -1
  191. package/umd/Interactions/External/Grab/Grabber.d.ts +1 -1
  192. package/umd/Interactions/External/Grab/Grabber.js +1 -1
  193. package/umd/Interactions/External/Repulse/Repulser.d.ts +1 -1
  194. package/umd/Interactions/External/Repulse/Repulser.js +1 -1
  195. package/umd/Interactions/External/Trail/TrailMaker.d.ts +1 -1
  196. package/umd/Interactions/External/Trail/TrailMaker.js +1 -1
  197. package/umd/Interactions/Particles/Attract/Attractor.d.ts +1 -1
  198. package/umd/Interactions/Particles/Attract/Attractor.js +1 -1
  199. package/umd/Interactions/Particles/Collisions/Collider.d.ts +1 -1
  200. package/umd/Interactions/Particles/Collisions/Collider.js +1 -1
  201. package/umd/Interactions/Particles/Links/Linker.d.ts +1 -1
  202. package/umd/Interactions/Particles/Links/Linker.js +1 -1
  203. package/umd/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
  204. package/umd/Updaters/Opacity/OpacityUpdater.js +7 -5
  205. package/umd/Updaters/Size/SizeUpdater.js +6 -5
@@ -37,21 +37,21 @@ export class InteractionManager {
37
37
  }
38
38
  }
39
39
  }
40
- externalInteract(delta) {
40
+ async externalInteract(delta) {
41
41
  for (const interactor of this.externalInteractors) {
42
42
  if (interactor.isEnabled()) {
43
- interactor.interact(delta);
43
+ await interactor.interact(delta);
44
44
  }
45
45
  }
46
46
  }
47
- particlesInteract(particle, delta) {
47
+ async particlesInteract(particle, delta) {
48
48
  for (const interactor of this.externalInteractors) {
49
49
  interactor.reset(particle);
50
50
  }
51
51
  /* interaction auto between particles */
52
52
  for (const interactor of this.particleInteractors) {
53
53
  if (interactor.isEnabled(particle)) {
54
- interactor.interact(particle, delta);
54
+ await interactor.interact(particle, delta);
55
55
  }
56
56
  }
57
57
  }
@@ -6,7 +6,7 @@ export declare abstract class ParticlesInteractorBase implements IParticlesInter
6
6
  protected readonly container: Container;
7
7
  protected constructor(container: Container);
8
8
  type: InteractorType;
9
- abstract interact(particle: Particle, delta: IDelta): void;
9
+ abstract interact(particle: Particle, delta: IDelta): Promise<void>;
10
10
  abstract isEnabled(particle: Particle): boolean;
11
11
  abstract reset(particle: Particle): void;
12
12
  }
@@ -8,7 +8,7 @@ export declare class Attractor extends ExternalInteractorBase {
8
8
  constructor(container: Container);
9
9
  isEnabled(): boolean;
10
10
  reset(): void;
11
- interact(): void;
11
+ interact(): Promise<void>;
12
12
  private hoverAttract;
13
13
  private processAttract;
14
14
  private clickAttract;
@@ -19,7 +19,7 @@ export class Attractor extends ExternalInteractorBase {
19
19
  reset() {
20
20
  // do nothing
21
21
  }
22
- interact() {
22
+ async interact() {
23
23
  const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode;
24
24
  if (mouseMoveStatus && hoverEnabled && isInArray("attract" /* attract */, hoverMode)) {
25
25
  this.hoverAttract();
@@ -3,7 +3,7 @@ import type { Container } from "../../../Core";
3
3
  export declare class Bouncer extends ExternalInteractorBase {
4
4
  constructor(container: Container);
5
5
  isEnabled(): boolean;
6
- interact(): void;
6
+ interact(): Promise<void>;
7
7
  reset(): void;
8
8
  private processMouseBounce;
9
9
  private singleSelectorBounce;
@@ -9,7 +9,7 @@ export class Bouncer extends ExternalInteractorBase {
9
9
  return ((mouse.position && events.onHover.enable && isInArray("bounce" /* bounce */, events.onHover.mode)) ||
10
10
  isDivModeEnabled("bounce" /* bounce */, divs));
11
11
  }
12
- interact() {
12
+ async interact() {
13
13
  const container = this.container, options = container.actualOptions, events = options.interactivity.events, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, divs = events.onDiv;
14
14
  if (mouseMoveStatus && hoverEnabled && isInArray("bounce" /* bounce */, hoverMode)) {
15
15
  this.processMouseBounce();
@@ -9,7 +9,7 @@ export declare class Bubbler extends ExternalInteractorBase {
9
9
  constructor(container: Container);
10
10
  isEnabled(): boolean;
11
11
  reset(particle: Particle, force?: boolean): void;
12
- interact(): void;
12
+ interact(): Promise<void>;
13
13
  private singleSelectorHover;
14
14
  private process;
15
15
  private clickBubble;
@@ -36,7 +36,7 @@ export class Bubbler extends ExternalInteractorBase {
36
36
  delete particle.bubble.radius;
37
37
  delete particle.bubble.color;
38
38
  }
39
- interact() {
39
+ async interact() {
40
40
  const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
41
41
  /* on hover event */
42
42
  if (hoverEnabled && isInArray("bubble" /* bubble */, hoverMode)) {
@@ -11,5 +11,5 @@ export declare class Connector extends ExternalInteractorBase {
11
11
  /**
12
12
  * Connecting particles on hover interactivity
13
13
  */
14
- interact(): void;
14
+ interact(): Promise<void>;
15
15
  }
@@ -21,7 +21,7 @@ export class Connector extends ExternalInteractorBase {
21
21
  /**
22
22
  * Connecting particles on hover interactivity
23
23
  */
24
- interact() {
24
+ async interact() {
25
25
  const container = this.container, options = container.actualOptions;
26
26
  if (options.interactivity.events.onHover.enable && container.interactivity.status === "mousemove") {
27
27
  const mousePos = container.interactivity.mouse.position;
@@ -8,5 +8,5 @@ export declare class Grabber extends ExternalInteractorBase {
8
8
  constructor(container: Container);
9
9
  isEnabled(): boolean;
10
10
  reset(): void;
11
- interact(): void;
11
+ interact(): Promise<void>;
12
12
  }
@@ -15,7 +15,7 @@ export class Grabber extends ExternalInteractorBase {
15
15
  reset() {
16
16
  // do nothing
17
17
  }
18
- interact() {
18
+ async interact() {
19
19
  var _a;
20
20
  const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
21
21
  if (interactivity.events.onHover.enable && container.interactivity.status === Constants.mouseMoveEvent) {
@@ -8,7 +8,7 @@ export declare class Repulser extends ExternalInteractorBase {
8
8
  constructor(container: Container);
9
9
  isEnabled(): boolean;
10
10
  reset(): void;
11
- interact(): void;
11
+ interact(): Promise<void>;
12
12
  private singleSelectorRepulse;
13
13
  private hoverRepulse;
14
14
  private processRepulse;
@@ -19,7 +19,7 @@ export class Repulser extends ExternalInteractorBase {
19
19
  reset() {
20
20
  // do nothing
21
21
  }
22
- interact() {
22
+ async interact() {
23
23
  const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode, divs = events.onDiv;
24
24
  if (mouseMoveStatus && hoverEnabled && isInArray("repulse" /* repulse */, hoverMode)) {
25
25
  this.hoverRepulse();
@@ -7,7 +7,7 @@ export declare class TrailMaker extends ExternalInteractorBase {
7
7
  private delay;
8
8
  private lastPosition?;
9
9
  constructor(container: Container);
10
- interact(delta: IDelta): void;
10
+ interact(delta: IDelta): Promise<void>;
11
11
  isEnabled(): boolean;
12
12
  reset(): void;
13
13
  }
@@ -8,7 +8,7 @@ export class TrailMaker extends ExternalInteractorBase {
8
8
  super(container);
9
9
  this.delay = 0;
10
10
  }
11
- interact(delta) {
11
+ async interact(delta) {
12
12
  var _a, _b, _c, _d;
13
13
  if (!this.container.retina.reduceFactor) {
14
14
  return;
@@ -5,7 +5,7 @@ import { ParticlesInteractorBase } from "../../../Core";
5
5
  */
6
6
  export declare class Attractor extends ParticlesInteractorBase {
7
7
  constructor(container: Container);
8
- interact(p1: IParticle): void;
8
+ interact(p1: IParticle): Promise<void>;
9
9
  isEnabled(particle: Particle): boolean;
10
10
  reset(): void;
11
11
  }
@@ -7,7 +7,7 @@ export class Attractor extends ParticlesInteractorBase {
7
7
  constructor(container) {
8
8
  super(container);
9
9
  }
10
- interact(p1) {
10
+ async interact(p1) {
11
11
  var _a;
12
12
  const container = this.container, distance = (_a = p1.retina.attractDistance) !== null && _a !== void 0 ? _a : container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
13
13
  for (const p2 of query) {
@@ -7,7 +7,7 @@ export declare class Collider extends ParticlesInteractorBase {
7
7
  constructor(container: Container);
8
8
  isEnabled(particle: Particle): boolean;
9
9
  reset(): void;
10
- interact(p1: Particle): void;
10
+ interact(p1: Particle): Promise<void>;
11
11
  private resolveCollision;
12
12
  private absorb;
13
13
  }
@@ -35,7 +35,7 @@ export class Collider extends ParticlesInteractorBase {
35
35
  reset() {
36
36
  // do nothing
37
37
  }
38
- interact(p1) {
38
+ async interact(p1) {
39
39
  const container = this.container;
40
40
  const pos1 = p1.getPosition();
41
41
  const radius1 = p1.getRadius();
@@ -5,6 +5,6 @@ export declare class Linker extends ParticlesInteractorBase {
5
5
  constructor(container: Container);
6
6
  isEnabled(particle: Particle): boolean;
7
7
  reset(): void;
8
- interact(p1: LinkParticle): void;
8
+ interact(p1: LinkParticle): Promise<void>;
9
9
  private setColor;
10
10
  }
@@ -38,7 +38,7 @@ export class Linker extends ParticlesInteractorBase {
38
38
  reset() {
39
39
  // do nothing
40
40
  }
41
- interact(p1) {
41
+ async interact(p1) {
42
42
  var _a;
43
43
  p1.links = [];
44
44
  const pos1 = p1.getPosition();
@@ -37,7 +37,7 @@ export class PolygonMaskInstance {
37
37
  }
38
38
  this.redrawTimeout = window.setTimeout(async () => {
39
39
  await this.initRawData(true);
40
- container.particles.redraw();
40
+ await container.particles.redraw();
41
41
  }, 250);
42
42
  }
43
43
  stop() {
@@ -20,9 +20,9 @@ function updateOpacity(particle, delta) {
20
20
  }
21
21
  const minValue = particle.opacity.min;
22
22
  const maxValue = particle.opacity.max;
23
- if (!(!particle.destroyed &&
24
- particle.opacity.enable &&
25
- (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) < ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0)))) {
23
+ if (particle.destroyed ||
24
+ !particle.opacity.enable ||
25
+ (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) > 0 && ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) > ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0))) {
26
26
  return;
27
27
  }
28
28
  switch (particle.opacity.status) {
@@ -100,12 +100,14 @@ export class OpacityUpdater {
100
100
  }
101
101
  }
102
102
  isEnabled(particle) {
103
- var _a, _b, _c;
103
+ var _a, _b, _c, _d;
104
104
  return (!particle.destroyed &&
105
105
  !particle.spawning &&
106
106
  !!particle.opacity &&
107
107
  particle.opacity.enable &&
108
- (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) < ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0)));
108
+ (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 ||
109
+ (((_b = particle.opacity.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 &&
110
+ ((_c = particle.opacity.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.opacity.maxLoops) !== null && _d !== void 0 ? _d : 0))));
109
111
  }
110
112
  update(particle, delta) {
111
113
  if (!this.isEnabled(particle)) {
@@ -18,9 +18,9 @@ function updateSize(particle, delta) {
18
18
  const sizeVelocity = ((_a = particle.size.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor;
19
19
  const minValue = particle.size.min;
20
20
  const maxValue = particle.size.max;
21
- if (!(!particle.destroyed &&
22
- particle.size.enable &&
23
- (((_b = particle.size.loops) !== null && _b !== void 0 ? _b : 0) <= 0 || ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0)))) {
21
+ if (particle.destroyed ||
22
+ !particle.size.enable ||
23
+ (((_b = particle.size.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) > ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0))) {
24
24
  return;
25
25
  }
26
26
  switch (particle.size.status) {
@@ -58,11 +58,12 @@ export class SizeUpdater {
58
58
  // nothing
59
59
  }
60
60
  isEnabled(particle) {
61
- var _a, _b, _c;
61
+ var _a, _b, _c, _d;
62
62
  return (!particle.destroyed &&
63
63
  !particle.spawning &&
64
64
  particle.size.enable &&
65
- (((_a = particle.size.loops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.size.loops) !== null && _b !== void 0 ? _b : 0) < ((_c = particle.size.maxLoops) !== null && _c !== void 0 ? _c : 0)));
65
+ (((_a = particle.size.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 ||
66
+ (((_b = particle.size.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0))));
66
67
  }
67
68
  update(particle, delta) {
68
69
  if (!this.isEnabled(particle)) {
@@ -112,12 +112,12 @@ export class Container {
112
112
  }
113
113
  draw(force) {
114
114
  let refreshTime = force;
115
- this.drawAnimationFrame = animate()((timestamp) => {
115
+ this.drawAnimationFrame = animate()(async (timestamp) => {
116
116
  if (refreshTime) {
117
117
  this.lastFrameTime = undefined;
118
118
  refreshTime = false;
119
119
  }
120
- this.drawer.nextFrame(timestamp);
120
+ await this.drawer.nextFrame(timestamp);
121
121
  });
122
122
  }
123
123
  getAnimationStatus() {
@@ -2,5 +2,5 @@ import type { IDelta } from "./IDelta";
2
2
  import type { IInteractor } from "./IInteractor";
3
3
  export interface IExternalInteractor extends IInteractor {
4
4
  isEnabled(): boolean;
5
- interact(delta: IDelta): void;
5
+ interact(delta: IDelta): Promise<void>;
6
6
  }
@@ -3,5 +3,5 @@ import type { IInteractor } from "./IInteractor";
3
3
  import type { Particle } from "../Particle";
4
4
  export interface IParticlesInteractor extends IInteractor {
5
5
  isEnabled(particle: Particle): boolean;
6
- interact(particle: Particle, delta: IDelta): void;
6
+ interact(particle: Particle, delta: IDelta): Promise<void>;
7
7
  }
@@ -207,10 +207,10 @@ export class Particle {
207
207
  return (this.getRadius() ** 2 * Math.PI) / 2;
208
208
  }
209
209
  getFillColor() {
210
- var _a, _b, _c;
210
+ var _a, _b;
211
211
  const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
212
212
  if (color && this.roll && (this.backColor || this.roll.alter)) {
213
- const rolled = Math.floor(((_c = (_b = this.roll) === null || _b === void 0 ? void 0 : _b.angle) !== null && _c !== void 0 ? _c : 0) / (Math.PI / 2)) % 2;
213
+ const backFactor = this.options.roll.mode === "both" ? 2 : 1, backSum = this.options.roll.mode === "horizontal" ? Math.PI / 2 : 0, rolled = Math.floor((((_b = this.roll.angle) !== null && _b !== void 0 ? _b : 0) + backSum) / (Math.PI / backFactor)) % 2;
214
214
  if (rolled) {
215
215
  if (this.backColor) {
216
216
  return this.backColor;
@@ -26,11 +26,11 @@ export declare class Particles {
26
26
  private readonly mover;
27
27
  constructor(engine: Engine, container: Container);
28
28
  init(): void;
29
- redraw(): void;
29
+ redraw(): Promise<void>;
30
30
  removeAt(index: number, quantity?: number, group?: string, override?: boolean): void;
31
31
  remove(particle: Particle, group?: string, override?: boolean): void;
32
- update(delta: IDelta): void;
33
- draw(delta: IDelta): void;
32
+ update(delta: IDelta): Promise<void>;
33
+ draw(delta: IDelta): Promise<void>;
34
34
  clear(): void;
35
35
  push(nb: number, mouse?: IMouseData, overrideOptions?: RecursivePartial<IParticles>, group?: string): void;
36
36
  addParticle(position?: ICoordinates, overrideOptions?: RecursivePartial<IParticles>, group?: string): Particle | undefined;
@@ -72,10 +72,10 @@ export class Particles {
72
72
  }
73
73
  container.pathGenerator.init(container);
74
74
  }
75
- redraw() {
75
+ async redraw() {
76
76
  this.clear();
77
77
  this.init();
78
- this.draw({ value: 0, factor: 0 });
78
+ await this.draw({ value: 0, factor: 0 });
79
79
  }
80
80
  removeAt(index, quantity = 1, group, override) {
81
81
  if (!(index >= 0 && index <= this.count)) {
@@ -97,7 +97,7 @@ export class Particles {
97
97
  remove(particle, group, override) {
98
98
  this.removeAt(this.array.indexOf(particle), undefined, group, override);
99
99
  }
100
- update(delta) {
100
+ async update(delta) {
101
101
  const container = this.container;
102
102
  const particlesToDelete = [];
103
103
  container.pathGenerator.update();
@@ -131,23 +131,23 @@ export class Particles {
131
131
  for (const particle of particlesToDelete) {
132
132
  this.remove(particle);
133
133
  }
134
- this.interactionManager.externalInteract(delta);
134
+ await this.interactionManager.externalInteract(delta);
135
135
  for (const particle of container.particles.array) {
136
136
  for (const updater of this.updaters) {
137
137
  updater.update(particle, delta);
138
138
  }
139
139
  if (!particle.destroyed && !particle.spawning) {
140
- this.interactionManager.particlesInteract(particle, delta);
140
+ await this.interactionManager.particlesInteract(particle, delta);
141
141
  }
142
142
  }
143
143
  delete container.canvas.resizeFactor;
144
144
  }
145
- draw(delta) {
145
+ async draw(delta) {
146
146
  const container = this.container;
147
147
  container.canvas.clear();
148
148
  const canvasSize = this.container.canvas.size;
149
149
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, (canvasSize.width * 3) / 2, (canvasSize.height * 3) / 2), 4);
150
- this.update(delta);
150
+ await this.update(delta);
151
151
  if (this.needsSort) {
152
152
  this.zArray.sort((a, b) => b.position.z - a.position.z || a.id - b.id);
153
153
  this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
@@ -6,7 +6,7 @@ export declare abstract class ExternalInteractorBase implements IExternalInterac
6
6
  protected readonly container: Container;
7
7
  protected constructor(container: Container);
8
8
  type: InteractorType;
9
- abstract interact(delta: IDelta): void;
9
+ abstract interact(delta: IDelta): Promise<void>;
10
10
  abstract isEnabled(): boolean;
11
11
  abstract reset(particle: Particle): void;
12
12
  }
@@ -2,5 +2,5 @@ import type { Container } from "../Container";
2
2
  export declare class FrameManager {
3
3
  private readonly container;
4
4
  constructor(container: Container);
5
- nextFrame(timestamp: DOMHighResTimeStamp): void;
5
+ nextFrame(timestamp: DOMHighResTimeStamp): Promise<void>;
6
6
  }
@@ -2,7 +2,7 @@ export class FrameManager {
2
2
  constructor(container) {
3
3
  this.container = container;
4
4
  }
5
- nextFrame(timestamp) {
5
+ async nextFrame(timestamp) {
6
6
  var _a;
7
7
  try {
8
8
  const container = this.container;
@@ -23,7 +23,7 @@ export class FrameManager {
23
23
  container.draw(false);
24
24
  return;
25
25
  }
26
- container.particles.draw(delta);
26
+ await container.particles.draw(delta);
27
27
  if (container.duration > 0 && container.lifeTime > container.duration) {
28
28
  container.destroy();
29
29
  return;
@@ -9,6 +9,6 @@ export declare class InteractionManager {
9
9
  private particleInteractors;
10
10
  constructor(engine: Engine, container: Container);
11
11
  init(): void;
12
- externalInteract(delta: IDelta): void;
13
- particlesInteract(particle: Particle, delta: IDelta): void;
12
+ externalInteract(delta: IDelta): Promise<void>;
13
+ particlesInteract(particle: Particle, delta: IDelta): Promise<void>;
14
14
  }
@@ -34,20 +34,20 @@ export class InteractionManager {
34
34
  }
35
35
  }
36
36
  }
37
- externalInteract(delta) {
37
+ async externalInteract(delta) {
38
38
  for (const interactor of this.externalInteractors) {
39
39
  if (interactor.isEnabled()) {
40
- interactor.interact(delta);
40
+ await interactor.interact(delta);
41
41
  }
42
42
  }
43
43
  }
44
- particlesInteract(particle, delta) {
44
+ async particlesInteract(particle, delta) {
45
45
  for (const interactor of this.externalInteractors) {
46
46
  interactor.reset(particle);
47
47
  }
48
48
  for (const interactor of this.particleInteractors) {
49
49
  if (interactor.isEnabled(particle)) {
50
- interactor.interact(particle, delta);
50
+ await interactor.interact(particle, delta);
51
51
  }
52
52
  }
53
53
  }
@@ -6,7 +6,7 @@ export declare abstract class ParticlesInteractorBase implements IParticlesInter
6
6
  protected readonly container: Container;
7
7
  protected constructor(container: Container);
8
8
  type: InteractorType;
9
- abstract interact(particle: Particle, delta: IDelta): void;
9
+ abstract interact(particle: Particle, delta: IDelta): Promise<void>;
10
10
  abstract isEnabled(particle: Particle): boolean;
11
11
  abstract reset(particle: Particle): void;
12
12
  }
@@ -4,7 +4,7 @@ export declare class Attractor extends ExternalInteractorBase {
4
4
  constructor(container: Container);
5
5
  isEnabled(): boolean;
6
6
  reset(): void;
7
- interact(): void;
7
+ interact(): Promise<void>;
8
8
  private hoverAttract;
9
9
  private processAttract;
10
10
  private clickAttract;
@@ -14,7 +14,7 @@ export class Attractor extends ExternalInteractorBase {
14
14
  }
15
15
  reset() {
16
16
  }
17
- interact() {
17
+ async interact() {
18
18
  const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode;
19
19
  if (mouseMoveStatus && hoverEnabled && isInArray("attract", hoverMode)) {
20
20
  this.hoverAttract();
@@ -3,7 +3,7 @@ import type { Container } from "../../../Core";
3
3
  export declare class Bouncer extends ExternalInteractorBase {
4
4
  constructor(container: Container);
5
5
  isEnabled(): boolean;
6
- interact(): void;
6
+ interact(): Promise<void>;
7
7
  reset(): void;
8
8
  private processMouseBounce;
9
9
  private singleSelectorBounce;
@@ -9,7 +9,7 @@ export class Bouncer extends ExternalInteractorBase {
9
9
  return ((mouse.position && events.onHover.enable && isInArray("bounce", events.onHover.mode)) ||
10
10
  isDivModeEnabled("bounce", divs));
11
11
  }
12
- interact() {
12
+ async interact() {
13
13
  const container = this.container, options = container.actualOptions, events = options.interactivity.events, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, divs = events.onDiv;
14
14
  if (mouseMoveStatus && hoverEnabled && isInArray("bounce", hoverMode)) {
15
15
  this.processMouseBounce();
@@ -5,7 +5,7 @@ export declare class Bubbler extends ExternalInteractorBase {
5
5
  constructor(container: Container);
6
6
  isEnabled(): boolean;
7
7
  reset(particle: Particle, force?: boolean): void;
8
- interact(): void;
8
+ interact(): Promise<void>;
9
9
  private singleSelectorHover;
10
10
  private process;
11
11
  private clickBubble;
@@ -32,7 +32,7 @@ export class Bubbler extends ExternalInteractorBase {
32
32
  delete particle.bubble.radius;
33
33
  delete particle.bubble.color;
34
34
  }
35
- interact() {
35
+ async interact() {
36
36
  const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
37
37
  if (hoverEnabled && isInArray("bubble", hoverMode)) {
38
38
  this.hoverBubble();
@@ -4,5 +4,5 @@ export declare class Connector extends ExternalInteractorBase {
4
4
  constructor(container: Container);
5
5
  isEnabled(): boolean;
6
6
  reset(): void;
7
- interact(): void;
7
+ interact(): Promise<void>;
8
8
  }
@@ -13,7 +13,7 @@ export class Connector extends ExternalInteractorBase {
13
13
  }
14
14
  reset() {
15
15
  }
16
- interact() {
16
+ async interact() {
17
17
  const container = this.container, options = container.actualOptions;
18
18
  if (options.interactivity.events.onHover.enable && container.interactivity.status === "mousemove") {
19
19
  const mousePos = container.interactivity.mouse.position;
@@ -4,5 +4,5 @@ export declare class Grabber extends ExternalInteractorBase {
4
4
  constructor(container: Container);
5
5
  isEnabled(): boolean;
6
6
  reset(): void;
7
- interact(): void;
7
+ interact(): Promise<void>;
8
8
  }
@@ -10,7 +10,7 @@ export class Grabber extends ExternalInteractorBase {
10
10
  }
11
11
  reset() {
12
12
  }
13
- interact() {
13
+ async interact() {
14
14
  var _a;
15
15
  const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
16
16
  if (interactivity.events.onHover.enable && container.interactivity.status === Constants.mouseMoveEvent) {
@@ -4,7 +4,7 @@ export declare class Repulser extends ExternalInteractorBase {
4
4
  constructor(container: Container);
5
5
  isEnabled(): boolean;
6
6
  reset(): void;
7
- interact(): void;
7
+ interact(): Promise<void>;
8
8
  private singleSelectorRepulse;
9
9
  private hoverRepulse;
10
10
  private processRepulse;
@@ -14,7 +14,7 @@ export class Repulser extends ExternalInteractorBase {
14
14
  }
15
15
  reset() {
16
16
  }
17
- interact() {
17
+ async interact() {
18
18
  const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode, divs = events.onDiv;
19
19
  if (mouseMoveStatus && hoverEnabled && isInArray("repulse", hoverMode)) {
20
20
  this.hoverRepulse();