@tsparticles/path-zig-zag 4.0.0-alpha.0 → 4.0.0-alpha.14
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/923.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 +2 -2
- 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
package/923.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_path_zig_zag=this.webpackChunk_tsparticles_path_zig_zag||[]).push([[923],{923(t,e,a){a.d(e,{ZigZagPathGenerator:()=>h});var i=a(303);let n=Math.PI*i.half,g={waveHeight:{min:0,max:3},waveLength:{min:0,max:5}};class h{options;_container;constructor(t){this._container=t,this.options=(0,i.deepExtend)({},g)}generate(t,e){let{options:a}=this;t.zigzag??={counter:(0,i.getRandom)(),waveHeight:(0,i.getRangeValue)(a.waveHeight),waveLength:(0,i.getRangeValue)(a.waveLength)};let g=.5/t.zigzag.waveLength*e.factor;t.zigzag.counter+=g;let h=t.zigzag.waveHeight*Math.sin(t.zigzag.counter);return t.position.x+=h*Math.cos(t.velocity.angle+n),t.position.y+=h*Math.sin(t.velocity.angle+n),i.Vector.origin}init(){let t=this._container.actualOptions.particles.move.path.options;this.options.waveLength=t.waveLength??this.options.waveLength,this.options.waveHeight=t.waveHeight??this.options.waveHeight}reset(){}update(){}}}}]);
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { Vector, getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
-
const angularFrequencyFactor = 0.5,
|
|
1
|
+
import { Vector, deepExtend, getRandom, getRangeValue, half, } from "@tsparticles/engine";
|
|
2
|
+
const angularFrequencyFactor = 0.5, halfPI = Math.PI * half;
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
waveHeight: { min: 0, max: 3 },
|
|
5
|
+
waveLength: { min: 0, max: 5 },
|
|
6
|
+
};
|
|
3
7
|
export class ZigZagPathGenerator {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
options;
|
|
9
|
+
_container;
|
|
10
|
+
constructor(container) {
|
|
11
|
+
this._container = container;
|
|
12
|
+
this.options = deepExtend({}, defaultOptions);
|
|
9
13
|
}
|
|
10
14
|
generate(particle, delta) {
|
|
15
|
+
const { options } = this;
|
|
11
16
|
particle.zigzag ??= {
|
|
12
17
|
counter: getRandom(),
|
|
13
|
-
waveHeight: getRangeValue(
|
|
14
|
-
waveLength: getRangeValue(
|
|
18
|
+
waveHeight: getRangeValue(options.waveHeight),
|
|
19
|
+
waveLength: getRangeValue(options.waveLength),
|
|
15
20
|
};
|
|
16
21
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
17
22
|
particle.zigzag.counter += angularFrequency;
|
|
@@ -20,10 +25,10 @@ export class ZigZagPathGenerator {
|
|
|
20
25
|
particle.position.y += zigzagAngle * Math.sin(particle.velocity.angle + halfPI);
|
|
21
26
|
return Vector.origin;
|
|
22
27
|
}
|
|
23
|
-
init(
|
|
24
|
-
const
|
|
25
|
-
this.options.waveLength =
|
|
26
|
-
this.options.waveHeight =
|
|
28
|
+
init() {
|
|
29
|
+
const sourceOptions = this._container.actualOptions.particles.move.path.options;
|
|
30
|
+
this.options.waveLength = sourceOptions["waveLength"] ?? this.options.waveLength;
|
|
31
|
+
this.options.waveHeight = sourceOptions["waveHeight"] ?? this.options.waveHeight;
|
|
27
32
|
}
|
|
28
33
|
reset() {
|
|
29
34
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export const zigZagPathName = "zigZagPathGenerator";
|
|
2
|
-
export function loadZigZagPath(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-alpha.
|
|
4
|
-
engine.register(
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export async function loadZigZagPath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
4
|
+
await engine.register(e => {
|
|
5
|
+
e.addPathGenerator(zigZagPathName, async (container) => {
|
|
6
|
+
const { ZigZagPathGenerator } = await import("./ZigZagPathGenerator.js");
|
|
7
|
+
return new ZigZagPathGenerator(container);
|
|
8
|
+
});
|
|
7
9
|
});
|
|
8
10
|
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { Vector, getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
-
const angularFrequencyFactor = 0.5,
|
|
1
|
+
import { Vector, deepExtend, getRandom, getRangeValue, half, } from "@tsparticles/engine";
|
|
2
|
+
const angularFrequencyFactor = 0.5, halfPI = Math.PI * half;
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
waveHeight: { min: 0, max: 3 },
|
|
5
|
+
waveLength: { min: 0, max: 5 },
|
|
6
|
+
};
|
|
3
7
|
export class ZigZagPathGenerator {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
options;
|
|
9
|
+
_container;
|
|
10
|
+
constructor(container) {
|
|
11
|
+
this._container = container;
|
|
12
|
+
this.options = deepExtend({}, defaultOptions);
|
|
9
13
|
}
|
|
10
14
|
generate(particle, delta) {
|
|
15
|
+
const { options } = this;
|
|
11
16
|
particle.zigzag ??= {
|
|
12
17
|
counter: getRandom(),
|
|
13
|
-
waveHeight: getRangeValue(
|
|
14
|
-
waveLength: getRangeValue(
|
|
18
|
+
waveHeight: getRangeValue(options.waveHeight),
|
|
19
|
+
waveLength: getRangeValue(options.waveLength),
|
|
15
20
|
};
|
|
16
21
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
17
22
|
particle.zigzag.counter += angularFrequency;
|
|
@@ -20,10 +25,10 @@ export class ZigZagPathGenerator {
|
|
|
20
25
|
particle.position.y += zigzagAngle * Math.sin(particle.velocity.angle + halfPI);
|
|
21
26
|
return Vector.origin;
|
|
22
27
|
}
|
|
23
|
-
init(
|
|
24
|
-
const
|
|
25
|
-
this.options.waveLength =
|
|
26
|
-
this.options.waveHeight =
|
|
28
|
+
init() {
|
|
29
|
+
const sourceOptions = this._container.actualOptions.particles.move.path.options;
|
|
30
|
+
this.options.waveLength = sourceOptions["waveLength"] ?? this.options.waveLength;
|
|
31
|
+
this.options.waveHeight = sourceOptions["waveHeight"] ?? this.options.waveHeight;
|
|
27
32
|
}
|
|
28
33
|
reset() {
|
|
29
34
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export const zigZagPathName = "zigZagPathGenerator";
|
|
2
|
-
export function loadZigZagPath(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-alpha.
|
|
4
|
-
engine.register(
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export async function loadZigZagPath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
4
|
+
await engine.register(e => {
|
|
5
|
+
e.addPathGenerator(zigZagPathName, async (container) => {
|
|
6
|
+
const { ZigZagPathGenerator } = await import("./ZigZagPathGenerator.js");
|
|
7
|
+
return new ZigZagPathGenerator(container);
|
|
8
|
+
});
|
|
7
9
|
});
|
|
8
10
|
}
|
|
@@ -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.14
|
|
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 */ 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
|
|
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, halfPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half;\nconst defaultOptions = {\n waveHeight: {\n min: 0,\n max: 3\n },\n waveLength: {\n min: 0,\n max: 5\n }\n};\nclass ZigZagPathGenerator {\n options;\n _container;\n constructor(container){\n this._container = container;\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, defaultOptions);\n }\n generate(particle, delta) {\n const { options } = this;\n particle.zigzag ??= {\n counter: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)(),\n waveHeight: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(options.waveHeight),\n waveLength: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(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() {\n const sourceOptions = this._container.actualOptions.particles.move.path.options;\n this.options.waveLength = sourceOptions[\"waveLength\"] ?? this.options.waveLength;\n this.options.waveHeight = sourceOptions[\"waveHeight\"] ?? this.options.waveHeight;\n }\n reset() {}\n update() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-zig-zag/./dist/browser/ZigZagPathGenerator.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { Vector, getRandom, getRangeValue, } from "@tsparticles/engine";
|
|
2
|
-
const angularFrequencyFactor = 0.5,
|
|
1
|
+
import { Vector, deepExtend, getRandom, getRangeValue, half, } from "@tsparticles/engine";
|
|
2
|
+
const angularFrequencyFactor = 0.5, halfPI = Math.PI * half;
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
waveHeight: { min: 0, max: 3 },
|
|
5
|
+
waveLength: { min: 0, max: 5 },
|
|
6
|
+
};
|
|
3
7
|
export class ZigZagPathGenerator {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
8
|
+
options;
|
|
9
|
+
_container;
|
|
10
|
+
constructor(container) {
|
|
11
|
+
this._container = container;
|
|
12
|
+
this.options = deepExtend({}, defaultOptions);
|
|
9
13
|
}
|
|
10
14
|
generate(particle, delta) {
|
|
15
|
+
const { options } = this;
|
|
11
16
|
particle.zigzag ??= {
|
|
12
17
|
counter: getRandom(),
|
|
13
|
-
waveHeight: getRangeValue(
|
|
14
|
-
waveLength: getRangeValue(
|
|
18
|
+
waveHeight: getRangeValue(options.waveHeight),
|
|
19
|
+
waveLength: getRangeValue(options.waveLength),
|
|
15
20
|
};
|
|
16
21
|
const angularFrequency = (angularFrequencyFactor / particle.zigzag.waveLength) * delta.factor;
|
|
17
22
|
particle.zigzag.counter += angularFrequency;
|
|
@@ -20,10 +25,10 @@ export class ZigZagPathGenerator {
|
|
|
20
25
|
particle.position.y += zigzagAngle * Math.sin(particle.velocity.angle + halfPI);
|
|
21
26
|
return Vector.origin;
|
|
22
27
|
}
|
|
23
|
-
init(
|
|
24
|
-
const
|
|
25
|
-
this.options.waveLength =
|
|
26
|
-
this.options.waveHeight =
|
|
28
|
+
init() {
|
|
29
|
+
const sourceOptions = this._container.actualOptions.particles.move.path.options;
|
|
30
|
+
this.options.waveLength = sourceOptions["waveLength"] ?? this.options.waveLength;
|
|
31
|
+
this.options.waveHeight = sourceOptions["waveHeight"] ?? this.options.waveHeight;
|
|
27
32
|
}
|
|
28
33
|
reset() {
|
|
29
34
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export const zigZagPathName = "zigZagPathGenerator";
|
|
2
|
-
export function loadZigZagPath(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-alpha.
|
|
4
|
-
engine.register(
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export async function loadZigZagPath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
4
|
+
await engine.register(e => {
|
|
5
|
+
e.addPathGenerator(zigZagPathName, async (container) => {
|
|
6
|
+
const { ZigZagPathGenerator } = await import("./ZigZagPathGenerator.js");
|
|
7
|
+
return new ZigZagPathGenerator(container);
|
|
8
|
+
});
|
|
7
9
|
});
|
|
8
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/path-zig-zag",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.14",
|
|
4
4
|
"description": "tsParticles zig zag path",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"./package.json": "./package.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
104
|
+
"@tsparticles/engine": "4.0.0-alpha.14"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|