@tsparticles/updater-gradient 3.3.0 → 3.4.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.
@@ -1,4 +1,4 @@
1
- import { executeOnSingleOrMultiple, getHslAnimationFromHsl, getRandom, getRangeMax, getRangeMin, getRangeValue, getStyleFromHsl, halfRandom, itemFromSingleOrMultiple, millisecondsToSeconds, percentDenominator, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
1
+ import { AnimationStatus, GradientType, RotateDirection, StartValueType, 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
3
  import { updateGradient } from "./Utils.js";
4
4
  const double = 2, doublePI = Math.PI * double;
@@ -8,7 +8,7 @@ export class GradientUpdater {
8
8
  if (!gradient) {
9
9
  return {};
10
10
  }
11
- const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === "radial"
11
+ const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === GradientType.radial
12
12
  ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius)
13
13
  : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
14
14
  for (const { stop, value, opacity: cOpacity } of gradient.colors) {
@@ -41,16 +41,16 @@ export class GradientUpdater {
41
41
  colors: [],
42
42
  };
43
43
  let rotateDirection = gradient.angle.direction;
44
- if (rotateDirection === "random") {
45
- rotateDirection = getRandom() > halfRandom ? "counter-clockwise" : "clockwise";
44
+ if (rotateDirection === RotateDirection.random) {
45
+ rotateDirection = getRandom() > halfRandom ? RotateDirection.counterClockwise : RotateDirection.clockwise;
46
46
  }
47
47
  switch (rotateDirection) {
48
- case "counter-clockwise":
48
+ case RotateDirection.counterClockwise:
49
49
  case "counterClockwise":
50
- particle.gradient.angle.status = "decreasing";
50
+ particle.gradient.angle.status = AnimationStatus.decreasing;
51
51
  break;
52
- case "clockwise":
53
- particle.gradient.angle.status = "increasing";
52
+ case RotateDirection.clockwise:
53
+ particle.gradient.angle.status = AnimationStatus.increasing;
54
54
  break;
55
55
  }
56
56
  const reduceDuplicates = particle.options.reduceDuplicates;
@@ -67,7 +67,7 @@ export class GradientUpdater {
67
67
  enable: grColor.opacity.animation.enable,
68
68
  max: getRangeMax(grColor.opacity.value),
69
69
  min: getRangeMin(grColor.opacity.value),
70
- status: "increasing",
70
+ status: AnimationStatus.increasing,
71
71
  value: getRangeValue(grColor.opacity.value),
72
72
  velocity: (getRangeValue(grColor.opacity.animation.speed) / percentDenominator) *
73
73
  particle.container.retina.reduceFactor,
@@ -84,19 +84,19 @@ export class GradientUpdater {
84
84
  addOpacity.max = getRangeMax(opacityRange);
85
85
  const opacityAnimation = grColor.opacity.animation;
86
86
  switch (opacityAnimation.startValue) {
87
- case "min":
87
+ case StartValueType.min:
88
88
  addOpacity.value = addOpacity.min;
89
- addOpacity.status = "increasing";
89
+ addOpacity.status = AnimationStatus.increasing;
90
90
  break;
91
- case "max":
91
+ case StartValueType.max:
92
92
  addOpacity.value = addOpacity.max;
93
- addOpacity.status = "decreasing";
93
+ addOpacity.status = AnimationStatus.decreasing;
94
94
  break;
95
- case "random":
95
+ case StartValueType.random:
96
96
  default:
97
97
  addOpacity.value = randomInRange(addOpacity);
98
98
  addOpacity.status =
99
- getRandom() >= halfRandom ? "increasing" : "decreasing";
99
+ getRandom() >= halfRandom ? AnimationStatus.increasing : AnimationStatus.decreasing;
100
100
  break;
101
101
  }
102
102
  }
@@ -107,7 +107,7 @@ export class GradientUpdater {
107
107
  return (!particle.destroyed &&
108
108
  !particle.spawning &&
109
109
  (!!particle.gradient?.angle.enable ||
110
- (particle.gradient?.colors.some((c) => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
110
+ (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
111
111
  false)));
112
112
  }
113
113
  loadOptions(options, ...sources) {
@@ -119,7 +119,7 @@ export class GradientUpdater {
119
119
  if (!gradientToLoad) {
120
120
  continue;
121
121
  }
122
- options.gradient = executeOnSingleOrMultiple(gradientToLoad, (gradient) => {
122
+ options.gradient = executeOnSingleOrMultiple(gradientToLoad, gradient => {
123
123
  const tmp = new AnimatableGradient();
124
124
  tmp.load(gradient);
125
125
  return tmp;
@@ -1,10 +1,11 @@
1
+ import { GradientType } from "@tsparticles/engine";
1
2
  import { AnimatableGradientColor } from "./AnimatableGradientColor.js";
2
3
  import { GradientAngle } from "./GradientAngle.js";
3
4
  export class AnimatableGradient {
4
5
  constructor() {
5
6
  this.angle = new GradientAngle();
6
7
  this.colors = [];
7
- this.type = "random";
8
+ this.type = GradientType.random;
8
9
  }
9
10
  load(data) {
10
11
  if (!data) {
@@ -12,7 +13,7 @@ export class AnimatableGradient {
12
13
  }
13
14
  this.angle.load(data.angle);
14
15
  if (data.colors !== undefined) {
15
- this.colors = data.colors.map((s) => {
16
+ this.colors = data.colors.map(s => {
16
17
  const tmp = new AnimatableGradientColor();
17
18
  tmp.load(s);
18
19
  return tmp;
@@ -1,10 +1,10 @@
1
- import { setRangeValue, } from "@tsparticles/engine";
1
+ import { RotateDirection, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
4
  constructor() {
5
5
  this.value = 0;
6
6
  this.animation = new GradientAngleAnimation();
7
- this.direction = "clockwise";
7
+ this.direction = RotateDirection.clockwise;
8
8
  }
9
9
  load(data) {
10
10
  if (!data) {
@@ -1,4 +1,4 @@
1
- import { setRangeValue, } from "@tsparticles/engine";
1
+ import { StartValueType, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
3
  constructor() {
4
4
  this.count = 0;
@@ -7,7 +7,7 @@ export class GradientColorOpacityAnimation {
7
7
  this.decay = 0;
8
8
  this.delay = 0;
9
9
  this.sync = false;
10
- this.startValue = "random";
10
+ this.startValue = StartValueType.random;
11
11
  }
12
12
  load(data) {
13
13
  if (!data) {
package/browser/Utils.js CHANGED
@@ -1,14 +1,14 @@
1
- import { updateAnimation, updateColor } from "@tsparticles/engine";
1
+ import { DestroyType, updateAnimation, updateColor } from "@tsparticles/engine";
2
2
  export function updateGradient(particle, delta) {
3
3
  const { gradient } = particle;
4
4
  if (!gradient) {
5
5
  return;
6
6
  }
7
- updateAnimation(particle, gradient.angle, false, "none", delta);
7
+ updateAnimation(particle, gradient.angle, false, DestroyType.none, delta);
8
8
  for (const color of gradient.colors) {
9
9
  updateColor(color.value, delta);
10
10
  if (color.opacity) {
11
- updateAnimation(particle, color.opacity, true, "none", delta);
11
+ updateAnimation(particle, color.opacity, true, DestroyType.none, delta);
12
12
  }
13
13
  }
14
14
  }
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { GradientUpdater } from "./GradientUpdater.js";
1
2
  export async function loadGradientUpdater(engine, refresh = true) {
2
- await engine.addParticleUpdater("gradient", async () => {
3
- const { GradientUpdater } = await import("./GradientUpdater.js");
4
- return new GradientUpdater();
3
+ await engine.addParticleUpdater("gradient", () => {
4
+ return Promise.resolve(new GradientUpdater());
5
5
  }, refresh);
6
6
  }
@@ -11,7 +11,7 @@ class GradientUpdater {
11
11
  if (!gradient) {
12
12
  return {};
13
13
  }
14
- const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === "radial"
14
+ const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === engine_1.GradientType.radial
15
15
  ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius)
16
16
  : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
17
17
  for (const { stop, value, opacity: cOpacity } of gradient.colors) {
@@ -44,16 +44,16 @@ class GradientUpdater {
44
44
  colors: [],
45
45
  };
46
46
  let rotateDirection = gradient.angle.direction;
47
- if (rotateDirection === "random") {
48
- rotateDirection = (0, engine_1.getRandom)() > engine_1.halfRandom ? "counter-clockwise" : "clockwise";
47
+ if (rotateDirection === engine_1.RotateDirection.random) {
48
+ rotateDirection = (0, engine_1.getRandom)() > engine_1.halfRandom ? engine_1.RotateDirection.counterClockwise : engine_1.RotateDirection.clockwise;
49
49
  }
50
50
  switch (rotateDirection) {
51
- case "counter-clockwise":
51
+ case engine_1.RotateDirection.counterClockwise:
52
52
  case "counterClockwise":
53
- particle.gradient.angle.status = "decreasing";
53
+ particle.gradient.angle.status = engine_1.AnimationStatus.decreasing;
54
54
  break;
55
- case "clockwise":
56
- particle.gradient.angle.status = "increasing";
55
+ case engine_1.RotateDirection.clockwise:
56
+ particle.gradient.angle.status = engine_1.AnimationStatus.increasing;
57
57
  break;
58
58
  }
59
59
  const reduceDuplicates = particle.options.reduceDuplicates;
@@ -70,7 +70,7 @@ class GradientUpdater {
70
70
  enable: grColor.opacity.animation.enable,
71
71
  max: (0, engine_1.getRangeMax)(grColor.opacity.value),
72
72
  min: (0, engine_1.getRangeMin)(grColor.opacity.value),
73
- status: "increasing",
73
+ status: engine_1.AnimationStatus.increasing,
74
74
  value: (0, engine_1.getRangeValue)(grColor.opacity.value),
75
75
  velocity: ((0, engine_1.getRangeValue)(grColor.opacity.animation.speed) / engine_1.percentDenominator) *
76
76
  particle.container.retina.reduceFactor,
@@ -87,19 +87,19 @@ class GradientUpdater {
87
87
  addOpacity.max = (0, engine_1.getRangeMax)(opacityRange);
88
88
  const opacityAnimation = grColor.opacity.animation;
89
89
  switch (opacityAnimation.startValue) {
90
- case "min":
90
+ case engine_1.StartValueType.min:
91
91
  addOpacity.value = addOpacity.min;
92
- addOpacity.status = "increasing";
92
+ addOpacity.status = engine_1.AnimationStatus.increasing;
93
93
  break;
94
- case "max":
94
+ case engine_1.StartValueType.max:
95
95
  addOpacity.value = addOpacity.max;
96
- addOpacity.status = "decreasing";
96
+ addOpacity.status = engine_1.AnimationStatus.decreasing;
97
97
  break;
98
- case "random":
98
+ case engine_1.StartValueType.random:
99
99
  default:
100
100
  addOpacity.value = (0, engine_1.randomInRange)(addOpacity);
101
101
  addOpacity.status =
102
- (0, engine_1.getRandom)() >= engine_1.halfRandom ? "increasing" : "decreasing";
102
+ (0, engine_1.getRandom)() >= engine_1.halfRandom ? engine_1.AnimationStatus.increasing : engine_1.AnimationStatus.decreasing;
103
103
  break;
104
104
  }
105
105
  }
@@ -110,7 +110,7 @@ class GradientUpdater {
110
110
  return (!particle.destroyed &&
111
111
  !particle.spawning &&
112
112
  (!!particle.gradient?.angle.enable ||
113
- (particle.gradient?.colors.some((c) => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
113
+ (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
114
114
  false)));
115
115
  }
116
116
  loadOptions(options, ...sources) {
@@ -122,7 +122,7 @@ class GradientUpdater {
122
122
  if (!gradientToLoad) {
123
123
  continue;
124
124
  }
125
- options.gradient = (0, engine_1.executeOnSingleOrMultiple)(gradientToLoad, (gradient) => {
125
+ options.gradient = (0, engine_1.executeOnSingleOrMultiple)(gradientToLoad, gradient => {
126
126
  const tmp = new AnimatableGradient_js_1.AnimatableGradient();
127
127
  tmp.load(gradient);
128
128
  return tmp;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AnimatableGradient = void 0;
4
+ const engine_1 = require("@tsparticles/engine");
4
5
  const AnimatableGradientColor_js_1 = require("./AnimatableGradientColor.js");
5
6
  const GradientAngle_js_1 = require("./GradientAngle.js");
6
7
  class AnimatableGradient {
7
8
  constructor() {
8
9
  this.angle = new GradientAngle_js_1.GradientAngle();
9
10
  this.colors = [];
10
- this.type = "random";
11
+ this.type = engine_1.GradientType.random;
11
12
  }
12
13
  load(data) {
13
14
  if (!data) {
@@ -15,7 +16,7 @@ class AnimatableGradient {
15
16
  }
16
17
  this.angle.load(data.angle);
17
18
  if (data.colors !== undefined) {
18
- this.colors = data.colors.map((s) => {
19
+ this.colors = data.colors.map(s => {
19
20
  const tmp = new AnimatableGradientColor_js_1.AnimatableGradientColor();
20
21
  tmp.load(s);
21
22
  return tmp;
@@ -7,7 +7,7 @@ class GradientAngle {
7
7
  constructor() {
8
8
  this.value = 0;
9
9
  this.animation = new GradientAngleAnimation_js_1.GradientAngleAnimation();
10
- this.direction = "clockwise";
10
+ this.direction = engine_1.RotateDirection.clockwise;
11
11
  }
12
12
  load(data) {
13
13
  if (!data) {
@@ -10,7 +10,7 @@ class GradientColorOpacityAnimation {
10
10
  this.decay = 0;
11
11
  this.delay = 0;
12
12
  this.sync = false;
13
- this.startValue = "random";
13
+ this.startValue = engine_1.StartValueType.random;
14
14
  }
15
15
  load(data) {
16
16
  if (!data) {
package/cjs/Utils.js CHANGED
@@ -7,11 +7,11 @@ function updateGradient(particle, delta) {
7
7
  if (!gradient) {
8
8
  return;
9
9
  }
10
- (0, engine_1.updateAnimation)(particle, gradient.angle, false, "none", delta);
10
+ (0, engine_1.updateAnimation)(particle, gradient.angle, false, engine_1.DestroyType.none, delta);
11
11
  for (const color of gradient.colors) {
12
12
  (0, engine_1.updateColor)(color.value, delta);
13
13
  if (color.opacity) {
14
- (0, engine_1.updateAnimation)(particle, color.opacity, true, "none", delta);
14
+ (0, engine_1.updateAnimation)(particle, color.opacity, true, engine_1.DestroyType.none, delta);
15
15
  }
16
16
  }
17
17
  }
package/cjs/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadGradientUpdater = void 0;
4
+ const GradientUpdater_js_1 = require("./GradientUpdater.js");
4
5
  async function loadGradientUpdater(engine, refresh = true) {
5
- await engine.addParticleUpdater("gradient", async () => {
6
- const { GradientUpdater } = await import("./GradientUpdater.js");
7
- return new GradientUpdater();
6
+ await engine.addParticleUpdater("gradient", () => {
7
+ return Promise.resolve(new GradientUpdater_js_1.GradientUpdater());
8
8
  }, refresh);
9
9
  }
10
10
  exports.loadGradientUpdater = loadGradientUpdater;
@@ -1,4 +1,4 @@
1
- import { executeOnSingleOrMultiple, getHslAnimationFromHsl, getRandom, getRangeMax, getRangeMin, getRangeValue, getStyleFromHsl, halfRandom, itemFromSingleOrMultiple, millisecondsToSeconds, percentDenominator, randomInRange, rangeColorToHsl, } from "@tsparticles/engine";
1
+ import { AnimationStatus, GradientType, RotateDirection, StartValueType, 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
3
  import { updateGradient } from "./Utils.js";
4
4
  const double = 2, doublePI = Math.PI * double;
@@ -8,7 +8,7 @@ export class GradientUpdater {
8
8
  if (!gradient) {
9
9
  return {};
10
10
  }
11
- const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === "radial"
11
+ const gradientAngle = gradient.angle.value, origin = { x: 0, y: 0 }, minRadius = 0, fillGradient = gradient.type === GradientType.radial
12
12
  ? context.createRadialGradient(origin.x, origin.y, minRadius, origin.x, origin.y, radius)
13
13
  : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
14
14
  for (const { stop, value, opacity: cOpacity } of gradient.colors) {
@@ -41,16 +41,16 @@ export class GradientUpdater {
41
41
  colors: [],
42
42
  };
43
43
  let rotateDirection = gradient.angle.direction;
44
- if (rotateDirection === "random") {
45
- rotateDirection = getRandom() > halfRandom ? "counter-clockwise" : "clockwise";
44
+ if (rotateDirection === RotateDirection.random) {
45
+ rotateDirection = getRandom() > halfRandom ? RotateDirection.counterClockwise : RotateDirection.clockwise;
46
46
  }
47
47
  switch (rotateDirection) {
48
- case "counter-clockwise":
48
+ case RotateDirection.counterClockwise:
49
49
  case "counterClockwise":
50
- particle.gradient.angle.status = "decreasing";
50
+ particle.gradient.angle.status = AnimationStatus.decreasing;
51
51
  break;
52
- case "clockwise":
53
- particle.gradient.angle.status = "increasing";
52
+ case RotateDirection.clockwise:
53
+ particle.gradient.angle.status = AnimationStatus.increasing;
54
54
  break;
55
55
  }
56
56
  const reduceDuplicates = particle.options.reduceDuplicates;
@@ -67,7 +67,7 @@ export class GradientUpdater {
67
67
  enable: grColor.opacity.animation.enable,
68
68
  max: getRangeMax(grColor.opacity.value),
69
69
  min: getRangeMin(grColor.opacity.value),
70
- status: "increasing",
70
+ status: AnimationStatus.increasing,
71
71
  value: getRangeValue(grColor.opacity.value),
72
72
  velocity: (getRangeValue(grColor.opacity.animation.speed) / percentDenominator) *
73
73
  particle.container.retina.reduceFactor,
@@ -84,19 +84,19 @@ export class GradientUpdater {
84
84
  addOpacity.max = getRangeMax(opacityRange);
85
85
  const opacityAnimation = grColor.opacity.animation;
86
86
  switch (opacityAnimation.startValue) {
87
- case "min":
87
+ case StartValueType.min:
88
88
  addOpacity.value = addOpacity.min;
89
- addOpacity.status = "increasing";
89
+ addOpacity.status = AnimationStatus.increasing;
90
90
  break;
91
- case "max":
91
+ case StartValueType.max:
92
92
  addOpacity.value = addOpacity.max;
93
- addOpacity.status = "decreasing";
93
+ addOpacity.status = AnimationStatus.decreasing;
94
94
  break;
95
- case "random":
95
+ case StartValueType.random:
96
96
  default:
97
97
  addOpacity.value = randomInRange(addOpacity);
98
98
  addOpacity.status =
99
- getRandom() >= halfRandom ? "increasing" : "decreasing";
99
+ getRandom() >= halfRandom ? AnimationStatus.increasing : AnimationStatus.decreasing;
100
100
  break;
101
101
  }
102
102
  }
@@ -107,7 +107,7 @@ export class GradientUpdater {
107
107
  return (!particle.destroyed &&
108
108
  !particle.spawning &&
109
109
  (!!particle.gradient?.angle.enable ||
110
- (particle.gradient?.colors.some((c) => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
110
+ (particle.gradient?.colors.some(c => c.value.h.enable || c.value.s.enable || c.value.l.enable) ??
111
111
  false)));
112
112
  }
113
113
  loadOptions(options, ...sources) {
@@ -119,7 +119,7 @@ export class GradientUpdater {
119
119
  if (!gradientToLoad) {
120
120
  continue;
121
121
  }
122
- options.gradient = executeOnSingleOrMultiple(gradientToLoad, (gradient) => {
122
+ options.gradient = executeOnSingleOrMultiple(gradientToLoad, gradient => {
123
123
  const tmp = new AnimatableGradient();
124
124
  tmp.load(gradient);
125
125
  return tmp;
@@ -1,10 +1,11 @@
1
+ import { GradientType } from "@tsparticles/engine";
1
2
  import { AnimatableGradientColor } from "./AnimatableGradientColor.js";
2
3
  import { GradientAngle } from "./GradientAngle.js";
3
4
  export class AnimatableGradient {
4
5
  constructor() {
5
6
  this.angle = new GradientAngle();
6
7
  this.colors = [];
7
- this.type = "random";
8
+ this.type = GradientType.random;
8
9
  }
9
10
  load(data) {
10
11
  if (!data) {
@@ -12,7 +13,7 @@ export class AnimatableGradient {
12
13
  }
13
14
  this.angle.load(data.angle);
14
15
  if (data.colors !== undefined) {
15
- this.colors = data.colors.map((s) => {
16
+ this.colors = data.colors.map(s => {
16
17
  const tmp = new AnimatableGradientColor();
17
18
  tmp.load(s);
18
19
  return tmp;
@@ -1,10 +1,10 @@
1
- import { setRangeValue, } from "@tsparticles/engine";
1
+ import { RotateDirection, setRangeValue, } from "@tsparticles/engine";
2
2
  import { GradientAngleAnimation } from "./GradientAngleAnimation.js";
3
3
  export class GradientAngle {
4
4
  constructor() {
5
5
  this.value = 0;
6
6
  this.animation = new GradientAngleAnimation();
7
- this.direction = "clockwise";
7
+ this.direction = RotateDirection.clockwise;
8
8
  }
9
9
  load(data) {
10
10
  if (!data) {
@@ -1,4 +1,4 @@
1
- import { setRangeValue, } from "@tsparticles/engine";
1
+ import { StartValueType, setRangeValue, } from "@tsparticles/engine";
2
2
  export class GradientColorOpacityAnimation {
3
3
  constructor() {
4
4
  this.count = 0;
@@ -7,7 +7,7 @@ export class GradientColorOpacityAnimation {
7
7
  this.decay = 0;
8
8
  this.delay = 0;
9
9
  this.sync = false;
10
- this.startValue = "random";
10
+ this.startValue = StartValueType.random;
11
11
  }
12
12
  load(data) {
13
13
  if (!data) {
package/esm/Utils.js CHANGED
@@ -1,14 +1,14 @@
1
- import { updateAnimation, updateColor } from "@tsparticles/engine";
1
+ import { DestroyType, updateAnimation, updateColor } from "@tsparticles/engine";
2
2
  export function updateGradient(particle, delta) {
3
3
  const { gradient } = particle;
4
4
  if (!gradient) {
5
5
  return;
6
6
  }
7
- updateAnimation(particle, gradient.angle, false, "none", delta);
7
+ updateAnimation(particle, gradient.angle, false, DestroyType.none, delta);
8
8
  for (const color of gradient.colors) {
9
9
  updateColor(color.value, delta);
10
10
  if (color.opacity) {
11
- updateAnimation(particle, color.opacity, true, "none", delta);
11
+ updateAnimation(particle, color.opacity, true, DestroyType.none, delta);
12
12
  }
13
13
  }
14
14
  }
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { GradientUpdater } from "./GradientUpdater.js";
1
2
  export async function loadGradientUpdater(engine, refresh = true) {
2
- await engine.addParticleUpdater("gradient", async () => {
3
- const { GradientUpdater } = await import("./GradientUpdater.js");
4
- return new GradientUpdater();
3
+ await engine.addParticleUpdater("gradient", () => {
4
+ return Promise.resolve(new GradientUpdater());
5
5
  }, refresh);
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-gradient",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "tsParticles particles gradient updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -101,7 +101,7 @@
101
101
  "./package.json": "./package.json"
102
102
  },
103
103
  "dependencies": {
104
- "@tsparticles/engine": "^3.3.0"
104
+ "@tsparticles/engine": "^3.4.0"
105
105
  },
106
106
  "publishConfig": {
107
107
  "access": "public"
package/report.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@tsparticles/updater-gradient [27 Feb 2024 at 12:21]</title>
6
+ <title>@tsparticles/updater-gradient [13 May 2024 at 00:14]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+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