@tsparticles/plugin-poisson-disc 4.0.0-beta.12 → 4.0.0-beta.15

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,2 +1 @@
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/plugin-poisson-disc:"+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/plugin-poisson-disc:"+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={189: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_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.12"),await e.pluginManager.register(async e=>{let{PoissonDiscPlugin:t}=await a.e(87).then(a.bind(a,87));e.pluginManager.addPlugin(new t)})}return a.r(d),a.d(d,{loadPoissonDiscPlugin:()=>f}),d})());
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/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.poisson=s.__tsParticlesInternals.plugins.poisson||{}),s.__tsParticlesInternals.engine)}(this,function(s,t){"use strict";class i{dimensions;enable;radius;retries;steps;constructor(){this.enable=!1,this.dimensions=2,this.radius=0,this.retries=30,this.steps=0}load(s){t.isNull(s)||(void 0!==s.enable&&(this.enable=s.enable),void 0!==s.dimensions&&(this.dimensions=s.dimensions),void 0!==s.radius&&(this.radius=s.radius),void 0!==s.retries&&(this.retries=s.retries))}}class e{id="poisson";async getPlugin(s){const{PoissonDiscPluginInstance:t}=await Promise.resolve().then(function(){return r});return new t(s)}loadOptions(s,t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let n=t.poisson;void 0===n?.load&&(t.poisson=n=new i),n.load(e?.poisson)}needsPlugin(s){return s?.poisson?.enable??!1}}async function n(s){s.checkVersion("4.0.0-beta.15"),await s.pluginManager.register(s=>{s.pluginManager.addPlugin(new e)})}const a=globalThis;a.__tsParticlesInternals=a.__tsParticlesInternals??{},a.loadPoissonDiscPlugin=n;var r=Object.freeze({__proto__:null,PoissonDiscPluginInstance:class{poissonDisc;redrawTimeout;_container;_currentIndex;constructor(s){this._container=s,this._currentIndex=0}async init(){await this._initData()}particlePosition(s){const t=this._container.actualOptions.poisson;if(this.poissonDisc&&t?.enable&&!(this._currentIndex>=this.poissonDisc.points.length))return s??this.poissonDisc.points[this._currentIndex++]?.position}resize(){const s=this._container,t=s.actualOptions.poisson;if(!t?.enable)return;this.redrawTimeout&&clearTimeout(this.redrawTimeout);this.redrawTimeout=setTimeout(()=>{(async()=>{this._container.destroyed||(await this._initData(),await s.particles.redraw())})()},250)}stop(){delete this.poissonDisc}async _initData(){const s=this._container,i=s.actualOptions.poisson,e=s.actualOptions.particles,n=s.canvas.size,a=s.retina.pixelRatio;if(!i?.enable)return;this._currentIndex=0;const{PoissonDisc:r}=await Promise.resolve().then(function(){return l});this.poissonDisc=new r(n,i.radius?i.radius*a:Math.max(t.getRangeMax(e.size.value)*a,Math.sqrt(n.width*n.height/e.number.value)),i.retries,i.dimensions);i.steps>0?this.poissonDisc.steps(i.steps):await this.poissonDisc.run()}}});var l=Object.freeze({__proto__:null,PoissonDisc:class{active;cellSize;cols;dimensions;firstPoint;grid;points;radius;retries;rows;size;constructor(s,t,i,e,n){this.size={...s},this.radius=t,this.retries=i,this.dimensions=e,this.cellSize=Math.floor(this.radius/Math.sqrt(this.dimensions)),this.cols=Math.floor(this.size.width/this.cellSize),this.rows=Math.floor(this.size.height/this.cellSize),this.points=[],this.active=[],this.grid=[],this.firstPoint=n?{...n}:void 0,this.reset()}addPoint(s){const t={position:{...s},gridPosition:{x:Math.floor(s.x/this.cellSize),y:Math.floor(s.y/this.cellSize)}},i=this.points.length,e=this.grid[t.gridPosition.y];e&&(this.points.push(t),e[t.gridPosition.x]=i,this.active.push(i))}getRandom(s,i){return Math.floor(t.getRandom()*(i-s))+s}initialiseGrid(){for(let s=0;s<=this.rows;s++){this.grid[s]=[];const t=this.grid[s];if(t)for(let s=0;s<=this.cols;s++)t[s]=-1}}reset(){if(this.points=[],this.active=[],this.grid=[],this.initialiseGrid(),this.firstPoint)this.addPoint(this.firstPoint);else{const s=0;this.addPoint({x:this.getRandom(s,this.size.width),y:this.getRandom(s,this.size.height)})}}async run(){this.reset();let s=0;for(;this.active.length>0;)this.steps(1),++s%100==0&&await new Promise(s=>setTimeout(s))}steps(s){for(let t=0;t<s;t++)this.active.length<=0||this._step()}_getNewPoint(s,i){const e=i*(t.doublePI/this.retries),n=this.getRandom(this.radius,this.radius*t.double),a=Math.cos(e)*n,r=Math.sin(e)*n,l={x:Math.floor(s.position.x+a),y:Math.floor(s.position.y+r)},o=Math.floor(l.x/this.cellSize),c=Math.floor(l.y/this.cellSize);if(l.x<=0||l.x>=this.size.width||l.y<=0||l.y>=this.size.height)return;const _=this.grid[c];if(!_)return;const h=_[o];if(void 0!==h&&!(h>=0)){for(let s=-1;s<=1;s++)for(let i=-1;i<=1;i++){if(!s&&!i)continue;const e={x:o+i,y:c+s};if(e.x<0||e.y<0||e.x>=this.cols||e.y>=this.rows)continue;const n=this.grid[e.y]?.[e.x];if(void 0===n||n<0)continue;const a=this.points[n];if(a&&t.getDistance(l,a.position)<this.radius)return}return l}}_step(){const s=this.getRandom(0,this.active.length);let t=!1;for(let i=0;i<this.retries;i++){const e=this.active[s];if(void 0===e)continue;const n=this.points[e];if(!n)continue;const a=this._getNewPoint(n,i);if(a){t=!0,this.addPoint(a);break}}if(!t){const t=1;this.active.splice(s,t)}}}});s.loadPoissonDiscPlugin=n}),Object.assign(globalThis.window||globalThis,{loadPoissonDiscPlugin:(globalThis.__tsParticlesInternals.plugins.poisson||{}).loadPoissonDiscPlugin}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -0,0 +1 @@
1
+ export * from "./index.js";
@@ -0,0 +1,2 @@
1
+ import { type Engine } from "@tsparticles/engine/lazy";
2
+ export declare function loadPoissonDiscPlugin(engine: Engine): Promise<void>;
package/41.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_poisson_disc=this.webpackChunk_tsparticles_plugin_poisson_disc||[]).push([[41],{41(i,t,s){s.d(t,{PoissonDisc:()=>h});var e=s(303);class h{active;cellSize;cols;dimensions;firstPoint;grid;points;radius;retries;rows;size;constructor(i,t,s,e,h){this.size={...i},this.radius=t,this.retries=s,this.dimensions=e,this.cellSize=Math.floor(this.radius/Math.sqrt(this.dimensions)),this.cols=Math.floor(this.size.width/this.cellSize),this.rows=Math.floor(this.size.height/this.cellSize),this.points=[],this.active=[],this.grid=[],this.firstPoint=h?{...h}:void 0,this.reset()}addPoint(i){let t={position:{...i},gridPosition:{x:Math.floor(i.x/this.cellSize),y:Math.floor(i.y/this.cellSize)}},s=this.points.length,e=this.grid[t.gridPosition.y];e&&(this.points.push(t),e[t.gridPosition.x]=s,this.active.push(s))}getRandom(i,t){return Math.floor((0,e.getRandom)()*(t-i))+i}initialiseGrid(){for(let i=0;i<=this.rows;i++){this.grid[i]=[];let t=this.grid[i];if(t)for(let i=0;i<=this.cols;i++)t[i]=-1}}reset(){this.points=[],this.active=[],this.grid=[],this.initialiseGrid(),this.firstPoint?this.addPoint(this.firstPoint):this.addPoint({x:this.getRandom(0,this.size.width),y:this.getRandom(0,this.size.height)})}async run(){this.reset();let i=0;for(;this.active.length>0;)this.steps(1),++i%100==0&&await new Promise(i=>setTimeout(i))}steps(i){for(let t=0;t<i;t++)this.active.length<=0||this._step()}_getNewPoint(i,t){let s=t*(e.doublePI/this.retries),h=this.getRandom(this.radius,this.radius*e.double),o={x:Math.cos(s)*h,y:Math.sin(s)*h},r={x:Math.floor(i.position.x+o.x),y:Math.floor(i.position.y+o.y)},n={x:Math.floor(r.x/this.cellSize),y:Math.floor(r.y/this.cellSize)};if(r.x<=0||r.x>=this.size.width||r.y<=0||r.y>=this.size.height)return;let l=this.grid[n.y];if(!l)return;let a=l[n.x];if(void 0!==a&&!(a>=0)){for(let i=-1;i<=1;i++)for(let t=-1;t<=1;t++){if(!i&&!t)continue;let s={x:n.x+t,y:n.y+i};if(s.x<0||s.y<0||s.x>=this.cols||s.y>=this.rows)continue;let h=this.grid[s.y]?.[s.x];if(void 0===h||h<0)continue;let o=this.points[h];if(o&&(0,e.getDistance)(r,o.position)<this.radius)return}return r}}_step(){let i=this.getRandom(0,this.active.length),t=!1;for(let s=0;s<this.retries;s++){let e=this.active[i];if(void 0===e)continue;let h=this.points[e];if(!h)continue;let o=this._getNewPoint(h,s);if(o){t=!0,this.addPoint(o);break}}t||this.active.splice(i,1)}}}}]);
package/87.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_poisson_disc=this.webpackChunk_tsparticles_plugin_poisson_disc||[]).push([[87],{87(s,i,e){e.d(i,{PoissonDiscPlugin:()=>o});var n=e(303);class t{dimensions;enable;radius;retries;steps;constructor(){this.enable=!1,this.dimensions=2,this.radius=0,this.retries=30,this.steps=0}load(s){(0,n.isNull)(s)||(void 0!==s.enable&&(this.enable=s.enable),void 0!==s.dimensions&&(this.dimensions=s.dimensions),void 0!==s.radius&&(this.radius=s.radius),void 0!==s.retries&&(this.retries=s.retries))}}class o{id="poisson";async getPlugin(s){let{PoissonDiscPluginInstance:i}=await e.e(945).then(e.bind(e,945));return new i(s)}loadOptions(s,i,e){if(!this.needsPlugin(i)&&!this.needsPlugin(e))return;let n=i.poisson;n?.load===void 0&&(i.poisson=n=new t),n.load(e?.poisson)}needsPlugin(s){return s?.poisson?.enable??!1}}}}]);
package/945.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_poisson_disc=this.webpackChunk_tsparticles_plugin_poisson_disc||[]).push([[945],{945(i,s,t){t.d(s,{PoissonDiscPluginInstance:()=>n});var e=t(303);class n{poissonDisc;redrawTimeout;_container;_currentIndex;constructor(i){this._container=i,this._currentIndex=0}async init(){await this._initData()}particlePosition(i){let s=this._container.actualOptions.poisson;if(this.poissonDisc&&s?.enable&&!(this._currentIndex>=this.poissonDisc.points.length))return i??this.poissonDisc.points[this._currentIndex++]?.position}resize(){let i=this._container,s=i.actualOptions.poisson;s?.enable&&(this.redrawTimeout&&clearTimeout(this.redrawTimeout),this.redrawTimeout=setTimeout(()=>{(async()=>{this._container.destroyed||(await this._initData(),await i.particles.redraw())})()},250))}stop(){delete this.poissonDisc}async _initData(){let i=this._container,s=i.actualOptions.poisson,n=i.actualOptions.particles,a=i.canvas.size,o=i.retina.pixelRatio;if(!s?.enable)return;this._currentIndex=0;let{PoissonDisc:r}=await t.e(41).then(t.bind(t,41));this.poissonDisc=new r(a,s.radius?s.radius*o:Math.max((0,e.getRangeMax)(n.size.value)*o,Math.sqrt(a.width*a.height/n.number.value)),s.retries,s.dimensions),s.steps>0?this.poissonDisc.steps(s.steps):await this.poissonDisc.run()}}}}]);
@@ -1,30 +0,0 @@
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.12
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_PoissonDiscPluginInstance_js"],{
19
-
20
- /***/ "./dist/browser/PoissonDiscPluginInstance.js"
21
- /*!***************************************************!*\
22
- !*** ./dist/browser/PoissonDiscPluginInstance.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 */ PoissonDiscPluginInstance: () => (/* binding */ PoissonDiscPluginInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass PoissonDiscPluginInstance {\n poissonDisc;\n redrawTimeout;\n _container;\n _currentIndex;\n constructor(container){\n this._container = container;\n this._currentIndex = 0;\n }\n async init() {\n await this._initData();\n }\n particlePosition(position) {\n const container = this._container, options = container.actualOptions.poisson;\n if (!this.poissonDisc || !(options?.enable ?? false) || this._currentIndex >= this.poissonDisc.points.length) {\n return;\n }\n return position ?? this.poissonDisc.points[this._currentIndex++]?.position;\n }\n resize() {\n const container = this._container, options = container.actualOptions.poisson;\n if (!(options?.enable ?? false)) {\n return;\n }\n if (this.redrawTimeout) {\n clearTimeout(this.redrawTimeout);\n }\n const timeout = 250;\n this.redrawTimeout = setTimeout(()=>{\n void (async ()=>{\n if (this._container.destroyed) {\n return;\n }\n await this._initData();\n await container.particles.redraw();\n })();\n }, timeout);\n }\n stop() {\n delete this.poissonDisc;\n }\n async _initData() {\n const container = this._container, poissonOptions = container.actualOptions.poisson, particlesOptions = container.actualOptions.particles, canvasSize = container.canvas.size, pixelRatio = container.retina.pixelRatio;\n if (!poissonOptions?.enable) {\n return;\n }\n this._currentIndex = 0;\n const { PoissonDisc } = await __webpack_require__.e(/*! import() */ \"dist_browser_PoissonDisc_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PoissonDisc.js */ \"./dist/browser/PoissonDisc.js\"));\n this.poissonDisc = new PoissonDisc(canvasSize, poissonOptions.radius ? poissonOptions.radius * pixelRatio : Math.max((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particlesOptions.size.value) * pixelRatio, Math.sqrt(canvasSize.width * canvasSize.height / particlesOptions.number.value)), poissonOptions.retries, poissonOptions.dimensions);\n const noSteps = 0;\n if (poissonOptions.steps > noSteps) {\n this.poissonDisc.steps(poissonOptions.steps);\n } else {\n await this.poissonDisc.run();\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/PoissonDiscPluginInstance.js?\n}");
27
-
28
- /***/ }
29
-
30
- }]);
@@ -1,40 +0,0 @@
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.12
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_PoissonDiscPlugin_js"],{
19
-
20
- /***/ "./dist/browser/Options/Classes/Poisson.js"
21
- /*!*************************************************!*\
22
- !*** ./dist/browser/Options/Classes/Poisson.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 */ Poisson: () => (/* binding */ Poisson)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass Poisson {\n dimensions;\n enable;\n radius;\n retries;\n steps;\n constructor(){\n this.enable = false;\n this.dimensions = 2;\n this.radius = 0;\n this.retries = 30;\n this.steps = 0;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.dimensions !== undefined) {\n this.dimensions = data.dimensions;\n }\n if (data.radius !== undefined) {\n this.radius = data.radius;\n }\n if (data.retries !== undefined) {\n this.retries = data.retries;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/Options/Classes/Poisson.js?\n}");
27
-
28
- /***/ },
29
-
30
- /***/ "./dist/browser/PoissonDiscPlugin.js"
31
- /*!*******************************************!*\
32
- !*** ./dist/browser/PoissonDiscPlugin.js ***!
33
- \*******************************************/
34
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
-
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PoissonDiscPlugin: () => (/* binding */ PoissonDiscPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Poisson_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Poisson.js */ \"./dist/browser/Options/Classes/Poisson.js\");\n\nclass PoissonDiscPlugin {\n id = \"poisson\";\n async getPlugin(container) {\n const { PoissonDiscPluginInstance } = await __webpack_require__.e(/*! import() */ \"dist_browser_PoissonDiscPluginInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PoissonDiscPluginInstance.js */ \"./dist/browser/PoissonDiscPluginInstance.js\"));\n return new PoissonDiscPluginInstance(container);\n }\n loadOptions(_container, options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let poissonOptions = options.poisson;\n if (poissonOptions?.load === undefined) {\n options.poisson = poissonOptions = new _Options_Classes_Poisson_js__WEBPACK_IMPORTED_MODULE_0__.Poisson();\n }\n poissonOptions.load(source?.poisson);\n }\n needsPlugin(options) {\n return options?.poisson?.enable ?? false;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/PoissonDiscPlugin.js?\n}");
37
-
38
- /***/ }
39
-
40
- }]);
@@ -1,30 +0,0 @@
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.12
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
- }]);