@tsparticles/plugin-poisson-disc 4.0.0-alpha.8 → 4.0.0-beta.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 (38) hide show
  1. package/56.min.js +1 -0
  2. package/960.min.js +1 -0
  3. package/964.min.js +1 -0
  4. package/browser/Options/Classes/Poisson.js +5 -0
  5. package/browser/PoissonDisc.js +79 -67
  6. package/browser/PoissonDiscPlugin.js +1 -3
  7. package/browser/PoissonDiscPluginInstance.js +9 -2
  8. package/browser/index.js +1 -1
  9. package/cjs/Options/Classes/Poisson.js +5 -0
  10. package/cjs/PoissonDisc.js +79 -67
  11. package/cjs/PoissonDiscPlugin.js +1 -3
  12. package/cjs/PoissonDiscPluginInstance.js +9 -2
  13. package/cjs/index.js +1 -1
  14. package/dist_browser_PoissonDiscPluginInstance_js.js +2 -12
  15. package/dist_browser_PoissonDiscPlugin_js.js +3 -3
  16. package/dist_browser_PoissonDisc_js.js +30 -0
  17. package/esm/Options/Classes/Poisson.js +5 -0
  18. package/esm/PoissonDisc.js +79 -67
  19. package/esm/PoissonDiscPlugin.js +1 -3
  20. package/esm/PoissonDiscPluginInstance.js +9 -2
  21. package/esm/index.js +1 -1
  22. package/package.json +2 -2
  23. package/report.html +1 -1
  24. package/tsparticles.plugin.poisson.js +31 -19
  25. package/tsparticles.plugin.poisson.min.js +2 -2
  26. package/types/PoissonDisc.d.ts +1 -1
  27. package/types/PoissonDiscPlugin.d.ts +1 -2
  28. package/types/PoissonDiscPluginInstance.d.ts +1 -1
  29. package/umd/Options/Classes/Poisson.js +5 -0
  30. package/umd/PoissonDisc.js +79 -67
  31. package/umd/PoissonDiscPlugin.js +1 -3
  32. package/umd/PoissonDiscPluginInstance.js +45 -4
  33. package/umd/index.js +1 -1
  34. package/336.min.js +0 -2
  35. package/336.min.js.LICENSE.txt +0 -1
  36. package/879.min.js +0 -2
  37. package/879.min.js.LICENSE.txt +0 -1
  38. package/tsparticles.plugin.poisson.min.js.LICENSE.txt +0 -1
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-beta.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_plugin_poisson_disc"] = this["webpackChunk_tsparticles_plugin_poisson_disc"] || []).push([["dist_browser_PoissonDisc_js"],{
19
+
20
+ /***/ "./dist/browser/PoissonDisc.js"
21
+ /*!*************************************!*\
22
+ !*** ./dist/browser/PoissonDisc.js ***!
23
+ \*************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PoissonDisc: () => (/* binding */ PoissonDisc)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass PoissonDisc {\n active;\n cellSize;\n cols;\n dimensions;\n firstPoint;\n grid;\n points;\n radius;\n retries;\n rows;\n size;\n constructor(size, radius, retries, dimensions, firstPoint){\n this.size = {\n ...size\n };\n this.radius = radius;\n this.retries = retries;\n this.dimensions = dimensions;\n this.cellSize = Math.floor(this.radius / Math.sqrt(this.dimensions));\n this.cols = Math.floor(this.size.width / this.cellSize);\n this.rows = Math.floor(this.size.height / this.cellSize);\n this.points = [];\n this.active = [];\n this.grid = [];\n this.firstPoint = firstPoint ? {\n ...firstPoint\n } : undefined;\n this.reset();\n }\n addPoint(inputPoint) {\n const point = {\n position: {\n ...inputPoint\n },\n gridPosition: {\n x: Math.floor(inputPoint.x / this.cellSize),\n y: Math.floor(inputPoint.y / this.cellSize)\n }\n }, pointIndex = this.points.length, row = this.grid[point.gridPosition.y];\n if (!row) {\n return;\n }\n this.points.push(point);\n row[point.gridPosition.x] = pointIndex;\n this.active.push(pointIndex);\n }\n getRandom(min, max) {\n return Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * (max - min)) + min;\n }\n initialiseGrid() {\n for(let y = 0; y <= this.rows; y++){\n this.grid[y] = [];\n const row = this.grid[y];\n if (!row) {\n continue;\n }\n for(let x = 0; x <= this.cols; x++){\n row[x] = -1;\n }\n }\n }\n reset() {\n this.points = [];\n this.active = [];\n this.grid = [];\n this.initialiseGrid();\n if (this.firstPoint) {\n this.addPoint(this.firstPoint);\n } else {\n const minCoordinate = 0;\n this.addPoint({\n x: this.getRandom(minCoordinate, this.size.width),\n y: this.getRandom(minCoordinate, this.size.height)\n });\n }\n }\n async run() {\n this.reset();\n const minCount = 0, step = 1, yieldEvery = 100, yieldStepModule = 0;\n let iterations = 0;\n while(this.active.length > minCount){\n this.steps(step);\n if (++iterations % yieldEvery === yieldStepModule) {\n await new Promise((resolve)=>setTimeout(resolve));\n }\n }\n }\n steps(steps) {\n const minCount = 0;\n for(let i = 0; i < steps; i++){\n if (this.active.length <= minCount) {\n continue;\n }\n this._step();\n }\n }\n _getNewPoint(currentPoint, tries) {\n const minCoordinate = 0, gridMinValue = 0, maxNeighbourIndex = 1, newAngle = tries * (_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI / this.retries), newDist = this.getRandom(this.radius, this.radius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double), offset = {\n x: Math.cos(newAngle) * newDist,\n y: Math.sin(newAngle) * newDist\n }, newPoint = {\n x: Math.floor(currentPoint.position.x + offset.x),\n y: Math.floor(currentPoint.position.y + offset.y)\n }, newGridCoords = {\n x: Math.floor(newPoint.x / this.cellSize),\n y: Math.floor(newPoint.y / this.cellSize)\n };\n if (newPoint.x <= minCoordinate || newPoint.x >= this.size.width || newPoint.y <= minCoordinate || newPoint.y >= this.size.height) {\n return;\n }\n const row = this.grid[newGridCoords.y];\n if (!row) {\n return;\n }\n const cellValue = row[newGridCoords.x];\n if (cellValue === undefined) {\n return;\n }\n if (cellValue >= gridMinValue) {\n return;\n }\n for(let i = -1; i <= maxNeighbourIndex; i++){\n for(let j = -1; j <= maxNeighbourIndex; j++){\n if (!i && !j) {\n continue;\n }\n const neighbourGrid = {\n x: newGridCoords.x + j,\n y: newGridCoords.y + i\n };\n if (neighbourGrid.x < minCoordinate || neighbourGrid.y < minCoordinate || neighbourGrid.x >= this.cols || neighbourGrid.y >= this.rows) {\n continue;\n }\n const neighbourCellValue = this.grid[neighbourGrid.y]?.[neighbourGrid.x];\n if (neighbourCellValue === undefined || neighbourCellValue < gridMinValue) {\n continue;\n }\n const neighbour = this.points[neighbourCellValue];\n if (!neighbour) {\n continue;\n }\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(newPoint, neighbour.position) < this.radius) {\n return;\n }\n }\n }\n return newPoint;\n }\n _step() {\n const minCount = 0, randomActive = this.getRandom(minCount, this.active.length);\n let foundNewPoint = false;\n for(let tries = 0; tries < this.retries; tries++){\n const randomActivePointIndex = this.active[randomActive];\n if (randomActivePointIndex === undefined) {\n continue;\n }\n const point = this.points[randomActivePointIndex];\n if (!point) {\n continue;\n }\n const newPoint = this._getNewPoint(point, tries);\n if (newPoint) {\n foundNewPoint = true;\n this.addPoint(newPoint);\n break;\n }\n }\n if (!foundNewPoint) {\n const deleteCount = 1;\n this.active.splice(randomActive, deleteCount);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/PoissonDisc.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
@@ -1,5 +1,10 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  export class Poisson {
3
+ dimensions;
4
+ enable;
5
+ radius;
6
+ retries;
7
+ steps;
3
8
  constructor() {
4
9
  this.enable = false;
5
10
  this.dimensions = 2;
@@ -1,5 +1,16 @@
1
1
  import { double, doublePI, getDistance, getRandom } from "@tsparticles/engine";
2
2
  export class PoissonDisc {
3
+ active;
4
+ cellSize;
5
+ cols;
6
+ dimensions;
7
+ firstPoint;
8
+ grid;
9
+ points;
10
+ radius;
11
+ retries;
12
+ rows;
13
+ size;
3
14
  constructor(size, radius, retries, dimensions, firstPoint) {
4
15
  this.size = { ...size };
5
16
  this.radius = radius;
@@ -62,18 +73,22 @@ export class PoissonDisc {
62
73
  }
63
74
  async run() {
64
75
  this.reset();
65
- const minCount = 0, step = 1;
76
+ const minCount = 0, step = 1, yieldEvery = 100, yieldStepModule = 0;
77
+ let iterations = 0;
66
78
  while (this.active.length > minCount) {
67
- await this.steps(step);
79
+ this.steps(step);
80
+ if (++iterations % yieldEvery === yieldStepModule) {
81
+ await new Promise(resolve => setTimeout(resolve));
82
+ }
68
83
  }
69
84
  }
70
- async steps(steps) {
85
+ steps(steps) {
71
86
  const minCount = 0;
72
87
  for (let i = 0; i < steps; i++) {
73
88
  if (this.active.length <= minCount) {
74
89
  continue;
75
90
  }
76
- await this._step();
91
+ this._step();
77
92
  }
78
93
  }
79
94
  _getNewPoint(currentPoint, tries) {
@@ -87,78 +102,75 @@ export class PoissonDisc {
87
102
  x: Math.floor(newPoint.x / this.cellSize),
88
103
  y: Math.floor(newPoint.y / this.cellSize),
89
104
  };
90
- if (newPoint.x > minCoordinate &&
91
- newPoint.x < this.size.width &&
92
- newPoint.y > minCoordinate &&
93
- newPoint.y < this.size.height) {
94
- const row = this.grid[newGridCoords.y];
95
- if (!row) {
96
- return;
97
- }
98
- const point = row[newGridCoords.x];
99
- if (point === undefined) {
100
- return;
101
- }
102
- if (point < gridMinValue) {
103
- for (let i = -1; i <= maxNeighbourIndex; i++) {
104
- for (let j = -1; j <= maxNeighbourIndex; j++) {
105
- const neighbourGrid = {
106
- x: newGridCoords.x + j,
107
- y: newGridCoords.y + i,
108
- };
109
- if (neighbourGrid.x >= minCoordinate &&
110
- neighbourGrid.y >= minCoordinate &&
111
- neighbourGrid.x < this.cols &&
112
- neighbourGrid.y < this.rows &&
113
- (neighbourGrid.x !== newGridCoords.x || neighbourGrid.y !== newGridCoords.y)) {
114
- if (point >= gridMinValue) {
115
- const neighbourIndex = point, neighbour = this.points[neighbourIndex];
116
- if (!neighbour) {
117
- continue;
118
- }
119
- const dist = getDistance(newPoint, neighbour.position);
120
- if (dist < this.radius) {
121
- return;
122
- }
123
- }
124
- }
125
- }
126
- }
127
- }
128
- else {
129
- return;
130
- }
105
+ if (newPoint.x <= minCoordinate ||
106
+ newPoint.x >= this.size.width ||
107
+ newPoint.y <= minCoordinate ||
108
+ newPoint.y >= this.size.height) {
109
+ return;
131
110
  }
132
- else {
111
+ const row = this.grid[newGridCoords.y];
112
+ if (!row) {
133
113
  return;
134
114
  }
135
- return newPoint;
136
- }
137
- async _step() {
138
- const minCount = 0, randomActive = this.getRandom(minCount, this.active.length);
139
- return new Promise(resolve => {
140
- let foundNewPoint = false;
141
- for (let tries = 0; tries < this.retries; tries++) {
142
- const randomActivePointIndex = this.active[randomActive];
143
- if (randomActivePointIndex === undefined) {
115
+ const cellValue = row[newGridCoords.x];
116
+ if (cellValue === undefined) {
117
+ return;
118
+ }
119
+ if (cellValue >= gridMinValue) {
120
+ return;
121
+ }
122
+ for (let i = -1; i <= maxNeighbourIndex; i++) {
123
+ for (let j = -1; j <= maxNeighbourIndex; j++) {
124
+ if (!i && !j) {
125
+ continue;
126
+ }
127
+ const neighbourGrid = {
128
+ x: newGridCoords.x + j,
129
+ y: newGridCoords.y + i,
130
+ };
131
+ if (neighbourGrid.x < minCoordinate ||
132
+ neighbourGrid.y < minCoordinate ||
133
+ neighbourGrid.x >= this.cols ||
134
+ neighbourGrid.y >= this.rows) {
135
+ continue;
136
+ }
137
+ const neighbourCellValue = this.grid[neighbourGrid.y]?.[neighbourGrid.x];
138
+ if (neighbourCellValue === undefined || neighbourCellValue < gridMinValue) {
144
139
  continue;
145
140
  }
146
- const point = this.points[randomActivePointIndex];
147
- if (!point) {
141
+ const neighbour = this.points[neighbourCellValue];
142
+ if (!neighbour) {
148
143
  continue;
149
144
  }
150
- const newPoint = this._getNewPoint(point, tries);
151
- if (newPoint) {
152
- foundNewPoint = true;
153
- this.addPoint(newPoint);
154
- break;
145
+ if (getDistance(newPoint, neighbour.position) < this.radius) {
146
+ return;
155
147
  }
156
148
  }
157
- if (!foundNewPoint) {
158
- const deleteCount = 1;
159
- this.active.splice(randomActive, deleteCount);
149
+ }
150
+ return newPoint;
151
+ }
152
+ _step() {
153
+ const minCount = 0, randomActive = this.getRandom(minCount, this.active.length);
154
+ let foundNewPoint = false;
155
+ for (let tries = 0; tries < this.retries; tries++) {
156
+ const randomActivePointIndex = this.active[randomActive];
157
+ if (randomActivePointIndex === undefined) {
158
+ continue;
159
+ }
160
+ const point = this.points[randomActivePointIndex];
161
+ if (!point) {
162
+ continue;
160
163
  }
161
- resolve();
162
- });
164
+ const newPoint = this._getNewPoint(point, tries);
165
+ if (newPoint) {
166
+ foundNewPoint = true;
167
+ this.addPoint(newPoint);
168
+ break;
169
+ }
170
+ }
171
+ if (!foundNewPoint) {
172
+ const deleteCount = 1;
173
+ this.active.splice(randomActive, deleteCount);
174
+ }
163
175
  }
164
176
  }
@@ -1,8 +1,6 @@
1
1
  import { Poisson } from "./Options/Classes/Poisson.js";
2
2
  export class PoissonDiscPlugin {
3
- constructor() {
4
- this.id = "poisson";
5
- }
3
+ id = "poisson";
6
4
  async getPlugin(container) {
7
5
  const { PoissonDiscPluginInstance } = await import("./PoissonDiscPluginInstance.js");
8
6
  return new PoissonDiscPluginInstance(container);
@@ -1,6 +1,9 @@
1
1
  import { getRangeMax } from "@tsparticles/engine";
2
- import { PoissonDisc } from "./PoissonDisc.js";
3
2
  export class PoissonDiscPluginInstance {
3
+ poissonDisc;
4
+ redrawTimeout;
5
+ _container;
6
+ _currentIndex;
4
7
  constructor(container) {
5
8
  this._container = container;
6
9
  this._currentIndex = 0;
@@ -26,6 +29,9 @@ export class PoissonDiscPluginInstance {
26
29
  const timeout = 250;
27
30
  this.redrawTimeout = setTimeout(() => {
28
31
  void (async () => {
32
+ if (this._container.destroyed) {
33
+ return;
34
+ }
29
35
  await this._initData();
30
36
  await container.particles.redraw();
31
37
  })();
@@ -40,12 +46,13 @@ export class PoissonDiscPluginInstance {
40
46
  return;
41
47
  }
42
48
  this._currentIndex = 0;
49
+ const { PoissonDisc } = await import("./PoissonDisc.js");
43
50
  this.poissonDisc = new PoissonDisc(canvasSize, poissonOptions.radius
44
51
  ? poissonOptions.radius * pixelRatio
45
52
  : Math.max(getRangeMax(particlesOptions.size.value) * pixelRatio, Math.sqrt((canvasSize.width * canvasSize.height) / particlesOptions.number.value)), poissonOptions.retries, poissonOptions.dimensions);
46
53
  const noSteps = 0;
47
54
  if (poissonOptions.steps > noSteps) {
48
- await this.poissonDisc.steps(poissonOptions.steps);
55
+ this.poissonDisc.steps(poissonOptions.steps);
49
56
  }
50
57
  else {
51
58
  await this.poissonDisc.run();
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadPoissonDiscPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.8");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(async (e) => {
4
4
  const { PoissonDiscPlugin } = await import("./PoissonDiscPlugin.js");
5
5
  e.addPlugin(new PoissonDiscPlugin());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-poisson-disc",
3
- "version": "4.0.0-alpha.8",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "tsParticles poisson disc plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -85,7 +85,7 @@
85
85
  "./package.json": "./package.json"
86
86
  },
87
87
  "dependencies": {
88
- "@tsparticles/engine": "4.0.0-alpha.8"
88
+ "@tsparticles/engine": "4.0.0-beta.0"
89
89
  },
90
90
  "publishConfig": {
91
91
  "access": "public"
package/report.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@tsparticles/plugin-poisson-disc [23 Jan 2026 at 23:46]</title>
6
+ <title>@tsparticles/plugin-poisson-disc [19 Mar 2026 at 14:00]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.8
7
+ * v4.0.0-beta.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/index.js"
32
- /*!*******************************!*\
33
- !*** ./dist/browser/index.js ***!
34
- \*******************************/
35
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
-
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPoissonDiscPlugin: () => (/* binding */ loadPoissonDiscPlugin)\n/* harmony export */ });\nasync function loadPoissonDiscPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.8\");\n await engine.register(async e => {\n const {\n PoissonDiscPlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_PoissonDiscPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PoissonDiscPlugin.js */ \"./dist/browser/PoissonDiscPlugin.js\"));\n e.addPlugin(new PoissonDiscPlugin());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/index.js?\n}");
38
-
39
- /***/ },
40
-
41
31
  /***/ "@tsparticles/engine"
42
32
  /*!*********************************************************************************************************************************!*\
43
33
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
@@ -46,6 +36,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
46
36
 
47
37
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
48
38
 
39
+ /***/ },
40
+
41
+ /***/ "./dist/browser/index.js"
42
+ /*!*******************************!*\
43
+ !*** ./dist/browser/index.js ***!
44
+ \*******************************/
45
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
+
47
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPoissonDiscPlugin: () => (/* binding */ loadPoissonDiscPlugin)\n/* harmony export */ });\nasync function loadPoissonDiscPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const { PoissonDiscPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_PoissonDiscPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PoissonDiscPlugin.js */ \"./dist/browser/PoissonDiscPlugin.js\"));\n e.addPlugin(new PoissonDiscPlugin());\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/index.js?\n}");
48
+
49
49
  /***/ }
50
50
 
51
51
  /******/ });
@@ -60,12 +60,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
60
60
  /******/ if (cachedModule !== undefined) {
61
61
  /******/ return cachedModule.exports;
62
62
  /******/ }
63
- /******/ // Check if module exists (development only)
64
- /******/ if (__webpack_modules__[moduleId] === undefined) {
65
- /******/ var e = new Error("Cannot find module '" + moduleId + "'");
66
- /******/ e.code = 'MODULE_NOT_FOUND';
67
- /******/ throw e;
68
- /******/ }
69
63
  /******/ // Create a new module (and put it into the cache)
70
64
  /******/ var module = __webpack_module_cache__[moduleId] = {
71
65
  /******/ // no module.id needed
@@ -74,6 +68,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
74
68
  /******/ };
75
69
  /******/
76
70
  /******/ // Execute the module function
71
+ /******/ if (!(moduleId in __webpack_modules__)) {
72
+ /******/ delete __webpack_module_cache__[moduleId];
73
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
74
+ /******/ e.code = 'MODULE_NOT_FOUND';
75
+ /******/ throw e;
76
+ /******/ }
77
77
  /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
78
78
  /******/
79
79
  /******/ // Return the exports of the module
@@ -118,6 +118,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
118
118
  /******/ };
119
119
  /******/ })();
120
120
  /******/
121
+ /******/ /* webpack/runtime/global */
122
+ /******/ (() => {
123
+ /******/ __webpack_require__.g = (function() {
124
+ /******/ if (typeof globalThis === 'object') return globalThis;
125
+ /******/ try {
126
+ /******/ return this || new Function('return this')();
127
+ /******/ } catch (e) {
128
+ /******/ if (typeof window === 'object') return window;
129
+ /******/ }
130
+ /******/ })();
131
+ /******/ })();
132
+ /******/
121
133
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
122
134
  /******/ (() => {
123
135
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
@@ -182,8 +194,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
182
194
  /******/ /* webpack/runtime/publicPath */
183
195
  /******/ (() => {
184
196
  /******/ var scriptUrl;
185
- /******/ if (globalThis.importScripts) scriptUrl = globalThis.location + "";
186
- /******/ var document = globalThis.document;
197
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
198
+ /******/ var document = __webpack_require__.g.document;
187
199
  /******/ if (!scriptUrl && document) {
188
200
  /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
189
201
  /******/ scriptUrl = document.currentScript.src;
@@ -1,2 +1,2 @@
1
- /*! For license information please see tsparticles.plugin.poisson.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={303(t){t.exports=e}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,n),r.exports}n.m=o,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,r)=>(n.f[r](e,t),t)),[])),n.u=e=>e+".min.js",n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/plugin-poisson-disc:",n.l=(e,o,i,a)=>{if(t[e])t[e].push(o);else{var s,l;if(void 0!==i)for(var p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var u=p[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+i){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",n.nc&&s.setAttribute("nonce",n.nc),s.setAttribute("data-webpack",r+i),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var i=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),l&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={189:0};n.f.j=(t,r)=>{var o=n.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise(((r,i)=>o=e[t]=[r,i]));r.push(o[2]=i);var a=n.p+n.u(t),s=new Error;n.l(a,(r=>{if(n.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,i,[a,s,l]=r,p=0;if(a.some((t=>0!==e[t]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(l)l(n)}for(t&&t(r);p<a.length;p++)i=a[p],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunk_tsparticles_plugin_poisson_disc=this.webpackChunk_tsparticles_plugin_poisson_disc||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};async function s(e){e.checkVersion("4.0.0-alpha.8"),await e.register((async e=>{const{PoissonDiscPlugin:t}=await n.e(879).then(n.bind(n,879));e.addPlugin(new t)}))}return n.r(a),n.d(a,{loadPoissonDiscPlugin:()=>s}),a})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,i={303(t){t.exports=e}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e](r,r.exports,s),r.exports}s.m=i,s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},s.l=(e,t,r,o)=>{if(a[e])return void a[e].push(t);if(void 0!==r)for(var i,n,c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var l=c[p];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/plugin-poisson-disc:"+r){i=l;break}}i||(n=!0,(i=document.createElement("script")).charset="utf-8",s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack","@tsparticles/plugin-poisson-disc:"+r),i.src=e),a[e]=[t];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=a[e];if(delete a[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),n&&document.head.appendChild(i)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(c=s.g.location+"");var a,c,p=s.g.document;if(!c&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(c=p.currentScript.src),!c)){var l=p.getElementsByTagName("script");if(l.length)for(var u=l.length-1;u>-1&&(!c||!/^http(s?):/.test(c));)c=l[u--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");s.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={189:0},s.f.j=(e,r)=>{var o=s.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise((r,i)=>o=t[e]=[r,i]);r.push(o[2]=i);var n=s.p+s.u(e),a=Error();s.l(n,r=>{if(s.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;a.message="Loading chunk "+e+` failed.
2
+ (`+i+": "+n+")",a.name="ChunkLoadError",a.type=i,a.request=n,o[1](a)}},"chunk-"+e,e)}},r=(e,r)=>{var o,i,[n,a,c]=r,p=0;if(n.some(e=>0!==t[e])){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);c&&c(s)}for(e&&e(r);p<n.length;p++)i=n[p],s.o(t,i)&&t[i]&&t[i][0](),t[i]=0},(o=this.webpackChunk_tsparticles_plugin_poisson_disc=this.webpackChunk_tsparticles_plugin_poisson_disc||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.0"),await e.register(async e=>{let{PoissonDiscPlugin:t}=await s.e(964).then(s.bind(s,964));e.addPlugin(new t)})}return s.r(d),s.d(d,{loadPoissonDiscPlugin:()=>f}),d})());
@@ -21,7 +21,7 @@ export declare class PoissonDisc {
21
21
  initialiseGrid(): void;
22
22
  reset(): void;
23
23
  run(): Promise<void>;
24
- steps(steps: number): Promise<void>;
24
+ steps(steps: number): void;
25
25
  private _getNewPoint;
26
26
  private _step;
27
27
  }
@@ -1,8 +1,7 @@
1
1
  import { type Container, type IContainerPlugin, type IPlugin, type RecursivePartial } from "@tsparticles/engine";
2
2
  import type { IPoissonOptions, PoissonOptions } from "./types.js";
3
3
  export declare class PoissonDiscPlugin implements IPlugin {
4
- readonly id: string;
5
- constructor();
4
+ readonly id = "poisson";
6
5
  getPlugin(container: Container): Promise<IContainerPlugin>;
7
6
  loadOptions(_container: Container, options: PoissonOptions, source?: RecursivePartial<IPoissonOptions>): void;
8
7
  needsPlugin(options?: RecursivePartial<IPoissonOptions>): boolean;
@@ -1,6 +1,6 @@
1
1
  import { type IContainerPlugin, type ICoordinates } from "@tsparticles/engine";
2
2
  import type { PoissonContainer } from "./types.js";
3
- import { PoissonDisc } from "./PoissonDisc.js";
3
+ import type { PoissonDisc } from "./PoissonDisc.js";
4
4
  export declare class PoissonDiscPluginInstance implements IContainerPlugin {
5
5
  poissonDisc?: PoissonDisc;
6
6
  redrawTimeout?: number | NodeJS.Timeout;
@@ -12,6 +12,11 @@
12
12
  exports.Poisson = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  class Poisson {
15
+ dimensions;
16
+ enable;
17
+ radius;
18
+ retries;
19
+ steps;
15
20
  constructor() {
16
21
  this.enable = false;
17
22
  this.dimensions = 2;