@tsparticles/perlin-noise 4.0.5 → 4.1.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/PerlinNoise.js +20 -20
- package/cjs/PerlinNoise.js +20 -20
- package/esm/PerlinNoise.js +20 -20
- package/package.json +1 -1
- package/report.html +1 -1
- package/tsparticles.perlin.noise.js +21 -21
- package/tsparticles.perlin.noise.min.js +1 -1
- package/types/PerlinNoise.d.ts +1 -6
package/browser/PerlinNoise.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Grad } from "./Grad.js";
|
|
2
2
|
export class PerlinNoise {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
#grad4;
|
|
4
|
+
#gradP;
|
|
5
|
+
#p;
|
|
6
|
+
#perm;
|
|
7
7
|
constructor() {
|
|
8
|
-
this
|
|
8
|
+
this.#grad4 = [
|
|
9
9
|
new Grad(0, 1, 1, 1),
|
|
10
10
|
new Grad(0, 1, 1, -1),
|
|
11
11
|
new Grad(0, 1, -1, 1),
|
|
@@ -39,7 +39,7 @@ export class PerlinNoise {
|
|
|
39
39
|
new Grad(-1, -1, 1, 0),
|
|
40
40
|
new Grad(-1, -1, -1, 0),
|
|
41
41
|
];
|
|
42
|
-
this
|
|
42
|
+
this.#p = [
|
|
43
43
|
151,
|
|
44
44
|
160,
|
|
45
45
|
137,
|
|
@@ -297,21 +297,21 @@ export class PerlinNoise {
|
|
|
297
297
|
156,
|
|
298
298
|
180,
|
|
299
299
|
];
|
|
300
|
-
this
|
|
301
|
-
this
|
|
300
|
+
this.#gradP = new Array(512);
|
|
301
|
+
this.#perm = new Array(512);
|
|
302
302
|
}
|
|
303
303
|
noise2d(x, y) {
|
|
304
|
-
const
|
|
304
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
305
305
|
let X = Math.floor(x), Y = Math.floor(y);
|
|
306
306
|
x -= X;
|
|
307
307
|
y -= Y;
|
|
308
308
|
X &= 255;
|
|
309
309
|
Y &= 255;
|
|
310
|
-
const n00 =
|
|
311
|
-
return this
|
|
310
|
+
const n00 = gradP[X + perm[Y]].dot2(x, y), n01 = gradP[X + perm[Y + 1]].dot2(x, y - 1), n10 = gradP[X + 1 + perm[Y]].dot2(x - 1, y), n11 = gradP[X + 1 + perm[Y + 1]].dot2(x - 1, y - 1), u = this.#fade(x);
|
|
311
|
+
return this.#lerp(this.#lerp(n00, n10, u), this.#lerp(n01, n11, u), this.#fade(y));
|
|
312
312
|
}
|
|
313
313
|
noise3d(x, y, z) {
|
|
314
|
-
const
|
|
314
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
315
315
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z);
|
|
316
316
|
x = x - X;
|
|
317
317
|
y = y - Y;
|
|
@@ -319,11 +319,11 @@ export class PerlinNoise {
|
|
|
319
319
|
X = X & 255;
|
|
320
320
|
Y = Y & 255;
|
|
321
321
|
Z = Z & 255;
|
|
322
|
-
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this
|
|
323
|
-
return this
|
|
322
|
+
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this.#fade(x), v = this.#fade(y), w = this.#fade(z);
|
|
323
|
+
return this.#lerp(this.#lerp(this.#lerp(n000, n100, u), this.#lerp(n001, n101, u), w), this.#lerp(this.#lerp(n010, n110, u), this.#lerp(n011, n111, u), w), v);
|
|
324
324
|
}
|
|
325
325
|
noise4d(x, y, z, w) {
|
|
326
|
-
const
|
|
326
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
327
327
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z), W = Math.floor(w);
|
|
328
328
|
x -= X;
|
|
329
329
|
y -= Y;
|
|
@@ -333,11 +333,11 @@ export class PerlinNoise {
|
|
|
333
333
|
Y &= 255;
|
|
334
334
|
Z &= 255;
|
|
335
335
|
W &= 255;
|
|
336
|
-
const u = this
|
|
337
|
-
return this
|
|
336
|
+
const u = this.#fade(x), v = this.#fade(y), s = this.#fade(z), t = this.#fade(w), gi = (i, j, k, l) => gradP[X + i + perm[Y + j + perm[Z + k + perm[W + l]]]], n0000 = gi(0, 0, 0, 0).dot4(x, y, z, w), n0001 = gi(0, 0, 0, 1).dot4(x, y, z, w - 1), n0010 = gi(0, 0, 1, 0).dot4(x, y, z - 1, w), n0011 = gi(0, 0, 1, 1).dot4(x, y, z - 1, w - 1), n0100 = gi(0, 1, 0, 0).dot4(x, y - 1, z, w), n0101 = gi(0, 1, 0, 1).dot4(x, y - 1, z, w - 1), n0110 = gi(0, 1, 1, 0).dot4(x, y - 1, z - 1, w), n0111 = gi(0, 1, 1, 1).dot4(x, y - 1, z - 1, w - 1), n1000 = gi(1, 0, 0, 0).dot4(x - 1, y, z, w), n1001 = gi(1, 0, 0, 1).dot4(x - 1, y, z, w - 1), n1010 = gi(1, 0, 1, 0).dot4(x - 1, y, z - 1, w), n1011 = gi(1, 0, 1, 1).dot4(x - 1, y, z - 1, w - 1), n1100 = gi(1, 1, 0, 0).dot4(x - 1, y - 1, z, w), n1101 = gi(1, 1, 0, 1).dot4(x - 1, y - 1, z, w - 1), n1110 = gi(1, 1, 1, 0).dot4(x - 1, y - 1, z - 1, w), n1111 = gi(1, 1, 1, 1).dot4(x - 1, y - 1, z - 1, w - 1), x00 = this.#lerp(n0000, n1000, u), x01 = this.#lerp(n0001, n1001, u), x10 = this.#lerp(n0010, n1010, u), x11 = this.#lerp(n0011, n1011, u), y00 = this.#lerp(x00, x10, s), y01 = this.#lerp(x01, x11, s), x20 = this.#lerp(n0100, n1100, u), x21 = this.#lerp(n0101, n1101, u), x30 = this.#lerp(n0110, n1110, u), x31 = this.#lerp(n0111, n1111, u), y10 = this.#lerp(x20, x30, s), y11 = this.#lerp(x21, x31, s), z0 = this.#lerp(y00, y10, v), z1 = this.#lerp(y01, y11, v);
|
|
337
|
+
return this.#lerp(z0, z1, t);
|
|
338
338
|
}
|
|
339
339
|
seed(inputSeed) {
|
|
340
|
-
const
|
|
340
|
+
const grad4 = this.#grad4, gradP = this.#gradP, perm = this.#perm, p = this.#p;
|
|
341
341
|
let seed = inputSeed;
|
|
342
342
|
if (seed > 0 && seed < 1) {
|
|
343
343
|
seed *= 65536;
|
|
@@ -353,10 +353,10 @@ export class PerlinNoise {
|
|
|
353
353
|
gradP[i] = gradP[i + 256] = grad4[v % grad4Length];
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
#fade(t) {
|
|
357
357
|
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
#lerp(a, b, t) {
|
|
360
360
|
return (1 - t) * a + t * b;
|
|
361
361
|
}
|
|
362
362
|
}
|
package/cjs/PerlinNoise.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Grad } from "./Grad.js";
|
|
2
2
|
export class PerlinNoise {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
#grad4;
|
|
4
|
+
#gradP;
|
|
5
|
+
#p;
|
|
6
|
+
#perm;
|
|
7
7
|
constructor() {
|
|
8
|
-
this
|
|
8
|
+
this.#grad4 = [
|
|
9
9
|
new Grad(0, 1, 1, 1),
|
|
10
10
|
new Grad(0, 1, 1, -1),
|
|
11
11
|
new Grad(0, 1, -1, 1),
|
|
@@ -39,7 +39,7 @@ export class PerlinNoise {
|
|
|
39
39
|
new Grad(-1, -1, 1, 0),
|
|
40
40
|
new Grad(-1, -1, -1, 0),
|
|
41
41
|
];
|
|
42
|
-
this
|
|
42
|
+
this.#p = [
|
|
43
43
|
151,
|
|
44
44
|
160,
|
|
45
45
|
137,
|
|
@@ -297,21 +297,21 @@ export class PerlinNoise {
|
|
|
297
297
|
156,
|
|
298
298
|
180,
|
|
299
299
|
];
|
|
300
|
-
this
|
|
301
|
-
this
|
|
300
|
+
this.#gradP = new Array(512);
|
|
301
|
+
this.#perm = new Array(512);
|
|
302
302
|
}
|
|
303
303
|
noise2d(x, y) {
|
|
304
|
-
const
|
|
304
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
305
305
|
let X = Math.floor(x), Y = Math.floor(y);
|
|
306
306
|
x -= X;
|
|
307
307
|
y -= Y;
|
|
308
308
|
X &= 255;
|
|
309
309
|
Y &= 255;
|
|
310
|
-
const n00 =
|
|
311
|
-
return this
|
|
310
|
+
const n00 = gradP[X + perm[Y]].dot2(x, y), n01 = gradP[X + perm[Y + 1]].dot2(x, y - 1), n10 = gradP[X + 1 + perm[Y]].dot2(x - 1, y), n11 = gradP[X + 1 + perm[Y + 1]].dot2(x - 1, y - 1), u = this.#fade(x);
|
|
311
|
+
return this.#lerp(this.#lerp(n00, n10, u), this.#lerp(n01, n11, u), this.#fade(y));
|
|
312
312
|
}
|
|
313
313
|
noise3d(x, y, z) {
|
|
314
|
-
const
|
|
314
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
315
315
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z);
|
|
316
316
|
x = x - X;
|
|
317
317
|
y = y - Y;
|
|
@@ -319,11 +319,11 @@ export class PerlinNoise {
|
|
|
319
319
|
X = X & 255;
|
|
320
320
|
Y = Y & 255;
|
|
321
321
|
Z = Z & 255;
|
|
322
|
-
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this
|
|
323
|
-
return this
|
|
322
|
+
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this.#fade(x), v = this.#fade(y), w = this.#fade(z);
|
|
323
|
+
return this.#lerp(this.#lerp(this.#lerp(n000, n100, u), this.#lerp(n001, n101, u), w), this.#lerp(this.#lerp(n010, n110, u), this.#lerp(n011, n111, u), w), v);
|
|
324
324
|
}
|
|
325
325
|
noise4d(x, y, z, w) {
|
|
326
|
-
const
|
|
326
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
327
327
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z), W = Math.floor(w);
|
|
328
328
|
x -= X;
|
|
329
329
|
y -= Y;
|
|
@@ -333,11 +333,11 @@ export class PerlinNoise {
|
|
|
333
333
|
Y &= 255;
|
|
334
334
|
Z &= 255;
|
|
335
335
|
W &= 255;
|
|
336
|
-
const u = this
|
|
337
|
-
return this
|
|
336
|
+
const u = this.#fade(x), v = this.#fade(y), s = this.#fade(z), t = this.#fade(w), gi = (i, j, k, l) => gradP[X + i + perm[Y + j + perm[Z + k + perm[W + l]]]], n0000 = gi(0, 0, 0, 0).dot4(x, y, z, w), n0001 = gi(0, 0, 0, 1).dot4(x, y, z, w - 1), n0010 = gi(0, 0, 1, 0).dot4(x, y, z - 1, w), n0011 = gi(0, 0, 1, 1).dot4(x, y, z - 1, w - 1), n0100 = gi(0, 1, 0, 0).dot4(x, y - 1, z, w), n0101 = gi(0, 1, 0, 1).dot4(x, y - 1, z, w - 1), n0110 = gi(0, 1, 1, 0).dot4(x, y - 1, z - 1, w), n0111 = gi(0, 1, 1, 1).dot4(x, y - 1, z - 1, w - 1), n1000 = gi(1, 0, 0, 0).dot4(x - 1, y, z, w), n1001 = gi(1, 0, 0, 1).dot4(x - 1, y, z, w - 1), n1010 = gi(1, 0, 1, 0).dot4(x - 1, y, z - 1, w), n1011 = gi(1, 0, 1, 1).dot4(x - 1, y, z - 1, w - 1), n1100 = gi(1, 1, 0, 0).dot4(x - 1, y - 1, z, w), n1101 = gi(1, 1, 0, 1).dot4(x - 1, y - 1, z, w - 1), n1110 = gi(1, 1, 1, 0).dot4(x - 1, y - 1, z - 1, w), n1111 = gi(1, 1, 1, 1).dot4(x - 1, y - 1, z - 1, w - 1), x00 = this.#lerp(n0000, n1000, u), x01 = this.#lerp(n0001, n1001, u), x10 = this.#lerp(n0010, n1010, u), x11 = this.#lerp(n0011, n1011, u), y00 = this.#lerp(x00, x10, s), y01 = this.#lerp(x01, x11, s), x20 = this.#lerp(n0100, n1100, u), x21 = this.#lerp(n0101, n1101, u), x30 = this.#lerp(n0110, n1110, u), x31 = this.#lerp(n0111, n1111, u), y10 = this.#lerp(x20, x30, s), y11 = this.#lerp(x21, x31, s), z0 = this.#lerp(y00, y10, v), z1 = this.#lerp(y01, y11, v);
|
|
337
|
+
return this.#lerp(z0, z1, t);
|
|
338
338
|
}
|
|
339
339
|
seed(inputSeed) {
|
|
340
|
-
const
|
|
340
|
+
const grad4 = this.#grad4, gradP = this.#gradP, perm = this.#perm, p = this.#p;
|
|
341
341
|
let seed = inputSeed;
|
|
342
342
|
if (seed > 0 && seed < 1) {
|
|
343
343
|
seed *= 65536;
|
|
@@ -353,10 +353,10 @@ export class PerlinNoise {
|
|
|
353
353
|
gradP[i] = gradP[i + 256] = grad4[v % grad4Length];
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
#fade(t) {
|
|
357
357
|
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
#lerp(a, b, t) {
|
|
360
360
|
return (1 - t) * a + t * b;
|
|
361
361
|
}
|
|
362
362
|
}
|
package/esm/PerlinNoise.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Grad } from "./Grad.js";
|
|
2
2
|
export class PerlinNoise {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
#grad4;
|
|
4
|
+
#gradP;
|
|
5
|
+
#p;
|
|
6
|
+
#perm;
|
|
7
7
|
constructor() {
|
|
8
|
-
this
|
|
8
|
+
this.#grad4 = [
|
|
9
9
|
new Grad(0, 1, 1, 1),
|
|
10
10
|
new Grad(0, 1, 1, -1),
|
|
11
11
|
new Grad(0, 1, -1, 1),
|
|
@@ -39,7 +39,7 @@ export class PerlinNoise {
|
|
|
39
39
|
new Grad(-1, -1, 1, 0),
|
|
40
40
|
new Grad(-1, -1, -1, 0),
|
|
41
41
|
];
|
|
42
|
-
this
|
|
42
|
+
this.#p = [
|
|
43
43
|
151,
|
|
44
44
|
160,
|
|
45
45
|
137,
|
|
@@ -297,21 +297,21 @@ export class PerlinNoise {
|
|
|
297
297
|
156,
|
|
298
298
|
180,
|
|
299
299
|
];
|
|
300
|
-
this
|
|
301
|
-
this
|
|
300
|
+
this.#gradP = new Array(512);
|
|
301
|
+
this.#perm = new Array(512);
|
|
302
302
|
}
|
|
303
303
|
noise2d(x, y) {
|
|
304
|
-
const
|
|
304
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
305
305
|
let X = Math.floor(x), Y = Math.floor(y);
|
|
306
306
|
x -= X;
|
|
307
307
|
y -= Y;
|
|
308
308
|
X &= 255;
|
|
309
309
|
Y &= 255;
|
|
310
|
-
const n00 =
|
|
311
|
-
return this
|
|
310
|
+
const n00 = gradP[X + perm[Y]].dot2(x, y), n01 = gradP[X + perm[Y + 1]].dot2(x, y - 1), n10 = gradP[X + 1 + perm[Y]].dot2(x - 1, y), n11 = gradP[X + 1 + perm[Y + 1]].dot2(x - 1, y - 1), u = this.#fade(x);
|
|
311
|
+
return this.#lerp(this.#lerp(n00, n10, u), this.#lerp(n01, n11, u), this.#fade(y));
|
|
312
312
|
}
|
|
313
313
|
noise3d(x, y, z) {
|
|
314
|
-
const
|
|
314
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
315
315
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z);
|
|
316
316
|
x = x - X;
|
|
317
317
|
y = y - Y;
|
|
@@ -319,11 +319,11 @@ export class PerlinNoise {
|
|
|
319
319
|
X = X & 255;
|
|
320
320
|
Y = Y & 255;
|
|
321
321
|
Z = Z & 255;
|
|
322
|
-
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this
|
|
323
|
-
return this
|
|
322
|
+
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this.#fade(x), v = this.#fade(y), w = this.#fade(z);
|
|
323
|
+
return this.#lerp(this.#lerp(this.#lerp(n000, n100, u), this.#lerp(n001, n101, u), w), this.#lerp(this.#lerp(n010, n110, u), this.#lerp(n011, n111, u), w), v);
|
|
324
324
|
}
|
|
325
325
|
noise4d(x, y, z, w) {
|
|
326
|
-
const
|
|
326
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
327
327
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z), W = Math.floor(w);
|
|
328
328
|
x -= X;
|
|
329
329
|
y -= Y;
|
|
@@ -333,11 +333,11 @@ export class PerlinNoise {
|
|
|
333
333
|
Y &= 255;
|
|
334
334
|
Z &= 255;
|
|
335
335
|
W &= 255;
|
|
336
|
-
const u = this
|
|
337
|
-
return this
|
|
336
|
+
const u = this.#fade(x), v = this.#fade(y), s = this.#fade(z), t = this.#fade(w), gi = (i, j, k, l) => gradP[X + i + perm[Y + j + perm[Z + k + perm[W + l]]]], n0000 = gi(0, 0, 0, 0).dot4(x, y, z, w), n0001 = gi(0, 0, 0, 1).dot4(x, y, z, w - 1), n0010 = gi(0, 0, 1, 0).dot4(x, y, z - 1, w), n0011 = gi(0, 0, 1, 1).dot4(x, y, z - 1, w - 1), n0100 = gi(0, 1, 0, 0).dot4(x, y - 1, z, w), n0101 = gi(0, 1, 0, 1).dot4(x, y - 1, z, w - 1), n0110 = gi(0, 1, 1, 0).dot4(x, y - 1, z - 1, w), n0111 = gi(0, 1, 1, 1).dot4(x, y - 1, z - 1, w - 1), n1000 = gi(1, 0, 0, 0).dot4(x - 1, y, z, w), n1001 = gi(1, 0, 0, 1).dot4(x - 1, y, z, w - 1), n1010 = gi(1, 0, 1, 0).dot4(x - 1, y, z - 1, w), n1011 = gi(1, 0, 1, 1).dot4(x - 1, y, z - 1, w - 1), n1100 = gi(1, 1, 0, 0).dot4(x - 1, y - 1, z, w), n1101 = gi(1, 1, 0, 1).dot4(x - 1, y - 1, z, w - 1), n1110 = gi(1, 1, 1, 0).dot4(x - 1, y - 1, z - 1, w), n1111 = gi(1, 1, 1, 1).dot4(x - 1, y - 1, z - 1, w - 1), x00 = this.#lerp(n0000, n1000, u), x01 = this.#lerp(n0001, n1001, u), x10 = this.#lerp(n0010, n1010, u), x11 = this.#lerp(n0011, n1011, u), y00 = this.#lerp(x00, x10, s), y01 = this.#lerp(x01, x11, s), x20 = this.#lerp(n0100, n1100, u), x21 = this.#lerp(n0101, n1101, u), x30 = this.#lerp(n0110, n1110, u), x31 = this.#lerp(n0111, n1111, u), y10 = this.#lerp(x20, x30, s), y11 = this.#lerp(x21, x31, s), z0 = this.#lerp(y00, y10, v), z1 = this.#lerp(y01, y11, v);
|
|
337
|
+
return this.#lerp(z0, z1, t);
|
|
338
338
|
}
|
|
339
339
|
seed(inputSeed) {
|
|
340
|
-
const
|
|
340
|
+
const grad4 = this.#grad4, gradP = this.#gradP, perm = this.#perm, p = this.#p;
|
|
341
341
|
let seed = inputSeed;
|
|
342
342
|
if (seed > 0 && seed < 1) {
|
|
343
343
|
seed *= 65536;
|
|
@@ -353,10 +353,10 @@ export class PerlinNoise {
|
|
|
353
353
|
gradP[i] = gradP[i + 256] = grad4[v % grad4Length];
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
#fade(t) {
|
|
357
357
|
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
#lerp(a, b, t) {
|
|
360
360
|
return (1 - t) * a + t * b;
|
|
361
361
|
}
|
|
362
362
|
}
|
package/package.json
CHANGED
package/report.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.perlin.noise.js","children":[{"name":"dist/browser","children":[{"uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.perlin.noise.js","children":[{"name":"dist/browser","children":[{"uid":"dcbe602e-1","name":"Grad.js"},{"uid":"dcbe602e-3","name":"PerlinNoise.js"},{"uid":"dcbe602e-5","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"dcbe602e-1":{"renderedLength":453,"gzipLength":0,"brotliLength":0,"metaUid":"dcbe602e-0"},"dcbe602e-3":{"renderedLength":11066,"gzipLength":0,"brotliLength":0,"metaUid":"dcbe602e-2"},"dcbe602e-5":{"renderedLength":121,"gzipLength":0,"brotliLength":0,"metaUid":"dcbe602e-4"}},"nodeMetas":{"dcbe602e-0":{"id":"/dist/browser/Grad.js","moduleParts":{"tsparticles.perlin.noise.js":"dcbe602e-1"},"imported":[],"importedBy":[{"uid":"dcbe602e-2"}]},"dcbe602e-2":{"id":"/dist/browser/PerlinNoise.js","moduleParts":{"tsparticles.perlin.noise.js":"dcbe602e-3"},"imported":[{"uid":"dcbe602e-0"}],"importedBy":[{"uid":"dcbe602e-6"}]},"dcbe602e-4":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.perlin.noise.js":"dcbe602e-5"},"imported":[{"uid":"dcbe602e-6"}],"importedBy":[],"isEntry":true},"dcbe602e-6":{"id":"/dist/browser/index.js","moduleParts":{},"imported":[{"uid":"dcbe602e-2"}],"importedBy":[{"uid":"dcbe602e-4"}]}},"env":{"rollup":"4.60.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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.
|
|
2
|
+
/* Utility v4.1.1 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
class PerlinNoise {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
#grad4;
|
|
33
|
+
#gradP;
|
|
34
|
+
#p;
|
|
35
|
+
#perm;
|
|
36
36
|
constructor() {
|
|
37
|
-
this
|
|
37
|
+
this.#grad4 = [
|
|
38
38
|
new Grad(0, 1, 1, 1),
|
|
39
39
|
new Grad(0, 1, 1, -1),
|
|
40
40
|
new Grad(0, 1, -1, 1),
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
new Grad(-1, -1, 1, 0),
|
|
69
69
|
new Grad(-1, -1, -1, 0),
|
|
70
70
|
];
|
|
71
|
-
this
|
|
71
|
+
this.#p = [
|
|
72
72
|
151,
|
|
73
73
|
160,
|
|
74
74
|
137,
|
|
@@ -326,21 +326,21 @@
|
|
|
326
326
|
156,
|
|
327
327
|
180,
|
|
328
328
|
];
|
|
329
|
-
this
|
|
330
|
-
this
|
|
329
|
+
this.#gradP = new Array(512);
|
|
330
|
+
this.#perm = new Array(512);
|
|
331
331
|
}
|
|
332
332
|
noise2d(x, y) {
|
|
333
|
-
const
|
|
333
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
334
334
|
let X = Math.floor(x), Y = Math.floor(y);
|
|
335
335
|
x -= X;
|
|
336
336
|
y -= Y;
|
|
337
337
|
X &= 255;
|
|
338
338
|
Y &= 255;
|
|
339
|
-
const n00 =
|
|
340
|
-
return this
|
|
339
|
+
const n00 = gradP[X + perm[Y]].dot2(x, y), n01 = gradP[X + perm[Y + 1]].dot2(x, y - 1), n10 = gradP[X + 1 + perm[Y]].dot2(x - 1, y), n11 = gradP[X + 1 + perm[Y + 1]].dot2(x - 1, y - 1), u = this.#fade(x);
|
|
340
|
+
return this.#lerp(this.#lerp(n00, n10, u), this.#lerp(n01, n11, u), this.#fade(y));
|
|
341
341
|
}
|
|
342
342
|
noise3d(x, y, z) {
|
|
343
|
-
const
|
|
343
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
344
344
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z);
|
|
345
345
|
x = x - X;
|
|
346
346
|
y = y - Y;
|
|
@@ -348,11 +348,11 @@
|
|
|
348
348
|
X = X & 255;
|
|
349
349
|
Y = Y & 255;
|
|
350
350
|
Z = Z & 255;
|
|
351
|
-
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this
|
|
352
|
-
return this
|
|
351
|
+
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z), n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1), n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z), n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1), n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z), n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1), n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z), n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1), u = this.#fade(x), v = this.#fade(y), w = this.#fade(z);
|
|
352
|
+
return this.#lerp(this.#lerp(this.#lerp(n000, n100, u), this.#lerp(n001, n101, u), w), this.#lerp(this.#lerp(n010, n110, u), this.#lerp(n011, n111, u), w), v);
|
|
353
353
|
}
|
|
354
354
|
noise4d(x, y, z, w) {
|
|
355
|
-
const
|
|
355
|
+
const gradP = this.#gradP, perm = this.#perm;
|
|
356
356
|
let X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z), W = Math.floor(w);
|
|
357
357
|
x -= X;
|
|
358
358
|
y -= Y;
|
|
@@ -362,11 +362,11 @@
|
|
|
362
362
|
Y &= 255;
|
|
363
363
|
Z &= 255;
|
|
364
364
|
W &= 255;
|
|
365
|
-
const u = this
|
|
366
|
-
return this
|
|
365
|
+
const u = this.#fade(x), v = this.#fade(y), s = this.#fade(z), t = this.#fade(w), gi = (i, j, k, l) => gradP[X + i + perm[Y + j + perm[Z + k + perm[W + l]]]], n0000 = gi(0, 0, 0, 0).dot4(x, y, z, w), n0001 = gi(0, 0, 0, 1).dot4(x, y, z, w - 1), n0010 = gi(0, 0, 1, 0).dot4(x, y, z - 1, w), n0011 = gi(0, 0, 1, 1).dot4(x, y, z - 1, w - 1), n0100 = gi(0, 1, 0, 0).dot4(x, y - 1, z, w), n0101 = gi(0, 1, 0, 1).dot4(x, y - 1, z, w - 1), n0110 = gi(0, 1, 1, 0).dot4(x, y - 1, z - 1, w), n0111 = gi(0, 1, 1, 1).dot4(x, y - 1, z - 1, w - 1), n1000 = gi(1, 0, 0, 0).dot4(x - 1, y, z, w), n1001 = gi(1, 0, 0, 1).dot4(x - 1, y, z, w - 1), n1010 = gi(1, 0, 1, 0).dot4(x - 1, y, z - 1, w), n1011 = gi(1, 0, 1, 1).dot4(x - 1, y, z - 1, w - 1), n1100 = gi(1, 1, 0, 0).dot4(x - 1, y - 1, z, w), n1101 = gi(1, 1, 0, 1).dot4(x - 1, y - 1, z, w - 1), n1110 = gi(1, 1, 1, 0).dot4(x - 1, y - 1, z - 1, w), n1111 = gi(1, 1, 1, 1).dot4(x - 1, y - 1, z - 1, w - 1), x00 = this.#lerp(n0000, n1000, u), x01 = this.#lerp(n0001, n1001, u), x10 = this.#lerp(n0010, n1010, u), x11 = this.#lerp(n0011, n1011, u), y00 = this.#lerp(x00, x10, s), y01 = this.#lerp(x01, x11, s), x20 = this.#lerp(n0100, n1100, u), x21 = this.#lerp(n0101, n1101, u), x30 = this.#lerp(n0110, n1110, u), x31 = this.#lerp(n0111, n1111, u), y10 = this.#lerp(x20, x30, s), y11 = this.#lerp(x21, x31, s), z0 = this.#lerp(y00, y10, v), z1 = this.#lerp(y01, y11, v);
|
|
366
|
+
return this.#lerp(z0, z1, t);
|
|
367
367
|
}
|
|
368
368
|
seed(inputSeed) {
|
|
369
|
-
const
|
|
369
|
+
const grad4 = this.#grad4, gradP = this.#gradP, perm = this.#perm, p = this.#p;
|
|
370
370
|
let seed = inputSeed;
|
|
371
371
|
if (seed > 0 && seed < 1) {
|
|
372
372
|
seed *= 65536;
|
|
@@ -382,10 +382,10 @@
|
|
|
382
382
|
gradP[i] = gradP[i + 256] = grad4[v % grad4Length];
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
|
|
385
|
+
#fade(t) {
|
|
386
386
|
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
387
387
|
}
|
|
388
|
-
|
|
388
|
+
#lerp(a, b, t) {
|
|
389
389
|
return (1 - t) * a + t * b;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
@@ -1 +1 @@
|
|
|
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):"function"==typeof define&&define.amd?define(["exports"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.perlin=t.__tsParticlesInternals.perlin||{},t.__tsParticlesInternals.perlin.noise=t.__tsParticlesInternals.perlin.noise||{}))}(this,function(t){"use strict";class s{w;x;y;z;constructor(t,s,e,n){this.x=t,this.y=s,this.z=e,this.w=n}dot2(t,s){return this.x*t+this.y*s}dot3(t,s,e){return this.dot2(t,s)+this.z*e}dot4(t,s,e,n){return this.dot3(t,s,e)+this.w*n}}const e=globalThis;e.__tsParticlesInternals=e.__tsParticlesInternals??{},t.PerlinNoise=class{
|
|
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):"function"==typeof define&&define.amd?define(["exports"],s):s(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.perlin=t.__tsParticlesInternals.perlin||{},t.__tsParticlesInternals.perlin.noise=t.__tsParticlesInternals.perlin.noise||{}))}(this,function(t){"use strict";class s{w;x;y;z;constructor(t,s,e,n){this.x=t,this.y=s,this.z=e,this.w=n}dot2(t,s){return this.x*t+this.y*s}dot3(t,s,e){return this.dot2(t,s)+this.z*e}dot4(t,s,e,n){return this.dot3(t,s,e)+this.w*n}}const e=globalThis;e.__tsParticlesInternals=e.__tsParticlesInternals??{},t.PerlinNoise=class{#t;#s;#e;#n;constructor(){this.#t=[new s(0,1,1,1),new s(0,1,1,-1),new s(0,1,-1,1),new s(0,1,-1,-1),new s(0,-1,1,1),new s(0,-1,1,-1),new s(0,-1,-1,1),new s(0,-1,-1,-1),new s(1,0,1,1),new s(1,0,1,-1),new s(1,0,-1,1),new s(1,0,-1,-1),new s(-1,0,1,1),new s(-1,0,1,-1),new s(-1,0,-1,1),new s(-1,0,-1,-1),new s(1,1,0,1),new s(1,1,0,-1),new s(1,-1,0,1),new s(1,-1,0,-1),new s(-1,1,0,1),new s(-1,1,0,-1),new s(-1,-1,0,1),new s(-1,-1,0,-1),new s(1,1,1,0),new s(1,1,-1,0),new s(1,-1,1,0),new s(1,-1,-1,0),new s(-1,1,1,0),new s(-1,1,-1,0),new s(-1,-1,1,0),new s(-1,-1,-1,0)],this.#e=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],this.#s=new Array(512),this.#n=new Array(512)}noise2d(t,s){const e=this.#s,n=this.#n;let r=Math.floor(t),l=Math.floor(s);t-=r,s-=l,r&=255,l&=255;const a=e[r+n[l]].dot2(t,s),i=e[r+n[l+1]].dot2(t,s-1),_=e[r+1+n[l]].dot2(t-1,s),c=e[r+1+n[l+1]].dot2(t-1,s-1),o=this.#r(t);return this.#l(this.#l(a,_,o),this.#l(i,c,o),this.#r(s))}noise3d(t,s,e){const n=this.#s,r=this.#n;let l=Math.floor(t),a=Math.floor(s),i=Math.floor(e);t-=l,s-=a,e-=i,l&=255,a&=255,i&=255;const _=n[l+r[a+r[i]]].dot3(t,s,e),c=n[l+r[a+r[i+1]]].dot3(t,s,e-1),o=n[l+r[a+1+r[i]]].dot3(t,s-1,e),h=n[l+r[a+1+r[i+1]]].dot3(t,s-1,e-1),p=n[l+1+r[a+r[i]]].dot3(t-1,s,e),d=n[l+1+r[a+r[i+1]]].dot3(t-1,s,e-1),P=n[l+1+r[a+1+r[i]]].dot3(t-1,s-1,e),I=n[l+1+r[a+1+r[i+1]]].dot3(t-1,s-1,e-1),u=this.#r(t),f=this.#r(s),w=this.#r(e);return this.#l(this.#l(this.#l(_,p,u),this.#l(c,d,u),w),this.#l(this.#l(o,P,u),this.#l(h,I,u),w),f)}noise4d(t,s,e,n){const r=this.#s,l=this.#n;let a=Math.floor(t),i=Math.floor(s),_=Math.floor(e),c=Math.floor(n);t-=a,s-=i,e-=_,n-=c,a&=255,i&=255,_&=255,c&=255;const o=this.#r(t),h=this.#r(s),p=this.#r(e),d=this.#r(n),P=(t,s,e,n)=>r[a+t+l[i+s+l[_+e+l[c+n]]]],I=P(0,0,0,0).dot4(t,s,e,n),u=P(0,0,0,1).dot4(t,s,e,n-1),f=P(0,0,1,0).dot4(t,s,e-1,n),w=P(0,0,1,1).dot4(t,s,e-1,n-1),g=P(0,1,0,0).dot4(t,s-1,e,n),y=P(0,1,0,1).dot4(t,s-1,e,n-1),b=P(0,1,1,0).dot4(t,s-1,e-1,n),m=P(0,1,1,1).dot4(t,s-1,e-1,n-1),x=P(1,0,0,0).dot4(t-1,s,e,n),M=P(1,0,0,1).dot4(t-1,s,e,n-1),v=P(1,0,1,0).dot4(t-1,s,e-1,n),T=P(1,0,1,1).dot4(t-1,s,e-1,n-1),S=P(1,1,0,0).dot4(t-1,s-1,e,n),z=P(1,1,0,1).dot4(t-1,s-1,e,n-1),E=P(1,1,1,0).dot4(t-1,s-1,e-1,n),A=P(1,1,1,1).dot4(t-1,s-1,e-1,n-1),j=this.#l(I,x,o),N=this.#l(u,M,o),k=this.#l(f,v,o),q=this.#l(w,T,o),B=this.#l(j,k,p),C=this.#l(N,q,p),D=this.#l(g,S,o),F=this.#l(y,z,o),G=this.#l(b,E,o),H=this.#l(m,A,o),J=this.#l(D,G,p),K=this.#l(F,H,p),L=this.#l(B,J,h),O=this.#l(C,K,h);return this.#l(L,O,d)}seed(t){const s=this.#t,e=this.#s,n=this.#n,r=this.#e;let l=t;l>0&&l<1&&(l*=65536),l=Math.floor(l),l<256&&(l|=l<<8);const a=s.length;for(let t=0;t<256;t++){const i=1&t?r[t]^255&l:r[t]^l>>8&255;n[t]=n[t+256]=i,e[t]=e[t+256]=s[i%a]}}#r(t){return t*t*t*(t*(6*t-15)+10)}#l(t,s,e){return(1-e)*t+e*s}}}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
package/types/PerlinNoise.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
export declare class PerlinNoise {
|
|
2
|
-
private
|
|
3
|
-
private readonly _gradP;
|
|
4
|
-
private readonly _p;
|
|
5
|
-
private readonly _perm;
|
|
2
|
+
#private;
|
|
6
3
|
constructor();
|
|
7
4
|
noise2d(x: number, y: number): number;
|
|
8
5
|
noise3d(x: number, y: number, z: number): number;
|
|
9
6
|
noise4d(x: number, y: number, z: number, w: number): number;
|
|
10
7
|
seed(inputSeed: number): void;
|
|
11
|
-
private _fade;
|
|
12
|
-
private _lerp;
|
|
13
8
|
}
|