@tsparticles/shape-cog 3.0.0-beta.2 → 3.0.0-beta.3

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,6 +1,7 @@
1
1
  import { getRangeValue } from "@tsparticles/engine";
2
2
  export class CogDrawer {
3
- afterEffect(ctx, particle, radius) {
3
+ afterEffect(data) {
4
+ const { context, particle, radius } = data;
4
5
  if (particle.cogHoleRadius === undefined ||
5
6
  particle.cogInnerRadius === undefined ||
6
7
  particle.cogInnerTaper === undefined ||
@@ -9,15 +10,16 @@ export class CogDrawer {
9
10
  return;
10
11
  }
11
12
  const pi2 = 2 * Math.PI, holeRadius = (radius * particle.cogHoleRadius) / 100;
12
- ctx.globalCompositeOperation = "destination-out";
13
- ctx.beginPath();
14
- ctx.moveTo(holeRadius, 0);
15
- ctx.arc(0, 0, holeRadius, 0, pi2);
16
- ctx.closePath();
17
- ctx.fill();
18
- ctx.globalCompositeOperation = "source-over";
13
+ context.globalCompositeOperation = "destination-out";
14
+ context.beginPath();
15
+ context.moveTo(holeRadius, 0);
16
+ context.arc(0, 0, holeRadius, 0, pi2);
17
+ context.closePath();
18
+ context.fill();
19
+ context.globalCompositeOperation = "source-over";
19
20
  }
20
- draw(ctx, particle, radius) {
21
+ draw(data) {
22
+ const { context, particle, radius } = data;
21
23
  if (particle.cogHoleRadius === undefined ||
22
24
  particle.cogInnerRadius === undefined ||
23
25
  particle.cogInnerTaper === undefined ||
@@ -27,15 +29,15 @@ export class CogDrawer {
27
29
  }
28
30
  const pi2 = 2 * Math.PI, angle = pi2 / (particle.cogNotches * 2), taperAI = angle * particle.cogInnerTaper * 0.005, taperAO = angle * particle.cogOuterTaper * 0.005, innerRadius = (radius * particle.cogInnerRadius) / 100;
29
31
  let a = angle, toggle = false;
30
- ctx.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
32
+ context.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
31
33
  for (; a <= pi2; a += angle) {
32
34
  if (toggle) {
33
- ctx.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
34
- ctx.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
35
+ context.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
36
+ context.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
35
37
  }
36
38
  else {
37
- ctx.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
38
- ctx.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
39
+ context.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
40
+ context.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
39
41
  }
40
42
  toggle = !toggle;
41
43
  }
package/cjs/CogDrawer.js CHANGED
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CogDrawer = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
5
  class CogDrawer {
6
- afterEffect(ctx, particle, radius) {
6
+ afterEffect(data) {
7
+ const { context, particle, radius } = data;
7
8
  if (particle.cogHoleRadius === undefined ||
8
9
  particle.cogInnerRadius === undefined ||
9
10
  particle.cogInnerTaper === undefined ||
@@ -12,15 +13,16 @@ class CogDrawer {
12
13
  return;
13
14
  }
14
15
  const pi2 = 2 * Math.PI, holeRadius = (radius * particle.cogHoleRadius) / 100;
15
- ctx.globalCompositeOperation = "destination-out";
16
- ctx.beginPath();
17
- ctx.moveTo(holeRadius, 0);
18
- ctx.arc(0, 0, holeRadius, 0, pi2);
19
- ctx.closePath();
20
- ctx.fill();
21
- ctx.globalCompositeOperation = "source-over";
16
+ context.globalCompositeOperation = "destination-out";
17
+ context.beginPath();
18
+ context.moveTo(holeRadius, 0);
19
+ context.arc(0, 0, holeRadius, 0, pi2);
20
+ context.closePath();
21
+ context.fill();
22
+ context.globalCompositeOperation = "source-over";
22
23
  }
23
- draw(ctx, particle, radius) {
24
+ draw(data) {
25
+ const { context, particle, radius } = data;
24
26
  if (particle.cogHoleRadius === undefined ||
25
27
  particle.cogInnerRadius === undefined ||
26
28
  particle.cogInnerTaper === undefined ||
@@ -30,15 +32,15 @@ class CogDrawer {
30
32
  }
31
33
  const pi2 = 2 * Math.PI, angle = pi2 / (particle.cogNotches * 2), taperAI = angle * particle.cogInnerTaper * 0.005, taperAO = angle * particle.cogOuterTaper * 0.005, innerRadius = (radius * particle.cogInnerRadius) / 100;
32
34
  let a = angle, toggle = false;
33
- ctx.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
35
+ context.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
34
36
  for (; a <= pi2; a += angle) {
35
37
  if (toggle) {
36
- ctx.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
37
- ctx.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
38
+ context.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
39
+ context.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
38
40
  }
39
41
  else {
40
- ctx.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
41
- ctx.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
42
+ context.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
43
+ context.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
42
44
  }
43
45
  toggle = !toggle;
44
46
  }
package/esm/CogDrawer.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { getRangeValue } from "@tsparticles/engine";
2
2
  export class CogDrawer {
3
- afterEffect(ctx, particle, radius) {
3
+ afterEffect(data) {
4
+ const { context, particle, radius } = data;
4
5
  if (particle.cogHoleRadius === undefined ||
5
6
  particle.cogInnerRadius === undefined ||
6
7
  particle.cogInnerTaper === undefined ||
@@ -9,15 +10,16 @@ export class CogDrawer {
9
10
  return;
10
11
  }
11
12
  const pi2 = 2 * Math.PI, holeRadius = (radius * particle.cogHoleRadius) / 100;
12
- ctx.globalCompositeOperation = "destination-out";
13
- ctx.beginPath();
14
- ctx.moveTo(holeRadius, 0);
15
- ctx.arc(0, 0, holeRadius, 0, pi2);
16
- ctx.closePath();
17
- ctx.fill();
18
- ctx.globalCompositeOperation = "source-over";
13
+ context.globalCompositeOperation = "destination-out";
14
+ context.beginPath();
15
+ context.moveTo(holeRadius, 0);
16
+ context.arc(0, 0, holeRadius, 0, pi2);
17
+ context.closePath();
18
+ context.fill();
19
+ context.globalCompositeOperation = "source-over";
19
20
  }
20
- draw(ctx, particle, radius) {
21
+ draw(data) {
22
+ const { context, particle, radius } = data;
21
23
  if (particle.cogHoleRadius === undefined ||
22
24
  particle.cogInnerRadius === undefined ||
23
25
  particle.cogInnerTaper === undefined ||
@@ -27,15 +29,15 @@ export class CogDrawer {
27
29
  }
28
30
  const pi2 = 2 * Math.PI, angle = pi2 / (particle.cogNotches * 2), taperAI = angle * particle.cogInnerTaper * 0.005, taperAO = angle * particle.cogOuterTaper * 0.005, innerRadius = (radius * particle.cogInnerRadius) / 100;
29
31
  let a = angle, toggle = false;
30
- ctx.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
32
+ context.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
31
33
  for (; a <= pi2; a += angle) {
32
34
  if (toggle) {
33
- ctx.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
34
- ctx.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
35
+ context.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
36
+ context.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
35
37
  }
36
38
  else {
37
- ctx.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
38
- ctx.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
39
+ context.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
40
+ context.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
39
41
  }
40
42
  toggle = !toggle;
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-cog",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.3",
4
4
  "description": "tsParticles cog shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,7 +100,7 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "^3.0.0-beta.2"
103
+ "@tsparticles/engine": "^3.0.0-beta.3"
104
104
  },
105
105
  "publishConfig": {
106
106
  "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/shape-cog [11 Sep 2023 at 10:18]</title>
6
+ <title>@tsparticles/shape-cog [20 Sep 2023 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>
@@ -49,7 +49,7 @@ var t="[object Symbol]",n=/[&<>"'`]/g,i=RegExp(n.source),r="object"==typeof self
49
49
  <body>
50
50
  <div id="app"></div>
51
51
  <script>
52
- window.chartData = [{"label":"tsparticles.shape.cog.js","isAsset":true,"statSize":2404,"parsedSize":6301,"gzipSize":1918,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":2362,"groups":[{"id":870,"label":"index.js + 1 modules (concatenated)","path":"./dist/browser/index.js + 1 modules (concatenated)","statSize":2362,"parsedSize":6301,"gzipSize":1918,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser","statSize":2362,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/index.js","statSize":164,"parsedSize":437,"gzipSize":133,"inaccurateSizes":true},{"id":null,"label":"CogDrawer.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/CogDrawer.js","statSize":2198,"parsedSize":5863,"gzipSize":1784,"inaccurateSizes":true}],"parsedSize":6301,"gzipSize":1918,"inaccurateSizes":true}]}],"parsedSize":6301,"gzipSize":1918},{"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}],"isInitialByEntrypoint":{"tsparticles.shape.cog":true}}];
52
+ window.chartData = [{"label":"tsparticles.shape.cog.js","isAsset":true,"statSize":2558,"parsedSize":6455,"gzipSize":1932,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":2516,"groups":[{"id":870,"label":"index.js + 1 modules (concatenated)","path":"./dist/browser/index.js + 1 modules (concatenated)","statSize":2516,"parsedSize":6455,"gzipSize":1932,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser","statSize":2516,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/index.js","statSize":164,"parsedSize":420,"gzipSize":125,"inaccurateSizes":true},{"id":null,"label":"CogDrawer.js","path":"./dist/browser/index.js + 1 modules (concatenated)/dist/browser/CogDrawer.js","statSize":2352,"parsedSize":6034,"gzipSize":1806,"inaccurateSizes":true}],"parsedSize":6455,"gzipSize":1932,"inaccurateSizes":true}]}],"parsedSize":6455,"gzipSize":1932},{"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}],"isInitialByEntrypoint":{"tsparticles.shape.cog":true}}];
53
53
  window.entrypoints = ["tsparticles.shape.cog","tsparticles.shape.cog.min"];
54
54
  window.defaultSizes = "parsed";
55
55
  </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.0-beta.2
7
+ * v3.0.0-beta.3
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -99,21 +99,31 @@ var engine_root_window_ = __webpack_require__(533);
99
99
  ;// CONCATENATED MODULE: ./dist/browser/CogDrawer.js
100
100
 
101
101
  class CogDrawer {
102
- afterEffect(ctx, particle, radius) {
102
+ afterEffect(data) {
103
+ const {
104
+ context,
105
+ particle,
106
+ radius
107
+ } = data;
103
108
  if (particle.cogHoleRadius === undefined || particle.cogInnerRadius === undefined || particle.cogInnerTaper === undefined || particle.cogNotches === undefined || particle.cogOuterTaper === undefined) {
104
109
  return;
105
110
  }
106
111
  const pi2 = 2 * Math.PI,
107
112
  holeRadius = radius * particle.cogHoleRadius / 100;
108
- ctx.globalCompositeOperation = "destination-out";
109
- ctx.beginPath();
110
- ctx.moveTo(holeRadius, 0);
111
- ctx.arc(0, 0, holeRadius, 0, pi2);
112
- ctx.closePath();
113
- ctx.fill();
114
- ctx.globalCompositeOperation = "source-over";
113
+ context.globalCompositeOperation = "destination-out";
114
+ context.beginPath();
115
+ context.moveTo(holeRadius, 0);
116
+ context.arc(0, 0, holeRadius, 0, pi2);
117
+ context.closePath();
118
+ context.fill();
119
+ context.globalCompositeOperation = "source-over";
115
120
  }
116
- draw(ctx, particle, radius) {
121
+ draw(data) {
122
+ const {
123
+ context,
124
+ particle,
125
+ radius
126
+ } = data;
117
127
  if (particle.cogHoleRadius === undefined || particle.cogInnerRadius === undefined || particle.cogInnerTaper === undefined || particle.cogNotches === undefined || particle.cogOuterTaper === undefined) {
118
128
  return;
119
129
  }
@@ -124,14 +134,14 @@ class CogDrawer {
124
134
  innerRadius = radius * particle.cogInnerRadius / 100;
125
135
  let a = angle,
126
136
  toggle = false;
127
- ctx.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
137
+ context.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
128
138
  for (; a <= pi2; a += angle) {
129
139
  if (toggle) {
130
- ctx.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
131
- ctx.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
140
+ context.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
141
+ context.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
132
142
  } else {
133
- ctx.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
134
- ctx.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
143
+ context.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
144
+ context.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
135
145
  }
136
146
  toggle = !toggle;
137
147
  }
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.shape.cog.min.js.LICENSE.txt */
2
- !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],o);else{var t="object"==typeof exports?o(require("@tsparticles/engine")):o(e.window);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,(e=>(()=>{"use strict";var o={533:o=>{o.exports=e}},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{r.r(a),r.d(a,{loadCogShape:()=>t});var e=r(533);class o{afterEffect(e,o,t){if(void 0===o.cogHoleRadius||void 0===o.cogInnerRadius||void 0===o.cogInnerTaper||void 0===o.cogNotches||void 0===o.cogOuterTaper)return;const r=2*Math.PI,a=t*o.cogHoleRadius/100;e.globalCompositeOperation="destination-out",e.beginPath(),e.moveTo(a,0),e.arc(0,0,a,0,r),e.closePath(),e.fill(),e.globalCompositeOperation="source-over"}draw(e,o,t){if(void 0===o.cogHoleRadius||void 0===o.cogInnerRadius||void 0===o.cogInnerTaper||void 0===o.cogNotches||void 0===o.cogOuterTaper)return;const r=2*Math.PI,a=r/(2*o.cogNotches),n=a*o.cogInnerTaper*.005,i=a*o.cogOuterTaper*.005,s=t*o.cogInnerRadius/100;let c=a,g=!1;for(e.moveTo(t*Math.cos(i),t*Math.sin(i));c<=r;c+=a)g?(e.lineTo(s*Math.cos(c-n),s*Math.sin(c-n)),e.lineTo(t*Math.cos(c+i),t*Math.sin(c+i))):(e.lineTo(t*Math.cos(c-i),t*Math.sin(c-i)),e.lineTo(s*Math.cos(c+n),s*Math.sin(c+n))),g=!g}particleInit(o,t){const r=t.shapeData;t.cogHoleRadius=(0,e.getRangeValue)(r?.holeRadius??44),t.cogInnerRadius=(0,e.getRangeValue)(r?.innerRadius??72),t.cogInnerTaper=(0,e.getRangeValue)(r?.innerTaper??35),t.cogNotches=(0,e.getRangeValue)(r?.notches??7),t.cogOuterTaper=(0,e.getRangeValue)(r?.outerTaper??50)}}async function t(e,t=!0){await e.addShape("cog",new o,t)}})(),a})()));
2
+ !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],o);else{var t="object"==typeof exports?o(require("@tsparticles/engine")):o(e.window);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,(e=>(()=>{"use strict";var o={533:o=>{o.exports=e}},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return o[e](n,n.exports,r),n.exports}r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{r.r(a),r.d(a,{loadCogShape:()=>t});var e=r(533);class o{afterEffect(e){const{context:o,particle:t,radius:r}=e;if(void 0===t.cogHoleRadius||void 0===t.cogInnerRadius||void 0===t.cogInnerTaper||void 0===t.cogNotches||void 0===t.cogOuterTaper)return;const a=2*Math.PI,n=r*t.cogHoleRadius/100;o.globalCompositeOperation="destination-out",o.beginPath(),o.moveTo(n,0),o.arc(0,0,n,0,a),o.closePath(),o.fill(),o.globalCompositeOperation="source-over"}draw(e){const{context:o,particle:t,radius:r}=e;if(void 0===t.cogHoleRadius||void 0===t.cogInnerRadius||void 0===t.cogInnerTaper||void 0===t.cogNotches||void 0===t.cogOuterTaper)return;const a=2*Math.PI,n=a/(2*t.cogNotches),i=n*t.cogInnerTaper*.005,c=n*t.cogOuterTaper*.005,s=r*t.cogInnerRadius/100;let p=n,d=!1;for(o.moveTo(r*Math.cos(c),r*Math.sin(c));p<=a;p+=n)d?(o.lineTo(s*Math.cos(p-i),s*Math.sin(p-i)),o.lineTo(r*Math.cos(p+c),r*Math.sin(p+c))):(o.lineTo(r*Math.cos(p-c),r*Math.sin(p-c)),o.lineTo(s*Math.cos(p+i),s*Math.sin(p+i))),d=!d}particleInit(o,t){const r=t.shapeData;t.cogHoleRadius=(0,e.getRangeValue)(r?.holeRadius??44),t.cogInnerRadius=(0,e.getRangeValue)(r?.innerRadius??72),t.cogInnerTaper=(0,e.getRangeValue)(r?.innerTaper??35),t.cogNotches=(0,e.getRangeValue)(r?.notches??7),t.cogOuterTaper=(0,e.getRangeValue)(r?.outerTaper??50)}}async function t(e,t=!0){await e.addShape("cog",new o,t)}})(),a})()));
@@ -1 +1 @@
1
- /*! tsParticles Cog Shape v3.0.0-beta.2 by Matteo Bruni */
1
+ /*! tsParticles Cog Shape v3.0.0-beta.3 by Matteo Bruni */
@@ -1,7 +1,7 @@
1
- import { type Container, type IShapeDrawer } from "@tsparticles/engine";
1
+ import { type Container, type IShapeDrawData, type IShapeDrawer } from "@tsparticles/engine";
2
2
  import type { CogParticle } from "./CogParticle.js";
3
- export declare class CogDrawer implements IShapeDrawer {
4
- afterEffect(ctx: CanvasRenderingContext2D, particle: CogParticle, radius: number): void;
5
- draw(ctx: CanvasRenderingContext2D, particle: CogParticle, radius: number): void;
3
+ export declare class CogDrawer implements IShapeDrawer<CogParticle> {
4
+ afterEffect(data: IShapeDrawData<CogParticle>): void;
5
+ draw(data: IShapeDrawData<CogParticle>): void;
6
6
  particleInit(container: Container, particle: CogParticle): void;
7
7
  }
package/umd/CogDrawer.js CHANGED
@@ -12,7 +12,8 @@
12
12
  exports.CogDrawer = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  class CogDrawer {
15
- afterEffect(ctx, particle, radius) {
15
+ afterEffect(data) {
16
+ const { context, particle, radius } = data;
16
17
  if (particle.cogHoleRadius === undefined ||
17
18
  particle.cogInnerRadius === undefined ||
18
19
  particle.cogInnerTaper === undefined ||
@@ -21,15 +22,16 @@
21
22
  return;
22
23
  }
23
24
  const pi2 = 2 * Math.PI, holeRadius = (radius * particle.cogHoleRadius) / 100;
24
- ctx.globalCompositeOperation = "destination-out";
25
- ctx.beginPath();
26
- ctx.moveTo(holeRadius, 0);
27
- ctx.arc(0, 0, holeRadius, 0, pi2);
28
- ctx.closePath();
29
- ctx.fill();
30
- ctx.globalCompositeOperation = "source-over";
25
+ context.globalCompositeOperation = "destination-out";
26
+ context.beginPath();
27
+ context.moveTo(holeRadius, 0);
28
+ context.arc(0, 0, holeRadius, 0, pi2);
29
+ context.closePath();
30
+ context.fill();
31
+ context.globalCompositeOperation = "source-over";
31
32
  }
32
- draw(ctx, particle, radius) {
33
+ draw(data) {
34
+ const { context, particle, radius } = data;
33
35
  if (particle.cogHoleRadius === undefined ||
34
36
  particle.cogInnerRadius === undefined ||
35
37
  particle.cogInnerTaper === undefined ||
@@ -39,15 +41,15 @@
39
41
  }
40
42
  const pi2 = 2 * Math.PI, angle = pi2 / (particle.cogNotches * 2), taperAI = angle * particle.cogInnerTaper * 0.005, taperAO = angle * particle.cogOuterTaper * 0.005, innerRadius = (radius * particle.cogInnerRadius) / 100;
41
43
  let a = angle, toggle = false;
42
- ctx.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
44
+ context.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
43
45
  for (; a <= pi2; a += angle) {
44
46
  if (toggle) {
45
- ctx.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
46
- ctx.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
47
+ context.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
48
+ context.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
47
49
  }
48
50
  else {
49
- ctx.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
50
- ctx.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
51
+ context.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
52
+ context.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
51
53
  }
52
54
  toggle = !toggle;
53
55
  }