@tsparticles/updater-gradient 4.1.2 → 4.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.
Files changed (37) hide show
  1. package/browser/Options/Classes/AnimatableGradient.js +5 -12
  2. package/browser/Options/Classes/AnimatableGradientColor.js +4 -10
  3. package/browser/Options/Classes/GradientAngle.js +6 -15
  4. package/browser/Options/Classes/GradientAngleAnimation.js +13 -33
  5. package/browser/Options/Classes/GradientColorOpacity.js +4 -10
  6. package/browser/Options/Classes/GradientColorOpacityAnimation.js +15 -38
  7. package/browser/Utils.js +2 -1
  8. package/browser/index.js +1 -1
  9. package/browser/index.lazy.js +1 -1
  10. package/cjs/Options/Classes/AnimatableGradient.js +5 -12
  11. package/cjs/Options/Classes/AnimatableGradientColor.js +4 -10
  12. package/cjs/Options/Classes/GradientAngle.js +6 -15
  13. package/cjs/Options/Classes/GradientAngleAnimation.js +13 -33
  14. package/cjs/Options/Classes/GradientColorOpacity.js +4 -10
  15. package/cjs/Options/Classes/GradientColorOpacityAnimation.js +15 -38
  16. package/cjs/Utils.js +2 -1
  17. package/cjs/index.js +1 -1
  18. package/cjs/index.lazy.js +1 -1
  19. package/esm/Options/Classes/AnimatableGradient.js +5 -12
  20. package/esm/Options/Classes/AnimatableGradientColor.js +4 -10
  21. package/esm/Options/Classes/GradientAngle.js +6 -15
  22. package/esm/Options/Classes/GradientAngleAnimation.js +13 -33
  23. package/esm/Options/Classes/GradientColorOpacity.js +4 -10
  24. package/esm/Options/Classes/GradientColorOpacityAnimation.js +15 -38
  25. package/esm/Utils.js +2 -1
  26. package/esm/index.js +1 -1
  27. package/esm/index.lazy.js +1 -1
  28. package/package.json +5 -2
  29. package/report.html +1 -1
  30. package/tsparticles.updater.gradient.js +49 -120
  31. package/tsparticles.updater.gradient.min.js +1 -1
  32. package/types/Options/Classes/AnimatableGradient.d.ts +1 -2
  33. package/types/Options/Classes/AnimatableGradientColor.d.ts +0 -1
  34. package/types/Options/Classes/GradientAngle.d.ts +1 -2
  35. package/types/Options/Classes/GradientAngleAnimation.d.ts +0 -1
  36. package/types/Options/Classes/GradientColorOpacity.d.ts +1 -2
  37. package/types/Options/Classes/GradientColorOpacityAnimation.d.ts +0 -1
@@ -1,15 +1,10 @@
1
- import { GradientType, isNull } from "@tsparticles/engine";
1
+ import { GradientType, isNull, loadProperty } 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;
8
- constructor() {
9
- this.angle = new GradientAngle();
10
- this.colors = [];
11
- this.type = GradientType.random;
12
- }
5
+ angle = new GradientAngle();
6
+ colors = [];
7
+ type = GradientType.random;
13
8
  load(data) {
14
9
  if (isNull(data)) {
15
10
  return;
@@ -22,8 +17,6 @@ export class AnimatableGradient {
22
17
  return tmp;
23
18
  });
24
19
  }
25
- if (data.type !== undefined) {
26
- this.type = data.type;
27
- }
20
+ loadProperty(this, "type", data.type);
28
21
  }
29
22
  }
@@ -1,20 +1,14 @@
1
- import { AnimatableColor, isNull, isNumber } from "@tsparticles/engine";
1
+ import { AnimatableColor, isNull, isNumber, loadProperty, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacity } from "./GradientColorOpacity.js";
3
3
  export class AnimatableGradientColor {
4
4
  opacity;
5
- stop;
6
- value;
7
- constructor() {
8
- this.stop = 0;
9
- this.value = new AnimatableColor();
10
- }
5
+ stop = 0;
6
+ value = new AnimatableColor();
11
7
  load(data) {
12
8
  if (isNull(data)) {
13
9
  return;
14
10
  }
15
- if (data.stop !== undefined) {
16
- this.stop = data.stop;
17
- }
11
+ loadProperty(this, "stop", data.stop);
18
12
  this.value = AnimatableColor.create(this.value, data.value);
19
13
  if (data.opacity !== undefined) {
20
14
  this.opacity = new GradientColorOpacity();
@@ -1,24 +1,15 @@
1
- import { RotateDirection, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { RotateDirection, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
- animation;
5
- direction;
6
- value;
7
- constructor() {
8
- this.value = 0;
9
- this.animation = new GradientAngleAnimation();
10
- this.direction = RotateDirection.clockwise;
11
- }
4
+ animation = new GradientAngleAnimation();
5
+ direction = RotateDirection.clockwise;
6
+ value = 0;
12
7
  load(data) {
13
8
  if (isNull(data)) {
14
9
  return;
15
10
  }
16
11
  this.animation.load(data.animation);
17
- if (data.value !== undefined) {
18
- this.value = setRangeValue(data.value);
19
- }
20
- if (data.direction !== undefined) {
21
- this.direction = data.direction;
22
- }
12
+ loadRangeProperty(this, "value", data.value);
13
+ loadProperty(this, "direction", data.direction);
23
14
  }
24
15
  }
@@ -1,40 +1,20 @@
1
- import { isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class GradientAngleAnimation {
3
- count;
4
- decay;
5
- delay;
6
- enable;
7
- speed;
8
- sync;
9
- constructor() {
10
- this.count = 0;
11
- this.enable = false;
12
- this.speed = 0;
13
- this.decay = 0;
14
- this.delay = 0;
15
- this.sync = false;
16
- }
3
+ count = 0;
4
+ decay = 0;
5
+ delay = 0;
6
+ enable = false;
7
+ speed = 0;
8
+ sync = false;
17
9
  load(data) {
18
10
  if (isNull(data)) {
19
11
  return;
20
12
  }
21
- if (data.count !== undefined) {
22
- this.count = setRangeValue(data.count);
23
- }
24
- if (data.enable !== undefined) {
25
- this.enable = data.enable;
26
- }
27
- if (data.speed !== undefined) {
28
- this.speed = setRangeValue(data.speed);
29
- }
30
- if (data.decay !== undefined) {
31
- this.decay = setRangeValue(data.decay);
32
- }
33
- if (data.delay !== undefined) {
34
- this.delay = setRangeValue(data.delay);
35
- }
36
- if (data.sync !== undefined) {
37
- this.sync = data.sync;
38
- }
13
+ loadRangeProperty(this, "count", data.count);
14
+ loadProperty(this, "enable", data.enable);
15
+ loadRangeProperty(this, "speed", data.speed);
16
+ loadRangeProperty(this, "decay", data.decay);
17
+ loadRangeProperty(this, "delay", data.delay);
18
+ loadProperty(this, "sync", data.sync);
39
19
  }
40
20
  }
@@ -1,19 +1,13 @@
1
- import { isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { isNull, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.js";
3
3
  export class GradientColorOpacity {
4
- animation;
5
- value;
6
- constructor() {
7
- this.value = 0;
8
- this.animation = new GradientColorOpacityAnimation();
9
- }
4
+ animation = new GradientColorOpacityAnimation();
5
+ value = 0;
10
6
  load(data) {
11
7
  if (isNull(data)) {
12
8
  return;
13
9
  }
14
10
  this.animation.load(data.animation);
15
- if (data.value !== undefined) {
16
- this.value = setRangeValue(data.value);
17
- }
11
+ loadRangeProperty(this, "value", data.value);
18
12
  }
19
13
  }
@@ -1,45 +1,22 @@
1
- import { StartValueType, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { StartValueType, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
- count;
4
- decay;
5
- delay;
6
- enable;
7
- speed;
8
- startValue;
9
- sync;
10
- constructor() {
11
- this.count = 0;
12
- this.enable = false;
13
- this.speed = 0;
14
- this.decay = 0;
15
- this.delay = 0;
16
- this.sync = false;
17
- this.startValue = StartValueType.random;
18
- }
3
+ count = 0;
4
+ decay = 0;
5
+ delay = 0;
6
+ enable = false;
7
+ speed = 0;
8
+ startValue = StartValueType.random;
9
+ sync = false;
19
10
  load(data) {
20
11
  if (isNull(data)) {
21
12
  return;
22
13
  }
23
- if (data.count !== undefined) {
24
- this.count = setRangeValue(data.count);
25
- }
26
- if (data.enable !== undefined) {
27
- this.enable = data.enable;
28
- }
29
- if (data.speed !== undefined) {
30
- this.speed = setRangeValue(data.speed);
31
- }
32
- if (data.sync !== undefined) {
33
- this.sync = data.sync;
34
- }
35
- if (data.startValue !== undefined) {
36
- this.startValue = data.startValue;
37
- }
38
- if (data.decay !== undefined) {
39
- this.decay = setRangeValue(data.decay);
40
- }
41
- if (data.delay !== undefined) {
42
- this.delay = setRangeValue(data.delay);
43
- }
14
+ loadRangeProperty(this, "count", data.count);
15
+ loadProperty(this, "enable", data.enable);
16
+ loadRangeProperty(this, "speed", data.speed);
17
+ loadProperty(this, "sync", data.sync);
18
+ loadProperty(this, "startValue", data.startValue);
19
+ loadRangeProperty(this, "decay", data.decay);
20
+ loadRangeProperty(this, "delay", data.delay);
44
21
  }
45
22
  }
package/browser/Utils.js CHANGED
@@ -1,4 +1,5 @@
1
- import { DestroyType, updateAnimation, updateColor } from "@tsparticles/engine";
1
+ import { DestroyType, updateColor } from "@tsparticles/engine";
2
+ import { updateAnimation } from "@tsparticles/animation-utils";
2
3
  export function updateGradient(particle, delta) {
3
4
  const { gradient } = particle;
4
5
  if (!gradient) {
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GradientUpdater } from "./GradientUpdater.js";
2
2
  export async function loadGradientUpdater(engine) {
3
- engine.checkVersion("4.1.2");
3
+ engine.checkVersion("4.2.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("gradient", container => {
6
6
  return Promise.resolve(new GradientUpdater(e.pluginManager, container));
@@ -1,5 +1,5 @@
1
1
  export async function loadGradientUpdater(engine) {
2
- engine.checkVersion("4.1.2");
2
+ engine.checkVersion("4.2.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("gradient", async (container) => {
5
5
  const { GradientUpdater } = await import("./GradientUpdater.js");
@@ -1,15 +1,10 @@
1
- import { GradientType, isNull } from "@tsparticles/engine";
1
+ import { GradientType, isNull, loadProperty } 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;
8
- constructor() {
9
- this.angle = new GradientAngle();
10
- this.colors = [];
11
- this.type = GradientType.random;
12
- }
5
+ angle = new GradientAngle();
6
+ colors = [];
7
+ type = GradientType.random;
13
8
  load(data) {
14
9
  if (isNull(data)) {
15
10
  return;
@@ -22,8 +17,6 @@ export class AnimatableGradient {
22
17
  return tmp;
23
18
  });
24
19
  }
25
- if (data.type !== undefined) {
26
- this.type = data.type;
27
- }
20
+ loadProperty(this, "type", data.type);
28
21
  }
29
22
  }
@@ -1,20 +1,14 @@
1
- import { AnimatableColor, isNull, isNumber } from "@tsparticles/engine";
1
+ import { AnimatableColor, isNull, isNumber, loadProperty, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacity } from "./GradientColorOpacity.js";
3
3
  export class AnimatableGradientColor {
4
4
  opacity;
5
- stop;
6
- value;
7
- constructor() {
8
- this.stop = 0;
9
- this.value = new AnimatableColor();
10
- }
5
+ stop = 0;
6
+ value = new AnimatableColor();
11
7
  load(data) {
12
8
  if (isNull(data)) {
13
9
  return;
14
10
  }
15
- if (data.stop !== undefined) {
16
- this.stop = data.stop;
17
- }
11
+ loadProperty(this, "stop", data.stop);
18
12
  this.value = AnimatableColor.create(this.value, data.value);
19
13
  if (data.opacity !== undefined) {
20
14
  this.opacity = new GradientColorOpacity();
@@ -1,24 +1,15 @@
1
- import { RotateDirection, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { RotateDirection, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
- animation;
5
- direction;
6
- value;
7
- constructor() {
8
- this.value = 0;
9
- this.animation = new GradientAngleAnimation();
10
- this.direction = RotateDirection.clockwise;
11
- }
4
+ animation = new GradientAngleAnimation();
5
+ direction = RotateDirection.clockwise;
6
+ value = 0;
12
7
  load(data) {
13
8
  if (isNull(data)) {
14
9
  return;
15
10
  }
16
11
  this.animation.load(data.animation);
17
- if (data.value !== undefined) {
18
- this.value = setRangeValue(data.value);
19
- }
20
- if (data.direction !== undefined) {
21
- this.direction = data.direction;
22
- }
12
+ loadRangeProperty(this, "value", data.value);
13
+ loadProperty(this, "direction", data.direction);
23
14
  }
24
15
  }
@@ -1,40 +1,20 @@
1
- import { isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class GradientAngleAnimation {
3
- count;
4
- decay;
5
- delay;
6
- enable;
7
- speed;
8
- sync;
9
- constructor() {
10
- this.count = 0;
11
- this.enable = false;
12
- this.speed = 0;
13
- this.decay = 0;
14
- this.delay = 0;
15
- this.sync = false;
16
- }
3
+ count = 0;
4
+ decay = 0;
5
+ delay = 0;
6
+ enable = false;
7
+ speed = 0;
8
+ sync = false;
17
9
  load(data) {
18
10
  if (isNull(data)) {
19
11
  return;
20
12
  }
21
- if (data.count !== undefined) {
22
- this.count = setRangeValue(data.count);
23
- }
24
- if (data.enable !== undefined) {
25
- this.enable = data.enable;
26
- }
27
- if (data.speed !== undefined) {
28
- this.speed = setRangeValue(data.speed);
29
- }
30
- if (data.decay !== undefined) {
31
- this.decay = setRangeValue(data.decay);
32
- }
33
- if (data.delay !== undefined) {
34
- this.delay = setRangeValue(data.delay);
35
- }
36
- if (data.sync !== undefined) {
37
- this.sync = data.sync;
38
- }
13
+ loadRangeProperty(this, "count", data.count);
14
+ loadProperty(this, "enable", data.enable);
15
+ loadRangeProperty(this, "speed", data.speed);
16
+ loadRangeProperty(this, "decay", data.decay);
17
+ loadRangeProperty(this, "delay", data.delay);
18
+ loadProperty(this, "sync", data.sync);
39
19
  }
40
20
  }
@@ -1,19 +1,13 @@
1
- import { isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { isNull, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.js";
3
3
  export class GradientColorOpacity {
4
- animation;
5
- value;
6
- constructor() {
7
- this.value = 0;
8
- this.animation = new GradientColorOpacityAnimation();
9
- }
4
+ animation = new GradientColorOpacityAnimation();
5
+ value = 0;
10
6
  load(data) {
11
7
  if (isNull(data)) {
12
8
  return;
13
9
  }
14
10
  this.animation.load(data.animation);
15
- if (data.value !== undefined) {
16
- this.value = setRangeValue(data.value);
17
- }
11
+ loadRangeProperty(this, "value", data.value);
18
12
  }
19
13
  }
@@ -1,45 +1,22 @@
1
- import { StartValueType, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { StartValueType, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
- count;
4
- decay;
5
- delay;
6
- enable;
7
- speed;
8
- startValue;
9
- sync;
10
- constructor() {
11
- this.count = 0;
12
- this.enable = false;
13
- this.speed = 0;
14
- this.decay = 0;
15
- this.delay = 0;
16
- this.sync = false;
17
- this.startValue = StartValueType.random;
18
- }
3
+ count = 0;
4
+ decay = 0;
5
+ delay = 0;
6
+ enable = false;
7
+ speed = 0;
8
+ startValue = StartValueType.random;
9
+ sync = false;
19
10
  load(data) {
20
11
  if (isNull(data)) {
21
12
  return;
22
13
  }
23
- if (data.count !== undefined) {
24
- this.count = setRangeValue(data.count);
25
- }
26
- if (data.enable !== undefined) {
27
- this.enable = data.enable;
28
- }
29
- if (data.speed !== undefined) {
30
- this.speed = setRangeValue(data.speed);
31
- }
32
- if (data.sync !== undefined) {
33
- this.sync = data.sync;
34
- }
35
- if (data.startValue !== undefined) {
36
- this.startValue = data.startValue;
37
- }
38
- if (data.decay !== undefined) {
39
- this.decay = setRangeValue(data.decay);
40
- }
41
- if (data.delay !== undefined) {
42
- this.delay = setRangeValue(data.delay);
43
- }
14
+ loadRangeProperty(this, "count", data.count);
15
+ loadProperty(this, "enable", data.enable);
16
+ loadRangeProperty(this, "speed", data.speed);
17
+ loadProperty(this, "sync", data.sync);
18
+ loadProperty(this, "startValue", data.startValue);
19
+ loadRangeProperty(this, "decay", data.decay);
20
+ loadRangeProperty(this, "delay", data.delay);
44
21
  }
45
22
  }
package/cjs/Utils.js CHANGED
@@ -1,4 +1,5 @@
1
- import { DestroyType, updateAnimation, updateColor } from "@tsparticles/engine";
1
+ import { DestroyType, updateColor } from "@tsparticles/engine";
2
+ import { updateAnimation } from "@tsparticles/animation-utils";
2
3
  export function updateGradient(particle, delta) {
3
4
  const { gradient } = particle;
4
5
  if (!gradient) {
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GradientUpdater } from "./GradientUpdater.js";
2
2
  export async function loadGradientUpdater(engine) {
3
- engine.checkVersion("4.1.2");
3
+ engine.checkVersion("4.2.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("gradient", container => {
6
6
  return Promise.resolve(new GradientUpdater(e.pluginManager, container));
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadGradientUpdater(engine) {
2
- engine.checkVersion("4.1.2");
2
+ engine.checkVersion("4.2.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("gradient", async (container) => {
5
5
  const { GradientUpdater } = await import("./GradientUpdater.js");
@@ -1,15 +1,10 @@
1
- import { GradientType, isNull } from "@tsparticles/engine";
1
+ import { GradientType, isNull, loadProperty } 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;
8
- constructor() {
9
- this.angle = new GradientAngle();
10
- this.colors = [];
11
- this.type = GradientType.random;
12
- }
5
+ angle = new GradientAngle();
6
+ colors = [];
7
+ type = GradientType.random;
13
8
  load(data) {
14
9
  if (isNull(data)) {
15
10
  return;
@@ -22,8 +17,6 @@ export class AnimatableGradient {
22
17
  return tmp;
23
18
  });
24
19
  }
25
- if (data.type !== undefined) {
26
- this.type = data.type;
27
- }
20
+ loadProperty(this, "type", data.type);
28
21
  }
29
22
  }
@@ -1,20 +1,14 @@
1
- import { AnimatableColor, isNull, isNumber } from "@tsparticles/engine";
1
+ import { AnimatableColor, isNull, isNumber, loadProperty, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacity } from "./GradientColorOpacity.js";
3
3
  export class AnimatableGradientColor {
4
4
  opacity;
5
- stop;
6
- value;
7
- constructor() {
8
- this.stop = 0;
9
- this.value = new AnimatableColor();
10
- }
5
+ stop = 0;
6
+ value = new AnimatableColor();
11
7
  load(data) {
12
8
  if (isNull(data)) {
13
9
  return;
14
10
  }
15
- if (data.stop !== undefined) {
16
- this.stop = data.stop;
17
- }
11
+ loadProperty(this, "stop", data.stop);
18
12
  this.value = AnimatableColor.create(this.value, data.value);
19
13
  if (data.opacity !== undefined) {
20
14
  this.opacity = new GradientColorOpacity();
@@ -1,24 +1,15 @@
1
- import { RotateDirection, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { RotateDirection, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
- animation;
5
- direction;
6
- value;
7
- constructor() {
8
- this.value = 0;
9
- this.animation = new GradientAngleAnimation();
10
- this.direction = RotateDirection.clockwise;
11
- }
4
+ animation = new GradientAngleAnimation();
5
+ direction = RotateDirection.clockwise;
6
+ value = 0;
12
7
  load(data) {
13
8
  if (isNull(data)) {
14
9
  return;
15
10
  }
16
11
  this.animation.load(data.animation);
17
- if (data.value !== undefined) {
18
- this.value = setRangeValue(data.value);
19
- }
20
- if (data.direction !== undefined) {
21
- this.direction = data.direction;
22
- }
12
+ loadRangeProperty(this, "value", data.value);
13
+ loadProperty(this, "direction", data.direction);
23
14
  }
24
15
  }
@@ -1,40 +1,20 @@
1
- import { isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class GradientAngleAnimation {
3
- count;
4
- decay;
5
- delay;
6
- enable;
7
- speed;
8
- sync;
9
- constructor() {
10
- this.count = 0;
11
- this.enable = false;
12
- this.speed = 0;
13
- this.decay = 0;
14
- this.delay = 0;
15
- this.sync = false;
16
- }
3
+ count = 0;
4
+ decay = 0;
5
+ delay = 0;
6
+ enable = false;
7
+ speed = 0;
8
+ sync = false;
17
9
  load(data) {
18
10
  if (isNull(data)) {
19
11
  return;
20
12
  }
21
- if (data.count !== undefined) {
22
- this.count = setRangeValue(data.count);
23
- }
24
- if (data.enable !== undefined) {
25
- this.enable = data.enable;
26
- }
27
- if (data.speed !== undefined) {
28
- this.speed = setRangeValue(data.speed);
29
- }
30
- if (data.decay !== undefined) {
31
- this.decay = setRangeValue(data.decay);
32
- }
33
- if (data.delay !== undefined) {
34
- this.delay = setRangeValue(data.delay);
35
- }
36
- if (data.sync !== undefined) {
37
- this.sync = data.sync;
38
- }
13
+ loadRangeProperty(this, "count", data.count);
14
+ loadProperty(this, "enable", data.enable);
15
+ loadRangeProperty(this, "speed", data.speed);
16
+ loadRangeProperty(this, "decay", data.decay);
17
+ loadRangeProperty(this, "delay", data.delay);
18
+ loadProperty(this, "sync", data.sync);
39
19
  }
40
20
  }
@@ -1,19 +1,13 @@
1
- import { isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { isNull, loadRangeProperty, } from "@tsparticles/engine";
2
2
  import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.js";
3
3
  export class GradientColorOpacity {
4
- animation;
5
- value;
6
- constructor() {
7
- this.value = 0;
8
- this.animation = new GradientColorOpacityAnimation();
9
- }
4
+ animation = new GradientColorOpacityAnimation();
5
+ value = 0;
10
6
  load(data) {
11
7
  if (isNull(data)) {
12
8
  return;
13
9
  }
14
10
  this.animation.load(data.animation);
15
- if (data.value !== undefined) {
16
- this.value = setRangeValue(data.value);
17
- }
11
+ loadRangeProperty(this, "value", data.value);
18
12
  }
19
13
  }
@@ -1,45 +1,22 @@
1
- import { StartValueType, isNull, setRangeValue, } from "@tsparticles/engine";
1
+ import { StartValueType, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
- count;
4
- decay;
5
- delay;
6
- enable;
7
- speed;
8
- startValue;
9
- sync;
10
- constructor() {
11
- this.count = 0;
12
- this.enable = false;
13
- this.speed = 0;
14
- this.decay = 0;
15
- this.delay = 0;
16
- this.sync = false;
17
- this.startValue = StartValueType.random;
18
- }
3
+ count = 0;
4
+ decay = 0;
5
+ delay = 0;
6
+ enable = false;
7
+ speed = 0;
8
+ startValue = StartValueType.random;
9
+ sync = false;
19
10
  load(data) {
20
11
  if (isNull(data)) {
21
12
  return;
22
13
  }
23
- if (data.count !== undefined) {
24
- this.count = setRangeValue(data.count);
25
- }
26
- if (data.enable !== undefined) {
27
- this.enable = data.enable;
28
- }
29
- if (data.speed !== undefined) {
30
- this.speed = setRangeValue(data.speed);
31
- }
32
- if (data.sync !== undefined) {
33
- this.sync = data.sync;
34
- }
35
- if (data.startValue !== undefined) {
36
- this.startValue = data.startValue;
37
- }
38
- if (data.decay !== undefined) {
39
- this.decay = setRangeValue(data.decay);
40
- }
41
- if (data.delay !== undefined) {
42
- this.delay = setRangeValue(data.delay);
43
- }
14
+ loadRangeProperty(this, "count", data.count);
15
+ loadProperty(this, "enable", data.enable);
16
+ loadRangeProperty(this, "speed", data.speed);
17
+ loadProperty(this, "sync", data.sync);
18
+ loadProperty(this, "startValue", data.startValue);
19
+ loadRangeProperty(this, "decay", data.decay);
20
+ loadRangeProperty(this, "delay", data.delay);
44
21
  }
45
22
  }
package/esm/Utils.js CHANGED
@@ -1,4 +1,5 @@
1
- import { DestroyType, updateAnimation, updateColor } from "@tsparticles/engine";
1
+ import { DestroyType, updateColor } from "@tsparticles/engine";
2
+ import { updateAnimation } from "@tsparticles/animation-utils";
2
3
  export function updateGradient(particle, delta) {
3
4
  const { gradient } = particle;
4
5
  if (!gradient) {
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GradientUpdater } from "./GradientUpdater.js";
2
2
  export async function loadGradientUpdater(engine) {
3
- engine.checkVersion("4.1.2");
3
+ engine.checkVersion("4.2.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addParticleUpdater("gradient", container => {
6
6
  return Promise.resolve(new GradientUpdater(e.pluginManager, container));
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadGradientUpdater(engine) {
2
- engine.checkVersion("4.1.2");
2
+ engine.checkVersion("4.2.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addParticleUpdater("gradient", async (container) => {
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.1.2",
3
+ "version": "4.2.0",
4
4
  "description": "tsParticles particles gradient updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -106,8 +106,11 @@
106
106
  },
107
107
  "./package.json": "./package.json"
108
108
  },
109
+ "dependencies": {
110
+ "@tsparticles/animation-utils": "4.2.0"
111
+ },
109
112
  "peerDependencies": {
110
- "@tsparticles/engine": "4.1.2"
113
+ "@tsparticles/engine": "4.2.0"
111
114
  },
112
115
  "publishConfig": {
113
116
  "access": "public"
package/report.html CHANGED
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
4930
4930
  </script>
4931
4931
  <script>
4932
4932
  /*<!--*/
4933
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.updater.gradient.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"d3a68c52-1","name":"GradientColorOpacityAnimation.js"},{"uid":"d3a68c52-3","name":"GradientColorOpacity.js"},{"uid":"d3a68c52-5","name":"AnimatableGradientColor.js"},{"uid":"d3a68c52-7","name":"GradientAngleAnimation.js"},{"uid":"d3a68c52-9","name":"GradientAngle.js"},{"uid":"d3a68c52-11","name":"AnimatableGradient.js"}]},{"uid":"d3a68c52-13","name":"Utils.js"},{"uid":"d3a68c52-15","name":"GradientUpdater.js"},{"uid":"d3a68c52-17","name":"index.js"},{"uid":"d3a68c52-19","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"d3a68c52-1":{"renderedLength":1331,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-0"},"d3a68c52-3":{"renderedLength":478,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-2"},"d3a68c52-5":{"renderedLength":826,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-4"},"d3a68c52-7":{"renderedLength":1130,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-6"},"d3a68c52-9":{"renderedLength":657,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-8"},"d3a68c52-11":{"renderedLength":748,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-10"},"d3a68c52-13":{"renderedLength":502,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-12"},"d3a68c52-15":{"renderedLength":6816,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-14"},"d3a68c52-17":{"renderedLength":334,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-16"},"d3a68c52-19":{"renderedLength":181,"gzipLength":0,"brotliLength":0,"metaUid":"d3a68c52-18"}},"nodeMetas":{"d3a68c52-0":{"id":"/dist/browser/Options/Classes/GradientColorOpacityAnimation.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-1"},"imported":[{"uid":"d3a68c52-20"}],"importedBy":[{"uid":"d3a68c52-2"}]},"d3a68c52-2":{"id":"/dist/browser/Options/Classes/GradientColorOpacity.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-3"},"imported":[{"uid":"d3a68c52-20"},{"uid":"d3a68c52-0"}],"importedBy":[{"uid":"d3a68c52-4"}]},"d3a68c52-4":{"id":"/dist/browser/Options/Classes/AnimatableGradientColor.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-5"},"imported":[{"uid":"d3a68c52-20"},{"uid":"d3a68c52-2"}],"importedBy":[{"uid":"d3a68c52-10"}]},"d3a68c52-6":{"id":"/dist/browser/Options/Classes/GradientAngleAnimation.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-7"},"imported":[{"uid":"d3a68c52-20"}],"importedBy":[{"uid":"d3a68c52-8"}]},"d3a68c52-8":{"id":"/dist/browser/Options/Classes/GradientAngle.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-9"},"imported":[{"uid":"d3a68c52-20"},{"uid":"d3a68c52-6"}],"importedBy":[{"uid":"d3a68c52-10"}]},"d3a68c52-10":{"id":"/dist/browser/Options/Classes/AnimatableGradient.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-11"},"imported":[{"uid":"d3a68c52-20"},{"uid":"d3a68c52-4"},{"uid":"d3a68c52-8"}],"importedBy":[{"uid":"d3a68c52-14"}]},"d3a68c52-12":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-13"},"imported":[{"uid":"d3a68c52-20"}],"importedBy":[{"uid":"d3a68c52-14"}]},"d3a68c52-14":{"id":"/dist/browser/GradientUpdater.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-15"},"imported":[{"uid":"d3a68c52-20"},{"uid":"d3a68c52-10"},{"uid":"d3a68c52-12"}],"importedBy":[{"uid":"d3a68c52-16"}]},"d3a68c52-16":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-17"},"imported":[{"uid":"d3a68c52-14"}],"importedBy":[{"uid":"d3a68c52-18"}]},"d3a68c52-18":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.gradient.js":"d3a68c52-19"},"imported":[{"uid":"d3a68c52-16"}],"importedBy":[],"isEntry":true},"d3a68c52-20":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"d3a68c52-14"},{"uid":"d3a68c52-10"},{"uid":"d3a68c52-12"},{"uid":"d3a68c52-4"},{"uid":"d3a68c52-8"},{"uid":"d3a68c52-2"},{"uid":"d3a68c52-6"},{"uid":"d3a68c52-0"}],"isExternal":true}},"env":{"rollup":"4.60.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4933
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.updater.gradient.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes","children":[{"uid":"336fcac3-1","name":"GradientColorOpacityAnimation.js"},{"uid":"336fcac3-3","name":"GradientColorOpacity.js"},{"uid":"336fcac3-5","name":"AnimatableGradientColor.js"},{"uid":"336fcac3-7","name":"GradientAngleAnimation.js"},{"uid":"336fcac3-9","name":"GradientAngle.js"},{"uid":"336fcac3-11","name":"AnimatableGradient.js"}]},{"uid":"336fcac3-13","name":"Utils.js"},{"uid":"336fcac3-15","name":"GradientUpdater.js"},{"uid":"336fcac3-17","name":"index.js"},{"uid":"336fcac3-19","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"336fcac3-1":{"renderedLength":778,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-0"},"336fcac3-3":{"renderedLength":336,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-2"},"336fcac3-5":{"renderedLength":707,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-4"},"336fcac3-7":{"renderedLength":650,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-6"},"336fcac3-9":{"renderedLength":444,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-8"},"336fcac3-11":{"renderedLength":604,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-10"},"336fcac3-13":{"renderedLength":518,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-12"},"336fcac3-15":{"renderedLength":6816,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-14"},"336fcac3-17":{"renderedLength":334,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-16"},"336fcac3-19":{"renderedLength":181,"gzipLength":0,"brotliLength":0,"metaUid":"336fcac3-18"}},"nodeMetas":{"336fcac3-0":{"id":"/dist/browser/Options/Classes/GradientColorOpacityAnimation.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-1"},"imported":[{"uid":"336fcac3-20"}],"importedBy":[{"uid":"336fcac3-2"}]},"336fcac3-2":{"id":"/dist/browser/Options/Classes/GradientColorOpacity.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-3"},"imported":[{"uid":"336fcac3-20"},{"uid":"336fcac3-0"}],"importedBy":[{"uid":"336fcac3-4"}]},"336fcac3-4":{"id":"/dist/browser/Options/Classes/AnimatableGradientColor.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-5"},"imported":[{"uid":"336fcac3-20"},{"uid":"336fcac3-2"}],"importedBy":[{"uid":"336fcac3-10"}]},"336fcac3-6":{"id":"/dist/browser/Options/Classes/GradientAngleAnimation.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-7"},"imported":[{"uid":"336fcac3-20"}],"importedBy":[{"uid":"336fcac3-8"}]},"336fcac3-8":{"id":"/dist/browser/Options/Classes/GradientAngle.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-9"},"imported":[{"uid":"336fcac3-20"},{"uid":"336fcac3-6"}],"importedBy":[{"uid":"336fcac3-10"}]},"336fcac3-10":{"id":"/dist/browser/Options/Classes/AnimatableGradient.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-11"},"imported":[{"uid":"336fcac3-20"},{"uid":"336fcac3-4"},{"uid":"336fcac3-8"}],"importedBy":[{"uid":"336fcac3-14"}]},"336fcac3-12":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-13"},"imported":[{"uid":"336fcac3-20"},{"uid":"336fcac3-21"}],"importedBy":[{"uid":"336fcac3-14"}]},"336fcac3-14":{"id":"/dist/browser/GradientUpdater.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-15"},"imported":[{"uid":"336fcac3-20"},{"uid":"336fcac3-10"},{"uid":"336fcac3-12"}],"importedBy":[{"uid":"336fcac3-16"}]},"336fcac3-16":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-17"},"imported":[{"uid":"336fcac3-14"}],"importedBy":[{"uid":"336fcac3-18"}]},"336fcac3-18":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.gradient.js":"336fcac3-19"},"imported":[{"uid":"336fcac3-16"}],"importedBy":[],"isEntry":true},"336fcac3-20":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"336fcac3-14"},{"uid":"336fcac3-10"},{"uid":"336fcac3-12"},{"uid":"336fcac3-4"},{"uid":"336fcac3-8"},{"uid":"336fcac3-2"},{"uid":"336fcac3-6"},{"uid":"336fcac3-0"}],"isExternal":true},"336fcac3-21":{"id":"@tsparticles/animation-utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"336fcac3-12"}],"isExternal":true}},"env":{"rollup":"4.62.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4934
4934
 
4935
4935
  const run = () => {
4936
4936
  const width = window.innerWidth;
@@ -1,89 +1,54 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Updater v4.1.2 */
2
+ /* Updater v4.2.0 */
3
3
  (function (global, factory) {
4
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
5
- typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
6
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.updaters = global.__tsParticlesInternals.updaters || {}, global.__tsParticlesInternals.updaters.gradient = global.__tsParticlesInternals.updaters.gradient || {}), global.__tsParticlesInternals.engine));
7
- })(this, (function (exports, engine) { 'use strict';
4
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine'), require('@tsparticles/animation-utils')) :
5
+ typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine', '@tsparticles/animation-utils'], factory) :
6
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.updaters = global.__tsParticlesInternals.updaters || {}, global.__tsParticlesInternals.updaters.gradient = global.__tsParticlesInternals.updaters.gradient || {}), global.__tsParticlesInternals.engine, global.__tsParticlesInternals.animation.utils));
7
+ })(this, (function (exports, engine, animationUtils) { 'use strict';
8
8
 
9
9
  class GradientColorOpacityAnimation {
10
- count;
11
- decay;
12
- delay;
13
- enable;
14
- speed;
15
- startValue;
16
- sync;
17
- constructor() {
18
- this.count = 0;
19
- this.enable = false;
20
- this.speed = 0;
21
- this.decay = 0;
22
- this.delay = 0;
23
- this.sync = false;
24
- this.startValue = engine.StartValueType.random;
25
- }
10
+ count = 0;
11
+ decay = 0;
12
+ delay = 0;
13
+ enable = false;
14
+ speed = 0;
15
+ startValue = engine.StartValueType.random;
16
+ sync = false;
26
17
  load(data) {
27
18
  if (engine.isNull(data)) {
28
19
  return;
29
20
  }
30
- if (data.count !== undefined) {
31
- this.count = engine.setRangeValue(data.count);
32
- }
33
- if (data.enable !== undefined) {
34
- this.enable = data.enable;
35
- }
36
- if (data.speed !== undefined) {
37
- this.speed = engine.setRangeValue(data.speed);
38
- }
39
- if (data.sync !== undefined) {
40
- this.sync = data.sync;
41
- }
42
- if (data.startValue !== undefined) {
43
- this.startValue = data.startValue;
44
- }
45
- if (data.decay !== undefined) {
46
- this.decay = engine.setRangeValue(data.decay);
47
- }
48
- if (data.delay !== undefined) {
49
- this.delay = engine.setRangeValue(data.delay);
50
- }
21
+ engine.loadRangeProperty(this, "count", data.count);
22
+ engine.loadProperty(this, "enable", data.enable);
23
+ engine.loadRangeProperty(this, "speed", data.speed);
24
+ engine.loadProperty(this, "sync", data.sync);
25
+ engine.loadProperty(this, "startValue", data.startValue);
26
+ engine.loadRangeProperty(this, "decay", data.decay);
27
+ engine.loadRangeProperty(this, "delay", data.delay);
51
28
  }
52
29
  }
53
30
 
54
31
  class GradientColorOpacity {
55
- animation;
56
- value;
57
- constructor() {
58
- this.value = 0;
59
- this.animation = new GradientColorOpacityAnimation();
60
- }
32
+ animation = new GradientColorOpacityAnimation();
33
+ value = 0;
61
34
  load(data) {
62
35
  if (engine.isNull(data)) {
63
36
  return;
64
37
  }
65
38
  this.animation.load(data.animation);
66
- if (data.value !== undefined) {
67
- this.value = engine.setRangeValue(data.value);
68
- }
39
+ engine.loadRangeProperty(this, "value", data.value);
69
40
  }
70
41
  }
71
42
 
72
43
  class AnimatableGradientColor {
73
44
  opacity;
74
- stop;
75
- value;
76
- constructor() {
77
- this.stop = 0;
78
- this.value = new engine.AnimatableColor();
79
- }
45
+ stop = 0;
46
+ value = new engine.AnimatableColor();
80
47
  load(data) {
81
48
  if (engine.isNull(data)) {
82
49
  return;
83
50
  }
84
- if (data.stop !== undefined) {
85
- this.stop = data.stop;
86
- }
51
+ engine.loadProperty(this, "stop", data.stop);
87
52
  this.value = engine.AnimatableColor.create(this.value, data.value);
88
53
  if (data.opacity !== undefined) {
89
54
  this.opacity = new GradientColorOpacity();
@@ -98,77 +63,43 @@
98
63
  }
99
64
 
100
65
  class GradientAngleAnimation {
101
- count;
102
- decay;
103
- delay;
104
- enable;
105
- speed;
106
- sync;
107
- constructor() {
108
- this.count = 0;
109
- this.enable = false;
110
- this.speed = 0;
111
- this.decay = 0;
112
- this.delay = 0;
113
- this.sync = false;
114
- }
66
+ count = 0;
67
+ decay = 0;
68
+ delay = 0;
69
+ enable = false;
70
+ speed = 0;
71
+ sync = false;
115
72
  load(data) {
116
73
  if (engine.isNull(data)) {
117
74
  return;
118
75
  }
119
- if (data.count !== undefined) {
120
- this.count = engine.setRangeValue(data.count);
121
- }
122
- if (data.enable !== undefined) {
123
- this.enable = data.enable;
124
- }
125
- if (data.speed !== undefined) {
126
- this.speed = engine.setRangeValue(data.speed);
127
- }
128
- if (data.decay !== undefined) {
129
- this.decay = engine.setRangeValue(data.decay);
130
- }
131
- if (data.delay !== undefined) {
132
- this.delay = engine.setRangeValue(data.delay);
133
- }
134
- if (data.sync !== undefined) {
135
- this.sync = data.sync;
136
- }
76
+ engine.loadRangeProperty(this, "count", data.count);
77
+ engine.loadProperty(this, "enable", data.enable);
78
+ engine.loadRangeProperty(this, "speed", data.speed);
79
+ engine.loadRangeProperty(this, "decay", data.decay);
80
+ engine.loadRangeProperty(this, "delay", data.delay);
81
+ engine.loadProperty(this, "sync", data.sync);
137
82
  }
138
83
  }
139
84
 
140
85
  class GradientAngle {
141
- animation;
142
- direction;
143
- value;
144
- constructor() {
145
- this.value = 0;
146
- this.animation = new GradientAngleAnimation();
147
- this.direction = engine.RotateDirection.clockwise;
148
- }
86
+ animation = new GradientAngleAnimation();
87
+ direction = engine.RotateDirection.clockwise;
88
+ value = 0;
149
89
  load(data) {
150
90
  if (engine.isNull(data)) {
151
91
  return;
152
92
  }
153
93
  this.animation.load(data.animation);
154
- if (data.value !== undefined) {
155
- this.value = engine.setRangeValue(data.value);
156
- }
157
- if (data.direction !== undefined) {
158
- this.direction = data.direction;
159
- }
94
+ engine.loadRangeProperty(this, "value", data.value);
95
+ engine.loadProperty(this, "direction", data.direction);
160
96
  }
161
97
  }
162
98
 
163
99
  class AnimatableGradient {
164
- angle;
165
- colors;
166
- type;
167
- constructor() {
168
- this.angle = new GradientAngle();
169
- this.colors = [];
170
- this.type = engine.GradientType.random;
171
- }
100
+ angle = new GradientAngle();
101
+ colors = [];
102
+ type = engine.GradientType.random;
172
103
  load(data) {
173
104
  if (engine.isNull(data)) {
174
105
  return;
@@ -181,9 +112,7 @@
181
112
  return tmp;
182
113
  });
183
114
  }
184
- if (data.type !== undefined) {
185
- this.type = data.type;
186
- }
115
+ engine.loadProperty(this, "type", data.type);
187
116
  }
188
117
  }
189
118
 
@@ -192,11 +121,11 @@
192
121
  if (!gradient) {
193
122
  return;
194
123
  }
195
- engine.updateAnimation(particle, gradient.angle, false, engine.DestroyType.none, delta);
124
+ animationUtils.updateAnimation(particle, gradient.angle, false, engine.DestroyType.none, delta);
196
125
  for (const color of gradient.colors) {
197
126
  engine.updateColor(color.value, delta);
198
127
  if (color.opacity) {
199
- engine.updateAnimation(particle, color.opacity, true, engine.DestroyType.none, delta);
128
+ animationUtils.updateAnimation(particle, color.opacity, true, engine.DestroyType.none, delta);
200
129
  }
201
130
  }
202
131
  }
@@ -331,7 +260,7 @@
331
260
  }
332
261
 
333
262
  async function loadGradientUpdater(engine) {
334
- engine.checkVersion("4.1.2");
263
+ engine.checkVersion("4.2.0");
335
264
  await engine.pluginManager.register(e => {
336
265
  e.pluginManager.addParticleUpdater("gradient", container => {
337
266
  return Promise.resolve(new GradientUpdater(e.pluginManager, container));
@@ -1 +1 @@
1
- !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.gradient=t.__tsParticlesInternals.updaters.gradient||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class a{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=e.StartValueType.random}load(t){e.isNull(t)||(void 0!==t.count&&(this.count=e.setRangeValue(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=e.setRangeValue(t.speed)),void 0!==t.sync&&(this.sync=t.sync),void 0!==t.startValue&&(this.startValue=t.startValue),void 0!==t.decay&&(this.decay=e.setRangeValue(t.decay)),void 0!==t.delay&&(this.delay=e.setRangeValue(t.delay)))}}class s{animation;value;constructor(){this.value=0,this.animation=new a}load(t){e.isNull(t)||(this.animation.load(t.animation),void 0!==t.value&&(this.value=e.setRangeValue(t.value)))}}class n{opacity;stop;value;constructor(){this.stop=0,this.value=new e.AnimatableColor}load(t){e.isNull(t)||(void 0!==t.stop&&(this.stop=t.stop),this.value=e.AnimatableColor.create(this.value,t.value),void 0!==t.opacity&&(this.opacity=new s,e.isNumber(t.opacity)?this.opacity.value=t.opacity:this.opacity.load(t.opacity)))}}class i{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(t){e.isNull(t)||(void 0!==t.count&&(this.count=e.setRangeValue(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=e.setRangeValue(t.speed)),void 0!==t.decay&&(this.decay=e.setRangeValue(t.decay)),void 0!==t.delay&&(this.delay=e.setRangeValue(t.delay)),void 0!==t.sync&&(this.sync=t.sync))}}class l{animation;direction;value;constructor(){this.value=0,this.animation=new i,this.direction=e.RotateDirection.clockwise}load(t){e.isNull(t)||(this.animation.load(t.animation),void 0!==t.value&&(this.value=e.setRangeValue(t.value)),void 0!==t.direction&&(this.direction=t.direction))}}class r{angle;colors;type;constructor(){this.angle=new l,this.colors=[],this.type=e.GradientType.random}load(t){e.isNull(t)||(this.angle.load(t.angle),void 0!==t.colors&&(this.colors=t.colors.map(t=>{const e=new n;return e.load(t),e})),void 0!==t.type&&(this.type=t.type))}}class o{#t;#e;constructor(t,e){this.#e=t,this.#t=e}getColorStyles(t,a,s,n){const i=t.gradient;if(!i)return{};const l=this.#t,r=i.angle.value,o=0,c=0,u=i.type===e.GradientType.radial?a.createRadialGradient(o,c,0,o,c,s):a.createLinearGradient(Math.cos(r)*-s,Math.sin(r)*-s,Math.cos(r)*s,Math.sin(r)*s);for(const{stop:t,value:a,opacity:s}of i.colors){const i={h:a.h.value,s:a.s.value,l:a.l.value};u.addColorStop(t,e.getStyleFromHsl(i,l.hdr,s?.value??n))}return{fill:u}}init(t){const a=e.itemFromSingleOrMultiple(t.options.gradient);if(!a)return;const s=this.#t,{angle:n}=a;t.gradient={angle:{value:e.getRangeValue(n.value),enable:n.animation.enable,velocity:e.getRangeValue(n.animation.speed)/360*s.retina.reduceFactor,decay:1-e.getRangeValue(n.animation.decay),delayTime:e.getRangeValue(n.animation.delay)*e.millisecondsToSeconds,max:e.doublePI,min:0,time:0},type:a.type,colors:[]};let i=a.angle.direction;switch(i===e.RotateDirection.random&&(i=e.getRandom()>e.half?e.RotateDirection.counterClockwise:e.RotateDirection.clockwise),i){case e.RotateDirection.counterClockwise:case"counterClockwise":t.gradient.angle.status=e.AnimationStatus.decreasing;break;case e.RotateDirection.clockwise:t.gradient.angle.status=e.AnimationStatus.increasing}const l=t.options.reduceDuplicates;for(const n of a.colors){const a=e.rangeColorToHsl(this.#e,n.value,t.id,l);if(!a)continue;const i=e.getHslAnimationFromHsl(a,n.value.animation,s.retina.reduceFactor),r={stop:n.stop,value:i,opacity:n.opacity?{enable:n.opacity.animation.enable,max:e.getRangeMax(n.opacity.value),min:e.getRangeMin(n.opacity.value),status:e.AnimationStatus.increasing,value:e.getRangeValue(n.opacity.value),velocity:e.getRangeValue(n.opacity.animation.speed)/e.percentDenominator*s.retina.reduceFactor,decay:1-e.getRangeValue(n.opacity.animation.decay),delayTime:e.getRangeValue(n.opacity.animation.delay)*e.millisecondsToSeconds,time:0}:void 0},{opacity:o}=r;if(n.opacity&&o){const t=n.opacity.value;o.min=e.getRangeMin(t),o.max=e.getRangeMax(t);switch(n.opacity.animation.startValue){case e.StartValueType.min:o.value=o.min,o.status=e.AnimationStatus.increasing;break;case e.StartValueType.max:o.value=o.max,o.status=e.AnimationStatus.decreasing;break;case e.StartValueType.random:default:o.value=e.randomInRangeValue(o),o.status=e.getRandom()>=e.half?e.AnimationStatus.increasing:e.AnimationStatus.decreasing}}t.gradient.colors.push(r)}}isEnabled(t){return!t.destroyed&&!t.spawning&&(!!t.gradient?.angle.enable||(t.gradient?.colors.some(t=>t.value.h.enable||t.value.s.enable||t.value.l.enable)??!1))}loadOptions(t,...a){for(const s of a){if(!s?.gradient)continue;const a=s.gradient;t.gradient=e.executeOnSingleOrMultiple(a,t=>{const e=new r;return e.load(t),e})}}update(t,a){!function(t,a){const{gradient:s}=t;if(s){e.updateAnimation(t,s.angle,!1,e.DestroyType.none,a);for(const n of s.colors)e.updateColor(n.value,a),n.opacity&&e.updateAnimation(t,n.opacity,!0,e.DestroyType.none,a)}}(t,a)}}async function c(t){t.checkVersion("4.1.2"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("gradient",e=>Promise.resolve(new o(t.pluginManager,e)))})}const u=globalThis;u.__tsParticlesInternals=u.__tsParticlesInternals??{},u.loadGradientUpdater=c,t.loadGradientUpdater=c}),Object.assign(globalThis.window||globalThis,{loadGradientUpdater:(globalThis.__tsParticlesInternals.updaters.gradient||{}).loadGradientUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine"),require("@tsparticles/animation-utils")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine","@tsparticles/animation-utils"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.gradient=t.__tsParticlesInternals.updaters.gradient||{}),t.__tsParticlesInternals.engine,t.__tsParticlesInternals.animation.utils)}(this,function(t,e,a){"use strict";class s{count=0;decay=0;delay=0;enable=!1;speed=0;startValue=e.StartValueType.random;sync=!1;load(t){e.isNull(t)||(e.loadRangeProperty(this,"count",t.count),e.loadProperty(this,"enable",t.enable),e.loadRangeProperty(this,"speed",t.speed),e.loadProperty(this,"sync",t.sync),e.loadProperty(this,"startValue",t.startValue),e.loadRangeProperty(this,"decay",t.decay),e.loadRangeProperty(this,"delay",t.delay))}}class n{animation=new s;value=0;load(t){e.isNull(t)||(this.animation.load(t.animation),e.loadRangeProperty(this,"value",t.value))}}class l{opacity;stop=0;value=new e.AnimatableColor;load(t){e.isNull(t)||(e.loadProperty(this,"stop",t.stop),this.value=e.AnimatableColor.create(this.value,t.value),void 0!==t.opacity&&(this.opacity=new n,e.isNumber(t.opacity)?this.opacity.value=t.opacity:this.opacity.load(t.opacity)))}}class i{count=0;decay=0;delay=0;enable=!1;speed=0;sync=!1;load(t){e.isNull(t)||(e.loadRangeProperty(this,"count",t.count),e.loadProperty(this,"enable",t.enable),e.loadRangeProperty(this,"speed",t.speed),e.loadRangeProperty(this,"decay",t.decay),e.loadRangeProperty(this,"delay",t.delay),e.loadProperty(this,"sync",t.sync))}}class r{animation=new i;direction=e.RotateDirection.clockwise;value=0;load(t){e.isNull(t)||(this.animation.load(t.animation),e.loadRangeProperty(this,"value",t.value),e.loadProperty(this,"direction",t.direction))}}class o{angle=new r;colors=[];type=e.GradientType.random;load(t){e.isNull(t)||(this.angle.load(t.angle),void 0!==t.colors&&(this.colors=t.colors.map(t=>{const e=new l;return e.load(t),e})),e.loadProperty(this,"type",t.type))}}class c{#t;#e;constructor(t,e){this.#e=t,this.#t=e}getColorStyles(t,a,s,n){const l=t.gradient;if(!l)return{};const i=this.#t,r=l.angle.value,o=0,c=0,d=l.type===e.GradientType.radial?a.createRadialGradient(o,c,0,o,c,s):a.createLinearGradient(Math.cos(r)*-s,Math.sin(r)*-s,Math.cos(r)*s,Math.sin(r)*s);for(const{stop:t,value:a,opacity:s}of l.colors){const l={h:a.h.value,s:a.s.value,l:a.l.value};d.addColorStop(t,e.getStyleFromHsl(l,i.hdr,s?.value??n))}return{fill:d}}init(t){const a=e.itemFromSingleOrMultiple(t.options.gradient);if(!a)return;const s=this.#t,{angle:n}=a;t.gradient={angle:{value:e.getRangeValue(n.value),enable:n.animation.enable,velocity:e.getRangeValue(n.animation.speed)/360*s.retina.reduceFactor,decay:1-e.getRangeValue(n.animation.decay),delayTime:e.getRangeValue(n.animation.delay)*e.millisecondsToSeconds,max:e.doublePI,min:0,time:0},type:a.type,colors:[]};let l=a.angle.direction;switch(l===e.RotateDirection.random&&(l=e.getRandom()>e.half?e.RotateDirection.counterClockwise:e.RotateDirection.clockwise),l){case e.RotateDirection.counterClockwise:case"counterClockwise":t.gradient.angle.status=e.AnimationStatus.decreasing;break;case e.RotateDirection.clockwise:t.gradient.angle.status=e.AnimationStatus.increasing}const i=t.options.reduceDuplicates;for(const n of a.colors){const a=e.rangeColorToHsl(this.#e,n.value,t.id,i);if(!a)continue;const l=e.getHslAnimationFromHsl(a,n.value.animation,s.retina.reduceFactor),r={stop:n.stop,value:l,opacity:n.opacity?{enable:n.opacity.animation.enable,max:e.getRangeMax(n.opacity.value),min:e.getRangeMin(n.opacity.value),status:e.AnimationStatus.increasing,value:e.getRangeValue(n.opacity.value),velocity:e.getRangeValue(n.opacity.animation.speed)/e.percentDenominator*s.retina.reduceFactor,decay:1-e.getRangeValue(n.opacity.animation.decay),delayTime:e.getRangeValue(n.opacity.animation.delay)*e.millisecondsToSeconds,time:0}:void 0},{opacity:o}=r;if(n.opacity&&o){const t=n.opacity.value;o.min=e.getRangeMin(t),o.max=e.getRangeMax(t);switch(n.opacity.animation.startValue){case e.StartValueType.min:o.value=o.min,o.status=e.AnimationStatus.increasing;break;case e.StartValueType.max:o.value=o.max,o.status=e.AnimationStatus.decreasing;break;case e.StartValueType.random:default:o.value=e.randomInRangeValue(o),o.status=e.getRandom()>=e.half?e.AnimationStatus.increasing:e.AnimationStatus.decreasing}}t.gradient.colors.push(r)}}isEnabled(t){return!t.destroyed&&!t.spawning&&(!!t.gradient?.angle.enable||(t.gradient?.colors.some(t=>t.value.h.enable||t.value.s.enable||t.value.l.enable)??!1))}loadOptions(t,...a){for(const s of a){if(!s?.gradient)continue;const a=s.gradient;t.gradient=e.executeOnSingleOrMultiple(a,t=>{const e=new o;return e.load(t),e})}}update(t,s){!function(t,s){const{gradient:n}=t;if(n){a.updateAnimation(t,n.angle,!1,e.DestroyType.none,s);for(const l of n.colors)e.updateColor(l.value,s),l.opacity&&a.updateAnimation(t,l.opacity,!0,e.DestroyType.none,s)}}(t,s)}}async function d(t){t.checkVersion("4.2.0"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("gradient",e=>Promise.resolve(new c(t.pluginManager,e)))})}const u=globalThis;u.__tsParticlesInternals=u.__tsParticlesInternals??{},u.loadGradientUpdater=d,t.loadGradientUpdater=d}),Object.assign(globalThis.window||globalThis,{loadGradientUpdater:(globalThis.__tsParticlesInternals.updaters.gradient||{}).loadGradientUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
@@ -3,9 +3,8 @@ import { AnimatableGradientColor } from "./AnimatableGradientColor.js";
3
3
  import { GradientAngle } from "./GradientAngle.js";
4
4
  import type { IAnimatableGradient } from "../Interfaces/IAnimatableGradient.js";
5
5
  export declare class AnimatableGradient implements IAnimatableGradient, IOptionLoader<IAnimatableGradient> {
6
- angle: GradientAngle;
6
+ readonly angle: GradientAngle;
7
7
  colors: AnimatableGradientColor[];
8
8
  type: GradientType;
9
- constructor();
10
9
  load(data?: RecursivePartial<IAnimatableGradient>): void;
11
10
  }
@@ -5,6 +5,5 @@ export declare class AnimatableGradientColor implements IAnimatableGradientColor
5
5
  opacity?: GradientColorOpacity;
6
6
  stop: number;
7
7
  value: AnimatableColor;
8
- constructor();
9
8
  load(data?: RecursivePartial<IAnimatableGradientColor>): void;
10
9
  }
@@ -2,9 +2,8 @@ import { type IAnimatable, type IAnimation, type IOptionLoader, type RangeValue,
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  import type { IGradientAngle } from "../Interfaces/Gradients.js";
4
4
  export declare class GradientAngle implements IGradientAngle, IAnimatable<IAnimation>, IOptionLoader<IGradientAngle & IAnimatable<IAnimation>> {
5
- animation: GradientAngleAnimation;
5
+ readonly animation: GradientAngleAnimation;
6
6
  direction: RotateDirection | keyof typeof RotateDirection | RotateDirectionAlt;
7
7
  value: RangeValue;
8
- constructor();
9
8
  load(data?: RecursivePartial<IGradientAngle & IAnimatable<IAnimation>>): void;
10
9
  }
@@ -6,6 +6,5 @@ export declare class GradientAngleAnimation implements IAnimation, IOptionLoader
6
6
  enable: boolean;
7
7
  speed: RangeValue;
8
8
  sync: boolean;
9
- constructor();
10
9
  load(data?: RecursivePartial<IAnimation>): void;
11
10
  }
@@ -3,8 +3,7 @@ import { GradientColorOpacityAnimation } from "./GradientColorOpacityAnimation.j
3
3
  import type { IGradientColorOpacity } from "../Interfaces/Gradients.js";
4
4
  import type { IGradientColorOpacityAnimation } from "../Interfaces/IOptionsGradient.js";
5
5
  export declare class GradientColorOpacity implements IGradientColorOpacity, IAnimatable<GradientColorOpacityAnimation>, IOptionLoader<IGradientColorOpacity & IAnimatable<IGradientColorOpacityAnimation>> {
6
- animation: GradientColorOpacityAnimation;
6
+ readonly animation: GradientColorOpacityAnimation;
7
7
  value: RangeValue;
8
- constructor();
9
8
  load(data?: RecursivePartial<IGradientColorOpacity & IAnimatable<IAnimation>>): void;
10
9
  }
@@ -8,6 +8,5 @@ export declare class GradientColorOpacityAnimation implements IGradientColorOpac
8
8
  speed: RangeValue;
9
9
  startValue: StartValueType | keyof typeof StartValueType;
10
10
  sync: boolean;
11
- constructor();
12
11
  load(data?: RecursivePartial<IGradientColorOpacityAnimation>): void;
13
12
  }