@tsparticles/perlin-noise 3.0.3 → 3.2.0
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/package.json
CHANGED
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/perlin-noise [
|
|
6
|
+
<title>@tsparticles/perlin-noise [31 Jan 2024 at 02:02]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
<body>
|
|
32
32
|
<div id="app"></div>
|
|
33
33
|
<script>
|
|
34
|
-
window.chartData = [
|
|
35
|
-
window.entrypoints = ["tsparticles.perlin.noise
|
|
34
|
+
window.chartData = [];
|
|
35
|
+
window.entrypoints = ["tsparticles.perlin.noise.min"];
|
|
36
36
|
window.defaultSizes = "parsed";
|
|
37
37
|
</script>
|
|
38
38
|
</body>
|
|
@@ -4,7 +4,15 @@
|
|
|
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
|
|
7
|
+
* v3.2.0
|
|
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/).
|
|
8
16
|
*/
|
|
9
17
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
18
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -18,8 +26,63 @@
|
|
|
18
26
|
})(this, () => {
|
|
19
27
|
return /******/ (() => { // webpackBootstrap
|
|
20
28
|
/******/ "use strict";
|
|
21
|
-
/******/
|
|
22
|
-
|
|
29
|
+
/******/ var __webpack_modules__ = ({
|
|
30
|
+
|
|
31
|
+
/***/ "./dist/browser/Grad.js":
|
|
32
|
+
/*!******************************!*\
|
|
33
|
+
!*** ./dist/browser/Grad.js ***!
|
|
34
|
+
\******************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grad: () => (/* binding */ Grad)\n/* harmony export */ });\nclass Grad {\n constructor(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n dot2(x, y) {\n return this.x * x + this.y * y;\n }\n dot3(x, y, z) {\n return this.dot2(x, y) + this.z * z;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/perlin-noise/./dist/browser/Grad.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/PerlinNoise.js":
|
|
42
|
+
/*!*************************************!*\
|
|
43
|
+
!*** ./dist/browser/PerlinNoise.js ***!
|
|
44
|
+
\*************************************/
|
|
45
|
+
/***/ ((__unused_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 */ PerlinNoise: () => (/* binding */ PerlinNoise)\n/* harmony export */ });\n/* harmony import */ var _Grad_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Grad.js */ \"./dist/browser/Grad.js\");\n\nclass PerlinNoise {\n constructor() {\n this._grad3 = [new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(1, 1, 0), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(-1, 1, 0), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(1, -1, 0), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(-1, -1, 0), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(1, 0, 1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(-1, 0, 1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(1, 0, -1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(-1, 0, -1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(0, 1, 1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(0, -1, 1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(0, 1, -1), new _Grad_js__WEBPACK_IMPORTED_MODULE_0__.Grad(0, -1, -1)];\n this._p = [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];\n this._gradP = new Array(512);\n this._perm = new Array(512);\n }\n noise2d(x, y) {\n const {\n _gradP,\n _perm\n } = this;\n let X = Math.floor(x),\n Y = Math.floor(y);\n x = x - X;\n y = y - Y;\n X = X & 255;\n Y = Y & 255;\n const n00 = _gradP[X + _perm[Y]].dot2(x, y),\n n01 = _gradP[X + _perm[Y + 1]].dot2(x, y - 1),\n n10 = _gradP[X + 1 + _perm[Y]].dot2(x - 1, y),\n n11 = _gradP[X + 1 + _perm[Y + 1]].dot2(x - 1, y - 1);\n const u = this._fade(x);\n return this._lerp(this._lerp(n00, n10, u), this._lerp(n01, n11, u), this._fade(y));\n }\n noise3d(x, y, z) {\n const {\n _gradP: gradP,\n _perm: perm\n } = this;\n let X = Math.floor(x),\n Y = Math.floor(y),\n Z = Math.floor(z);\n x = x - X;\n y = y - Y;\n z = z - Z;\n X = X & 255;\n Y = Y & 255;\n Z = Z & 255;\n const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z),\n n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1),\n n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z),\n n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1),\n n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z),\n n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1),\n n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z),\n n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1),\n u = this._fade(x),\n v = this._fade(y),\n w = this._fade(z);\n 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);\n }\n seed(inputSeed) {\n const {\n _grad3: grad3,\n _gradP: gradP,\n _perm: perm,\n _p: p\n } = this;\n let seed = inputSeed;\n if (seed > 0 && seed < 1) {\n seed *= 65536;\n }\n seed = Math.floor(seed);\n if (seed < 256) {\n seed |= seed << 8;\n }\n for (let i = 0; i < 256; i++) {\n const v = i & 1 ? p[i] ^ seed & 255 : p[i] ^ seed >> 8 & 255;\n perm[i] = perm[i + 256] = v;\n gradP[i] = gradP[i + 256] = grad3[v % 12];\n }\n }\n _fade(t) {\n return t * t * t * (t * (t * 6 - 15) + 10);\n }\n _lerp(a, b, t) {\n return (1 - t) * a + t * b;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/perlin-noise/./dist/browser/PerlinNoise.js?");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
51
|
+
/***/ "./dist/browser/index.js":
|
|
52
|
+
/*!*******************************!*\
|
|
53
|
+
!*** ./dist/browser/index.js ***!
|
|
54
|
+
\*******************************/
|
|
55
|
+
/***/ ((__unused_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 */ PerlinNoise: () => (/* reexport safe */ _PerlinNoise_js__WEBPACK_IMPORTED_MODULE_0__.PerlinNoise)\n/* harmony export */ });\n/* harmony import */ var _PerlinNoise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PerlinNoise.js */ \"./dist/browser/PerlinNoise.js\");\n\n\n//# sourceURL=webpack://@tsparticles/perlin-noise/./dist/browser/index.js?");
|
|
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
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
82
|
+
/******/
|
|
83
|
+
/******/ // Return the exports of the module
|
|
84
|
+
/******/ return module.exports;
|
|
85
|
+
/******/ }
|
|
23
86
|
/******/
|
|
24
87
|
/************************************************************************/
|
|
25
88
|
/******/ /* webpack/runtime/define property getters */
|
|
@@ -51,113 +114,12 @@ return /******/ (() => { // webpackBootstrap
|
|
|
51
114
|
/******/ })();
|
|
52
115
|
/******/
|
|
53
116
|
/************************************************************************/
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
PerlinNoise: () => (/* reexport */ PerlinNoise)
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
;// CONCATENATED MODULE: ./dist/browser/Grad.js
|
|
64
|
-
class Grad {
|
|
65
|
-
constructor(x, y, z) {
|
|
66
|
-
this.x = x;
|
|
67
|
-
this.y = y;
|
|
68
|
-
this.z = z;
|
|
69
|
-
}
|
|
70
|
-
dot2(x, y) {
|
|
71
|
-
return this.x * x + this.y * y;
|
|
72
|
-
}
|
|
73
|
-
dot3(x, y, z) {
|
|
74
|
-
return this.dot2(x, y) + this.z * z;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
;// CONCATENATED MODULE: ./dist/browser/PerlinNoise.js
|
|
78
|
-
|
|
79
|
-
class PerlinNoise {
|
|
80
|
-
constructor() {
|
|
81
|
-
this._grad3 = [new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0), new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1), new Grad(0, 1, 1), new Grad(0, -1, 1), new Grad(0, 1, -1), new Grad(0, -1, -1)];
|
|
82
|
-
this._p = [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];
|
|
83
|
-
this._gradP = new Array(512);
|
|
84
|
-
this._perm = new Array(512);
|
|
85
|
-
}
|
|
86
|
-
noise2d(x, y) {
|
|
87
|
-
const {
|
|
88
|
-
_gradP,
|
|
89
|
-
_perm
|
|
90
|
-
} = this;
|
|
91
|
-
let X = Math.floor(x),
|
|
92
|
-
Y = Math.floor(y);
|
|
93
|
-
x = x - X;
|
|
94
|
-
y = y - Y;
|
|
95
|
-
X = X & 255;
|
|
96
|
-
Y = Y & 255;
|
|
97
|
-
const n00 = _gradP[X + _perm[Y]].dot2(x, y),
|
|
98
|
-
n01 = _gradP[X + _perm[Y + 1]].dot2(x, y - 1),
|
|
99
|
-
n10 = _gradP[X + 1 + _perm[Y]].dot2(x - 1, y),
|
|
100
|
-
n11 = _gradP[X + 1 + _perm[Y + 1]].dot2(x - 1, y - 1);
|
|
101
|
-
const u = this._fade(x);
|
|
102
|
-
return this._lerp(this._lerp(n00, n10, u), this._lerp(n01, n11, u), this._fade(y));
|
|
103
|
-
}
|
|
104
|
-
noise3d(x, y, z) {
|
|
105
|
-
const {
|
|
106
|
-
_gradP: gradP,
|
|
107
|
-
_perm: perm
|
|
108
|
-
} = this;
|
|
109
|
-
let X = Math.floor(x),
|
|
110
|
-
Y = Math.floor(y),
|
|
111
|
-
Z = Math.floor(z);
|
|
112
|
-
x = x - X;
|
|
113
|
-
y = y - Y;
|
|
114
|
-
z = z - Z;
|
|
115
|
-
X = X & 255;
|
|
116
|
-
Y = Y & 255;
|
|
117
|
-
Z = Z & 255;
|
|
118
|
-
const n000 = gradP[X + perm[Y + perm[Z]]].dot3(x, y, z),
|
|
119
|
-
n001 = gradP[X + perm[Y + perm[Z + 1]]].dot3(x, y, z - 1),
|
|
120
|
-
n010 = gradP[X + perm[Y + 1 + perm[Z]]].dot3(x, y - 1, z),
|
|
121
|
-
n011 = gradP[X + perm[Y + 1 + perm[Z + 1]]].dot3(x, y - 1, z - 1),
|
|
122
|
-
n100 = gradP[X + 1 + perm[Y + perm[Z]]].dot3(x - 1, y, z),
|
|
123
|
-
n101 = gradP[X + 1 + perm[Y + perm[Z + 1]]].dot3(x - 1, y, z - 1),
|
|
124
|
-
n110 = gradP[X + 1 + perm[Y + 1 + perm[Z]]].dot3(x - 1, y - 1, z),
|
|
125
|
-
n111 = gradP[X + 1 + perm[Y + 1 + perm[Z + 1]]].dot3(x - 1, y - 1, z - 1),
|
|
126
|
-
u = this._fade(x),
|
|
127
|
-
v = this._fade(y),
|
|
128
|
-
w = this._fade(z);
|
|
129
|
-
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);
|
|
130
|
-
}
|
|
131
|
-
seed(inputSeed) {
|
|
132
|
-
const {
|
|
133
|
-
_grad3: grad3,
|
|
134
|
-
_gradP: gradP,
|
|
135
|
-
_perm: perm,
|
|
136
|
-
_p: p
|
|
137
|
-
} = this;
|
|
138
|
-
let seed = inputSeed;
|
|
139
|
-
if (seed > 0 && seed < 1) {
|
|
140
|
-
seed *= 65536;
|
|
141
|
-
}
|
|
142
|
-
seed = Math.floor(seed);
|
|
143
|
-
if (seed < 256) {
|
|
144
|
-
seed |= seed << 8;
|
|
145
|
-
}
|
|
146
|
-
for (let i = 0; i < 256; i++) {
|
|
147
|
-
const v = i & 1 ? p[i] ^ seed & 255 : p[i] ^ seed >> 8 & 255;
|
|
148
|
-
perm[i] = perm[i + 256] = v;
|
|
149
|
-
gradP[i] = gradP[i + 256] = grad3[v % 12];
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
_fade(t) {
|
|
153
|
-
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
154
|
-
}
|
|
155
|
-
_lerp(a, b, t) {
|
|
156
|
-
return (1 - t) * a + t * b;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
160
|
-
|
|
117
|
+
/******/
|
|
118
|
+
/******/ // startup
|
|
119
|
+
/******/ // Load entry module and return exports
|
|
120
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
121
|
+
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
122
|
+
/******/
|
|
161
123
|
/******/ return __webpack_exports__;
|
|
162
124
|
/******/ })()
|
|
163
125
|
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.perlin.noise.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(()=>(()=>{var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{PerlinNoise:()=>r});class o{constructor(e,t,o){this.x=e,this.y=t,this.z=o}dot2(e,t){return this.x*e+this.y*t}dot3(e,t,o){return this.dot2(e,t)+this.z*o}}class r{constructor(){this._grad3=[new o(1,1,0),new o(-1,1,0),new o(1,-1,0),new o(-1,-1,0),new o(1,0,1),new o(-1,0,1),new o(1,0,-1),new o(-1,0,-1),new o(0,1,1),new o(0,-1,1),new o(0,1,-1),new o(0,-1,-1)],this._p=[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._gradP=new Array(512),this._perm=new Array(512)}noise2d(e,t){const{_gradP:o,_perm:r}=this;let s=Math.floor(e),n=Math.floor(t);e-=s,t-=n,s&=255,n&=255;const i=o[s+r[n]].dot2(e,t),d=o[s+r[n+1]].dot2(e,t-1),l=o[s+1+r[n]].dot2(e-1,t),h=o[s+1+r[n+1]].dot2(e-1,t-1),a=this._fade(e);return this._lerp(this._lerp(i,l,a),this._lerp(d,h,a),this._fade(t))}noise3d(e,t,o){const{_gradP:r,_perm:s}=this;let n=Math.floor(e),i=Math.floor(t),d=Math.floor(o);e-=n,t-=i,o-=d,n&=255,i&=255,d&=255;const l=r[n+s[i+s[d]]].dot3(e,t,o),h=r[n+s[i+s[d+1]]].dot3(e,t,o-1),a=r[n+s[i+1+s[d]]].dot3(e,t-1,o),p=r[n+s[i+1+s[d+1]]].dot3(e,t-1,o-1),f=r[n+1+s[i+s[d]]].dot3(e-1,t,o),_=r[n+1+s[i+s[d+1]]].dot3(e-1,t,o-1),c=r[n+1+s[i+1+s[d]]].dot3(e-1,t-1,o),u=r[n+1+s[i+1+s[d+1]]].dot3(e-1,t-1,o-1),y=this._fade(e),w=this._fade(t),b=this._fade(o);return this._lerp(this._lerp(this._lerp(l,f,y),this._lerp(h,_,y),b),this._lerp(this._lerp(a,c,y),this._lerp(p,u,y),b),w)}seed(e){const{_grad3:t,_gradP:o,_perm:r,_p:s}=this;let n=e;n>0&&n<1&&(n*=65536),n=Math.floor(n),n<256&&(n|=n<<8);for(let e=0;e<256;e++){const i=1&e?s[e]^255&n:s[e]^n>>8&255;r[e]=r[e+256]=i,o[e]=o[e+256]=t[i%12]}}_fade(e){return e*e*e*(e*(6*e-15)+10)}_lerp(e,t,o){return(1-o)*e+o*t}}return t})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Perlin Noise v3.0
|
|
1
|
+
/*! tsParticles Perlin Noise v3.2.0 by Matteo Bruni */
|