@tsparticles/path-polygon 4.0.0-alpha.2 → 4.0.0-alpha.21
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/425.min.js +1 -0
- package/browser/PolygonPathGenerator.js +29 -21
- package/browser/index.js +7 -5
- package/cjs/PolygonPathGenerator.js +29 -21
- package/cjs/index.js +7 -5
- package/dist_browser_PolygonPathGenerator_js.js +2 -2
- package/esm/PolygonPathGenerator.js +29 -21
- package/esm/index.js +7 -5
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.path.polygon.js +11 -11
- package/tsparticles.path.polygon.min.js +2 -2
- package/types/PolygonPathGenerator.d.ts +3 -2
- package/types/index.d.ts +1 -1
- package/umd/PolygonPathGenerator.js +28 -20
- package/umd/index.js +7 -5
- package/399.min.js +0 -2
- package/399.min.js.LICENSE.txt +0 -1
- package/tsparticles.path.polygon.min.js.LICENSE.txt +0 -1
|
@@ -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-alpha.
|
|
7
|
+
* v4.0.0-alpha.21
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/index.js"
|
|
32
|
-
/*!*******************************!*\
|
|
33
|
-
!*** ./dist/browser/index.js ***!
|
|
34
|
-
\*******************************/
|
|
35
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
|
-
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPolygonPath: () => (/* binding */ loadPolygonPath),\n/* harmony export */ polygonPathName: () => (/* binding */ polygonPathName)\n/* harmony export */ });\nconst polygonPathName = \"polygonPathGenerator\";\nfunction loadPolygonPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\n PolygonPathGenerator\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_PolygonPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PolygonPathGenerator.js */ \"./dist/browser/PolygonPathGenerator.js\"));\n e.addPathGenerator(polygonPathName, new PolygonPathGenerator());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/path-polygon/./dist/browser/index.js?\n}");
|
|
38
|
-
|
|
39
|
-
/***/ },
|
|
40
|
-
|
|
41
31
|
/***/ "@tsparticles/engine"
|
|
42
32
|
/*!*********************************************************************************************************************************!*\
|
|
43
33
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
@@ -46,6 +36,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
46
36
|
|
|
47
37
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
48
38
|
|
|
39
|
+
/***/ },
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/index.js"
|
|
42
|
+
/*!*******************************!*\
|
|
43
|
+
!*** ./dist/browser/index.js ***!
|
|
44
|
+
\*******************************/
|
|
45
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
|
+
|
|
47
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPolygonPath: () => (/* binding */ loadPolygonPath),\n/* harmony export */ polygonPathName: () => (/* binding */ polygonPathName)\n/* harmony export */ });\nconst polygonPathName = \"polygonPathGenerator\";\nasync function loadPolygonPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.21\");\n await engine.register((e)=>{\n e.addPathGenerator(polygonPathName, async (container)=>{\n const { PolygonPathGenerator } = await __webpack_require__.e(/*! import() */ \"dist_browser_PolygonPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PolygonPathGenerator.js */ \"./dist/browser/PolygonPathGenerator.js\"));\n return new PolygonPathGenerator(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-polygon/./dist/browser/index.js?\n}");
|
|
48
|
+
|
|
49
49
|
/***/ }
|
|
50
50
|
|
|
51
51
|
/******/ });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,n={303(t){t.exports=e}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,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.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,r)=>(i.f[r](e,t),t),[])),i.u=e=>""+e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},i.l=(e,t,r,o)=>{if(p[e])return void p[e].push(t);if(void 0!==r)for(var n,a,s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var c=s[l];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/path-polygon:"+r){n=c;break}}n||(a=!0,(n=document.createElement("script")).charset="utf-8",i.nc&&n.setAttribute("nonce",i.nc),n.setAttribute("data-webpack","@tsparticles/path-polygon:"+r),n.src=e),p[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=p[e];if(delete p[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),a&&document.head.appendChild(n)},i.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.g.importScripts&&(s=i.g.location+"");var p,s,l=i.g.document;if(!s&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(s=l.currentScript.src),!s)){var c=l.getElementsByTagName("script");if(c.length)for(var u=c.length-1;u>-1&&(!s||!/^http(s?):/.test(s));)s=c[u--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");i.p=s=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={334:0},i.f.j=(e,r)=>{var o=i.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=t[e]=[r,n]);r.push(o[2]=n);var a=i.p+i.u(e),p=Error();i.l(a,r=>{if(i.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;p.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+n+": "+a+")",p.name="ChunkLoadError",p.type=n,p.request=a,o[1](p)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[a,p,s]=r,l=0;if(a.some(e=>0!==t[e])){for(o in p)i.o(p,o)&&(i.m[o]=p[o]);s&&s(i)}for(e&&e(r);l<a.length;l++)n=a[l],i.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_path_polygon=this.webpackChunk_tsparticles_path_polygon||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};i.r(d),i.d(d,{loadPolygonPath:()=>h,polygonPathName:()=>f});let f="polygonPathGenerator";async function h(e){e.checkVersion("4.0.0-alpha.21"),await e.register(e=>{e.addPathGenerator(f,async e=>{let{PolygonPathGenerator:t}=await i.e(425).then(i.bind(i,425));return new t(e)})})}return d})());
|
|
@@ -4,9 +4,10 @@ import type { PolygonPathParticle } from "./PolygonPathParticle.js";
|
|
|
4
4
|
export declare class PolygonPathGenerator implements IMovePathGenerator {
|
|
5
5
|
dirsList: ICoordinates[];
|
|
6
6
|
readonly options: IPolygonPathOptions;
|
|
7
|
-
|
|
7
|
+
private readonly _container;
|
|
8
|
+
constructor(container: Container);
|
|
8
9
|
generate(p: PolygonPathParticle): Vector;
|
|
9
|
-
init(
|
|
10
|
+
init(): void;
|
|
10
11
|
reset(particle: PolygonPathParticle): void;
|
|
11
12
|
update(): void;
|
|
12
13
|
private readonly _createDirs;
|
package/types/index.d.ts
CHANGED
|
@@ -11,28 +11,26 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PolygonPathGenerator = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const defaultOptions = {
|
|
15
|
+
sides: 6,
|
|
16
|
+
turnSteps: 20,
|
|
17
|
+
angle: 30,
|
|
18
|
+
};
|
|
14
19
|
class PolygonPathGenerator {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.dirsList.push(engine_1.Vector.create(Math.cos((angle * Math.PI) / 180), Math.sin((angle * Math.PI) / 180)));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
20
|
+
dirsList;
|
|
21
|
+
options;
|
|
22
|
+
_container;
|
|
23
|
+
constructor(container) {
|
|
24
|
+
this._container = container;
|
|
23
25
|
this.dirsList = [];
|
|
24
|
-
this.options = {
|
|
25
|
-
sides: 6,
|
|
26
|
-
turnSteps: 20,
|
|
27
|
-
angle: 30,
|
|
28
|
-
};
|
|
26
|
+
this.options = (0, engine_1.deepExtend)({}, defaultOptions);
|
|
29
27
|
}
|
|
30
28
|
generate(p) {
|
|
31
|
-
const { sides } = this.options;
|
|
29
|
+
const { sides, turnSteps } = this.options;
|
|
32
30
|
p.hexStep ??= 0;
|
|
33
31
|
p.hexDirection ??= sides === 6 ? (((0, engine_1.getRandom)() * 3) | 0) * 2 : ((0, engine_1.getRandom)() * sides) | 0;
|
|
34
32
|
p.hexSpeed ??= p.velocity.length;
|
|
35
|
-
if (p.hexStep %
|
|
33
|
+
if (p.hexStep % turnSteps === 0) {
|
|
36
34
|
p.hexDirection = (0, engine_1.getRandom)() > 0.5 ? (p.hexDirection + 1) % sides : (p.hexDirection + sides - 1) % sides;
|
|
37
35
|
}
|
|
38
36
|
p.velocity.x = 0;
|
|
@@ -41,11 +39,13 @@
|
|
|
41
39
|
const direction = this.dirsList[p.hexDirection];
|
|
42
40
|
return engine_1.Vector.create(direction.x * p.hexSpeed, direction.y * p.hexSpeed);
|
|
43
41
|
}
|
|
44
|
-
init(
|
|
45
|
-
const
|
|
46
|
-
this.options.sides =
|
|
47
|
-
|
|
48
|
-
this.options.
|
|
42
|
+
init() {
|
|
43
|
+
const container = this._container, sourceOptions = container.actualOptions.particles.move.path.options;
|
|
44
|
+
this.options.sides =
|
|
45
|
+
sourceOptions["sides"] > 0 ? sourceOptions["sides"] : this.options.sides;
|
|
46
|
+
this.options.angle = sourceOptions["angle"] ?? this.options.angle;
|
|
47
|
+
this.options.turnSteps =
|
|
48
|
+
sourceOptions["turnSteps"] >= 0 ? sourceOptions["turnSteps"] : this.options.turnSteps;
|
|
49
49
|
this._createDirs();
|
|
50
50
|
}
|
|
51
51
|
reset(particle) {
|
|
@@ -55,6 +55,14 @@
|
|
|
55
55
|
}
|
|
56
56
|
update() {
|
|
57
57
|
}
|
|
58
|
+
_createDirs = () => {
|
|
59
|
+
const { options } = this;
|
|
60
|
+
this.dirsList = [];
|
|
61
|
+
for (let i = 0; i < 360; i += 360 / options.sides) {
|
|
62
|
+
const angle = options.angle + i;
|
|
63
|
+
this.dirsList.push(engine_1.Vector.create(Math.cos((angle * Math.PI) / 180), Math.sin((angle * Math.PI) / 180)));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
58
66
|
}
|
|
59
67
|
exports.PolygonPathGenerator = PolygonPathGenerator;
|
|
60
68
|
});
|
package/umd/index.js
CHANGED
|
@@ -46,11 +46,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
exports.polygonPathName = void 0;
|
|
47
47
|
exports.loadPolygonPath = loadPolygonPath;
|
|
48
48
|
exports.polygonPathName = "polygonPathGenerator";
|
|
49
|
-
function loadPolygonPath(engine) {
|
|
50
|
-
engine.checkVersion("4.0.0-alpha.
|
|
51
|
-
engine.register(
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
async function loadPolygonPath(engine) {
|
|
50
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
51
|
+
await engine.register(e => {
|
|
52
|
+
e.addPathGenerator(exports.polygonPathName, async (container) => {
|
|
53
|
+
const { PolygonPathGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./PolygonPathGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./PolygonPathGenerator.js"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
+
return new PolygonPathGenerator(container);
|
|
55
|
+
});
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
});
|
package/399.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 399.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_path_polygon=this.webpackChunk_tsparticles_path_polygon||[]).push([[399],{399(t,e,s){s.d(e,{PolygonPathGenerator:()=>o});var i=s(303);class o{constructor(){this._createDirs=()=>{this.dirsList=[];for(let t=0;t<360;t+=360/this.options.sides){const e=this.options.angle+t;this.dirsList.push(i.Vector.create(Math.cos(e*Math.PI/180),Math.sin(e*Math.PI/180)))}},this.dirsList=[],this.options={sides:6,turnSteps:20,angle:30}}generate(t){const{sides:e}=this.options;t.hexStep??=0,t.hexDirection??=6===e?2*(3*(0,i.getRandom)()|0):(0,i.getRandom)()*e|0,t.hexSpeed??=t.velocity.length,t.hexStep%this.options.turnSteps==0&&(t.hexDirection=(0,i.getRandom)()>.5?(t.hexDirection+1)%e:(t.hexDirection+e-1)%e),t.velocity.x=0,t.velocity.y=0,t.hexStep++;const s=this.dirsList[t.hexDirection];return i.Vector.create(s.x*t.hexSpeed,s.y*t.hexSpeed)}init(t){const e=t.actualOptions.particles.move.path.options;this.options.sides=e.sides>0?e.sides:6,this.options.angle=e.angle??30,this.options.turnSteps=e.turnSteps>=0?e.turnSteps:20,this._createDirs()}reset(t){delete t.hexStep,delete t.hexDirection,delete t.hexSpeed}update(){}}}}]);
|
package/399.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Polygon Path v4.0.0-alpha.2 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Polygon Path v4.0.0-alpha.2 by Matteo Bruni */
|