@tsparticles/path-zig-zag 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/839.min.js +1 -0
- package/browser/ZigZagPathGenerator.js +18 -13
- package/browser/index.js +7 -5
- package/cjs/ZigZagPathGenerator.js +18 -13
- package/cjs/index.js +7 -5
- package/dist_browser_ZigZagPathGenerator_js.js +2 -2
- package/esm/ZigZagPathGenerator.js +18 -13
- package/esm/index.js +7 -5
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.path.zigzag.js +11 -11
- package/tsparticles.path.zigzag.min.js +2 -2
- package/types/ZigZagPathGenerator.d.ts +4 -3
- package/types/index.d.ts +1 -1
- package/umd/ZigZagPathGenerator.js +17 -12
- package/umd/index.js +7 -5
- package/345.min.js +0 -2
- package/345.min.js.LICENSE.txt +0 -1
- package/tsparticles.path.zigzag.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 */ loadZigZagPath: () => (/* binding */ loadZigZagPath),\n/* harmony export */ zigZagPathName: () => (/* binding */ zigZagPathName)\n/* harmony export */ });\nconst zigZagPathName = \"zigZagPathGenerator\";\nfunction loadZigZagPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\n ZigZagPathGenerator\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_ZigZagPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ZigZagPathGenerator.js */ \"./dist/browser/ZigZagPathGenerator.js\"));\n e.addPathGenerator(zigZagPathName, new ZigZagPathGenerator());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/path-zig-zag/./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 */ loadZigZagPath: () => (/* binding */ loadZigZagPath),\n/* harmony export */ zigZagPathName: () => (/* binding */ zigZagPathName)\n/* harmony export */ });\nconst zigZagPathName = \"zigZagPathGenerator\";\nasync function loadZigZagPath(engine) {\n engine.checkVersion(\"4.0.0-alpha.21\");\n await engine.register((e)=>{\n e.addPathGenerator(zigZagPathName, async (container)=>{\n const { ZigZagPathGenerator } = await __webpack_require__.e(/*! import() */ \"dist_browser_ZigZagPathGenerator_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ZigZagPathGenerator.js */ \"./dist/browser/ZigZagPathGenerator.js\"));\n return new ZigZagPathGenerator(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-zig-zag/./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,a={303(t){t.exports=e}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return a[e](r,r.exports,n),r.exports}n.m=a,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>""+e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},n.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var a,i,c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var l=c[p];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/path-zig-zag:"+r){a=l;break}}a||(i=!0,(a=document.createElement("script")).charset="utf-8",n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack","@tsparticles/path-zig-zag:"+r),a.src=e),s[e]=[t];var u=(t,r)=>{a.onerror=a.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),i&&document.head.appendChild(a)},n.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.g.importScripts&&(c=n.g.location+"");var s,c,p=n.g.document;if(!c&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(c=p.currentScript.src),!c)){var l=p.getElementsByTagName("script");if(l.length)for(var u=l.length-1;u>-1&&(!c||!/^http(s?):/.test(c));)c=l[u--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");n.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={952:0},n.f.j=(e,r)=>{var o=n.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var a=new Promise((r,a)=>o=t[e]=[r,a]);r.push(o[2]=a);var i=n.p+n.u(e),s=Error();n.l(i,r=>{if(n.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,a,[i,s,c]=r,p=0;if(i.some(e=>0!==t[e])){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);c&&c(n)}for(e&&e(r);p<i.length;p++)a=i[p],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0},(o=this.webpackChunk_tsparticles_path_zig_zag=this.webpackChunk_tsparticles_path_zig_zag||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};n.r(d),n.d(d,{loadZigZagPath:()=>g,zigZagPathName:()=>f});let f="zigZagPathGenerator";async function g(e){e.checkVersion("4.0.0-alpha.21"),await e.register(e=>{e.addPathGenerator(f,async e=>{let{ZigZagPathGenerator:t}=await n.e(839).then(n.bind(n,839));return new t(e)})})}return d})());
|
|
@@ -12,10 +12,11 @@ interface IZigZagOptions {
|
|
|
12
12
|
waveLength: RangeValue;
|
|
13
13
|
}
|
|
14
14
|
export declare class ZigZagPathGenerator implements IMovePathGenerator {
|
|
15
|
-
options: IZigZagOptions;
|
|
16
|
-
|
|
15
|
+
readonly options: IZigZagOptions;
|
|
16
|
+
private readonly _container;
|
|
17
|
+
constructor(container: Container);
|
|
17
18
|
generate(particle: ZigZagParticle, delta: IDelta): Vector;
|
|
18
|
-
init(
|
|
19
|
+
init(): void;
|
|
19
20
|
reset(): void;
|
|
20
21
|
update(): void;
|
|
21
22
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -11,19 +11,24 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ZigZagPathGenerator = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const angularFrequencyFactor = 0.5,
|
|
14
|
+
const angularFrequencyFactor = 0.5, halfPI = Math.PI * engine_1.half;
|
|
15
|
+
const defaultOptions = {
|
|
16
|
+
waveHeight: { min: 0, max: 3 },
|
|
17
|
+
waveLength: { min: 0, max: 5 },
|
|
18
|
+
};
|
|
15
19
|
class ZigZagPathGenerator {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
20
|
+
options;
|
|
21
|
+
_container;
|
|
22
|
+
constructor(container) {
|
|
23
|
+
this._container = container;
|
|
24
|
+
this.options = (0, engine_1.deepExtend)({}, defaultOptions);
|
|
21
25
|
}
|
|
22
26
|
generate(particle, delta) {
|
|
27
|
+
const { options } = this;
|
|
23
28
|
particle.zigzag ??= {
|
|
24
29
|
counter: (0, engine_1.getRandom)(),
|
|
25
|
-
waveHeight: (0, engine_1.getRangeValue)(
|
|
26
|
-
waveLength: (0, engine_1.getRangeValue)(
|
|
30
|
+
waveHeight: (0, engine_1.getRangeValue)(options.waveHeight),
|
|
31
|
+
waveLength: (0, engine_1.getRangeValue)(options.waveLength),
|
|
27
32
|
};
|
|
28
33
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
29
34
|
particle.zigzag.counter += angularFrequency;
|
|
@@ -32,10 +37,10 @@
|
|
|
32
37
|
particle.position.y += zigzagAngle * Math.sin(particle.velocity.angle + halfPI);
|
|
33
38
|
return engine_1.Vector.origin;
|
|
34
39
|
}
|
|
35
|
-
init(
|
|
36
|
-
const
|
|
37
|
-
this.options.waveLength =
|
|
38
|
-
this.options.waveHeight =
|
|
40
|
+
init() {
|
|
41
|
+
const sourceOptions = this._container.actualOptions.particles.move.path.options;
|
|
42
|
+
this.options.waveLength = sourceOptions["waveLength"] ?? this.options.waveLength;
|
|
43
|
+
this.options.waveHeight = sourceOptions["waveHeight"] ?? this.options.waveHeight;
|
|
39
44
|
}
|
|
40
45
|
reset() {
|
|
41
46
|
}
|
package/umd/index.js
CHANGED
|
@@ -46,11 +46,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
exports.zigZagPathName = void 0;
|
|
47
47
|
exports.loadZigZagPath = loadZigZagPath;
|
|
48
48
|
exports.zigZagPathName = "zigZagPathGenerator";
|
|
49
|
-
function loadZigZagPath(engine) {
|
|
50
|
-
engine.checkVersion("4.0.0-alpha.
|
|
51
|
-
engine.register(
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
async function loadZigZagPath(engine) {
|
|
50
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
51
|
+
await engine.register(e => {
|
|
52
|
+
e.addPathGenerator(exports.zigZagPathName, async (container) => {
|
|
53
|
+
const { ZigZagPathGenerator } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ZigZagPathGenerator.js"))) : new Promise((resolve_1, reject_1) => { require(["./ZigZagPathGenerator.js"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
+
return new ZigZagPathGenerator(container);
|
|
55
|
+
});
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
});
|
package/345.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 345.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_path_zig_zag=this.webpackChunk_tsparticles_path_zig_zag||[]).push([[345],{345(t,e,a){a.d(e,{ZigZagPathGenerator:()=>g});var i=a(303);const n=.5*Math.PI;class g{constructor(){this.options={waveHeight:{min:0,max:3},waveLength:{min:0,max:5}}}generate(t,e){t.zigzag??={counter:(0,i.getRandom)(),waveHeight:(0,i.getRangeValue)(this.options.waveHeight),waveLength:(0,i.getRangeValue)(this.options.waveLength)};const a=.5/t.zigzag.waveLength*e.factor;t.zigzag.counter+=a;const g=t.zigzag.waveHeight*Math.sin(t.zigzag.counter);return t.position.x+=g*Math.cos(t.velocity.angle+n),t.position.y+=g*Math.sin(t.velocity.angle+n),i.Vector.origin}init(t){const e=t.actualOptions.particles.move.path.options;this.options.waveLength=e.waveLength??this.options.waveLength,this.options.waveHeight=e.waveHeight??this.options.waveHeight}reset(){}update(){}}}}]);
|
package/345.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Zig Zag Path v4.0.0-alpha.2 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Zig Zag Path v4.0.0-alpha.2 by Matteo Bruni */
|