@tsparticles/updater-gradient 3.1.0 → 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/103.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 103.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_updater_gradient=this.webpackChunk_tsparticles_updater_gradient||[]).push([[103],{103:(t,a,n)=>{n.d(a,{updateGradient:()=>i});var e=n(533);function i(t,a){const{gradient:n}=t;if(n){(0,e.updateAnimation)(t,n.angle,!1,"none",a);for(const i of n.colors)(0,e.updateColor)(i.value,a),i.opacity&&(0,e.updateAnimation)(t,i.opacity,!0,"none",a)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Gradient Updater v3.2.0 by Matteo Bruni */
package/914.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 914.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_updater_gradient=this.webpackChunk_tsparticles_updater_gradient||[]).push([[914],{914:(e,a,t)=>{t.d(a,{GradientUpdater:()=>u});var i=t(533);class n{constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1,this.startValue="random"}load(e){e&&(void 0!==e.count&&(this.count=(0,i.setRangeValue)(e.count)),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.speed&&(this.speed=(0,i.setRangeValue)(e.speed)),void 0!==e.sync&&(this.sync=e.sync),void 0!==e.startValue&&(this.startValue=e.startValue),void 0!==e.decay&&(this.decay=(0,i.setRangeValue)(e.decay)),void 0!==e.delay&&(this.delay=(0,i.setRangeValue)(e.delay)))}}class s{constructor(){this.value=0,this.animation=new n}load(e){e&&(this.animation.load(e.animation),void 0!==e.value&&(this.value=(0,i.setRangeValue)(e.value)))}}class o{constructor(){this.stop=0,this.value=new i.AnimatableColor}load(e){e&&(void 0!==e.stop&&(this.stop=e.stop),this.value=i.AnimatableColor.create(this.value,e.value),void 0!==e.opacity&&(this.opacity=new s,(0,i.isNumber)(e.opacity)?this.opacity.value=e.opacity:this.opacity.load(e.opacity)))}}class l{constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1}load(e){e&&(void 0!==e.count&&(this.count=(0,i.setRangeValue)(e.count)),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.speed&&(this.speed=(0,i.setRangeValue)(e.speed)),void 0!==e.decay&&(this.decay=(0,i.setRangeValue)(e.decay)),void 0!==e.delay&&(this.delay=(0,i.setRangeValue)(e.delay)),void 0!==e.sync&&(this.sync=e.sync))}}class c{constructor(){this.value=0,this.animation=new l,this.direction="clockwise"}load(e){e&&(this.animation.load(e.animation),void 0!==e.value&&(this.value=(0,i.setRangeValue)(e.value)),void 0!==e.direction&&(this.direction=e.direction))}}class d{constructor(){this.angle=new c,this.colors=[],this.type="random"}load(e){e&&(this.angle.load(e.angle),void 0!==e.colors&&(this.colors=e.colors.map((e=>{const a=new o;return a.load(e),a}))),void 0!==e.type&&(this.type=e.type))}}const r=2*Math.PI;class u{getColorStyles(e,a,t,n){const s=e.gradient;if(!s)return{};const o=s.angle.value,l=0,c=0,d="radial"===s.type?a.createRadialGradient(l,c,0,l,c,t):a.createLinearGradient(Math.cos(o)*-t,Math.sin(o)*-t,Math.cos(o)*t,Math.sin(o)*t);for(const{stop:e,value:a,opacity:t}of s.colors)d.addColorStop(e,(0,i.getStyleFromHsl)({h:a.h.value,s:a.s.value,l:a.l.value},t?.value??n));return{fill:d}}async init(e){const a=(0,i.itemFromSingleOrMultiple)(e.options.gradient);if(!a)return;const{angle:t}=a;e.gradient={angle:{value:(0,i.getRangeValue)(t.value),enable:t.animation.enable,velocity:(0,i.getRangeValue)(t.animation.speed)/360*e.container.retina.reduceFactor,decay:1-(0,i.getRangeValue)(t.animation.decay),delayTime:(0,i.getRangeValue)(t.animation.delay)*i.millisecondsToSeconds,max:r,min:0,time:0},type:a.type,colors:[]};let n=a.angle.direction;switch("random"===n&&(n=(0,i.getRandom)()>i.halfRandom?"counter-clockwise":"clockwise"),n){case"counter-clockwise":case"counterClockwise":e.gradient.angle.status="decreasing";break;case"clockwise":e.gradient.angle.status="increasing"}const s=e.options.reduceDuplicates;for(const t of a.colors){const a=(0,i.rangeColorToHsl)(t.value,e.id,s);if(!a)continue;const n=(0,i.getHslAnimationFromHsl)(a,t.value.animation,e.container.retina.reduceFactor),o={stop:t.stop,value:n,opacity:t.opacity?{enable:t.opacity.animation.enable,max:(0,i.getRangeMax)(t.opacity.value),min:(0,i.getRangeMin)(t.opacity.value),status:"increasing",value:(0,i.getRangeValue)(t.opacity.value),velocity:(0,i.getRangeValue)(t.opacity.animation.speed)/i.percentDenominator*e.container.retina.reduceFactor,decay:1-(0,i.getRangeValue)(t.opacity.animation.decay),delayTime:(0,i.getRangeValue)(t.opacity.animation.delay)*i.millisecondsToSeconds,time:0}:void 0},{opacity:l}=o;if(t.opacity&&l){const e=t.opacity.value;l.min=(0,i.getRangeMin)(e),l.max=(0,i.getRangeMax)(e);switch(t.opacity.animation.startValue){case"min":l.value=l.min,l.status="increasing";break;case"max":l.value=l.max,l.status="decreasing";break;default:l.value=(0,i.randomInRange)(l),l.status=(0,i.getRandom)()>=i.halfRandom?"increasing":"decreasing"}}e.gradient.colors.push(o)}await Promise.resolve()}isEnabled(e){return!e.destroyed&&!e.spawning&&(!!e.gradient?.angle.enable||(e.gradient?.colors.some((e=>e.value.h.enable||e.value.s.enable||e.value.l.enable))??!1))}loadOptions(e,...a){for(const t of a){if(!t?.gradient)continue;const a=t.gradient;a&&(e.gradient=(0,i.executeOnSingleOrMultiple)(a,(e=>{const a=new d;return a.load(e),a})))}}async update(e,a){const{updateGradient:i}=await t.e(103).then(t.bind(t,103));i(e,a)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Gradient Updater v3.2.0 by Matteo Bruni */
@@ -1,6 +1,5 @@
1
1
  import { executeOnSingleOrMultiple, getHslAnimationFromHsl, getRandom, getRangeMax, getRangeMin, getRangeValue, getStyleFromHsl, halfRandom, itemFromSingleOrMultiple, millisecondsToSeconds, percentDenominator, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
2
2
  import { AnimatableGradient } from "./Options/Classes/AnimatableGradient.js";
3
- import { updateGradient } from "./Utils.js";
4
3
  const double = 2, doublePI = Math.PI * double;
5
4
  export class GradientUpdater {
6
5
  getColorStyles(particle, context, radius, opacity) {
@@ -20,7 +19,7 @@ export class GradientUpdater {
20
19
  }
21
20
  return { fill: fillGradient };
22
21
  }
23
- init(particle) {
22
+ async init(particle) {
24
23
  const gradient = itemFromSingleOrMultiple(particle.options.gradient);
25
24
  if (!gradient) {
26
25
  return;
@@ -102,6 +101,7 @@ export class GradientUpdater {
102
101
  }
103
102
  particle.gradient.colors.push(addColor);
104
103
  }
104
+ await Promise.resolve();
105
105
  }
106
106
  isEnabled(particle) {
107
107
  return (!particle.destroyed &&
@@ -126,7 +126,8 @@ export class GradientUpdater {
126
126
  });
127
127
  }
128
128
  }
129
- update(particle, delta) {
129
+ async update(particle, delta) {
130
+ const { updateGradient } = await import("./Utils.js");
130
131
  updateGradient(particle, delta);
131
132
  }
132
133
  }
package/browser/index.js CHANGED
@@ -1,4 +1,6 @@
1
- import { GradientUpdater } from "./GradientUpdater.js";
2
1
  export async function loadGradientUpdater(engine, refresh = true) {
3
- await engine.addParticleUpdater("gradient", () => new GradientUpdater(), refresh);
2
+ await engine.addParticleUpdater("gradient", async () => {
3
+ const { GradientUpdater } = await import("./GradientUpdater.js");
4
+ return new GradientUpdater();
5
+ }, refresh);
4
6
  }
@@ -1,9 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.GradientUpdater = void 0;
4
27
  const engine_1 = require("@tsparticles/engine");
5
28
  const AnimatableGradient_js_1 = require("./Options/Classes/AnimatableGradient.js");
6
- const Utils_js_1 = require("./Utils.js");
7
29
  const double = 2, doublePI = Math.PI * double;
8
30
  class GradientUpdater {
9
31
  getColorStyles(particle, context, radius, opacity) {
@@ -23,7 +45,7 @@ class GradientUpdater {
23
45
  }
24
46
  return { fill: fillGradient };
25
47
  }
26
- init(particle) {
48
+ async init(particle) {
27
49
  const gradient = (0, engine_1.itemFromSingleOrMultiple)(particle.options.gradient);
28
50
  if (!gradient) {
29
51
  return;
@@ -105,6 +127,7 @@ class GradientUpdater {
105
127
  }
106
128
  particle.gradient.colors.push(addColor);
107
129
  }
130
+ await Promise.resolve();
108
131
  }
109
132
  isEnabled(particle) {
110
133
  return (!particle.destroyed &&
@@ -129,8 +152,9 @@ class GradientUpdater {
129
152
  });
130
153
  }
131
154
  }
132
- update(particle, delta) {
133
- (0, Utils_js_1.updateGradient)(particle, delta);
155
+ async update(particle, delta) {
156
+ const { updateGradient } = await Promise.resolve().then(() => __importStar(require("./Utils.js")));
157
+ updateGradient(particle, delta);
134
158
  }
135
159
  }
136
160
  exports.GradientUpdater = GradientUpdater;
package/cjs/index.js CHANGED
@@ -1,8 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.loadGradientUpdater = void 0;
4
- const GradientUpdater_js_1 = require("./GradientUpdater.js");
5
27
  async function loadGradientUpdater(engine, refresh = true) {
6
- await engine.addParticleUpdater("gradient", () => new GradientUpdater_js_1.GradientUpdater(), refresh);
28
+ await engine.addParticleUpdater("gradient", async () => {
29
+ const { GradientUpdater } = await Promise.resolve().then(() => __importStar(require("./GradientUpdater.js")));
30
+ return new GradientUpdater();
31
+ }, refresh);
7
32
  }
8
33
  exports.loadGradientUpdater = loadGradientUpdater;
@@ -0,0 +1,90 @@
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
+ * v3.2.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_updater_gradient"] = this["webpackChunk_tsparticles_updater_gradient"] || []).push([["dist_browser_GradientUpdater_js"],{
19
+
20
+ /***/ "./dist/browser/GradientUpdater.js":
21
+ /*!*****************************************!*\
22
+ !*** ./dist/browser/GradientUpdater.js ***!
23
+ \*****************************************/
24
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
+
26
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GradientUpdater: () => (/* binding */ GradientUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_AnimatableGradient_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/AnimatableGradient.js */ \"./dist/browser/Options/Classes/AnimatableGradient.js\");\n\n\nconst double = 2,\n doublePI = Math.PI * double;\nclass GradientUpdater {\n getColorStyles(particle, context, radius, opacity) {\n const gradient = particle.gradient;\n if (!gradient) {\n return {};\n }\n const gradientAngle = gradient.angle.value,\n origin = {\n x: 0,\n y: 0\n },\n minRadius = 0,\n fillGradient = gradient.type === \"radial\" ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius) : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);\n for (const {\n stop,\n value,\n opacity: cOpacity\n } of gradient.colors) {\n fillGradient.addColorStop(stop, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)({\n h: value.h.value,\n s: value.s.value,\n l: value.l.value\n }, cOpacity?.value ?? opacity));\n }\n return {\n fill: fillGradient\n };\n }\n async init(particle) {\n const gradient = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(particle.options.gradient);\n if (!gradient) {\n return;\n }\n const {\n angle\n } = gradient,\n speedFactor = 360,\n delayOffset = 1;\n particle.gradient = {\n angle: {\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(angle.value),\n enable: angle.animation.enable,\n velocity: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(angle.animation.speed) / speedFactor * particle.container.retina.reduceFactor,\n decay: delayOffset - (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(angle.animation.decay),\n delayTime: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(angle.animation.delay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds,\n max: doublePI,\n min: 0,\n time: 0\n },\n type: gradient.type,\n colors: []\n };\n let rotateDirection = gradient.angle.direction;\n if (rotateDirection === \"random\") {\n rotateDirection = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() > _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? \"counter-clockwise\" : \"clockwise\";\n }\n switch (rotateDirection) {\n case \"counter-clockwise\":\n case \"counterClockwise\":\n particle.gradient.angle.status = \"decreasing\";\n break;\n case \"clockwise\":\n particle.gradient.angle.status = \"increasing\";\n break;\n }\n const reduceDuplicates = particle.options.reduceDuplicates;\n for (const grColor of gradient.colors) {\n const grHslColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(grColor.value, particle.id, reduceDuplicates);\n if (!grHslColor) {\n continue;\n }\n const grHslAnimation = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getHslAnimationFromHsl)(grHslColor, grColor.value.animation, particle.container.retina.reduceFactor),\n addColor = {\n stop: grColor.stop,\n value: grHslAnimation,\n opacity: grColor.opacity ? {\n enable: grColor.opacity.animation.enable,\n max: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(grColor.opacity.value),\n min: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMin)(grColor.opacity.value),\n status: \"increasing\",\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(grColor.opacity.value),\n velocity: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(grColor.opacity.animation.speed) / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator * particle.container.retina.reduceFactor,\n decay: delayOffset - (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(grColor.opacity.animation.decay),\n delayTime: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(grColor.opacity.animation.delay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds,\n time: 0\n } : undefined\n };\n const {\n opacity: addOpacity\n } = addColor;\n if (grColor.opacity && addOpacity) {\n const opacityRange = grColor.opacity.value;\n addOpacity.min = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMin)(opacityRange);\n addOpacity.max = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(opacityRange);\n const opacityAnimation = grColor.opacity.animation;\n switch (opacityAnimation.startValue) {\n case \"min\":\n addOpacity.value = addOpacity.min;\n addOpacity.status = \"increasing\";\n break;\n case \"max\":\n addOpacity.value = addOpacity.max;\n addOpacity.status = \"decreasing\";\n break;\n case \"random\":\n default:\n addOpacity.value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(addOpacity);\n addOpacity.status = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? \"increasing\" : \"decreasing\";\n break;\n }\n }\n particle.gradient.colors.push(addColor);\n }\n await Promise.resolve();\n }\n isEnabled(particle) {\n return !particle.destroyed && !particle.spawning && (!!particle.gradient?.angle.enable || (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ?? false));\n }\n loadOptions(options, ...sources) {\n for (const source of sources) {\n if (!source?.gradient) {\n continue;\n }\n const gradientToLoad = source.gradient;\n if (!gradientToLoad) {\n continue;\n }\n options.gradient = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(gradientToLoad, gradient => {\n const tmp = new _Options_Classes_AnimatableGradient_js__WEBPACK_IMPORTED_MODULE_1__.AnimatableGradient();\n tmp.load(gradient);\n return tmp;\n });\n }\n }\n async update(particle, delta) {\n const {\n updateGradient\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Utils_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Utils.js */ \"./dist/browser/Utils.js\"));\n updateGradient(particle, delta);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/GradientUpdater.js?");
27
+
28
+ /***/ }),
29
+
30
+ /***/ "./dist/browser/Options/Classes/AnimatableGradient.js":
31
+ /*!************************************************************!*\
32
+ !*** ./dist/browser/Options/Classes/AnimatableGradient.js ***!
33
+ \************************************************************/
34
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
+
36
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AnimatableGradient: () => (/* binding */ AnimatableGradient)\n/* harmony export */ });\n/* harmony import */ var _AnimatableGradientColor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AnimatableGradientColor.js */ \"./dist/browser/Options/Classes/AnimatableGradientColor.js\");\n/* harmony import */ var _GradientAngle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GradientAngle.js */ \"./dist/browser/Options/Classes/GradientAngle.js\");\n\n\nclass AnimatableGradient {\n constructor() {\n this.angle = new _GradientAngle_js__WEBPACK_IMPORTED_MODULE_0__.GradientAngle();\n this.colors = [];\n this.type = \"random\";\n }\n load(data) {\n if (!data) {\n return;\n }\n this.angle.load(data.angle);\n if (data.colors !== undefined) {\n this.colors = data.colors.map(s => {\n const tmp = new _AnimatableGradientColor_js__WEBPACK_IMPORTED_MODULE_1__.AnimatableGradientColor();\n tmp.load(s);\n return tmp;\n });\n }\n if (data.type !== undefined) {\n this.type = data.type;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/AnimatableGradient.js?");
37
+
38
+ /***/ }),
39
+
40
+ /***/ "./dist/browser/Options/Classes/AnimatableGradientColor.js":
41
+ /*!*****************************************************************!*\
42
+ !*** ./dist/browser/Options/Classes/AnimatableGradientColor.js ***!
43
+ \*****************************************************************/
44
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
45
+
46
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AnimatableGradientColor: () => (/* binding */ AnimatableGradientColor)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _GradientColorOpacity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GradientColorOpacity.js */ \"./dist/browser/Options/Classes/GradientColorOpacity.js\");\n\n\nclass AnimatableGradientColor {\n constructor() {\n this.stop = 0;\n this.value = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.stop !== undefined) {\n this.stop = data.stop;\n }\n this.value = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(this.value, data.value);\n if (data.opacity !== undefined) {\n this.opacity = new _GradientColorOpacity_js__WEBPACK_IMPORTED_MODULE_1__.GradientColorOpacity();\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(data.opacity)) {\n this.opacity.value = data.opacity;\n } else {\n this.opacity.load(data.opacity);\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/AnimatableGradientColor.js?");
47
+
48
+ /***/ }),
49
+
50
+ /***/ "./dist/browser/Options/Classes/GradientAngle.js":
51
+ /*!*******************************************************!*\
52
+ !*** ./dist/browser/Options/Classes/GradientAngle.js ***!
53
+ \*******************************************************/
54
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
55
+
56
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GradientAngle: () => (/* binding */ GradientAngle)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _GradientAngleAnimation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GradientAngleAnimation.js */ \"./dist/browser/Options/Classes/GradientAngleAnimation.js\");\n\n\nclass GradientAngle {\n constructor() {\n this.value = 0;\n this.animation = new _GradientAngleAnimation_js__WEBPACK_IMPORTED_MODULE_1__.GradientAngleAnimation();\n this.direction = \"clockwise\";\n }\n load(data) {\n if (!data) {\n return;\n }\n this.animation.load(data.animation);\n if (data.value !== undefined) {\n this.value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.value);\n }\n if (data.direction !== undefined) {\n this.direction = data.direction;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientAngle.js?");
57
+
58
+ /***/ }),
59
+
60
+ /***/ "./dist/browser/Options/Classes/GradientAngleAnimation.js":
61
+ /*!****************************************************************!*\
62
+ !*** ./dist/browser/Options/Classes/GradientAngleAnimation.js ***!
63
+ \****************************************************************/
64
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
65
+
66
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GradientAngleAnimation: () => (/* binding */ GradientAngleAnimation)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass GradientAngleAnimation {\n constructor() {\n this.count = 0;\n this.enable = false;\n this.speed = 0;\n this.decay = 0;\n this.delay = 0;\n this.sync = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.count !== undefined) {\n this.count = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.count);\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.speed !== undefined) {\n this.speed = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.speed);\n }\n if (data.decay !== undefined) {\n this.decay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.decay);\n }\n if (data.delay !== undefined) {\n this.delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.delay);\n }\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientAngleAnimation.js?");
67
+
68
+ /***/ }),
69
+
70
+ /***/ "./dist/browser/Options/Classes/GradientColorOpacity.js":
71
+ /*!**************************************************************!*\
72
+ !*** ./dist/browser/Options/Classes/GradientColorOpacity.js ***!
73
+ \**************************************************************/
74
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
75
+
76
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GradientColorOpacity: () => (/* binding */ GradientColorOpacity)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _GradientColorOpacityAnimation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GradientColorOpacityAnimation.js */ \"./dist/browser/Options/Classes/GradientColorOpacityAnimation.js\");\n\n\nclass GradientColorOpacity {\n constructor() {\n this.value = 0;\n this.animation = new _GradientColorOpacityAnimation_js__WEBPACK_IMPORTED_MODULE_1__.GradientColorOpacityAnimation();\n }\n load(data) {\n if (!data) {\n return;\n }\n this.animation.load(data.animation);\n if (data.value !== undefined) {\n this.value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.value);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientColorOpacity.js?");
77
+
78
+ /***/ }),
79
+
80
+ /***/ "./dist/browser/Options/Classes/GradientColorOpacityAnimation.js":
81
+ /*!***********************************************************************!*\
82
+ !*** ./dist/browser/Options/Classes/GradientColorOpacityAnimation.js ***!
83
+ \***********************************************************************/
84
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
85
+
86
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ GradientColorOpacityAnimation: () => (/* binding */ GradientColorOpacityAnimation)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass GradientColorOpacityAnimation {\n constructor() {\n this.count = 0;\n this.enable = false;\n this.speed = 0;\n this.decay = 0;\n this.delay = 0;\n this.sync = false;\n this.startValue = \"random\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.count !== undefined) {\n this.count = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.count);\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.speed !== undefined) {\n this.speed = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.speed);\n }\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n if (data.startValue !== undefined) {\n this.startValue = data.startValue;\n }\n if (data.decay !== undefined) {\n this.decay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.decay);\n }\n if (data.delay !== undefined) {\n this.delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.delay);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientColorOpacityAnimation.js?");
87
+
88
+ /***/ })
89
+
90
+ }]);
@@ -0,0 +1,30 @@
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
+ * v3.2.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_updater_gradient"] = this["webpackChunk_tsparticles_updater_gradient"] || []).push([["dist_browser_Utils_js"],{
19
+
20
+ /***/ "./dist/browser/Utils.js":
21
+ /*!*******************************!*\
22
+ !*** ./dist/browser/Utils.js ***!
23
+ \*******************************/
24
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
+
26
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ updateGradient: () => (/* binding */ updateGradient)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction updateGradient(particle, delta) {\n const {\n gradient\n } = particle;\n if (!gradient) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, gradient.angle, false, \"none\", delta);\n for (const color of gradient.colors) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateColor)(color.value, delta);\n if (color.opacity) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, color.opacity, true, \"none\", delta);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Utils.js?");
27
+
28
+ /***/ })
29
+
30
+ }]);
@@ -1,6 +1,5 @@
1
1
  import { executeOnSingleOrMultiple, getHslAnimationFromHsl, getRandom, getRangeMax, getRangeMin, getRangeValue, getStyleFromHsl, halfRandom, itemFromSingleOrMultiple, millisecondsToSeconds, percentDenominator, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
2
2
  import { AnimatableGradient } from "./Options/Classes/AnimatableGradient.js";
3
- import { updateGradient } from "./Utils.js";
4
3
  const double = 2, doublePI = Math.PI * double;
5
4
  export class GradientUpdater {
6
5
  getColorStyles(particle, context, radius, opacity) {
@@ -20,7 +19,7 @@ export class GradientUpdater {
20
19
  }
21
20
  return { fill: fillGradient };
22
21
  }
23
- init(particle) {
22
+ async init(particle) {
24
23
  const gradient = itemFromSingleOrMultiple(particle.options.gradient);
25
24
  if (!gradient) {
26
25
  return;
@@ -102,6 +101,7 @@ export class GradientUpdater {
102
101
  }
103
102
  particle.gradient.colors.push(addColor);
104
103
  }
104
+ await Promise.resolve();
105
105
  }
106
106
  isEnabled(particle) {
107
107
  return (!particle.destroyed &&
@@ -126,7 +126,8 @@ export class GradientUpdater {
126
126
  });
127
127
  }
128
128
  }
129
- update(particle, delta) {
129
+ async update(particle, delta) {
130
+ const { updateGradient } = await import("./Utils.js");
130
131
  updateGradient(particle, delta);
131
132
  }
132
133
  }
package/esm/index.js CHANGED
@@ -1,4 +1,6 @@
1
- import { GradientUpdater } from "./GradientUpdater.js";
2
1
  export async function loadGradientUpdater(engine, refresh = true) {
3
- await engine.addParticleUpdater("gradient", () => new GradientUpdater(), refresh);
2
+ await engine.addParticleUpdater("gradient", async () => {
3
+ const { GradientUpdater } = await import("./GradientUpdater.js");
4
+ return new GradientUpdater();
5
+ }, refresh);
4
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-gradient",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "tsParticles particles gradient updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -101,7 +101,7 @@
101
101
  "./package.json": "./package.json"
102
102
  },
103
103
  "dependencies": {
104
- "@tsparticles/engine": "^3.1.0"
104
+ "@tsparticles/engine": "^3.2.0"
105
105
  },
106
106
  "publishConfig": {
107
107
  "access": "public"
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/updater-gradient [13 Jan 2024 at 23:08]</title>
6
+ <title>@tsparticles/updater-gradient [31 Jan 2024 at 02:10]</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 = [{"label":"tsparticles.updater.gradient.js","isAsset":true,"statSize":10014,"parsedSize":14255,"gzipSize":3280,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":9972,"groups":[{"id":453,"label":"index.js + 8 modules (concatenated)","path":"./dist/browser/index.js + 8 modules (concatenated)","statSize":9972,"parsedSize":14255,"gzipSize":3280,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser","statSize":9972,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/index.js","statSize":210,"parsedSize":300,"gzipSize":69,"inaccurateSizes":true},{"id":null,"label":"GradientUpdater.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/GradientUpdater.js","statSize":5299,"parsedSize":7574,"gzipSize":1742,"inaccurateSizes":true},{"label":"Options/Classes","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes","statSize":4021,"groups":[{"id":null,"label":"AnimatableGradient.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes/AnimatableGradient.js","statSize":614,"parsedSize":877,"gzipSize":201,"inaccurateSizes":true},{"id":null,"label":"GradientAngle.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes/GradientAngle.js","statSize":550,"parsedSize":786,"gzipSize":180,"inaccurateSizes":true},{"id":null,"label":"AnimatableGradientColor.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes/AnimatableGradientColor.js","statSize":679,"parsedSize":970,"gzipSize":223,"inaccurateSizes":true},{"id":null,"label":"GradientAngleAnimation.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes/GradientAngleAnimation.js","statSize":796,"parsedSize":1137,"gzipSize":261,"inaccurateSizes":true},{"id":null,"label":"GradientColorOpacity.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes/GradientColorOpacity.js","statSize":459,"parsedSize":656,"gzipSize":150,"inaccurateSizes":true},{"id":null,"label":"GradientColorOpacityAnimation.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Options/Classes/GradientColorOpacityAnimation.js","statSize":923,"parsedSize":1319,"gzipSize":303,"inaccurateSizes":true}],"parsedSize":5748,"gzipSize":1322,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 8 modules (concatenated)/dist/browser/Utils.js","statSize":442,"parsedSize":631,"gzipSize":145,"inaccurateSizes":true}],"parsedSize":14255,"gzipSize":3280,"inaccurateSizes":true}]}],"parsedSize":14255,"gzipSize":3280},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.updater.gradient":true}}];
35
- window.entrypoints = ["tsparticles.updater.gradient","tsparticles.updater.gradient.min"];
34
+ window.chartData = [];
35
+ window.entrypoints = ["tsparticles.updater.gradient.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.1.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')
@@ -15,15 +23,28 @@
15
23
  var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
16
24
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
25
  }
18
- })(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
26
+ })(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
19
27
  return /******/ (() => { // webpackBootstrap
20
28
  /******/ "use strict";
21
29
  /******/ var __webpack_modules__ = ({
22
30
 
23
- /***/ 533:
31
+ /***/ "./dist/browser/index.js":
32
+ /*!*******************************!*\
33
+ !*** ./dist/browser/index.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 */ loadGradientUpdater: () => (/* binding */ loadGradientUpdater)\n/* harmony export */ });\nasync function loadGradientUpdater(engine, refresh = true) {\n await engine.addParticleUpdater(\"gradient\", async () => {\n const {\n GradientUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_GradientUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./GradientUpdater.js */ \"./dist/browser/GradientUpdater.js\"));\n return new GradientUpdater();\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/index.js?");
38
+
39
+ /***/ }),
40
+
41
+ /***/ "@tsparticles/engine":
42
+ /*!*********************************************************************************************************************************!*\
43
+ !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
44
+ \*********************************************************************************************************************************/
24
45
  /***/ ((module) => {
25
46
 
26
- module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
47
+ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
27
48
 
28
49
  /***/ })
29
50
 
@@ -53,7 +74,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
53
74
  /******/ return module.exports;
54
75
  /******/ }
55
76
  /******/
77
+ /******/ // expose the modules object (__webpack_modules__)
78
+ /******/ __webpack_require__.m = __webpack_modules__;
79
+ /******/
56
80
  /************************************************************************/
81
+ /******/ /* webpack/runtime/compat get default export */
82
+ /******/ (() => {
83
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
84
+ /******/ __webpack_require__.n = (module) => {
85
+ /******/ var getter = module && module.__esModule ?
86
+ /******/ () => (module['default']) :
87
+ /******/ () => (module);
88
+ /******/ __webpack_require__.d(getter, { a: getter });
89
+ /******/ return getter;
90
+ /******/ };
91
+ /******/ })();
92
+ /******/
57
93
  /******/ /* webpack/runtime/define property getters */
58
94
  /******/ (() => {
59
95
  /******/ // define getter functions for harmony exports
@@ -66,11 +102,91 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
66
102
  /******/ };
67
103
  /******/ })();
68
104
  /******/
105
+ /******/ /* webpack/runtime/ensure chunk */
106
+ /******/ (() => {
107
+ /******/ __webpack_require__.f = {};
108
+ /******/ // This file contains only the entry chunk.
109
+ /******/ // The chunk loading function for additional chunks
110
+ /******/ __webpack_require__.e = (chunkId) => {
111
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
112
+ /******/ __webpack_require__.f[key](chunkId, promises);
113
+ /******/ return promises;
114
+ /******/ }, []));
115
+ /******/ };
116
+ /******/ })();
117
+ /******/
118
+ /******/ /* webpack/runtime/get javascript chunk filename */
119
+ /******/ (() => {
120
+ /******/ // This function allow to reference async chunks
121
+ /******/ __webpack_require__.u = (chunkId) => {
122
+ /******/ // return url for filenames based on template
123
+ /******/ return "" + chunkId + ".js";
124
+ /******/ };
125
+ /******/ })();
126
+ /******/
127
+ /******/ /* webpack/runtime/global */
128
+ /******/ (() => {
129
+ /******/ __webpack_require__.g = (function() {
130
+ /******/ if (typeof globalThis === 'object') return globalThis;
131
+ /******/ try {
132
+ /******/ return this || new Function('return this')();
133
+ /******/ } catch (e) {
134
+ /******/ if (typeof window === 'object') return window;
135
+ /******/ }
136
+ /******/ })();
137
+ /******/ })();
138
+ /******/
69
139
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
70
140
  /******/ (() => {
71
141
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
72
142
  /******/ })();
73
143
  /******/
144
+ /******/ /* webpack/runtime/load script */
145
+ /******/ (() => {
146
+ /******/ var inProgress = {};
147
+ /******/ var dataWebpackPrefix = "@tsparticles/updater-gradient:";
148
+ /******/ // loadScript function to load a script via script tag
149
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
150
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
151
+ /******/ var script, needAttach;
152
+ /******/ if(key !== undefined) {
153
+ /******/ var scripts = document.getElementsByTagName("script");
154
+ /******/ for(var i = 0; i < scripts.length; i++) {
155
+ /******/ var s = scripts[i];
156
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
157
+ /******/ }
158
+ /******/ }
159
+ /******/ if(!script) {
160
+ /******/ needAttach = true;
161
+ /******/ script = document.createElement('script');
162
+ /******/
163
+ /******/ script.charset = 'utf-8';
164
+ /******/ script.timeout = 120;
165
+ /******/ if (__webpack_require__.nc) {
166
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
167
+ /******/ }
168
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
169
+ /******/
170
+ /******/ script.src = url;
171
+ /******/ }
172
+ /******/ inProgress[url] = [done];
173
+ /******/ var onScriptComplete = (prev, event) => {
174
+ /******/ // avoid mem leaks in IE.
175
+ /******/ script.onerror = script.onload = null;
176
+ /******/ clearTimeout(timeout);
177
+ /******/ var doneFns = inProgress[url];
178
+ /******/ delete inProgress[url];
179
+ /******/ script.parentNode && script.parentNode.removeChild(script);
180
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
181
+ /******/ if(prev) return prev(event);
182
+ /******/ }
183
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
184
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
185
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
186
+ /******/ needAttach && document.head.appendChild(script);
187
+ /******/ };
188
+ /******/ })();
189
+ /******/
74
190
  /******/ /* webpack/runtime/make namespace object */
75
191
  /******/ (() => {
76
192
  /******/ // define __esModule on exports
@@ -82,353 +198,128 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
82
198
  /******/ };
83
199
  /******/ })();
84
200
  /******/
201
+ /******/ /* webpack/runtime/publicPath */
202
+ /******/ (() => {
203
+ /******/ var scriptUrl;
204
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
205
+ /******/ var document = __webpack_require__.g.document;
206
+ /******/ if (!scriptUrl && document) {
207
+ /******/ if (document.currentScript)
208
+ /******/ scriptUrl = document.currentScript.src;
209
+ /******/ if (!scriptUrl) {
210
+ /******/ var scripts = document.getElementsByTagName("script");
211
+ /******/ if(scripts.length) {
212
+ /******/ var i = scripts.length - 1;
213
+ /******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
214
+ /******/ }
215
+ /******/ }
216
+ /******/ }
217
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
218
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
219
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
220
+ /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
221
+ /******/ __webpack_require__.p = scriptUrl;
222
+ /******/ })();
223
+ /******/
224
+ /******/ /* webpack/runtime/jsonp chunk loading */
225
+ /******/ (() => {
226
+ /******/ // no baseURI
227
+ /******/
228
+ /******/ // object to store loaded and loading chunks
229
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
230
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
231
+ /******/ var installedChunks = {
232
+ /******/ "tsparticles.updater.gradient": 0
233
+ /******/ };
234
+ /******/
235
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
236
+ /******/ // JSONP chunk loading for javascript
237
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
238
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
239
+ /******/
240
+ /******/ // a Promise means "currently loading".
241
+ /******/ if(installedChunkData) {
242
+ /******/ promises.push(installedChunkData[2]);
243
+ /******/ } else {
244
+ /******/ if(true) { // all chunks have JS
245
+ /******/ // setup Promise in chunk cache
246
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
247
+ /******/ promises.push(installedChunkData[2] = promise);
248
+ /******/
249
+ /******/ // start chunk loading
250
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
251
+ /******/ // create error before stack unwound to get useful stacktrace later
252
+ /******/ var error = new Error();
253
+ /******/ var loadingEnded = (event) => {
254
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
255
+ /******/ installedChunkData = installedChunks[chunkId];
256
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
257
+ /******/ if(installedChunkData) {
258
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
259
+ /******/ var realSrc = event && event.target && event.target.src;
260
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
261
+ /******/ error.name = 'ChunkLoadError';
262
+ /******/ error.type = errorType;
263
+ /******/ error.request = realSrc;
264
+ /******/ installedChunkData[1](error);
265
+ /******/ }
266
+ /******/ }
267
+ /******/ };
268
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
269
+ /******/ }
270
+ /******/ }
271
+ /******/ }
272
+ /******/ };
273
+ /******/
274
+ /******/ // no prefetching
275
+ /******/
276
+ /******/ // no preloaded
277
+ /******/
278
+ /******/ // no HMR
279
+ /******/
280
+ /******/ // no HMR manifest
281
+ /******/
282
+ /******/ // no on chunks loaded
283
+ /******/
284
+ /******/ // install a JSONP callback for chunk loading
285
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
286
+ /******/ var chunkIds = data[0];
287
+ /******/ var moreModules = data[1];
288
+ /******/ var runtime = data[2];
289
+ /******/ // add "moreModules" to the modules object,
290
+ /******/ // then flag all "chunkIds" as loaded and fire callback
291
+ /******/ var moduleId, chunkId, i = 0;
292
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
293
+ /******/ for(moduleId in moreModules) {
294
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
295
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
296
+ /******/ }
297
+ /******/ }
298
+ /******/ if(runtime) var result = runtime(__webpack_require__);
299
+ /******/ }
300
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
301
+ /******/ for(;i < chunkIds.length; i++) {
302
+ /******/ chunkId = chunkIds[i];
303
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
304
+ /******/ installedChunks[chunkId][0]();
305
+ /******/ }
306
+ /******/ installedChunks[chunkId] = 0;
307
+ /******/ }
308
+ /******/
309
+ /******/ }
310
+ /******/
311
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_updater_gradient"] = this["webpackChunk_tsparticles_updater_gradient"] || [];
312
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
313
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
314
+ /******/ })();
315
+ /******/
85
316
  /************************************************************************/
86
- var __webpack_exports__ = {};
87
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
88
- (() => {
89
- // ESM COMPAT FLAG
90
- __webpack_require__.r(__webpack_exports__);
91
-
92
- // EXPORTS
93
- __webpack_require__.d(__webpack_exports__, {
94
- loadGradientUpdater: () => (/* binding */ loadGradientUpdater)
95
- });
96
-
97
- // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
98
- var engine_root_window_ = __webpack_require__(533);
99
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/GradientColorOpacityAnimation.js
100
-
101
- class GradientColorOpacityAnimation {
102
- constructor() {
103
- this.count = 0;
104
- this.enable = false;
105
- this.speed = 0;
106
- this.decay = 0;
107
- this.delay = 0;
108
- this.sync = false;
109
- this.startValue = "random";
110
- }
111
- load(data) {
112
- if (!data) {
113
- return;
114
- }
115
- if (data.count !== undefined) {
116
- this.count = (0,engine_root_window_.setRangeValue)(data.count);
117
- }
118
- if (data.enable !== undefined) {
119
- this.enable = data.enable;
120
- }
121
- if (data.speed !== undefined) {
122
- this.speed = (0,engine_root_window_.setRangeValue)(data.speed);
123
- }
124
- if (data.sync !== undefined) {
125
- this.sync = data.sync;
126
- }
127
- if (data.startValue !== undefined) {
128
- this.startValue = data.startValue;
129
- }
130
- if (data.decay !== undefined) {
131
- this.decay = (0,engine_root_window_.setRangeValue)(data.decay);
132
- }
133
- if (data.delay !== undefined) {
134
- this.delay = (0,engine_root_window_.setRangeValue)(data.delay);
135
- }
136
- }
137
- }
138
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/GradientColorOpacity.js
139
-
140
-
141
- class GradientColorOpacity {
142
- constructor() {
143
- this.value = 0;
144
- this.animation = new GradientColorOpacityAnimation();
145
- }
146
- load(data) {
147
- if (!data) {
148
- return;
149
- }
150
- this.animation.load(data.animation);
151
- if (data.value !== undefined) {
152
- this.value = (0,engine_root_window_.setRangeValue)(data.value);
153
- }
154
- }
155
- }
156
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/AnimatableGradientColor.js
157
-
158
-
159
- class AnimatableGradientColor {
160
- constructor() {
161
- this.stop = 0;
162
- this.value = new engine_root_window_.AnimatableColor();
163
- }
164
- load(data) {
165
- if (!data) {
166
- return;
167
- }
168
- if (data.stop !== undefined) {
169
- this.stop = data.stop;
170
- }
171
- this.value = engine_root_window_.AnimatableColor.create(this.value, data.value);
172
- if (data.opacity !== undefined) {
173
- this.opacity = new GradientColorOpacity();
174
- if ((0,engine_root_window_.isNumber)(data.opacity)) {
175
- this.opacity.value = data.opacity;
176
- } else {
177
- this.opacity.load(data.opacity);
178
- }
179
- }
180
- }
181
- }
182
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/GradientAngleAnimation.js
183
-
184
- class GradientAngleAnimation {
185
- constructor() {
186
- this.count = 0;
187
- this.enable = false;
188
- this.speed = 0;
189
- this.decay = 0;
190
- this.delay = 0;
191
- this.sync = false;
192
- }
193
- load(data) {
194
- if (!data) {
195
- return;
196
- }
197
- if (data.count !== undefined) {
198
- this.count = (0,engine_root_window_.setRangeValue)(data.count);
199
- }
200
- if (data.enable !== undefined) {
201
- this.enable = data.enable;
202
- }
203
- if (data.speed !== undefined) {
204
- this.speed = (0,engine_root_window_.setRangeValue)(data.speed);
205
- }
206
- if (data.decay !== undefined) {
207
- this.decay = (0,engine_root_window_.setRangeValue)(data.decay);
208
- }
209
- if (data.delay !== undefined) {
210
- this.delay = (0,engine_root_window_.setRangeValue)(data.delay);
211
- }
212
- if (data.sync !== undefined) {
213
- this.sync = data.sync;
214
- }
215
- }
216
- }
217
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/GradientAngle.js
218
-
219
-
220
- class GradientAngle {
221
- constructor() {
222
- this.value = 0;
223
- this.animation = new GradientAngleAnimation();
224
- this.direction = "clockwise";
225
- }
226
- load(data) {
227
- if (!data) {
228
- return;
229
- }
230
- this.animation.load(data.animation);
231
- if (data.value !== undefined) {
232
- this.value = (0,engine_root_window_.setRangeValue)(data.value);
233
- }
234
- if (data.direction !== undefined) {
235
- this.direction = data.direction;
236
- }
237
- }
238
- }
239
- ;// CONCATENATED MODULE: ./dist/browser/Options/Classes/AnimatableGradient.js
240
-
241
-
242
- class AnimatableGradient {
243
- constructor() {
244
- this.angle = new GradientAngle();
245
- this.colors = [];
246
- this.type = "random";
247
- }
248
- load(data) {
249
- if (!data) {
250
- return;
251
- }
252
- this.angle.load(data.angle);
253
- if (data.colors !== undefined) {
254
- this.colors = data.colors.map(s => {
255
- const tmp = new AnimatableGradientColor();
256
- tmp.load(s);
257
- return tmp;
258
- });
259
- }
260
- if (data.type !== undefined) {
261
- this.type = data.type;
262
- }
263
- }
264
- }
265
- ;// CONCATENATED MODULE: ./dist/browser/Utils.js
266
-
267
- function updateGradient(particle, delta) {
268
- const {
269
- gradient
270
- } = particle;
271
- if (!gradient) {
272
- return;
273
- }
274
- (0,engine_root_window_.updateAnimation)(particle, gradient.angle, false, "none", delta);
275
- for (const color of gradient.colors) {
276
- (0,engine_root_window_.updateColor)(color.value, delta);
277
- if (color.opacity) {
278
- (0,engine_root_window_.updateAnimation)(particle, color.opacity, true, "none", delta);
279
- }
280
- }
281
- }
282
- ;// CONCATENATED MODULE: ./dist/browser/GradientUpdater.js
283
-
284
-
285
-
286
- const GradientUpdater_double = 2,
287
- doublePI = Math.PI * GradientUpdater_double;
288
- class GradientUpdater {
289
- getColorStyles(particle, context, radius, opacity) {
290
- const gradient = particle.gradient;
291
- if (!gradient) {
292
- return {};
293
- }
294
- const gradientAngle = gradient.angle.value,
295
- origin = {
296
- x: 0,
297
- y: 0
298
- },
299
- minRadius = 0,
300
- fillGradient = gradient.type === "radial" ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius) : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
301
- for (const {
302
- stop,
303
- value,
304
- opacity: cOpacity
305
- } of gradient.colors) {
306
- fillGradient.addColorStop(stop, (0,engine_root_window_.getStyleFromHsl)({
307
- h: value.h.value,
308
- s: value.s.value,
309
- l: value.l.value
310
- }, cOpacity?.value ?? opacity));
311
- }
312
- return {
313
- fill: fillGradient
314
- };
315
- }
316
- init(particle) {
317
- const gradient = (0,engine_root_window_.itemFromSingleOrMultiple)(particle.options.gradient);
318
- if (!gradient) {
319
- return;
320
- }
321
- const {
322
- angle
323
- } = gradient,
324
- speedFactor = 360,
325
- delayOffset = 1;
326
- particle.gradient = {
327
- angle: {
328
- value: (0,engine_root_window_.getRangeValue)(angle.value),
329
- enable: angle.animation.enable,
330
- velocity: (0,engine_root_window_.getRangeValue)(angle.animation.speed) / speedFactor * particle.container.retina.reduceFactor,
331
- decay: delayOffset - (0,engine_root_window_.getRangeValue)(angle.animation.decay),
332
- delayTime: (0,engine_root_window_.getRangeValue)(angle.animation.delay) * engine_root_window_.millisecondsToSeconds,
333
- max: doublePI,
334
- min: 0,
335
- time: 0
336
- },
337
- type: gradient.type,
338
- colors: []
339
- };
340
- let rotateDirection = gradient.angle.direction;
341
- if (rotateDirection === "random") {
342
- rotateDirection = (0,engine_root_window_.getRandom)() > engine_root_window_.halfRandom ? "counter-clockwise" : "clockwise";
343
- }
344
- switch (rotateDirection) {
345
- case "counter-clockwise":
346
- case "counterClockwise":
347
- particle.gradient.angle.status = "decreasing";
348
- break;
349
- case "clockwise":
350
- particle.gradient.angle.status = "increasing";
351
- break;
352
- }
353
- const reduceDuplicates = particle.options.reduceDuplicates;
354
- for (const grColor of gradient.colors) {
355
- const grHslColor = (0,engine_root_window_.rangeColorToHsl)(grColor.value, particle.id, reduceDuplicates);
356
- if (!grHslColor) {
357
- continue;
358
- }
359
- const grHslAnimation = (0,engine_root_window_.getHslAnimationFromHsl)(grHslColor, grColor.value.animation, particle.container.retina.reduceFactor),
360
- addColor = {
361
- stop: grColor.stop,
362
- value: grHslAnimation,
363
- opacity: grColor.opacity ? {
364
- enable: grColor.opacity.animation.enable,
365
- max: (0,engine_root_window_.getRangeMax)(grColor.opacity.value),
366
- min: (0,engine_root_window_.getRangeMin)(grColor.opacity.value),
367
- status: "increasing",
368
- value: (0,engine_root_window_.getRangeValue)(grColor.opacity.value),
369
- velocity: (0,engine_root_window_.getRangeValue)(grColor.opacity.animation.speed) / engine_root_window_.percentDenominator * particle.container.retina.reduceFactor,
370
- decay: delayOffset - (0,engine_root_window_.getRangeValue)(grColor.opacity.animation.decay),
371
- delayTime: (0,engine_root_window_.getRangeValue)(grColor.opacity.animation.delay) * engine_root_window_.millisecondsToSeconds,
372
- time: 0
373
- } : undefined
374
- };
375
- const {
376
- opacity: addOpacity
377
- } = addColor;
378
- if (grColor.opacity && addOpacity) {
379
- const opacityRange = grColor.opacity.value;
380
- addOpacity.min = (0,engine_root_window_.getRangeMin)(opacityRange);
381
- addOpacity.max = (0,engine_root_window_.getRangeMax)(opacityRange);
382
- const opacityAnimation = grColor.opacity.animation;
383
- switch (opacityAnimation.startValue) {
384
- case "min":
385
- addOpacity.value = addOpacity.min;
386
- addOpacity.status = "increasing";
387
- break;
388
- case "max":
389
- addOpacity.value = addOpacity.max;
390
- addOpacity.status = "decreasing";
391
- break;
392
- case "random":
393
- default:
394
- addOpacity.value = (0,engine_root_window_.randomInRange)(addOpacity);
395
- addOpacity.status = (0,engine_root_window_.getRandom)() >= engine_root_window_.halfRandom ? "increasing" : "decreasing";
396
- break;
397
- }
398
- }
399
- particle.gradient.colors.push(addColor);
400
- }
401
- }
402
- isEnabled(particle) {
403
- return !particle.destroyed && !particle.spawning && (!!particle.gradient?.angle.enable || (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ?? false));
404
- }
405
- loadOptions(options, ...sources) {
406
- for (const source of sources) {
407
- if (!source?.gradient) {
408
- continue;
409
- }
410
- const gradientToLoad = source.gradient;
411
- if (!gradientToLoad) {
412
- continue;
413
- }
414
- options.gradient = (0,engine_root_window_.executeOnSingleOrMultiple)(gradientToLoad, gradient => {
415
- const tmp = new AnimatableGradient();
416
- tmp.load(gradient);
417
- return tmp;
418
- });
419
- }
420
- }
421
- update(particle, delta) {
422
- updateGradient(particle, delta);
423
- }
424
- }
425
- ;// CONCATENATED MODULE: ./dist/browser/index.js
426
-
427
- async function loadGradientUpdater(engine, refresh = true) {
428
- await engine.addParticleUpdater("gradient", () => new GradientUpdater(), refresh);
429
- }
430
- })();
431
-
317
+ /******/
318
+ /******/ // startup
319
+ /******/ // Load entry module and return exports
320
+ /******/ // This entry module can't be inlined because the eval devtool is used.
321
+ /******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
322
+ /******/
432
323
  /******/ return __webpack_exports__;
433
324
  /******/ })()
434
325
  ;
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.updater.gradient.min.js.LICENSE.txt */
2
- !function(e,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],a);else{var t="object"==typeof exports?a(require("@tsparticles/engine")):a(e.window);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(this,(e=>(()=>{"use strict";var a={533:a=>{a.exports=e}},t={};function n(e){var i=t[e];if(void 0!==i)return i.exports;var o=t[e]={exports:{}};return a[e](o,o.exports,n),o.exports}n.d=(e,a)=>{for(var t in a)n.o(a,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},n.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{loadGradientUpdater:()=>u});var e=n(533);class a{constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1,this.startValue="random"}load(a){a&&(void 0!==a.count&&(this.count=(0,e.setRangeValue)(a.count)),void 0!==a.enable&&(this.enable=a.enable),void 0!==a.speed&&(this.speed=(0,e.setRangeValue)(a.speed)),void 0!==a.sync&&(this.sync=a.sync),void 0!==a.startValue&&(this.startValue=a.startValue),void 0!==a.decay&&(this.decay=(0,e.setRangeValue)(a.decay)),void 0!==a.delay&&(this.delay=(0,e.setRangeValue)(a.delay)))}}class t{constructor(){this.value=0,this.animation=new a}load(a){a&&(this.animation.load(a.animation),void 0!==a.value&&(this.value=(0,e.setRangeValue)(a.value)))}}class o{constructor(){this.stop=0,this.value=new e.AnimatableColor}load(a){a&&(void 0!==a.stop&&(this.stop=a.stop),this.value=e.AnimatableColor.create(this.value,a.value),void 0!==a.opacity&&(this.opacity=new t,(0,e.isNumber)(a.opacity)?this.opacity.value=a.opacity:this.opacity.load(a.opacity)))}}class s{constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1}load(a){a&&(void 0!==a.count&&(this.count=(0,e.setRangeValue)(a.count)),void 0!==a.enable&&(this.enable=a.enable),void 0!==a.speed&&(this.speed=(0,e.setRangeValue)(a.speed)),void 0!==a.decay&&(this.decay=(0,e.setRangeValue)(a.decay)),void 0!==a.delay&&(this.delay=(0,e.setRangeValue)(a.delay)),void 0!==a.sync&&(this.sync=a.sync))}}class l{constructor(){this.value=0,this.animation=new s,this.direction="clockwise"}load(a){a&&(this.animation.load(a.animation),void 0!==a.value&&(this.value=(0,e.setRangeValue)(a.value)),void 0!==a.direction&&(this.direction=a.direction))}}class c{constructor(){this.angle=new l,this.colors=[],this.type="random"}load(e){e&&(this.angle.load(e.angle),void 0!==e.colors&&(this.colors=e.colors.map((e=>{const a=new o;return a.load(e),a}))),void 0!==e.type&&(this.type=e.type))}}const r=2*Math.PI;class d{getColorStyles(a,t,n,i){const o=a.gradient;if(!o)return{};const s=o.angle.value,l=0,c=0,r="radial"===o.type?t.createRadialGradient(l,c,0,l,c,n):t.createLinearGradient(Math.cos(s)*-n,Math.sin(s)*-n,Math.cos(s)*n,Math.sin(s)*n);for(const{stop:a,value:t,opacity:n}of o.colors)r.addColorStop(a,(0,e.getStyleFromHsl)({h:t.h.value,s:t.s.value,l:t.l.value},n?.value??i));return{fill:r}}init(a){const t=(0,e.itemFromSingleOrMultiple)(a.options.gradient);if(!t)return;const{angle:n}=t;a.gradient={angle:{value:(0,e.getRangeValue)(n.value),enable:n.animation.enable,velocity:(0,e.getRangeValue)(n.animation.speed)/360*a.container.retina.reduceFactor,decay:1-(0,e.getRangeValue)(n.animation.decay),delayTime:(0,e.getRangeValue)(n.animation.delay)*e.millisecondsToSeconds,max:r,min:0,time:0},type:t.type,colors:[]};let i=t.angle.direction;switch("random"===i&&(i=(0,e.getRandom)()>e.halfRandom?"counter-clockwise":"clockwise"),i){case"counter-clockwise":case"counterClockwise":a.gradient.angle.status="decreasing";break;case"clockwise":a.gradient.angle.status="increasing"}const o=a.options.reduceDuplicates;for(const n of t.colors){const t=(0,e.rangeColorToHsl)(n.value,a.id,o);if(!t)continue;const i=(0,e.getHslAnimationFromHsl)(t,n.value.animation,a.container.retina.reduceFactor),s={stop:n.stop,value:i,opacity:n.opacity?{enable:n.opacity.animation.enable,max:(0,e.getRangeMax)(n.opacity.value),min:(0,e.getRangeMin)(n.opacity.value),status:"increasing",value:(0,e.getRangeValue)(n.opacity.value),velocity:(0,e.getRangeValue)(n.opacity.animation.speed)/e.percentDenominator*a.container.retina.reduceFactor,decay:1-(0,e.getRangeValue)(n.opacity.animation.decay),delayTime:(0,e.getRangeValue)(n.opacity.animation.delay)*e.millisecondsToSeconds,time:0}:void 0},{opacity:l}=s;if(n.opacity&&l){const a=n.opacity.value;l.min=(0,e.getRangeMin)(a),l.max=(0,e.getRangeMax)(a);switch(n.opacity.animation.startValue){case"min":l.value=l.min,l.status="increasing";break;case"max":l.value=l.max,l.status="decreasing";break;default:l.value=(0,e.randomInRange)(l),l.status=(0,e.getRandom)()>=e.halfRandom?"increasing":"decreasing"}}a.gradient.colors.push(s)}}isEnabled(e){return!e.destroyed&&!e.spawning&&(!!e.gradient?.angle.enable||(e.gradient?.colors.some((e=>e.value.h.enable||e.value.s.enable||e.value.l.enable))??!1))}loadOptions(a,...t){for(const n of t){if(!n?.gradient)continue;const t=n.gradient;t&&(a.gradient=(0,e.executeOnSingleOrMultiple)(t,(e=>{const a=new c;return a.load(e),a})))}}update(a,t){!function(a,t){const{gradient:n}=a;if(n){(0,e.updateAnimation)(a,n.angle,!1,"none",t);for(const i of n.colors)(0,e.updateColor)(i.value,t),i.opacity&&(0,e.updateAnimation)(a,i.opacity,!0,"none",t)}}(a,t)}}async function u(e,a=!0){await e.addParticleUpdater("gradient",(()=>new d),a)}})(),i})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(e=>(()=>{var t,r,n={533:t=>{t.exports=e}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,i),r.exports}i.m=n,i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/updater-gradient:",i.l=(e,n,o,a)=>{if(t[e])t[e].push(n);else{var s,d;if(void 0!==o)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var p=u[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==r+o){s=p;break}}s||(d=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",r+o),s.src=e),t[e]=[n];var l=(r,n)=>{s.onerror=s.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((e=>e(n))),r)return r(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=l.bind(null,s.onerror),s.onload=l.bind(null,s.onload),d&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!e;)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={127:0};i.f.j=(t,r)=>{var n=i.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=o);var a=i.p+i.u(t),s=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,n[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,o,a=r[0],s=r[1],d=r[2],u=0;if(a.some((t=>0!==e[t]))){for(n in s)i.o(s,n)&&(i.m[n]=s[n]);if(d)d(i)}for(t&&t(r);u<a.length;u++)o=a[u],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_updater_gradient=this.webpackChunk_tsparticles_updater_gradient||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("gradient",(async()=>{const{GradientUpdater:e}=await i.e(914).then(i.bind(i,914));return new e}),t)}i.r(a),i.d(a,{loadGradientUpdater:()=>e})})(),a})()));
@@ -1 +1 @@
1
- /*! tsParticles Gradient Updater v3.1.0 by Matteo Bruni */
1
+ /*! tsParticles Gradient Updater v3.2.0 by Matteo Bruni */
@@ -2,8 +2,8 @@ import { type IDelta, type IParticleColorStyle, type IParticleUpdater, type Recu
2
2
  import type { GradientParticle, GradientParticlesOptions, IGradientParticlesOptions } from "./Types.js";
3
3
  export declare class GradientUpdater implements IParticleUpdater {
4
4
  getColorStyles(particle: GradientParticle, context: CanvasRenderingContext2D, radius: number, opacity: number): IParticleColorStyle;
5
- init(particle: GradientParticle): void;
5
+ init(particle: GradientParticle): Promise<void>;
6
6
  isEnabled(particle: GradientParticle): boolean;
7
7
  loadOptions(options: GradientParticlesOptions, ...sources: (RecursivePartial<IGradientParticlesOptions> | undefined)[]): void;
8
- update(particle: GradientParticle, delta: IDelta): void;
8
+ update(particle: GradientParticle, delta: IDelta): Promise<void>;
9
9
  }
@@ -1,18 +1,41 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14
+ }) : function(o, v) {
15
+ o["default"] = v;
16
+ });
17
+ var __importStar = (this && this.__importStar) || function (mod) {
18
+ if (mod && mod.__esModule) return mod;
19
+ var result = {};
20
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ __setModuleDefault(result, mod);
22
+ return result;
23
+ };
1
24
  (function (factory) {
2
25
  if (typeof module === "object" && typeof module.exports === "object") {
3
26
  var v = factory(require, exports);
4
27
  if (v !== undefined) module.exports = v;
5
28
  }
6
29
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./Options/Classes/AnimatableGradient.js", "./Utils.js"], factory);
30
+ define(["require", "exports", "@tsparticles/engine", "./Options/Classes/AnimatableGradient.js"], factory);
8
31
  }
9
32
  })(function (require, exports) {
10
33
  "use strict";
34
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
11
35
  Object.defineProperty(exports, "__esModule", { value: true });
12
36
  exports.GradientUpdater = void 0;
13
37
  const engine_1 = require("@tsparticles/engine");
14
38
  const AnimatableGradient_js_1 = require("./Options/Classes/AnimatableGradient.js");
15
- const Utils_js_1 = require("./Utils.js");
16
39
  const double = 2, doublePI = Math.PI * double;
17
40
  class GradientUpdater {
18
41
  getColorStyles(particle, context, radius, opacity) {
@@ -32,7 +55,7 @@
32
55
  }
33
56
  return { fill: fillGradient };
34
57
  }
35
- init(particle) {
58
+ async init(particle) {
36
59
  const gradient = (0, engine_1.itemFromSingleOrMultiple)(particle.options.gradient);
37
60
  if (!gradient) {
38
61
  return;
@@ -114,6 +137,7 @@
114
137
  }
115
138
  particle.gradient.colors.push(addColor);
116
139
  }
140
+ await Promise.resolve();
117
141
  }
118
142
  isEnabled(particle) {
119
143
  return (!particle.destroyed &&
@@ -138,8 +162,9 @@
138
162
  });
139
163
  }
140
164
  }
141
- update(particle, delta) {
142
- (0, Utils_js_1.updateGradient)(particle, delta);
165
+ async update(particle, delta) {
166
+ const { updateGradient } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Utils.js"))) : new Promise((resolve_1, reject_1) => { require(["./Utils.js"], resolve_1, reject_1); }).then(__importStar));
167
+ updateGradient(particle, delta);
143
168
  }
144
169
  }
145
170
  exports.GradientUpdater = GradientUpdater;
package/umd/index.js CHANGED
@@ -1,18 +1,44 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14
+ }) : function(o, v) {
15
+ o["default"] = v;
16
+ });
17
+ var __importStar = (this && this.__importStar) || function (mod) {
18
+ if (mod && mod.__esModule) return mod;
19
+ var result = {};
20
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ __setModuleDefault(result, mod);
22
+ return result;
23
+ };
1
24
  (function (factory) {
2
25
  if (typeof module === "object" && typeof module.exports === "object") {
3
26
  var v = factory(require, exports);
4
27
  if (v !== undefined) module.exports = v;
5
28
  }
6
29
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./GradientUpdater.js"], factory);
30
+ define(["require", "exports"], factory);
8
31
  }
9
32
  })(function (require, exports) {
10
33
  "use strict";
34
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
11
35
  Object.defineProperty(exports, "__esModule", { value: true });
12
36
  exports.loadGradientUpdater = void 0;
13
- const GradientUpdater_js_1 = require("./GradientUpdater.js");
14
37
  async function loadGradientUpdater(engine, refresh = true) {
15
- await engine.addParticleUpdater("gradient", () => new GradientUpdater_js_1.GradientUpdater(), refresh);
38
+ await engine.addParticleUpdater("gradient", async () => {
39
+ const { GradientUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./GradientUpdater.js"))) : new Promise((resolve_1, reject_1) => { require(["./GradientUpdater.js"], resolve_1, reject_1); }).then(__importStar));
40
+ return new GradientUpdater();
41
+ }, refresh);
16
42
  }
17
43
  exports.loadGradientUpdater = loadGradientUpdater;
18
44
  });