tsparticles 2.1.1 → 2.1.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.
- package/README.md +2 -2
- package/package.json +11 -11
- package/report.html +2 -2
- package/tsparticles.bundle.js +95 -36
- package/tsparticles.bundle.min.js +2 -2
- package/tsparticles.js +1 -1
- package/tsparticles.min.js +1 -1
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
|
-
* v2.1.
|
|
7
|
+
* v2.1.4
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -7554,7 +7554,6 @@ class InteractionManager {
|
|
|
7554
7554
|
|
|
7555
7555
|
this.externalInteractors = [];
|
|
7556
7556
|
this.particleInteractors = [];
|
|
7557
|
-
this.init();
|
|
7558
7557
|
}
|
|
7559
7558
|
|
|
7560
7559
|
async externalInteract(delta) {
|
|
@@ -8648,6 +8647,7 @@ class Particles {
|
|
|
8648
8647
|
}
|
|
8649
8648
|
}
|
|
8650
8649
|
|
|
8650
|
+
this.interactionManager.init();
|
|
8651
8651
|
container.pathGenerator.init(container);
|
|
8652
8652
|
}
|
|
8653
8653
|
|
|
@@ -8960,7 +8960,7 @@ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldG
|
|
|
8960
8960
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8961
8961
|
};
|
|
8962
8962
|
|
|
8963
|
-
var _Container_engine;
|
|
8963
|
+
var _Container_engine, _Container_eventListeners;
|
|
8964
8964
|
|
|
8965
8965
|
|
|
8966
8966
|
|
|
@@ -8972,6 +8972,10 @@ var _Container_engine;
|
|
|
8972
8972
|
|
|
8973
8973
|
|
|
8974
8974
|
|
|
8975
|
+
function guardCheck(container) {
|
|
8976
|
+
return !container.destroyed;
|
|
8977
|
+
}
|
|
8978
|
+
|
|
8975
8979
|
function loadContainerOptions(engine, container, ...sourceOptionsArr) {
|
|
8976
8980
|
const options = new Options(engine, container);
|
|
8977
8981
|
loadOptions(options, ...sourceOptionsArr);
|
|
@@ -8984,6 +8988,8 @@ class Container {
|
|
|
8984
8988
|
|
|
8985
8989
|
_Container_engine.set(this, void 0);
|
|
8986
8990
|
|
|
8991
|
+
_Container_eventListeners.set(this, void 0);
|
|
8992
|
+
|
|
8987
8993
|
Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
|
|
8988
8994
|
|
|
8989
8995
|
this.fpsLimit = 120;
|
|
@@ -9022,7 +9028,8 @@ class Container {
|
|
|
9022
9028
|
this.density = 1;
|
|
9023
9029
|
this._options = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
|
|
9024
9030
|
this.actualOptions = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
|
|
9025
|
-
|
|
9031
|
+
|
|
9032
|
+
Container_classPrivateFieldSet(this, _Container_eventListeners, new EventListeners(this), "f");
|
|
9026
9033
|
|
|
9027
9034
|
if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
|
|
9028
9035
|
this.intersectionObserver = new IntersectionObserver(entries => this.intersectionManager(entries));
|
|
@@ -9042,6 +9049,10 @@ class Container {
|
|
|
9042
9049
|
}
|
|
9043
9050
|
|
|
9044
9051
|
addClickHandler(callback) {
|
|
9052
|
+
if (!guardCheck(this)) {
|
|
9053
|
+
return;
|
|
9054
|
+
}
|
|
9055
|
+
|
|
9045
9056
|
const el = this.interactivity.element;
|
|
9046
9057
|
|
|
9047
9058
|
if (!el) {
|
|
@@ -9049,7 +9060,7 @@ class Container {
|
|
|
9049
9060
|
}
|
|
9050
9061
|
|
|
9051
9062
|
const clickOrTouchHandler = (e, pos, radius) => {
|
|
9052
|
-
if (this
|
|
9063
|
+
if (!guardCheck(this)) {
|
|
9053
9064
|
return;
|
|
9054
9065
|
}
|
|
9055
9066
|
|
|
@@ -9063,7 +9074,7 @@ class Container {
|
|
|
9063
9074
|
};
|
|
9064
9075
|
|
|
9065
9076
|
const clickHandler = e => {
|
|
9066
|
-
if (this
|
|
9077
|
+
if (!guardCheck(this)) {
|
|
9067
9078
|
return;
|
|
9068
9079
|
}
|
|
9069
9080
|
|
|
@@ -9076,7 +9087,7 @@ class Container {
|
|
|
9076
9087
|
};
|
|
9077
9088
|
|
|
9078
9089
|
const touchStartHandler = () => {
|
|
9079
|
-
if (this
|
|
9090
|
+
if (!guardCheck(this)) {
|
|
9080
9091
|
return;
|
|
9081
9092
|
}
|
|
9082
9093
|
|
|
@@ -9085,7 +9096,7 @@ class Container {
|
|
|
9085
9096
|
};
|
|
9086
9097
|
|
|
9087
9098
|
const touchMoveHandler = () => {
|
|
9088
|
-
if (this
|
|
9099
|
+
if (!guardCheck(this)) {
|
|
9089
9100
|
return;
|
|
9090
9101
|
}
|
|
9091
9102
|
|
|
@@ -9095,7 +9106,7 @@ class Container {
|
|
|
9095
9106
|
const touchEndHandler = e => {
|
|
9096
9107
|
var _a, _b, _c;
|
|
9097
9108
|
|
|
9098
|
-
if (this
|
|
9109
|
+
if (!guardCheck(this)) {
|
|
9099
9110
|
return;
|
|
9100
9111
|
}
|
|
9101
9112
|
|
|
@@ -9124,7 +9135,7 @@ class Container {
|
|
|
9124
9135
|
};
|
|
9125
9136
|
|
|
9126
9137
|
const touchCancelHandler = () => {
|
|
9127
|
-
if (this
|
|
9138
|
+
if (!guardCheck(this)) {
|
|
9128
9139
|
return;
|
|
9129
9140
|
}
|
|
9130
9141
|
|
|
@@ -9142,6 +9153,10 @@ class Container {
|
|
|
9142
9153
|
}
|
|
9143
9154
|
|
|
9144
9155
|
destroy() {
|
|
9156
|
+
if (!guardCheck(this)) {
|
|
9157
|
+
return;
|
|
9158
|
+
}
|
|
9159
|
+
|
|
9145
9160
|
this.stop();
|
|
9146
9161
|
this.particles.destroy();
|
|
9147
9162
|
this.canvas.destroy();
|
|
@@ -9158,12 +9173,23 @@ class Container {
|
|
|
9158
9173
|
|
|
9159
9174
|
this.destroyed = true;
|
|
9160
9175
|
|
|
9176
|
+
const mainArr = Container_classPrivateFieldGet(this, _Container_engine, "f").dom(),
|
|
9177
|
+
idx = mainArr.findIndex(t => t === this);
|
|
9178
|
+
|
|
9179
|
+
if (idx >= 0) {
|
|
9180
|
+
mainArr.splice(idx, 1);
|
|
9181
|
+
}
|
|
9182
|
+
|
|
9161
9183
|
Container_classPrivateFieldGet(this, _Container_engine, "f").dispatchEvent("containerDestroyed", {
|
|
9162
9184
|
container: this
|
|
9163
9185
|
});
|
|
9164
9186
|
}
|
|
9165
9187
|
|
|
9166
9188
|
draw(force) {
|
|
9189
|
+
if (!guardCheck(this)) {
|
|
9190
|
+
return;
|
|
9191
|
+
}
|
|
9192
|
+
|
|
9167
9193
|
let refreshTime = force;
|
|
9168
9194
|
this.drawAnimationFrame = animate()(async timestamp => {
|
|
9169
9195
|
if (refreshTime) {
|
|
@@ -9190,10 +9216,14 @@ class Container {
|
|
|
9190
9216
|
}
|
|
9191
9217
|
|
|
9192
9218
|
getAnimationStatus() {
|
|
9193
|
-
return !this.paused && !this.pageHidden;
|
|
9219
|
+
return !this.paused && !this.pageHidden && guardCheck(this);
|
|
9194
9220
|
}
|
|
9195
9221
|
|
|
9196
9222
|
handleClickMode(mode) {
|
|
9223
|
+
if (!guardCheck(this)) {
|
|
9224
|
+
return;
|
|
9225
|
+
}
|
|
9226
|
+
|
|
9197
9227
|
this.particles.handleClickMode(mode);
|
|
9198
9228
|
|
|
9199
9229
|
for (const [, plugin] of this.plugins) {
|
|
@@ -9204,6 +9234,10 @@ class Container {
|
|
|
9204
9234
|
}
|
|
9205
9235
|
|
|
9206
9236
|
async init() {
|
|
9237
|
+
if (!guardCheck(this)) {
|
|
9238
|
+
return;
|
|
9239
|
+
}
|
|
9240
|
+
|
|
9207
9241
|
const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
|
|
9208
9242
|
|
|
9209
9243
|
for (const type of shapes) {
|
|
@@ -9271,11 +9305,19 @@ class Container {
|
|
|
9271
9305
|
}
|
|
9272
9306
|
|
|
9273
9307
|
async loadTheme(name) {
|
|
9308
|
+
if (!guardCheck(this)) {
|
|
9309
|
+
return;
|
|
9310
|
+
}
|
|
9311
|
+
|
|
9274
9312
|
this.currentTheme = name;
|
|
9275
9313
|
await this.refresh();
|
|
9276
9314
|
}
|
|
9277
9315
|
|
|
9278
9316
|
pause() {
|
|
9317
|
+
if (!guardCheck(this)) {
|
|
9318
|
+
return;
|
|
9319
|
+
}
|
|
9320
|
+
|
|
9279
9321
|
if (this.drawAnimationFrame !== undefined) {
|
|
9280
9322
|
cancelAnimation()(this.drawAnimationFrame);
|
|
9281
9323
|
delete this.drawAnimationFrame;
|
|
@@ -9301,6 +9343,10 @@ class Container {
|
|
|
9301
9343
|
}
|
|
9302
9344
|
|
|
9303
9345
|
play(force) {
|
|
9346
|
+
if (!guardCheck(this)) {
|
|
9347
|
+
return;
|
|
9348
|
+
}
|
|
9349
|
+
|
|
9304
9350
|
const needsUpdate = this.paused || force;
|
|
9305
9351
|
|
|
9306
9352
|
if (this.firstStart && !this.actualOptions.autoPlay) {
|
|
@@ -9327,24 +9373,36 @@ class Container {
|
|
|
9327
9373
|
this.draw(needsUpdate || false);
|
|
9328
9374
|
}
|
|
9329
9375
|
|
|
9330
|
-
refresh() {
|
|
9376
|
+
async refresh() {
|
|
9377
|
+
if (!guardCheck(this)) {
|
|
9378
|
+
return;
|
|
9379
|
+
}
|
|
9380
|
+
|
|
9331
9381
|
this.stop();
|
|
9332
9382
|
return this.start();
|
|
9333
9383
|
}
|
|
9334
9384
|
|
|
9335
|
-
reset() {
|
|
9385
|
+
async reset() {
|
|
9386
|
+
if (!guardCheck(this)) {
|
|
9387
|
+
return;
|
|
9388
|
+
}
|
|
9389
|
+
|
|
9336
9390
|
this._options = loadContainerOptions(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
|
|
9337
9391
|
return this.refresh();
|
|
9338
9392
|
}
|
|
9339
9393
|
|
|
9340
9394
|
setNoise(noiseOrGenerator, init, update) {
|
|
9395
|
+
if (!guardCheck(this)) {
|
|
9396
|
+
return;
|
|
9397
|
+
}
|
|
9398
|
+
|
|
9341
9399
|
this.setPath(noiseOrGenerator, init, update);
|
|
9342
9400
|
}
|
|
9343
9401
|
|
|
9344
9402
|
setPath(pathOrGenerator, init, update) {
|
|
9345
9403
|
var _a, _b, _c;
|
|
9346
9404
|
|
|
9347
|
-
if (!pathOrGenerator) {
|
|
9405
|
+
if (!pathOrGenerator || !guardCheck(this)) {
|
|
9348
9406
|
return;
|
|
9349
9407
|
}
|
|
9350
9408
|
|
|
@@ -9368,13 +9426,14 @@ class Container {
|
|
|
9368
9426
|
}
|
|
9369
9427
|
|
|
9370
9428
|
async start() {
|
|
9371
|
-
if (this.started) {
|
|
9429
|
+
if (this.started || !guardCheck(this)) {
|
|
9372
9430
|
return;
|
|
9373
9431
|
}
|
|
9374
9432
|
|
|
9375
9433
|
await this.init();
|
|
9376
9434
|
this.started = true;
|
|
9377
|
-
|
|
9435
|
+
|
|
9436
|
+
Container_classPrivateFieldGet(this, _Container_eventListeners, "f").addListeners();
|
|
9378
9437
|
|
|
9379
9438
|
if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
|
|
9380
9439
|
this.intersectionObserver.observe(this.interactivity.element);
|
|
@@ -9396,13 +9455,15 @@ class Container {
|
|
|
9396
9455
|
}
|
|
9397
9456
|
|
|
9398
9457
|
stop() {
|
|
9399
|
-
if (!this.started) {
|
|
9458
|
+
if (!this.started || !guardCheck(this)) {
|
|
9400
9459
|
return;
|
|
9401
9460
|
}
|
|
9402
9461
|
|
|
9403
9462
|
this.firstStart = true;
|
|
9404
9463
|
this.started = false;
|
|
9405
|
-
|
|
9464
|
+
|
|
9465
|
+
Container_classPrivateFieldGet(this, _Container_eventListeners, "f").removeListeners();
|
|
9466
|
+
|
|
9406
9467
|
this.pause();
|
|
9407
9468
|
this.particles.clear();
|
|
9408
9469
|
this.canvas.clear();
|
|
@@ -9463,7 +9524,7 @@ class Container {
|
|
|
9463
9524
|
}
|
|
9464
9525
|
|
|
9465
9526
|
}
|
|
9466
|
-
_Container_engine = new WeakMap();
|
|
9527
|
+
_Container_engine = new WeakMap(), _Container_eventListeners = new WeakMap();
|
|
9467
9528
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Loader.js
|
|
9468
9529
|
var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function (receiver, state, value, kind, f) {
|
|
9469
9530
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
@@ -9851,19 +9912,24 @@ var engine_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet
|
|
|
9851
9912
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9852
9913
|
};
|
|
9853
9914
|
|
|
9854
|
-
var _Engine_initialized, _Engine_loader;
|
|
9915
|
+
var _Engine_domArray, _Engine_eventDispatcher, _Engine_initialized, _Engine_loader;
|
|
9855
9916
|
|
|
9856
9917
|
|
|
9857
9918
|
|
|
9858
9919
|
|
|
9859
9920
|
class Engine {
|
|
9860
9921
|
constructor() {
|
|
9922
|
+
_Engine_domArray.set(this, void 0);
|
|
9923
|
+
|
|
9924
|
+
_Engine_eventDispatcher.set(this, void 0);
|
|
9925
|
+
|
|
9861
9926
|
_Engine_initialized.set(this, void 0);
|
|
9862
9927
|
|
|
9863
9928
|
_Engine_loader.set(this, void 0);
|
|
9864
9929
|
|
|
9865
|
-
this
|
|
9866
|
-
|
|
9930
|
+
engine_classPrivateFieldSet(this, _Engine_domArray, [], "f");
|
|
9931
|
+
|
|
9932
|
+
engine_classPrivateFieldSet(this, _Engine_eventDispatcher, new EventDispatcher(), "f");
|
|
9867
9933
|
|
|
9868
9934
|
engine_classPrivateFieldSet(this, _Engine_initialized, false, "f");
|
|
9869
9935
|
|
|
@@ -9873,7 +9939,7 @@ class Engine {
|
|
|
9873
9939
|
}
|
|
9874
9940
|
|
|
9875
9941
|
addEventListener(type, listener) {
|
|
9876
|
-
this.
|
|
9942
|
+
engine_classPrivateFieldGet(this, _Engine_eventDispatcher, "f").addEventListener(type, listener);
|
|
9877
9943
|
}
|
|
9878
9944
|
|
|
9879
9945
|
async addInteractor(name, interactorInitializer) {
|
|
@@ -9925,11 +9991,11 @@ class Engine {
|
|
|
9925
9991
|
}
|
|
9926
9992
|
|
|
9927
9993
|
dispatchEvent(type, args) {
|
|
9928
|
-
this.
|
|
9994
|
+
engine_classPrivateFieldGet(this, _Engine_eventDispatcher, "f").dispatchEvent(type, args);
|
|
9929
9995
|
}
|
|
9930
9996
|
|
|
9931
9997
|
dom() {
|
|
9932
|
-
return this
|
|
9998
|
+
return engine_classPrivateFieldGet(this, _Engine_domArray, "f");
|
|
9933
9999
|
}
|
|
9934
10000
|
|
|
9935
10001
|
domItem(index) {
|
|
@@ -9968,7 +10034,7 @@ class Engine {
|
|
|
9968
10034
|
}
|
|
9969
10035
|
|
|
9970
10036
|
removeEventListener(type, listener) {
|
|
9971
|
-
this.
|
|
10037
|
+
engine_classPrivateFieldGet(this, _Engine_eventDispatcher, "f").removeEventListener(type, listener);
|
|
9972
10038
|
}
|
|
9973
10039
|
|
|
9974
10040
|
async set(id, element, options) {
|
|
@@ -9992,7 +10058,7 @@ class Engine {
|
|
|
9992
10058
|
}
|
|
9993
10059
|
|
|
9994
10060
|
}
|
|
9995
|
-
_Engine_initialized = new WeakMap(), _Engine_loader = new WeakMap();
|
|
10061
|
+
_Engine_domArray = new WeakMap(), _Engine_eventDispatcher = new WeakMap(), _Engine_initialized = new WeakMap(), _Engine_loader = new WeakMap();
|
|
9996
10062
|
;// CONCATENATED MODULE: ../../engine/dist/esm/Core/Utils/ExternalInteractorBase.js
|
|
9997
10063
|
class ExternalInteractorBase {
|
|
9998
10064
|
constructor(container) {
|
|
@@ -14751,16 +14817,9 @@ class ImageDrawer {
|
|
|
14751
14817
|
x: -radius,
|
|
14752
14818
|
y: -radius
|
|
14753
14819
|
};
|
|
14754
|
-
|
|
14755
|
-
if (!(image === null || image === void 0 ? void 0 : image.data.svgData) || !(image === null || image === void 0 ? void 0 : image.replaceColor)) {
|
|
14756
|
-
context.globalAlpha = opacity;
|
|
14757
|
-
}
|
|
14758
|
-
|
|
14820
|
+
context.globalAlpha = opacity;
|
|
14759
14821
|
context.drawImage(element, pos.x, pos.y, radius * 2, radius * 2 / ratio);
|
|
14760
|
-
|
|
14761
|
-
if (!(image === null || image === void 0 ? void 0 : image.data.svgData) || !(image === null || image === void 0 ? void 0 : image.replaceColor)) {
|
|
14762
|
-
context.globalAlpha = 1;
|
|
14763
|
-
}
|
|
14822
|
+
context.globalAlpha = 1;
|
|
14764
14823
|
}
|
|
14765
14824
|
|
|
14766
14825
|
getImages(container) {
|