@tsparticles/updater-gradient 3.0.3 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,14 +1,14 @@
1
- import { executeOnSingleOrMultiple, getHslAnimationFromHsl, getRandom, getRangeMax, getRangeMin, getRangeValue, getStyleFromHsl, itemFromSingleOrMultiple, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
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";
3
+ const double = 2, doublePI = Math.PI * double;
4
4
  export class GradientUpdater {
5
5
  getColorStyles(particle, context, radius, opacity) {
6
6
  const gradient = particle.gradient;
7
7
  if (!gradient) {
8
8
  return {};
9
9
  }
10
- const gradientAngle = gradient.angle.value, fillGradient = gradient.type === "radial"
11
- ? context.createRadialGradient(0, 0, 0, 0, 0, radius)
10
+ const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === "radial"
11
+ ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius)
12
12
  : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
13
13
  for (const { stop, value, opacity: cOpacity } of gradient.colors) {
14
14
  fillGradient.addColorStop(stop, getStyleFromHsl({
@@ -19,19 +19,21 @@ export class GradientUpdater {
19
19
  }
20
20
  return { fill: fillGradient };
21
21
  }
22
- init(particle) {
22
+ async init(particle) {
23
23
  const gradient = itemFromSingleOrMultiple(particle.options.gradient);
24
24
  if (!gradient) {
25
25
  return;
26
26
  }
27
- const { angle } = gradient;
27
+ const { angle } = gradient, speedFactor = 360, delayOffset = 1;
28
28
  particle.gradient = {
29
29
  angle: {
30
30
  value: getRangeValue(angle.value),
31
31
  enable: angle.animation.enable,
32
- velocity: (getRangeValue(angle.animation.speed) / 360) * particle.container.retina.reduceFactor,
33
- decay: 1 - getRangeValue(angle.animation.decay),
34
- delayTime: getRangeValue(angle.animation.delay) * 1000,
32
+ velocity: (getRangeValue(angle.animation.speed) / speedFactor) * particle.container.retina.reduceFactor,
33
+ decay: delayOffset - getRangeValue(angle.animation.decay),
34
+ delayTime: getRangeValue(angle.animation.delay) * millisecondsToSeconds,
35
+ max: doublePI,
36
+ min: 0,
35
37
  time: 0,
36
38
  },
37
39
  type: gradient.type,
@@ -39,7 +41,7 @@ export class GradientUpdater {
39
41
  };
40
42
  let rotateDirection = gradient.angle.direction;
41
43
  if (rotateDirection === "random") {
42
- rotateDirection = getRandom() > 0.5 ? "counter-clockwise" : "clockwise";
44
+ rotateDirection = getRandom() > halfRandom ? "counter-clockwise" : "clockwise";
43
45
  }
44
46
  switch (rotateDirection) {
45
47
  case "counter-clockwise":
@@ -66,10 +68,10 @@ export class GradientUpdater {
66
68
  min: getRangeMin(grColor.opacity.value),
67
69
  status: "increasing",
68
70
  value: getRangeValue(grColor.opacity.value),
69
- velocity: (getRangeValue(grColor.opacity.animation.speed) / 100) *
71
+ velocity: (getRangeValue(grColor.opacity.animation.speed) / percentDenominator) *
70
72
  particle.container.retina.reduceFactor,
71
- decay: 1 - getRangeValue(grColor.opacity.animation.decay),
72
- delayTime: getRangeValue(grColor.opacity.animation.delay) * 1000,
73
+ decay: delayOffset - getRangeValue(grColor.opacity.animation.decay),
74
+ delayTime: getRangeValue(grColor.opacity.animation.delay) * millisecondsToSeconds,
73
75
  time: 0,
74
76
  }
75
77
  : undefined,
@@ -93,17 +95,18 @@ export class GradientUpdater {
93
95
  default:
94
96
  addOpacity.value = randomInRange(addOpacity);
95
97
  addOpacity.status =
96
- getRandom() >= 0.5 ? "increasing" : "decreasing";
98
+ getRandom() >= halfRandom ? "increasing" : "decreasing";
97
99
  break;
98
100
  }
99
101
  }
100
102
  particle.gradient.colors.push(addColor);
101
103
  }
104
+ await Promise.resolve();
102
105
  }
103
106
  isEnabled(particle) {
104
107
  return (!particle.destroyed &&
105
108
  !particle.spawning &&
106
- (particle.gradient?.angle.enable ||
109
+ (!!particle.gradient?.angle.enable ||
107
110
  (particle.gradient?.colors.some((c) => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
108
111
  false)));
109
112
  }
@@ -123,7 +126,8 @@ export class GradientUpdater {
123
126
  });
124
127
  }
125
128
  }
126
- update(particle, delta) {
129
+ async update(particle, delta) {
130
+ const { updateGradient } = await import("./Utils.js");
127
131
  updateGradient(particle, delta);
128
132
  }
129
133
  }
package/browser/Utils.js CHANGED
@@ -1,107 +1,14 @@
1
- function updateColorOpacity(delta, value) {
2
- if (!value.enable) {
3
- return;
4
- }
5
- const decay = value.decay ?? 1;
6
- switch (value.status) {
7
- case "increasing":
8
- if (value.value >= value.max) {
9
- value.status = "decreasing";
10
- }
11
- else {
12
- value.value += (value.velocity ?? 0) * delta.factor;
13
- }
14
- break;
15
- case "decreasing":
16
- if (value.value <= value.min) {
17
- value.status = "increasing";
18
- }
19
- else {
20
- value.value -= (value.velocity ?? 0) * delta.factor;
21
- }
22
- break;
23
- }
24
- if (value.velocity && decay !== 1) {
25
- value.velocity *= decay;
26
- }
27
- }
28
- function updateColorValue(delta, colorValue, max, decrease) {
29
- if (!colorValue || !colorValue.enable) {
30
- return;
31
- }
32
- if (!colorValue.time) {
33
- colorValue.time = 0;
34
- }
35
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
36
- colorValue.time += delta.value;
37
- }
38
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
39
- return;
40
- }
41
- const velocity = (colorValue.velocity ?? 0) * delta.factor, decay = colorValue.decay ?? 1;
42
- if (!decrease || colorValue.status === "increasing") {
43
- colorValue.value += velocity;
44
- if (decrease && colorValue.value > max) {
45
- colorValue.status = "decreasing";
46
- colorValue.value -= colorValue.value % max;
47
- }
48
- }
49
- else {
50
- colorValue.value -= velocity;
51
- if (colorValue.value < 0) {
52
- colorValue.status = "increasing";
53
- colorValue.value += colorValue.value;
54
- }
55
- }
56
- if (colorValue.value > max) {
57
- colorValue.value %= max;
58
- }
59
- if (colorValue.velocity && decay !== 1) {
60
- colorValue.velocity *= decay;
61
- }
62
- }
63
- function updateAngle(delta, angle) {
64
- const speed = (angle.velocity ?? 0) * delta.factor, max = 2 * Math.PI, decay = angle.decay ?? 1;
65
- if (!angle.enable) {
66
- return;
67
- }
68
- switch (angle.status) {
69
- case "increasing":
70
- angle.value += speed;
71
- if (angle.value > max) {
72
- angle.value -= max;
73
- }
74
- break;
75
- case "decreasing":
76
- default:
77
- angle.value -= speed;
78
- if (angle.value < 0) {
79
- angle.value += max;
80
- }
81
- break;
82
- }
83
- if (angle.velocity && decay !== 1) {
84
- angle.velocity *= decay;
85
- }
86
- }
1
+ import { updateAnimation, updateColor } from "@tsparticles/engine";
87
2
  export function updateGradient(particle, delta) {
88
3
  const { gradient } = particle;
89
4
  if (!gradient) {
90
5
  return;
91
6
  }
92
- updateAngle(delta, gradient.angle);
7
+ updateAnimation(particle, gradient.angle, false, "none", delta);
93
8
  for (const color of gradient.colors) {
94
- if (particle.color?.h !== undefined) {
95
- updateColorValue(delta, color.value.h, 360, false);
96
- }
97
- if (particle.color?.s !== undefined) {
98
- updateColorValue(delta, color.value.s, 100, true);
99
- }
100
- if (particle.color?.l !== undefined) {
101
- updateColorValue(delta, color.value.l, 100, true);
102
- }
9
+ updateColor(color.value, delta);
103
10
  if (color.opacity) {
104
- updateColorOpacity(delta, color.opacity);
11
+ updateAnimation(particle, color.opacity, true, "none", delta);
105
12
  }
106
13
  }
107
14
  }
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,17 +1,40 @@
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");
29
+ const double = 2, doublePI = Math.PI * double;
7
30
  class GradientUpdater {
8
31
  getColorStyles(particle, context, radius, opacity) {
9
32
  const gradient = particle.gradient;
10
33
  if (!gradient) {
11
34
  return {};
12
35
  }
13
- const gradientAngle = gradient.angle.value, fillGradient = gradient.type === "radial"
14
- ? context.createRadialGradient(0, 0, 0, 0, 0, radius)
36
+ const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === "radial"
37
+ ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius)
15
38
  : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
16
39
  for (const { stop, value, opacity: cOpacity } of gradient.colors) {
17
40
  fillGradient.addColorStop(stop, (0, engine_1.getStyleFromHsl)({
@@ -22,19 +45,21 @@ class GradientUpdater {
22
45
  }
23
46
  return { fill: fillGradient };
24
47
  }
25
- init(particle) {
48
+ async init(particle) {
26
49
  const gradient = (0, engine_1.itemFromSingleOrMultiple)(particle.options.gradient);
27
50
  if (!gradient) {
28
51
  return;
29
52
  }
30
- const { angle } = gradient;
53
+ const { angle } = gradient, speedFactor = 360, delayOffset = 1;
31
54
  particle.gradient = {
32
55
  angle: {
33
56
  value: (0, engine_1.getRangeValue)(angle.value),
34
57
  enable: angle.animation.enable,
35
- velocity: ((0, engine_1.getRangeValue)(angle.animation.speed) / 360) * particle.container.retina.reduceFactor,
36
- decay: 1 - (0, engine_1.getRangeValue)(angle.animation.decay),
37
- delayTime: (0, engine_1.getRangeValue)(angle.animation.delay) * 1000,
58
+ velocity: ((0, engine_1.getRangeValue)(angle.animation.speed) / speedFactor) * particle.container.retina.reduceFactor,
59
+ decay: delayOffset - (0, engine_1.getRangeValue)(angle.animation.decay),
60
+ delayTime: (0, engine_1.getRangeValue)(angle.animation.delay) * engine_1.millisecondsToSeconds,
61
+ max: doublePI,
62
+ min: 0,
38
63
  time: 0,
39
64
  },
40
65
  type: gradient.type,
@@ -42,7 +67,7 @@ class GradientUpdater {
42
67
  };
43
68
  let rotateDirection = gradient.angle.direction;
44
69
  if (rotateDirection === "random") {
45
- rotateDirection = (0, engine_1.getRandom)() > 0.5 ? "counter-clockwise" : "clockwise";
70
+ rotateDirection = (0, engine_1.getRandom)() > engine_1.halfRandom ? "counter-clockwise" : "clockwise";
46
71
  }
47
72
  switch (rotateDirection) {
48
73
  case "counter-clockwise":
@@ -69,10 +94,10 @@ class GradientUpdater {
69
94
  min: (0, engine_1.getRangeMin)(grColor.opacity.value),
70
95
  status: "increasing",
71
96
  value: (0, engine_1.getRangeValue)(grColor.opacity.value),
72
- velocity: ((0, engine_1.getRangeValue)(grColor.opacity.animation.speed) / 100) *
97
+ velocity: ((0, engine_1.getRangeValue)(grColor.opacity.animation.speed) / engine_1.percentDenominator) *
73
98
  particle.container.retina.reduceFactor,
74
- decay: 1 - (0, engine_1.getRangeValue)(grColor.opacity.animation.decay),
75
- delayTime: (0, engine_1.getRangeValue)(grColor.opacity.animation.delay) * 1000,
99
+ decay: delayOffset - (0, engine_1.getRangeValue)(grColor.opacity.animation.decay),
100
+ delayTime: (0, engine_1.getRangeValue)(grColor.opacity.animation.delay) * engine_1.millisecondsToSeconds,
76
101
  time: 0,
77
102
  }
78
103
  : undefined,
@@ -96,17 +121,18 @@ class GradientUpdater {
96
121
  default:
97
122
  addOpacity.value = (0, engine_1.randomInRange)(addOpacity);
98
123
  addOpacity.status =
99
- (0, engine_1.getRandom)() >= 0.5 ? "increasing" : "decreasing";
124
+ (0, engine_1.getRandom)() >= engine_1.halfRandom ? "increasing" : "decreasing";
100
125
  break;
101
126
  }
102
127
  }
103
128
  particle.gradient.colors.push(addColor);
104
129
  }
130
+ await Promise.resolve();
105
131
  }
106
132
  isEnabled(particle) {
107
133
  return (!particle.destroyed &&
108
134
  !particle.spawning &&
109
- (particle.gradient?.angle.enable ||
135
+ (!!particle.gradient?.angle.enable ||
110
136
  (particle.gradient?.colors.some((c) => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
111
137
  false)));
112
138
  }
@@ -126,8 +152,9 @@ class GradientUpdater {
126
152
  });
127
153
  }
128
154
  }
129
- update(particle, delta) {
130
- (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);
131
158
  }
132
159
  }
133
160
  exports.GradientUpdater = GradientUpdater;
package/cjs/Utils.js CHANGED
@@ -1,110 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateGradient = void 0;
4
- function updateColorOpacity(delta, value) {
5
- if (!value.enable) {
6
- return;
7
- }
8
- const decay = value.decay ?? 1;
9
- switch (value.status) {
10
- case "increasing":
11
- if (value.value >= value.max) {
12
- value.status = "decreasing";
13
- }
14
- else {
15
- value.value += (value.velocity ?? 0) * delta.factor;
16
- }
17
- break;
18
- case "decreasing":
19
- if (value.value <= value.min) {
20
- value.status = "increasing";
21
- }
22
- else {
23
- value.value -= (value.velocity ?? 0) * delta.factor;
24
- }
25
- break;
26
- }
27
- if (value.velocity && decay !== 1) {
28
- value.velocity *= decay;
29
- }
30
- }
31
- function updateColorValue(delta, colorValue, max, decrease) {
32
- if (!colorValue || !colorValue.enable) {
33
- return;
34
- }
35
- if (!colorValue.time) {
36
- colorValue.time = 0;
37
- }
38
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
39
- colorValue.time += delta.value;
40
- }
41
- if ((colorValue.delayTime ?? 0) > 0 && colorValue.time < (colorValue.delayTime ?? 0)) {
42
- return;
43
- }
44
- const velocity = (colorValue.velocity ?? 0) * delta.factor, decay = colorValue.decay ?? 1;
45
- if (!decrease || colorValue.status === "increasing") {
46
- colorValue.value += velocity;
47
- if (decrease && colorValue.value > max) {
48
- colorValue.status = "decreasing";
49
- colorValue.value -= colorValue.value % max;
50
- }
51
- }
52
- else {
53
- colorValue.value -= velocity;
54
- if (colorValue.value < 0) {
55
- colorValue.status = "increasing";
56
- colorValue.value += colorValue.value;
57
- }
58
- }
59
- if (colorValue.value > max) {
60
- colorValue.value %= max;
61
- }
62
- if (colorValue.velocity && decay !== 1) {
63
- colorValue.velocity *= decay;
64
- }
65
- }
66
- function updateAngle(delta, angle) {
67
- const speed = (angle.velocity ?? 0) * delta.factor, max = 2 * Math.PI, decay = angle.decay ?? 1;
68
- if (!angle.enable) {
69
- return;
70
- }
71
- switch (angle.status) {
72
- case "increasing":
73
- angle.value += speed;
74
- if (angle.value > max) {
75
- angle.value -= max;
76
- }
77
- break;
78
- case "decreasing":
79
- default:
80
- angle.value -= speed;
81
- if (angle.value < 0) {
82
- angle.value += max;
83
- }
84
- break;
85
- }
86
- if (angle.velocity && decay !== 1) {
87
- angle.velocity *= decay;
88
- }
89
- }
4
+ const engine_1 = require("@tsparticles/engine");
90
5
  function updateGradient(particle, delta) {
91
6
  const { gradient } = particle;
92
7
  if (!gradient) {
93
8
  return;
94
9
  }
95
- updateAngle(delta, gradient.angle);
10
+ (0, engine_1.updateAnimation)(particle, gradient.angle, false, "none", delta);
96
11
  for (const color of gradient.colors) {
97
- if (particle.color?.h !== undefined) {
98
- updateColorValue(delta, color.value.h, 360, false);
99
- }
100
- if (particle.color?.s !== undefined) {
101
- updateColorValue(delta, color.value.s, 100, true);
102
- }
103
- if (particle.color?.l !== undefined) {
104
- updateColorValue(delta, color.value.l, 100, true);
105
- }
12
+ (0, engine_1.updateColor)(color.value, delta);
106
13
  if (color.opacity) {
107
- updateColorOpacity(delta, color.opacity);
14
+ (0, engine_1.updateAnimation)(particle, color.opacity, true, "none", delta);
108
15
  }
109
16
  }
110
17
  }
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
+ }]);