tsparticles 2.5.3 → 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.5.3
7
+ * v2.7.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -100,6 +100,7 @@ __webpack_require__.d(__webpack_exports__, {
100
100
  "Point": () => (/* reexport */ Point),
101
101
  "Range": () => (/* reexport */ Range),
102
102
  "Rectangle": () => (/* reexport */ Rectangle),
103
+ "ResizeEvent": () => (/* reexport */ ResizeEvent),
103
104
  "Responsive": () => (/* reexport */ Responsive),
104
105
  "RgbColorManager": () => (/* reexport */ RgbColorManager),
105
106
  "Shadow": () => (/* reexport */ Shadow),
@@ -372,9 +373,7 @@ function addEasing(name, easing) {
372
373
  }
373
374
  }
374
375
  function getEasing(name) {
375
- var _a;
376
- const noEasing = value => value;
377
- return (_a = easings.get(name)) !== null && _a !== void 0 ? _a : noEasing;
376
+ return easings.get(name) || (value => value);
378
377
  }
379
378
  function setRandom(rnd = Math.random) {
380
379
  _random = rnd;
@@ -433,7 +432,7 @@ function getDistances(pointA, pointB) {
433
432
  return {
434
433
  dx: dx,
435
434
  dy: dy,
436
- distance: Math.sqrt(dx * dx + dy * dy)
435
+ distance: Math.sqrt(dx ** 2 + dy ** 2)
437
436
  };
438
437
  }
439
438
  function getDistance(pointA, pointB) {
@@ -742,13 +741,13 @@ function rectBounce(particle, divBounds) {
742
741
  }
743
742
  }
744
743
  function executeOnSingleOrMultiple(obj, callback) {
745
- 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);
746
745
  }
747
746
  function itemFromSingleOrMultiple(obj, index, useIndex) {
748
747
  return obj instanceof Array ? itemFromArray(obj, index, useIndex) : obj;
749
748
  }
750
749
  function findItemFromSingleOrMultiple(obj, callback) {
751
- 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;
752
751
  }
753
752
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/ColorUtils.js
754
753
 
@@ -1019,11 +1018,14 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
1019
1018
  if (colorValue.enable) {
1020
1019
  colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
1021
1020
  colorValue.decay = 1 - getRangeValue(colorAnimation.decay);
1022
- colorValue.status = 0;
1021
+ colorValue.status = "increasing";
1022
+ colorValue.loops = 0;
1023
+ colorValue.maxLoops = getRangeValue(colorAnimation.count);
1023
1024
  if (!colorAnimation.sync) {
1024
1025
  colorValue.velocity *= getRandom();
1025
1026
  colorValue.value *= getRandom();
1026
1027
  }
1028
+ colorValue.initialValue = colorValue.value;
1027
1029
  } else {
1028
1030
  colorValue.velocity = 0;
1029
1031
  }
@@ -1051,7 +1053,7 @@ function clear(context, dimension) {
1051
1053
  context.clearRect(0, 0, dimension.width, dimension.height);
1052
1054
  }
1053
1055
  function drawParticle(data) {
1054
- var _a, _b, _c, _d, _e, _f;
1056
+ var _a, _b, _c, _d, _e;
1055
1057
  const {
1056
1058
  container,
1057
1059
  context,
@@ -1092,13 +1094,13 @@ function drawParticle(data) {
1092
1094
  if (colorStyles.fill) {
1093
1095
  context.fillStyle = colorStyles.fill;
1094
1096
  }
1095
- const stroke = particle.stroke;
1096
- 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;
1097
1099
  if (colorStyles.stroke) {
1098
1100
  context.strokeStyle = colorStyles.stroke;
1099
1101
  }
1100
1102
  drawShape(container, context, particle, radius, opacity, delta);
1101
- if (((_f = stroke === null || stroke === void 0 ? void 0 : stroke.width) !== null && _f !== void 0 ? _f : 0) > 0) {
1103
+ if (strokeWidth > 0) {
1102
1104
  context.stroke();
1103
1105
  }
1104
1106
  if (particle.close) {
@@ -1256,12 +1258,12 @@ class Canvas {
1256
1258
  return;
1257
1259
  }
1258
1260
  this.draw(ctx => {
1259
- var _a, _b, _c, _d, _e;
1261
+ var _a, _b, _c, _d;
1260
1262
  const options = this.container.actualOptions,
1261
1263
  zIndexOptions = particle.options.zIndex,
1262
1264
  zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate,
1263
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,
1264
- 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,
1265
1267
  zOpacity = opacity * zOpacityFactor,
1266
1268
  zStrokeOpacity = strokeOpacity * zOpacityFactor,
1267
1269
  transform = {},
@@ -1589,19 +1591,21 @@ class EventListeners {
1589
1591
  constructor(container) {
1590
1592
  this.container = container;
1591
1593
  this.canPush = true;
1592
- this.mouseMoveHandler = e => this.mouseTouchMove(e);
1593
- this.touchStartHandler = e => this.mouseTouchMove(e);
1594
- this.touchMoveHandler = e => this.mouseTouchMove(e);
1595
- this.touchEndHandler = () => this.mouseTouchFinish();
1596
- this.mouseLeaveHandler = () => this.mouseTouchFinish();
1597
- this.touchCancelHandler = () => this.mouseTouchFinish();
1598
- this.touchEndClickHandler = e => this.mouseTouchClick(e);
1599
- this.mouseUpHandler = e => this.mouseTouchClick(e);
1600
- this.mouseDownHandler = () => this.mouseDown();
1601
- this.visibilityChangeHandler = () => this.handleVisibilityChange();
1602
- this.themeChangeHandler = e => this.handleThemeChange(e);
1603
- this.oldThemeChangeHandler = e => this.handleThemeChange(e);
1604
- this.resizeHandler = () => this.handleWindowResize();
1594
+ this.handlers = {
1595
+ mouseMove: e => this.mouseTouchMove(e),
1596
+ touchStart: e => this.mouseTouchMove(e),
1597
+ touchMove: e => this.mouseTouchMove(e),
1598
+ touchEnd: () => this.mouseTouchFinish(),
1599
+ mouseLeave: () => this.mouseTouchFinish(),
1600
+ touchCancel: () => this.mouseTouchFinish(),
1601
+ touchEndClick: e => this.mouseTouchClick(e),
1602
+ mouseUp: e => this.mouseTouchClick(e),
1603
+ mouseDown: () => this.mouseDown(),
1604
+ visibilityChange: () => this.handleVisibilityChange(),
1605
+ themeChange: e => this.handleThemeChange(e),
1606
+ oldThemeChange: e => this.handleThemeChange(e),
1607
+ resize: () => this.handleWindowResize()
1608
+ };
1605
1609
  }
1606
1610
  addListeners() {
1607
1611
  this.manageListeners(true);
@@ -1613,12 +1617,13 @@ class EventListeners {
1613
1617
  const container = this.container,
1614
1618
  options = container.actualOptions;
1615
1619
  if (this.canPush) {
1616
- const mousePos = container.interactivity.mouse.position;
1620
+ const mouseInteractivity = container.interactivity.mouse,
1621
+ mousePos = mouseInteractivity.position;
1617
1622
  if (!mousePos) {
1618
1623
  return;
1619
1624
  }
1620
- container.interactivity.mouse.clickPosition = Object.assign({}, mousePos);
1621
- container.interactivity.mouse.clickTime = new Date().getTime();
1625
+ mouseInteractivity.clickPosition = Object.assign({}, mousePos);
1626
+ mouseInteractivity.clickTime = new Date().getTime();
1622
1627
  const onClick = options.interactivity.events.onClick;
1623
1628
  executeOnSingleOrMultiple(onClick.mode, mode => this.handleClickMode(mode));
1624
1629
  }
@@ -1631,10 +1636,13 @@ class EventListeners {
1631
1636
  }
1632
1637
  handleThemeChange(e) {
1633
1638
  const mediaEvent = e,
1634
- themeName = mediaEvent.matches ? this.container.options.defaultThemes.dark : this.container.options.defaultThemes.light,
1635
- theme = this.container.options.themes.find(theme => theme.name === themeName);
1639
+ container = this.container,
1640
+ options = container.options,
1641
+ defaultThemes = options.defaultThemes,
1642
+ themeName = mediaEvent.matches ? defaultThemes.dark : defaultThemes.light,
1643
+ theme = options.themes.find(theme => theme.name === themeName);
1636
1644
  if (theme && theme.default.auto) {
1637
- this.container.loadTheme(themeName);
1645
+ container.loadTheme(themeName);
1638
1646
  }
1639
1647
  }
1640
1648
  handleVisibilityChange() {
@@ -1664,11 +1672,12 @@ class EventListeners {
1664
1672
  this.resizeTimeout = setTimeout(async () => {
1665
1673
  var _a;
1666
1674
  return (_a = this.container.canvas) === null || _a === void 0 ? void 0 : _a.windowResize();
1667
- }, 500);
1675
+ }, this.container.actualOptions.interactivity.events.resize.delay * 1000);
1668
1676
  }
1669
1677
  manageListeners(add) {
1670
1678
  var _a;
1671
- const container = this.container,
1679
+ const handlers = this.handlers,
1680
+ container = this.container,
1672
1681
  options = container.actualOptions,
1673
1682
  detectType = options.interactivity.detectsOn;
1674
1683
  let mouseLeaveTmpEvent = mouseLeaveEvent;
@@ -1684,12 +1693,12 @@ class EventListeners {
1684
1693
  const mediaMatch = safeMatchMedia("(prefers-color-scheme: dark)");
1685
1694
  if (mediaMatch) {
1686
1695
  if (mediaMatch.addEventListener !== undefined) {
1687
- manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1696
+ manageListener(mediaMatch, "change", handlers.themeChange, add);
1688
1697
  } else if (mediaMatch.addListener !== undefined) {
1689
1698
  if (add) {
1690
- mediaMatch.addListener(this.oldThemeChangeHandler);
1699
+ mediaMatch.addListener(handlers.oldThemeChange);
1691
1700
  } else {
1692
- mediaMatch.removeListener(this.oldThemeChangeHandler);
1701
+ mediaMatch.removeListener(handlers.oldThemeChange);
1693
1702
  }
1694
1703
  }
1695
1704
  }
@@ -1699,18 +1708,18 @@ class EventListeners {
1699
1708
  }
1700
1709
  const html = interactivityEl;
1701
1710
  if (options.interactivity.events.onHover.enable || options.interactivity.events.onClick.enable) {
1702
- manageListener(interactivityEl, mouseMoveEvent, this.mouseMoveHandler, add);
1703
- manageListener(interactivityEl, touchStartEvent, this.touchStartHandler, add);
1704
- manageListener(interactivityEl, touchMoveEvent, this.touchMoveHandler, add);
1711
+ manageListener(interactivityEl, mouseMoveEvent, handlers.mouseMove, add);
1712
+ manageListener(interactivityEl, touchStartEvent, handlers.touchStart, add);
1713
+ manageListener(interactivityEl, touchMoveEvent, handlers.touchMove, add);
1705
1714
  if (!options.interactivity.events.onClick.enable) {
1706
- manageListener(interactivityEl, touchEndEvent, this.touchEndHandler, add);
1715
+ manageListener(interactivityEl, touchEndEvent, handlers.touchEnd, add);
1707
1716
  } else {
1708
- manageListener(interactivityEl, touchEndEvent, this.touchEndClickHandler, add);
1709
- manageListener(interactivityEl, mouseUpEvent, this.mouseUpHandler, add);
1710
- manageListener(interactivityEl, mouseDownEvent, this.mouseDownHandler, add);
1717
+ manageListener(interactivityEl, touchEndEvent, handlers.touchEndClick, add);
1718
+ manageListener(interactivityEl, mouseUpEvent, handlers.mouseUp, add);
1719
+ manageListener(interactivityEl, mouseDownEvent, handlers.mouseDown, add);
1711
1720
  }
1712
- manageListener(interactivityEl, mouseLeaveTmpEvent, this.mouseLeaveHandler, add);
1713
- manageListener(interactivityEl, touchCancelEvent, this.touchCancelHandler, add);
1721
+ manageListener(interactivityEl, mouseLeaveTmpEvent, handlers.mouseLeave, add);
1722
+ manageListener(interactivityEl, touchCancelEvent, handlers.touchCancel, add);
1714
1723
  }
1715
1724
  if (container.canvas.element) {
1716
1725
  container.canvas.element.style.pointerEvents = html === container.canvas.element ? "initial" : "none";
@@ -1734,11 +1743,11 @@ class EventListeners {
1734
1743
  this.resizeObserver.observe(container.canvas.element);
1735
1744
  }
1736
1745
  } else {
1737
- manageListener(window, resizeEvent, this.resizeHandler, add);
1746
+ manageListener(window, resizeEvent, handlers.resize, add);
1738
1747
  }
1739
1748
  }
1740
1749
  if (document) {
1741
- manageListener(document, visibilityChangeEvent, this.visibilityChangeHandler, add, false);
1750
+ manageListener(document, visibilityChangeEvent, handlers.visibilityChange, add, false);
1742
1751
  }
1743
1752
  }
1744
1753
  mouseDown() {
@@ -2130,17 +2139,36 @@ class HoverEvent {
2130
2139
  this.parallax.load(data.parallax);
2131
2140
  }
2132
2141
  }
2142
+ ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/ResizeEvent.js
2143
+ class ResizeEvent {
2144
+ constructor() {
2145
+ this.delay = 0.5;
2146
+ this.enable = true;
2147
+ }
2148
+ load(data) {
2149
+ if (data === undefined) {
2150
+ return;
2151
+ }
2152
+ if (data.delay !== undefined) {
2153
+ this.delay = data.delay;
2154
+ }
2155
+ if (data.enable !== undefined) {
2156
+ this.enable = data.enable;
2157
+ }
2158
+ }
2159
+ }
2133
2160
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Interactivity/Events/Events.js
2134
2161
 
2135
2162
 
2136
2163
 
2137
2164
 
2165
+
2138
2166
  class Events {
2139
2167
  constructor() {
2140
2168
  this.onClick = new ClickEvent();
2141
2169
  this.onDiv = new DivEvent();
2142
2170
  this.onHover = new HoverEvent();
2143
- this.resize = true;
2171
+ this.resize = new ResizeEvent();
2144
2172
  }
2145
2173
  get onclick() {
2146
2174
  return this.onClick;
@@ -2175,8 +2203,10 @@ class Events {
2175
2203
  });
2176
2204
  }
2177
2205
  this.onHover.load((_c = data.onHover) !== null && _c !== void 0 ? _c : data.onhover);
2178
- if (data.resize !== undefined) {
2179
- this.resize = data.resize;
2206
+ if (typeof data.resize === "boolean") {
2207
+ this.resize.enable = data.resize;
2208
+ } else {
2209
+ this.resize.load(data.resize);
2180
2210
  }
2181
2211
  }
2182
2212
  }
@@ -2807,7 +2837,7 @@ class Move {
2807
2837
  this.attract.load(data.attract);
2808
2838
  this.center.load(data.center);
2809
2839
  if (data.decay !== undefined) {
2810
- this.decay = data.decay;
2840
+ this.decay = setRangeValue(data.decay);
2811
2841
  }
2812
2842
  if (data.direction !== undefined) {
2813
2843
  this.direction = data.direction;
@@ -2964,8 +2994,20 @@ class Opacity extends ValueWithRandom {
2964
2994
  class ParticlesDensity {
2965
2995
  constructor() {
2966
2996
  this.enable = false;
2967
- this.area = 800;
2968
- 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;
2969
3011
  }
2970
3012
  get value_area() {
2971
3013
  return this.area;
@@ -2974,19 +3016,20 @@ class ParticlesDensity {
2974
3016
  this.area = value;
2975
3017
  }
2976
3018
  load(data) {
2977
- var _a;
3019
+ var _a, _b, _c;
2978
3020
  if (!data) {
2979
3021
  return;
2980
3022
  }
2981
3023
  if (data.enable !== undefined) {
2982
3024
  this.enable = data.enable;
2983
3025
  }
2984
- const area = (_a = data.area) !== null && _a !== void 0 ? _a : data.value_area;
2985
- if (area !== undefined) {
2986
- 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;
2987
3029
  }
2988
- if (data.factor !== undefined) {
2989
- 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;
2990
3033
  }
2991
3034
  }
2992
3035
  }
@@ -3219,6 +3262,7 @@ class Size extends ValueWithRandom {
3219
3262
  }
3220
3263
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Stroke.js
3221
3264
 
3265
+
3222
3266
  class Stroke {
3223
3267
  constructor() {
3224
3268
  this.width = 0;
@@ -3231,10 +3275,10 @@ class Stroke {
3231
3275
  this.color = AnimatableColor.create(this.color, data.color);
3232
3276
  }
3233
3277
  if (data.width !== undefined) {
3234
- this.width = data.width;
3278
+ this.width = setRangeValue(data.width);
3235
3279
  }
3236
3280
  if (data.opacity !== undefined) {
3237
- this.opacity = data.opacity;
3281
+ this.opacity = setRangeValue(data.opacity);
3238
3282
  }
3239
3283
  }
3240
3284
  }
@@ -3495,9 +3539,14 @@ class Options {
3495
3539
  this.responsive.sort((a, b) => a.maxWidth - b.maxWidth);
3496
3540
  if (data.themes !== undefined) {
3497
3541
  for (const theme of data.themes) {
3498
- const optTheme = new Theme();
3499
- optTheme.load(theme);
3500
- this.themes.push(optTheme);
3542
+ const existingTheme = this.themes.find(t => t.name === theme.name);
3543
+ if (!existingTheme) {
3544
+ const optTheme = new Theme();
3545
+ optTheme.load(theme);
3546
+ this.themes.push(optTheme);
3547
+ } else {
3548
+ existingTheme.load(theme);
3549
+ }
3501
3550
  }
3502
3551
  }
3503
3552
  this.defaultThemes.dark = (_d = this._findDefaultTheme("dark")) === null || _d === void 0 ? void 0 : _d.name;
@@ -3560,10 +3609,10 @@ class InteractionManager {
3560
3609
  this._particleInteractors = [];
3561
3610
  for (const interactor of this._interactors) {
3562
3611
  switch (interactor.type) {
3563
- case 0:
3612
+ case "external":
3564
3613
  this._externalInteractors.push(interactor);
3565
3614
  break;
3566
- case 1:
3615
+ case "particles":
3567
3616
  this._particleInteractors.push(interactor);
3568
3617
  break;
3569
3618
  }
@@ -3619,6 +3668,7 @@ class Particle {
3619
3668
  this.init(id, position, overrideOptions, group);
3620
3669
  }
3621
3670
  destroy(override) {
3671
+ var _a;
3622
3672
  if (this.unbreakable || this.destroyed) {
3623
3673
  return;
3624
3674
  }
@@ -3635,6 +3685,7 @@ class Particle {
3635
3685
  updater.particleDestroyed(this, override);
3636
3686
  }
3637
3687
  }
3688
+ (_a = this.pathGenerator) === null || _a === void 0 ? void 0 : _a.reset(this);
3638
3689
  }
3639
3690
  draw(delta) {
3640
3691
  const container = this.container;
@@ -3644,22 +3695,8 @@ class Particle {
3644
3695
  container.canvas.drawParticle(this, delta);
3645
3696
  }
3646
3697
  getFillColor() {
3647
- var _a, _b;
3648
- const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
3649
- if (color && this.roll && (this.backColor || this.roll.alter)) {
3650
- const backFactor = this.roll.horizontal && this.roll.vertical ? 2 : 1,
3651
- backSum = this.roll.horizontal ? Math.PI / 2 : 0,
3652
- rolled = Math.floor((((_b = this.roll.angle) !== null && _b !== void 0 ? _b : 0) + backSum) / (Math.PI / backFactor)) % 2;
3653
- if (rolled) {
3654
- if (this.backColor) {
3655
- return this.backColor;
3656
- }
3657
- if (this.roll.alter) {
3658
- return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
3659
- }
3660
- }
3661
- }
3662
- return color;
3698
+ var _a;
3699
+ return this._getRollColor((_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color));
3663
3700
  }
3664
3701
  getMass() {
3665
3702
  return this.getRadius() ** 2 * Math.PI / 2;
@@ -3676,8 +3713,8 @@ class Particle {
3676
3713
  return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
3677
3714
  }
3678
3715
  getStrokeColor() {
3679
- var _a, _b;
3680
- 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));
3681
3718
  }
3682
3719
  init(id, position, overrideOptions, group) {
3683
3720
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -3746,24 +3783,25 @@ class Particle {
3746
3783
  maxLoops: getRangeValue(sizeOptions.animation.count)
3747
3784
  };
3748
3785
  if (sizeAnimation.enable) {
3749
- this.size.status = 0;
3786
+ this.size.status = "increasing";
3750
3787
  this.size.decay = 1 - getRangeValue(sizeAnimation.decay);
3751
3788
  switch (sizeAnimation.startValue) {
3752
3789
  case "min":
3753
3790
  this.size.value = this.size.min;
3754
- this.size.status = 0;
3791
+ this.size.status = "increasing";
3755
3792
  break;
3756
3793
  case "random":
3757
- this.size.value = randomInRange(this.size) * pxRatio;
3758
- this.size.status = getRandom() >= 0.5 ? 0 : 1;
3794
+ this.size.value = randomInRange(this.size);
3795
+ this.size.status = getRandom() >= 0.5 ? "increasing" : "decreasing";
3759
3796
  break;
3760
3797
  case "max":
3761
3798
  default:
3762
3799
  this.size.value = this.size.max;
3763
- this.size.status = 1;
3800
+ this.size.status = "decreasing";
3764
3801
  break;
3765
3802
  }
3766
3803
  }
3804
+ this.size.initialValue = this.size.value;
3767
3805
  this.bubble = {
3768
3806
  inRange: false
3769
3807
  };
@@ -3889,9 +3927,9 @@ class Particle {
3889
3927
  return pos;
3890
3928
  }
3891
3929
  _calculateVelocity() {
3892
- const baseVelocity = getParticleBaseVelocity(this.direction);
3893
- const res = baseVelocity.copy();
3894
- const moveOptions = this.options.move;
3930
+ const baseVelocity = getParticleBaseVelocity(this.direction),
3931
+ res = baseVelocity.copy(),
3932
+ moveOptions = this.options.move;
3895
3933
  if (moveOptions.direction === "inside" || moveOptions.direction === "outside") {
3896
3934
  return res;
3897
3935
  }
@@ -3932,6 +3970,25 @@ class Particle {
3932
3970
  }
3933
3971
  return overlaps;
3934
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
+ }
3935
3992
  _loadShapeData(shapeOptions, reduceDuplicates) {
3936
3993
  const shapeData = shapeOptions.options[this.shape];
3937
3994
  if (shapeData) {
@@ -4426,7 +4483,8 @@ const defaultPathGeneratorKey = "default",
4426
4483
  return v;
4427
4484
  },
4428
4485
  init: () => {},
4429
- update: () => {}
4486
+ update: () => {},
4487
+ reset: () => {}
4430
4488
  };
4431
4489
  class Container {
4432
4490
  constructor(engine, id, sourceOptions) {
@@ -4864,9 +4922,6 @@ class Container {
4864
4922
 
4865
4923
 
4866
4924
 
4867
- function fetchError(statusCode) {
4868
- console.error(`tsParticles - Error ${statusCode} while retrieving config file`);
4869
- }
4870
4925
  async function getDataFromUrl(jsonUrl, index) {
4871
4926
  const url = itemFromSingleOrMultiple(jsonUrl, index);
4872
4927
  if (!url) {
@@ -4876,7 +4931,7 @@ async function getDataFromUrl(jsonUrl, index) {
4876
4931
  if (response.ok) {
4877
4932
  return response.json();
4878
4933
  }
4879
- fetchError(response.status);
4934
+ console.error(`tsParticles - Error ${response.status} while retrieving config file`);
4880
4935
  }
4881
4936
  class Loader {
4882
4937
  constructor(engine) {
@@ -5017,6 +5072,7 @@ class Loader {
5017
5072
  }
5018
5073
  }
5019
5074
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/Plugins.js
5075
+
5020
5076
  function getItemsFromInitializer(container, map, initializers, force = false) {
5021
5077
  let res = map.get(container);
5022
5078
  if (!res || force) {
@@ -5065,10 +5121,12 @@ class Plugins {
5065
5121
  this.presets.set(presetKey, options);
5066
5122
  }
5067
5123
  }
5068
- addShapeDrawer(type, drawer) {
5069
- if (!this.getShapeDrawer(type)) {
5070
- this.drawers.set(type, drawer);
5071
- }
5124
+ addShapeDrawer(types, drawer) {
5125
+ executeOnSingleOrMultiple(types, type => {
5126
+ if (!this.getShapeDrawer(type)) {
5127
+ this.drawers.set(type, drawer);
5128
+ }
5129
+ });
5072
5130
  }
5073
5131
  destroy(container) {
5074
5132
  this.updaters.delete(container);
@@ -5244,7 +5302,7 @@ class HslColorManager {
5244
5302
  var _a;
5245
5303
  const colorValue = color.value,
5246
5304
  hslColor = (_a = colorValue.hsl) !== null && _a !== void 0 ? _a : color.value;
5247
- if (hslColor.h !== undefined && hslColor.l !== undefined) {
5305
+ if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
5248
5306
  return hslToRgb(hslColor);
5249
5307
  }
5250
5308
  }
@@ -5319,14 +5377,14 @@ class RgbColorManager {
5319
5377
  class ExternalInteractorBase {
5320
5378
  constructor(container) {
5321
5379
  this.container = container;
5322
- this.type = 0;
5380
+ this.type = "external";
5323
5381
  }
5324
5382
  }
5325
5383
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/ParticlesInteractorBase.js
5326
5384
  class ParticlesInteractorBase {
5327
5385
  constructor(container) {
5328
5386
  this.container = container;
5329
- this.type = 1;
5387
+ this.type = "particles";
5330
5388
  }
5331
5389
  }
5332
5390
  ;// CONCATENATED MODULE: ../../engine/dist/esm/index.js
@@ -5513,6 +5571,11 @@ tsParticles.init();
5513
5571
 
5514
5572
 
5515
5573
 
5574
+
5575
+
5576
+
5577
+
5578
+
5516
5579
 
5517
5580
 
5518
5581
 
@@ -7117,13 +7180,13 @@ function updateAngle(particle, delta) {
7117
7180
  return;
7118
7181
  }
7119
7182
  switch (rotate.status) {
7120
- case 0:
7183
+ case "increasing":
7121
7184
  rotate.value += speed;
7122
7185
  if (rotate.value > max) {
7123
7186
  rotate.value -= max;
7124
7187
  }
7125
7188
  break;
7126
- case 1:
7189
+ case "decreasing":
7127
7190
  default:
7128
7191
  rotate.value -= speed;
7129
7192
  if (rotate.value < 0) {
@@ -7157,10 +7220,10 @@ class RotateUpdater {
7157
7220
  switch (rotateDirection) {
7158
7221
  case "counter-clockwise":
7159
7222
  case "counterClockwise":
7160
- particle.rotate.status = 1;
7223
+ particle.rotate.status = "decreasing";
7161
7224
  break;
7162
7225
  case "clockwise":
7163
- particle.rotate.status = 0;
7226
+ particle.rotate.status = "increasing";
7164
7227
  break;
7165
7228
  }
7166
7229
  const rotateAnimation = rotateOptions.animation;
@@ -7388,11 +7451,33 @@ async function loadBaseMover(engine) {
7388
7451
  ;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/CircleDrawer.js
7389
7452
  class CircleDrawer {
7390
7453
  draw(context, particle, radius) {
7391
- 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);
7392
7462
  }
7393
7463
  getSidesCount() {
7394
7464
  return 12;
7395
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
+ }
7396
7481
  }
7397
7482
  ;// CONCATENATED MODULE: ../../shapes/circle/dist/esm/index.js
7398
7483
 
@@ -7404,22 +7489,32 @@ async function loadCircleShape(engine) {
7404
7489
  function updateColorValue(delta, value, valueAnimation, max, decrease) {
7405
7490
  var _a, _b;
7406
7491
  const colorValue = value;
7407
- if (!colorValue || !valueAnimation.enable) {
7492
+ if (!colorValue || !valueAnimation.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) {
7408
7493
  return;
7409
7494
  }
7410
7495
  const offset = randomInRange(valueAnimation.offset),
7411
7496
  velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6,
7412
7497
  decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
7413
- if (!decrease || colorValue.status === 0) {
7498
+ if (!decrease || colorValue.status === "increasing") {
7414
7499
  colorValue.value += velocity;
7415
- if (decrease && colorValue.value > max) {
7416
- colorValue.status = 1;
7417
- 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
+ }
7418
7509
  }
7419
7510
  } else {
7420
7511
  colorValue.value -= velocity;
7421
7512
  if (colorValue.value < 0) {
7422
- colorValue.status = 0;
7513
+ if (!colorValue.loops) {
7514
+ colorValue.loops = 0;
7515
+ }
7516
+ colorValue.loops++;
7517
+ colorValue.status = "increasing";
7423
7518
  colorValue.value += colorValue.value;
7424
7519
  }
7425
7520
  }
@@ -7433,14 +7528,17 @@ function updateColorValue(delta, value, valueAnimation, max, decrease) {
7433
7528
  function updateColor(particle, delta) {
7434
7529
  var _a, _b, _c;
7435
7530
  const animationOptions = particle.options.color.animation;
7436
- if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) {
7437
- 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);
7438
7536
  }
7439
- if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) {
7440
- updateColorValue(delta, particle.color.s, animationOptions.s, 100, true);
7537
+ if (s) {
7538
+ updateColorValue(delta, s, animationOptions.s, 100, true);
7441
7539
  }
7442
- if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) {
7443
- updateColorValue(delta, particle.color.l, animationOptions.l, 100, true);
7540
+ if (l) {
7541
+ updateColorValue(delta, l, animationOptions.l, 100, true);
7444
7542
  }
7445
7543
  }
7446
7544
  class ColorUpdater {
@@ -9272,9 +9370,7 @@ class ImageDrawer {
9272
9370
  ;// CONCATENATED MODULE: ../../shapes/image/dist/esm/index.js
9273
9371
 
9274
9372
  async function loadImageShape(engine) {
9275
- const imageDrawer = new ImageDrawer();
9276
- await engine.addShape("image", imageDrawer);
9277
- await engine.addShape("images", imageDrawer);
9373
+ await engine.addShape(["image", "images"], new ImageDrawer());
9278
9374
  }
9279
9375
  ;// CONCATENATED MODULE: ../../updaters/life/dist/esm/Options/Classes/LifeDelay.js
9280
9376
 
@@ -9476,9 +9572,9 @@ function updateOpacity(particle, delta) {
9476
9572
  return;
9477
9573
  }
9478
9574
  switch (particle.opacity.status) {
9479
- case 0:
9575
+ case "increasing":
9480
9576
  if (particle.opacity.value >= maxValue) {
9481
- particle.opacity.status = 1;
9577
+ particle.opacity.status = "decreasing";
9482
9578
  if (!particle.opacity.loops) {
9483
9579
  particle.opacity.loops = 0;
9484
9580
  }
@@ -9487,9 +9583,9 @@ function updateOpacity(particle, delta) {
9487
9583
  particle.opacity.value += ((_e = particle.opacity.velocity) !== null && _e !== void 0 ? _e : 0) * delta.factor;
9488
9584
  }
9489
9585
  break;
9490
- case 1:
9586
+ case "decreasing":
9491
9587
  if (particle.opacity.value <= minValue) {
9492
- particle.opacity.status = 0;
9588
+ particle.opacity.status = "increasing";
9493
9589
  if (!particle.opacity.loops) {
9494
9590
  particle.opacity.loops = 0;
9495
9591
  }
@@ -9524,23 +9620,23 @@ class OpacityUpdater {
9524
9620
  const opacityAnimation = opacityOptions.animation;
9525
9621
  if (opacityAnimation.enable) {
9526
9622
  particle.opacity.decay = 1 - getRangeValue(opacityAnimation.decay);
9527
- particle.opacity.status = 0;
9623
+ particle.opacity.status = "increasing";
9528
9624
  const opacityRange = opacityOptions.value;
9529
9625
  particle.opacity.min = getRangeMin(opacityRange);
9530
9626
  particle.opacity.max = getRangeMax(opacityRange);
9531
9627
  switch (opacityAnimation.startValue) {
9532
9628
  case "min":
9533
9629
  particle.opacity.value = particle.opacity.min;
9534
- particle.opacity.status = 0;
9630
+ particle.opacity.status = "increasing";
9535
9631
  break;
9536
9632
  case "random":
9537
9633
  particle.opacity.value = randomInRange(particle.opacity);
9538
- particle.opacity.status = getRandom() >= 0.5 ? 0 : 1;
9634
+ particle.opacity.status = getRandom() >= 0.5 ? "increasing" : "decreasing";
9539
9635
  break;
9540
9636
  case "max":
9541
9637
  default:
9542
9638
  particle.opacity.value = particle.opacity.max;
9543
- particle.opacity.status = 1;
9639
+ particle.opacity.status = "decreasing";
9544
9640
  break;
9545
9641
  }
9546
9642
  particle.opacity.velocity = getRangeValue(opacityAnimation.speed) / 100 * this.container.retina.reduceFactor;
@@ -9548,6 +9644,7 @@ class OpacityUpdater {
9548
9644
  particle.opacity.velocity *= getRandom();
9549
9645
  }
9550
9646
  }
9647
+ particle.opacity.initialValue = particle.opacity.value;
9551
9648
  }
9552
9649
  isEnabled(particle) {
9553
9650
  var _a, _b, _c, _d;
@@ -10290,6 +10387,7 @@ class Linker extends ParticlesInteractorBase {
10290
10387
  }
10291
10388
  clear() {}
10292
10389
  init() {
10390
+ this.linkContainer.particles.linksColor = undefined;
10293
10391
  this.linkContainer.particles.linksColors = new Map();
10294
10392
  }
10295
10393
  async interact(p1) {
@@ -10488,14 +10586,13 @@ class LinkInstance {
10488
10586
  }
10489
10587
  drawParticle(context, particle) {
10490
10588
  var _a;
10491
- const container = this.container,
10492
- pOptions = particle.options;
10589
+ const pOptions = particle.options;
10493
10590
  if (!particle.links || particle.links.length <= 0) {
10494
10591
  return;
10495
10592
  }
10496
10593
  const p1Links = particle.links.filter(l => pOptions.links && this.getLinkFrequency(particle, l.destination) <= pOptions.links.frequency);
10497
10594
  for (const link of p1Links) {
10498
- this.drawTriangles(container, pOptions, particle, link, p1Links);
10595
+ this.drawTriangles(pOptions, particle, link, p1Links);
10499
10596
  if (link.opacity > 0 && ((_a = particle.retina.linksWidth) !== null && _a !== void 0 ? _a : 0) > 0) {
10500
10597
  this.drawLinkLine(particle, link);
10501
10598
  }
@@ -10588,7 +10685,7 @@ class LinkInstance {
10588
10685
  drawLinkTriangle(ctx, pos1, pos2, pos3, options.backgroundMask.enable, options.backgroundMask.composite, colorTriangle, opacityTriangle);
10589
10686
  });
10590
10687
  }
10591
- drawTriangles(container, options, p1, link, p1Links) {
10688
+ drawTriangles(options, p1, link, p1Links) {
10592
10689
  var _a, _b, _c;
10593
10690
  const p2 = link.destination;
10594
10691
  if (!(((_a = options.links) === null || _a === void 0 ? void 0 : _a.triangles.enable) && ((_b = p2.options.links) === null || _b === void 0 ? void 0 : _b.triangles.enable))) {
@@ -10649,14 +10746,15 @@ async function loadParticlesLinksInteraction(engine) {
10649
10746
 
10650
10747
 
10651
10748
  ;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawerBase.js
10749
+
10652
10750
  class PolygonDrawerBase {
10653
10751
  draw(context, particle, radius) {
10654
- const start = this.getCenter(particle, radius);
10655
- const side = this.getSidesData(particle, radius);
10656
- const sideCount = side.count.numerator * side.count.denominator;
10657
- const decimalSides = side.count.numerator / side.count.denominator;
10658
- const interiorAngleDegrees = 180 * (decimalSides - 2) / decimalSides;
10659
- 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;
10660
10758
  if (!context) {
10661
10759
  return;
10662
10760
  }
@@ -10671,24 +10769,22 @@ class PolygonDrawerBase {
10671
10769
  }
10672
10770
  getSidesCount(particle) {
10673
10771
  var _a, _b;
10674
- const polygon = particle.shapeData;
10675
- 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;
10676
10775
  }
10677
10776
  }
10678
10777
  ;// CONCATENATED MODULE: ../../shapes/polygon/dist/esm/PolygonDrawer.js
10679
10778
 
10680
10779
  class PolygonDrawer extends PolygonDrawerBase {
10681
10780
  getCenter(particle, radius) {
10682
- const sides = this.getSidesCount(particle);
10683
10781
  return {
10684
- x: -radius / (sides / 3.5),
10782
+ x: -radius / (particle.sides / 3.5),
10685
10783
  y: -radius / (2.66 / 3.5)
10686
10784
  };
10687
10785
  }
10688
10786
  getSidesData(particle, radius) {
10689
- var _a, _b;
10690
- const polygon = particle.shapeData;
10691
- 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;
10692
10788
  return {
10693
10789
  count: {
10694
10790
  denominator: 1,
@@ -10759,9 +10855,9 @@ function updateSize(particle, delta) {
10759
10855
  return;
10760
10856
  }
10761
10857
  switch (particle.size.status) {
10762
- case 0:
10858
+ case "increasing":
10763
10859
  if (particle.size.value >= maxValue) {
10764
- particle.size.status = 1;
10860
+ particle.size.status = "decreasing";
10765
10861
  if (!particle.size.loops) {
10766
10862
  particle.size.loops = 0;
10767
10863
  }
@@ -10770,9 +10866,9 @@ function updateSize(particle, delta) {
10770
10866
  particle.size.value += sizeVelocity;
10771
10867
  }
10772
10868
  break;
10773
- case 1:
10869
+ case "decreasing":
10774
10870
  if (particle.size.value <= minValue) {
10775
- particle.size.status = 0;
10871
+ particle.size.status = "increasing";
10776
10872
  if (!particle.size.loops) {
10777
10873
  particle.size.loops = 0;
10778
10874
  }
@@ -10835,16 +10931,15 @@ class SquareDrawer {
10835
10931
 
10836
10932
  async function loadSquareShape(engine) {
10837
10933
  const drawer = new SquareDrawer();
10838
- await engine.addShape("edge", drawer);
10839
- await engine.addShape("square", drawer);
10934
+ await engine.addShape(["edge", "square"], drawer);
10840
10935
  }
10841
10936
  ;// CONCATENATED MODULE: ../../shapes/star/dist/esm/StarDrawer.js
10937
+
10842
10938
  class StarDrawer {
10843
10939
  draw(context, particle, radius) {
10844
10940
  var _a;
10845
- const star = particle.shapeData,
10846
- sides = this.getSidesCount(particle),
10847
- 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;
10848
10943
  context.moveTo(0, 0 - radius);
10849
10944
  for (let i = 0; i < sides; i++) {
10850
10945
  context.rotate(Math.PI / sides);
@@ -10856,7 +10951,13 @@ class StarDrawer {
10856
10951
  getSidesCount(particle) {
10857
10952
  var _a, _b;
10858
10953
  const star = particle.shapeData;
10859
- 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;
10860
10961
  }
10861
10962
  }
10862
10963
  ;// CONCATENATED MODULE: ../../shapes/star/dist/esm/index.js
@@ -10869,22 +10970,32 @@ async function loadStarShape(engine) {
10869
10970
  function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max, decrease) {
10870
10971
  var _a, _b;
10871
10972
  const colorValue = value;
10872
- if (!colorValue || !colorValue.enable) {
10973
+ if (!colorValue || !colorValue.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) {
10873
10974
  return;
10874
10975
  }
10875
10976
  const offset = randomInRange(valueAnimation.offset),
10876
10977
  velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6,
10877
10978
  decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
10878
- if (!decrease || colorValue.status === 0) {
10979
+ if (!decrease || colorValue.status === "increasing") {
10879
10980
  colorValue.value += velocity;
10880
- if (decrease && colorValue.value > max) {
10881
- colorValue.status = 1;
10882
- 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
+ }
10883
10990
  }
10884
10991
  } else {
10885
10992
  colorValue.value -= velocity;
10886
10993
  if (colorValue.value < 0) {
10887
- colorValue.status = 0;
10994
+ if (!colorValue.loops) {
10995
+ colorValue.loops = 0;
10996
+ }
10997
+ colorValue.loops++;
10998
+ colorValue.status = "increasing";
10888
10999
  colorValue.value += colorValue.value;
10889
11000
  }
10890
11001
  }
@@ -10896,22 +11007,20 @@ function StrokeColorUpdater_updateColorValue(delta, value, valueAnimation, max,
10896
11007
  }
10897
11008
  }
10898
11009
  function updateStrokeColor(particle, delta) {
10899
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
10900
- if (!((_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color)) {
11010
+ if (!particle.strokeColor || !particle.strokeAnimation) {
10901
11011
  return;
10902
11012
  }
10903
- const animationOptions = particle.stroke.color.animation,
10904
- 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;
10905
11014
  if (h) {
10906
- StrokeColorUpdater_updateColorValue(delta, h, animationOptions.h, 360, false);
11015
+ StrokeColorUpdater_updateColorValue(delta, h, particle.strokeAnimation.h, 360, false);
10907
11016
  }
10908
- 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;
10909
11018
  if (s) {
10910
- StrokeColorUpdater_updateColorValue(delta, s, animationOptions.s, 100, true);
11019
+ StrokeColorUpdater_updateColorValue(delta, s, particle.strokeAnimation.s, 100, true);
10911
11020
  }
10912
- 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;
10913
11022
  if (l) {
10914
- StrokeColorUpdater_updateColorValue(delta, l, animationOptions.l, 100, true);
11023
+ StrokeColorUpdater_updateColorValue(delta, l, particle.strokeAnimation.l, 100, true);
10915
11024
  }
10916
11025
  }
10917
11026
  class StrokeColorUpdater {
@@ -10919,19 +11028,21 @@ class StrokeColorUpdater {
10919
11028
  this.container = container;
10920
11029
  }
10921
11030
  init(particle) {
10922
- var _a, _b;
11031
+ var _a, _b, _c;
10923
11032
  const container = this.container;
10924
- particle.stroke = itemFromSingleOrMultiple(particle.options.stroke, particle.id, particle.options.reduceDuplicates);
10925
- particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
10926
- 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();
10927
11038
  if (strokeHslColor) {
10928
- 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);
10929
11040
  }
10930
11041
  }
10931
11042
  isEnabled(particle) {
10932
- var _a, _b, _c, _d;
10933
- const color = (_a = particle.stroke) === null || _a === void 0 ? void 0 : _a.color;
10934
- 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);
10935
11046
  }
10936
11047
  update(particle, delta) {
10937
11048
  if (!this.isEnabled(particle)) {
@@ -11001,10 +11112,7 @@ class TextDrawer {
11001
11112
  ;// CONCATENATED MODULE: ../../shapes/text/dist/esm/index.js
11002
11113
 
11003
11114
  async function loadTextShape(engine) {
11004
- const drawer = new TextDrawer();
11005
- for (const type of validTypes) {
11006
- await engine.addShape(type, drawer);
11007
- }
11115
+ await engine.addShape(validTypes, new TextDrawer());
11008
11116
  }
11009
11117
  ;// CONCATENATED MODULE: ../slim/dist/esm/index.js
11010
11118
 
@@ -11138,13 +11246,13 @@ function updateTilt(particle, delta) {
11138
11246
  return;
11139
11247
  }
11140
11248
  switch (particle.tilt.status) {
11141
- case 0:
11249
+ case "increasing":
11142
11250
  particle.tilt.value += speed;
11143
11251
  if (particle.tilt.value > max) {
11144
11252
  particle.tilt.value -= max;
11145
11253
  }
11146
11254
  break;
11147
- case 1:
11255
+ case "decreasing":
11148
11256
  default:
11149
11257
  particle.tilt.value -= speed;
11150
11258
  if (particle.tilt.value < 0) {
@@ -11188,10 +11296,10 @@ class TiltUpdater {
11188
11296
  switch (tiltDirection) {
11189
11297
  case "counter-clockwise":
11190
11298
  case "counterClockwise":
11191
- particle.tilt.status = 1;
11299
+ particle.tilt.status = "decreasing";
11192
11300
  break;
11193
11301
  case "clockwise":
11194
- particle.tilt.status = 0;
11302
+ particle.tilt.status = "increasing";
11195
11303
  break;
11196
11304
  }
11197
11305
  const tiltAnimation = (_a = particle.options.tilt) === null || _a === void 0 ? void 0 : _a.animation;