@tsparticles/path-grid 4.0.0-alpha.14 → 4.0.0-alpha.8

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.
package/912.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 912.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_path_grid=this.webpackChunk_tsparticles_path_grid||[]).push([[912],{912(t,i,o){o.d(i,{GridPathGenerator:()=>r});var e=o(303);const n=[e.Vector.create(e.identity,e.originPoint.y),e.Vector.create(e.originPoint.x,e.identity),e.Vector.create(-e.identity,e.originPoint.y),e.Vector.create(e.originPoint.x,-e.identity)],s=[2,3,0,1];class r{constructor(t){this._container=t,this.options={cellSize:40,graph:void 0,autoMaze:!1,mazeWidth:20,mazeHeight:20}}generate(t){const i=this.options.cellSize;t.grid??={direction:Math.trunc((0,e.getRandom)()*n.length),speed:t.velocity.length,cellPosition:{x:Math.floor(t.position.x/i),y:Math.floor(t.position.y/i)}};const o=t.grid,s={x:Math.floor(t.position.x/i),y:Math.floor(t.position.y/i)};if(s.x!==o.cellPosition.x||s.y!==o.cellPosition.y){o.cellPosition.x=s.x,o.cellPosition.y=s.y;const t=`${s.x},${s.y}`,i=this.options.graph?.[t];if(i&&i.length>0)o.direction=i[Math.trunc((0,e.getRandom)()*i.length)];else if(!this.options.graph){const t=Math.trunc(3*(0,e.getRandom)())-1;o.direction=(o.direction+t+4)%n.length}}t.velocity.x=0,t.velocity.y=0;const r=n[o.direction];return e.Vector.create(r.x*o.speed,r.y*o.speed)}init(){const t=this._container.actualOptions.particles.move.path.options;if(this.options.cellSize=t.cellSize??this.options.cellSize,this.options.autoMaze=t.autoMaze??this.options.autoMaze,this.options.graph=t.graph,this.options.autoMaze){const t=this._container.canvas.size,i=this.options.cellSize,o={width:Math.ceil(t.width/i),height:Math.ceil(t.height/i)};this.options.graph=this._generateMazeGraph(o)}}reset(t){delete t.grid}update(){}_generateMazeGraph({height:t,width:i}){const o={},n=[];for(let i=0;i<t;i++)n[i]=[];const r=[{x:e.originPoint.x,y:e.originPoint.y}];for(;r.length>0;){const{x:a,y:h}=r[r.length-1];n[h][a]||(n[h][a]=!0);const c=[0,1,2,3].sort((()=>(0,e.getRandom)()-.5));let l=!1;for(const e of c){const c={x:a+(0===e?1:2===e?-1:0),y:h+(1===e?1:3===e?-1:0)};if(!(c.x<0||c.y<0||c.x>=i||c.y>=t)&&!n[c.y][c.x]){const t=`${a},${h}`,i=`${c.x},${c.y}`;o[t]??=[],o[i]??=[],o[t].push(e),o[i].push(s[e]),r.push(c),l=!0;break}}l||r.pop()}return o}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Grid Path Path v4.0.0-alpha.8 by Matteo Bruni */
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
2
 
3
- # tsParticles Grid Path
3
+ # tsParticles Grid Path Path
4
4
 
5
5
  [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/path-grid/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/path-grid)
6
6
  [![npmjs](https://badge.fury.io/js/@tsparticles/path-grid.svg)](https://www.npmjs.com/package/@tsparticles/path-grid)
@@ -6,14 +6,14 @@ const dirs = [
6
6
  Vector.create(originPoint.x, -identity),
7
7
  ], opposite = [2, 3, 0, 1], minLength = 0;
8
8
  export class GridPathGenerator {
9
- options;
10
- _container;
11
9
  constructor(container) {
12
10
  this._container = container;
13
11
  this.options = {
14
12
  cellSize: 40,
15
13
  graph: undefined,
16
14
  autoMaze: false,
15
+ mazeWidth: 20,
16
+ mazeHeight: 20,
17
17
  };
18
18
  }
19
19
  generate(p) {
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const gridPathName = "gridPathGenerator";
2
2
  export async function loadGridPath(engine) {
3
- engine.checkVersion("4.0.0-alpha.14");
3
+ engine.checkVersion("4.0.0-alpha.8");
4
4
  await engine.register(e => {
5
5
  e.addPathGenerator(gridPathName, async (container) => {
6
6
  const { GridPathGenerator } = await import("./GridPathGenerator.js");
@@ -6,14 +6,14 @@ const dirs = [
6
6
  Vector.create(originPoint.x, -identity),
7
7
  ], opposite = [2, 3, 0, 1], minLength = 0;
8
8
  export class GridPathGenerator {
9
- options;
10
- _container;
11
9
  constructor(container) {
12
10
  this._container = container;
13
11
  this.options = {
14
12
  cellSize: 40,
15
13
  graph: undefined,
16
14
  autoMaze: false,
15
+ mazeWidth: 20,
16
+ mazeHeight: 20,
17
17
  };
18
18
  }
19
19
  generate(p) {
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const gridPathName = "gridPathGenerator";
2
2
  export async function loadGridPath(engine) {
3
- engine.checkVersion("4.0.0-alpha.14");
3
+ engine.checkVersion("4.0.0-alpha.8");
4
4
  await engine.register(e => {
5
5
  e.addPathGenerator(gridPathName, async (container) => {
6
6
  const { GridPathGenerator } = await import("./GridPathGenerator.js");
@@ -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.14
7
+ * v4.0.0-alpha.8
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \*******************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GridPathGenerator: () => (/* binding */ GridPathGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst dirs = [\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y),\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity),\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(-_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y),\n _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, -_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity)\n], opposite = [\n 2,\n 3,\n 0,\n 1\n], minLength = 0;\nclass GridPathGenerator {\n options;\n _container;\n constructor(container){\n this._container = container;\n this.options = {\n cellSize: 40,\n graph: undefined,\n autoMaze: false\n };\n }\n generate(p) {\n const size = this.options.cellSize;\n p.grid ??= {\n direction: Math.trunc((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * dirs.length),\n speed: p.velocity.length,\n cellPosition: {\n x: Math.floor(p.position.x / size),\n y: Math.floor(p.position.y / size)\n }\n };\n const grid = p.grid, c = {\n x: Math.floor(p.position.x / size),\n y: Math.floor(p.position.y / size)\n };\n if (c.x !== grid.cellPosition.x || c.y !== grid.cellPosition.y) {\n grid.cellPosition.x = c.x;\n grid.cellPosition.y = c.y;\n const key = `${c.x},${c.y}`, allowed = this.options.graph?.[key];\n if (allowed && allowed.length > minLength) {\n grid.direction = allowed[Math.trunc((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * allowed.length)];\n } else if (!this.options.graph) {\n const turn = Math.trunc((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * 3) - 1;\n grid.direction = (grid.direction + turn + 4) % dirs.length;\n }\n }\n p.velocity.x = 0;\n p.velocity.y = 0;\n const d = dirs[grid.direction];\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(d.x * grid.speed, d.y * grid.speed);\n }\n init() {\n const source = this._container.actualOptions.particles.move.path.options;\n this.options.cellSize = source[\"cellSize\"] ?? this.options.cellSize;\n this.options.autoMaze = source[\"autoMaze\"] ?? this.options.autoMaze;\n this.options.graph = source[\"graph\"];\n if (this.options.autoMaze) {\n const canvas = this._container.canvas.size, cellSize = this.options.cellSize, size = {\n width: Math.ceil(canvas.width / cellSize),\n height: Math.ceil(canvas.height / cellSize)\n };\n this.options.graph = this._generateMazeGraph(size);\n }\n }\n reset(p) {\n delete p.grid;\n }\n update() {}\n _generateMazeGraph({ height, width }) {\n const graph = {}, visited = [];\n for(let y = 0; y < height; y++){\n visited[y] = [];\n }\n const stack = [\n {\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y\n }\n ];\n while(stack.length > 0){\n const { x, y } = stack[stack.length - 1];\n if (!visited[y][x]) {\n visited[y][x] = true;\n }\n const dirsOrder = [\n 0,\n 1,\n 2,\n 3\n ].sort(()=>(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() - 0.5);\n let moved = false;\n for (const d of dirsOrder){\n const n = {\n x: x + (d === 0 ? 1 : d === 2 ? -1 : 0),\n y: y + (d === 1 ? 1 : d === 3 ? -1 : 0)\n };\n if (n.x < 0 || n.y < 0 || n.x >= width || n.y >= height) {\n continue;\n }\n if (!visited[n.y][n.x]) {\n const key = `${x},${y}`, nKey = `${n.x},${n.y}`;\n graph[key] ??= [];\n graph[nKey] ??= [];\n graph[key].push(d);\n graph[nKey].push(opposite[d]);\n stack.push(n);\n moved = true;\n break;\n }\n }\n if (!moved) {\n stack.pop();\n }\n }\n return graph;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-grid/./dist/browser/GridPathGenerator.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GridPathGenerator: () => (/* binding */ GridPathGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst dirs = [_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y), _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity), _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(-_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y), _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x, -_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity)],\n opposite = [2, 3, 0, 1],\n minLength = 0;\nclass GridPathGenerator {\n constructor(container) {\n this._container = container;\n this.options = {\n cellSize: 40,\n graph: undefined,\n autoMaze: false,\n mazeWidth: 20,\n mazeHeight: 20\n };\n }\n generate(p) {\n const size = this.options.cellSize;\n p.grid ??= {\n direction: Math.trunc((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * dirs.length),\n speed: p.velocity.length,\n cellPosition: {\n x: Math.floor(p.position.x / size),\n y: Math.floor(p.position.y / size)\n }\n };\n const grid = p.grid,\n c = {\n x: Math.floor(p.position.x / size),\n y: Math.floor(p.position.y / size)\n };\n if (c.x !== grid.cellPosition.x || c.y !== grid.cellPosition.y) {\n grid.cellPosition.x = c.x;\n grid.cellPosition.y = c.y;\n const key = `${c.x},${c.y}`,\n allowed = this.options.graph?.[key];\n if (allowed && allowed.length > minLength) {\n grid.direction = allowed[Math.trunc((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * allowed.length)];\n } else if (!this.options.graph) {\n const turn = Math.trunc((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * 3) - 1;\n grid.direction = (grid.direction + turn + 4) % dirs.length;\n }\n }\n p.velocity.x = 0;\n p.velocity.y = 0;\n const d = dirs[grid.direction];\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(d.x * grid.speed, d.y * grid.speed);\n }\n init() {\n const source = this._container.actualOptions.particles.move.path.options;\n this.options.cellSize = source[\"cellSize\"] ?? this.options.cellSize;\n this.options.autoMaze = source[\"autoMaze\"] ?? this.options.autoMaze;\n this.options.graph = source[\"graph\"];\n if (this.options.autoMaze) {\n const canvas = this._container.canvas.size,\n cellSize = this.options.cellSize,\n size = {\n width: Math.ceil(canvas.width / cellSize),\n height: Math.ceil(canvas.height / cellSize)\n };\n this.options.graph = this._generateMazeGraph(size);\n }\n }\n reset(p) {\n delete p.grid;\n }\n update() {}\n _generateMazeGraph({\n height,\n width\n }) {\n const graph = {},\n visited = [];\n for (let y = 0; y < height; y++) {\n visited[y] = [];\n }\n const stack = [{\n x: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.x,\n y: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y\n }];\n while (stack.length > 0) {\n const {\n x,\n y\n } = stack[stack.length - 1];\n if (!visited[y][x]) {\n visited[y][x] = true;\n }\n const dirsOrder = [0, 1, 2, 3].sort(() => (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() - 0.5);\n let moved = false;\n for (const d of dirsOrder) {\n const n = {\n x: x + (d === 0 ? 1 : d === 2 ? -1 : 0),\n y: y + (d === 1 ? 1 : d === 3 ? -1 : 0)\n };\n if (n.x < 0 || n.y < 0 || n.x >= width || n.y >= height) {\n continue;\n }\n if (!visited[n.y][n.x]) {\n const key = `${x},${y}`,\n nKey = `${n.x},${n.y}`;\n graph[key] ??= [];\n graph[nKey] ??= [];\n graph[key].push(d);\n graph[nKey].push(opposite[d]);\n stack.push(n);\n moved = true;\n break;\n }\n }\n if (!moved) {\n stack.pop();\n }\n }\n return graph;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/path-grid/./dist/browser/GridPathGenerator.js?\n}");
27
27
 
28
28
  /***/ }
29
29
 
@@ -6,14 +6,14 @@ const dirs = [
6
6
  Vector.create(originPoint.x, -identity),
7
7
  ], opposite = [2, 3, 0, 1], minLength = 0;
8
8
  export class GridPathGenerator {
9
- options;
10
- _container;
11
9
  constructor(container) {
12
10
  this._container = container;
13
11
  this.options = {
14
12
  cellSize: 40,
15
13
  graph: undefined,
16
14
  autoMaze: false,
15
+ mazeWidth: 20,
16
+ mazeHeight: 20,
17
17
  };
18
18
  }
19
19
  generate(p) {
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const gridPathName = "gridPathGenerator";
2
2
  export async function loadGridPath(engine) {
3
- engine.checkVersion("4.0.0-alpha.14");
3
+ engine.checkVersion("4.0.0-alpha.8");
4
4
  await engine.register(e => {
5
5
  e.addPathGenerator(gridPathName, async (container) => {
6
6
  const { GridPathGenerator } = await import("./GridPathGenerator.js");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsparticles/path-grid",
3
- "version": "4.0.0-alpha.14",
4
- "description": "tsParticles grid path",
3
+ "version": "4.0.0-alpha.8",
4
+ "description": "tsParticles grid path path",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
7
7
  "type": "git",
@@ -104,7 +104,7 @@
104
104
  "./package.json": "./package.json"
105
105
  },
106
106
  "dependencies": {
107
- "@tsparticles/engine": "4.0.0-alpha.14"
107
+ "@tsparticles/engine": "4.0.0-alpha.8"
108
108
  },
109
109
  "type": "module"
110
110
  }
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/path-grid [2 Feb 2026 at 17:58]</title>
6
+ <title>@tsparticles/path-grid [30 Jan 2026 at 10:14]</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.14
7
+ * v4.0.0-alpha.8
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -34,7 +34,7 @@ return /******/ (() => { // webpackBootstrap
34
34
  \*******************************/
35
35
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
36
 
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ gridPathName: () => (/* binding */ gridPathName),\n/* harmony export */ loadGridPath: () => (/* binding */ loadGridPath)\n/* harmony export */ });\nconst gridPathName = \"gridPathGenerator\";\nasync function loadGridPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.14\");\n await engine.register((e)=>{\n e.addPathGenerator(gridPathName, async (container)=>{\n const { GridPathGenerator } = await __webpack_require__.e(/*! import() */ \"dist_browser_GridPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./GridPathGenerator.js */ \"./dist/browser/GridPathGenerator.js\"));\n return new GridPathGenerator(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-grid/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ gridPathName: () => (/* binding */ gridPathName),\n/* harmony export */ loadGridPath: () => (/* binding */ loadGridPath)\n/* harmony export */ });\nconst gridPathName = \"gridPathGenerator\";\nasync function loadGridPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.8\");\n await engine.register(e => {\n e.addPathGenerator(gridPathName, async container => {\n const {\n GridPathGenerator\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_GridPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./GridPathGenerator.js */ \"./dist/browser/GridPathGenerator.js\"));\n return new GridPathGenerator(container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/path-grid/./dist/browser/index.js?\n}");
38
38
 
39
39
  /***/ },
40
40
 
@@ -118,18 +118,6 @@ 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
- /******/
133
121
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
134
122
  /******/ (() => {
135
123
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
@@ -194,8 +182,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
194
182
  /******/ /* webpack/runtime/publicPath */
195
183
  /******/ (() => {
196
184
  /******/ var scriptUrl;
197
- /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
198
- /******/ var document = __webpack_require__.g.document;
185
+ /******/ if (globalThis.importScripts) scriptUrl = globalThis.location + "";
186
+ /******/ var document = globalThis.document;
199
187
  /******/ if (!scriptUrl && document) {
200
188
  /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
201
189
  /******/ scriptUrl = document.currentScript.src;
@@ -1,2 +1,2 @@
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 a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e](r,r.exports,a),r.exports}a.m=i,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,o)=>{if(s[e])return void s[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/path-grid:"+r){i=l;break}}i||(n=!0,(i=document.createElement("script")).charset="utf-8",a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack","@tsparticles/path-grid:"+r),i.src=e),s[e]=[t];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=s[e];if(delete s[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)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(c=a.g.location+"");var s,c,p=a.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");a.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={80:0},a.f.j=(e,r)=>{var o=a.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=a.p+a.u(e),s=Error();a.l(n,r=>{if(a.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;s.message="Loading chunk "+e+` failed.
2
- (`+i+": "+n+")",s.name="ChunkLoadError",s.type=i,s.request=n,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,i,[n,s,c]=r,p=0;if(n.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);c&&c(a)}for(e&&e(r);p<n.length;p++)i=n[p],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},(o=this.webpackChunk_tsparticles_path_grid=this.webpackChunk_tsparticles_path_grid||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};a.r(d),a.d(d,{gridPathName:()=>f,loadGridPath:()=>h});let f="gridPathGenerator";async function h(e){e.checkVersion("4.0.0-alpha.14"),await e.register(e=>{e.addPathGenerator(f,async e=>{let{GridPathGenerator:t}=await a.e(915).then(a.bind(a,915));return new t(e)})})}return d})());
1
+ /*! For license information please see tsparticles.path.grid.min.js.LICENSE.txt */
2
+ !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],r);else{var t="object"==typeof exports?r(require("@tsparticles/engine")):r(e.window);for(var o in t)("object"==typeof exports?exports:e)[o]=t[o]}}(this,(e=>(()=>{var r,t,o={303(r){r.exports=e}},a={};function i(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={exports:{}};return o[e](t,t.exports,i),t.exports}i.m=o,i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((r,t)=>(i.f[t](e,r),r)),[])),i.u=e=>e+".min.js",i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="@tsparticles/path-grid:",i.l=(e,o,a,n)=>{if(r[e])r[e].push(o);else{var s,l;if(void 0!==a)for(var p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var d=p[c];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==t+a){s=d;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",t+a),s.src=e),r[e]=[o];var u=(t,o)=>{s.onerror=s.onload=null,clearTimeout(f);var a=r[e];if(delete r[e],s.parentNode&&s.parentNode.removeChild(s),a&&a.forEach((e=>e(o))),t)return t(o)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=u.bind(null,s.onerror),s.onload=u.bind(null,s.onload),l&&document.head.appendChild(s)}},i.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 r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={80:0};i.f.j=(r,t)=>{var o=i.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise(((t,a)=>o=e[r]=[t,a]));t.push(o[2]=a);var n=i.p+i.u(r),s=new Error;i.l(n,(t=>{if(i.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;s.message="Loading chunk "+r+" failed.\n("+a+": "+n+")",s.name="ChunkLoadError",s.type=a,s.request=n,o[1](s)}}),"chunk-"+r,r)}};var r=(r,t)=>{var o,a,[n,s,l]=t,p=0;if(n.some((r=>0!==e[r]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(l)l(i)}for(r&&r(t);p<n.length;p++)a=n[p],i.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=this.webpackChunk_tsparticles_path_grid=this.webpackChunk_tsparticles_path_grid||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var n={};i.r(n),i.d(n,{gridPathName:()=>s,loadGridPath:()=>l});const s="gridPathGenerator";async function l(e){e.checkVersion("4.0.0-alpha.8"),await e.register((e=>{e.addPathGenerator(s,(async e=>{const{GridPathGenerator:r}=await i.e(912).then(i.bind(i,912));return new r(e)}))}))}return n})()));
@@ -0,0 +1 @@
1
+ /*! tsParticles Grid Path Path v4.0.0-alpha.8 by Matteo Bruni */
@@ -2,4 +2,6 @@ export interface IGridPathOptions {
2
2
  autoMaze?: boolean;
3
3
  cellSize: number;
4
4
  graph?: Record<string, number[]>;
5
+ mazeHeight?: number;
6
+ mazeWidth?: number;
5
7
  }
@@ -18,14 +18,14 @@
18
18
  engine_1.Vector.create(engine_1.originPoint.x, -engine_1.identity),
19
19
  ], opposite = [2, 3, 0, 1], minLength = 0;
20
20
  class GridPathGenerator {
21
- options;
22
- _container;
23
21
  constructor(container) {
24
22
  this._container = container;
25
23
  this.options = {
26
24
  cellSize: 40,
27
25
  graph: undefined,
28
26
  autoMaze: false,
27
+ mazeWidth: 20,
28
+ mazeHeight: 20,
29
29
  };
30
30
  }
31
31
  generate(p) {
package/umd/index.js CHANGED
@@ -47,7 +47,7 @@ var __importStar = (this && this.__importStar) || (function () {
47
47
  exports.loadGridPath = loadGridPath;
48
48
  exports.gridPathName = "gridPathGenerator";
49
49
  async function loadGridPath(engine) {
50
- engine.checkVersion("4.0.0-alpha.14");
50
+ engine.checkVersion("4.0.0-alpha.8");
51
51
  await engine.register(e => {
52
52
  e.addPathGenerator(exports.gridPathName, async (container) => {
53
53
  const { GridPathGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./GridPathGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./GridPathGenerator.js"], resolve_1, reject_1); }).then(__importStar));
package/915.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_path_grid=this.webpackChunk_tsparticles_path_grid||[]).push([[915],{915(t,i,e){e.d(i,{GridPathGenerator:()=>s});var o=e(303);let n=[o.Vector.create(o.identity,o.originPoint.y),o.Vector.create(o.originPoint.x,o.identity),o.Vector.create(-o.identity,o.originPoint.y),o.Vector.create(o.originPoint.x,-o.identity)],r=[2,3,0,1];class s{options;_container;constructor(t){this._container=t,this.options={cellSize:40,graph:void 0,autoMaze:!1}}generate(t){let i=this.options.cellSize;t.grid??={direction:Math.trunc((0,o.getRandom)()*n.length),speed:t.velocity.length,cellPosition:{x:Math.floor(t.position.x/i),y:Math.floor(t.position.y/i)}};let e=t.grid,r={x:Math.floor(t.position.x/i),y:Math.floor(t.position.y/i)};if(r.x!==e.cellPosition.x||r.y!==e.cellPosition.y){e.cellPosition.x=r.x,e.cellPosition.y=r.y;let t=`${r.x},${r.y}`,i=this.options.graph?.[t];if(i&&i.length>0)e.direction=i[Math.trunc((0,o.getRandom)()*i.length)];else if(!this.options.graph){let t=Math.trunc(3*(0,o.getRandom)())-1;e.direction=(e.direction+t+4)%n.length}}t.velocity.x=0,t.velocity.y=0;let s=n[e.direction];return o.Vector.create(s.x*e.speed,s.y*e.speed)}init(){let t=this._container.actualOptions.particles.move.path.options;if(this.options.cellSize=t.cellSize??this.options.cellSize,this.options.autoMaze=t.autoMaze??this.options.autoMaze,this.options.graph=t.graph,this.options.autoMaze){let t=this._container.canvas.size,i=this.options.cellSize,e={width:Math.ceil(t.width/i),height:Math.ceil(t.height/i)};this.options.graph=this._generateMazeGraph(e)}}reset(t){delete t.grid}update(){}_generateMazeGraph({height:t,width:i}){let e={},n=[];for(let i=0;i<t;i++)n[i]=[];let s=[{x:o.originPoint.x,y:o.originPoint.y}];for(;s.length>0;){let{x:a,y:l}=s[s.length-1];n[l][a]||(n[l][a]=!0);let h=[0,1,2,3].sort(()=>(0,o.getRandom)()-.5),c=!1;for(let o of h){let h={x:a+(0===o?1:2===o?-1:0),y:l+(1===o?1:3===o?-1:0)};if(!(h.x<0)&&!(h.y<0)&&!(h.x>=i)&&!(h.y>=t)&&!n[h.y][h.x]){let t=`${a},${l}`,i=`${h.x},${h.y}`;e[t]??=[],e[i]??=[],e[t].push(o),e[i].push(r[o]),s.push(h),c=!0;break}}c||s.pop()}return e}}}}]);