@tsparticles/path-fractal-noise 3.9.1 → 4.0.0-alpha.1
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/819.min.js +2 -0
- package/819.min.js.LICENSE.txt +1 -0
- package/browser/FractalNoiseGenerator.js +9 -96
- package/browser/index.js +6 -4
- package/cjs/FractalNoiseGenerator.js +10 -101
- package/cjs/index.js +7 -9
- package/dist_browser_FractalNoiseGenerator_js.js +30 -0
- package/esm/FractalNoiseGenerator.js +9 -96
- package/esm/index.js +6 -4
- package/package.json +6 -4
- package/report.html +5 -4
- package/tsparticles.path.fractal.noise.js +223 -44
- package/tsparticles.path.fractal.noise.min.js +1 -1
- package/tsparticles.path.fractal.noise.min.js.LICENSE.txt +1 -1
- package/types/FractalNoiseGenerator.d.ts +2 -16
- package/types/index.d.ts +1 -1
- package/umd/FractalNoiseGenerator.js +10 -97
- package/umd/index.js +41 -5
- package/browser/IFractalOptions.js +0 -1
- package/browser/IOffsetValues.js +0 -1
- package/cjs/IFractalOptions.js +0 -2
- package/cjs/IOffsetValues.js +0 -2
- package/esm/IFractalOptions.js +0 -1
- package/esm/IOffsetValues.js +0 -1
- package/types/IFractalOptions.d.ts +0 -12
- package/types/IOffsetValues.d.ts +0 -5
- package/umd/IFractalOptions.js +0 -12
- package/umd/IOffsetValues.js +0 -12
package/819.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 819.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_path_fractal_noise=this.webpackChunk_tsparticles_path_fractal_noise||[]).push([[819],{819(e,s,a){a.d(s,{FractalNoiseGenerator:()=>c});var t=a(689),r=a(104);class c extends r.NoiseFieldGenerator{constructor(){const e=new t.FractalNoise;super({noise4d:(s,a,t,r)=>e.noise4d(s,a,t,r),seed:s=>{e.seed(s)}})}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Fractal Noise Path v4.0.0-alpha.1 by Matteo Bruni */
|
|
@@ -1,100 +1,13 @@
|
|
|
1
|
-
import { Vector, deepExtend, getRandom, } from "@tsparticles/engine";
|
|
2
1
|
import { FractalNoise } from "@tsparticles/fractal-noise";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
increment: 0.004,
|
|
6
|
-
columns: 0,
|
|
7
|
-
rows: 0,
|
|
8
|
-
layers: 0,
|
|
9
|
-
width: 0,
|
|
10
|
-
height: 0,
|
|
11
|
-
offset: {
|
|
12
|
-
x: 40000,
|
|
13
|
-
y: 40000,
|
|
14
|
-
z: 40000,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export class FractalNoiseGenerator {
|
|
2
|
+
import { NoiseFieldGenerator } from "@tsparticles/noise-field";
|
|
3
|
+
export class FractalNoiseGenerator extends NoiseFieldGenerator {
|
|
18
4
|
constructor() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
x: Math.max(Math.floor(pos.x / this.options.size), 0),
|
|
27
|
-
y: Math.max(Math.floor(pos.y / this.options.size), 0),
|
|
28
|
-
z: Math.max(Math.floor(pos.z / this.options.size), 0),
|
|
29
|
-
}, v = Vector.origin;
|
|
30
|
-
if (!this.field?.[point.x]?.[point.y]?.[point.z]) {
|
|
31
|
-
return v;
|
|
32
|
-
}
|
|
33
|
-
v.setTo(this.field[point.x][point.y][point.z]);
|
|
34
|
-
return v;
|
|
35
|
-
}
|
|
36
|
-
init(container) {
|
|
37
|
-
this.container = container;
|
|
38
|
-
this._setup();
|
|
39
|
-
}
|
|
40
|
-
reset() {
|
|
41
|
-
}
|
|
42
|
-
update() {
|
|
43
|
-
if (!this.container) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
this._calculateField();
|
|
47
|
-
this.noiseW += this.options.increment;
|
|
48
|
-
}
|
|
49
|
-
_calculateField() {
|
|
50
|
-
const options = this.options;
|
|
51
|
-
for (let x = 0; x < options.columns; x++) {
|
|
52
|
-
for (let y = 0; y < options.rows; y++) {
|
|
53
|
-
for (let z = 0; z < options.layers; z++) {
|
|
54
|
-
this.field[x][y][z].angle =
|
|
55
|
-
this._fractal.noise4d(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
|
|
56
|
-
this.field[x][y][z].length = this._fractal.noise4d(x / 100 + options.offset.x, y / 100 + options.offset.y, z / 100 + options.offset.z, this.noiseW);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
_initField() {
|
|
62
|
-
this.field = new Array(this.options.columns);
|
|
63
|
-
for (let x = 0; x < this.options.columns; x++) {
|
|
64
|
-
this.field[x] = new Array(this.options.rows);
|
|
65
|
-
for (let y = 0; y < this.options.rows; y++) {
|
|
66
|
-
this.field[x][y] = new Array(this.options.layers);
|
|
67
|
-
for (let z = 0; z < this.options.layers; z++) {
|
|
68
|
-
this.field[x][y][z] = Vector.origin;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_resetField() {
|
|
74
|
-
const container = this.container;
|
|
75
|
-
if (!container) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
79
|
-
this.options.size = sourceOptions.size > 0 ? sourceOptions.size : defaultOptions.size;
|
|
80
|
-
this.options.increment =
|
|
81
|
-
sourceOptions.increment > 0 ? sourceOptions.increment : defaultOptions.increment;
|
|
82
|
-
this.options.width = container.canvas.size.width;
|
|
83
|
-
this.options.height = container.canvas.size.height;
|
|
84
|
-
const offset = sourceOptions.offset;
|
|
85
|
-
this.options.offset.x = offset?.x ?? defaultOptions.offset.x;
|
|
86
|
-
this.options.offset.y = offset?.y ?? defaultOptions.offset.y;
|
|
87
|
-
this.options.offset.z = offset?.z ?? defaultOptions.offset.z;
|
|
88
|
-
this.options.seed = sourceOptions.seed;
|
|
89
|
-
this._fractal.seed(this.options.seed ?? getRandom());
|
|
90
|
-
this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
|
|
91
|
-
this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
|
|
92
|
-
this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
|
|
93
|
-
this._initField();
|
|
94
|
-
}
|
|
95
|
-
_setup() {
|
|
96
|
-
this.noiseW = 0;
|
|
97
|
-
this._resetField();
|
|
98
|
-
addEventListener("resize", () => this._resetField());
|
|
5
|
+
const fractalNoise = new FractalNoise();
|
|
6
|
+
super({
|
|
7
|
+
noise4d: (x, y, z, w) => fractalNoise.noise4d(x, y, z, w),
|
|
8
|
+
seed: seed => {
|
|
9
|
+
fractalNoise.seed(seed);
|
|
10
|
+
},
|
|
11
|
+
});
|
|
99
12
|
}
|
|
100
13
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { FractalNoiseGenerator } from "./FractalNoiseGenerator.js";
|
|
2
1
|
export const fractalNoisePathName = "fractalNoise";
|
|
3
|
-
export
|
|
4
|
-
engine.checkVersion("
|
|
5
|
-
|
|
2
|
+
export function loadFractalNoisePath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.1");
|
|
4
|
+
engine.register(async (e) => {
|
|
5
|
+
const { FractalNoiseGenerator } = await import("./FractalNoiseGenerator.js");
|
|
6
|
+
e.addPathGenerator(fractalNoisePathName, new FractalNoiseGenerator());
|
|
7
|
+
});
|
|
6
8
|
}
|
|
@@ -1,104 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const fractal_noise_1 = require("@tsparticles/fractal-noise");
|
|
6
|
-
const defaultOptions = {
|
|
7
|
-
size: 20,
|
|
8
|
-
increment: 0.004,
|
|
9
|
-
columns: 0,
|
|
10
|
-
rows: 0,
|
|
11
|
-
layers: 0,
|
|
12
|
-
width: 0,
|
|
13
|
-
height: 0,
|
|
14
|
-
offset: {
|
|
15
|
-
x: 40000,
|
|
16
|
-
y: 40000,
|
|
17
|
-
z: 40000,
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
class FractalNoiseGenerator {
|
|
1
|
+
import { FractalNoise } from "@tsparticles/fractal-noise";
|
|
2
|
+
import { NoiseFieldGenerator } from "@tsparticles/noise-field";
|
|
3
|
+
export class FractalNoiseGenerator extends NoiseFieldGenerator {
|
|
21
4
|
constructor() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
x: Math.max(Math.floor(pos.x / this.options.size), 0),
|
|
30
|
-
y: Math.max(Math.floor(pos.y / this.options.size), 0),
|
|
31
|
-
z: Math.max(Math.floor(pos.z / this.options.size), 0),
|
|
32
|
-
}, v = engine_1.Vector.origin;
|
|
33
|
-
if (!this.field?.[point.x]?.[point.y]?.[point.z]) {
|
|
34
|
-
return v;
|
|
35
|
-
}
|
|
36
|
-
v.setTo(this.field[point.x][point.y][point.z]);
|
|
37
|
-
return v;
|
|
38
|
-
}
|
|
39
|
-
init(container) {
|
|
40
|
-
this.container = container;
|
|
41
|
-
this._setup();
|
|
42
|
-
}
|
|
43
|
-
reset() {
|
|
44
|
-
}
|
|
45
|
-
update() {
|
|
46
|
-
if (!this.container) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this._calculateField();
|
|
50
|
-
this.noiseW += this.options.increment;
|
|
51
|
-
}
|
|
52
|
-
_calculateField() {
|
|
53
|
-
const options = this.options;
|
|
54
|
-
for (let x = 0; x < options.columns; x++) {
|
|
55
|
-
for (let y = 0; y < options.rows; y++) {
|
|
56
|
-
for (let z = 0; z < options.layers; z++) {
|
|
57
|
-
this.field[x][y][z].angle =
|
|
58
|
-
this._fractal.noise4d(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
|
|
59
|
-
this.field[x][y][z].length = this._fractal.noise4d(x / 100 + options.offset.x, y / 100 + options.offset.y, z / 100 + options.offset.z, this.noiseW);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
_initField() {
|
|
65
|
-
this.field = new Array(this.options.columns);
|
|
66
|
-
for (let x = 0; x < this.options.columns; x++) {
|
|
67
|
-
this.field[x] = new Array(this.options.rows);
|
|
68
|
-
for (let y = 0; y < this.options.rows; y++) {
|
|
69
|
-
this.field[x][y] = new Array(this.options.layers);
|
|
70
|
-
for (let z = 0; z < this.options.layers; z++) {
|
|
71
|
-
this.field[x][y][z] = engine_1.Vector.origin;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
_resetField() {
|
|
77
|
-
const container = this.container;
|
|
78
|
-
if (!container) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
82
|
-
this.options.size = sourceOptions.size > 0 ? sourceOptions.size : defaultOptions.size;
|
|
83
|
-
this.options.increment =
|
|
84
|
-
sourceOptions.increment > 0 ? sourceOptions.increment : defaultOptions.increment;
|
|
85
|
-
this.options.width = container.canvas.size.width;
|
|
86
|
-
this.options.height = container.canvas.size.height;
|
|
87
|
-
const offset = sourceOptions.offset;
|
|
88
|
-
this.options.offset.x = offset?.x ?? defaultOptions.offset.x;
|
|
89
|
-
this.options.offset.y = offset?.y ?? defaultOptions.offset.y;
|
|
90
|
-
this.options.offset.z = offset?.z ?? defaultOptions.offset.z;
|
|
91
|
-
this.options.seed = sourceOptions.seed;
|
|
92
|
-
this._fractal.seed(this.options.seed ?? (0, engine_1.getRandom)());
|
|
93
|
-
this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
|
|
94
|
-
this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
|
|
95
|
-
this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
|
|
96
|
-
this._initField();
|
|
97
|
-
}
|
|
98
|
-
_setup() {
|
|
99
|
-
this.noiseW = 0;
|
|
100
|
-
this._resetField();
|
|
101
|
-
addEventListener("resize", () => this._resetField());
|
|
5
|
+
const fractalNoise = new FractalNoise();
|
|
6
|
+
super({
|
|
7
|
+
noise4d: (x, y, z, w) => fractalNoise.noise4d(x, y, z, w),
|
|
8
|
+
seed: seed => {
|
|
9
|
+
fractalNoise.seed(seed);
|
|
10
|
+
},
|
|
11
|
+
});
|
|
102
12
|
}
|
|
103
13
|
}
|
|
104
|
-
exports.FractalNoiseGenerator = FractalNoiseGenerator;
|
package/cjs/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
engine.checkVersion("3.9.1");
|
|
9
|
-
await engine.addPathGenerator(exports.fractalNoisePathName, new FractalNoiseGenerator_js_1.FractalNoiseGenerator(), refresh);
|
|
1
|
+
export const fractalNoisePathName = "fractalNoise";
|
|
2
|
+
export function loadFractalNoisePath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.1");
|
|
4
|
+
engine.register(async (e) => {
|
|
5
|
+
const { FractalNoiseGenerator } = await import("./FractalNoiseGenerator.js");
|
|
6
|
+
e.addPathGenerator(fractalNoisePathName, new FractalNoiseGenerator());
|
|
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.1
|
|
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_fractal_noise"] = this["webpackChunk_tsparticles_path_fractal_noise"] || []).push([["dist_browser_FractalNoiseGenerator_js"],{
|
|
19
|
+
|
|
20
|
+
/***/ "./dist/browser/FractalNoiseGenerator.js"
|
|
21
|
+
/*!***********************************************!*\
|
|
22
|
+
!*** ./dist/browser/FractalNoiseGenerator.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 */ FractalNoiseGenerator: () => (/* binding */ FractalNoiseGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_fractal_noise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/fractal-noise */ \"@tsparticles/fractal-noise\");\n/* harmony import */ var _tsparticles_noise_field__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/noise-field */ \"@tsparticles/noise-field\");\n\n\nclass FractalNoiseGenerator extends _tsparticles_noise_field__WEBPACK_IMPORTED_MODULE_1__.NoiseFieldGenerator {\n constructor() {\n const fractalNoise = new _tsparticles_fractal_noise__WEBPACK_IMPORTED_MODULE_0__.FractalNoise();\n super({\n noise4d: (x, y, z, w) => fractalNoise.noise4d(x, y, z, w),\n seed: seed => {\n fractalNoise.seed(seed);\n }\n });\n }\n}\n\n//# sourceURL=webpack://@tsparticles/path-fractal-noise/./dist/browser/FractalNoiseGenerator.js?\n}");
|
|
27
|
+
|
|
28
|
+
/***/ }
|
|
29
|
+
|
|
30
|
+
}]);
|
|
@@ -1,100 +1,13 @@
|
|
|
1
|
-
import { Vector, deepExtend, getRandom, } from "@tsparticles/engine";
|
|
2
1
|
import { FractalNoise } from "@tsparticles/fractal-noise";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
increment: 0.004,
|
|
6
|
-
columns: 0,
|
|
7
|
-
rows: 0,
|
|
8
|
-
layers: 0,
|
|
9
|
-
width: 0,
|
|
10
|
-
height: 0,
|
|
11
|
-
offset: {
|
|
12
|
-
x: 40000,
|
|
13
|
-
y: 40000,
|
|
14
|
-
z: 40000,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export class FractalNoiseGenerator {
|
|
2
|
+
import { NoiseFieldGenerator } from "@tsparticles/noise-field";
|
|
3
|
+
export class FractalNoiseGenerator extends NoiseFieldGenerator {
|
|
18
4
|
constructor() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
x: Math.max(Math.floor(pos.x / this.options.size), 0),
|
|
27
|
-
y: Math.max(Math.floor(pos.y / this.options.size), 0),
|
|
28
|
-
z: Math.max(Math.floor(pos.z / this.options.size), 0),
|
|
29
|
-
}, v = Vector.origin;
|
|
30
|
-
if (!this.field?.[point.x]?.[point.y]?.[point.z]) {
|
|
31
|
-
return v;
|
|
32
|
-
}
|
|
33
|
-
v.setTo(this.field[point.x][point.y][point.z]);
|
|
34
|
-
return v;
|
|
35
|
-
}
|
|
36
|
-
init(container) {
|
|
37
|
-
this.container = container;
|
|
38
|
-
this._setup();
|
|
39
|
-
}
|
|
40
|
-
reset() {
|
|
41
|
-
}
|
|
42
|
-
update() {
|
|
43
|
-
if (!this.container) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
this._calculateField();
|
|
47
|
-
this.noiseW += this.options.increment;
|
|
48
|
-
}
|
|
49
|
-
_calculateField() {
|
|
50
|
-
const options = this.options;
|
|
51
|
-
for (let x = 0; x < options.columns; x++) {
|
|
52
|
-
for (let y = 0; y < options.rows; y++) {
|
|
53
|
-
for (let z = 0; z < options.layers; z++) {
|
|
54
|
-
this.field[x][y][z].angle =
|
|
55
|
-
this._fractal.noise4d(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
|
|
56
|
-
this.field[x][y][z].length = this._fractal.noise4d(x / 100 + options.offset.x, y / 100 + options.offset.y, z / 100 + options.offset.z, this.noiseW);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
_initField() {
|
|
62
|
-
this.field = new Array(this.options.columns);
|
|
63
|
-
for (let x = 0; x < this.options.columns; x++) {
|
|
64
|
-
this.field[x] = new Array(this.options.rows);
|
|
65
|
-
for (let y = 0; y < this.options.rows; y++) {
|
|
66
|
-
this.field[x][y] = new Array(this.options.layers);
|
|
67
|
-
for (let z = 0; z < this.options.layers; z++) {
|
|
68
|
-
this.field[x][y][z] = Vector.origin;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_resetField() {
|
|
74
|
-
const container = this.container;
|
|
75
|
-
if (!container) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const sourceOptions = container.actualOptions.particles.move.path.options;
|
|
79
|
-
this.options.size = sourceOptions.size > 0 ? sourceOptions.size : defaultOptions.size;
|
|
80
|
-
this.options.increment =
|
|
81
|
-
sourceOptions.increment > 0 ? sourceOptions.increment : defaultOptions.increment;
|
|
82
|
-
this.options.width = container.canvas.size.width;
|
|
83
|
-
this.options.height = container.canvas.size.height;
|
|
84
|
-
const offset = sourceOptions.offset;
|
|
85
|
-
this.options.offset.x = offset?.x ?? defaultOptions.offset.x;
|
|
86
|
-
this.options.offset.y = offset?.y ?? defaultOptions.offset.y;
|
|
87
|
-
this.options.offset.z = offset?.z ?? defaultOptions.offset.z;
|
|
88
|
-
this.options.seed = sourceOptions.seed;
|
|
89
|
-
this._fractal.seed(this.options.seed ?? getRandom());
|
|
90
|
-
this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
|
|
91
|
-
this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
|
|
92
|
-
this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
|
|
93
|
-
this._initField();
|
|
94
|
-
}
|
|
95
|
-
_setup() {
|
|
96
|
-
this.noiseW = 0;
|
|
97
|
-
this._resetField();
|
|
98
|
-
addEventListener("resize", () => this._resetField());
|
|
5
|
+
const fractalNoise = new FractalNoise();
|
|
6
|
+
super({
|
|
7
|
+
noise4d: (x, y, z, w) => fractalNoise.noise4d(x, y, z, w),
|
|
8
|
+
seed: seed => {
|
|
9
|
+
fractalNoise.seed(seed);
|
|
10
|
+
},
|
|
11
|
+
});
|
|
99
12
|
}
|
|
100
13
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { FractalNoiseGenerator } from "./FractalNoiseGenerator.js";
|
|
2
1
|
export const fractalNoisePathName = "fractalNoise";
|
|
3
|
-
export
|
|
4
|
-
engine.checkVersion("
|
|
5
|
-
|
|
2
|
+
export function loadFractalNoisePath(engine) {
|
|
3
|
+
engine.checkVersion("4.0.0-alpha.1");
|
|
4
|
+
engine.register(async (e) => {
|
|
5
|
+
const { FractalNoiseGenerator } = await import("./FractalNoiseGenerator.js");
|
|
6
|
+
e.addPathGenerator(fractalNoisePathName, new FractalNoiseGenerator());
|
|
7
|
+
});
|
|
6
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/path-fractal-noise",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "tsParticles fractal noise path",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -104,7 +104,9 @@
|
|
|
104
104
|
"./package.json": "./package.json"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@tsparticles/engine": "
|
|
108
|
-
"@tsparticles/fractal-noise": "
|
|
109
|
-
|
|
107
|
+
"@tsparticles/engine": "4.0.0-alpha.1",
|
|
108
|
+
"@tsparticles/fractal-noise": "4.0.0-alpha.1",
|
|
109
|
+
"@tsparticles/noise-field": "4.0.0-alpha.1"
|
|
110
|
+
},
|
|
111
|
+
"type": "module"
|
|
110
112
|
}
|