@tsparticles/fractal-noise 4.0.0-beta.9 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,132 +1,55 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v4.0.0-beta.9
8
- */
9
- /*
10
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
11
- * This devtool is neither made for production nor for readable output files.
12
- * It uses "eval()" calls to create a separate source file in the browser devtools.
13
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
14
- * or disable the default devtool with "devtool: false".
15
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
16
- */
17
- (function webpackUniversalModuleDefinition(root, factory) {
18
- if(typeof exports === 'object' && typeof module === 'object')
19
- module.exports = factory(require("@tsparticles/smooth-value-noise"));
20
- else if(typeof define === 'function' && define.amd)
21
- define(["@tsparticles/smooth-value-noise"], factory);
22
- else {
23
- var a = typeof exports === 'object' ? factory(require("@tsparticles/smooth-value-noise")) : factory(root["window"]);
24
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
25
- }
26
- })(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_smooth_value_noise__) => {
27
- return /******/ (() => { // webpackBootstrap
28
- /******/ "use strict";
29
- /******/ var __webpack_modules__ = ({
30
-
31
- /***/ "@tsparticles/smooth-value-noise"
32
- /*!*********************************************************************************************************************************************************************!*\
33
- !*** external {"commonjs":"@tsparticles/smooth-value-noise","commonjs2":"@tsparticles/smooth-value-noise","amd":"@tsparticles/smooth-value-noise","root":"window"} ***!
34
- \*********************************************************************************************************************************************************************/
35
- (module) {
36
-
37
- module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_smooth_value_noise__;
38
-
39
- /***/ },
40
-
41
- /***/ "./dist/browser/FractalNoise.js"
42
- /*!**************************************!*\
43
- !*** ./dist/browser/FractalNoise.js ***!
44
- \**************************************/
45
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
-
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FractalNoise: () => (/* binding */ FractalNoise)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_smooth_value_noise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/smooth-value-noise */ \"@tsparticles/smooth-value-noise\");\n\nclass FractalNoise {\n _smoothValueNoise;\n constructor(){\n this._smoothValueNoise = new _tsparticles_smooth_value_noise__WEBPACK_IMPORTED_MODULE_0__.SmoothValueNoise();\n }\n noise2d(x, y, octaves = 5, persistence = 0.5, lacunarity = 2) {\n let total = 0, frequency = 1, amplitude = 1, maxValue = 0;\n for(let i = 0; i < octaves; i++){\n total += this._smoothValueNoise.noise2d(x * frequency, y * frequency) * amplitude;\n maxValue += amplitude;\n amplitude *= persistence;\n frequency *= lacunarity;\n }\n return total / maxValue;\n }\n noise3d(x, y, z, octaves = 5, persistence = 0.5, lacunarity = 2) {\n let total = 0, frequency = 1, amplitude = 1, maxValue = 0;\n for(let i = 0; i < octaves; i++){\n total += this._smoothValueNoise.noise3d(x * frequency, y * frequency, z * frequency) * amplitude;\n maxValue += amplitude;\n amplitude *= persistence;\n frequency *= lacunarity;\n }\n return total / maxValue;\n }\n noise4d(x, y, z, w, octaves = 5, persistence = 0.5, lacunarity = 2) {\n let total = 0, frequency = 1, amplitude = 1, maxValue = 0;\n for(let i = 0; i < octaves; i++){\n total += this._smoothValueNoise.noise4d(x * frequency, y * frequency, z * frequency, w * frequency) * amplitude;\n maxValue += amplitude;\n amplitude *= persistence;\n frequency *= lacunarity;\n }\n return total / maxValue;\n }\n seed(seed) {\n this._smoothValueNoise.seed(seed);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/fractal-noise/./dist/browser/FractalNoise.js?\n}");
48
-
49
- /***/ },
50
-
51
- /***/ "./dist/browser/index.js"
52
- /*!*******************************!*\
53
- !*** ./dist/browser/index.js ***!
54
- \*******************************/
55
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
56
-
57
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FractalNoise: () => (/* reexport safe */ _FractalNoise_js__WEBPACK_IMPORTED_MODULE_0__.FractalNoise)\n/* harmony export */ });\n/* harmony import */ var _FractalNoise_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FractalNoise.js */ \"./dist/browser/FractalNoise.js\");\n\n\n\n//# sourceURL=webpack://@tsparticles/fractal-noise/./dist/browser/index.js?\n}");
58
-
59
- /***/ }
60
-
61
- /******/ });
62
- /************************************************************************/
63
- /******/ // The module cache
64
- /******/ var __webpack_module_cache__ = {};
65
- /******/
66
- /******/ // The require function
67
- /******/ function __webpack_require__(moduleId) {
68
- /******/ // Check if module is in cache
69
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
70
- /******/ if (cachedModule !== undefined) {
71
- /******/ return cachedModule.exports;
72
- /******/ }
73
- /******/ // Create a new module (and put it into the cache)
74
- /******/ var module = __webpack_module_cache__[moduleId] = {
75
- /******/ // no module.id needed
76
- /******/ // no module.loaded needed
77
- /******/ exports: {}
78
- /******/ };
79
- /******/
80
- /******/ // Execute the module function
81
- /******/ if (!(moduleId in __webpack_modules__)) {
82
- /******/ delete __webpack_module_cache__[moduleId];
83
- /******/ var e = new Error("Cannot find module '" + moduleId + "'");
84
- /******/ e.code = 'MODULE_NOT_FOUND';
85
- /******/ throw e;
86
- /******/ }
87
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
88
- /******/
89
- /******/ // Return the exports of the module
90
- /******/ return module.exports;
91
- /******/ }
92
- /******/
93
- /************************************************************************/
94
- /******/ /* webpack/runtime/define property getters */
95
- /******/ (() => {
96
- /******/ // define getter functions for harmony exports
97
- /******/ __webpack_require__.d = (exports, definition) => {
98
- /******/ for(var key in definition) {
99
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
100
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
101
- /******/ }
102
- /******/ }
103
- /******/ };
104
- /******/ })();
105
- /******/
106
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
107
- /******/ (() => {
108
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
109
- /******/ })();
110
- /******/
111
- /******/ /* webpack/runtime/make namespace object */
112
- /******/ (() => {
113
- /******/ // define __esModule on exports
114
- /******/ __webpack_require__.r = (exports) => {
115
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
116
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
117
- /******/ }
118
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
119
- /******/ };
120
- /******/ })();
121
- /******/
122
- /************************************************************************/
123
- /******/
124
- /******/ // startup
125
- /******/ // Load entry module and return exports
126
- /******/ // This entry module can't be inlined because the eval devtool is used.
127
- /******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
128
- /******/
129
- /******/ return __webpack_exports__;
130
- /******/ })()
131
- ;
132
- });
1
+ (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
+ /* Utility v4.0.1 */
3
+ (function (global, factory) {
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/smooth-value-noise')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/smooth-value-noise'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.fractal = global.__tsParticlesInternals.fractal || {}, global.__tsParticlesInternals.fractal.noise = global.__tsParticlesInternals.fractal.noise || {}), global.__tsParticlesInternals.smooth.value.noise));
7
+ })(this, (function (exports, smoothValueNoise) { 'use strict';
8
+
9
+ class FractalNoise {
10
+ _smoothValueNoise;
11
+ constructor() {
12
+ this._smoothValueNoise = new smoothValueNoise.SmoothValueNoise();
13
+ }
14
+ noise2d(x, y, octaves = 5, persistence = 0.5, lacunarity = 2) {
15
+ let total = 0, frequency = 1, amplitude = 1, maxValue = 0;
16
+ for (let i = 0; i < octaves; i++) {
17
+ total += this._smoothValueNoise.noise2d(x * frequency, y * frequency) * amplitude;
18
+ maxValue += amplitude;
19
+ amplitude *= persistence;
20
+ frequency *= lacunarity;
21
+ }
22
+ return total / maxValue;
23
+ }
24
+ noise3d(x, y, z, octaves = 5, persistence = 0.5, lacunarity = 2) {
25
+ let total = 0, frequency = 1, amplitude = 1, maxValue = 0;
26
+ for (let i = 0; i < octaves; i++) {
27
+ total += this._smoothValueNoise.noise3d(x * frequency, y * frequency, z * frequency) * amplitude;
28
+ maxValue += amplitude;
29
+ amplitude *= persistence;
30
+ frequency *= lacunarity;
31
+ }
32
+ return total / maxValue;
33
+ }
34
+ noise4d(x, y, z, w, octaves = 5, persistence = 0.5, lacunarity = 2) {
35
+ let total = 0, frequency = 1, amplitude = 1, maxValue = 0;
36
+ for (let i = 0; i < octaves; i++) {
37
+ total += this._smoothValueNoise.noise4d(x * frequency, y * frequency, z * frequency, w * frequency) * amplitude;
38
+ maxValue += amplitude;
39
+ amplitude *= persistence;
40
+ frequency *= lacunarity;
41
+ }
42
+ return total / maxValue;
43
+ }
44
+ seed(seed) {
45
+ this._smoothValueNoise.seed(seed);
46
+ }
47
+ }
48
+
49
+ const globalObject = globalThis;
50
+ globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
51
+
52
+ exports.FractalNoise = FractalNoise;
53
+
54
+ }));
55
+ delete (globalThis.window || globalThis).tsparticlesInternalExports;
@@ -1 +1 @@
1
- !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/smooth-value-noise"));else if("function"==typeof define&&define.amd)define(["@tsparticles/smooth-value-noise"],o);else{var t="object"==typeof exports?o(require("@tsparticles/smooth-value-noise")):o(e.window);for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(this,e=>(()=>{"use strict";var o={434(o){o.exports=e}},t={};function r(e){var s=t[e];if(void 0!==s)return s.exports;var i=t[e]={exports:{}};return o[e](i,i.exports,r),i.exports}r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};r.r(s),r.d(s,{FractalNoise:()=>n});var i=r(434);class n{_smoothValueNoise;constructor(){this._smoothValueNoise=new i.SmoothValueNoise}noise2d(e,o,t=5,r=.5,s=2){let i=0,n=1,l=1,a=0;for(let u=0;u<t;u++)i+=this._smoothValueNoise.noise2d(e*n,o*n)*l,a+=l,l*=r,n*=s;return i/a}noise3d(e,o,t,r=5,s=.5,i=2){let n=0,l=1,a=1,u=0;for(let p=0;p<r;p++)n+=this._smoothValueNoise.noise3d(e*l,o*l,t*l)*a,u+=a,a*=s,l*=i;return n/u}noise4d(e,o,t,r,s=5,i=.5,n=2){let l=0,a=1,u=1,p=0;for(let d=0;d<s;d++)l+=this._smoothValueNoise.noise4d(e*a,o*a,t*a,r*a)*u,p+=u,u*=i,a*=n;return l/p}seed(e){this._smoothValueNoise.seed(e)}}return s})());
1
+ !function(s){s.__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.bundles=s.__tsParticlesInternals.bundles||{},s.__tsParticlesInternals.effects=s.__tsParticlesInternals.effects||{},s.__tsParticlesInternals.engine=s.__tsParticlesInternals.engine||{},s.__tsParticlesInternals.interactions=s.__tsParticlesInternals.interactions||{},s.__tsParticlesInternals.palettes=s.__tsParticlesInternals.palettes||{},s.__tsParticlesInternals.paths=s.__tsParticlesInternals.paths||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins=s.__tsParticlesInternals.plugins||{},s.__tsParticlesInternals.plugins.emittersShapes=s.__tsParticlesInternals.plugins.emittersShapes||{},s.__tsParticlesInternals.presets=s.__tsParticlesInternals.presets||{},s.__tsParticlesInternals.shapes=s.__tsParticlesInternals.shapes||{},s.__tsParticlesInternals.updaters=s.__tsParticlesInternals.updaters||{},s.__tsParticlesInternals.utils=s.__tsParticlesInternals.utils||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas=s.__tsParticlesInternals.canvas||{},s.__tsParticlesInternals.canvas.utils=s.__tsParticlesInternals.canvas.utils||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path=s.__tsParticlesInternals.path||{},s.__tsParticlesInternals.path.utils=s.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(s){return new Proxy(s,{get:function(s,t){return t in s||(s[t]={}),s[t]}})}:function(s){return s};s.__tsParticlesInternals.bundles=t(s.__tsParticlesInternals.bundles),s.__tsParticlesInternals.effects=t(s.__tsParticlesInternals.effects),s.__tsParticlesInternals.interactions=t(s.__tsParticlesInternals.interactions),s.__tsParticlesInternals.palettes=t(s.__tsParticlesInternals.palettes),s.__tsParticlesInternals.paths=t(s.__tsParticlesInternals.paths),s.__tsParticlesInternals.plugins=t(s.__tsParticlesInternals.plugins),s.__tsParticlesInternals.plugins.emittersShapes=t(s.__tsParticlesInternals.plugins.emittersShapes),s.__tsParticlesInternals.presets=t(s.__tsParticlesInternals.presets),s.__tsParticlesInternals.shapes=t(s.__tsParticlesInternals.shapes),s.__tsParticlesInternals.updaters=t(s.__tsParticlesInternals.updaters),s.__tsParticlesInternals.utils=t(s.__tsParticlesInternals.utils),s.__tsParticlesInternals.canvas=t(s.__tsParticlesInternals.canvas),s.__tsParticlesInternals.path=t(s.__tsParticlesInternals.path),s.tsparticlesInternalExports=s.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(s,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/smooth-value-noise")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/smooth-value-noise"],t):t(((s="undefined"!=typeof globalThis?globalThis:s||self).__tsParticlesInternals=s.__tsParticlesInternals||{},s.__tsParticlesInternals.fractal=s.__tsParticlesInternals.fractal||{},s.__tsParticlesInternals.fractal.noise=s.__tsParticlesInternals.fractal.noise||{}),s.__tsParticlesInternals.smooth.value.noise)}(this,function(s,t){"use strict";const e=globalThis;e.__tsParticlesInternals=e.__tsParticlesInternals??{},s.FractalNoise=class{_smoothValueNoise;constructor(){this._smoothValueNoise=new t.SmoothValueNoise}noise2d(s,t,e=5,n=.5,a=2){let l=0,r=1,i=1,_=0;for(let c=0;c<e;c++)l+=this._smoothValueNoise.noise2d(s*r,t*r)*i,_+=i,i*=n,r*=a;return l/_}noise3d(s,t,e,n=5,a=.5,l=2){let r=0,i=1,_=1,c=0;for(let o=0;o<n;o++)r+=this._smoothValueNoise.noise3d(s*i,t*i,e*i)*_,c+=_,_*=a,i*=l;return r/c}noise4d(s,t,e,n,a=5,l=.5,r=2){let i=0,_=1,c=1,o=0;for(let I=0;I<a;I++)i+=this._smoothValueNoise.noise4d(s*_,t*_,e*_,n*_)*c,o+=c,c*=l,_*=r;return i/o}seed(s){this._smoothValueNoise.seed(s)}}}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -0,0 +1 @@
1
+ export * from "./index.js";
@@ -0,0 +1 @@
1
+ export { FractalNoise } from "./FractalNoise.js";