@tsparticles/updater-gradient 4.0.0-alpha.5 → 4.0.0-beta.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.
Files changed (41) hide show
  1. package/711.min.js +1 -0
  2. package/browser/GradientUpdater.js +6 -6
  3. package/browser/Options/Classes/AnimatableGradient.js +3 -0
  4. package/browser/Options/Classes/AnimatableGradientColor.js +3 -0
  5. package/browser/Options/Classes/GradientAngle.js +3 -0
  6. package/browser/Options/Classes/GradientAngleAnimation.js +6 -0
  7. package/browser/Options/Classes/GradientColorOpacity.js +2 -0
  8. package/browser/Options/Classes/GradientColorOpacityAnimation.js +7 -0
  9. package/browser/index.js +1 -1
  10. package/cjs/GradientUpdater.js +6 -6
  11. package/cjs/Options/Classes/AnimatableGradient.js +3 -0
  12. package/cjs/Options/Classes/AnimatableGradientColor.js +3 -0
  13. package/cjs/Options/Classes/GradientAngle.js +3 -0
  14. package/cjs/Options/Classes/GradientAngleAnimation.js +6 -0
  15. package/cjs/Options/Classes/GradientColorOpacity.js +2 -0
  16. package/cjs/Options/Classes/GradientColorOpacityAnimation.js +7 -0
  17. package/cjs/index.js +1 -1
  18. package/dist_browser_GradientUpdater_js.js +9 -9
  19. package/esm/GradientUpdater.js +6 -6
  20. package/esm/Options/Classes/AnimatableGradient.js +3 -0
  21. package/esm/Options/Classes/AnimatableGradientColor.js +3 -0
  22. package/esm/Options/Classes/GradientAngle.js +3 -0
  23. package/esm/Options/Classes/GradientAngleAnimation.js +6 -0
  24. package/esm/Options/Classes/GradientColorOpacity.js +2 -0
  25. package/esm/Options/Classes/GradientColorOpacityAnimation.js +7 -0
  26. package/esm/index.js +1 -1
  27. package/package.json +2 -2
  28. package/report.html +3 -3
  29. package/tsparticles.updater.gradient.js +31 -19
  30. package/tsparticles.updater.gradient.min.js +2 -2
  31. package/umd/GradientUpdater.js +6 -6
  32. package/umd/Options/Classes/AnimatableGradient.js +3 -0
  33. package/umd/Options/Classes/AnimatableGradientColor.js +3 -0
  34. package/umd/Options/Classes/GradientAngle.js +3 -0
  35. package/umd/Options/Classes/GradientAngleAnimation.js +6 -0
  36. package/umd/Options/Classes/GradientColorOpacity.js +2 -0
  37. package/umd/Options/Classes/GradientColorOpacityAnimation.js +7 -0
  38. package/umd/index.js +1 -1
  39. package/652.min.js +0 -2
  40. package/652.min.js.LICENSE.txt +0 -1
  41. package/tsparticles.updater.gradient.min.js.LICENSE.txt +0 -1
package/711.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_updater_gradient=this.webpackChunk_tsparticles_updater_gradient||[]).push([[711],{711(e,a,t){t.d(a,{GradientUpdater:()=>u});var i=t(303);class n{count;decay;delay;enable;speed;startValue;sync;constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1,this.startValue=i.StartValueType.random}load(e){(0,i.isNull)(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 o{animation;value;constructor(){this.value=0,this.animation=new n}load(e){(0,i.isNull)(e)||(this.animation.load(e.animation),void 0!==e.value&&(this.value=(0,i.setRangeValue)(e.value)))}}class l{opacity;stop;value;constructor(){this.stop=0,this.value=new i.AnimatableColor}load(e){(0,i.isNull)(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 o,(0,i.isNumber)(e.opacity)?this.opacity.value=e.opacity:this.opacity.load(e.opacity)))}}class s{count;decay;delay;enable;speed;sync;constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1}load(e){(0,i.isNull)(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{animation;direction;value;constructor(){this.value=0,this.animation=new s,this.direction=i.RotateDirection.clockwise}load(e){(0,i.isNull)(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 r{angle;colors;type;constructor(){this.angle=new c,this.colors=[],this.type=i.GradientType.random}load(e){(0,i.isNull)(e)||(this.angle.load(e.angle),void 0!==e.colors&&(this.colors=e.colors.map(e=>{let a=new l;return a.load(e),a})),void 0!==e.type&&(this.type=e.type))}}class u{_engine;constructor(e){this._engine=e}getColorStyles(e,a,t,n){let o=e.gradient;if(!o)return{};let{container:l}=e,s=o.angle.value,c=o.type===i.GradientType.radial?a.createRadialGradient(0,0,0,0,0,t):a.createLinearGradient(-(Math.cos(s)*t),-(Math.sin(s)*t),Math.cos(s)*t,Math.sin(s)*t);for(let{stop:e,value:a,opacity:t}of o.colors){let o={h:a.h.value,s:a.s.value,l:a.l.value};c.addColorStop(e,(0,i.getStyleFromHsl)(o,l.hdr,t?.value??n))}return{fill:c}}init(e){let a=(0,i.itemFromSingleOrMultiple)(e.options.gradient);if(!a)return;let{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:i.doublePI,min:0,time:0},type:a.type,colors:[]};let n=a.angle.direction;switch(n===i.RotateDirection.random&&(n=(0,i.getRandom)()>i.half?i.RotateDirection.counterClockwise:i.RotateDirection.clockwise),n){case i.RotateDirection.counterClockwise:case"counterClockwise":e.gradient.angle.status=i.AnimationStatus.decreasing;break;case i.RotateDirection.clockwise:e.gradient.angle.status=i.AnimationStatus.increasing}let o=e.options.reduceDuplicates;for(let t of a.colors){let a=(0,i.rangeColorToHsl)(this._engine,t.value,e.id,o);if(!a)continue;let n=(0,i.getHslAnimationFromHsl)(a,t.value.animation,e.container.retina.reduceFactor),l={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:i.AnimationStatus.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:s}=l;if(t.opacity&&s){let e=t.opacity.value;switch(s.min=(0,i.getRangeMin)(e),s.max=(0,i.getRangeMax)(e),t.opacity.animation.startValue){case i.StartValueType.min:s.value=s.min,s.status=i.AnimationStatus.increasing;break;case i.StartValueType.max:s.value=s.max,s.status=i.AnimationStatus.decreasing;break;case i.StartValueType.random:default:s.value=(0,i.randomInRangeValue)(s),s.status=(0,i.getRandom)()>=i.half?i.AnimationStatus.increasing:i.AnimationStatus.decreasing}}e.gradient.colors.push(l)}}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(let t of a){if(!t?.gradient)continue;let a=t.gradient;e.gradient=(0,i.executeOnSingleOrMultiple)(a,e=>{let a=new r;return a.load(e),a})}}update(e,a){!function(e,a){let{gradient:t}=e;if(t)for(let n of((0,i.updateAnimation)(e,t.angle,!1,i.DestroyType.none,a),t.colors))(0,i.updateColor)(n.value,a),n.opacity&&(0,i.updateAnimation)(e,n.opacity,!0,i.DestroyType.none,a)}(e,a)}}}}]);
@@ -2,6 +2,7 @@ import { AnimationStatus, GradientType, RotateDirection, StartValueType, doubleP
2
2
  import { AnimatableGradient } from "./Options/Classes/AnimatableGradient.js";
3
3
  import { updateGradient } from "./Utils.js";
4
4
  export class GradientUpdater {
5
+ _engine;
5
6
  constructor(engine) {
6
7
  this._engine = engine;
7
8
  }
@@ -55,6 +56,8 @@ export class GradientUpdater {
55
56
  case RotateDirection.clockwise:
56
57
  particle.gradient.angle.status = AnimationStatus.increasing;
57
58
  break;
59
+ default:
60
+ break;
58
61
  }
59
62
  const reduceDuplicates = particle.options.reduceDuplicates;
60
63
  for (const grColor of gradient.colors) {
@@ -79,8 +82,7 @@ export class GradientUpdater {
79
82
  time: 0,
80
83
  }
81
84
  : undefined,
82
- };
83
- const { opacity: addOpacity } = addColor;
85
+ }, { opacity: addOpacity } = addColor;
84
86
  if (grColor.opacity && addOpacity) {
85
87
  const opacityRange = grColor.opacity.value;
86
88
  addOpacity.min = getRangeMin(opacityRange);
@@ -98,8 +100,7 @@ export class GradientUpdater {
98
100
  case StartValueType.random:
99
101
  default:
100
102
  addOpacity.value = randomInRangeValue(addOpacity);
101
- addOpacity.status =
102
- getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
103
+ addOpacity.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
103
104
  break;
104
105
  }
105
106
  }
@@ -110,8 +111,7 @@ export class GradientUpdater {
110
111
  return (!particle.destroyed &&
111
112
  !particle.spawning &&
112
113
  (!!particle.gradient?.angle.enable ||
113
- (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
114
- false)));
114
+ (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ?? false)));
115
115
  }
116
116
  loadOptions(options, ...sources) {
117
117
  for (const source of sources) {
@@ -2,6 +2,9 @@ import { GradientType, isNull } from "@tsparticles/engine";
2
2
  import { AnimatableGradientColor } from "./AnimatableGradientColor.js";
3
3
  import { GradientAngle } from "./GradientAngle.js";
4
4
  export class AnimatableGradient {
5
+ angle;
6
+ colors;
7
+ type;
5
8
  constructor() {
6
9
  this.angle = new GradientAngle();
7
10
  this.colors = [];
@@ -1,6 +1,9 @@
1
1
  import { AnimatableColor, isNull, isNumber } from "@tsparticles/engine";
2
2
  import { GradientColorOpacity } from "./GradientColorOpacity.js";
3
3
  export class AnimatableGradientColor {
4
+ opacity;
5
+ stop;
6
+ value;
4
7
  constructor() {
5
8
  this.stop = 0;
6
9
  this.value = new AnimatableColor();
@@ -1,6 +1,9 @@
1
1
  import { RotateDirection, isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
+ animation;
5
+ direction;
6
+ value;
4
7
  constructor() {
5
8
  this.value = 0;
6
9
  this.animation = new GradientAngleAnimation();
@@ -1,5 +1,11 @@
1
1
  import { isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientAngleAnimation {
3
+ count;
4
+ decay;
5
+ delay;
6
+ enable;
7
+ speed;
8
+ sync;
3
9
  constructor() {
4
10
  this.count = 0;
5
11
  this.enable = false;
@@ -1,6 +1,8 @@
1
1
  import { isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.js";
3
3
  export class GradientColorOpacity {
4
+ animation;
5
+ value;
4
6
  constructor() {
5
7
  this.value = 0;
6
8
  this.animation = new GradientColorOpacityAnimation();
@@ -1,5 +1,12 @@
1
1
  import { StartValueType, isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
+ count;
4
+ decay;
5
+ delay;
6
+ enable;
7
+ speed;
8
+ startValue;
9
+ sync;
3
10
  constructor() {
4
11
  this.count = 0;
5
12
  this.enable = false;
package/browser/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadGradientUpdater(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(e => {
4
4
  e.addParticleUpdater("gradient", async () => {
5
5
  const { GradientUpdater } = await import("./GradientUpdater.js");
@@ -2,6 +2,7 @@ import { AnimationStatus, GradientType, RotateDirection, StartValueType, doubleP
2
2
  import { AnimatableGradient } from "./Options/Classes/AnimatableGradient.js";
3
3
  import { updateGradient } from "./Utils.js";
4
4
  export class GradientUpdater {
5
+ _engine;
5
6
  constructor(engine) {
6
7
  this._engine = engine;
7
8
  }
@@ -55,6 +56,8 @@ export class GradientUpdater {
55
56
  case RotateDirection.clockwise:
56
57
  particle.gradient.angle.status = AnimationStatus.increasing;
57
58
  break;
59
+ default:
60
+ break;
58
61
  }
59
62
  const reduceDuplicates = particle.options.reduceDuplicates;
60
63
  for (const grColor of gradient.colors) {
@@ -79,8 +82,7 @@ export class GradientUpdater {
79
82
  time: 0,
80
83
  }
81
84
  : undefined,
82
- };
83
- const { opacity: addOpacity } = addColor;
85
+ }, { opacity: addOpacity } = addColor;
84
86
  if (grColor.opacity && addOpacity) {
85
87
  const opacityRange = grColor.opacity.value;
86
88
  addOpacity.min = getRangeMin(opacityRange);
@@ -98,8 +100,7 @@ export class GradientUpdater {
98
100
  case StartValueType.random:
99
101
  default:
100
102
  addOpacity.value = randomInRangeValue(addOpacity);
101
- addOpacity.status =
102
- getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
103
+ addOpacity.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
103
104
  break;
104
105
  }
105
106
  }
@@ -110,8 +111,7 @@ export class GradientUpdater {
110
111
  return (!particle.destroyed &&
111
112
  !particle.spawning &&
112
113
  (!!particle.gradient?.angle.enable ||
113
- (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
114
- false)));
114
+ (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ?? false)));
115
115
  }
116
116
  loadOptions(options, ...sources) {
117
117
  for (const source of sources) {
@@ -2,6 +2,9 @@ import { GradientType, isNull } from "@tsparticles/engine";
2
2
  import { AnimatableGradientColor } from "./AnimatableGradientColor.js";
3
3
  import { GradientAngle } from "./GradientAngle.js";
4
4
  export class AnimatableGradient {
5
+ angle;
6
+ colors;
7
+ type;
5
8
  constructor() {
6
9
  this.angle = new GradientAngle();
7
10
  this.colors = [];
@@ -1,6 +1,9 @@
1
1
  import { AnimatableColor, isNull, isNumber } from "@tsparticles/engine";
2
2
  import { GradientColorOpacity } from "./GradientColorOpacity.js";
3
3
  export class AnimatableGradientColor {
4
+ opacity;
5
+ stop;
6
+ value;
4
7
  constructor() {
5
8
  this.stop = 0;
6
9
  this.value = new AnimatableColor();
@@ -1,6 +1,9 @@
1
1
  import { RotateDirection, isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
+ animation;
5
+ direction;
6
+ value;
4
7
  constructor() {
5
8
  this.value = 0;
6
9
  this.animation = new GradientAngleAnimation();
@@ -1,5 +1,11 @@
1
1
  import { isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientAngleAnimation {
3
+ count;
4
+ decay;
5
+ delay;
6
+ enable;
7
+ speed;
8
+ sync;
3
9
  constructor() {
4
10
  this.count = 0;
5
11
  this.enable = false;
@@ -1,6 +1,8 @@
1
1
  import { isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.js";
3
3
  export class GradientColorOpacity {
4
+ animation;
5
+ value;
4
6
  constructor() {
5
7
  this.value = 0;
6
8
  this.animation = new GradientColorOpacityAnimation();
@@ -1,5 +1,12 @@
1
1
  import { StartValueType, isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
+ count;
4
+ decay;
5
+ delay;
6
+ enable;
7
+ speed;
8
+ startValue;
9
+ sync;
3
10
  constructor() {
4
11
  this.count = 0;
5
12
  this.enable = false;
package/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadGradientUpdater(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(e => {
4
4
  e.addParticleUpdater("gradient", async () => {
5
5
  const { GradientUpdater } = await import("./GradientUpdater.js");
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.5
7
+ * v4.0.0-beta.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \*****************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
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 _Options_Classes_AnimatableGradient_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/AnimatableGradient.js */ \"./dist/browser/Options/Classes/AnimatableGradient.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nclass GradientUpdater {\n constructor(engine) {\n this._engine = engine;\n }\n getColorStyles(particle, context, radius, opacity) {\n const gradient = particle.gradient;\n if (!gradient) {\n return {};\n }\n const {\n container\n } = particle,\n gradientAngle = gradient.angle.value,\n origin = {\n x: 0,\n y: 0\n },\n minRadius = 0,\n fillGradient = gradient.type === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.GradientType.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 const hsl = {\n h: value.h.value,\n s: value.s.value,\n l: value.l.value\n };\n fillGradient.addColorStop(stop, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(hsl, container.hdr, cOpacity?.value ?? opacity));\n }\n return {\n fill: fillGradient\n };\n }\n 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: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI,\n min: 0,\n time: 0\n },\n type: gradient.type,\n colors: []\n };\n let rotateDirection = gradient.angle.direction;\n if (rotateDirection === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.random) {\n rotateDirection = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() > _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise;\n }\n switch (rotateDirection) {\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise:\n case \"counterClockwise\":\n particle.gradient.angle.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise:\n particle.gradient.angle.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.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)(this._engine, 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: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.min:\n addOpacity.value = addOpacity.min;\n addOpacity.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.increasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.max:\n addOpacity.value = addOpacity.max;\n addOpacity.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.random:\n default:\n addOpacity.value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)(addOpacity);\n addOpacity.status = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.increasing : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n }\n }\n particle.gradient.colors.push(addColor);\n }\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 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 update(particle, delta) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.updateGradient)(particle, delta);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/GradientUpdater.js?\n}");
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 _Options_Classes_AnimatableGradient_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/AnimatableGradient.js */ \"./dist/browser/Options/Classes/AnimatableGradient.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nclass GradientUpdater {\n _engine;\n constructor(engine){\n this._engine = engine;\n }\n getColorStyles(particle, context, radius, opacity) {\n const gradient = particle.gradient;\n if (!gradient) {\n return {};\n }\n const { container } = particle, gradientAngle = gradient.angle.value, origin = {\n x: 0,\n y: 0\n }, minRadius = 0, fillGradient = gradient.type === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.GradientType.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 { stop, value, opacity: cOpacity } of gradient.colors){\n const hsl = {\n h: value.h.value,\n s: value.s.value,\n l: value.l.value\n };\n fillGradient.addColorStop(stop, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(hsl, container.hdr, cOpacity?.value ?? opacity));\n }\n return {\n fill: fillGradient\n };\n }\n init(particle) {\n const gradient = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(particle.options.gradient);\n if (!gradient) {\n return;\n }\n const { angle } = gradient, speedFactor = 360, 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: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI,\n min: 0,\n time: 0\n },\n type: gradient.type,\n colors: []\n };\n let rotateDirection = gradient.angle.direction;\n if (rotateDirection === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.random) {\n rotateDirection = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() > _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise;\n }\n switch(rotateDirection){\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise:\n case \"counterClockwise\":\n particle.gradient.angle.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise:\n particle.gradient.angle.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.increasing;\n break;\n default:\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)(this._engine, 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), 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: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.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 }, { opacity: addOpacity } = 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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.min:\n addOpacity.value = addOpacity.min;\n addOpacity.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.increasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.max:\n addOpacity.value = addOpacity.max;\n addOpacity.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.random:\n default:\n addOpacity.value = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)(addOpacity);\n addOpacity.status = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.increasing : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n }\n }\n particle.gradient.colors.push(addColor);\n }\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 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 update(particle, delta) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__.updateGradient)(particle, delta);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/GradientUpdater.js?\n}");
27
27
 
28
28
  /***/ },
29
29
 
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
33
33
  \************************************************************/
34
34
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\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_2__ = __webpack_require__(/*! ./GradientAngle.js */ \"./dist/browser/Options/Classes/GradientAngle.js\");\n\n\n\nclass AnimatableGradient {\n constructor() {\n this.angle = new _GradientAngle_js__WEBPACK_IMPORTED_MODULE_2__.GradientAngle();\n this.colors = [];\n this.type = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.GradientType.random;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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?\n}");
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 _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\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_2__ = __webpack_require__(/*! ./GradientAngle.js */ \"./dist/browser/Options/Classes/GradientAngle.js\");\n\n\n\nclass AnimatableGradient {\n angle;\n colors;\n type;\n constructor(){\n this.angle = new _GradientAngle_js__WEBPACK_IMPORTED_MODULE_2__.GradientAngle();\n this.colors = [];\n this.type = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.GradientType.random;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/AnimatableGradient.js?\n}");
37
37
 
38
38
  /***/ },
39
39
 
@@ -43,7 +43,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
43
43
  \*****************************************************************/
44
44
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
45
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 _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 ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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?\n}");
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 _GradientColorOpacity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GradientColorOpacity.js */ \"./dist/browser/Options/Classes/GradientColorOpacity.js\");\n\n\nclass AnimatableGradientColor {\n opacity;\n stop;\n value;\n constructor(){\n this.stop = 0;\n this.value = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/AnimatableGradientColor.js?\n}");
47
47
 
48
48
  /***/ },
49
49
 
@@ -53,7 +53,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
53
53
  \*******************************************************/
54
54
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
55
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 _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 = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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?\n}");
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 _GradientAngleAnimation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GradientAngleAnimation.js */ \"./dist/browser/Options/Classes/GradientAngleAnimation.js\");\n\n\nclass GradientAngle {\n animation;\n direction;\n value;\n constructor(){\n this.value = 0;\n this.animation = new _GradientAngleAnimation_js__WEBPACK_IMPORTED_MODULE_1__.GradientAngleAnimation();\n this.direction = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientAngle.js?\n}");
57
57
 
58
58
  /***/ },
59
59
 
@@ -63,7 +63,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
63
63
  \****************************************************************/
64
64
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
65
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\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 ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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?\n}");
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\nclass GradientAngleAnimation {\n count;\n decay;\n delay;\n enable;\n speed;\n sync;\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 ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientAngleAnimation.js?\n}");
67
67
 
68
68
  /***/ },
69
69
 
@@ -73,7 +73,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
73
73
  \**************************************************************/
74
74
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
75
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 _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 ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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?\n}");
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 _GradientColorOpacityAnimation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GradientColorOpacityAnimation.js */ \"./dist/browser/Options/Classes/GradientColorOpacityAnimation.js\");\n\n\nclass GradientColorOpacity {\n animation;\n value;\n constructor(){\n this.value = 0;\n this.animation = new _GradientColorOpacityAnimation_js__WEBPACK_IMPORTED_MODULE_1__.GradientColorOpacityAnimation();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientColorOpacity.js?\n}");
77
77
 
78
78
  /***/ },
79
79
 
@@ -83,7 +83,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
83
83
  \***********************************************************************/
84
84
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
85
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\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 = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.random;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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?\n}");
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\nclass GradientColorOpacityAnimation {\n count;\n decay;\n delay;\n enable;\n speed;\n startValue;\n sync;\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 = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.random;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(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\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Options/Classes/GradientColorOpacityAnimation.js?\n}");
87
87
 
88
88
  /***/ },
89
89
 
@@ -93,7 +93,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
93
93
  \*******************************/
94
94
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
95
95
 
96
- 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\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, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.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, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.none, delta);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Utils.js?\n}");
96
+ 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\nfunction updateGradient(particle, delta) {\n const { gradient } = particle;\n if (!gradient) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, gradient.angle, false, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.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, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.none, delta);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-gradient/./dist/browser/Utils.js?\n}");
97
97
 
98
98
  /***/ }
99
99
 
@@ -2,6 +2,7 @@ import { AnimationStatus, GradientType, RotateDirection, StartValueType, doubleP
2
2
  import { AnimatableGradient } from "./Options/Classes/AnimatableGradient.js";
3
3
  import { updateGradient } from "./Utils.js";
4
4
  export class GradientUpdater {
5
+ _engine;
5
6
  constructor(engine) {
6
7
  this._engine = engine;
7
8
  }
@@ -55,6 +56,8 @@ export class GradientUpdater {
55
56
  case RotateDirection.clockwise:
56
57
  particle.gradient.angle.status = AnimationStatus.increasing;
57
58
  break;
59
+ default:
60
+ break;
58
61
  }
59
62
  const reduceDuplicates = particle.options.reduceDuplicates;
60
63
  for (const grColor of gradient.colors) {
@@ -79,8 +82,7 @@ export class GradientUpdater {
79
82
  time: 0,
80
83
  }
81
84
  : undefined,
82
- };
83
- const { opacity: addOpacity } = addColor;
85
+ }, { opacity: addOpacity } = addColor;
84
86
  if (grColor.opacity && addOpacity) {
85
87
  const opacityRange = grColor.opacity.value;
86
88
  addOpacity.min = getRangeMin(opacityRange);
@@ -98,8 +100,7 @@ export class GradientUpdater {
98
100
  case StartValueType.random:
99
101
  default:
100
102
  addOpacity.value = randomInRangeValue(addOpacity);
101
- addOpacity.status =
102
- getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
103
+ addOpacity.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
103
104
  break;
104
105
  }
105
106
  }
@@ -110,8 +111,7 @@ export class GradientUpdater {
110
111
  return (!particle.destroyed &&
111
112
  !particle.spawning &&
112
113
  (!!particle.gradient?.angle.enable ||
113
- (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
114
- false)));
114
+ (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ?? false)));
115
115
  }
116
116
  loadOptions(options, ...sources) {
117
117
  for (const source of sources) {
@@ -2,6 +2,9 @@ import { GradientType, isNull } from "@tsparticles/engine";
2
2
  import { AnimatableGradientColor } from "./AnimatableGradientColor.js";
3
3
  import { GradientAngle } from "./GradientAngle.js";
4
4
  export class AnimatableGradient {
5
+ angle;
6
+ colors;
7
+ type;
5
8
  constructor() {
6
9
  this.angle = new GradientAngle();
7
10
  this.colors = [];
@@ -1,6 +1,9 @@
1
1
  import { AnimatableColor, isNull, isNumber } from "@tsparticles/engine";
2
2
  import { GradientColorOpacity } from "./GradientColorOpacity.js";
3
3
  export class AnimatableGradientColor {
4
+ opacity;
5
+ stop;
6
+ value;
4
7
  constructor() {
5
8
  this.stop = 0;
6
9
  this.value = new AnimatableColor();
@@ -1,6 +1,9 @@
1
1
  import { RotateDirection, isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
+ animation;
5
+ direction;
6
+ value;
4
7
  constructor() {
5
8
  this.value = 0;
6
9
  this.animation = new GradientAngleAnimation();
@@ -1,5 +1,11 @@
1
1
  import { isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientAngleAnimation {
3
+ count;
4
+ decay;
5
+ delay;
6
+ enable;
7
+ speed;
8
+ sync;
3
9
  constructor() {
4
10
  this.count = 0;
5
11
  this.enable = false;
@@ -1,6 +1,8 @@
1
1
  import { isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.js";
3
3
  export class GradientColorOpacity {
4
+ animation;
5
+ value;
4
6
  constructor() {
5
7
  this.value = 0;
6
8
  this.animation = new GradientColorOpacityAnimation();
@@ -1,5 +1,12 @@
1
1
  import { StartValueType, isNull, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
+ count;
4
+ decay;
5
+ delay;
6
+ enable;
7
+ speed;
8
+ startValue;
9
+ sync;
3
10
  constructor() {
4
11
  this.count = 0;
5
12
  this.enable = false;
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadGradientUpdater(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(e => {
4
4
  e.addParticleUpdater("gradient", async () => {
5
5
  const { GradientUpdater } = await import("./GradientUpdater.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-gradient",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-beta.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": "4.0.0-alpha.5"
104
+ "@tsparticles/engine": "4.0.0-beta.0"
105
105
  },
106
106
  "publishConfig": {
107
107
  "access": "public"