@tsparticles/interaction-particles-collisions 4.1.3 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { double, getDistance } from "@tsparticles/engine";
1
+ import { double, getDistance, loadOptionProperty, } from "@tsparticles/engine";
2
2
  import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
3
3
  import { Collisions } from "./Options/Classes/Collisions.js";
4
4
  import { resolveCollision } from "./ResolveCollision.js";
@@ -42,10 +42,7 @@ export class Collider extends ParticlesInteractorBase {
42
42
  return !!particle.options.collisions?.enable;
43
43
  }
44
44
  loadParticlesOptions(options, ...sources) {
45
- options.collisions ??= new Collisions();
46
- for (const source of sources) {
47
- options.collisions.load(source?.collisions);
48
- }
45
+ loadOptionProperty(options, "collisions", Collisions, ...sources);
49
46
  }
50
47
  reset() {
51
48
  }
@@ -1,37 +1,23 @@
1
- import { ParticlesBounce, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { ParticlesBounce, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { CollisionMode } from "../../CollisionMode.js";
3
3
  import { CollisionsAbsorb } from "./CollisionsAbsorb.js";
4
4
  import { CollisionsOverlap } from "./CollisionsOverlap.js";
5
5
  export class Collisions {
6
- absorb;
7
- bounce;
8
- enable;
9
- maxSpeed;
10
- mode;
11
- overlap;
12
- constructor() {
13
- this.absorb = new CollisionsAbsorb();
14
- this.bounce = new ParticlesBounce();
15
- this.enable = false;
16
- this.maxSpeed = 50;
17
- this.mode = CollisionMode.bounce;
18
- this.overlap = new CollisionsOverlap();
19
- }
6
+ absorb = new CollisionsAbsorb();
7
+ bounce = new ParticlesBounce();
8
+ enable = false;
9
+ maxSpeed = 50;
10
+ mode = CollisionMode.bounce;
11
+ overlap = new CollisionsOverlap();
20
12
  load(data) {
21
13
  if (isNull(data)) {
22
14
  return;
23
15
  }
24
16
  this.absorb.load(data.absorb);
25
17
  this.bounce.load(data.bounce);
26
- if (data.enable !== undefined) {
27
- this.enable = data.enable;
28
- }
29
- if (data.maxSpeed !== undefined) {
30
- this.maxSpeed = setRangeValue(data.maxSpeed);
31
- }
32
- if (data.mode !== undefined) {
33
- this.mode = data.mode;
34
- }
18
+ loadProperty(this, "enable", data.enable);
19
+ loadRangeProperty(this, "maxSpeed", data.maxSpeed);
20
+ loadProperty(this, "mode", data.mode);
35
21
  this.overlap.load(data.overlap);
36
22
  }
37
23
  }
@@ -1,15 +1,10 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class CollisionsAbsorb {
3
- speed;
4
- constructor() {
5
- this.speed = 2;
6
- }
3
+ speed = 2;
7
4
  load(data) {
8
5
  if (isNull(data)) {
9
6
  return;
10
7
  }
11
- if (data.speed !== undefined) {
12
- this.speed = data.speed;
13
- }
8
+ loadProperty(this, "speed", data.speed);
14
9
  }
15
10
  }
@@ -1,20 +1,12 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class CollisionsOverlap {
3
- enable;
4
- retries;
5
- constructor() {
6
- this.enable = true;
7
- this.retries = 0;
8
- }
3
+ enable = true;
4
+ retries = 0;
9
5
  load(data) {
10
6
  if (isNull(data)) {
11
7
  return;
12
8
  }
13
- if (data.enable !== undefined) {
14
- this.enable = data.enable;
15
- }
16
- if (data.retries !== undefined) {
17
- this.retries = data.retries;
18
- }
9
+ loadProperty(this, "enable", data.enable);
10
+ loadProperty(this, "retries", data.retries);
19
11
  }
20
12
  }
@@ -8,7 +8,7 @@ export class OverlapPluginInstance {
8
8
  checkParticlePosition(particle, position, tryCount) {
9
9
  return !this.#hasOverlaps(particle, position, tryCount);
10
10
  }
11
- #hasOverlaps = (particle, pos, tryCount) => {
11
+ #hasOverlaps(particle, pos, tryCount) {
12
12
  const collisionsOptions = particle.options.collisions;
13
13
  if (!collisionsOptions?.enable) {
14
14
  return false;
@@ -22,5 +22,5 @@ export class OverlapPluginInstance {
22
22
  throw new Error(`Particle is overlapping and can't be placed`);
23
23
  }
24
24
  return !!this.#container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
25
- };
25
+ }
26
26
  }
package/browser/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { Collider } from "./Collider.js";
3
3
  import { OverlapPlugin } from "./OverlapPlugin.js";
4
4
  export async function loadParticlesCollisionsInteraction(engine) {
5
- engine.checkVersion("4.1.3");
5
+ engine.checkVersion("4.2.1");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new OverlapPlugin());
@@ -1,5 +1,5 @@
1
1
  export async function loadParticlesCollisionsInteraction(engine) {
2
- engine.checkVersion("4.1.3");
2
+ engine.checkVersion("4.2.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { OverlapPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/cjs/Collider.js CHANGED
@@ -1,4 +1,4 @@
1
- import { double, getDistance } from "@tsparticles/engine";
1
+ import { double, getDistance, loadOptionProperty, } from "@tsparticles/engine";
2
2
  import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
3
3
  import { Collisions } from "./Options/Classes/Collisions.js";
4
4
  import { resolveCollision } from "./ResolveCollision.js";
@@ -42,10 +42,7 @@ export class Collider extends ParticlesInteractorBase {
42
42
  return !!particle.options.collisions?.enable;
43
43
  }
44
44
  loadParticlesOptions(options, ...sources) {
45
- options.collisions ??= new Collisions();
46
- for (const source of sources) {
47
- options.collisions.load(source?.collisions);
48
- }
45
+ loadOptionProperty(options, "collisions", Collisions, ...sources);
49
46
  }
50
47
  reset() {
51
48
  }
@@ -1,37 +1,23 @@
1
- import { ParticlesBounce, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { ParticlesBounce, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { CollisionMode } from "../../CollisionMode.js";
3
3
  import { CollisionsAbsorb } from "./CollisionsAbsorb.js";
4
4
  import { CollisionsOverlap } from "./CollisionsOverlap.js";
5
5
  export class Collisions {
6
- absorb;
7
- bounce;
8
- enable;
9
- maxSpeed;
10
- mode;
11
- overlap;
12
- constructor() {
13
- this.absorb = new CollisionsAbsorb();
14
- this.bounce = new ParticlesBounce();
15
- this.enable = false;
16
- this.maxSpeed = 50;
17
- this.mode = CollisionMode.bounce;
18
- this.overlap = new CollisionsOverlap();
19
- }
6
+ absorb = new CollisionsAbsorb();
7
+ bounce = new ParticlesBounce();
8
+ enable = false;
9
+ maxSpeed = 50;
10
+ mode = CollisionMode.bounce;
11
+ overlap = new CollisionsOverlap();
20
12
  load(data) {
21
13
  if (isNull(data)) {
22
14
  return;
23
15
  }
24
16
  this.absorb.load(data.absorb);
25
17
  this.bounce.load(data.bounce);
26
- if (data.enable !== undefined) {
27
- this.enable = data.enable;
28
- }
29
- if (data.maxSpeed !== undefined) {
30
- this.maxSpeed = setRangeValue(data.maxSpeed);
31
- }
32
- if (data.mode !== undefined) {
33
- this.mode = data.mode;
34
- }
18
+ loadProperty(this, "enable", data.enable);
19
+ loadRangeProperty(this, "maxSpeed", data.maxSpeed);
20
+ loadProperty(this, "mode", data.mode);
35
21
  this.overlap.load(data.overlap);
36
22
  }
37
23
  }
@@ -1,15 +1,10 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class CollisionsAbsorb {
3
- speed;
4
- constructor() {
5
- this.speed = 2;
6
- }
3
+ speed = 2;
7
4
  load(data) {
8
5
  if (isNull(data)) {
9
6
  return;
10
7
  }
11
- if (data.speed !== undefined) {
12
- this.speed = data.speed;
13
- }
8
+ loadProperty(this, "speed", data.speed);
14
9
  }
15
10
  }
@@ -1,20 +1,12 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class CollisionsOverlap {
3
- enable;
4
- retries;
5
- constructor() {
6
- this.enable = true;
7
- this.retries = 0;
8
- }
3
+ enable = true;
4
+ retries = 0;
9
5
  load(data) {
10
6
  if (isNull(data)) {
11
7
  return;
12
8
  }
13
- if (data.enable !== undefined) {
14
- this.enable = data.enable;
15
- }
16
- if (data.retries !== undefined) {
17
- this.retries = data.retries;
18
- }
9
+ loadProperty(this, "enable", data.enable);
10
+ loadProperty(this, "retries", data.retries);
19
11
  }
20
12
  }
@@ -8,7 +8,7 @@ export class OverlapPluginInstance {
8
8
  checkParticlePosition(particle, position, tryCount) {
9
9
  return !this.#hasOverlaps(particle, position, tryCount);
10
10
  }
11
- #hasOverlaps = (particle, pos, tryCount) => {
11
+ #hasOverlaps(particle, pos, tryCount) {
12
12
  const collisionsOptions = particle.options.collisions;
13
13
  if (!collisionsOptions?.enable) {
14
14
  return false;
@@ -22,5 +22,5 @@ export class OverlapPluginInstance {
22
22
  throw new Error(`Particle is overlapping and can't be placed`);
23
23
  }
24
24
  return !!this.#container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
25
- };
25
+ }
26
26
  }
package/cjs/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { Collider } from "./Collider.js";
3
3
  import { OverlapPlugin } from "./OverlapPlugin.js";
4
4
  export async function loadParticlesCollisionsInteraction(engine) {
5
- engine.checkVersion("4.1.3");
5
+ engine.checkVersion("4.2.1");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new OverlapPlugin());
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadParticlesCollisionsInteraction(engine) {
2
- engine.checkVersion("4.1.3");
2
+ engine.checkVersion("4.2.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { OverlapPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/esm/Collider.js CHANGED
@@ -1,4 +1,4 @@
1
- import { double, getDistance } from "@tsparticles/engine";
1
+ import { double, getDistance, loadOptionProperty, } from "@tsparticles/engine";
2
2
  import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
3
3
  import { Collisions } from "./Options/Classes/Collisions.js";
4
4
  import { resolveCollision } from "./ResolveCollision.js";
@@ -42,10 +42,7 @@ export class Collider extends ParticlesInteractorBase {
42
42
  return !!particle.options.collisions?.enable;
43
43
  }
44
44
  loadParticlesOptions(options, ...sources) {
45
- options.collisions ??= new Collisions();
46
- for (const source of sources) {
47
- options.collisions.load(source?.collisions);
48
- }
45
+ loadOptionProperty(options, "collisions", Collisions, ...sources);
49
46
  }
50
47
  reset() {
51
48
  }
@@ -1,37 +1,23 @@
1
- import { ParticlesBounce, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { ParticlesBounce, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { CollisionMode } from "../../CollisionMode.js";
3
3
  import { CollisionsAbsorb } from "./CollisionsAbsorb.js";
4
4
  import { CollisionsOverlap } from "./CollisionsOverlap.js";
5
5
  export class Collisions {
6
- absorb;
7
- bounce;
8
- enable;
9
- maxSpeed;
10
- mode;
11
- overlap;
12
- constructor() {
13
- this.absorb = new CollisionsAbsorb();
14
- this.bounce = new ParticlesBounce();
15
- this.enable = false;
16
- this.maxSpeed = 50;
17
- this.mode = CollisionMode.bounce;
18
- this.overlap = new CollisionsOverlap();
19
- }
6
+ absorb = new CollisionsAbsorb();
7
+ bounce = new ParticlesBounce();
8
+ enable = false;
9
+ maxSpeed = 50;
10
+ mode = CollisionMode.bounce;
11
+ overlap = new CollisionsOverlap();
20
12
  load(data) {
21
13
  if (isNull(data)) {
22
14
  return;
23
15
  }
24
16
  this.absorb.load(data.absorb);
25
17
  this.bounce.load(data.bounce);
26
- if (data.enable !== undefined) {
27
- this.enable = data.enable;
28
- }
29
- if (data.maxSpeed !== undefined) {
30
- this.maxSpeed = setRangeValue(data.maxSpeed);
31
- }
32
- if (data.mode !== undefined) {
33
- this.mode = data.mode;
34
- }
18
+ loadProperty(this, "enable", data.enable);
19
+ loadRangeProperty(this, "maxSpeed", data.maxSpeed);
20
+ loadProperty(this, "mode", data.mode);
35
21
  this.overlap.load(data.overlap);
36
22
  }
37
23
  }
@@ -1,15 +1,10 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class CollisionsAbsorb {
3
- speed;
4
- constructor() {
5
- this.speed = 2;
6
- }
3
+ speed = 2;
7
4
  load(data) {
8
5
  if (isNull(data)) {
9
6
  return;
10
7
  }
11
- if (data.speed !== undefined) {
12
- this.speed = data.speed;
13
- }
8
+ loadProperty(this, "speed", data.speed);
14
9
  }
15
10
  }
@@ -1,20 +1,12 @@
1
- import { isNull } from "@tsparticles/engine";
1
+ import { isNull, loadProperty } from "@tsparticles/engine";
2
2
  export class CollisionsOverlap {
3
- enable;
4
- retries;
5
- constructor() {
6
- this.enable = true;
7
- this.retries = 0;
8
- }
3
+ enable = true;
4
+ retries = 0;
9
5
  load(data) {
10
6
  if (isNull(data)) {
11
7
  return;
12
8
  }
13
- if (data.enable !== undefined) {
14
- this.enable = data.enable;
15
- }
16
- if (data.retries !== undefined) {
17
- this.retries = data.retries;
18
- }
9
+ loadProperty(this, "enable", data.enable);
10
+ loadProperty(this, "retries", data.retries);
19
11
  }
20
12
  }
@@ -8,7 +8,7 @@ export class OverlapPluginInstance {
8
8
  checkParticlePosition(particle, position, tryCount) {
9
9
  return !this.#hasOverlaps(particle, position, tryCount);
10
10
  }
11
- #hasOverlaps = (particle, pos, tryCount) => {
11
+ #hasOverlaps(particle, pos, tryCount) {
12
12
  const collisionsOptions = particle.options.collisions;
13
13
  if (!collisionsOptions?.enable) {
14
14
  return false;
@@ -22,5 +22,5 @@ export class OverlapPluginInstance {
22
22
  throw new Error(`Particle is overlapping and can't be placed`);
23
23
  }
24
24
  return !!this.#container.particles.find(p => getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
25
- };
25
+ }
26
26
  }
package/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
2
2
  import { Collider } from "./Collider.js";
3
3
  import { OverlapPlugin } from "./OverlapPlugin.js";
4
4
  export async function loadParticlesCollisionsInteraction(engine) {
5
- engine.checkVersion("4.1.3");
5
+ engine.checkVersion("4.2.1");
6
6
  await engine.pluginManager.register((e) => {
7
7
  ensureInteractivityPluginLoaded(e);
8
8
  e.pluginManager.addPlugin(new OverlapPlugin());
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadParticlesCollisionsInteraction(engine) {
2
- engine.checkVersion("4.1.3");
2
+ engine.checkVersion("4.2.1");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ ensureInteractivityPluginLoaded }, { OverlapPlugin },] = await Promise.all([
5
5
  import("@tsparticles/plugin-interactivity/lazy"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-particles-collisions",
3
- "version": "4.1.3",
3
+ "version": "4.2.1",
4
4
  "description": "tsParticles collisions particles interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "type": "module",
99
99
  "peerDependencies": {
100
- "@tsparticles/engine": "4.1.3",
101
- "@tsparticles/plugin-interactivity": "4.1.3"
100
+ "@tsparticles/engine": "4.2.1",
101
+ "@tsparticles/plugin-interactivity": "4.2.1"
102
102
  }
103
103
  }
package/report.html CHANGED
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
4930
4930
  </script>
4931
4931
  <script>
4932
4932
  /*<!--*/
4933
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.particles.collisions.js","children":[{"name":"dist/browser","children":[{"uid":"b45da39a-1","name":"CollisionMode.js"},{"name":"Options/Classes","children":[{"uid":"b45da39a-3","name":"CollisionsAbsorb.js"},{"uid":"b45da39a-5","name":"CollisionsOverlap.js"},{"uid":"b45da39a-7","name":"Collisions.js"}]},{"uid":"b45da39a-9","name":"Absorb.js"},{"uid":"b45da39a-11","name":"Bounce.js"},{"uid":"b45da39a-13","name":"Destroy.js"},{"uid":"b45da39a-15","name":"ResolveCollision.js"},{"uid":"b45da39a-17","name":"Collider.js"},{"uid":"b45da39a-19","name":"OverlapPlugin.js"},{"uid":"b45da39a-21","name":"index.js"},{"uid":"b45da39a-23","name":"browser.js"},{"uid":"b45da39a-25","name":"OverlapPluginInstance.js"}]}]}],"isRoot":true},"nodeParts":{"b45da39a-1":{"renderedLength":235,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-0"},"b45da39a-3":{"renderedLength":318,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-2"},"b45da39a-5":{"renderedLength":479,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-4"},"b45da39a-7":{"renderedLength":995,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-6"},"b45da39a-9":{"renderedLength":1040,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-8"},"b45da39a-11":{"renderedLength":1351,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-10"},"b45da39a-13":{"renderedLength":497,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-12"},"b45da39a-15":{"renderedLength":565,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-14"},"b45da39a-17":{"renderedLength":1835,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-16"},"b45da39a-19":{"renderedLength":377,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-18"},"b45da39a-21":{"renderedLength":463,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-20"},"b45da39a-23":{"renderedLength":211,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-22"},"b45da39a-25":{"renderedLength":1022,"gzipLength":0,"brotliLength":0,"metaUid":"b45da39a-24"}},"nodeMetas":{"b45da39a-0":{"id":"/dist/browser/CollisionMode.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-1"},"imported":[],"importedBy":[{"uid":"b45da39a-6"},{"uid":"b45da39a-14"}]},"b45da39a-2":{"id":"/dist/browser/Options/Classes/CollisionsAbsorb.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-3"},"imported":[{"uid":"b45da39a-27"}],"importedBy":[{"uid":"b45da39a-6"}]},"b45da39a-4":{"id":"/dist/browser/Options/Classes/CollisionsOverlap.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-5"},"imported":[{"uid":"b45da39a-27"}],"importedBy":[{"uid":"b45da39a-6"}]},"b45da39a-6":{"id":"/dist/browser/Options/Classes/Collisions.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-7"},"imported":[{"uid":"b45da39a-27"},{"uid":"b45da39a-0"},{"uid":"b45da39a-2"},{"uid":"b45da39a-4"}],"importedBy":[{"uid":"b45da39a-16"}]},"b45da39a-8":{"id":"/dist/browser/Absorb.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-9"},"imported":[{"uid":"b45da39a-27"}],"importedBy":[{"uid":"b45da39a-14"}]},"b45da39a-10":{"id":"/dist/browser/Bounce.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-11"},"imported":[{"uid":"b45da39a-27"}],"importedBy":[{"uid":"b45da39a-14"},{"uid":"b45da39a-12"}]},"b45da39a-12":{"id":"/dist/browser/Destroy.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-13"},"imported":[{"uid":"b45da39a-10"}],"importedBy":[{"uid":"b45da39a-14"}]},"b45da39a-14":{"id":"/dist/browser/ResolveCollision.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-15"},"imported":[{"uid":"b45da39a-0"},{"uid":"b45da39a-8"},{"uid":"b45da39a-10"},{"uid":"b45da39a-12"}],"importedBy":[{"uid":"b45da39a-16"}]},"b45da39a-16":{"id":"/dist/browser/Collider.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-17"},"imported":[{"uid":"b45da39a-27"},{"uid":"b45da39a-26"},{"uid":"b45da39a-6"},{"uid":"b45da39a-14"}],"importedBy":[{"uid":"b45da39a-20"}]},"b45da39a-18":{"id":"/dist/browser/OverlapPlugin.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-19"},"imported":[{"uid":"b45da39a-24","dynamic":true}],"importedBy":[{"uid":"b45da39a-20"}]},"b45da39a-20":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-21"},"imported":[{"uid":"b45da39a-26"},{"uid":"b45da39a-16"},{"uid":"b45da39a-18"}],"importedBy":[{"uid":"b45da39a-22"}]},"b45da39a-22":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-23"},"imported":[{"uid":"b45da39a-20"}],"importedBy":[],"isEntry":true},"b45da39a-24":{"id":"/dist/browser/OverlapPluginInstance.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"b45da39a-25"},"imported":[{"uid":"b45da39a-27"}],"importedBy":[{"uid":"b45da39a-18"}]},"b45da39a-26":{"id":"@tsparticles/plugin-interactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"b45da39a-20"},{"uid":"b45da39a-16"}],"isExternal":true},"b45da39a-27":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"b45da39a-16"},{"uid":"b45da39a-6"},{"uid":"b45da39a-24"},{"uid":"b45da39a-2"},{"uid":"b45da39a-4"},{"uid":"b45da39a-8"},{"uid":"b45da39a-10"}],"isExternal":true}},"env":{"rollup":"4.60.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4933
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.particles.collisions.js","children":[{"name":"dist/browser","children":[{"uid":"050975cd-1","name":"CollisionMode.js"},{"name":"Options/Classes","children":[{"uid":"050975cd-3","name":"CollisionsAbsorb.js"},{"uid":"050975cd-5","name":"CollisionsOverlap.js"},{"uid":"050975cd-7","name":"Collisions.js"}]},{"uid":"050975cd-9","name":"Absorb.js"},{"uid":"050975cd-11","name":"Bounce.js"},{"uid":"050975cd-13","name":"Destroy.js"},{"uid":"050975cd-15","name":"ResolveCollision.js"},{"uid":"050975cd-17","name":"Collider.js"},{"uid":"050975cd-19","name":"OverlapPlugin.js"},{"uid":"050975cd-21","name":"index.js"},{"uid":"050975cd-23","name":"browser.js"},{"uid":"050975cd-25","name":"OverlapPluginInstance.js"}]}]}],"isRoot":true},"nodeParts":{"050975cd-1":{"renderedLength":235,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-0"},"050975cd-3":{"renderedLength":221,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-2"},"050975cd-5":{"renderedLength":313,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-4"},"050975cd-7":{"renderedLength":673,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-6"},"050975cd-9":{"renderedLength":1040,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-8"},"050975cd-11":{"renderedLength":1351,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-10"},"050975cd-13":{"renderedLength":497,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-12"},"050975cd-15":{"renderedLength":565,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-14"},"050975cd-17":{"renderedLength":1749,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-16"},"050975cd-19":{"renderedLength":377,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-18"},"050975cd-21":{"renderedLength":463,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-20"},"050975cd-23":{"renderedLength":211,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-22"},"050975cd-25":{"renderedLength":1015,"gzipLength":0,"brotliLength":0,"metaUid":"050975cd-24"}},"nodeMetas":{"050975cd-0":{"id":"/dist/browser/CollisionMode.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-1"},"imported":[],"importedBy":[{"uid":"050975cd-6"},{"uid":"050975cd-14"}]},"050975cd-2":{"id":"/dist/browser/Options/Classes/CollisionsAbsorb.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-3"},"imported":[{"uid":"050975cd-27"}],"importedBy":[{"uid":"050975cd-6"}]},"050975cd-4":{"id":"/dist/browser/Options/Classes/CollisionsOverlap.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-5"},"imported":[{"uid":"050975cd-27"}],"importedBy":[{"uid":"050975cd-6"}]},"050975cd-6":{"id":"/dist/browser/Options/Classes/Collisions.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-7"},"imported":[{"uid":"050975cd-27"},{"uid":"050975cd-0"},{"uid":"050975cd-2"},{"uid":"050975cd-4"}],"importedBy":[{"uid":"050975cd-16"}]},"050975cd-8":{"id":"/dist/browser/Absorb.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-9"},"imported":[{"uid":"050975cd-27"}],"importedBy":[{"uid":"050975cd-14"}]},"050975cd-10":{"id":"/dist/browser/Bounce.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-11"},"imported":[{"uid":"050975cd-27"}],"importedBy":[{"uid":"050975cd-14"},{"uid":"050975cd-12"}]},"050975cd-12":{"id":"/dist/browser/Destroy.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-13"},"imported":[{"uid":"050975cd-10"}],"importedBy":[{"uid":"050975cd-14"}]},"050975cd-14":{"id":"/dist/browser/ResolveCollision.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-15"},"imported":[{"uid":"050975cd-0"},{"uid":"050975cd-8"},{"uid":"050975cd-10"},{"uid":"050975cd-12"}],"importedBy":[{"uid":"050975cd-16"}]},"050975cd-16":{"id":"/dist/browser/Collider.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-17"},"imported":[{"uid":"050975cd-27"},{"uid":"050975cd-26"},{"uid":"050975cd-6"},{"uid":"050975cd-14"}],"importedBy":[{"uid":"050975cd-20"}]},"050975cd-18":{"id":"/dist/browser/OverlapPlugin.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-19"},"imported":[{"uid":"050975cd-24","dynamic":true}],"importedBy":[{"uid":"050975cd-20"}]},"050975cd-20":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-21"},"imported":[{"uid":"050975cd-26"},{"uid":"050975cd-16"},{"uid":"050975cd-18"}],"importedBy":[{"uid":"050975cd-22"}]},"050975cd-22":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-23"},"imported":[{"uid":"050975cd-20"}],"importedBy":[],"isEntry":true},"050975cd-24":{"id":"/dist/browser/OverlapPluginInstance.js","moduleParts":{"tsparticles.interaction.particles.collisions.js":"050975cd-25"},"imported":[{"uid":"050975cd-27"}],"importedBy":[{"uid":"050975cd-18"}]},"050975cd-26":{"id":"@tsparticles/plugin-interactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"050975cd-20"},{"uid":"050975cd-16"}],"isExternal":true},"050975cd-27":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"050975cd-16"},{"uid":"050975cd-6"},{"uid":"050975cd-24"},{"uid":"050975cd-2"},{"uid":"050975cd-4"},{"uid":"050975cd-8"},{"uid":"050975cd-10"}],"isExternal":true}},"env":{"rollup":"4.62.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4934
4934
 
4935
4935
  const run = () => {
4936
4936
  const width = window.innerWidth;
@@ -1,5 +1,5 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Particles Interaction v4.1.3 */
2
+ /* Particles Interaction v4.2.1 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
@@ -14,70 +14,43 @@
14
14
  })(CollisionMode || (CollisionMode = {}));
15
15
 
16
16
  class CollisionsAbsorb {
17
- speed;
18
- constructor() {
19
- this.speed = 2;
20
- }
17
+ speed = 2;
21
18
  load(data) {
22
19
  if (engine.isNull(data)) {
23
20
  return;
24
21
  }
25
- if (data.speed !== undefined) {
26
- this.speed = data.speed;
27
- }
22
+ engine.loadProperty(this, "speed", data.speed);
28
23
  }
29
24
  }
30
25
 
31
26
  class CollisionsOverlap {
32
- enable;
33
- retries;
34
- constructor() {
35
- this.enable = true;
36
- this.retries = 0;
37
- }
27
+ enable = true;
28
+ retries = 0;
38
29
  load(data) {
39
30
  if (engine.isNull(data)) {
40
31
  return;
41
32
  }
42
- if (data.enable !== undefined) {
43
- this.enable = data.enable;
44
- }
45
- if (data.retries !== undefined) {
46
- this.retries = data.retries;
47
- }
33
+ engine.loadProperty(this, "enable", data.enable);
34
+ engine.loadProperty(this, "retries", data.retries);
48
35
  }
49
36
  }
50
37
 
51
38
  class Collisions {
52
- absorb;
53
- bounce;
54
- enable;
55
- maxSpeed;
56
- mode;
57
- overlap;
58
- constructor() {
59
- this.absorb = new CollisionsAbsorb();
60
- this.bounce = new engine.ParticlesBounce();
61
- this.enable = false;
62
- this.maxSpeed = 50;
63
- this.mode = CollisionMode.bounce;
64
- this.overlap = new CollisionsOverlap();
65
- }
39
+ absorb = new CollisionsAbsorb();
40
+ bounce = new engine.ParticlesBounce();
41
+ enable = false;
42
+ maxSpeed = 50;
43
+ mode = CollisionMode.bounce;
44
+ overlap = new CollisionsOverlap();
66
45
  load(data) {
67
46
  if (engine.isNull(data)) {
68
47
  return;
69
48
  }
70
49
  this.absorb.load(data.absorb);
71
50
  this.bounce.load(data.bounce);
72
- if (data.enable !== undefined) {
73
- this.enable = data.enable;
74
- }
75
- if (data.maxSpeed !== undefined) {
76
- this.maxSpeed = engine.setRangeValue(data.maxSpeed);
77
- }
78
- if (data.mode !== undefined) {
79
- this.mode = data.mode;
80
- }
51
+ engine.loadProperty(this, "enable", data.enable);
52
+ engine.loadRangeProperty(this, "maxSpeed", data.maxSpeed);
53
+ engine.loadProperty(this, "mode", data.mode);
81
54
  this.overlap.load(data.overlap);
82
55
  }
83
56
  }
@@ -214,10 +187,7 @@
214
187
  return !!particle.options.collisions?.enable;
215
188
  }
216
189
  loadParticlesOptions(options, ...sources) {
217
- options.collisions ??= new Collisions();
218
- for (const source of sources) {
219
- options.collisions.load(source?.collisions);
220
- }
190
+ engine.loadOptionProperty(options, "collisions", Collisions, ...sources);
221
191
  }
222
192
  reset() {
223
193
  }
@@ -237,7 +207,7 @@
237
207
  }
238
208
 
239
209
  async function loadParticlesCollisionsInteraction(engine) {
240
- engine.checkVersion("4.1.3");
210
+ engine.checkVersion("4.2.1");
241
211
  await engine.pluginManager.register((e) => {
242
212
  pluginInteractivity.ensureInteractivityPluginLoaded(e);
243
213
  e.pluginManager.addPlugin(new OverlapPlugin());
@@ -260,7 +230,7 @@
260
230
  checkParticlePosition(particle, position, tryCount) {
261
231
  return !this.#hasOverlaps(particle, position, tryCount);
262
232
  }
263
- #hasOverlaps = (particle, pos, tryCount) => {
233
+ #hasOverlaps(particle, pos, tryCount) {
264
234
  const collisionsOptions = particle.options.collisions;
265
235
  if (!collisionsOptions?.enable) {
266
236
  return false;
@@ -274,7 +244,7 @@
274
244
  throw new Error(`Particle is overlapping and can't be placed`);
275
245
  }
276
246
  return !!this.#container.particles.find(p => engine.getDistance(pos, p.position) < particle.getRadius() + p.getRadius());
277
- };
247
+ }
278
248
  }
279
249
 
280
250
  var OverlapPluginInstance$1 = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.interactions.particlesCollisions=s.__tsParticlesInternals.interactions.particlesCollisions||{}),s.__tsParticlesInternals.plugins.interactivity,s.__tsParticlesInternals.engine)}(this,function(s,t,e){"use strict";var n;!function(s){s.absorb="absorb",s.bounce="bounce",s.destroy="destroy"}(n||(n={}));class a{speed;constructor(){this.speed=2}load(s){e.isNull(s)||void 0!==s.speed&&(this.speed=s.speed)}}class i{enable;retries;constructor(){this.enable=!0,this.retries=0}load(s){e.isNull(s)||(void 0!==s.enable&&(this.enable=s.enable),void 0!==s.retries&&(this.retries=s.retries))}}class l{absorb;bounce;enable;maxSpeed;mode;overlap;constructor(){this.absorb=new a,this.bounce=new e.ParticlesBounce,this.enable=!1,this.maxSpeed=50,this.mode=n.bounce,this.overlap=new i}load(s){e.isNull(s)||(this.absorb.load(s.absorb),this.bounce.load(s.bounce),void 0!==s.enable&&(this.enable=s.enable),void 0!==s.maxSpeed&&(this.maxSpeed=e.setRangeValue(s.maxSpeed)),void 0!==s.mode&&(this.mode=s.mode),this.overlap.load(s.overlap))}}function r(s,t,n,a,i,l){if(!s.options.collisions||!n.options.collisions)return;const r=s.options.collisions.absorb.speed,o=e.clamp(r*i.factor,0,a);s.size.value=Math.sqrt(t*t+o*o),n.size.value-=o,n.size.value<=l&&(n.size.value=0,n.destroy())}const o=s=>{s.options.collisions&&(s.collisionMaxSpeed??=e.getRangeValue(s.options.collisions.maxSpeed),s.velocity.length>s.collisionMaxSpeed&&(s.velocity.length=s.collisionMaxSpeed))};function c(s,t){const n=s.getMass(),a=t.getMass(),i=s.velocity.length,l=t.velocity.length,r=n*i*i+a*l*l;e.circleBounce(e.circleBounceDataFromParticle(s),e.circleBounceDataFromParticle(t));const c=s.velocity.length,_=t.velocity.length,p=n*c*c+a*_*_;if(p>1e-6*r){const e=Math.sqrt(r/p);Math.abs(e-1)>1e-4&&(s.velocity.length=c*e,t.velocity.length=_*e)}o(s),o(t)}function _(s,t,e,a){if(s.options.collisions&&t.options.collisions)switch(s.options.collisions.mode){case n.absorb:!function(s,t,e,n){const a=s.getRadius(),i=t.getRadius();!a&&i?s.destroy():a&&!i?t.destroy():a&&i&&(a>=i?r(s,a,t,i,e,n):r(t,i,s,a,e,n))}(s,t,e,a);break;case n.bounce:c(s,t);break;case n.destroy:!function(s,t){s.unbreakable||t.unbreakable||c(s,t);const e=s.getRadius(),n=t.getRadius();!e&&n?s.destroy():e&&!n?t.destroy():e&&n&&(s.getRadius()>=t.getRadius()?t:s).destroy()}(s,t)}}class p extends t.ParticlesInteractorBase{maxDistance;constructor(s){super(s),this.maxDistance=0}clear(){}init(){}interact(s,t,n){if(s.destroyed||s.spawning)return;const a=this.container,i=s.getPosition(),l=s.getRadius(),r=a.particles.grid.queryCircle(i,l*e.double);for(const t of r){if(s===t||s.id>=t.id||!s.options.collisions?.enable||!t.options.collisions?.enable||s.options.collisions.mode!==t.options.collisions.mode||t.destroyed||t.spawning)continue;const r=t.getPosition(),o=t.getRadius();if(Math.abs(Math.round(i.z)-Math.round(r.z))>l+o)continue;e.getDistance(i,r)>l+o||_(s,t,n,a.retina.pixelRatio)}}isEnabled(s){return!!s.options.collisions?.enable}loadParticlesOptions(s,...t){s.collisions??=new l;for(const e of t)s.collisions.load(e?.collisions)}reset(){}}class u{id="overlap";async getPlugin(s){const{OverlapPluginInstance:t}=await Promise.resolve().then(function(){return I});return new t(s)}loadOptions(){}needsPlugin(){return!0}}async function d(s){s.checkVersion("4.1.3"),await s.pluginManager.register(s=>{t.ensureInteractivityPluginLoaded(s),s.pluginManager.addPlugin(new u),s.pluginManager.addInteractor?.("particlesCollisions",s=>Promise.resolve(new p(s)))})}const P=globalThis;P.__tsParticlesInternals=P.__tsParticlesInternals??{},P.loadParticlesCollisionsInteraction=d;var I=Object.freeze({__proto__:null,OverlapPluginInstance:class{#s;constructor(s){this.#s=s}checkParticlePosition(s,t,e){return!this.#t(s,t,e)}#t=(s,t,n)=>{const a=s.options.collisions;if(!a?.enable)return!1;const i=a.overlap;if(i.enable)return!1;const l=i.retries;if(l>=0&&n>l)throw new Error("Particle is overlapping and can't be placed");return!!this.#s.particles.find(n=>e.getDistance(t,n.position)<s.getRadius()+n.getRadius())}}});s.loadParticlesCollisionsInteraction=d}),Object.assign(globalThis.window||globalThis,{loadParticlesCollisionsInteraction:(globalThis.__tsParticlesInternals.interactions.particlesCollisions||{}).loadParticlesCollisionsInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.interactions.particlesCollisions=s.__tsParticlesInternals.interactions.particlesCollisions||{}),s.__tsParticlesInternals.plugins.interactivity,s.__tsParticlesInternals.engine)}(this,function(s,t,e){"use strict";var n;!function(s){s.absorb="absorb",s.bounce="bounce",s.destroy="destroy"}(n||(n={}));class a{speed=2;load(s){e.isNull(s)||e.loadProperty(this,"speed",s.speed)}}class i{enable=!0;retries=0;load(s){e.isNull(s)||(e.loadProperty(this,"enable",s.enable),e.loadProperty(this,"retries",s.retries))}}class l{absorb=new a;bounce=new e.ParticlesBounce;enable=!1;maxSpeed=50;mode=n.bounce;overlap=new i;load(s){e.isNull(s)||(this.absorb.load(s.absorb),this.bounce.load(s.bounce),e.loadProperty(this,"enable",s.enable),e.loadRangeProperty(this,"maxSpeed",s.maxSpeed),e.loadProperty(this,"mode",s.mode),this.overlap.load(s.overlap))}}function r(s,t,n,a,i,l){if(!s.options.collisions||!n.options.collisions)return;const r=s.options.collisions.absorb.speed,o=e.clamp(r*i.factor,0,a);s.size.value=Math.sqrt(t*t+o*o),n.size.value-=o,n.size.value<=l&&(n.size.value=0,n.destroy())}const o=s=>{s.options.collisions&&(s.collisionMaxSpeed??=e.getRangeValue(s.options.collisions.maxSpeed),s.velocity.length>s.collisionMaxSpeed&&(s.velocity.length=s.collisionMaxSpeed))};function c(s,t){const n=s.getMass(),a=t.getMass(),i=s.velocity.length,l=t.velocity.length,r=n*i*i+a*l*l;e.circleBounce(e.circleBounceDataFromParticle(s),e.circleBounceDataFromParticle(t));const c=s.velocity.length,_=t.velocity.length,p=n*c*c+a*_*_;if(p>1e-6*r){const e=Math.sqrt(r/p);Math.abs(e-1)>1e-4&&(s.velocity.length=c*e,t.velocity.length=_*e)}o(s),o(t)}function _(s,t,e,a){if(s.options.collisions&&t.options.collisions)switch(s.options.collisions.mode){case n.absorb:!function(s,t,e,n){const a=s.getRadius(),i=t.getRadius();!a&&i?s.destroy():a&&!i?t.destroy():a&&i&&(a>=i?r(s,a,t,i,e,n):r(t,i,s,a,e,n))}(s,t,e,a);break;case n.bounce:c(s,t);break;case n.destroy:!function(s,t){s.unbreakable||t.unbreakable||c(s,t);const e=s.getRadius(),n=t.getRadius();!e&&n?s.destroy():e&&!n?t.destroy():e&&n&&(s.getRadius()>=t.getRadius()?t:s).destroy()}(s,t)}}class p extends t.ParticlesInteractorBase{maxDistance;constructor(s){super(s),this.maxDistance=0}clear(){}init(){}interact(s,t,n){if(s.destroyed||s.spawning)return;const a=this.container,i=s.getPosition(),l=s.getRadius(),r=a.particles.grid.queryCircle(i,l*e.double);for(const t of r){if(s===t||s.id>=t.id||!s.options.collisions?.enable||!t.options.collisions?.enable||s.options.collisions.mode!==t.options.collisions.mode||t.destroyed||t.spawning)continue;const r=t.getPosition(),o=t.getRadius();if(Math.abs(Math.round(i.z)-Math.round(r.z))>l+o)continue;e.getDistance(i,r)>l+o||_(s,t,n,a.retina.pixelRatio)}}isEnabled(s){return!!s.options.collisions?.enable}loadParticlesOptions(s,...t){e.loadOptionProperty(s,"collisions",l,...t)}reset(){}}class u{id="overlap";async getPlugin(s){const{OverlapPluginInstance:t}=await Promise.resolve().then(function(){return I});return new t(s)}loadOptions(){}needsPlugin(){return!0}}async function P(s){s.checkVersion("4.2.1"),await s.pluginManager.register(s=>{t.ensureInteractivityPluginLoaded(s),s.pluginManager.addPlugin(new u),s.pluginManager.addInteractor?.("particlesCollisions",s=>Promise.resolve(new p(s)))})}const d=globalThis;d.__tsParticlesInternals=d.__tsParticlesInternals??{},d.loadParticlesCollisionsInteraction=P;var I=Object.freeze({__proto__:null,OverlapPluginInstance:class{#s;constructor(s){this.#s=s}checkParticlePosition(s,t,e){return!this.#t(s,t,e)}#t(s,t,n){const a=s.options.collisions;if(!a?.enable)return!1;const i=a.overlap;if(i.enable)return!1;const l=i.retries;if(l>=0&&n>l)throw new Error("Particle is overlapping and can't be placed");return!!this.#s.particles.find(n=>e.getDistance(t,n.position)<s.getRadius()+n.getRadius())}}});s.loadParticlesCollisionsInteraction=P}),Object.assign(globalThis.window||globalThis,{loadParticlesCollisionsInteraction:(globalThis.__tsParticlesInternals.interactions.particlesCollisions||{}).loadParticlesCollisionsInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -10,6 +10,5 @@ export declare class Collisions implements ICollisions, IOptionLoader<ICollision
10
10
  maxSpeed: RangeValue;
11
11
  mode: CollisionMode | keyof typeof CollisionMode;
12
12
  readonly overlap: CollisionsOverlap;
13
- constructor();
14
13
  load(data?: RecursivePartial<ICollisions>): void;
15
14
  }
@@ -2,6 +2,5 @@ import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
2
2
  import type { ICollisionsAbsorb } from "../Interfaces/ICollisionsAbsorb.js";
3
3
  export declare class CollisionsAbsorb implements ICollisionsAbsorb, IOptionLoader<ICollisionsAbsorb> {
4
4
  speed: number;
5
- constructor();
6
5
  load(data?: RecursivePartial<ICollisionsAbsorb>): void;
7
6
  }
@@ -3,6 +3,5 @@ import type { ICollisionsOverlap } from "../Interfaces/ICollisionsOverlap.js";
3
3
  export declare class CollisionsOverlap implements ICollisionsOverlap, IOptionLoader<ICollisionsOverlap> {
4
4
  enable: boolean;
5
5
  retries: number;
6
- constructor();
7
6
  load(data?: RecursivePartial<ICollisionsOverlap>): void;
8
7
  }