tsparticles 1.42.1 → 1.42.4

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 (77) 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/browser/Core/Canvas.d.ts +1 -1
  5. package/browser/Core/Canvas.js +16 -7
  6. package/browser/Core/Particles.js +2 -3
  7. package/esm/Core/Canvas.d.ts +1 -1
  8. package/esm/Core/Canvas.js +16 -7
  9. package/esm/Core/Particles.js +2 -3
  10. package/package.json +15 -3
  11. package/report.html +2 -2
  12. package/report.slim.html +2 -2
  13. package/tsparticles.engine.js +15 -10
  14. package/tsparticles.engine.min.js +2 -2
  15. package/tsparticles.interaction.external.attract.js +15 -10
  16. package/tsparticles.interaction.external.attract.min.js +1 -1
  17. package/tsparticles.interaction.external.bounce.js +15 -10
  18. package/tsparticles.interaction.external.bounce.min.js +1 -1
  19. package/tsparticles.interaction.external.bubble.js +15 -10
  20. package/tsparticles.interaction.external.bubble.min.js +1 -1
  21. package/tsparticles.interaction.external.connect.js +15 -10
  22. package/tsparticles.interaction.external.connect.min.js +1 -1
  23. package/tsparticles.interaction.external.grab.js +15 -10
  24. package/tsparticles.interaction.external.grab.min.js +1 -1
  25. package/tsparticles.interaction.external.repulse.js +15 -10
  26. package/tsparticles.interaction.external.repulse.min.js +1 -1
  27. package/tsparticles.interaction.external.trail.js +15 -10
  28. package/tsparticles.interaction.external.trail.min.js +1 -1
  29. package/tsparticles.interaction.particles.attract.js +15 -10
  30. package/tsparticles.interaction.particles.attract.min.js +1 -1
  31. package/tsparticles.interaction.particles.collisions.js +15 -10
  32. package/tsparticles.interaction.particles.collisions.min.js +1 -1
  33. package/tsparticles.interaction.particles.links.js +15 -10
  34. package/tsparticles.interaction.particles.links.min.js +1 -1
  35. package/tsparticles.js +15 -10
  36. package/tsparticles.min.js +2 -2
  37. package/tsparticles.pathseg.min.js +1 -1
  38. package/tsparticles.plugins.absorbers.js +15 -10
  39. package/tsparticles.plugins.absorbers.min.js +1 -1
  40. package/tsparticles.plugins.emitters.js +15 -10
  41. package/tsparticles.plugins.emitters.min.js +1 -1
  42. package/tsparticles.plugins.polygonMask.js +15 -10
  43. package/tsparticles.plugins.polygonMask.min.js +1 -1
  44. package/tsparticles.shape.circle.min.js +1 -1
  45. package/tsparticles.shape.image.js +15 -10
  46. package/tsparticles.shape.image.min.js +1 -1
  47. package/tsparticles.shape.line.min.js +1 -1
  48. package/tsparticles.shape.polygon.min.js +1 -1
  49. package/tsparticles.shape.square.min.js +1 -1
  50. package/tsparticles.shape.star.min.js +1 -1
  51. package/tsparticles.shape.text.js +15 -10
  52. package/tsparticles.shape.text.min.js +1 -1
  53. package/tsparticles.slim.js +15 -10
  54. package/tsparticles.slim.min.js +2 -2
  55. package/tsparticles.updater.angle.js +15 -10
  56. package/tsparticles.updater.angle.min.js +1 -1
  57. package/tsparticles.updater.color.js +15 -10
  58. package/tsparticles.updater.color.min.js +1 -1
  59. package/tsparticles.updater.life.js +15 -10
  60. package/tsparticles.updater.life.min.js +1 -1
  61. package/tsparticles.updater.opacity.js +15 -10
  62. package/tsparticles.updater.opacity.min.js +1 -1
  63. package/tsparticles.updater.outModes.js +15 -10
  64. package/tsparticles.updater.outModes.min.js +1 -1
  65. package/tsparticles.updater.roll.js +15 -10
  66. package/tsparticles.updater.roll.min.js +1 -1
  67. package/tsparticles.updater.size.js +15 -10
  68. package/tsparticles.updater.size.min.js +1 -1
  69. package/tsparticles.updater.strokeColor.js +15 -10
  70. package/tsparticles.updater.strokeColor.min.js +1 -1
  71. package/tsparticles.updater.tilt.js +15 -10
  72. package/tsparticles.updater.tilt.min.js +1 -1
  73. package/tsparticles.updater.wobble.js +15 -10
  74. package/tsparticles.updater.wobble.min.js +1 -1
  75. package/umd/Core/Canvas.d.ts +1 -1
  76. package/umd/Core/Canvas.js +16 -7
  77. package/umd/Core/Particles.js +2 -3
@@ -941,9 +941,9 @@
941
941
  paint() {
942
942
  const options = this.container.actualOptions;
943
943
  this.draw((ctx => {
944
- if (options.backgroundMask.enable && options.backgroundMask.cover && this.coverColor) {
944
+ if (options.backgroundMask.enable && options.backgroundMask.cover) {
945
945
  clear(ctx, this.size);
946
- this.paintBase(getStyleFromRgb(this.coverColor, this.coverColor.a));
946
+ this.paintBase(this.coverColorStyle);
947
947
  } else {
948
948
  this.paintBase();
949
949
  }
@@ -986,11 +986,16 @@
986
986
  const container = this.container;
987
987
  const pxRatio = container.retina.pixelRatio;
988
988
  const size = container.canvas.size;
989
+ const newSize = {
990
+ width: this.element.offsetWidth * pxRatio,
991
+ height: this.element.offsetHeight * pxRatio
992
+ };
993
+ if (newSize.height === size.height && newSize.width === size.width && newSize.height === this.element.height && newSize.width === this.element.width) {
994
+ return;
995
+ }
989
996
  const oldSize = Object.assign({}, size);
990
- size.width = this.element.offsetWidth * pxRatio;
991
- size.height = this.element.offsetHeight * pxRatio;
992
- this.element.width = size.width;
993
- this.element.height = size.height;
997
+ this.element.width = size.width = this.element.offsetWidth * pxRatio;
998
+ this.element.height = size.height = this.element.offsetHeight * pxRatio;
994
999
  if (this.container.started) {
995
1000
  this.resizeFactor = {
996
1001
  width: size.width / oldSize.width,
@@ -1114,12 +1119,13 @@
1114
1119
  const color = cover.color;
1115
1120
  const coverRgb = colorToRgb(color);
1116
1121
  if (coverRgb) {
1117
- this.coverColor = {
1122
+ const coverColor = {
1118
1123
  r: coverRgb.r,
1119
1124
  g: coverRgb.g,
1120
1125
  b: coverRgb.b,
1121
1126
  a: cover.opacity
1122
1127
  };
1128
+ this.coverColorStyle = getStyleFromRgb(coverColor, coverColor.a);
1123
1129
  }
1124
1130
  }
1125
1131
  initTrail() {
@@ -3306,10 +3312,9 @@
3306
3312
  delete container.canvas.resizeFactor;
3307
3313
  }
3308
3314
  async draw(delta) {
3309
- const container = this.container;
3310
- container.canvas.clear();
3311
- const canvasSize = this.container.canvas.size;
3315
+ const container = this.container, canvasSize = this.container.canvas.size;
3312
3316
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
3317
+ container.canvas.clear();
3313
3318
  await this.update(delta);
3314
3319
  if (this.needsSort) {
3315
3320
  this.zArray.sort(((a, b) => b.position.z - a.position.z || a.id - b.id));
@@ -1,2 +1,2 @@
1
- /*! tsParticles v1.42.1 by Matteo Bruni */
1
+ /*! tsParticles v1.42.4 by Matteo Bruni */
2
2
  !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(window,(function(){return function(){"use strict";var e={d:function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{loadTiltUpdater:function(){return u}});class o{}o.generatedAttribute="generated",o.randomColorValue="random",o.midColorValue="mid",o.touchEndEvent="touchend",o.mouseDownEvent="mousedown",o.mouseUpEvent="mouseup",o.mouseMoveEvent="mousemove",o.touchStartEvent="touchstart",o.touchMoveEvent="touchmove",o.mouseLeaveEvent="mouseleave",o.mouseOutEvent="mouseout",o.touchCancelEvent="touchcancel",o.resizeEvent="resize",o.visibilityChangeEvent="visibilitychange",o.noPolygonDataLoaded="No polygon data loaded.",o.noPolygonFound="No polygon found, you need to specify SVG url in config.";new WeakMap;new WeakMap;new WeakMap,new WeakSet;new WeakMap;new WeakMap;new WeakMap;function n(e){return"number"==typeof e?e:function(e){const t=i(e);let o=a(e);return t===o&&(o=0),Math.random()*(t-o)+o}(e)}function a(e){return"number"==typeof e?e:e.min}function i(e){return"number"==typeof e?e:e.max}new WeakMap;class r{constructor(e){this.container=e}init(e){const t=e.options.tilt;e.tilt={enable:t.enable,value:n(t.value)*Math.PI/180,sinDirection:Math.random()>=.5?1:-1,cosDirection:Math.random()>=.5?1:-1};let o=t.direction;if("random"===o){o=Math.floor(2*Math.random())>0?"counter-clockwise":"clockwise"}switch(o){case"counter-clockwise":case"counterClockwise":e.tilt.status=1;break;case"clockwise":e.tilt.status=0}const a=e.options.tilt.animation;a.enable&&(e.tilt.velocity=n(a.speed)/360*this.container.retina.reduceFactor,a.sync||(e.tilt.velocity*=Math.random()))}isEnabled(e){const t=e.options.tilt.animation;return!e.destroyed&&!e.spawning&&t.enable}update(e,t){this.isEnabled(e)&&function(e,t){var o;if(!e.tilt)return;const n=e.options.tilt.animation,a=(null!==(o=e.tilt.velocity)&&void 0!==o?o:0)*t.factor,i=2*Math.PI;if(n.enable)switch(e.tilt.status){case 0:e.tilt.value+=a,e.tilt.value>i&&(e.tilt.value-=i);break;case 1:default:e.tilt.value-=a,e.tilt.value<0&&(e.tilt.value+=i)}}(e,t)}}async function u(e){await e.addParticleUpdater("tilt",(e=>new r(e)))}return t}()}));
@@ -941,9 +941,9 @@
941
941
  paint() {
942
942
  const options = this.container.actualOptions;
943
943
  this.draw((ctx => {
944
- if (options.backgroundMask.enable && options.backgroundMask.cover && this.coverColor) {
944
+ if (options.backgroundMask.enable && options.backgroundMask.cover) {
945
945
  clear(ctx, this.size);
946
- this.paintBase(getStyleFromRgb(this.coverColor, this.coverColor.a));
946
+ this.paintBase(this.coverColorStyle);
947
947
  } else {
948
948
  this.paintBase();
949
949
  }
@@ -986,11 +986,16 @@
986
986
  const container = this.container;
987
987
  const pxRatio = container.retina.pixelRatio;
988
988
  const size = container.canvas.size;
989
+ const newSize = {
990
+ width: this.element.offsetWidth * pxRatio,
991
+ height: this.element.offsetHeight * pxRatio
992
+ };
993
+ if (newSize.height === size.height && newSize.width === size.width && newSize.height === this.element.height && newSize.width === this.element.width) {
994
+ return;
995
+ }
989
996
  const oldSize = Object.assign({}, size);
990
- size.width = this.element.offsetWidth * pxRatio;
991
- size.height = this.element.offsetHeight * pxRatio;
992
- this.element.width = size.width;
993
- this.element.height = size.height;
997
+ this.element.width = size.width = this.element.offsetWidth * pxRatio;
998
+ this.element.height = size.height = this.element.offsetHeight * pxRatio;
994
999
  if (this.container.started) {
995
1000
  this.resizeFactor = {
996
1001
  width: size.width / oldSize.width,
@@ -1114,12 +1119,13 @@
1114
1119
  const color = cover.color;
1115
1120
  const coverRgb = colorToRgb(color);
1116
1121
  if (coverRgb) {
1117
- this.coverColor = {
1122
+ const coverColor = {
1118
1123
  r: coverRgb.r,
1119
1124
  g: coverRgb.g,
1120
1125
  b: coverRgb.b,
1121
1126
  a: cover.opacity
1122
1127
  };
1128
+ this.coverColorStyle = getStyleFromRgb(coverColor, coverColor.a);
1123
1129
  }
1124
1130
  }
1125
1131
  initTrail() {
@@ -3306,10 +3312,9 @@
3306
3312
  delete container.canvas.resizeFactor;
3307
3313
  }
3308
3314
  async draw(delta) {
3309
- const container = this.container;
3310
- container.canvas.clear();
3311
- const canvasSize = this.container.canvas.size;
3315
+ const container = this.container, canvasSize = this.container.canvas.size;
3312
3316
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
3317
+ container.canvas.clear();
3313
3318
  await this.update(delta);
3314
3319
  if (this.needsSort) {
3315
3320
  this.zArray.sort(((a, b) => b.position.z - a.position.z || a.id - b.id));
@@ -1,2 +1,2 @@
1
- /*! tsParticles v1.42.1 by Matteo Bruni */
1
+ /*! tsParticles v1.42.4 by Matteo Bruni */
2
2
  !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var n=o();for(var t in n)("object"==typeof exports?exports:e)[t]=n[t]}}(window,(function(){return function(){"use strict";var e={d:function(o,n){for(var t in n)e.o(n,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:n[t]})},o:function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{loadWobbleUpdater:function(){return u}});class n{}n.generatedAttribute="generated",n.randomColorValue="random",n.midColorValue="mid",n.touchEndEvent="touchend",n.mouseDownEvent="mousedown",n.mouseUpEvent="mouseup",n.mouseMoveEvent="mousemove",n.touchStartEvent="touchstart",n.touchMoveEvent="touchmove",n.mouseLeaveEvent="mouseleave",n.mouseOutEvent="mouseout",n.touchCancelEvent="touchcancel",n.resizeEvent="resize",n.visibilityChangeEvent="visibilitychange",n.noPolygonDataLoaded="No polygon data loaded.",n.noPolygonFound="No polygon found, you need to specify SVG url in config.";new WeakMap;new WeakMap;new WeakMap,new WeakSet;new WeakMap;new WeakMap;new WeakMap;function t(e){return"number"==typeof e?e:function(e){const o=i(e);let n=a(e);return o===n&&(n=0),Math.random()*(o-n)+n}(e)}function a(e){return"number"==typeof e?e:e.min}function i(e){return"number"==typeof e?e:e.max}new WeakMap;class r{constructor(e){this.container=e}init(e){const o=e.options.wobble;o.enable?e.wobble={angle:Math.random()*Math.PI*2,speed:t(o.speed)/360}:e.wobble={angle:0,speed:0},e.retina.wobbleDistance=t(o.distance)*this.container.retina.pixelRatio}isEnabled(e){return!e.destroyed&&!e.spawning&&e.options.wobble.enable}update(e,o){this.isEnabled(e)&&function(e,o){var n;if(!e.options.wobble.enable||!e.wobble)return;const t=e.wobble.speed*o.factor,a=(null!==(n=e.retina.wobbleDistance)&&void 0!==n?n:0)*o.factor/(1e3/60),i=2*Math.PI;e.wobble.angle+=t,e.wobble.angle>i&&(e.wobble.angle-=i),e.position.x+=a*Math.cos(e.wobble.angle),e.position.y+=a*Math.abs(Math.sin(e.wobble.angle))}(e,o)}}async function u(e){await e.addParticleUpdater("wobble",(e=>new r(e)))}return o}()}));
@@ -8,7 +8,7 @@ export declare class Canvas {
8
8
  resizeFactor?: IDimension;
9
9
  private context;
10
10
  private generatedCanvas;
11
- private coverColor?;
11
+ private coverColorStyle?;
12
12
  private trailFillColor?;
13
13
  private originalStyle?;
14
14
  constructor(container: Container);
@@ -59,9 +59,9 @@
59
59
  paint() {
60
60
  const options = this.container.actualOptions;
61
61
  this.draw((ctx) => {
62
- if (options.backgroundMask.enable && options.backgroundMask.cover && this.coverColor) {
62
+ if (options.backgroundMask.enable && options.backgroundMask.cover) {
63
63
  (0, Utils_1.clear)(ctx, this.size);
64
- this.paintBase((0, Utils_1.getStyleFromRgb)(this.coverColor, this.coverColor.a));
64
+ this.paintBase(this.coverColorStyle);
65
65
  }
66
66
  else {
67
67
  this.paintBase();
@@ -107,11 +107,19 @@
107
107
  const container = this.container;
108
108
  const pxRatio = container.retina.pixelRatio;
109
109
  const size = container.canvas.size;
110
+ const newSize = {
111
+ width: this.element.offsetWidth * pxRatio,
112
+ height: this.element.offsetHeight * pxRatio,
113
+ };
114
+ if (newSize.height === size.height &&
115
+ newSize.width === size.width &&
116
+ newSize.height === this.element.height &&
117
+ newSize.width === this.element.width) {
118
+ return;
119
+ }
110
120
  const oldSize = Object.assign({}, size);
111
- size.width = this.element.offsetWidth * pxRatio;
112
- size.height = this.element.offsetHeight * pxRatio;
113
- this.element.width = size.width;
114
- this.element.height = size.height;
121
+ this.element.width = size.width = this.element.offsetWidth * pxRatio;
122
+ this.element.height = size.height = this.element.offsetHeight * pxRatio;
115
123
  if (this.container.started) {
116
124
  this.resizeFactor = {
117
125
  width: size.width / oldSize.width,
@@ -238,12 +246,13 @@
238
246
  const color = cover.color;
239
247
  const coverRgb = (0, Utils_1.colorToRgb)(color);
240
248
  if (coverRgb) {
241
- this.coverColor = {
249
+ const coverColor = {
242
250
  r: coverRgb.r,
243
251
  g: coverRgb.g,
244
252
  b: coverRgb.b,
245
253
  a: cover.opacity,
246
254
  };
255
+ this.coverColorStyle = (0, Utils_1.getStyleFromRgb)(coverColor, coverColor.a);
247
256
  }
248
257
  }
249
258
  initTrail() {
@@ -156,10 +156,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
156
156
  delete container.canvas.resizeFactor;
157
157
  }
158
158
  async draw(delta) {
159
- const container = this.container;
160
- container.canvas.clear();
161
- const canvasSize = this.container.canvas.size;
159
+ const container = this.container, canvasSize = this.container.canvas.size;
162
160
  this.quadTree = new Utils_1.QuadTree(new Utils_1.Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, (canvasSize.width * 3) / 2, (canvasSize.height * 3) / 2), 4);
161
+ container.canvas.clear();
163
162
  await this.update(delta);
164
163
  if (this.needsSort) {
165
164
  this.zArray.sort((a, b) => b.position.z - a.position.z || a.id - b.id);