tsparticles 1.42.0 → 1.42.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/Core/Canvas.d.ts +1 -1
  2. package/Core/Canvas.js +16 -7
  3. package/Core/Particles.js +2 -3
  4. package/Plugins/Emitters/Options/Classes/Emitter.js +2 -2
  5. package/browser/Core/Canvas.d.ts +1 -1
  6. package/browser/Core/Canvas.js +16 -7
  7. package/browser/Core/Particles.js +3 -4
  8. package/browser/Plugins/Emitters/Options/Classes/Emitter.js +2 -2
  9. package/esm/Core/Canvas.d.ts +1 -1
  10. package/esm/Core/Canvas.js +16 -7
  11. package/esm/Core/Particles.js +2 -3
  12. package/esm/Plugins/Emitters/Options/Classes/Emitter.js +2 -2
  13. package/package.json +15 -3
  14. package/report.html +2 -2
  15. package/report.slim.html +2 -2
  16. package/tsparticles.engine.js +15 -10
  17. package/tsparticles.engine.min.js +2 -2
  18. package/tsparticles.interaction.external.attract.js +15 -10
  19. package/tsparticles.interaction.external.attract.min.js +1 -1
  20. package/tsparticles.interaction.external.bounce.js +15 -10
  21. package/tsparticles.interaction.external.bounce.min.js +1 -1
  22. package/tsparticles.interaction.external.bubble.js +15 -10
  23. package/tsparticles.interaction.external.bubble.min.js +1 -1
  24. package/tsparticles.interaction.external.connect.js +15 -10
  25. package/tsparticles.interaction.external.connect.min.js +1 -1
  26. package/tsparticles.interaction.external.grab.js +15 -10
  27. package/tsparticles.interaction.external.grab.min.js +1 -1
  28. package/tsparticles.interaction.external.repulse.js +15 -10
  29. package/tsparticles.interaction.external.repulse.min.js +1 -1
  30. package/tsparticles.interaction.external.trail.js +15 -10
  31. package/tsparticles.interaction.external.trail.min.js +1 -1
  32. package/tsparticles.interaction.particles.attract.js +15 -10
  33. package/tsparticles.interaction.particles.attract.min.js +1 -1
  34. package/tsparticles.interaction.particles.collisions.js +15 -10
  35. package/tsparticles.interaction.particles.collisions.min.js +1 -1
  36. package/tsparticles.interaction.particles.links.js +15 -10
  37. package/tsparticles.interaction.particles.links.min.js +1 -1
  38. package/tsparticles.js +17 -12
  39. package/tsparticles.min.js +2 -2
  40. package/tsparticles.pathseg.min.js +1 -1
  41. package/tsparticles.plugins.absorbers.js +15 -10
  42. package/tsparticles.plugins.absorbers.min.js +1 -1
  43. package/tsparticles.plugins.emitters.js +17 -12
  44. package/tsparticles.plugins.emitters.min.js +2 -2
  45. package/tsparticles.plugins.polygonMask.js +15 -10
  46. package/tsparticles.plugins.polygonMask.min.js +1 -1
  47. package/tsparticles.shape.circle.min.js +1 -1
  48. package/tsparticles.shape.image.js +15 -10
  49. package/tsparticles.shape.image.min.js +1 -1
  50. package/tsparticles.shape.line.min.js +1 -1
  51. package/tsparticles.shape.polygon.min.js +1 -1
  52. package/tsparticles.shape.square.min.js +1 -1
  53. package/tsparticles.shape.star.min.js +1 -1
  54. package/tsparticles.shape.text.js +15 -10
  55. package/tsparticles.shape.text.min.js +1 -1
  56. package/tsparticles.slim.js +15 -10
  57. package/tsparticles.slim.min.js +2 -2
  58. package/tsparticles.updater.angle.js +15 -10
  59. package/tsparticles.updater.angle.min.js +1 -1
  60. package/tsparticles.updater.color.js +15 -10
  61. package/tsparticles.updater.color.min.js +1 -1
  62. package/tsparticles.updater.life.js +15 -10
  63. package/tsparticles.updater.life.min.js +1 -1
  64. package/tsparticles.updater.opacity.js +15 -10
  65. package/tsparticles.updater.opacity.min.js +1 -1
  66. package/tsparticles.updater.outModes.js +15 -10
  67. package/tsparticles.updater.outModes.min.js +1 -1
  68. package/tsparticles.updater.roll.js +15 -10
  69. package/tsparticles.updater.roll.min.js +1 -1
  70. package/tsparticles.updater.size.js +15 -10
  71. package/tsparticles.updater.size.min.js +1 -1
  72. package/tsparticles.updater.strokeColor.js +15 -10
  73. package/tsparticles.updater.strokeColor.min.js +1 -1
  74. package/tsparticles.updater.tilt.js +15 -10
  75. package/tsparticles.updater.tilt.min.js +1 -1
  76. package/tsparticles.updater.wobble.js +15 -10
  77. package/tsparticles.updater.wobble.min.js +1 -1
  78. package/umd/Core/Canvas.d.ts +1 -1
  79. package/umd/Core/Canvas.js +16 -7
  80. package/umd/Core/Particles.js +2 -3
  81. package/umd/Plugins/Emitters/Options/Classes/Emitter.js +2 -2
@@ -2515,9 +2515,9 @@
2515
2515
  paint() {
2516
2516
  const options = this.container.actualOptions;
2517
2517
  this.draw((ctx => {
2518
- if (options.backgroundMask.enable && options.backgroundMask.cover && this.coverColor) {
2518
+ if (options.backgroundMask.enable && options.backgroundMask.cover) {
2519
2519
  clear(ctx, this.size);
2520
- this.paintBase(getStyleFromRgb(this.coverColor, this.coverColor.a));
2520
+ this.paintBase(this.coverColorStyle);
2521
2521
  } else {
2522
2522
  this.paintBase();
2523
2523
  }
@@ -2560,11 +2560,16 @@
2560
2560
  const container = this.container;
2561
2561
  const pxRatio = container.retina.pixelRatio;
2562
2562
  const size = container.canvas.size;
2563
+ const newSize = {
2564
+ width: this.element.offsetWidth * pxRatio,
2565
+ height: this.element.offsetHeight * pxRatio
2566
+ };
2567
+ if (newSize.height === size.height && newSize.width === size.width && newSize.height === this.element.height && newSize.width === this.element.width) {
2568
+ return;
2569
+ }
2563
2570
  const oldSize = Object.assign({}, size);
2564
- size.width = this.element.offsetWidth * pxRatio;
2565
- size.height = this.element.offsetHeight * pxRatio;
2566
- this.element.width = size.width;
2567
- this.element.height = size.height;
2571
+ this.element.width = size.width = this.element.offsetWidth * pxRatio;
2572
+ this.element.height = size.height = this.element.offsetHeight * pxRatio;
2568
2573
  if (this.container.started) {
2569
2574
  this.resizeFactor = {
2570
2575
  width: size.width / oldSize.width,
@@ -2688,12 +2693,13 @@
2688
2693
  const color = cover.color;
2689
2694
  const coverRgb = colorToRgb(color);
2690
2695
  if (coverRgb) {
2691
- this.coverColor = {
2696
+ const coverColor = {
2692
2697
  r: coverRgb.r,
2693
2698
  g: coverRgb.g,
2694
2699
  b: coverRgb.b,
2695
2700
  a: cover.opacity
2696
2701
  };
2702
+ this.coverColorStyle = getStyleFromRgb(coverColor, coverColor.a);
2697
2703
  }
2698
2704
  }
2699
2705
  initTrail() {
@@ -5902,9 +5908,7 @@
5902
5908
  delete container.canvas.resizeFactor;
5903
5909
  }
5904
5910
  async draw(delta) {
5905
- const container = this.container;
5906
- container.canvas.clear();
5907
- const canvasSize = this.container.canvas.size;
5911
+ const container = this.container, canvasSize = this.container.canvas.size;
5908
5912
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
5909
5913
  await this.update(delta);
5910
5914
  if (this.needsSort) {
@@ -5912,6 +5916,7 @@
5912
5916
  this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
5913
5917
  this.needsSort = false;
5914
5918
  }
5919
+ container.canvas.clear();
5915
5920
  for (const [, plugin] of container.plugins) {
5916
5921
  container.canvas.drawPlugin(plugin, delta);
5917
5922
  }