@tsparticles/path-zig-zag 3.9.0 → 4.0.0-alpha.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/345.min.js +2 -0
- package/345.min.js.LICENSE.txt +1 -0
- package/browser/ZigZagPathGenerator.js +7 -9
- package/browser/index.js +6 -4
- package/cjs/ZigZagPathGenerator.js +10 -16
- package/cjs/index.js +7 -9
- package/dist_browser_ZigZagPathGenerator_js.js +30 -0
- package/esm/ZigZagPathGenerator.js +7 -9
- package/esm/index.js +6 -4
- package/package.json +4 -3
- package/report.html +5 -4
- package/tsparticles.path.zigzag.js +209 -30
- package/tsparticles.path.zigzag.min.js +1 -1
- package/tsparticles.path.zigzag.min.js.LICENSE.txt +1 -1
- package/types/index.d.ts +1 -1
- package/umd/ZigZagPathGenerator.js +7 -9
- package/umd/index.js +41 -5
package/345.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
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(){}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Zig Zag Path v4.0.0-alpha.0 by Matteo Bruni */
|
|
@@ -8,13 +8,11 @@ export class ZigZagPathGenerator {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
generate(particle, delta) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
}
|
|
11
|
+
particle.zigzag ??= {
|
|
12
|
+
counter: getRandom(),
|
|
13
|
+
waveHeight: getRangeValue(this.options.waveHeight),
|
|
14
|
+
waveLength: getRangeValue(this.options.waveLength),
|
|
15
|
+
};
|
|
18
16
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
19
17
|
particle.zigzag.counter += angularFrequency;
|
|
20
18
|
const zigzagAngle = particle.zigzag.waveHeight * Math.sin(particle.zigzag.counter);
|
|
@@ -24,8 +22,8 @@ export class ZigZagPathGenerator {
|
|
|
24
22
|
}
|
|
25
23
|
init(container) {
|
|
26
24
|
const options = container.actualOptions.particles.move.path.options;
|
|
27
|
-
this.options.waveLength = options
|
|
28
|
-
this.options.waveHeight = options
|
|
25
|
+
this.options.waveLength = options["waveLength"] ?? this.options.waveLength;
|
|
26
|
+
this.options.waveHeight = options["waveHeight"] ?? this.options.waveHeight;
|
|
29
27
|
}
|
|
30
28
|
reset() {
|
|
31
29
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ZigZagPathGenerator } from "./ZigZagPathGenerator.js";
|
|
2
1
|
export const zigZagPathName = "zigZagPathGenerator";
|
|
3
|
-
export
|
|
4
|
-
engine.checkVersion("
|
|
5
|
-
|
|
2
|
+
export function loadZigZagPath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
4
|
+
engine.register(async (e) => {
|
|
5
|
+
const { ZigZagPathGenerator } = await import("./ZigZagPathGenerator.js");
|
|
6
|
+
e.addPathGenerator(zigZagPathName, new ZigZagPathGenerator());
|
|
7
|
+
});
|
|
6
8
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZigZagPathGenerator = void 0;
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
1
|
+
import { Vector, getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
5
2
|
const angularFrequencyFactor = 0.5, half = 0.5, halfPI = Math.PI * half;
|
|
6
|
-
class ZigZagPathGenerator {
|
|
3
|
+
export class ZigZagPathGenerator {
|
|
7
4
|
constructor() {
|
|
8
5
|
this.options = {
|
|
9
6
|
waveHeight: { min: 0, max: 3 },
|
|
@@ -11,28 +8,25 @@ class ZigZagPathGenerator {
|
|
|
11
8
|
};
|
|
12
9
|
}
|
|
13
10
|
generate(particle, delta) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
}
|
|
11
|
+
particle.zigzag ??= {
|
|
12
|
+
counter: getRandom(),
|
|
13
|
+
waveHeight: getRangeValue(this.options.waveHeight),
|
|
14
|
+
waveLength: getRangeValue(this.options.waveLength),
|
|
15
|
+
};
|
|
21
16
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
22
17
|
particle.zigzag.counter += angularFrequency;
|
|
23
18
|
const zigzagAngle = particle.zigzag.waveHeight * Math.sin(particle.zigzag.counter);
|
|
24
19
|
particle.position.x += zigzagAngle * Math.cos(particle.velocity.angle + halfPI);
|
|
25
20
|
particle.position.y += zigzagAngle * Math.sin(particle.velocity.angle + halfPI);
|
|
26
|
-
return
|
|
21
|
+
return Vector.origin;
|
|
27
22
|
}
|
|
28
23
|
init(container) {
|
|
29
24
|
const options = container.actualOptions.particles.move.path.options;
|
|
30
|
-
this.options.waveLength = options
|
|
31
|
-
this.options.waveHeight = options
|
|
25
|
+
this.options.waveLength = options["waveLength"] ?? this.options.waveLength;
|
|
26
|
+
this.options.waveHeight = options["waveHeight"] ?? this.options.waveHeight;
|
|
32
27
|
}
|
|
33
28
|
reset() {
|
|
34
29
|
}
|
|
35
30
|
update() {
|
|
36
31
|
}
|
|
37
32
|
}
|
|
38
|
-
exports.ZigZagPathGenerator = ZigZagPathGenerator;
|
package/cjs/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
engine.checkVersion("3.9.0");
|
|
9
|
-
await engine.addPathGenerator(exports.zigZagPathName, new ZigZagPathGenerator_js_1.ZigZagPathGenerator(), refresh);
|
|
1
|
+
export const zigZagPathName = "zigZagPathGenerator";
|
|
2
|
+
export function loadZigZagPath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
4
|
+
engine.register(async (e) => {
|
|
5
|
+
const { ZigZagPathGenerator } = await import("./ZigZagPathGenerator.js");
|
|
6
|
+
e.addPathGenerator(zigZagPathName, new ZigZagPathGenerator());
|
|
7
|
+
});
|
|
10
8
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Author : Matteo Bruni
|
|
3
|
+
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
+
* Demo / Generator : https://particles.js.org/
|
|
5
|
+
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
+
* How to use? : Check the GitHub README
|
|
7
|
+
* v4.0.0-alpha.0
|
|
8
|
+
*/
|
|
9
|
+
"use strict";
|
|
10
|
+
/*
|
|
11
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
+
* This devtool is neither made for production nor for readable output files.
|
|
13
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
+
* or disable the default devtool with "devtool: false".
|
|
16
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
+
*/
|
|
18
|
+
(this["webpackChunk_tsparticles_path_zig_zag"] = this["webpackChunk_tsparticles_path_zig_zag"] || []).push([["dist_browser_ZigZagPathGenerator_js"],{
|
|
19
|
+
|
|
20
|
+
/***/ "./dist/browser/ZigZagPathGenerator.js"
|
|
21
|
+
/*!*********************************************!*\
|
|
22
|
+
!*** ./dist/browser/ZigZagPathGenerator.js ***!
|
|
23
|
+
\*********************************************/
|
|
24
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
+
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ZigZagPathGenerator: () => (/* binding */ ZigZagPathGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst angularFrequencyFactor = 0.5,\n half = 0.5,\n halfPI = Math.PI * half;\nclass ZigZagPathGenerator {\n constructor() {\n this.options = {\n waveHeight: {\n min: 0,\n max: 3\n },\n waveLength: {\n min: 0,\n max: 5\n }\n };\n }\n generate(particle, delta) {\n particle.zigzag ??= {\n counter: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)(),\n waveHeight: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.waveHeight),\n waveLength: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.waveLength)\n };\n const angularFrequency = angularFrequencyFactor / particle.zigzag.waveLength * delta.factor;\n particle.zigzag.counter += angularFrequency;\n const zigzagAngle = particle.zigzag.waveHeight * Math.sin(particle.zigzag.counter);\n particle.position.x += zigzagAngle * Math.cos(particle.velocity.angle + halfPI);\n particle.position.y += zigzagAngle * Math.sin(particle.velocity.angle + halfPI);\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n }\n init(container) {\n const options = container.actualOptions.particles.move.path.options;\n this.options.waveLength = options[\"waveLength\"] ?? this.options.waveLength;\n this.options.waveHeight = options[\"waveHeight\"] ?? this.options.waveHeight;\n }\n reset() {}\n update() {}\n}\n\n//# sourceURL=webpack://@tsparticles/path-zig-zag/./dist/browser/ZigZagPathGenerator.js?\n}");
|
|
27
|
+
|
|
28
|
+
/***/ }
|
|
29
|
+
|
|
30
|
+
}]);
|
|
@@ -8,13 +8,11 @@ export class ZigZagPathGenerator {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
generate(particle, delta) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
}
|
|
11
|
+
particle.zigzag ??= {
|
|
12
|
+
counter: getRandom(),
|
|
13
|
+
waveHeight: getRangeValue(this.options.waveHeight),
|
|
14
|
+
waveLength: getRangeValue(this.options.waveLength),
|
|
15
|
+
};
|
|
18
16
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
19
17
|
particle.zigzag.counter += angularFrequency;
|
|
20
18
|
const zigzagAngle = particle.zigzag.waveHeight * Math.sin(particle.zigzag.counter);
|
|
@@ -24,8 +22,8 @@ export class ZigZagPathGenerator {
|
|
|
24
22
|
}
|
|
25
23
|
init(container) {
|
|
26
24
|
const options = container.actualOptions.particles.move.path.options;
|
|
27
|
-
this.options.waveLength = options
|
|
28
|
-
this.options.waveHeight = options
|
|
25
|
+
this.options.waveLength = options["waveLength"] ?? this.options.waveLength;
|
|
26
|
+
this.options.waveHeight = options["waveHeight"] ?? this.options.waveHeight;
|
|
29
27
|
}
|
|
30
28
|
reset() {
|
|
31
29
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ZigZagPathGenerator } from "./ZigZagPathGenerator.js";
|
|
2
1
|
export const zigZagPathName = "zigZagPathGenerator";
|
|
3
|
-
export
|
|
4
|
-
engine.checkVersion("
|
|
5
|
-
|
|
2
|
+
export function loadZigZagPath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
4
|
+
engine.register(async (e) => {
|
|
5
|
+
const { ZigZagPathGenerator } = await import("./ZigZagPathGenerator.js");
|
|
6
|
+
e.addPathGenerator(zigZagPathName, new ZigZagPathGenerator());
|
|
7
|
+
});
|
|
6
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/path-zig-zag",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"description": "tsParticles zig zag path",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -101,9 +101,10 @@
|
|
|
101
101
|
"./package.json": "./package.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@tsparticles/engine": "
|
|
104
|
+
"@tsparticles/engine": "4.0.0-alpha.0"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"type": "module"
|
|
109
110
|
}
|