@tsparticles/path-simplex-noise 3.0.0-beta.3 → 3.0.0-beta.4

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.
@@ -4,18 +4,18 @@
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
- * v3.0.0-beta.3
7
+ * v3.0.0-beta.4
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
11
- module.exports = factory(require("@tsparticles/engine"));
11
+ module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/simplex-noise"));
12
12
  else if(typeof define === 'function' && define.amd)
13
- define(["@tsparticles/engine"], factory);
13
+ define(["@tsparticles/engine", "@tsparticles/simplex-noise"], factory);
14
14
  else {
15
- var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
15
+ var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/simplex-noise")) : factory(root["window"], root["window"]);
16
16
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
17
  }
18
- })(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
18
+ })(this, (__WEBPACK_EXTERNAL_MODULE__533__, __WEBPACK_EXTERNAL_MODULE__245__) => {
19
19
  return /******/ (() => { // webpackBootstrap
20
20
  /******/ "use strict";
21
21
  /******/ var __webpack_modules__ = ({
@@ -25,6 +25,13 @@ return /******/ (() => { // webpackBootstrap
25
25
 
26
26
  module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
27
27
 
28
+ /***/ }),
29
+
30
+ /***/ 245:
31
+ /***/ ((module) => {
32
+
33
+ module.exports = __WEBPACK_EXTERNAL_MODULE__245__;
34
+
28
35
  /***/ })
29
36
 
30
37
  /******/ });
@@ -97,176 +104,32 @@ __webpack_require__.d(__webpack_exports__, {
97
104
 
98
105
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
99
106
  var engine_root_window_ = __webpack_require__(533);
100
- ;// CONCATENATED MODULE: ./dist/browser/simplex.js
101
- function shuffleSeed(seed) {
102
- const newSeed = new Uint32Array(1);
103
- newSeed[0] = seed[0] * 1664525 + 1013904223;
104
- return newSeed;
105
- }
106
- const NORM_4D = 1.0 / 30.0,
107
- SQUISH_4D = (Math.sqrt(4 + 1) - 1) / 4,
108
- STRETCH_4D = (1 / Math.sqrt(4 + 1) - 1) / 4;
109
- function contribution4D(multiplier, xsb, ysb, zsb, wsb) {
110
- return {
111
- dx: -xsb - multiplier * SQUISH_4D,
112
- dy: -ysb - multiplier * SQUISH_4D,
113
- dz: -zsb - multiplier * SQUISH_4D,
114
- dw: -wsb - multiplier * SQUISH_4D,
115
- xsb,
116
- ysb,
117
- zsb,
118
- wsb
119
- };
120
- }
121
- function makeNoise4D(clientSeed) {
122
- const contributions = [];
123
- for (let i = 0; i < p4D.length; i += 16) {
124
- const baseSet = base4D[p4D[i]];
125
- let previous = null,
126
- current = null;
127
- for (let k = 0; k < baseSet.length; k += 5) {
128
- current = contribution4D(baseSet[k], baseSet[k + 1], baseSet[k + 2], baseSet[k + 3], baseSet[k + 4]);
129
- if (previous === null) {
130
- contributions[i / 16] = current;
131
- } else {
132
- previous.next = current;
133
- }
134
- previous = current;
135
- }
136
- if (current) {
137
- current.next = contribution4D(p4D[i + 1], p4D[i + 2], p4D[i + 3], p4D[i + 4], p4D[i + 5]);
138
- current.next.next = contribution4D(p4D[i + 6], p4D[i + 7], p4D[i + 8], p4D[i + 9], p4D[i + 10]);
139
- current.next.next.next = contribution4D(p4D[i + 11], p4D[i + 12], p4D[i + 13], p4D[i + 14], p4D[i + 15]);
140
- }
141
- }
142
- const lookup = [];
143
- for (let i = 0; i < lookupPairs4D.length; i += 2) {
144
- lookup[lookupPairs4D[i]] = contributions[lookupPairs4D[i + 1]];
145
- }
146
- const perm = new Uint8Array(256),
147
- perm4D = new Uint8Array(256),
148
- source = new Uint8Array(256);
149
- for (let i = 0; i < 256; i++) {
150
- source[i] = i;
151
- }
152
- let seed = new Uint32Array(1);
153
- seed[0] = clientSeed;
154
- seed = shuffleSeed(shuffleSeed(shuffleSeed(seed)));
155
- for (let i = 255; i >= 0; i--) {
156
- seed = shuffleSeed(seed);
157
- const r = new Uint32Array(1);
158
- r[0] = (seed[0] + 31) % (i + 1);
159
- if (r[0] < 0) {
160
- r[0] += i + 1;
161
- }
162
- perm[i] = source[r[0]];
163
- perm4D[i] = perm[i] & 0xfc;
164
- source[r[0]] = source[i];
165
- }
166
- return (x, y, z, w) => {
167
- const stretchOffset = (x + y + z + w) * STRETCH_4D,
168
- xs = x + stretchOffset,
169
- ys = y + stretchOffset,
170
- zs = z + stretchOffset,
171
- ws = w + stretchOffset,
172
- xsb = Math.floor(xs),
173
- ysb = Math.floor(ys),
174
- zsb = Math.floor(zs),
175
- wsb = Math.floor(ws),
176
- squishOffset = (xsb + ysb + zsb + wsb) * SQUISH_4D,
177
- dx0 = x - (xsb + squishOffset),
178
- dy0 = y - (ysb + squishOffset),
179
- dz0 = z - (zsb + squishOffset),
180
- dw0 = w - (wsb + squishOffset),
181
- xins = xs - xsb,
182
- yins = ys - ysb,
183
- zins = zs - zsb,
184
- wins = ws - wsb,
185
- inSum = xins + yins + zins + wins,
186
- hash = zins - wins + 1 | yins - zins + 1 << 1 | yins - wins + 1 << 2 | xins - yins + 1 << 3 | xins - zins + 1 << 4 | xins - wins + 1 << 5 | inSum << 6 | inSum + wins << 8 | inSum + zins << 11 | inSum + yins << 14 | inSum + xins << 17;
187
- let value = 0;
188
- for (let c = lookup[hash]; c !== undefined; c = c.next) {
189
- const dx = dx0 + c.dx,
190
- dy = dy0 + c.dy,
191
- dz = dz0 + c.dz,
192
- dw = dw0 + c.dw,
193
- attn = 2 - dx * dx - dy * dy - dz * dz - dw * dw;
194
- if (attn > 0) {
195
- const px = xsb + c.xsb,
196
- py = ysb + c.ysb,
197
- pz = zsb + c.zsb,
198
- pw = wsb + c.wsb,
199
- indexPartA = perm[px & 0xff],
200
- indexPartB = perm[indexPartA + py & 0xff],
201
- indexPartC = perm[indexPartB + pz & 0xff],
202
- index = perm4D[indexPartC + pw & 0xff],
203
- valuePart = gradients4D[index] * dx + gradients4D[index + 1] * dy + gradients4D[index + 2] * dz + gradients4D[index + 3] * dw;
204
- value += attn * attn * attn * attn * valuePart;
205
- }
206
- }
207
- return value * NORM_4D;
208
- };
209
- }
210
- const base4D = [[0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1], [3, 1, 1, 1, 0, 3, 1, 1, 0, 1, 3, 1, 0, 1, 1, 3, 0, 1, 1, 1, 4, 1, 1, 1, 1], [1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 2, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 1, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 1], [3, 1, 1, 1, 0, 3, 1, 1, 0, 1, 3, 1, 0, 1, 1, 3, 0, 1, 1, 1, 2, 1, 1, 0, 0, 2, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 1, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 1]],
211
- gradients4D = [3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3],
212
- lookupPairs4D = [0, 3, 1, 2, 2, 3, 5, 2, 6, 1, 7, 1, 8, 3, 9, 2, 10, 3, 13, 2, 16, 3, 18, 3, 22, 1, 23, 1, 24, 3, 26, 3, 33, 2, 37, 2, 38, 1, 39, 1, 41, 2, 45, 2, 54, 1, 55, 1, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 256, 3, 258, 3, 264, 3, 266, 3, 272, 3, 274, 3, 280, 3, 282, 3, 2049, 2, 2053, 2, 2057, 2, 2061, 2, 2081, 2, 2085, 2, 2089, 2, 2093, 2, 2304, 9, 2305, 9, 2312, 9, 2313, 9, 16390, 1, 16391, 1, 16406, 1, 16407, 1, 16422, 1, 16423, 1, 16438, 1, 16439, 1, 16642, 8, 16646, 8, 16658, 8, 16662, 8, 18437, 6, 18439, 6, 18469, 6, 18471, 6, 18688, 9, 18689, 9, 18690, 8, 18693, 6, 18694, 8, 18695, 6, 18696, 9, 18697, 9, 18706, 8, 18710, 8, 18725, 6, 18727, 6, 131128, 0, 131129, 0, 131130, 0, 131131, 0, 131132, 0, 131133, 0, 131134, 0, 131135, 0, 131352, 7, 131354, 7, 131384, 7, 131386, 7, 133161, 5, 133165, 5, 133177, 5, 133181, 5, 133376, 9, 133377, 9, 133384, 9, 133385, 9, 133400, 7, 133402, 7, 133417, 5, 133421, 5, 133432, 7, 133433, 5, 133434, 7, 133437, 5, 147510, 4, 147511, 4, 147518, 4, 147519, 4, 147714, 8, 147718, 8, 147730, 8, 147734, 8, 147736, 7, 147738, 7, 147766, 4, 147767, 4, 147768, 7, 147770, 7, 147774, 4, 147775, 4, 149509, 6, 149511, 6, 149541, 6, 149543, 6, 149545, 5, 149549, 5, 149558, 4, 149559, 4, 149561, 5, 149565, 5, 149566, 4, 149567, 4, 149760, 9, 149761, 9, 149762, 8, 149765, 6, 149766, 8, 149767, 6, 149768, 9, 149769, 9, 149778, 8, 149782, 8, 149784, 7, 149786, 7, 149797, 6, 149799, 6, 149801, 5, 149805, 5, 149814, 4, 149815, 4, 149816, 7, 149817, 5, 149818, 7, 149821, 5, 149822, 4, 149823, 4, 149824, 37, 149825, 37, 149826, 36, 149829, 34, 149830, 36, 149831, 34, 149832, 37, 149833, 37, 149842, 36, 149846, 36, 149848, 35, 149850, 35, 149861, 34, 149863, 34, 149865, 33, 149869, 33, 149878, 32, 149879, 32, 149880, 35, 149881, 33, 149882, 35, 149885, 33, 149886, 32, 149887, 32, 150080, 49, 150082, 48, 150088, 49, 150098, 48, 150104, 47, 150106, 47, 151873, 46, 151877, 45, 151881, 46, 151909, 45, 151913, 44, 151917, 44, 152128, 49, 152129, 46, 152136, 49, 152137, 46, 166214, 43, 166215, 42, 166230, 43, 166247, 42, 166262, 41, 166263, 41, 166466, 48, 166470, 43, 166482, 48, 166486, 43, 168261, 45, 168263, 42, 168293, 45, 168295, 42, 168512, 31, 168513, 28, 168514, 31, 168517, 28, 168518, 25, 168519, 25, 280952, 40, 280953, 39, 280954, 40, 280957, 39, 280958, 38, 280959, 38, 281176, 47, 281178, 47, 281208, 40, 281210, 40, 282985, 44, 282989, 44, 283001, 39, 283005, 39, 283208, 30, 283209, 27, 283224, 30, 283241, 27, 283256, 22, 283257, 22, 297334, 41, 297335, 41, 297342, 38, 297343, 38, 297554, 29, 297558, 24, 297562, 29, 297590, 24, 297594, 21, 297598, 21, 299365, 26, 299367, 23, 299373, 26, 299383, 23, 299389, 20, 299391, 20, 299584, 31, 299585, 28, 299586, 31, 299589, 28, 299590, 25, 299591, 25, 299592, 30, 299593, 27, 299602, 29, 299606, 24, 299608, 30, 299610, 29, 299621, 26, 299623, 23, 299625, 27, 299629, 26, 299638, 24, 299639, 23, 299640, 22, 299641, 22, 299642, 21, 299645, 20, 299646, 21, 299647, 20, 299648, 61, 299649, 60, 299650, 61, 299653, 60, 299654, 59, 299655, 59, 299656, 58, 299657, 57, 299666, 55, 299670, 54, 299672, 58, 299674, 55, 299685, 52, 299687, 51, 299689, 57, 299693, 52, 299702, 54, 299703, 51, 299704, 56, 299705, 56, 299706, 53, 299709, 50, 299710, 53, 299711, 50, 299904, 61, 299906, 61, 299912, 58, 299922, 55, 299928, 58, 299930, 55, 301697, 60, 301701, 60, 301705, 57, 301733, 52, 301737, 57, 301741, 52, 301952, 79, 301953, 79, 301960, 76, 301961, 76, 316038, 59, 316039, 59, 316054, 54, 316071, 51, 316086, 54, 316087, 51, 316290, 78, 316294, 78, 316306, 73, 316310, 73, 318085, 77, 318087, 77, 318117, 70, 318119, 70, 318336, 79, 318337, 79, 318338, 78, 318341, 77, 318342, 78, 318343, 77, 430776, 56, 430777, 56, 430778, 53, 430781, 50, 430782, 53, 430783, 50, 431000, 75, 431002, 72, 431032, 75, 431034, 72, 432809, 74, 432813, 69, 432825, 74, 432829, 69, 433032, 76, 433033, 76, 433048, 75, 433065, 74, 433080, 75, 433081, 74, 447158, 71, 447159, 68, 447166, 71, 447167, 68, 447378, 73, 447382, 73, 447386, 72, 447414, 71, 447418, 72, 447422, 71, 449189, 70, 449191, 70, 449197, 69, 449207, 68, 449213, 69, 449215, 68, 449408, 67, 449409, 67, 449410, 66, 449413, 64, 449414, 66, 449415, 64, 449416, 67, 449417, 67, 449426, 66, 449430, 66, 449432, 65, 449434, 65, 449445, 64, 449447, 64, 449449, 63, 449453, 63, 449462, 62, 449463, 62, 449464, 65, 449465, 63, 449466, 65, 449469, 63, 449470, 62, 449471, 62, 449472, 19, 449473, 19, 449474, 18, 449477, 16, 449478, 18, 449479, 16, 449480, 19, 449481, 19, 449490, 18, 449494, 18, 449496, 17, 449498, 17, 449509, 16, 449511, 16, 449513, 15, 449517, 15, 449526, 14, 449527, 14, 449528, 17, 449529, 15, 449530, 17, 449533, 15, 449534, 14, 449535, 14, 449728, 19, 449729, 19, 449730, 18, 449734, 18, 449736, 19, 449737, 19, 449746, 18, 449750, 18, 449752, 17, 449754, 17, 449784, 17, 449786, 17, 451520, 19, 451521, 19, 451525, 16, 451527, 16, 451528, 19, 451529, 19, 451557, 16, 451559, 16, 451561, 15, 451565, 15, 451577, 15, 451581, 15, 451776, 19, 451777, 19, 451784, 19, 451785, 19, 465858, 18, 465861, 16, 465862, 18, 465863, 16, 465874, 18, 465878, 18, 465893, 16, 465895, 16, 465910, 14, 465911, 14, 465918, 14, 465919, 14, 466114, 18, 466118, 18, 466130, 18, 466134, 18, 467909, 16, 467911, 16, 467941, 16, 467943, 16, 468160, 13, 468161, 13, 468162, 13, 468163, 13, 468164, 13, 468165, 13, 468166, 13, 468167, 13, 580568, 17, 580570, 17, 580585, 15, 580589, 15, 580598, 14, 580599, 14, 580600, 17, 580601, 15, 580602, 17, 580605, 15, 580606, 14, 580607, 14, 580824, 17, 580826, 17, 580856, 17, 580858, 17, 582633, 15, 582637, 15, 582649, 15, 582653, 15, 582856, 12, 582857, 12, 582872, 12, 582873, 12, 582888, 12, 582889, 12, 582904, 12, 582905, 12, 596982, 14, 596983, 14, 596990, 14, 596991, 14, 597202, 11, 597206, 11, 597210, 11, 597214, 11, 597234, 11, 597238, 11, 597242, 11, 597246, 11, 599013, 10, 599015, 10, 599021, 10, 599023, 10, 599029, 10, 599031, 10, 599037, 10, 599039, 10, 599232, 13, 599233, 13, 599234, 13, 599235, 13, 599236, 13, 599237, 13, 599238, 13, 599239, 13, 599240, 12, 599241, 12, 599250, 11, 599254, 11, 599256, 12, 599257, 12, 599258, 11, 599262, 11, 599269, 10, 599271, 10, 599272, 12, 599273, 12, 599277, 10, 599279, 10, 599282, 11, 599285, 10, 599286, 11, 599287, 10, 599288, 12, 599289, 12, 599290, 11, 599293, 10, 599294, 11, 599295, 10],
213
- p4D = [0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 0, 0, -1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 2, 1, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 0, 2, 0, 1, 1, 0, 1, -1, 1, 1, 0, 1, 0, 1, 1, -1, 0, 2, 1, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 0, 2, 0, 1, 0, 1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, 0, 2, 0, 0, 1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 1, 1, 1, 4, 2, 1, 1, 0, 4, 1, 2, 1, 0, 4, 1, 1, 2, 0, 1, 4, 2, 1, 0, 1, 4, 1, 2, 0, 1, 4, 1, 1, 0, 2, 1, 4, 2, 0, 1, 1, 4, 1, 0, 2, 1, 4, 1, 0, 1, 2, 1, 4, 0, 2, 1, 1, 4, 0, 1, 2, 1, 4, 0, 1, 1, 2, 1, 2, 1, 1, 0, 0, 3, 2, 1, 0, 0, 3, 1, 2, 0, 0, 1, 2, 1, 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0, 2, 1, 3, 0, 0, 1, 2, 2, -1, 1, 1, 1];
107
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/simplex-noise","commonjs2":"@tsparticles/simplex-noise","amd":"@tsparticles/simplex-noise","root":"window"}
108
+ var simplex_noise_root_window_ = __webpack_require__(245);
214
109
  ;// CONCATENATED MODULE: ./dist/browser/SimplexNoiseGenerator.js
215
110
 
216
111
 
112
+ const defaultOptions = {
113
+ size: 20,
114
+ increment: 0.004,
115
+ columns: 0,
116
+ rows: 0,
117
+ layers: 0,
118
+ width: 0,
119
+ height: 0,
120
+ offset: {
121
+ x: 40000,
122
+ y: 40000,
123
+ z: 40000
124
+ }
125
+ };
217
126
  class SimplexNoiseGenerator {
218
127
  constructor() {
219
- this._calculateField = () => {
220
- for (let x = 0; x < this.options.columns; x++) {
221
- for (let y = 0; y < this.options.rows; y++) {
222
- for (let z = 0; z < this.options.layers; z++) {
223
- this.field[x][y][z][0] = this.noiseFunc(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
224
- this.field[x][y][z][1] = this.noiseFunc(x / 100 + 40000, y / 100 + 40000, z / 100 + 40000, this.noiseW);
225
- }
226
- }
227
- }
228
- };
229
- this._initField = () => {
230
- this.field = new Array(this.options.columns);
231
- for (let x = 0; x < this.options.columns; x++) {
232
- this.field[x] = new Array(this.options.rows);
233
- for (let y = 0; y < this.options.rows; y++) {
234
- this.field[x][y] = new Array(this.options.layers);
235
- for (let z = 0; z < this.options.layers; z++) {
236
- this.field[x][y][z] = [0, 0];
237
- }
238
- }
239
- }
240
- };
241
- this._resetField = container => {
242
- const sourceOptions = container.actualOptions.particles.move.path.options;
243
- this.options.size = sourceOptions.size > 0 ? sourceOptions.size : 20;
244
- this.options.increment = sourceOptions.increment > 0 ? sourceOptions.increment : 0.004;
245
- this.options.width = container.canvas.size.width;
246
- this.options.height = container.canvas.size.height;
247
- this.noiseFunc = makeNoise4D(sourceOptions.seed ?? (0,engine_root_window_.getRandom)());
248
- this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
249
- this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
250
- this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
251
- this._initField();
252
- };
253
- this._setup = container => {
254
- this.noiseW = 0;
255
- this._resetField(container);
256
- addEventListener("resize", () => this._resetField(container));
257
- };
128
+ const simplex = new simplex_noise_root_window_.SimplexNoise();
129
+ this._simplex = simplex.noise4d;
258
130
  this.field = [];
259
- this.noiseFunc = makeNoise4D((0,engine_root_window_.getRandom)());
260
131
  this.noiseW = 0;
261
- this.options = {
262
- size: 20,
263
- increment: 0.004,
264
- columns: 0,
265
- rows: 0,
266
- layers: 0,
267
- width: 0,
268
- height: 0
269
- };
132
+ this.options = (0,engine_root_window_.deepExtend)({}, defaultOptions);
270
133
  }
271
134
  generate(particle) {
272
135
  const pos = particle.getPosition(),
@@ -279,13 +142,14 @@ class SimplexNoiseGenerator {
279
142
  if (!this.field || !this.field[point.x] || !this.field[point.x][point.y] || !this.field[point.x][point.y][point.z]) {
280
143
  return v;
281
144
  }
282
- v.length = this.field[point.x][point.y][point.z][1];
283
- v.angle = this.field[point.x][point.y][point.z][0];
145
+ const cell = this.field[point.x][point.y][point.z];
146
+ v.length = cell[1];
147
+ v.angle = cell[0];
284
148
  return v;
285
149
  }
286
150
  init(container) {
287
151
  this.container = container;
288
- this._setup(this.container);
152
+ this._setup();
289
153
  }
290
154
  reset() {}
291
155
  update() {
@@ -295,6 +159,55 @@ class SimplexNoiseGenerator {
295
159
  this._calculateField();
296
160
  this.noiseW += this.options.increment;
297
161
  }
162
+ _calculateField() {
163
+ const options = this.options;
164
+ for (let x = 0; x < options.columns; x++) {
165
+ for (let y = 0; y < options.rows; y++) {
166
+ for (let z = 0; z < options.layers; z++) {
167
+ this.field[x][y][z][0] = this._simplex.noise(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
168
+ this.field[x][y][z][1] = this._simplex.noise(x / 100 + options.offset.x, y / 100 + options.offset.y, z / 100 + options.offset.z, this.noiseW);
169
+ }
170
+ }
171
+ }
172
+ }
173
+ _initField() {
174
+ this.field = new Array(this.options.columns);
175
+ for (let x = 0; x < this.options.columns; x++) {
176
+ this.field[x] = new Array(this.options.rows);
177
+ for (let y = 0; y < this.options.rows; y++) {
178
+ this.field[x][y] = new Array(this.options.layers);
179
+ for (let z = 0; z < this.options.layers; z++) {
180
+ this.field[x][y][z] = [0, 0];
181
+ }
182
+ }
183
+ }
184
+ }
185
+ _resetField() {
186
+ const container = this.container;
187
+ if (!container) {
188
+ return;
189
+ }
190
+ const sourceOptions = container.actualOptions.particles.move.path.options;
191
+ this.options.size = sourceOptions.size > 0 ? sourceOptions.size : defaultOptions.size;
192
+ this.options.increment = sourceOptions.increment > 0 ? sourceOptions.increment : defaultOptions.increment;
193
+ this.options.width = container.canvas.size.width;
194
+ this.options.height = container.canvas.size.height;
195
+ const offset = sourceOptions.offset;
196
+ this.options.offset.x = offset?.x ?? defaultOptions.offset.x;
197
+ this.options.offset.y = offset?.y ?? defaultOptions.offset.y;
198
+ this.options.offset.z = offset?.z ?? defaultOptions.offset.z;
199
+ this.options.seed = sourceOptions.seed ?? defaultOptions.seed;
200
+ this._simplex.seed(this.options.seed ?? (0,engine_root_window_.getRandom)());
201
+ this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
202
+ this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
203
+ this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
204
+ this._initField();
205
+ }
206
+ _setup() {
207
+ this.noiseW = 0;
208
+ this._resetField();
209
+ addEventListener("resize", () => this._resetField());
210
+ }
298
211
  }
299
212
  ;// CONCATENATED MODULE: ./dist/browser/index.js
300
213
 
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.path.simplex.noise.min.js.LICENSE.txt */
2
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},i={};function s(t){var o=i[t];if(void 0!==o)return o.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,s),n.exports}s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{loadSimplexNoisePath:()=>u,simplexNoisePathName:()=>d});var t=s(533);function e(t){const e=new Uint32Array(1);return e[0]=1664525*t[0]+1013904223,e}const i=(Math.sqrt(5)-1)/4,n=(1/Math.sqrt(5)-1)/4;function r(t,e,s,o,n){return{dx:-e-t*i,dy:-s-t*i,dz:-o-t*i,dw:-n-t*i,xsb:e,ysb:s,zsb:o,wsb:n}}function h(t){const s=[];for(let t=0;t<f.length;t+=16){const e=l[f[t]];let i=null,o=null;for(let n=0;n<e.length;n+=5)o=r(e[n],e[n+1],e[n+2],e[n+3],e[n+4]),null===i?s[t/16]=o:i.next=o,i=o;o&&(o.next=r(f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),o.next.next=r(f[t+6],f[t+7],f[t+8],f[t+9],f[t+10]),o.next.next.next=r(f[t+11],f[t+12],f[t+13],f[t+14],f[t+15]))}const o=[];for(let t=0;t<c.length;t+=2)o[c[t]]=s[c[t+1]];const h=new Uint8Array(256),p=new Uint8Array(256),d=new Uint8Array(256);for(let t=0;t<256;t++)d[t]=t;let u=new Uint32Array(1);u[0]=t,u=e(e(e(u)));for(let t=255;t>=0;t--){u=e(u);const i=new Uint32Array(1);i[0]=(u[0]+31)%(t+1),i[0]<0&&(i[0]+=t+1),h[t]=d[i[0]],p[t]=252&h[t],d[i[0]]=d[t]}return(t,e,s,r)=>{const l=(t+e+s+r)*n,c=t+l,f=e+l,d=s+l,u=r+l,y=Math.floor(c),x=Math.floor(f),m=Math.floor(d),w=Math.floor(u),g=(y+x+m+w)*i,b=t-(y+g),z=e-(x+g),M=s-(m+g),v=r-(w+g),F=c-y,_=f-x,A=d-m,P=u-w,j=F+_+A+P;let O=0;for(let t=o[A-P+1|_-A+1<<1|_-P+1<<2|F-_+1<<3|F-A+1<<4|F-P+1<<5|j<<6|j+P<<8|j+A<<11|j+_<<14|j+F<<17];void 0!==t;t=t.next){const e=b+t.dx,i=z+t.dy,s=M+t.dz,o=v+t.dw,n=2-e*e-i*i-s*s-o*o;if(n>0){const r=y+t.xsb,l=x+t.ysb,c=m+t.zsb,f=w+t.wsb,d=h[255&r],u=h[d+l&255],g=h[u+c&255],b=p[g+f&255];O+=n*n*n*n*(a[b]*e+a[b+1]*i+a[b+2]*s+a[b+3]*o)}}return.03333333333333333*O}}const l=[[0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,4,1,1,1,1],[1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1],[3,1,1,1,0,3,1,1,0,1,3,1,0,1,1,3,0,1,1,1,2,1,1,0,0,2,1,0,1,0,2,1,0,0,1,2,0,1,1,0,2,0,1,0,1,2,0,0,1,1]],a=[3,1,1,1,1,3,1,1,1,1,3,1,1,1,1,3,-3,1,1,1,-1,3,1,1,-1,1,3,1,-1,1,1,3,3,-1,1,1,1,-3,1,1,1,-1,3,1,1,-1,1,3,-3,-1,1,1,-1,-3,1,1,-1,-1,3,1,-1,-1,1,3,3,1,-1,1,1,3,-1,1,1,1,-3,1,1,1,-1,3,-3,1,-1,1,-1,3,-1,1,-1,1,-3,1,-1,1,-1,3,3,-1,-1,1,1,-3,-1,1,1,-1,-3,1,1,-1,-1,3,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,3,1,1,-1,1,3,1,-1,1,1,3,-1,1,1,1,-3,-3,1,1,-1,-1,3,1,-1,-1,1,3,-1,-1,1,1,-3,3,-1,1,-1,1,-3,1,-1,1,-1,3,-1,1,-1,1,-3,-3,-1,1,-1,-1,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,3,1,-1,-1,1,3,-1,-1,1,1,-3,-1,1,1,-1,-3,-3,1,-1,-1,-1,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,3,-1,-1,-1,1,-3,-1,-1,1,-1,-3,-1,1,-1,-1,-3,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3,-1,-1,-1,-1,-3],c=[0,3,1,2,2,3,5,2,6,1,7,1,8,3,9,2,10,3,13,2,16,3,18,3,22,1,23,1,24,3,26,3,33,2,37,2,38,1,39,1,41,2,45,2,54,1,55,1,56,0,57,0,58,0,59,0,60,0,61,0,62,0,63,0,256,3,258,3,264,3,266,3,272,3,274,3,280,3,282,3,2049,2,2053,2,2057,2,2061,2,2081,2,2085,2,2089,2,2093,2,2304,9,2305,9,2312,9,2313,9,16390,1,16391,1,16406,1,16407,1,16422,1,16423,1,16438,1,16439,1,16642,8,16646,8,16658,8,16662,8,18437,6,18439,6,18469,6,18471,6,18688,9,18689,9,18690,8,18693,6,18694,8,18695,6,18696,9,18697,9,18706,8,18710,8,18725,6,18727,6,131128,0,131129,0,131130,0,131131,0,131132,0,131133,0,131134,0,131135,0,131352,7,131354,7,131384,7,131386,7,133161,5,133165,5,133177,5,133181,5,133376,9,133377,9,133384,9,133385,9,133400,7,133402,7,133417,5,133421,5,133432,7,133433,5,133434,7,133437,5,147510,4,147511,4,147518,4,147519,4,147714,8,147718,8,147730,8,147734,8,147736,7,147738,7,147766,4,147767,4,147768,7,147770,7,147774,4,147775,4,149509,6,149511,6,149541,6,149543,6,149545,5,149549,5,149558,4,149559,4,149561,5,149565,5,149566,4,149567,4,149760,9,149761,9,149762,8,149765,6,149766,8,149767,6,149768,9,149769,9,149778,8,149782,8,149784,7,149786,7,149797,6,149799,6,149801,5,149805,5,149814,4,149815,4,149816,7,149817,5,149818,7,149821,5,149822,4,149823,4,149824,37,149825,37,149826,36,149829,34,149830,36,149831,34,149832,37,149833,37,149842,36,149846,36,149848,35,149850,35,149861,34,149863,34,149865,33,149869,33,149878,32,149879,32,149880,35,149881,33,149882,35,149885,33,149886,32,149887,32,150080,49,150082,48,150088,49,150098,48,150104,47,150106,47,151873,46,151877,45,151881,46,151909,45,151913,44,151917,44,152128,49,152129,46,152136,49,152137,46,166214,43,166215,42,166230,43,166247,42,166262,41,166263,41,166466,48,166470,43,166482,48,166486,43,168261,45,168263,42,168293,45,168295,42,168512,31,168513,28,168514,31,168517,28,168518,25,168519,25,280952,40,280953,39,280954,40,280957,39,280958,38,280959,38,281176,47,281178,47,281208,40,281210,40,282985,44,282989,44,283001,39,283005,39,283208,30,283209,27,283224,30,283241,27,283256,22,283257,22,297334,41,297335,41,297342,38,297343,38,297554,29,297558,24,297562,29,297590,24,297594,21,297598,21,299365,26,299367,23,299373,26,299383,23,299389,20,299391,20,299584,31,299585,28,299586,31,299589,28,299590,25,299591,25,299592,30,299593,27,299602,29,299606,24,299608,30,299610,29,299621,26,299623,23,299625,27,299629,26,299638,24,299639,23,299640,22,299641,22,299642,21,299645,20,299646,21,299647,20,299648,61,299649,60,299650,61,299653,60,299654,59,299655,59,299656,58,299657,57,299666,55,299670,54,299672,58,299674,55,299685,52,299687,51,299689,57,299693,52,299702,54,299703,51,299704,56,299705,56,299706,53,299709,50,299710,53,299711,50,299904,61,299906,61,299912,58,299922,55,299928,58,299930,55,301697,60,301701,60,301705,57,301733,52,301737,57,301741,52,301952,79,301953,79,301960,76,301961,76,316038,59,316039,59,316054,54,316071,51,316086,54,316087,51,316290,78,316294,78,316306,73,316310,73,318085,77,318087,77,318117,70,318119,70,318336,79,318337,79,318338,78,318341,77,318342,78,318343,77,430776,56,430777,56,430778,53,430781,50,430782,53,430783,50,431e3,75,431002,72,431032,75,431034,72,432809,74,432813,69,432825,74,432829,69,433032,76,433033,76,433048,75,433065,74,433080,75,433081,74,447158,71,447159,68,447166,71,447167,68,447378,73,447382,73,447386,72,447414,71,447418,72,447422,71,449189,70,449191,70,449197,69,449207,68,449213,69,449215,68,449408,67,449409,67,449410,66,449413,64,449414,66,449415,64,449416,67,449417,67,449426,66,449430,66,449432,65,449434,65,449445,64,449447,64,449449,63,449453,63,449462,62,449463,62,449464,65,449465,63,449466,65,449469,63,449470,62,449471,62,449472,19,449473,19,449474,18,449477,16,449478,18,449479,16,449480,19,449481,19,449490,18,449494,18,449496,17,449498,17,449509,16,449511,16,449513,15,449517,15,449526,14,449527,14,449528,17,449529,15,449530,17,449533,15,449534,14,449535,14,449728,19,449729,19,449730,18,449734,18,449736,19,449737,19,449746,18,449750,18,449752,17,449754,17,449784,17,449786,17,451520,19,451521,19,451525,16,451527,16,451528,19,451529,19,451557,16,451559,16,451561,15,451565,15,451577,15,451581,15,451776,19,451777,19,451784,19,451785,19,465858,18,465861,16,465862,18,465863,16,465874,18,465878,18,465893,16,465895,16,465910,14,465911,14,465918,14,465919,14,466114,18,466118,18,466130,18,466134,18,467909,16,467911,16,467941,16,467943,16,468160,13,468161,13,468162,13,468163,13,468164,13,468165,13,468166,13,468167,13,580568,17,580570,17,580585,15,580589,15,580598,14,580599,14,580600,17,580601,15,580602,17,580605,15,580606,14,580607,14,580824,17,580826,17,580856,17,580858,17,582633,15,582637,15,582649,15,582653,15,582856,12,582857,12,582872,12,582873,12,582888,12,582889,12,582904,12,582905,12,596982,14,596983,14,596990,14,596991,14,597202,11,597206,11,597210,11,597214,11,597234,11,597238,11,597242,11,597246,11,599013,10,599015,10,599021,10,599023,10,599029,10,599031,10,599037,10,599039,10,599232,13,599233,13,599234,13,599235,13,599236,13,599237,13,599238,13,599239,13,599240,12,599241,12,599250,11,599254,11,599256,12,599257,12,599258,11,599262,11,599269,10,599271,10,599272,12,599273,12,599277,10,599279,10,599282,11,599285,10,599286,11,599287,10,599288,12,599289,12,599290,11,599293,10,599294,11,599295,10],f=[0,0,1,-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,0,-1,1,0,0,0,0,1,-1,0,0,0,1,0,-1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,-1,0,0,-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,2,1,1,0,0,1,1,1,-1,0,1,1,1,0,-1,0,2,1,0,1,0,1,1,-1,1,0,1,1,0,1,-1,0,2,0,1,1,0,1,-1,1,1,0,1,0,1,1,-1,0,2,1,0,0,1,1,1,-1,0,1,1,1,0,-1,1,0,2,0,1,0,1,1,-1,1,0,1,1,0,1,-1,1,0,2,0,0,1,1,1,-1,0,1,1,1,0,-1,1,1,1,4,2,1,1,0,4,1,2,1,0,4,1,1,2,0,1,4,2,1,0,1,4,1,2,0,1,4,1,1,0,2,1,4,2,0,1,1,4,1,0,2,1,4,1,0,1,2,1,4,0,2,1,1,4,0,1,2,1,4,0,1,1,2,1,2,1,1,0,0,3,2,1,0,0,3,1,2,0,0,1,2,1,0,1,0,3,2,0,1,0,3,1,0,2,0,1,2,0,1,1,0,3,0,2,1,0,3,0,1,2,0,1,2,1,0,0,1,3,2,0,0,1,3,1,0,0,2,1,2,0,1,0,1,3,0,2,0,1,3,0,1,0,2,1,2,0,0,1,1,3,0,0,2,1,3,0,0,1,2,2,3,1,1,1,0,2,1,1,1,-1,2,2,0,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,2,0,0,0,2,3,1,0,1,1,2,1,-1,1,1,2,2,0,0,0,2,3,1,1,1,0,2,1,1,1,-1,2,0,2,0,0,2,3,1,1,0,1,2,1,1,-1,1,2,0,2,0,0,2,3,0,1,1,1,2,-1,1,1,1,2,0,2,0,0,2,3,1,1,1,0,2,1,1,1,-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0,0,1,0,2,0,0,2,0,2,1,-1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,1,-1,1,1,3,1,0,1,0,0,2,0,2,0,0,2,-1,1,1,1,3,1,0,0,1,0,2,0,0,2,0,2,-1,1,1,1,3,1,0,0,0,1,2,0,0,0,2,2,-1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,4,1,1,1,1,3,3,2,0,1,0,3,1,0,2,0,4,1,1,1,1,3,3,0,2,1,0,3,0,1,2,0,4,1,1,1,1,3,3,2,0,0,1,3,1,0,0,2,4,1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,4,1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,4,1,1,1,1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,1,-1,3,3,2,0,1,0,3,1,0,2,0,2,1,1,1,-1,3,3,0,2,1,0,3,0,1,2,0,2,1,1,1,-1,3,3,2,1,0,0,3,1,2,0,0,2,1,1,-1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,1,-1,1,3,3,0,2,0,1,3,0,1,0,2,2,1,1,-1,1,3,3,2,0,1,0,3,1,0,2,0,2,1,-1,1,1,3,3,2,0,0,1,3,1,0,0,2,2,1,-1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,1,-1,1,1,3,3,0,2,1,0,3,0,1,2,0,2,-1,1,1,1,3,3,0,2,0,1,3,0,1,0,2,2,-1,1,1,1,3,3,0,0,2,1,3,0,0,1,2,2,-1,1,1,1];class p{constructor(){this._calculateField=()=>{for(let t=0;t<this.options.columns;t++)for(let e=0;e<this.options.rows;e++)for(let i=0;i<this.options.layers;i++)this.field[t][e][i][0]=this.noiseFunc(t/50,e/50,i/50,this.noiseW)*Math.PI*2,this.field[t][e][i][1]=this.noiseFunc(t/100+4e4,e/100+4e4,i/100+4e4,this.noiseW)},this._initField=()=>{this.field=new Array(this.options.columns);for(let t=0;t<this.options.columns;t++){this.field[t]=new Array(this.options.rows);for(let e=0;e<this.options.rows;e++){this.field[t][e]=new Array(this.options.layers);for(let i=0;i<this.options.layers;i++)this.field[t][e][i]=[0,0]}}},this._resetField=e=>{const i=e.actualOptions.particles.move.path.options;this.options.size=i.size>0?i.size:20,this.options.increment=i.increment>0?i.increment:.004,this.options.width=e.canvas.size.width,this.options.height=e.canvas.size.height,this.noiseFunc=h(i.seed??(0,t.getRandom)()),this.options.columns=Math.floor(this.options.width/this.options.size)+1,this.options.rows=Math.floor(this.options.height/this.options.size)+1,this.options.layers=Math.floor(e.zLayers/this.options.size)+1,this._initField()},this._setup=t=>{this.noiseW=0,this._resetField(t),addEventListener("resize",(()=>this._resetField(t)))},this.field=[],this.noiseFunc=h((0,t.getRandom)()),this.noiseW=0,this.options={size:20,increment:.004,columns:0,rows:0,layers:0,width:0,height:0}}generate(e){const i=e.getPosition(),s=Math.max(Math.floor(i.x/this.options.size),0),o=Math.max(Math.floor(i.y/this.options.size),0),n=Math.max(Math.floor(i.z/this.options.size),0),r=t.Vector.origin;return this.field&&this.field[s]&&this.field[s][o]&&this.field[s][o][n]?(r.length=this.field[s][o][n][1],r.angle=this.field[s][o][n][0],r):r}init(t){this.container=t,this._setup(this.container)}reset(){}update(){this.container&&(this._calculateField(),this.noiseW+=this.options.increment)}}const d="simplexNoise";async function u(t,e=!0){await t.addPathGenerator(d,new p,e)}})(),o})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/simplex-noise"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/simplex-noise")):t(e.window,e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,((e,t)=>(()=>{"use strict";var i={533:t=>{t.exports=e},245:e=>{e.exports=t}},s={};function o(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return i[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{loadSimplexNoisePath:()=>h,simplexNoisePathName:()=>r});var e=o(533),t=o(245);const i={size:20,increment:.004,columns:0,rows:0,layers:0,width:0,height:0,offset:{x:4e4,y:4e4,z:4e4}};class s{constructor(){const s=new t.SimplexNoise;this._simplex=s.noise4d,this.field=[],this.noiseW=0,this.options=(0,e.deepExtend)({},i)}generate(t){const i=t.getPosition(),s=Math.max(Math.floor(i.x/this.options.size),0),o=Math.max(Math.floor(i.y/this.options.size),0),n=Math.max(Math.floor(i.z/this.options.size),0),r=e.Vector.origin;if(!(this.field&&this.field[s]&&this.field[s][o]&&this.field[s][o][n]))return r;const h=this.field[s][o][n];return r.length=h[1],r.angle=h[0],r}init(e){this.container=e,this._setup()}reset(){}update(){this.container&&(this._calculateField(),this.noiseW+=this.options.increment)}_calculateField(){const e=this.options;for(let t=0;t<e.columns;t++)for(let i=0;i<e.rows;i++)for(let s=0;s<e.layers;s++)this.field[t][i][s][0]=this._simplex.noise(t/50,i/50,s/50,this.noiseW)*Math.PI*2,this.field[t][i][s][1]=this._simplex.noise(t/100+e.offset.x,i/100+e.offset.y,s/100+e.offset.z,this.noiseW)}_initField(){this.field=new Array(this.options.columns);for(let e=0;e<this.options.columns;e++){this.field[e]=new Array(this.options.rows);for(let t=0;t<this.options.rows;t++){this.field[e][t]=new Array(this.options.layers);for(let i=0;i<this.options.layers;i++)this.field[e][t][i]=[0,0]}}}_resetField(){const t=this.container;if(!t)return;const s=t.actualOptions.particles.move.path.options;this.options.size=s.size>0?s.size:i.size,this.options.increment=s.increment>0?s.increment:i.increment,this.options.width=t.canvas.size.width,this.options.height=t.canvas.size.height;const o=s.offset;this.options.offset.x=o?.x??i.offset.x,this.options.offset.y=o?.y??i.offset.y,this.options.offset.z=o?.z??i.offset.z,this.options.seed=s.seed??i.seed,this._simplex.seed(this.options.seed??(0,e.getRandom)()),this.options.columns=Math.floor(this.options.width/this.options.size)+1,this.options.rows=Math.floor(this.options.height/this.options.size)+1,this.options.layers=Math.floor(t.zLayers/this.options.size)+1,this._initField()}_setup(){this.noiseW=0,this._resetField(),addEventListener("resize",(()=>this._resetField()))}}const r="simplexNoise";async function h(e,t=!0){await e.addPathGenerator(r,new s,t)}})(),n})()));
@@ -1 +1 @@
1
- /*! tsParticles Simplex Noise Path v3.0.0-beta.3 by Matteo Bruni */
1
+ /*! tsParticles Simplex Noise Path v3.0.0-beta.4 by Matteo Bruni */
@@ -0,0 +1,5 @@
1
+ export interface IOffsetValues {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ }
@@ -1,9 +1,12 @@
1
+ import type { IOffsetValues } from "./IOffsetValues.js";
1
2
  export interface ISimplexOptions {
2
3
  columns: number;
3
4
  height: number;
4
5
  increment: number;
5
6
  layers: number;
7
+ offset: IOffsetValues;
6
8
  rows: number;
9
+ seed?: number;
7
10
  size: number;
8
11
  width: number;
9
12
  }
@@ -1,19 +1,18 @@
1
1
  import { type Container, type IMovePathGenerator, type Particle, Vector } from "@tsparticles/engine";
2
2
  import type { ISimplexOptions } from "./ISimplexOptions.js";
3
- import type { Noise4D } from "./simplex.js";
4
3
  export declare class SimplexNoiseGenerator implements IMovePathGenerator {
5
4
  container?: Container;
6
5
  field: number[][][][];
7
- noiseFunc: Noise4D;
8
6
  noiseW: number;
9
7
  readonly options: ISimplexOptions;
8
+ private readonly _simplex;
10
9
  constructor();
11
10
  generate(particle: Particle): Vector;
12
11
  init(container: Container): void;
13
12
  reset(): void;
14
13
  update(): void;
15
- private readonly _calculateField;
16
- private readonly _initField;
17
- private readonly _resetField;
18
- private readonly _setup;
14
+ private _calculateField;
15
+ private _initField;
16
+ private _resetField;
17
+ private _setup;
19
18
  }
@@ -4,67 +4,35 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./simplex.js"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "@tsparticles/simplex-noise"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SimplexNoiseGenerator = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
- const simplex_js_1 = require("./simplex.js");
14
+ const simplex_noise_1 = require("@tsparticles/simplex-noise");
15
+ const defaultOptions = {
16
+ size: 20,
17
+ increment: 0.004,
18
+ columns: 0,
19
+ rows: 0,
20
+ layers: 0,
21
+ width: 0,
22
+ height: 0,
23
+ offset: {
24
+ x: 40000,
25
+ y: 40000,
26
+ z: 40000,
27
+ },
28
+ };
15
29
  class SimplexNoiseGenerator {
16
30
  constructor() {
17
- this._calculateField = () => {
18
- for (let x = 0; x < this.options.columns; x++) {
19
- for (let y = 0; y < this.options.rows; y++) {
20
- for (let z = 0; z < this.options.layers; z++) {
21
- this.field[x][y][z][0] = this.noiseFunc(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
22
- this.field[x][y][z][1] = this.noiseFunc(x / 100 + 40000, y / 100 + 40000, z / 100 + 40000, this.noiseW);
23
- }
24
- }
25
- }
26
- };
27
- this._initField = () => {
28
- this.field = new Array(this.options.columns);
29
- for (let x = 0; x < this.options.columns; x++) {
30
- this.field[x] = new Array(this.options.rows);
31
- for (let y = 0; y < this.options.rows; y++) {
32
- this.field[x][y] = new Array(this.options.layers);
33
- for (let z = 0; z < this.options.layers; z++) {
34
- this.field[x][y][z] = [0, 0];
35
- }
36
- }
37
- }
38
- };
39
- this._resetField = (container) => {
40
- const sourceOptions = container.actualOptions.particles.move.path.options;
41
- this.options.size = sourceOptions.size > 0 ? sourceOptions.size : 20;
42
- this.options.increment = sourceOptions.increment > 0 ? sourceOptions.increment : 0.004;
43
- this.options.width = container.canvas.size.width;
44
- this.options.height = container.canvas.size.height;
45
- this.noiseFunc = (0, simplex_js_1.makeNoise4D)(sourceOptions.seed ?? (0, engine_1.getRandom)());
46
- this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
47
- this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
48
- this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
49
- this._initField();
50
- };
51
- this._setup = (container) => {
52
- this.noiseW = 0;
53
- this._resetField(container);
54
- addEventListener("resize", () => this._resetField(container));
55
- };
31
+ const simplex = new simplex_noise_1.SimplexNoise();
32
+ this._simplex = simplex.noise4d;
56
33
  this.field = [];
57
- this.noiseFunc = (0, simplex_js_1.makeNoise4D)((0, engine_1.getRandom)());
58
34
  this.noiseW = 0;
59
- this.options = {
60
- size: 20,
61
- increment: 0.004,
62
- columns: 0,
63
- rows: 0,
64
- layers: 0,
65
- width: 0,
66
- height: 0,
67
- };
35
+ this.options = (0, engine_1.deepExtend)({}, defaultOptions);
68
36
  }
69
37
  generate(particle) {
70
38
  const pos = particle.getPosition(), point = {
@@ -78,13 +46,14 @@
78
46
  !this.field[point.x][point.y][point.z]) {
79
47
  return v;
80
48
  }
81
- v.length = this.field[point.x][point.y][point.z][1];
82
- v.angle = this.field[point.x][point.y][point.z][0];
49
+ const cell = this.field[point.x][point.y][point.z];
50
+ v.length = cell[1];
51
+ v.angle = cell[0];
83
52
  return v;
84
53
  }
85
54
  init(container) {
86
55
  this.container = container;
87
- this._setup(this.container);
56
+ this._setup();
88
57
  }
89
58
  reset() {
90
59
  }
@@ -95,6 +64,56 @@
95
64
  this._calculateField();
96
65
  this.noiseW += this.options.increment;
97
66
  }
67
+ _calculateField() {
68
+ const options = this.options;
69
+ for (let x = 0; x < options.columns; x++) {
70
+ for (let y = 0; y < options.rows; y++) {
71
+ for (let z = 0; z < options.layers; z++) {
72
+ this.field[x][y][z][0] = this._simplex.noise(x / 50, y / 50, z / 50, this.noiseW) * Math.PI * 2;
73
+ this.field[x][y][z][1] = this._simplex.noise(x / 100 + options.offset.x, y / 100 + options.offset.y, z / 100 + options.offset.z, this.noiseW);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ _initField() {
79
+ this.field = new Array(this.options.columns);
80
+ for (let x = 0; x < this.options.columns; x++) {
81
+ this.field[x] = new Array(this.options.rows);
82
+ for (let y = 0; y < this.options.rows; y++) {
83
+ this.field[x][y] = new Array(this.options.layers);
84
+ for (let z = 0; z < this.options.layers; z++) {
85
+ this.field[x][y][z] = [0, 0];
86
+ }
87
+ }
88
+ }
89
+ }
90
+ _resetField() {
91
+ const container = this.container;
92
+ if (!container) {
93
+ return;
94
+ }
95
+ const sourceOptions = container.actualOptions.particles.move.path.options;
96
+ this.options.size = sourceOptions.size > 0 ? sourceOptions.size : defaultOptions.size;
97
+ this.options.increment =
98
+ sourceOptions.increment > 0 ? sourceOptions.increment : defaultOptions.increment;
99
+ this.options.width = container.canvas.size.width;
100
+ this.options.height = container.canvas.size.height;
101
+ const offset = sourceOptions.offset;
102
+ this.options.offset.x = offset?.x ?? defaultOptions.offset.x;
103
+ this.options.offset.y = offset?.y ?? defaultOptions.offset.y;
104
+ this.options.offset.z = offset?.z ?? defaultOptions.offset.z;
105
+ this.options.seed = sourceOptions.seed ?? defaultOptions.seed;
106
+ this._simplex.seed(this.options.seed ?? (0, engine_1.getRandom)());
107
+ this.options.columns = Math.floor(this.options.width / this.options.size) + 1;
108
+ this.options.rows = Math.floor(this.options.height / this.options.size) + 1;
109
+ this.options.layers = Math.floor(container.zLayers / this.options.size) + 1;
110
+ this._initField();
111
+ }
112
+ _setup() {
113
+ this.noiseW = 0;
114
+ this._resetField();
115
+ addEventListener("resize", () => this._resetField());
116
+ }
98
117
  }
99
118
  exports.SimplexNoiseGenerator = SimplexNoiseGenerator;
100
119
  });