tsparticles 3.0.0 → 3.0.2
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.
package/tsparticles.bundle.js
CHANGED
|
@@ -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
|
-
* v3.0.
|
|
7
|
+
* v3.0.2
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -3901,6 +3901,12 @@ class Particle {
|
|
|
3901
3901
|
updater.particleDestroyed && updater.particleDestroyed(this, override);
|
|
3902
3902
|
}
|
|
3903
3903
|
pathGenerator && pathGenerator.reset(this);
|
|
3904
|
+
this._engine.dispatchEvent("particleDestroyed", {
|
|
3905
|
+
container: this.container,
|
|
3906
|
+
data: {
|
|
3907
|
+
particle: this
|
|
3908
|
+
}
|
|
3909
|
+
});
|
|
3904
3910
|
}
|
|
3905
3911
|
draw(delta) {
|
|
3906
3912
|
const container = this.container,
|
|
@@ -4253,12 +4259,17 @@ const qTreeRectangle = canvasSize => {
|
|
|
4253
4259
|
};
|
|
4254
4260
|
class Particles {
|
|
4255
4261
|
constructor(engine, container) {
|
|
4262
|
+
this._addToPool = (...particles) => {
|
|
4263
|
+
for (const particle of particles) {
|
|
4264
|
+
this._pool.push(particle);
|
|
4265
|
+
}
|
|
4266
|
+
};
|
|
4256
4267
|
this._applyDensity = (options, manualCount, group) => {
|
|
4257
4268
|
const numberOptions = options.number;
|
|
4258
4269
|
if (!options.number.density?.enable) {
|
|
4259
4270
|
if (group === undefined) {
|
|
4260
4271
|
this._limit = numberOptions.limit.value;
|
|
4261
|
-
} else {
|
|
4272
|
+
} else if (numberOptions.limit) {
|
|
4262
4273
|
this._groupLimits.set(group, numberOptions.limit.value);
|
|
4263
4274
|
}
|
|
4264
4275
|
return;
|
|
@@ -4323,17 +4334,17 @@ class Particles {
|
|
|
4323
4334
|
if (!particle || particle.group !== group) {
|
|
4324
4335
|
return false;
|
|
4325
4336
|
}
|
|
4326
|
-
particle.destroy(override);
|
|
4327
4337
|
const zIdx = this._zArray.indexOf(particle);
|
|
4328
4338
|
this._array.splice(index, 1);
|
|
4329
4339
|
this._zArray.splice(zIdx, 1);
|
|
4330
|
-
|
|
4340
|
+
particle.destroy(override);
|
|
4331
4341
|
this._engine.dispatchEvent("particleRemoved", {
|
|
4332
4342
|
container: this._container,
|
|
4333
4343
|
data: {
|
|
4334
4344
|
particle
|
|
4335
4345
|
}
|
|
4336
4346
|
});
|
|
4347
|
+
this._addToPool(particle);
|
|
4337
4348
|
return true;
|
|
4338
4349
|
};
|
|
4339
4350
|
this._engine = engine;
|
|
@@ -4531,7 +4542,15 @@ class Particles {
|
|
|
4531
4542
|
const checkDelete = p => !particlesToDelete.has(p);
|
|
4532
4543
|
this._array = this.filter(checkDelete);
|
|
4533
4544
|
this._zArray = this._zArray.filter(checkDelete);
|
|
4534
|
-
|
|
4545
|
+
for (const particle of particlesToDelete) {
|
|
4546
|
+
this._engine.dispatchEvent("particleRemoved", {
|
|
4547
|
+
container: this._container,
|
|
4548
|
+
data: {
|
|
4549
|
+
particle
|
|
4550
|
+
}
|
|
4551
|
+
});
|
|
4552
|
+
}
|
|
4553
|
+
this._addToPool(...particlesToDelete);
|
|
4535
4554
|
}
|
|
4536
4555
|
await this._interactionManager.externalInteract(delta);
|
|
4537
4556
|
for (const particle of this._array) {
|
|
@@ -5147,7 +5166,7 @@ class Engine {
|
|
|
5147
5166
|
return res;
|
|
5148
5167
|
}
|
|
5149
5168
|
get version() {
|
|
5150
|
-
return "3.0.
|
|
5169
|
+
return "3.0.2";
|
|
5151
5170
|
}
|
|
5152
5171
|
addConfig(config) {
|
|
5153
5172
|
const name = config.name ?? "default";
|
|
@@ -6512,6 +6531,7 @@ class EmitterInstance {
|
|
|
6512
6531
|
}
|
|
6513
6532
|
if (this._lifeCount > 0 || this._immortal) {
|
|
6514
6533
|
this.position = this._calcPosition();
|
|
6534
|
+
this._shape?.resize(this.position, this.size);
|
|
6515
6535
|
this._spawnDelay = getRangeValue(this.options.life.delay ?? 0) * 1000 / this.container.retina.reduceFactor;
|
|
6516
6536
|
} else {
|
|
6517
6537
|
this._destroy();
|