tsparticles 2.6.0 → 2.7.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.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v2.6.0
7
+ * v2.7.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -741,13 +741,13 @@ function rectBounce(particle, divBounds) {
741
741
  }
742
742
  }
743
743
  function executeOnSingleOrMultiple(obj, callback) {
744
- return obj instanceof Array ? obj.map(item => callback(item)) : callback(obj);
744
+ return obj instanceof Array ? obj.map((item, index) => callback(item, index)) : callback(obj, 0);
745
745
  }
746
746
  function itemFromSingleOrMultiple(obj, index, useIndex) {
747
747
  return obj instanceof Array ? itemFromArray(obj, index, useIndex) : obj;
748
748
  }
749
749
  function findItemFromSingleOrMultiple(obj, callback) {
750
- return obj instanceof Array ? obj.find(t => callback(t)) : callback(obj) ? obj : undefined;
750
+ return obj instanceof Array ? obj.find((t, index) => callback(t, index)) : callback(obj, 0) ? obj : undefined;
751
751
  }
752
752
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/ColorUtils.js
753
753
 
@@ -1019,10 +1019,13 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
1019
1019
  colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
1020
1020
  colorValue.decay = 1 - getRangeValue(colorAnimation.decay);
1021
1021
  colorValue.status = "increasing";
1022
+ colorValue.loops = 0;
1023
+ colorValue.maxLoops = getRangeValue(colorAnimation.count);
1022
1024
  if (!colorAnimation.sync) {
1023
1025
  colorValue.velocity *= getRandom();
1024
1026
  colorValue.value *= getRandom();
1025
1027
  }
1028
+ colorValue.initialValue = colorValue.value;
1026
1029
  } else {
1027
1030
  colorValue.velocity = 0;
1028
1031
  }
@@ -1050,7 +1053,7 @@ function clear(context, dimension) {
1050
1053
  context.clearRect(0, 0, dimension.width, dimension.height);
1051
1054
  }
1052
1055
  function drawParticle(data) {
1053
- var _a, _b, _c, _d, _e, _f;
1056
+ var _a, _b, _c, _d, _e;
1054
1057
  const {
1055
1058
  container,
1056
1059
  context,
@@ -1091,13 +1094,13 @@ function drawParticle(data) {
1091
1094
  if (colorStyles.fill) {
1092
1095
  context.fillStyle = colorStyles.fill;
1093
1096
  }
1094
- const stroke = particle.stroke;
1095
- context.lineWidth = (_e = particle.strokeWidth) !== null && _e !== void 0 ? _e : 0;
1097
+ const strokeWidth = (_e = particle.strokeWidth) !== null && _e !== void 0 ? _e : 0;
1098
+ context.lineWidth = strokeWidth;
1096
1099
  if (colorStyles.stroke) {
1097
1100
  context.strokeStyle = colorStyles.stroke;
1098
1101
  }
1099
1102
  drawShape(container, context, particle, radius, opacity, delta);
1100
- if (((_f = stroke === null || stroke === void 0 ? void 0 : stroke.width) !== null && _f !== void 0 ? _f : 0) > 0) {
1103
+ if (strokeWidth > 0) {
1101
1104
  context.stroke();
1102
1105
  }
1103
1106
  if (particle.close) {
@@ -1255,12 +1258,12 @@ class Canvas {
1255
1258
  return;
1256
1259
  }
1257
1260
  this.draw(ctx => {
1258
- var _a, _b, _c, _d, _e;
1261
+ var _a, _b, _c, _d;
1259
1262
  const options = this.container.actualOptions,
1260
1263
  zIndexOptions = particle.options.zIndex,
1261
1264
  zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate,
1262
1265
  opacity = (_c = (_a = particle.bubble.opacity) !== null && _a !== void 0 ? _a : (_b = particle.opacity) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 1,
1263
- strokeOpacity = (_e = (_d = particle.stroke) === null || _d === void 0 ? void 0 : _d.opacity) !== null && _e !== void 0 ? _e : opacity,
1266
+ strokeOpacity = (_d = particle.strokeOpacity) !== null && _d !== void 0 ? _d : opacity,
1264
1267
  zOpacity = opacity * zOpacityFactor,
1265
1268
  zStrokeOpacity = strokeOpacity * zOpacityFactor,
1266
1269
  transform = {},
@@ -2834,7 +2837,7 @@ class Move {
2834
2837
  this.attract.load(data.attract);
2835
2838
  this.center.load(data.center);
2836
2839
  if (data.decay !== undefined) {
2837
- this.decay = data.decay;
2840
+ this.decay = setRangeValue(data.decay);
2838
2841
  }
2839
2842
  if (data.direction !== undefined) {
2840
2843
  this.direction = data.direction;
@@ -2991,8 +2994,20 @@ class Opacity extends ValueWithRandom {
2991
2994
  class ParticlesDensity {
2992
2995
  constructor() {
2993
2996
  this.enable = false;
2994
- this.area = 800;
2995
- this.factor = 1000;
2997
+ this.width = 1920;
2998
+ this.height = 1080;
2999
+ }
3000
+ get area() {
3001
+ return this.width;
3002
+ }
3003
+ set area(value) {
3004
+ this.width = value;
3005
+ }
3006
+ get factor() {
3007
+ return this.height;
3008
+ }
3009
+ set factor(value) {
3010
+ this.height = value;
2996
3011
  }
2997
3012
  get value_area() {
2998
3013
  return this.area;
@@ -3001,19 +3016,20 @@ class ParticlesDensity {
3001
3016
  this.area = value;
3002
3017
  }
3003
3018
  load(data) {
3004
- var _a;
3019
+ var _a, _b, _c;
3005
3020
  if (!data) {
3006
3021
  return;
3007
3022
  }
3008
3023
  if (data.enable !== undefined) {
3009
3024
  this.enable = data.enable;
3010
3025
  }
3011
- const area = (_a = data.area) !== null && _a !== void 0 ? _a : data.value_area;
3012
- if (area !== undefined) {
3013
- this.area = area;
3026
+ const width = (_b = (_a = data.width) !== null && _a !== void 0 ? _a : data.area) !== null && _b !== void 0 ? _b : data.value_area;
3027
+ if (width !== undefined) {
3028
+ this.width = width;
3014
3029
  }
3015
- if (data.factor !== undefined) {
3016
- this.factor = data.factor;
3030
+ const height = (_c = data.height) !== null && _c !== void 0 ? _c : data.factor;
3031
+ if (height !== undefined) {
3032
+ this.height = height;
3017
3033
  }
3018
3034
  }
3019
3035
  }
@@ -3246,6 +3262,7 @@ class Size extends ValueWithRandom {
3246
3262
  }
3247
3263
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Stroke.js
3248
3264
 
3265
+
3249
3266
  class Stroke {
3250
3267
  constructor() {
3251
3268
  this.width = 0;
@@ -3258,10 +3275,10 @@ class Stroke {
3258
3275
  this.color = AnimatableColor.create(this.color, data.color);
3259
3276
  }
3260
3277
  if (data.width !== undefined) {
3261
- this.width = data.width;
3278
+ this.width = setRangeValue(data.width);
3262
3279
  }
3263
3280
  if (data.opacity !== undefined) {
3264
- this.opacity = data.opacity;
3281
+ this.opacity = setRangeValue(data.opacity);
3265
3282
  }
3266
3283
  }
3267
3284
  }
@@ -3678,22 +3695,8 @@ class Particle {
3678
3695
  container.canvas.drawParticle(this, delta);
3679
3696
  }
3680
3697
  getFillColor() {
3681
- var _a, _b;
3682
- const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
3683
- if (color && this.roll && (this.backColor || this.roll.alter)) {
3684
- const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1,
3685
- backSum = this.roll.horizontal ? Math.PI / 2 : 0,
3686
- rolled = Math.floor((((_b = this.roll.angle) !== null && _b !== void 0 ? _b : 0) + backSum) / (Math.PI / backFactor)) % 2;
3687
- if (rolled) {
3688
- if (this.backColor) {
3689
- return this.backColor;
3690
- }
3691
- if (this.roll.alter) {
3692
- return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
3693
- }
3694
- }
3695
- }
3696
- return color;
3698
+ var _a;
3699
+ return this._getRollColor((_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color));
3697
3700
  }
3698
3701
  getMass() {
3699
3702
  return this.getRadius() ** 2 * Math.PI / 2;
@@ -3710,8 +3713,8 @@ class Particle {
3710
3713
  return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
3711
3714
  }
3712
3715
  getStrokeColor() {
3713
- var _a, _b;
3714
- return (_b = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor)) !== null && _b !== void 0 ? _b : this.getFillColor();
3716
+ var _a;
3717
+ return this._getRollColor((_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor));
3715
3718
  }
3716
3719
  init(id, position, overrideOptions, group) {
3717
3720
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -3788,7 +3791,7 @@ class Particle {
3788
3791
  this.size.status = "increasing";
3789
3792
  break;
3790
3793
  case "random":
3791
- this.size.value = randomInRange(this.size) * pxRatio;
3794
+ this.size.value = randomInRange(this.size);
3792
3795
  this.size.status = getRandom() >= 0.5 ? "increasing" : "decreasing";
3793
3796
  break;
3794
3797
  case "max":
@@ -3798,6 +3801,7 @@ class Particle {
3798
3801
  break;
3799
3802
  }
3800
3803
  }
3804
+ this.size.initialValue = this.size.value;
3801
3805
  this.bubble = {
3802
3806
  inRange: false
3803
3807
  };
@@ -3966,6 +3970,25 @@ class Particle {
3966
3970
  }
3967
3971
  return overlaps;
3968
3972
  }
3973
+ _getRollColor(color) {
3974
+ var _a;
3975
+ if (!color || !this.roll || !this.backColor && !this.roll.alter) {
3976
+ return color;
3977
+ }
3978
+ const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1,
3979
+ backSum = this.roll.horizontal ? Math.PI / 2 : 0,
3980
+ rolled = Math.floor((((_a = this.roll.angle) !== null && _a !== void 0 ? _a : 0) + backSum) / (Math.PI / backFactor)) % 2;
3981
+ if (!rolled) {
3982
+ return color;
3983
+ }
3984
+ if (this.backColor) {
3985
+ return this.backColor;
3986
+ }
3987
+ if (this.roll.alter) {
3988
+ return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
3989
+ }
3990
+ return color;
3991
+ }
3969
3992
  _loadShapeData(shapeOptions, reduceDuplicates) {
3970
3993
  const shapeData = shapeOptions.options[this.shape];
3971
3994
  if (shapeData) {
@@ -5049,6 +5072,7 @@ class Loader {
5049
5072
  }
5050
5073
  }
5051
5074
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Plugins.js
5075
+
5052
5076
  function getItemsFromInitializer(container, map, initializers, force = false) {
5053
5077
  let res = map.get(container);
5054
5078
  if (!res || force) {
@@ -5097,10 +5121,12 @@ class Plugins {
5097
5121
  this.presets.set(presetKey, options);
5098
5122
  }
5099
5123
  }
5100
- addShapeDrawer(type, drawer) {
5101
- if (!this.getShapeDrawer(type)) {
5102
- this.drawers.set(type, drawer);
5103
- }
5124
+ addShapeDrawer(types, drawer) {
5125
+ executeOnSingleOrMultiple(types, type => {
5126
+ if (!this.getShapeDrawer(type)) {
5127
+ this.drawers.set(type, drawer);
5128
+ }
5129
+ });
5104
5130
  }
5105
5131
  destroy(container) {
5106
5132
  this.updaters.delete(container);
@@ -5547,6 +5573,10 @@ tsParticles.init();
5547
5573
 
5548
5574
 
5549
5575
 
5576
+
5577
+
5578
+
5579
+
5550
5580
 
5551
5581
 
5552
5582
 
@@ -7421,11 +7451,33 @@ async function loadBaseMover(engine) {
7421
7451
  ;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/CircleDrawer.js
7422
7452
  class CircleDrawer {
7423
7453
  draw(context, particle, radius) {
7424
- context.arc(0, 0, radius, 0, Math.PI * 2, false);
7454
+ if (!particle.circleRange) {
7455
+ particle.circleRange = {
7456
+ min: 0,
7457
+ max: Math.PI * 2
7458
+ };
7459
+ }
7460
+ const circleRange = particle.circleRange;
7461
+ context.arc(0, 0, radius, circleRange.min, circleRange.max, false);
7425
7462
  }
7426
7463
  getSidesCount() {
7427
7464
  return 12;
7428
7465
  }
7466
+ particleInit(container, particle) {
7467
+ var _a;
7468
+ const shapeData = particle.shapeData,
7469
+ angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
7470
+ max: 360,
7471
+ min: 0
7472
+ };
7473
+ particle.circleRange = typeof angle !== "object" ? {
7474
+ min: 0,
7475
+ max: angle * Math.PI / 180
7476
+ } : {
7477
+ min: angle.min * Math.PI / 180,
7478
+ max: angle.max * Math.PI / 180
7479
+ };
7480
+ }
7429
7481
  }
7430
7482
  ;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/index.js
7431
7483
 
@@ -7437,7 +7489,7 @@ async function loadCircleShape(engine) {
7437
7489
  function updateColorValue(delta, value, valueAnimation, max, decrease) {
7438
7490
  var _a, _b;
7439
7491
  const colorValue = value;
7440
- if (!colorValue || !valueAnimation.enable) {
7492
+ if (!colorValue || !valueAnimation.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) {
7441
7493
  return;
7442
7494
  }
7443
7495
  const offset = randomInRange(valueAnimation.offset),
@@ -7445,13 +7497,23 @@ function updateColorValue(delta, value, valueAnimation, max, decrease) {
7445
7497
  decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
7446
7498
  if (!decrease || colorValue.status === "increasing") {
7447
7499
  colorValue.value += velocity;
7448
- if (decrease && colorValue.value > max) {
7449
- colorValue.status = "decreasing";
7450
- colorValue.value -= colorValue.value % max;
7500
+ if (colorValue.value > max) {
7501
+ if (!colorValue.loops) {
7502
+ colorValue.loops = 0;
7503
+ }
7504
+ colorValue.loops++;
7505
+ if (decrease) {
7506
+ colorValue.status = "decreasing";
7507
+ colorValue.value -= colorValue.value % max;
7508
+ }
7451
7509
  }
7452
7510
  } else {
7453
7511
  colorValue.value -= velocity;
7454
7512
  if (colorValue.value < 0) {
7513
+ if (!colorValue.loops) {
7514
+ colorValue.loops = 0;
7515
+ }
7516
+ colorValue.loops++;
7455
7517
  colorValue.status = "increasing";
7456
7518
  colorValue.value += colorValue.value;
7457
7519
  }
@@ -7466,14 +7528,17 @@ function updateColorValue(delta, value, valueAnimation, max, decrease) {
7466
7528
  function updateColor(particle, delta) {
7467
7529
  var _a, _b, _c;
7468
7530
  const animationOptions = particle.options.color.animation;
7469
- if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) {
7470
- updateColorValue(delta, particle.color.h, animationOptions.h, 360, false);
7531
+ const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h,
7532
+ s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s,
7533
+ l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l;
7534
+ if (h) {
7535
+ updateColorValue(delta, h, animationOptions.h, 360, false);
7471
7536
  }
7472
- if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) {
7473
- updateColorValue(delta, particle.color.s, animationOptions.s, 100, true);
7537
+ if (s) {
7538
+ updateColorValue(delta, s, animationOptions.s, 100, true);
7474
7539
  }
7475
- if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) {
7476
- updateColorValue(delta, particle.color.l, animationOptions.l, 100, true);
7540
+ if (l) {
7541
+ updateColorValue(delta, l, animationOptions.l, 100, true);
7477
7542
  }
7478
7543
  }
7479
7544
  class ColorUpdater {
@@ -9305,9 +9370,7 @@ class ImageDrawer {
9305
9370
  ;// CONCATENATED MODULE: ../../shapes/image/dist/esm/index.js
9306
9371
 
9307
9372
  async function loadImageShape(engine) {
9308
- const imageDrawer = new ImageDrawer();
9309
- await engine.addShape("image", imageDrawer);
9310
- await engine.addShape("images", imageDrawer);
9373
+ await engine.addShape(["image", "images"], new ImageDrawer());
9311
9374
  }
9312
9375
  ;// CONCATENATED MODULE: ../../updaters/life/dist/esm/Options/Classes/LifeDelay.js
9313
9376
 
@@ -9581,6 +9644,7 @@ class OpacityUpdater {
9581
9644
  particle.opacity.velocity *= getRandom();
9582
9645
  }
9583
9646
  }
9647
+ particle.opacity.initialValue = particle.opacity.value;
9584
9648
  }
9585
9649
  isEnabled(particle) {
9586
9650
  var _a, _b, _c, _d;
@@ -10682,14 +10746,15 @@ async function loadParticlesLinksInteraction(engine) {
10682
10746
 
10683
10747
 
10684
10748
  ;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawerBase.js
10749
+
10685
10750
  class PolygonDrawerBase {
10686
10751
  draw(context, particle, radius) {
10687
- const start = this.getCenter(particle, radius);
10688
- const side = this.getSidesData(particle, radius);
10689
- const sideCount = side.count.numerator * side.count.denominator;
10690
- const decimalSides = side.count.numerator / side.count.denominator;
10691
- const interiorAngleDegrees = 180 * (decimalSides - 2) / decimalSides;
10692
- const interiorAngle = Math.PI - Math.PI * interiorAngleDegrees / 180;
10752
+ const start = this.getCenter(particle, radius),
10753
+ side = this.getSidesData(particle, radius),
10754
+ sideCount = side.count.numerator * side.count.denominator,
10755
+ decimalSides = side.count.numerator / side.count.denominator,
10756
+ interiorAngleDegrees = 180 * (decimalSides - 2) / decimalSides,
10757
+ interiorAngle = Math.PI - Math.PI * interiorAngleDegrees / 180;
10693
10758
  if (!context) {
10694
10759
  return;
10695
10760
  }
@@ -10704,24 +10769,22 @@ class PolygonDrawerBase {
10704
10769
  }
10705
10770
  getSidesCount(particle) {
10706
10771
  var _a, _b;
10707
- const polygon = particle.shapeData;
10708
- return (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5;
10772
+ const polygon = particle.shapeData,
10773
+ sides = Math.round(getRangeValue((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
10774
+ return sides;
10709
10775
  }
10710
10776
  }
10711
10777
  ;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawer.js
10712
10778
 
10713
10779
  class PolygonDrawer extends PolygonDrawerBase {
10714
10780
  getCenter(particle, radius) {
10715
- const sides = this.getSidesCount(particle);
10716
10781
  return {
10717
- x: -radius / (sides / 3.5),
10782
+ x: -radius / (particle.sides / 3.5),
10718
10783
  y: -radius / (2.66 / 3.5)
10719
10784
  };
10720
10785
  }
10721
10786
  getSidesData(particle, radius) {
10722
- var _a, _b;
10723
- const polygon = particle.shapeData;
10724
- const sides = (_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5;
10787
+ const sides = particle.sides;
10725
10788
  return {
10726
10789
  count: {
10727
10790
  denominator: 1,
@@ -10868,16 +10931,15 @@ class SquareDrawer {
10868
10931
 
10869
10932
  async function loadSquareShape(engine) {
10870
10933
  const drawer = new SquareDrawer();
10871
- await engine.addShape("edge", drawer);
10872
- await engine.addShape("square", drawer);
10934
+ await engine.addShape(["edge", "square"], drawer);
10873
10935
  }
10874
10936
  ;// CONCATENATED MODULE: ../../shapes/star/dist/esm/StarDrawer.js
10937
+
10875
10938
  class StarDrawer {
10876
10939
  draw(context, particle, radius) {
10877
10940
  var _a;
10878
- const star = particle.shapeData,
10879
- sides = this.getSidesCount(particle),
10880
- inset = (_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2;
10941
+ const sides = particle.sides,
10942
+ inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
10881
10943
  context.moveTo(0, 0 - radius);
10882
10944
  for (let i = 0; i < sides; i++) {
10883
10945
  context.rotate(Math.PI / sides);
@@ -10889,7 +10951,13 @@ class StarDrawer {
10889
10951
  getSidesCount(particle) {
10890
10952
  var _a, _b;
10891
10953
  const star = particle.shapeData;
10892
- return (_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5;
10954
+ return Math.round(getRangeValue((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
10955
+ }
10956
+ particleInit(container, particle) {
10957
+ var _a;
10958
+ const star = particle.shapeData,
10959
+ inset = getRangeValue((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
10960
+ particle.starInset = inset;
10893
10961
  }
10894
10962
  }
10895
10963
  ;// CONCATENATED MODULE: ../../shapes/star/dist/esm/index.js
@@ -10902,7 +10970,7 @@ async function loadStarShape(engine) {
10902
10970
  function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max, decrease) {
10903
10971
  var _a, _b;
10904
10972
  const colorValue = value;
10905
- if (!colorValue || !colorValue.enable) {
10973
+ if (!colorValue || !colorValue.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) {
10906
10974
  return;
10907
10975
  }
10908
10976
  const offset = randomInRange(valueAnimation.offset),
@@ -10910,13 +10978,23 @@ function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max,
10910
10978
  decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
10911
10979
  if (!decrease || colorValue.status === "increasing") {
10912
10980
  colorValue.value += velocity;
10913
- if (decrease && colorValue.value > max) {
10914
- colorValue.status = "decreasing";
10915
- colorValue.value -= colorValue.value % max;
10981
+ if (colorValue.value > max) {
10982
+ if (!colorValue.loops) {
10983
+ colorValue.loops = 0;
10984
+ }
10985
+ colorValue.loops++;
10986
+ if (decrease) {
10987
+ colorValue.status = "decreasing";
10988
+ colorValue.value -= colorValue.value % max;
10989
+ }
10916
10990
  }
10917
10991
  } else {
10918
10992
  colorValue.value -= velocity;
10919
10993
  if (colorValue.value < 0) {
10994
+ if (!colorValue.loops) {
10995
+ colorValue.loops = 0;
10996
+ }
10997
+ colorValue.loops++;
10920
10998
  colorValue.status = "increasing";
10921
10999
  colorValue.value += colorValue.value;
10922
11000
  }
@@ -10929,22 +11007,20 @@ function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max,
10929
11007
  }
10930
11008
  }
10931
11009
  function updateStrokeColor(particle, delta) {
10932
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
10933
- if (!((_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color)) {
11010
+ if (!particle.strokeColor || !particle.strokeAnimation) {
10934
11011
  return;
10935
11012
  }
10936
- const animationOptions = particle.stroke.color.animation,
10937
- h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
11013
+ const h = particle.strokeColor.h;
10938
11014
  if (h) {
10939
- StrokeColorUpdater_updateColorValue(delta, h, animationOptions.h, 360, false);
11015
+ StrokeColorUpdater_updateColorValue(delta, h, particle.strokeAnimation.h, 360, false);
10940
11016
  }
10941
- const s = (_f = (_e = particle.strokeColor) === null || _e === void 0 ? void 0 : _e.s) !== null && _f !== void 0 ? _f : (_g = particle.color) === null || _g === void 0 ? void 0 : _g.s;
11017
+ const s = particle.strokeColor.s;
10942
11018
  if (s) {
10943
- StrokeColorUpdater_updateColorValue(delta, s, animationOptions.s, 100, true);
11019
+ StrokeColorUpdater_updateColorValue(delta, s, particle.strokeAnimation.s, 100, true);
10944
11020
  }
10945
- const l = (_j = (_h = particle.strokeColor) === null || _h === void 0 ? void 0 : _h.l) !== null && _j !== void 0 ? _j : (_k = particle.color) === null || _k === void 0 ? void 0 : _k.l;
11021
+ const l = particle.strokeColor.l;
10946
11022
  if (l) {
10947
- StrokeColorUpdater_updateColorValue(delta, l, animationOptions.l, 100, true);
11023
+ StrokeColorUpdater_updateColorValue(delta, l, particle.strokeAnimation.l, 100, true);
10948
11024
  }
10949
11025
  }
10950
11026
  class StrokeColorUpdater {
@@ -10952,19 +11028,21 @@ class StrokeColorUpdater {
10952
11028
  this.container = container;
10953
11029
  }
10954
11030
  init(particle) {
10955
- var _a, _b;
11031
+ var _a, _b, _c;
10956
11032
  const container = this.container;
10957
- particle.stroke = itemFromSingleOrMultiple(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
10958
- particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
10959
- const strokeHslColor = (_a = rangeColorToHsl(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
11033
+ const stroke = itemFromSingleOrMultiple(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
11034
+ particle.strokeWidth = getRangeValue(stroke.width) * container.retina.pixelRatio;
11035
+ particle.strokeOpacity = getRangeValue((_a = stroke.opacity) !== null && _a !== void 0 ? _a : 1);
11036
+ particle.strokeAnimation = (_b = stroke.color) === null || _b === void 0 ? void 0 : _b.animation;
11037
+ const strokeHslColor = (_c = rangeColorToHsl(stroke.color)) !== null && _c !== void 0 ? _c : particle.getFillColor();
10960
11038
  if (strokeHslColor) {
10961
- particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, (_b = particle.stroke.color) === null || _b === void 0 ? void 0 : _b.animation, container.retina.reduceFactor);
11039
+ particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, particle.strokeAnimation, container.retina.reduceFactor);
10962
11040
  }
10963
11041
  }
10964
11042
  isEnabled(particle) {
10965
- var _a, _b, _c, _d;
10966
- const color = (_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color;
10967
- return !particle.destroyed && !particle.spawning && !!color && (((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h.value) !== undefined && color.animation.h.enable || ((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.s.value) !== undefined && color.animation.s.enable || ((_d = particle.strokeColor) === null || _d === void 0 ? void 0 : _d.l.value) !== undefined && color.animation.l.enable);
11043
+ var _a, _b, _c;
11044
+ const color = particle.strokeAnimation;
11045
+ return !particle.destroyed && !particle.spawning && !!color && (((_a = particle.strokeColor) === null || _a === void 0 ? void 0 : _a.h.value) !== undefined && particle.strokeColor.h.enable || ((_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.s.value) !== undefined && particle.strokeColor.s.enable || ((_c = particle.strokeColor) === null || _c === void 0 ? void 0 : _c.l.value) !== undefined && particle.strokeColor.l.enable);
10968
11046
  }
10969
11047
  update(particle, delta) {
10970
11048
  if (!this.isEnabled(particle)) {
@@ -11034,10 +11112,7 @@ class TextDrawer {
11034
11112
  ;// CONCATENATED MODULE: ../../shapes/text/dist/esm/index.js
11035
11113
 
11036
11114
  async function loadTextShape(engine) {
11037
- const drawer = new TextDrawer();
11038
- for (const type of validTypes) {
11039
- await engine.addShape(type, drawer);
11040
- }
11115
+ await engine.addShape(validTypes, new TextDrawer());
11041
11116
  }
11042
11117
  ;// CONCATENATED MODULE: ../slim/dist/esm/index.js
11043
11118