@tsparticles/shape-polygon 4.0.0-beta.0 → 4.0.0-beta.10
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/{685.min.js → 138.min.js} +1 -1
- package/{833.min.js → 204.min.js} +1 -1
- package/README.md +35 -0
- package/browser/index.js +7 -7
- package/cjs/index.js +7 -7
- package/dist_browser_PolygonDrawer_js.js +1 -1
- package/dist_browser_TriangleDrawer_js.js +1 -1
- package/esm/index.js +7 -7
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.shape.polygon.js +2 -2
- package/tsparticles.shape.polygon.min.js +2 -2
- package/umd/IPolygonShape.js +0 -12
- package/umd/ISide.js +0 -12
- package/umd/ISideCount.js +0 -12
- package/umd/PolygonDrawer.js +0 -28
- package/umd/PolygonDrawerBase.js +0 -27
- package/umd/TriangleDrawer.js +0 -30
- package/umd/Utils.js +0 -49
- package/umd/index.js +0 -74
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_shape_polygon=this.webpackChunk_tsparticles_shape_polygon||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_shape_polygon=this.webpackChunk_tsparticles_shape_polygon||[]).push([[138],{761(e,t,n){n.d(t,{L:()=>r});var a=n(303);let o=new Map;class r{draw(e){let{particle:t,radius:n}=e;!function(e,t){let{context:n,radius:r}=e,s=function(e){let t=o.get(e);if(t)return t;let n=a.doublePI/e,r=(-Math.PI+(e%a.double?0:n))*a.half,s=[];for(let t=0;t<e;t++){let e=r+t*n;s[t]={x:Math.cos(e),y:Math.sin(e)}}return o.set(e,s),s}(t.count.numerator/t.count.denominator);n.beginPath();for(let e=0;e<s.length;e++){let t=s[e];if(!t)continue;let a=t.x*r,o=t.y*r;e?n.lineTo(a,o):n.moveTo(a,o)}n.closePath()}(e,this.getSidesData(t,n))}getSidesCount(e){let t=e.shapeData;return Math.round((0,a.getRangeValue)(t?.sides??5))}}},138(e,t,n){n.d(t,{TriangleDrawer:()=>o});var a=n(761);class o extends a.L{getSidesCount(){return 3}getSidesData(e,t){return{count:{denominator:1,numerator:3},length:2.66*t/1}}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_shape_polygon=this.webpackChunk_tsparticles_shape_polygon||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_shape_polygon=this.webpackChunk_tsparticles_shape_polygon||[]).push([[204],{204(t,e,n){n.d(e,{PolygonDrawer:()=>o});var a=n(761);class o extends a.L{getSidesData(t,e){let{sides:n}=t;return{count:{denominator:1,numerator:n},length:2.66*e/(n/3)}}}},761(t,e,n){n.d(e,{L:()=>l});var a=n(303);let o=new Map;class l{draw(t){let{particle:e,radius:n}=t;!function(t,e){let{context:n,radius:l}=t,s=function(t){let e=o.get(t);if(e)return e;let n=a.doublePI/t,l=(-Math.PI+(t%a.double?0:n))*a.half,s=[];for(let e=0;e<t;e++){let t=l+e*n;s[e]={x:Math.cos(t),y:Math.sin(t)}}return o.set(t,s),s}(e.count.numerator/e.count.denominator);n.beginPath();for(let t=0;t<s.length;t++){let e=s[t];if(!e)continue;let a=e.x*l,o=e.y*l;t?n.lineTo(a,o):n.moveTo(a,o)}n.closePath()}(t,this.getSidesData(e,n))}getSidesCount(t){let e=t.shapeData;return Math.round((0,a.getRangeValue)(e?.sides??5))}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) additional polygon shape.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -74,3 +80,32 @@ import { loadPolygonShape } from "@tsparticles/shape-polygon";
|
|
|
74
80
|
await loadPolygonShape(tsParticles);
|
|
75
81
|
})();
|
|
76
82
|
```
|
|
83
|
+
|
|
84
|
+
## Option mapping
|
|
85
|
+
|
|
86
|
+
- Primary options key: `particles.shape.type: "polygon"`
|
|
87
|
+
- Shape-specific options key: `particles.shape.options.polygon`
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"particles": {
|
|
92
|
+
"shape": {
|
|
93
|
+
"type": "polygon",
|
|
94
|
+
"options": {
|
|
95
|
+
"polygon": {}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Common pitfalls
|
|
103
|
+
|
|
104
|
+
- Calling `tsParticles.load(...)` before `loadPolygonShape(...)`
|
|
105
|
+
- Verify required peer packages before enabling advanced options
|
|
106
|
+
- Change one option group at a time to isolate regressions quickly
|
|
107
|
+
|
|
108
|
+
## Related docs
|
|
109
|
+
|
|
110
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
111
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export async function loadGenericPolygonShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addShape(["polygon"], async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addShape(["polygon"], async () => {
|
|
5
5
|
const { PolygonDrawer } = await import("./PolygonDrawer.js");
|
|
6
6
|
return new PolygonDrawer();
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
export async function loadTriangleShape(engine) {
|
|
11
|
-
engine.checkVersion("4.0.0-beta.
|
|
12
|
-
await engine.register(e => {
|
|
13
|
-
e.addShape(["triangle"], async () => {
|
|
11
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
12
|
+
await engine.pluginManager.register(e => {
|
|
13
|
+
e.pluginManager.addShape(["triangle"], async () => {
|
|
14
14
|
const { TriangleDrawer } = await import("./TriangleDrawer.js");
|
|
15
15
|
return new TriangleDrawer();
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
export async function loadPolygonShape(engine) {
|
|
20
|
-
engine.checkVersion("4.0.0-beta.
|
|
20
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
21
21
|
await Promise.all([
|
|
22
22
|
loadGenericPolygonShape(engine),
|
|
23
23
|
loadTriangleShape(engine),
|
package/cjs/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export async function loadGenericPolygonShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addShape(["polygon"], async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addShape(["polygon"], async () => {
|
|
5
5
|
const { PolygonDrawer } = await import("./PolygonDrawer.js");
|
|
6
6
|
return new PolygonDrawer();
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
export async function loadTriangleShape(engine) {
|
|
11
|
-
engine.checkVersion("4.0.0-beta.
|
|
12
|
-
await engine.register(e => {
|
|
13
|
-
e.addShape(["triangle"], async () => {
|
|
11
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
12
|
+
await engine.pluginManager.register(e => {
|
|
13
|
+
e.pluginManager.addShape(["triangle"], async () => {
|
|
14
14
|
const { TriangleDrawer } = await import("./TriangleDrawer.js");
|
|
15
15
|
return new TriangleDrawer();
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
export async function loadPolygonShape(engine) {
|
|
20
|
-
engine.checkVersion("4.0.0-beta.
|
|
20
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
21
21
|
await Promise.all([
|
|
22
22
|
loadGenericPolygonShape(engine),
|
|
23
23
|
loadTriangleShape(engine),
|
package/esm/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export async function loadGenericPolygonShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addShape(["polygon"], async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addShape(["polygon"], async () => {
|
|
5
5
|
const { PolygonDrawer } = await import("./PolygonDrawer.js");
|
|
6
6
|
return new PolygonDrawer();
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
export async function loadTriangleShape(engine) {
|
|
11
|
-
engine.checkVersion("4.0.0-beta.
|
|
12
|
-
await engine.register(e => {
|
|
13
|
-
e.addShape(["triangle"], async () => {
|
|
11
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
12
|
+
await engine.pluginManager.register(e => {
|
|
13
|
+
e.pluginManager.addShape(["triangle"], async () => {
|
|
14
14
|
const { TriangleDrawer } = await import("./TriangleDrawer.js");
|
|
15
15
|
return new TriangleDrawer();
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
export async function loadPolygonShape(engine) {
|
|
20
|
-
engine.checkVersion("4.0.0-beta.
|
|
20
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
21
21
|
await Promise.all([
|
|
22
22
|
loadGenericPolygonShape(engine),
|
|
23
23
|
loadTriangleShape(engine),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/shape-polygon",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles polygon shape",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -53,13 +53,12 @@
|
|
|
53
53
|
"browser": "./browser/index.js",
|
|
54
54
|
"import": "./esm/index.js",
|
|
55
55
|
"require": "./cjs/index.js",
|
|
56
|
-
"
|
|
57
|
-
"default": "./cjs/index.js"
|
|
56
|
+
"default": "./esm/index.js"
|
|
58
57
|
},
|
|
59
58
|
"./package.json": "./package.json"
|
|
60
59
|
},
|
|
61
|
-
"
|
|
62
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@tsparticles/engine": "4.0.0-beta.10"
|
|
63
62
|
},
|
|
64
63
|
"publishConfig": {
|
|
65
64
|
"access": "public"
|