@tsparticles/smooth-value-noise 3.9.1 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
*
|
|
7
|
+
* v4.0.0-alpha.1
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,25 +28,25 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/SmoothValueNoise.js"
|
|
31
|
+
/***/ "./dist/browser/SmoothValueNoise.js"
|
|
32
32
|
/*!******************************************!*\
|
|
33
33
|
!*** ./dist/browser/SmoothValueNoise.js ***!
|
|
34
34
|
\******************************************/
|
|
35
|
-
|
|
35
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
36
|
|
|
37
37
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SmoothValueNoise: () => (/* binding */ SmoothValueNoise)\n/* harmony export */ });\nconst lerp = (a, b, t) => {\n return a + t * (b - a);\n },\n smoothstep = t => {\n return t * t * (3 - 2 * t);\n },\n fract = x => {\n return x - Math.floor(x);\n };\nclass SmoothValueNoise {\n constructor() {\n this._coeffW = 29.537;\n this._coeffX = 127.1;\n this._coeffY = 311.7;\n this._coeffZ = 78.233;\n this._coeffZW = 37.719;\n this._scaleFactor = 43758.5453;\n }\n noise2d(x, y) {\n const x0 = Math.floor(x),\n y0 = Math.floor(y),\n x1 = x0 + 1,\n y1 = y0 + 1,\n sx = smoothstep(x - x0),\n sy = smoothstep(y - y0),\n n00 = this._valueNoise2D(x0, y0),\n n10 = this._valueNoise2D(x1, y0),\n n01 = this._valueNoise2D(x0, y1),\n n11 = this._valueNoise2D(x1, y1),\n ix0 = lerp(n00, n10, sx),\n ix1 = lerp(n01, n11, sx);\n return lerp(ix0, ix1, sy);\n }\n noise3d(x, y, z) {\n const x0 = Math.floor(x),\n y0 = Math.floor(y),\n z0 = Math.floor(z),\n x1 = x0 + 1,\n y1 = y0 + 1,\n z1 = z0 + 1,\n sx = smoothstep(x - x0),\n sy = smoothstep(y - y0),\n sz = smoothstep(z - z0),\n n000 = this._valueNoise3D(x0, y0, z0),\n n100 = this._valueNoise3D(x1, y0, z0),\n n010 = this._valueNoise3D(x0, y1, z0),\n n110 = this._valueNoise3D(x1, y1, z0),\n n001 = this._valueNoise3D(x0, y0, z1),\n n101 = this._valueNoise3D(x1, y0, z1),\n n011 = this._valueNoise3D(x0, y1, z1),\n n111 = this._valueNoise3D(x1, y1, z1),\n ix00 = lerp(n000, n100, sx),\n ix10 = lerp(n010, n110, sx),\n ix01 = lerp(n001, n101, sx),\n ix11 = lerp(n011, n111, sx),\n iy0 = lerp(ix00, ix10, sy),\n iy1 = lerp(ix01, ix11, sy);\n return lerp(iy0, iy1, sz);\n }\n noise4d(x, y, z, w) {\n const x0 = Math.floor(x),\n y0 = Math.floor(y),\n z0 = Math.floor(z),\n w0 = Math.floor(w),\n x1 = x0 + 1,\n y1 = y0 + 1,\n z1 = z0 + 1,\n w1 = w0 + 1,\n sx = smoothstep(x - x0),\n sy = smoothstep(y - y0),\n sz = smoothstep(z - z0),\n sw = smoothstep(w - w0),\n n0000 = this._valueNoise4D(x0, y0, z0, w0),\n n1000 = this._valueNoise4D(x1, y0, z0, w0),\n n0100 = this._valueNoise4D(x0, y1, z0, w0),\n n1100 = this._valueNoise4D(x1, y1, z0, w0),\n n0010 = this._valueNoise4D(x0, y0, z1, w0),\n n1010 = this._valueNoise4D(x1, y0, z1, w0),\n n0110 = this._valueNoise4D(x0, y1, z1, w0),\n n1110 = this._valueNoise4D(x1, y1, z1, w0),\n n0001 = this._valueNoise4D(x0, y0, z0, w1),\n n1001 = this._valueNoise4D(x1, y0, z0, w1),\n n0101 = this._valueNoise4D(x0, y1, z0, w1),\n n1101 = this._valueNoise4D(x1, y1, z0, w1),\n n0011 = this._valueNoise4D(x0, y0, z1, w1),\n n1011 = this._valueNoise4D(x1, y0, z1, w1),\n n0111 = this._valueNoise4D(x0, y1, z1, w1),\n n1111 = this._valueNoise4D(x1, y1, z1, w1),\n ix000 = lerp(n0000, n1000, sx),\n ix100 = lerp(n0100, n1100, sx),\n ix010 = lerp(n0010, n1010, sx),\n ix110 = lerp(n0110, n1110, sx),\n ix001 = lerp(n0001, n1001, sx),\n ix101 = lerp(n0101, n1101, sx),\n ix011 = lerp(n0011, n1011, sx),\n ix111 = lerp(n0111, n1111, sx),\n iy00 = lerp(ix000, ix100, sy),\n iy10 = lerp(ix010, ix110, sy),\n iy01 = lerp(ix001, ix101, sy),\n iy11 = lerp(ix011, ix111, sy),\n iz0 = lerp(iy00, iy10, sz),\n iz1 = lerp(iy01, iy11, sz);\n return lerp(iz0, iz1, sw);\n }\n seed(seed) {\n const s = Math.sin(seed) * 10000;\n this._coeffX = fract(s * 15731);\n this._coeffY = fract(s * 789221);\n this._coeffZ = fract(s * 1376312589);\n this._coeffZW = fract(s * 974634777);\n this._coeffW = fract(s * 592558533);\n this._scaleFactor = 43758.5453;\n }\n _valueNoise2D(x, y) {\n const n = Math.sin(x * this._coeffX + y * this._coeffY) * this._scaleFactor;\n return (n - Math.floor(n)) * 2 - 1;\n }\n _valueNoise3D(x, y, z) {\n const n = Math.sin(x * this._coeffX + y * this._coeffY + z * this._coeffZ) * this._scaleFactor;\n return (n - Math.floor(n)) * 2 - 1;\n }\n _valueNoise4D(x, y, z, w) {\n const n = Math.sin(x * this._coeffX + y * this._coeffY + z * this._coeffZW + w * this._coeffW) * this._scaleFactor;\n return (n - Math.floor(n)) * 2 - 1;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/smooth-value-noise/./dist/browser/SmoothValueNoise.js?\n}");
|
|
38
38
|
|
|
39
|
-
/***/ }
|
|
39
|
+
/***/ },
|
|
40
40
|
|
|
41
|
-
/***/ "./dist/browser/index.js"
|
|
41
|
+
/***/ "./dist/browser/index.js"
|
|
42
42
|
/*!*******************************!*\
|
|
43
43
|
!*** ./dist/browser/index.js ***!
|
|
44
44
|
\*******************************/
|
|
45
|
-
|
|
45
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
46
|
|
|
47
47
|
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SmoothValueNoise: () => (/* reexport safe */ _SmoothValueNoise_js__WEBPACK_IMPORTED_MODULE_0__.SmoothValueNoise)\n/* harmony export */ });\n/* harmony import */ var _SmoothValueNoise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SmoothValueNoise.js */ \"./dist/browser/SmoothValueNoise.js\");\n\n\n//# sourceURL=webpack://@tsparticles/smooth-value-noise/./dist/browser/index.js?\n}");
|
|
48
48
|
|
|
49
|
-
/***/ }
|
|
49
|
+
/***/ }
|
|
50
50
|
|
|
51
51
|
/******/ });
|
|
52
52
|
/************************************************************************/
|
|
@@ -60,6 +60,12 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
60
60
|
/******/ if (cachedModule !== undefined) {
|
|
61
61
|
/******/ return cachedModule.exports;
|
|
62
62
|
/******/ }
|
|
63
|
+
/******/ // Check if module exists (development only)
|
|
64
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
65
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
66
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
67
|
+
/******/ throw e;
|
|
68
|
+
/******/ }
|
|
63
69
|
/******/ // Create a new module (and put it into the cache)
|
|
64
70
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
65
71
|
/******/ // no module.id needed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Smooth Value Noise
|
|
1
|
+
/*! tsParticles Smooth Value Noise v4.0.0-alpha.1 by Matteo Bruni */
|