@tsparticles/noise-field 4.0.0-beta.9 → 4.0.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/browser/NoiseFieldGenerator.js +1 -1
- package/browser/browser.js +3 -0
- package/browser/index.lazy.js +1 -0
- package/cjs/NoiseFieldGenerator.js +1 -1
- package/cjs/browser.js +3 -0
- package/cjs/index.lazy.js +1 -0
- package/esm/NoiseFieldGenerator.js +1 -1
- package/esm/browser.js +3 -0
- package/esm/index.lazy.js +1 -0
- package/package.json +10 -3
- package/report.html +4949 -94
- package/tsparticles.noise.field.js +182 -128
- package/tsparticles.noise.field.min.js +1 -1
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +4 -0
|
@@ -1,132 +1,186 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
/*
|
|
10
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
11
|
-
* This devtool is neither made for production nor for readable output files.
|
|
12
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
13
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
14
|
-
* or disable the default devtool with "devtool: false".
|
|
15
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
16
|
-
*/
|
|
17
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
-
module.exports = factory(require("@tsparticles/engine"));
|
|
20
|
-
else if(typeof define === 'function' && define.amd)
|
|
21
|
-
define(["@tsparticles/engine"], factory);
|
|
22
|
-
else {
|
|
23
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
24
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
|
-
}
|
|
26
|
-
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
27
|
-
return /******/ (() => { // webpackBootstrap
|
|
28
|
-
/******/ "use strict";
|
|
29
|
-
/******/ var __webpack_modules__ = ({
|
|
1
|
+
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
+
/* Utility v4.0.1 */
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.noise = global.__tsParticlesInternals.noise || {}, global.__tsParticlesInternals.noise.field = global.__tsParticlesInternals.noise.field || {}), global.__tsParticlesInternals.engine));
|
|
7
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
30
8
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
const originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {
|
|
10
|
+
a: 1,
|
|
11
|
+
b: 0,
|
|
12
|
+
c: 0,
|
|
13
|
+
d: 1,
|
|
14
|
+
e: 0,
|
|
15
|
+
f: 0,
|
|
16
|
+
}, defaultOptions = {
|
|
17
|
+
draw: false,
|
|
18
|
+
size: 20,
|
|
19
|
+
increment: 0.004,
|
|
20
|
+
columns: 0,
|
|
21
|
+
rows: 0,
|
|
22
|
+
layers: 0,
|
|
23
|
+
width: 0,
|
|
24
|
+
height: 0,
|
|
25
|
+
factor: {
|
|
26
|
+
angle: 0.02,
|
|
27
|
+
length: 0.01,
|
|
28
|
+
},
|
|
29
|
+
offset: {
|
|
30
|
+
x: 40000,
|
|
31
|
+
y: 40000,
|
|
32
|
+
z: 40000,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
class NoiseFieldGenerator {
|
|
36
|
+
container;
|
|
37
|
+
field;
|
|
38
|
+
noiseGen;
|
|
39
|
+
noiseW;
|
|
40
|
+
options;
|
|
41
|
+
_res;
|
|
42
|
+
constructor(container, noiseGen) {
|
|
43
|
+
this.container = container;
|
|
44
|
+
this.noiseGen = noiseGen;
|
|
45
|
+
this.field = [];
|
|
46
|
+
this.noiseW = 0;
|
|
47
|
+
this._res = engine.Vector.origin;
|
|
48
|
+
this.options = engine.deepExtend({}, defaultOptions);
|
|
49
|
+
}
|
|
50
|
+
generate(particle) {
|
|
51
|
+
const pos = particle.getPosition(), { size } = this.options, sizeFactor = engine.identity / size, point = {
|
|
52
|
+
x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),
|
|
53
|
+
y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),
|
|
54
|
+
z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate),
|
|
55
|
+
}, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];
|
|
56
|
+
if (fieldPoint) {
|
|
57
|
+
this._res.x = fieldPoint.x;
|
|
58
|
+
this._res.y = fieldPoint.y;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this._res.x = 0;
|
|
62
|
+
this._res.y = 0;
|
|
63
|
+
}
|
|
64
|
+
return this._res;
|
|
65
|
+
}
|
|
66
|
+
init() {
|
|
67
|
+
this._setup();
|
|
68
|
+
}
|
|
69
|
+
reset() {
|
|
70
|
+
}
|
|
71
|
+
update() {
|
|
72
|
+
this._calculateField();
|
|
73
|
+
this.noiseW += this.options.increment;
|
|
74
|
+
if (!this.options.draw) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.container.canvas.render.draw(ctx => {
|
|
78
|
+
this._drawField(ctx);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
_calculateField() {
|
|
82
|
+
const { field, noiseGen, options, noiseW } = this, lengthFactor = options.factor.length, angleFactor = options.factor.angle;
|
|
83
|
+
for (let x = 0; x < options.columns; x++) {
|
|
84
|
+
const xColumn = field[x];
|
|
85
|
+
if (!xColumn) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
for (let y = 0; y < options.rows; y++) {
|
|
89
|
+
const yColumn = xColumn[y];
|
|
90
|
+
if (!yColumn) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
for (let z = 0; z < options.layers; z++) {
|
|
94
|
+
const cell = yColumn[z];
|
|
95
|
+
if (!cell) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
cell.length = noiseGen.noise4d(x * lengthFactor + options.offset.x, y * lengthFactor + options.offset.y, z * lengthFactor + options.offset.z, noiseW);
|
|
99
|
+
cell.angle = noiseGen.noise4d(x * angleFactor, y * angleFactor, z * angleFactor, noiseW) * engine.doublePI;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
_drawField(ctx) {
|
|
105
|
+
const { field, options } = this;
|
|
106
|
+
for (let x = 0; x < options.columns; x++) {
|
|
107
|
+
const xColumn = field[x];
|
|
108
|
+
if (!xColumn) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
for (let y = 0; y < options.rows; y++) {
|
|
112
|
+
const yColumn = xColumn[y];
|
|
113
|
+
if (!yColumn) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const cell = yColumn[firstIndex];
|
|
117
|
+
if (!cell) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const { angle, length } = cell;
|
|
121
|
+
ctx.setTransform(transformDefaultValues.a, transformDefaultValues.b, transformDefaultValues.c, transformDefaultValues.d, x * this.options.size, y * this.options.size);
|
|
122
|
+
ctx.rotate(angle);
|
|
123
|
+
ctx.strokeStyle = "white";
|
|
124
|
+
ctx.beginPath();
|
|
125
|
+
ctx.moveTo(originCoordinate, originCoordinate);
|
|
126
|
+
ctx.lineTo(originCoordinate, this.options.size * length);
|
|
127
|
+
ctx.stroke();
|
|
128
|
+
ctx.setTransform(transformDefaultValues.a, transformDefaultValues.b, transformDefaultValues.c, transformDefaultValues.d, transformDefaultValues.e, transformDefaultValues.f);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
_initField() {
|
|
133
|
+
const { columns, rows, layers } = this.options;
|
|
134
|
+
this.field = new Array(columns);
|
|
135
|
+
for (let x = 0; x < columns; x++) {
|
|
136
|
+
const newX = new Array(rows);
|
|
137
|
+
for (let y = 0; y < rows; y++) {
|
|
138
|
+
const newY = new Array(layers);
|
|
139
|
+
for (let z = 0; z < layers; z++) {
|
|
140
|
+
newY[z] = engine.Vector.origin;
|
|
141
|
+
}
|
|
142
|
+
newX[y] = newY;
|
|
143
|
+
}
|
|
144
|
+
this.field[x] = newX;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
_resetField() {
|
|
148
|
+
const container = this.container, sourceOptions = container.actualOptions.particles.move.path.options, { options } = this;
|
|
149
|
+
options.width = container.canvas.size.width;
|
|
150
|
+
options.height = container.canvas.size.height;
|
|
151
|
+
options.size = sourceOptions["size"] > empty ? sourceOptions["size"] : defaultOptions.size;
|
|
152
|
+
options.increment =
|
|
153
|
+
sourceOptions["increment"] > empty
|
|
154
|
+
? sourceOptions["increment"]
|
|
155
|
+
: defaultOptions.increment;
|
|
156
|
+
options.draw = !!sourceOptions["draw"];
|
|
157
|
+
const offset = sourceOptions["offset"];
|
|
158
|
+
options.offset.x = offset?.x ?? defaultOptions.offset.x;
|
|
159
|
+
options.offset.y = offset?.y ?? defaultOptions.offset.y;
|
|
160
|
+
options.offset.z = offset?.z ?? defaultOptions.offset.z;
|
|
161
|
+
const factor = sourceOptions["factor"];
|
|
162
|
+
options.factor.angle = factor?.angle ?? defaultOptions.factor.angle;
|
|
163
|
+
options.factor.length = factor?.length ?? defaultOptions.factor.length;
|
|
164
|
+
options.seed = sourceOptions["seed"];
|
|
165
|
+
this.noiseGen.seed(options.seed ?? engine.getRandom());
|
|
166
|
+
options.columns = Math.floor(options.width / options.size) + optionsSizeOffset;
|
|
167
|
+
options.rows = Math.floor(options.height / options.size) + optionsSizeOffset;
|
|
168
|
+
options.layers = Math.floor(container.zLayers / options.size) + optionsSizeOffset;
|
|
169
|
+
this._initField();
|
|
170
|
+
}
|
|
171
|
+
_setup() {
|
|
172
|
+
this.noiseW = 0;
|
|
173
|
+
this._resetField();
|
|
174
|
+
addEventListener("resize", () => {
|
|
175
|
+
this._resetField();
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
36
179
|
|
|
37
|
-
|
|
180
|
+
const globalObject = globalThis;
|
|
181
|
+
globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
|
|
38
182
|
|
|
39
|
-
|
|
183
|
+
exports.NoiseFieldGenerator = NoiseFieldGenerator;
|
|
40
184
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
!*** ./dist/browser/NoiseFieldGenerator.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 */ NoiseFieldGenerator: () => (/* binding */ NoiseFieldGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst originCoordinate = 0, firstIndex = 0, empty = 0, optionsSizeOffset = 1, transformDefaultValues = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0\n}, defaultOptions = {\n draw: false,\n size: 20,\n increment: 0.004,\n columns: 0,\n rows: 0,\n layers: 0,\n width: 0,\n height: 0,\n factor: {\n angle: 0.02,\n length: 0.01\n },\n offset: {\n x: 40000,\n y: 40000,\n z: 40000\n }\n};\nclass NoiseFieldGenerator {\n container;\n field;\n noiseGen;\n noiseW;\n options;\n _res;\n constructor(container, noiseGen){\n this.container = container;\n this.noiseGen = noiseGen;\n this.field = [];\n this.noiseW = 0;\n this._res = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, defaultOptions);\n }\n generate(particle) {\n const pos = particle.getPosition(), { size } = this.options, sizeFactor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity / size, point = {\n x: Math.max(Math.floor(pos.x * sizeFactor), originCoordinate),\n y: Math.max(Math.floor(pos.y * sizeFactor), originCoordinate),\n z: Math.max(Math.floor(pos.z * sizeFactor), originCoordinate)\n }, { field } = this, fieldPoint = field[point.x]?.[point.y]?.[point.z];\n if (fieldPoint) {\n this._res.x = fieldPoint.x;\n this._res.y = fieldPoint.y;\n } else {\n this._res.x = 0;\n this._res.y = 0;\n }\n return this._res;\n }\n init() {\n this._setup();\n }\n reset() {}\n update() {\n this._calculateField();\n this.noiseW += this.options.increment;\n if (!this.options.draw) {\n return;\n }\n this.container.canvas.render.draw((ctx)=>{\n this._drawField(ctx);\n });\n }\n _calculateField() {\n const { field, noiseGen, options, noiseW } = this, lengthFactor = options.factor.length, angleFactor = options.factor.angle;\n for(let x = 0; x < options.columns; x++){\n const xColumn = field[x];\n if (!xColumn) {\n continue;\n }\n for(let y = 0; y < options.rows; y++){\n const yColumn = xColumn[y];\n if (!yColumn) {\n continue;\n }\n for(let z = 0; z < options.layers; z++){\n const cell = yColumn[z];\n if (!cell) {\n continue;\n }\n cell.length = noiseGen.noise4d(x * lengthFactor + options.offset.x, y * lengthFactor + options.offset.y, z * lengthFactor + options.offset.z, noiseW);\n cell.angle = noiseGen.noise4d(x * angleFactor, y * angleFactor, z * angleFactor, noiseW) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI;\n }\n }\n }\n }\n _drawField(ctx) {\n const { field, options } = this;\n for(let x = 0; x < options.columns; x++){\n const xColumn = field[x];\n if (!xColumn) {\n continue;\n }\n for(let y = 0; y < options.rows; y++){\n const yColumn = xColumn[y];\n if (!yColumn) {\n continue;\n }\n const cell = yColumn[firstIndex];\n if (!cell) {\n continue;\n }\n const { angle, length } = cell;\n ctx.setTransform(transformDefaultValues.a, transformDefaultValues.b, transformDefaultValues.c, transformDefaultValues.d, x * this.options.size, y * this.options.size);\n ctx.rotate(angle);\n ctx.strokeStyle = \"white\";\n ctx.beginPath();\n ctx.moveTo(originCoordinate, originCoordinate);\n ctx.lineTo(originCoordinate, this.options.size * length);\n ctx.stroke();\n ctx.setTransform(transformDefaultValues.a, transformDefaultValues.b, transformDefaultValues.c, transformDefaultValues.d, transformDefaultValues.e, transformDefaultValues.f);\n }\n }\n }\n _initField() {\n const { columns, rows, layers } = this.options;\n this.field = new Array(columns);\n for(let x = 0; x < columns; x++){\n const newX = new Array(rows);\n for(let y = 0; y < rows; y++){\n const newY = new Array(layers);\n for(let z = 0; z < layers; z++){\n newY[z] = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n }\n newX[y] = newY;\n }\n this.field[x] = newX;\n }\n }\n _resetField() {\n const container = this.container, sourceOptions = container.actualOptions.particles.move.path.options, { options } = this;\n options.width = container.canvas.size.width;\n options.height = container.canvas.size.height;\n options.size = sourceOptions[\"size\"] > empty ? sourceOptions[\"size\"] : defaultOptions.size;\n options.increment = sourceOptions[\"increment\"] > empty ? sourceOptions[\"increment\"] : defaultOptions.increment;\n options.draw = !!sourceOptions[\"draw\"];\n const offset = sourceOptions[\"offset\"];\n options.offset.x = offset?.x ?? defaultOptions.offset.x;\n options.offset.y = offset?.y ?? defaultOptions.offset.y;\n options.offset.z = offset?.z ?? defaultOptions.offset.z;\n const factor = sourceOptions[\"factor\"];\n options.factor.angle = factor?.angle ?? defaultOptions.factor.angle;\n options.factor.length = factor?.length ?? defaultOptions.factor.length;\n options.seed = sourceOptions[\"seed\"];\n this.noiseGen.seed(options.seed ?? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)());\n options.columns = Math.floor(options.width / options.size) + optionsSizeOffset;\n options.rows = Math.floor(options.height / options.size) + optionsSizeOffset;\n options.layers = Math.floor(container.zLayers / options.size) + optionsSizeOffset;\n this._initField();\n }\n _setup() {\n this.noiseW = 0;\n this._resetField();\n addEventListener(\"resize\", ()=>{\n this._resetField();\n });\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/noise-field/./dist/browser/NoiseFieldGenerator.js?\n}");
|
|
48
|
-
|
|
49
|
-
/***/ },
|
|
50
|
-
|
|
51
|
-
/***/ "./dist/browser/index.js"
|
|
52
|
-
/*!*******************************!*\
|
|
53
|
-
!*** ./dist/browser/index.js ***!
|
|
54
|
-
\*******************************/
|
|
55
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
|
-
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NoiseFieldGenerator: () => (/* reexport safe */ _NoiseFieldGenerator_js__WEBPACK_IMPORTED_MODULE_0__.NoiseFieldGenerator)\n/* harmony export */ });\n/* harmony import */ var _NoiseFieldGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NoiseFieldGenerator.js */ \"./dist/browser/NoiseFieldGenerator.js\");\n\n\n\n//# sourceURL=webpack://@tsparticles/noise-field/./dist/browser/index.js?\n}");
|
|
58
|
-
|
|
59
|
-
/***/ }
|
|
60
|
-
|
|
61
|
-
/******/ });
|
|
62
|
-
/************************************************************************/
|
|
63
|
-
/******/ // The module cache
|
|
64
|
-
/******/ var __webpack_module_cache__ = {};
|
|
65
|
-
/******/
|
|
66
|
-
/******/ // The require function
|
|
67
|
-
/******/ function __webpack_require__(moduleId) {
|
|
68
|
-
/******/ // Check if module is in cache
|
|
69
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
70
|
-
/******/ if (cachedModule !== undefined) {
|
|
71
|
-
/******/ return cachedModule.exports;
|
|
72
|
-
/******/ }
|
|
73
|
-
/******/ // Create a new module (and put it into the cache)
|
|
74
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
75
|
-
/******/ // no module.id needed
|
|
76
|
-
/******/ // no module.loaded needed
|
|
77
|
-
/******/ exports: {}
|
|
78
|
-
/******/ };
|
|
79
|
-
/******/
|
|
80
|
-
/******/ // Execute the module function
|
|
81
|
-
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
82
|
-
/******/ delete __webpack_module_cache__[moduleId];
|
|
83
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
84
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
85
|
-
/******/ throw e;
|
|
86
|
-
/******/ }
|
|
87
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Return the exports of the module
|
|
90
|
-
/******/ return module.exports;
|
|
91
|
-
/******/ }
|
|
92
|
-
/******/
|
|
93
|
-
/************************************************************************/
|
|
94
|
-
/******/ /* webpack/runtime/define property getters */
|
|
95
|
-
/******/ (() => {
|
|
96
|
-
/******/ // define getter functions for harmony exports
|
|
97
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
98
|
-
/******/ for(var key in definition) {
|
|
99
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
100
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
101
|
-
/******/ }
|
|
102
|
-
/******/ }
|
|
103
|
-
/******/ };
|
|
104
|
-
/******/ })();
|
|
105
|
-
/******/
|
|
106
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
107
|
-
/******/ (() => {
|
|
108
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
109
|
-
/******/ })();
|
|
110
|
-
/******/
|
|
111
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
112
|
-
/******/ (() => {
|
|
113
|
-
/******/ // define __esModule on exports
|
|
114
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
115
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
116
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
117
|
-
/******/ }
|
|
118
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
119
|
-
/******/ };
|
|
120
|
-
/******/ })();
|
|
121
|
-
/******/
|
|
122
|
-
/************************************************************************/
|
|
123
|
-
/******/
|
|
124
|
-
/******/ // startup
|
|
125
|
-
/******/ // Load entry module and return exports
|
|
126
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
127
|
-
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
128
|
-
/******/
|
|
129
|
-
/******/ return __webpack_exports__;
|
|
130
|
-
/******/ })()
|
|
131
|
-
;
|
|
132
|
-
});
|
|
185
|
+
}));
|
|
186
|
+
delete (globalThis.window || globalThis).tsparticlesInternalExports;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.noise=t.__tsParticlesInternals.noise||{},t.__tsParticlesInternals.noise.field=t.__tsParticlesInternals.noise.field||{}),t.__tsParticlesInternals.engine)}(this,function(t,s){"use strict";const e=1,n=0,i=0,a=1,r=0,l=0,o={draw:!1,size:20,increment:.004,columns:0,rows:0,layers:0,width:0,height:0,factor:{angle:.02,length:.01},offset:{x:4e4,y:4e4,z:4e4}};const _=globalThis;_.__tsParticlesInternals=_.__tsParticlesInternals??{},t.NoiseFieldGenerator=class{container;field;noiseGen;noiseW;options;_res;constructor(t,e){this.container=t,this.noiseGen=e,this.field=[],this.noiseW=0,this._res=s.Vector.origin,this.options=s.deepExtend({},o)}generate(t){const e=t.getPosition(),{size:n}=this.options,i=s.identity/n,a=Math.max(Math.floor(e.x*i),0),r=Math.max(Math.floor(e.y*i),0),l=Math.max(Math.floor(e.z*i),0),{field:o}=this,_=o[a]?.[r]?.[l];return _?(this._res.x=_.x,this._res.y=_.y):(this._res.x=0,this._res.y=0),this._res}init(){this._setup()}reset(){}update(){this._calculateField(),this.noiseW+=this.options.increment,this.options.draw&&this.container.canvas.render.draw(t=>{this._drawField(t)})}_calculateField(){const{field:t,noiseGen:e,options:n,noiseW:i}=this,a=n.factor.length,r=n.factor.angle;for(let l=0;l<n.columns;l++){const o=t[l];if(o)for(let t=0;t<n.rows;t++){const _=o[t];if(_)for(let o=0;o<n.layers;o++){const c=_[o];c&&(c.length=e.noise4d(l*a+n.offset.x,t*a+n.offset.y,o*a+n.offset.z,i),c.angle=e.noise4d(l*r,t*r,o*r,i)*s.doublePI)}}}}_drawField(t){const{field:s,options:o}=this;for(let _=0;_<o.columns;_++){const c=s[_];if(c)for(let s=0;s<o.rows;s++){const o=c[s];if(!o)continue;const h=o[0];if(!h)continue;const{angle:f,length:p}=h;t.setTransform(e,n,i,a,_*this.options.size,s*this.options.size),t.rotate(f),t.strokeStyle="white",t.beginPath(),t.moveTo(0,0),t.lineTo(0,this.options.size*p),t.stroke(),t.setTransform(e,n,i,a,r,l)}}}_initField(){const{columns:t,rows:e,layers:n}=this.options;this.field=new Array(t);for(let i=0;i<t;i++){const t=new Array(e);for(let i=0;i<e;i++){const e=new Array(n);for(let t=0;t<n;t++)e[t]=s.Vector.origin;t[i]=e}this.field[i]=t}}_resetField(){const t=this.container,e=t.actualOptions.particles.move.path.options,{options:n}=this;n.width=t.canvas.size.width,n.height=t.canvas.size.height,n.size=e.size>0?e.size:o.size,n.increment=e.increment>0?e.increment:o.increment,n.draw=!!e.draw;const i=e.offset;n.offset.x=i?.x??o.offset.x,n.offset.y=i?.y??o.offset.y,n.offset.z=i?.z??o.offset.z;const a=e.factor;n.factor.angle=a?.angle??o.factor.angle,n.factor.length=a?.length??o.factor.length,n.seed=e.seed,this.noiseGen.seed(n.seed??s.getRandom()),n.columns=Math.floor(n.width/n.size)+1,n.rows=Math.floor(n.height/n.size)+1,n.layers=Math.floor(t.zLayers/n.size)+1,this._initField()}_setup(){this.noiseW=0,this._resetField(),addEventListener("resize",()=>{this._resetField()})}}}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { IFactorValues, IOffsetValues } from "./IFactorOffsetValues.js";
|
|
2
|
+
export type { INoiseFieldOptions } from "./INoiseFieldOptions.js";
|
|
3
|
+
export type { INoiseGenerator } from "./INoiseGenerator.js";
|
|
4
|
+
export { NoiseFieldGenerator } from "./NoiseFieldGenerator.js";
|