canvasparticles-js 3.7.2 → 3.7.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.
@@ -9,7 +9,7 @@
9
9
  typeof self !== 'undefined' ? self : this,
10
10
  () =>
11
11
  class CanvasParticles {
12
- static version = '3.7.2'
12
+ static version = '3.7.3'
13
13
 
14
14
  // Mouse interaction with the particles.
15
15
  static interactionType = Object.freeze({
@@ -84,9 +84,12 @@
84
84
  this.offY = (this.canvas.height - this.height) / 2
85
85
 
86
86
  if (this.options.particles.regenerateOnResize || this.particles.length === 0) this.newParticles()
87
- else this.matchParticleCount()
87
+ else {
88
+ // Only update bounds of reused particles
89
+ this.particles.forEach(particle => this.#updateParticleBounds(particle))
88
90
 
89
- this.particles.forEach(particle => this.#updateParticleBounds(particle))
91
+ this.matchParticleCount()
92
+ }
90
93
  }
91
94
 
92
95
  updateMousePos(event) {
@@ -621,5 +624,5 @@
621
624
  // Recalculate the stroke style table.
622
625
  this.strokeStyleTable = this.#generateStrokeStyleTable(this.options.particles.color)
623
626
  }
624
- },
627
+ }
625
628
  )
@@ -2,7 +2,7 @@
2
2
  // https://github.com/Khoeckman/canvasparticles-js/blob/main/LICENSE
3
3
 
4
4
  export default class CanvasParticles {
5
- static version = '3.7.2'
5
+ static version = '3.7.3'
6
6
 
7
7
  // Mouse interaction with the particles.
8
8
  static interactionType = Object.freeze({
@@ -77,9 +77,12 @@ export default class CanvasParticles {
77
77
  this.offY = (this.canvas.height - this.height) / 2
78
78
 
79
79
  if (this.options.particles.regenerateOnResize || this.particles.length === 0) this.newParticles()
80
- else this.matchParticleCount()
80
+ else {
81
+ // Only update bounds of reused particles
82
+ this.particles.forEach(particle => this.#updateParticleBounds(particle))
81
83
 
82
- this.particles.forEach(particle => this.#updateParticleBounds(particle))
84
+ this.matchParticleCount()
85
+ }
83
86
  }
84
87
 
85
88
  updateMousePos(event) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasparticles-js",
3
- "version": "3.7.2",
3
+ "version": "3.7.3",
4
4
  "description": "In an HTML canvas, a bunch of interactive particles connected with lines when they approach each other.",
5
5
  "main": "canvasParticles.js",
6
6
  "module": "canvasParticles.mjs",