@tsparticles/plugin-emitters-shape-circle 3.0.2 → 3.1.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.
@@ -1,5 +1,6 @@
1
1
  import { EmitterShapeBase } from "@tsparticles/plugin-emitters";
2
2
  import { getRandom } from "@tsparticles/engine";
3
+ const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
3
4
  export class EmittersCircleShape extends EmitterShapeBase {
4
5
  constructor(position, size, fill, options) {
5
6
  super(position, size, fill, options);
@@ -8,25 +9,25 @@ export class EmittersCircleShape extends EmitterShapeBase {
8
9
  }
9
10
  async randomPosition() {
10
11
  const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
11
- const u = getRandom() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = getRandom();
12
- if (v < 0.25) {
12
+ const u = getRandom() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = getRandom();
13
+ if (v < quarter) {
13
14
  return theta;
14
15
  }
15
- else if (v < 0.5) {
16
+ else if (v < double * quarter) {
16
17
  return Math.PI - theta;
17
18
  }
18
- else if (v < 0.75) {
19
+ else if (v < double * quarter + quarter) {
19
20
  return Math.PI + theta;
20
21
  }
21
22
  else {
22
23
  return -theta;
23
24
  }
24
- }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
25
- return {
25
+ }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
26
+ return Promise.resolve({
26
27
  position: {
27
28
  x: position.x + randomRadius * Math.cos(randomTheta),
28
29
  y: position.y + randomRadius * Math.sin(randomTheta),
29
30
  },
30
- };
31
+ });
31
32
  }
32
33
  }
package/browser/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { EmittersCircleShapeGenerator } from "./EmittersCircleShapeGenerator.js";
2
2
  export async function loadEmittersShapeCircle(engine, refresh = true) {
3
3
  const emittersEngine = engine;
4
- emittersEngine.addEmitterShapeGenerator &&
5
- emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator());
4
+ emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
6
5
  await emittersEngine.refresh(refresh);
7
6
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmittersCircleShape = void 0;
4
4
  const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
5
5
  const engine_1 = require("@tsparticles/engine");
6
+ const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
6
7
  class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {
7
8
  constructor(position, size, fill, options) {
8
9
  super(position, size, fill, options);
@@ -11,26 +12,26 @@ class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {
11
12
  }
12
13
  async randomPosition() {
13
14
  const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
14
- const u = (0, engine_1.getRandom)() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = (0, engine_1.getRandom)();
15
- if (v < 0.25) {
15
+ const u = (0, engine_1.getRandom)() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = (0, engine_1.getRandom)();
16
+ if (v < quarter) {
16
17
  return theta;
17
18
  }
18
- else if (v < 0.5) {
19
+ else if (v < double * quarter) {
19
20
  return Math.PI - theta;
20
21
  }
21
- else if (v < 0.75) {
22
+ else if (v < double * quarter + quarter) {
22
23
  return Math.PI + theta;
23
24
  }
24
25
  else {
25
26
  return -theta;
26
27
  }
27
- }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
28
- return {
28
+ }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
29
+ return Promise.resolve({
29
30
  position: {
30
31
  x: position.x + randomRadius * Math.cos(randomTheta),
31
32
  y: position.y + randomRadius * Math.sin(randomTheta),
32
33
  },
33
- };
34
+ });
34
35
  }
35
36
  }
36
37
  exports.EmittersCircleShape = EmittersCircleShape;
package/cjs/index.js CHANGED
@@ -4,8 +4,7 @@ exports.loadEmittersShapeCircle = void 0;
4
4
  const EmittersCircleShapeGenerator_js_1 = require("./EmittersCircleShapeGenerator.js");
5
5
  async function loadEmittersShapeCircle(engine, refresh = true) {
6
6
  const emittersEngine = engine;
7
- emittersEngine.addEmitterShapeGenerator &&
8
- emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
7
+ emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
9
8
  await emittersEngine.refresh(refresh);
10
9
  }
11
10
  exports.loadEmittersShapeCircle = loadEmittersShapeCircle;
@@ -1,5 +1,6 @@
1
1
  import { EmitterShapeBase } from "@tsparticles/plugin-emitters";
2
2
  import { getRandom } from "@tsparticles/engine";
3
+ const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
3
4
  export class EmittersCircleShape extends EmitterShapeBase {
4
5
  constructor(position, size, fill, options) {
5
6
  super(position, size, fill, options);
@@ -8,25 +9,25 @@ export class EmittersCircleShape extends EmitterShapeBase {
8
9
  }
9
10
  async randomPosition() {
10
11
  const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
11
- const u = getRandom() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = getRandom();
12
- if (v < 0.25) {
12
+ const u = getRandom() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = getRandom();
13
+ if (v < quarter) {
13
14
  return theta;
14
15
  }
15
- else if (v < 0.5) {
16
+ else if (v < double * quarter) {
16
17
  return Math.PI - theta;
17
18
  }
18
- else if (v < 0.75) {
19
+ else if (v < double * quarter + quarter) {
19
20
  return Math.PI + theta;
20
21
  }
21
22
  else {
22
23
  return -theta;
23
24
  }
24
- }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
25
- return {
25
+ }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
26
+ return Promise.resolve({
26
27
  position: {
27
28
  x: position.x + randomRadius * Math.cos(randomTheta),
28
29
  y: position.y + randomRadius * Math.sin(randomTheta),
29
30
  },
30
- };
31
+ });
31
32
  }
32
33
  }
package/esm/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { EmittersCircleShapeGenerator } from "./EmittersCircleShapeGenerator.js";
2
2
  export async function loadEmittersShapeCircle(engine, refresh = true) {
3
3
  const emittersEngine = engine;
4
- emittersEngine.addEmitterShapeGenerator &&
5
- emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator());
4
+ emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
6
5
  await emittersEngine.refresh(refresh);
7
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-emitters-shape-circle",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "tsParticles emitters shape circle 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.0.2",
104
- "@tsparticles/plugin-emitters": "^3.0.2"
103
+ "@tsparticles/engine": "^3.1.0",
104
+ "@tsparticles/plugin-emitters": "^3.1.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-circle [6 Dec 2023 at 17:48]</title>
6
+ <title>@tsparticles/plugin-emitters-shape-circle [13 Jan 2024 at 23:10]</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>
@@ -31,7 +31,7 @@
31
31
  <body>
32
32
  <div id="app"></div>
33
33
  <script>
34
- window.chartData = [{"label":"tsparticles.plugin.emitters.shape.circle.js","isAsset":true,"statSize":1959,"parsedSize":6211,"gzipSize":1909,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":1875,"groups":[{"id":837,"label":"index.js + 2 modules (concatenated)","path":"./dist/browser/index.js + 2 modules (concatenated)","statSize":1875,"parsedSize":6211,"gzipSize":1909,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser","statSize":1875,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/index.js","statSize":361,"parsedSize":1195,"gzipSize":367,"inaccurateSizes":true},{"id":null,"label":"EmittersCircleShapeGenerator.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/EmittersCircleShapeGenerator.js","statSize":224,"parsedSize":742,"gzipSize":228,"inaccurateSizes":true},{"id":null,"label":"EmittersCircleShape.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/EmittersCircleShape.js","statSize":1290,"parsedSize":4273,"gzipSize":1313,"inaccurateSizes":true}],"parsedSize":6211,"gzipSize":1909,"inaccurateSizes":true}]}],"parsedSize":6211,"gzipSize":1909},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0},{"label":"plugin-emitters\",\"commonjs2\":\"@tsparticles/plugin-emitters\",\"amd\":\"@tsparticles","path":"./plugin-emitters\",\"commonjs2\":\"@tsparticles/plugin-emitters\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":68,"label":"plugin-emitters\",\"root\":\"window\"}","path":"./plugin-emitters\",\"commonjs2\":\"@tsparticles/plugin-emitters\",\"amd\":\"@tsparticles/plugin-emitters\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.plugin.emitters.shape.circle":true}}];
34
+ window.chartData = [{"label":"tsparticles.plugin.emitters.shape.circle.js","isAsset":true,"statSize":2094,"parsedSize":6426,"gzipSize":1974,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":2010,"groups":[{"id":409,"label":"index.js + 2 modules (concatenated)","path":"./dist/browser/index.js + 2 modules (concatenated)","statSize":2010,"parsedSize":6426,"gzipSize":1974,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser","statSize":2010,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/index.js","statSize":320,"parsedSize":1023,"gzipSize":314,"inaccurateSizes":true},{"id":null,"label":"EmittersCircleShapeGenerator.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/EmittersCircleShapeGenerator.js","statSize":224,"parsedSize":716,"gzipSize":219,"inaccurateSizes":true},{"id":null,"label":"EmittersCircleShape.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/EmittersCircleShape.js","statSize":1466,"parsedSize":4686,"gzipSize":1439,"inaccurateSizes":true}],"parsedSize":6426,"gzipSize":1974,"inaccurateSizes":true}]}],"parsedSize":6426,"gzipSize":1974},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0},{"label":"plugin-emitters\",\"commonjs2\":\"@tsparticles/plugin-emitters\",\"amd\":\"@tsparticles","path":"./plugin-emitters\",\"commonjs2\":\"@tsparticles/plugin-emitters\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":68,"label":"plugin-emitters\",\"root\":\"window\"}","path":"./plugin-emitters\",\"commonjs2\":\"@tsparticles/plugin-emitters\",\"amd\":\"@tsparticles/plugin-emitters\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.plugin.emitters.shape.circle":true}}];
35
35
  window.entrypoints = ["tsparticles.plugin.emitters.shape.circle","tsparticles.plugin.emitters.shape.circle.min"];
36
36
  window.defaultSizes = "parsed";
37
37
  </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.0.2
7
+ * v3.1.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -108,6 +108,11 @@ var engine_root_window_ = __webpack_require__(533);
108
108
  ;// CONCATENATED MODULE: ./dist/browser/EmittersCircleShape.js
109
109
 
110
110
 
111
+ const quarter = 0.25,
112
+ EmittersCircleShape_double = 2,
113
+ doublePI = Math.PI * EmittersCircleShape_double,
114
+ squareExp = 2,
115
+ half = 0.5;
111
116
  class EmittersCircleShape extends plugin_emitters_root_window_.EmitterShapeBase {
112
117
  constructor(position, size, fill, options) {
113
118
  super(position, size, fill, options);
@@ -118,30 +123,30 @@ class EmittersCircleShape extends plugin_emitters_root_window_.EmitterShapeBase
118
123
  fill = this.fill,
119
124
  position = this.position,
120
125
  generateTheta = (x, y) => {
121
- const u = (0,engine_root_window_.getRandom)() / 4.0,
122
- theta = Math.atan(y / x * Math.tan(2 * Math.PI * u)),
126
+ const u = (0,engine_root_window_.getRandom)() * quarter,
127
+ theta = Math.atan(y / x * Math.tan(doublePI * u)),
123
128
  v = (0,engine_root_window_.getRandom)();
124
- if (v < 0.25) {
129
+ if (v < quarter) {
125
130
  return theta;
126
- } else if (v < 0.5) {
131
+ } else if (v < EmittersCircleShape_double * quarter) {
127
132
  return Math.PI - theta;
128
- } else if (v < 0.75) {
133
+ } else if (v < EmittersCircleShape_double * quarter + quarter) {
129
134
  return Math.PI + theta;
130
135
  } else {
131
136
  return -theta;
132
137
  }
133
138
  },
134
- radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2),
135
- [a, b] = [size.width / 2, size.height / 2],
139
+ radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp),
140
+ [a, b] = [size.width * half, size.height * half],
136
141
  randomTheta = generateTheta(a, b),
137
142
  maxRadius = radius(a, b, randomTheta),
138
143
  randomRadius = fill ? maxRadius * Math.sqrt((0,engine_root_window_.getRandom)()) : maxRadius;
139
- return {
144
+ return Promise.resolve({
140
145
  position: {
141
146
  x: position.x + randomRadius * Math.cos(randomTheta),
142
147
  y: position.y + randomRadius * Math.sin(randomTheta)
143
148
  }
144
- };
149
+ });
145
150
  }
146
151
  }
147
152
  ;// CONCATENATED MODULE: ./dist/browser/EmittersCircleShapeGenerator.js
@@ -155,7 +160,7 @@ class EmittersCircleShapeGenerator {
155
160
 
156
161
  async function loadEmittersShapeCircle(engine, refresh = true) {
157
162
  const emittersEngine = engine;
158
- emittersEngine.addEmitterShapeGenerator && emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator());
163
+ emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
159
164
  await emittersEngine.refresh(refresh);
160
165
  }
161
166
  })();
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.emitters.shape.circle.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 r="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,((e,t)=>(()=>{"use strict";var r={533:e=>{e.exports=t},68:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{loadEmittersShapeCircle:()=>s});var e=i(68),t=i(533);class r extends e.EmitterShapeBase{constructor(e,t,r,o){super(e,t,r,o)}async init(){}async randomPosition(){const e=this.size,r=this.fill,o=this.position,[i,n]=[e.width/2,e.height/2],s=((e,r)=>{const o=(0,t.getRandom)()/4,i=Math.atan(r/e*Math.tan(2*Math.PI*o)),n=(0,t.getRandom)();return n<.25?i:n<.5?Math.PI-i:n<.75?Math.PI+i:-i})(i,n),a=(d=s,(c=i)*(l=n)/Math.sqrt((l*Math.cos(d))**2+(c*Math.sin(d))**2)),p=r?a*Math.sqrt((0,t.getRandom)()):a;var c,l,d;return{position:{x:o.x+p*Math.cos(s),y:o.y+p*Math.sin(s)}}}}class o{generate(e,t,o,i){return new r(e,t,o,i)}}async function s(e,t=!0){const r=e;r.addEmitterShapeGenerator&&r.addEmitterShapeGenerator("circle",new o),await r.refresh(t)}})(),n})()));
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 r="object"==typeof exports?t(require("@tsparticles/plugin-emitters"),require("@tsparticles/engine")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,((e,t)=>(()=>{"use strict";var r={533:e=>{e.exports=t},68:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,i),s.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{i.r(s),i.d(s,{loadEmittersShapeCircle:()=>p});var e=i(68),t=i(533);const r=.25,o=2*Math.PI;class n extends e.EmitterShapeBase{constructor(e,t,r,o){super(e,t,r,o)}async init(){}async randomPosition(){const e=this.size,i=this.fill,s=this.position,[n,a]=[.5*e.width,.5*e.height],p=((e,i)=>{const s=(0,t.getRandom)()*r,n=Math.atan(i/e*Math.tan(o*s)),a=(0,t.getRandom)();return a<r?n:a<.5?Math.PI-n:a<.75?Math.PI+n:-n})(n,a),c=(f=p,(u=n)*(d=a)/Math.sqrt((d*Math.cos(f))**2+(u*Math.sin(f))**2)),l=i?c*Math.sqrt((0,t.getRandom)()):c;var u,d,f;return Promise.resolve({position:{x:s.x+l*Math.cos(p),y:s.y+l*Math.sin(p)}})}}class a{generate(e,t,r,o){return new n(e,t,r,o)}}async function p(e,t=!0){const r=e;r.addEmitterShapeGenerator?.("circle",new a),await r.refresh(t)}})(),s})()));
@@ -1 +1 @@
1
- /*! tsParticles Emitters Shape Circle Plugin v3.0.2 by Matteo Bruni */
1
+ /*! tsParticles Emitters Shape Circle Plugin v3.1.0 by Matteo Bruni */
@@ -12,6 +12,7 @@
12
12
  exports.EmittersCircleShape = void 0;
13
13
  const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
14
14
  const engine_1 = require("@tsparticles/engine");
15
+ const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
15
16
  class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {
16
17
  constructor(position, size, fill, options) {
17
18
  super(position, size, fill, options);
@@ -20,26 +21,26 @@
20
21
  }
21
22
  async randomPosition() {
22
23
  const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
23
- const u = (0, engine_1.getRandom)() / 4.0, theta = Math.atan((y / x) * Math.tan(2 * Math.PI * u)), v = (0, engine_1.getRandom)();
24
- if (v < 0.25) {
24
+ const u = (0, engine_1.getRandom)() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = (0, engine_1.getRandom)();
25
+ if (v < quarter) {
25
26
  return theta;
26
27
  }
27
- else if (v < 0.5) {
28
+ else if (v < double * quarter) {
28
29
  return Math.PI - theta;
29
30
  }
30
- else if (v < 0.75) {
31
+ else if (v < double * quarter + quarter) {
31
32
  return Math.PI + theta;
32
33
  }
33
34
  else {
34
35
  return -theta;
35
36
  }
36
- }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2), [a, b] = [size.width / 2, size.height / 2], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
37
- return {
37
+ }, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt((0, engine_1.getRandom)()) : maxRadius;
38
+ return Promise.resolve({
38
39
  position: {
39
40
  x: position.x + randomRadius * Math.cos(randomTheta),
40
41
  y: position.y + randomRadius * Math.sin(randomTheta),
41
42
  },
42
- };
43
+ });
43
44
  }
44
45
  }
45
46
  exports.EmittersCircleShape = EmittersCircleShape;
package/umd/index.js CHANGED
@@ -13,8 +13,7 @@
13
13
  const EmittersCircleShapeGenerator_js_1 = require("./EmittersCircleShapeGenerator.js");
14
14
  async function loadEmittersShapeCircle(engine, refresh = true) {
15
15
  const emittersEngine = engine;
16
- emittersEngine.addEmitterShapeGenerator &&
17
- emittersEngine.addEmitterShapeGenerator("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
16
+ emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
18
17
  await emittersEngine.refresh(refresh);
19
18
  }
20
19
  exports.loadEmittersShapeCircle = loadEmittersShapeCircle;