@tsparticles/shape-rounded-polygon 4.0.0-alpha.5 → 4.0.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/512.min.js +1 -0
- package/browser/RoundedPolygonDrawer.js +1 -5
- package/browser/index.js +6 -4
- package/cjs/RoundedPolygonDrawer.js +1 -5
- package/cjs/index.js +6 -4
- package/dist_browser_RoundedPolygonDrawer_js.js +3 -3
- package/esm/RoundedPolygonDrawer.js +1 -5
- package/esm/index.js +6 -4
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.shape.rounded-polygon.js +31 -19
- package/tsparticles.shape.rounded-polygon.min.js +2 -2
- package/types/RoundedPolygonDrawer.d.ts +0 -1
- package/umd/RoundedPolygonDrawer.js +1 -5
- package/umd/index.js +6 -4
- package/98.min.js +0 -2
- package/98.min.js.LICENSE.txt +0 -1
- package/tsparticles.shape.rounded-polygon.min.js.LICENSE.txt +0 -1
package/512.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_shape_rounded_polygon=this.webpackChunk_tsparticles_shape_rounded_polygon||[]).push([[512],{512(e,t,a){a.d(t,{RoundedPolygonDrawer:()=>s});var r=a(303);class s{draw(e){let{context:t,particle:a,radius:s}=e;!function(e,t,a){let s=t[0],l=t[1];if(!s||!l)return;let n=t.length;e.moveTo((s.x+l.x)*r.half,(s.y+l.y)*r.half);for(let o=1;o<=n;o++)s=l,l=t[(o+1)%n],s&&l&&e.arcTo(s.x,s.y,(s.x+l.x)*r.half,(s.y+l.y)*r.half,a)}(t,function(e,t,a=0){let s=r.doublePI/e,l=[];for(let r=0;r<e;r++)l.push({x:Math.cos(r*s+a)*t,y:Math.sin(r*s+a)*t});return l}(a.sides,s),a.borderRadius??5)}getSidesCount(e){let t=e.shapeData;return Math.round((0,r.getRangeValue)(t?.sides??5))}particleInit(e,t){let a=t.shapeData;t.borderRadius=Math.round((0,r.getRangeValue)(a?.radius??5))*e.retina.pixelRatio}}}}]);
|
|
@@ -2,9 +2,6 @@ import { getRangeValue, } from "@tsparticles/engine";
|
|
|
2
2
|
import { polygon, roundedPath } from "./Utils.js";
|
|
3
3
|
const defaultSides = 5, defaultRadius = 5;
|
|
4
4
|
export class RoundedPolygonDrawer {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.validTypes = ["rounded-polygon"];
|
|
7
|
-
}
|
|
8
5
|
draw(data) {
|
|
9
6
|
const { context, particle, radius } = data;
|
|
10
7
|
roundedPath(context, polygon(particle.sides, radius), particle.borderRadius ?? defaultRadius);
|
|
@@ -15,7 +12,6 @@ export class RoundedPolygonDrawer {
|
|
|
15
12
|
}
|
|
16
13
|
particleInit(container, particle) {
|
|
17
14
|
const shapeData = particle.shapeData;
|
|
18
|
-
particle.borderRadius =
|
|
19
|
-
Math.round(getRangeValue(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;
|
|
15
|
+
particle.borderRadius = Math.round(getRangeValue(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;
|
|
20
16
|
}
|
|
21
17
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export async function loadRoundedPolygonShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
3
|
-
await engine.register(
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
|
+
await engine.register(e => {
|
|
4
|
+
e.addShape(["rounded-polygon"], async () => {
|
|
5
|
+
const { RoundedPolygonDrawer } = await import("./RoundedPolygonDrawer.js");
|
|
6
|
+
return new RoundedPolygonDrawer();
|
|
7
|
+
});
|
|
6
8
|
});
|
|
7
9
|
}
|
|
@@ -2,9 +2,6 @@ import { getRangeValue, } from "@tsparticles/engine";
|
|
|
2
2
|
import { polygon, roundedPath } from "./Utils.js";
|
|
3
3
|
const defaultSides = 5, defaultRadius = 5;
|
|
4
4
|
export class RoundedPolygonDrawer {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.validTypes = ["rounded-polygon"];
|
|
7
|
-
}
|
|
8
5
|
draw(data) {
|
|
9
6
|
const { context, particle, radius } = data;
|
|
10
7
|
roundedPath(context, polygon(particle.sides, radius), particle.borderRadius ?? defaultRadius);
|
|
@@ -15,7 +12,6 @@ export class RoundedPolygonDrawer {
|
|
|
15
12
|
}
|
|
16
13
|
particleInit(container, particle) {
|
|
17
14
|
const shapeData = particle.shapeData;
|
|
18
|
-
particle.borderRadius =
|
|
19
|
-
Math.round(getRangeValue(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;
|
|
15
|
+
particle.borderRadius = Math.round(getRangeValue(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;
|
|
20
16
|
}
|
|
21
17
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export async function loadRoundedPolygonShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
3
|
-
await engine.register(
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
|
+
await engine.register(e => {
|
|
4
|
+
e.addShape(["rounded-polygon"], async () => {
|
|
5
|
+
const { RoundedPolygonDrawer } = await import("./RoundedPolygonDrawer.js");
|
|
6
|
+
return new RoundedPolygonDrawer();
|
|
7
|
+
});
|
|
6
8
|
});
|
|
7
9
|
}
|
|
@@ -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
|
-
* v4.0.0-
|
|
7
|
+
* v4.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\**********************************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RoundedPolygonDrawer: () => (/* binding */ RoundedPolygonDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nconst defaultSides = 5
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RoundedPolygonDrawer: () => (/* binding */ RoundedPolygonDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nconst defaultSides = 5, defaultRadius = 5;\nclass RoundedPolygonDrawer {\n draw(data) {\n const { context, particle, radius } = data;\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.roundedPath)(context, (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.polygon)(particle.sides, radius), particle.borderRadius ?? defaultRadius);\n }\n getSidesCount(particle) {\n const roundedPolygon = particle.shapeData;\n return Math.round((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(roundedPolygon?.sides ?? defaultSides));\n }\n particleInit(container, particle) {\n const shapeData = particle.shapeData;\n particle.borderRadius = Math.round((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-polygon/./dist/browser/RoundedPolygonDrawer.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ },
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
33
33
|
\*******************************/
|
|
34
34
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
35
|
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ polygon: () => (/* binding */ polygon),\n/* harmony export */ roundedPath: () => (/* binding */ roundedPath)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultRotation = 0;\nfunction polygon(sides, radius, rot = defaultRotation) {\n
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ polygon: () => (/* binding */ polygon),\n/* harmony export */ roundedPath: () => (/* binding */ roundedPath)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultRotation = 0;\nfunction polygon(sides, radius, rot = defaultRotation) {\n const step = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI / sides, path = [];\n for(let i = 0; i < sides; i++){\n path.push({\n x: Math.cos(i * step + rot) * radius,\n y: Math.sin(i * step + rot) * radius\n });\n }\n return path;\n}\nfunction roundedPath(context, path, radius) {\n const index1 = 0, index2 = 1, increment = 1;\n let p1 = path[index1], p2 = path[index2];\n if (!p1 || !p2) {\n return;\n }\n const len = path.length;\n context.moveTo((p1.x + p2.x) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, (p1.y + p2.y) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n for(let i = 1; i <= len; i++){\n p1 = p2;\n p2 = path[(i + increment) % len];\n if (!p1 || !p2) {\n continue;\n }\n context.arcTo(p1.x, p1.y, (p1.x + p2.x) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, (p1.y + p2.y) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, radius);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-polygon/./dist/browser/Utils.js?\n}");
|
|
37
37
|
|
|
38
38
|
/***/ }
|
|
39
39
|
|
|
@@ -2,9 +2,6 @@ import { getRangeValue, } from "@tsparticles/engine";
|
|
|
2
2
|
import { polygon, roundedPath } from "./Utils.js";
|
|
3
3
|
const defaultSides = 5, defaultRadius = 5;
|
|
4
4
|
export class RoundedPolygonDrawer {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.validTypes = ["rounded-polygon"];
|
|
7
|
-
}
|
|
8
5
|
draw(data) {
|
|
9
6
|
const { context, particle, radius } = data;
|
|
10
7
|
roundedPath(context, polygon(particle.sides, radius), particle.borderRadius ?? defaultRadius);
|
|
@@ -15,7 +12,6 @@ export class RoundedPolygonDrawer {
|
|
|
15
12
|
}
|
|
16
13
|
particleInit(container, particle) {
|
|
17
14
|
const shapeData = particle.shapeData;
|
|
18
|
-
particle.borderRadius =
|
|
19
|
-
Math.round(getRangeValue(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;
|
|
15
|
+
particle.borderRadius = Math.round(getRangeValue(shapeData?.radius ?? defaultSides)) * container.retina.pixelRatio;
|
|
20
16
|
}
|
|
21
17
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export async function loadRoundedPolygonShape(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
3
|
-
await engine.register(
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
|
+
await engine.register(e => {
|
|
4
|
+
e.addShape(["rounded-polygon"], async () => {
|
|
5
|
+
const { RoundedPolygonDrawer } = await import("./RoundedPolygonDrawer.js");
|
|
6
|
+
return new RoundedPolygonDrawer();
|
|
7
|
+
});
|
|
6
8
|
});
|
|
7
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/shape-rounded-polygon",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles rounded polygon shape",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"./package.json": "./package.json"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@tsparticles/engine": "4.0.0-
|
|
62
|
+
"@tsparticles/engine": "4.0.0-beta.0"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|