@tsparticles/plugin-emitters-shape-polygon 3.4.0 → 3.6.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.
package/cjs/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadEmittersShapePolygon = void 0;
3
+ exports.loadEmittersShapePolygon = loadEmittersShapePolygon;
4
4
  const EmittersPolygonShapeGenerator_js_1 = require("./EmittersPolygonShapeGenerator.js");
5
5
  async function loadEmittersShapePolygon(engine, refresh = true) {
6
6
  const emittersEngine = engine;
7
7
  emittersEngine.addEmitterShapeGenerator?.("polygon", new EmittersPolygonShapeGenerator_js_1.EmittersPolygonShapeGenerator());
8
8
  await emittersEngine.refresh(refresh);
9
9
  }
10
- exports.loadEmittersShapePolygon = loadEmittersShapePolygon;
package/cjs/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPointInPolygon = exports.generateRandomPointOnPolygonPerimeter = exports.generateRandomPointWithinPolygon = exports.generateRandomPolygon = void 0;
3
+ exports.generateRandomPolygon = generateRandomPolygon;
4
+ exports.generateRandomPointWithinPolygon = generateRandomPointWithinPolygon;
5
+ exports.generateRandomPointOnPolygonPerimeter = generateRandomPointOnPolygonPerimeter;
6
+ exports.isPointInPolygon = isPointInPolygon;
4
7
  const engine_1 = require("@tsparticles/engine");
5
8
  const double = 2, doublePI = Math.PI * double, defaultRotation = 0, maxAttempts = 100;
6
9
  function generateRandomPolygon(position, sides, radius, rotationAngle = defaultRotation) {
@@ -14,7 +17,6 @@ function generateRandomPolygon(position, sides, radius, rotationAngle = defaultR
14
17
  }
15
18
  return polygon;
16
19
  }
17
- exports.generateRandomPolygon = generateRandomPolygon;
18
20
  function generateRandomPointWithinPolygon(polygon) {
19
21
  const firstIndex = 0, firstPoint = polygon[firstIndex], min = { ...firstPoint }, max = { ...firstPoint };
20
22
  for (const point of polygon) {
@@ -44,12 +46,10 @@ function generateRandomPointWithinPolygon(polygon) {
44
46
  }
45
47
  return randomPoint;
46
48
  }
47
- exports.generateRandomPointWithinPolygon = generateRandomPointWithinPolygon;
48
49
  function generateRandomPointOnPolygonPerimeter(polygon) {
49
50
  const sideIndex = Math.floor((0, engine_1.getRandom)() * polygon.length), startPoint = polygon[sideIndex], offset = 1, endPoint = polygon[(sideIndex + offset) % polygon.length], t = (0, engine_1.getRandom)();
50
51
  return { x: startPoint.x + (endPoint.x - startPoint.x) * t, y: startPoint.y + (endPoint.y - startPoint.y) * t };
51
52
  }
52
- exports.generateRandomPointOnPolygonPerimeter = generateRandomPointOnPolygonPerimeter;
53
53
  function isPointInPolygon(point, polygon) {
54
54
  let inside = false;
55
55
  const offset = 1;
@@ -62,4 +62,3 @@ function isPointInPolygon(point, polygon) {
62
62
  }
63
63
  return inside;
64
64
  }
65
- exports.isPointInPolygon = isPointInPolygon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-emitters-shape-polygon",
3
- "version": "3.4.0",
3
+ "version": "3.6.0-beta.0",
4
4
  "description": "tsParticles emitters shape polygon plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,8 +100,8 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "^3.4.0",
104
- "@tsparticles/plugin-emitters": "^3.4.0"
103
+ "@tsparticles/engine": "^3.6.0-beta.0",
104
+ "@tsparticles/plugin-emitters": "^3.6.0-beta.0"
105
105
  },
106
106
  "publishConfig": {
107
107
  "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-emitters-shape-polygon [13 May 2024 at 00:16]</title>
6
+ <title>@tsparticles/plugin-emitters-shape-polygon [7 Oct 2024 at 10:42]</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/fqJYOZYcn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wY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+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
- * v3.4.0
7
+ * v3.6.0-beta.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.emitters.shape.polygon.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):t(e.window,e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,((e,t)=>(()=>{var o={303:e=>{e.exports=t},526: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 o[e](r,r.exports,s),r.exports}s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{s.r(r),s.d(r,{loadEmittersShapePolygon:()=>c});var e=s(526),t=s(303);const o=2*Math.PI;function n(e,t,n,s=0){const r=[],i=o/t;for(let o=0;o<t;o++){const t=i*o+s;r.push({x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)})}return r}function i(e,t){let o=!1;for(let n=0,s=t.length-1;n<t.length;s=n++){const r=t[n],i=t[s];r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(o=!o)}return o}class a extends e.EmitterShapeBase{constructor(e,o,s,r){super(e,o,s,r),this.sides=r.sides,this.angle=(0,t.degToRad)(r.angle),this.polygon=n(e,this.sides,.5*o.width,this.angle)}async init(){}randomPosition(){const e=this.fill,o=this.polygon,n=e?function(e){const o=e[0],n={...o},s={...o};for(const t of e)t.x<n.x&&(n.x=t.x),t.x>s.x&&(s.x=t.x),t.y<n.y&&(n.y=t.y),t.y>s.y&&(s.y=t.y);let r=null;for(let o=0;o<100;o++){const o={x:n.x+(0,t.getRandom)()*(s.x-n.x),y:n.y+(0,t.getRandom)()*(s.y-n.y)};if(i(o,e)){r=o;break}}return r}(o):function(e){const o=Math.floor((0,t.getRandom)()*e.length),n=e[o],s=e[(o+1)%e.length],r=(0,t.getRandom)();return{x:n.x+(s.x-n.x)*r,y:n.y+(s.y-n.y)*r}}(o);return n?{position:n}:null}resize(e,t){super.resize(e,t),this.polygon=n(e,this.sides,.5*t.width,this.angle)}}class l{constructor(){this.angle=0,this.sides=5}load(e){e&&(void 0!==e.angle&&(this.angle=e.angle),void 0!==e.sides&&(this.sides=e.sides))}}class y{generate(e,t,o,n){const s=new l;return s.load(n),new a(e,t,o,s)}}async function c(e,t=!0){const o=e;o.addEmitterShapeGenerator?.("polygon",new y),await o.refresh(t)}})(),r})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-emitters","@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):t(e.window,e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,((e,t)=>(()=>{var o={303:e=>{e.exports=t},526: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 o[e](r,r.exports,s),r.exports}s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};s.r(r),s.d(r,{loadEmittersShapePolygon:()=>f});var i=s(526),a=s(303);const l=2*Math.PI;function y(e,t,o,n=0){const s=[],r=l/t;for(let i=0;i<t;i++){const t=r*i+n;s.push({x:e.x+o*Math.cos(t),y:e.y+o*Math.sin(t)})}return s}function c(e,t){let o=!1;for(let n=0,s=t.length-1;n<t.length;s=n++){const r=t[n],i=t[s];r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(o=!o)}return o}class d extends i.EmitterShapeBase{constructor(e,t,o,n){super(e,t,o,n),this.sides=n.sides,this.angle=(0,a.degToRad)(n.angle),this.polygon=y(e,this.sides,.5*t.width,this.angle)}async init(){}randomPosition(){const e=this.fill,t=this.polygon,o=e?function(e){const t=e[0],o={...t},n={...t};for(const t of e)t.x<o.x&&(o.x=t.x),t.x>n.x&&(n.x=t.x),t.y<o.y&&(o.y=t.y),t.y>n.y&&(n.y=t.y);let s=null;for(let t=0;t<100;t++){const t={x:o.x+(0,a.getRandom)()*(n.x-o.x),y:o.y+(0,a.getRandom)()*(n.y-o.y)};if(c(t,e)){s=t;break}}return s}(t):function(e){const t=Math.floor((0,a.getRandom)()*e.length),o=e[t],n=e[(t+1)%e.length],s=(0,a.getRandom)();return{x:o.x+(n.x-o.x)*s,y:o.y+(n.y-o.y)*s}}(t);return o?{position:o}:null}resize(e,t){super.resize(e,t),this.polygon=y(e,this.sides,.5*t.width,this.angle)}}class p{constructor(){this.angle=0,this.sides=5}load(e){e&&(void 0!==e.angle&&(this.angle=e.angle),void 0!==e.sides&&(this.sides=e.sides))}}class u{generate(e,t,o,n){const s=new p;return s.load(n),new d(e,t,o,s)}}async function f(e,t=!0){const o=e;o.addEmitterShapeGenerator?.("polygon",new u),await o.refresh(t)}return r})()));
@@ -1 +1 @@
1
- /*! tsParticles Emitters Shape Polygon Plugin v3.4.0 by Matteo Bruni */
1
+ /*! tsParticles Emitters Shape Polygon Plugin v3.6.0-beta.0 by Matteo Bruni */
package/umd/index.js CHANGED
@@ -9,12 +9,11 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.loadEmittersShapePolygon = void 0;
12
+ exports.loadEmittersShapePolygon = loadEmittersShapePolygon;
13
13
  const EmittersPolygonShapeGenerator_js_1 = require("./EmittersPolygonShapeGenerator.js");
14
14
  async function loadEmittersShapePolygon(engine, refresh = true) {
15
15
  const emittersEngine = engine;
16
16
  emittersEngine.addEmitterShapeGenerator?.("polygon", new EmittersPolygonShapeGenerator_js_1.EmittersPolygonShapeGenerator());
17
17
  await emittersEngine.refresh(refresh);
18
18
  }
19
- exports.loadEmittersShapePolygon = loadEmittersShapePolygon;
20
19
  });
package/umd/utils.js CHANGED
@@ -9,7 +9,10 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.isPointInPolygon = exports.generateRandomPointOnPolygonPerimeter = exports.generateRandomPointWithinPolygon = exports.generateRandomPolygon = void 0;
12
+ exports.generateRandomPolygon = generateRandomPolygon;
13
+ exports.generateRandomPointWithinPolygon = generateRandomPointWithinPolygon;
14
+ exports.generateRandomPointOnPolygonPerimeter = generateRandomPointOnPolygonPerimeter;
15
+ exports.isPointInPolygon = isPointInPolygon;
13
16
  const engine_1 = require("@tsparticles/engine");
14
17
  const double = 2, doublePI = Math.PI * double, defaultRotation = 0, maxAttempts = 100;
15
18
  function generateRandomPolygon(position, sides, radius, rotationAngle = defaultRotation) {
@@ -23,7 +26,6 @@
23
26
  }
24
27
  return polygon;
25
28
  }
26
- exports.generateRandomPolygon = generateRandomPolygon;
27
29
  function generateRandomPointWithinPolygon(polygon) {
28
30
  const firstIndex = 0, firstPoint = polygon[firstIndex], min = { ...firstPoint }, max = { ...firstPoint };
29
31
  for (const point of polygon) {
@@ -53,12 +55,10 @@
53
55
  }
54
56
  return randomPoint;
55
57
  }
56
- exports.generateRandomPointWithinPolygon = generateRandomPointWithinPolygon;
57
58
  function generateRandomPointOnPolygonPerimeter(polygon) {
58
59
  const sideIndex = Math.floor((0, engine_1.getRandom)() * polygon.length), startPoint = polygon[sideIndex], offset = 1, endPoint = polygon[(sideIndex + offset) % polygon.length], t = (0, engine_1.getRandom)();
59
60
  return { x: startPoint.x + (endPoint.x - startPoint.x) * t, y: startPoint.y + (endPoint.y - startPoint.y) * t };
60
61
  }
61
- exports.generateRandomPointOnPolygonPerimeter = generateRandomPointOnPolygonPerimeter;
62
62
  function isPointInPolygon(point, polygon) {
63
63
  let inside = false;
64
64
  const offset = 1;
@@ -71,5 +71,4 @@
71
71
  }
72
72
  return inside;
73
73
  }
74
- exports.isPointInPolygon = isPointInPolygon;
75
74
  });