@tsparticles/fireworks 4.5.0 → 4.5.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/browser/fireworks.js +2 -2
- package/browser/fireworks.lazy.js +2 -2
- package/cjs/fireworks.js +2 -2
- package/cjs/fireworks.lazy.js +2 -2
- package/esm/fireworks.js +2 -2
- package/esm/fireworks.lazy.js +2 -2
- package/package.json +12 -12
- package/report.html +1 -1
- package/tsparticles.fireworks.bundle.js +164 -90
- package/tsparticles.fireworks.bundle.min.js +1 -1
- package/tsparticles.fireworks.js +3 -3
- package/tsparticles.fireworks.min.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
2
|
(function (g) {
|
|
3
|
-
/* tsParticles v4.5.
|
|
3
|
+
/* tsParticles v4.5.2 */
|
|
4
4
|
g.__tsParticlesInternals = g.__tsParticlesInternals || {};
|
|
5
5
|
g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
6
6
|
(function (exports) {
|
|
@@ -143,7 +143,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
143
143
|
}
|
|
144
144
|
normalize() {
|
|
145
145
|
const length = this.length;
|
|
146
|
-
if (length
|
|
146
|
+
if (length !== none) {
|
|
147
147
|
this.multTo(inverseFactorNumerator / length);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -737,12 +737,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
737
737
|
}
|
|
738
738
|
addEventListener(type, listener) {
|
|
739
739
|
this.removeEventListener(type, listener);
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
arr = [];
|
|
743
|
-
this.#listeners.set(type, arr);
|
|
744
|
-
}
|
|
745
|
-
arr.push(listener);
|
|
740
|
+
const arr = this.#listeners.get(type);
|
|
741
|
+
this.#listeners.set(type, arr ? [...arr, listener] : [listener]);
|
|
746
742
|
}
|
|
747
743
|
dispatchEvent(type, args) {
|
|
748
744
|
const listeners = this.#listeners.get(type);
|
|
@@ -774,7 +770,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
774
770
|
this.#listeners.delete(type);
|
|
775
771
|
}
|
|
776
772
|
else {
|
|
777
|
-
arr.
|
|
773
|
+
this.#listeners.set(type, [...arr.slice(minIndex, idx), ...arr.slice(idx + deleteCount)]);
|
|
778
774
|
}
|
|
779
775
|
}
|
|
780
776
|
}
|
|
@@ -951,11 +947,13 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
951
947
|
#domArray = [];
|
|
952
948
|
#eventDispatcher = new EventDispatcher();
|
|
953
949
|
#initialized = false;
|
|
950
|
+
#loadSequence = 0;
|
|
951
|
+
#loadSequences = new Map();
|
|
954
952
|
get items() {
|
|
955
953
|
return this.#domArray;
|
|
956
954
|
}
|
|
957
955
|
get version() {
|
|
958
|
-
return "4.5.
|
|
956
|
+
return "4.5.2";
|
|
959
957
|
}
|
|
960
958
|
addEventListener(type, listener) {
|
|
961
959
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -985,44 +983,60 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
985
983
|
return item;
|
|
986
984
|
}
|
|
987
985
|
async load(params) {
|
|
988
|
-
await this.init();
|
|
989
986
|
let domSourceElement;
|
|
990
987
|
if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
|
|
991
988
|
domSourceElement = params.element;
|
|
992
989
|
}
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
990
|
+
const id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, loadSequence = ++this.#loadSequence;
|
|
991
|
+
this.#loadSequences.set(id, loadSequence);
|
|
992
|
+
try {
|
|
993
|
+
await this.init();
|
|
994
|
+
const { Container } = await Promise.resolve().then(function () { return Container$1; }), { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options;
|
|
995
|
+
if (this.#loadSequences.get(id) !== loadSequence) {
|
|
996
|
+
return undefined;
|
|
997
|
+
}
|
|
998
|
+
const currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
|
|
999
|
+
dispatchCallback: (eventType, args) => {
|
|
1000
|
+
this.dispatchEvent(eventType, args);
|
|
1001
|
+
},
|
|
1002
|
+
id,
|
|
1003
|
+
onDestroy: (remove) => {
|
|
1004
|
+
if (!remove) {
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const mainArr = this.items, idx = mainArr.indexOf(newItem);
|
|
1008
|
+
if (idx >= removeMinIndex) {
|
|
1009
|
+
mainArr.splice(idx, removeDeleteCount);
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
pluginManager: this.pluginManager,
|
|
1013
|
+
sourceOptions: currentOptions,
|
|
1014
|
+
});
|
|
1015
|
+
if (oldIndex >= loadMinIndex) {
|
|
1016
|
+
const old = this.item(oldIndex), deleteCount = old ? one : none;
|
|
1017
|
+
if (old && !old.destroyed) {
|
|
1018
|
+
old.destroy(false);
|
|
1005
1019
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
|
|
1020
|
+
items.splice(oldIndex, deleteCount, newItem);
|
|
1021
|
+
}
|
|
1022
|
+
else {
|
|
1023
|
+
items.push(newItem);
|
|
1024
|
+
}
|
|
1025
|
+
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
1026
|
+
? params.element
|
|
1027
|
+
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
1028
|
+
newItem.canvas.loadCanvas(sourceCanvas);
|
|
1029
|
+
await newItem.start();
|
|
1030
|
+
if (newItem.destroyed) {
|
|
1031
|
+
return undefined;
|
|
1014
1032
|
}
|
|
1015
|
-
|
|
1033
|
+
return newItem;
|
|
1016
1034
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1035
|
+
finally {
|
|
1036
|
+
if (this.#loadSequences.get(id) === loadSequence) {
|
|
1037
|
+
this.#loadSequences.delete(id);
|
|
1038
|
+
}
|
|
1019
1039
|
}
|
|
1020
|
-
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
1021
|
-
? params.element
|
|
1022
|
-
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
1023
|
-
newItem.canvas.loadCanvas(sourceCanvas);
|
|
1024
|
-
await newItem.start();
|
|
1025
|
-
return newItem;
|
|
1026
1040
|
}
|
|
1027
1041
|
async refresh(refresh = true) {
|
|
1028
1042
|
if (!refresh) {
|
|
@@ -2722,6 +2736,13 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2722
2736
|
}
|
|
2723
2737
|
}
|
|
2724
2738
|
|
|
2739
|
+
function hasEnabledBlend(particleOptions) {
|
|
2740
|
+
if (!particleOptions || typeof particleOptions !== "object" || !("blend" in particleOptions)) {
|
|
2741
|
+
return false;
|
|
2742
|
+
}
|
|
2743
|
+
const blend = particleOptions.blend;
|
|
2744
|
+
return !!blend && typeof blend === "object" && "enable" in blend && !!blend.enable;
|
|
2745
|
+
}
|
|
2725
2746
|
class BlendPlugin {
|
|
2726
2747
|
id = "blend";
|
|
2727
2748
|
async getPlugin(container) {
|
|
@@ -2743,12 +2764,31 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2743
2764
|
options.blend.load(source?.blend);
|
|
2744
2765
|
}
|
|
2745
2766
|
needsPlugin(options) {
|
|
2746
|
-
|
|
2767
|
+
if (options?.blend?.enable ||
|
|
2768
|
+
options?.particles?.blend?.enable ||
|
|
2769
|
+
Object.values(options?.particles?.groups ?? {}).some(hasEnabledBlend)) {
|
|
2770
|
+
return true;
|
|
2771
|
+
}
|
|
2772
|
+
const emitters = options?.["emitters"];
|
|
2773
|
+
let emitterList = [];
|
|
2774
|
+
if (Array.isArray(emitters)) {
|
|
2775
|
+
emitterList = emitters;
|
|
2776
|
+
}
|
|
2777
|
+
else if (emitters) {
|
|
2778
|
+
emitterList = [emitters];
|
|
2779
|
+
}
|
|
2780
|
+
return emitterList.some(emitter => {
|
|
2781
|
+
if (!emitter || typeof emitter !== "object" || !("particles" in emitter)) {
|
|
2782
|
+
return false;
|
|
2783
|
+
}
|
|
2784
|
+
const particles = emitter.particles;
|
|
2785
|
+
return Array.isArray(particles) ? particles.some(hasEnabledBlend) : hasEnabledBlend(particles);
|
|
2786
|
+
});
|
|
2747
2787
|
}
|
|
2748
2788
|
}
|
|
2749
2789
|
|
|
2750
2790
|
async function loadBlendPlugin(engine) {
|
|
2751
|
-
engine.checkVersion("4.5.
|
|
2791
|
+
engine.checkVersion("4.5.2");
|
|
2752
2792
|
await engine.pluginManager.register(e => {
|
|
2753
2793
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2754
2794
|
});
|
|
@@ -2785,7 +2825,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2785
2825
|
}
|
|
2786
2826
|
|
|
2787
2827
|
async function loadCircleShape(engine) {
|
|
2788
|
-
engine.checkVersion("4.5.
|
|
2828
|
+
engine.checkVersion("4.5.2");
|
|
2789
2829
|
await engine.pluginManager.register(e => {
|
|
2790
2830
|
e.pluginManager.addShape(["circle"], () => {
|
|
2791
2831
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -2833,7 +2873,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2833
2873
|
}
|
|
2834
2874
|
|
|
2835
2875
|
async function loadHexColorPlugin(engine) {
|
|
2836
|
-
engine.checkVersion("4.5.
|
|
2876
|
+
engine.checkVersion("4.5.2");
|
|
2837
2877
|
await engine.pluginManager.register(e => {
|
|
2838
2878
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
2839
2879
|
});
|
|
@@ -2886,7 +2926,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2886
2926
|
}
|
|
2887
2927
|
|
|
2888
2928
|
async function loadHslColorPlugin(engine) {
|
|
2889
|
-
engine.checkVersion("4.5.
|
|
2929
|
+
engine.checkVersion("4.5.2");
|
|
2890
2930
|
await engine.pluginManager.register(e => {
|
|
2891
2931
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
2892
2932
|
});
|
|
@@ -2918,7 +2958,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2918
2958
|
}
|
|
2919
2959
|
|
|
2920
2960
|
async function loadMovePlugin(engine) {
|
|
2921
|
-
engine.checkVersion("4.5.
|
|
2961
|
+
engine.checkVersion("4.5.2");
|
|
2922
2962
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
2923
2963
|
addErrorMessages(ErrorMessages$1);
|
|
2924
2964
|
}
|
|
@@ -3134,7 +3174,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3134
3174
|
}
|
|
3135
3175
|
|
|
3136
3176
|
async function loadOpacityUpdater(engine) {
|
|
3137
|
-
engine.checkVersion("4.5.
|
|
3177
|
+
engine.checkVersion("4.5.2");
|
|
3138
3178
|
await engine.pluginManager.register(e => {
|
|
3139
3179
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
3140
3180
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3463,7 +3503,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3463
3503
|
}
|
|
3464
3504
|
|
|
3465
3505
|
async function loadOutModesUpdater(engine) {
|
|
3466
|
-
engine.checkVersion("4.5.
|
|
3506
|
+
engine.checkVersion("4.5.2");
|
|
3467
3507
|
await engine.pluginManager.register(e => {
|
|
3468
3508
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3469
3509
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3542,7 +3582,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3542
3582
|
}
|
|
3543
3583
|
|
|
3544
3584
|
async function loadPaintUpdater(engine) {
|
|
3545
|
-
engine.checkVersion("4.5.
|
|
3585
|
+
engine.checkVersion("4.5.2");
|
|
3546
3586
|
await engine.pluginManager.register(e => {
|
|
3547
3587
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3548
3588
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3597,7 +3637,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3597
3637
|
}
|
|
3598
3638
|
|
|
3599
3639
|
async function loadRgbColorPlugin(engine) {
|
|
3600
|
-
engine.checkVersion("4.5.
|
|
3640
|
+
engine.checkVersion("4.5.2");
|
|
3601
3641
|
await engine.pluginManager.register(e => {
|
|
3602
3642
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3603
3643
|
});
|
|
@@ -3682,7 +3722,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3682
3722
|
}
|
|
3683
3723
|
|
|
3684
3724
|
async function loadSizeUpdater(engine) {
|
|
3685
|
-
engine.checkVersion("4.5.
|
|
3725
|
+
engine.checkVersion("4.5.2");
|
|
3686
3726
|
await engine.pluginManager.register(e => {
|
|
3687
3727
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3688
3728
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3691,7 +3731,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3691
3731
|
}
|
|
3692
3732
|
|
|
3693
3733
|
async function loadBasic(engine) {
|
|
3694
|
-
engine.checkVersion("4.5.
|
|
3734
|
+
engine.checkVersion("4.5.2");
|
|
3695
3735
|
await engine.pluginManager.register(async (e) => {
|
|
3696
3736
|
await Promise.all([
|
|
3697
3737
|
loadBlendPlugin(e),
|
|
@@ -4022,7 +4062,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4022
4062
|
}
|
|
4023
4063
|
|
|
4024
4064
|
async function loadDestroyUpdater(engine) {
|
|
4025
|
-
engine.checkVersion("4.5.
|
|
4065
|
+
engine.checkVersion("4.5.2");
|
|
4026
4066
|
await engine.pluginManager.register(e => {
|
|
4027
4067
|
e.pluginManager.addParticleUpdater("destroy", container => {
|
|
4028
4068
|
return Promise.resolve(new DestroyUpdater(e.pluginManager, container));
|
|
@@ -4123,7 +4163,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4123
4163
|
direction;
|
|
4124
4164
|
domId;
|
|
4125
4165
|
draggable = false;
|
|
4126
|
-
draw =
|
|
4166
|
+
draw = false;
|
|
4127
4167
|
fill = true;
|
|
4128
4168
|
life = new EmitterLife();
|
|
4129
4169
|
name;
|
|
@@ -4267,7 +4307,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4267
4307
|
})(EmitterClickMode || (EmitterClickMode = {}));
|
|
4268
4308
|
|
|
4269
4309
|
async function loadEmittersPluginSimple(engine) {
|
|
4270
|
-
engine.checkVersion("4.5.
|
|
4310
|
+
engine.checkVersion("4.5.2");
|
|
4271
4311
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
4272
4312
|
addErrorMessages(ErrorMessages);
|
|
4273
4313
|
}
|
|
@@ -4416,7 +4456,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4416
4456
|
}
|
|
4417
4457
|
|
|
4418
4458
|
async function loadEmittersShapeSquare(engine) {
|
|
4419
|
-
engine.checkVersion("4.5.
|
|
4459
|
+
engine.checkVersion("4.5.2");
|
|
4420
4460
|
await engine.pluginManager.register((e) => {
|
|
4421
4461
|
ensureEmittersPluginLoaded(e);
|
|
4422
4462
|
e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
|
|
@@ -4498,7 +4538,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4498
4538
|
particle.destroy();
|
|
4499
4539
|
return;
|
|
4500
4540
|
}
|
|
4501
|
-
const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.
|
|
4541
|
+
const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.height);
|
|
4502
4542
|
particle.position.x = randomInRangeValue(widthRange);
|
|
4503
4543
|
particle.position.y = randomInRangeValue(heightRange);
|
|
4504
4544
|
particle.spawning = true;
|
|
@@ -4560,7 +4600,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4560
4600
|
}
|
|
4561
4601
|
|
|
4562
4602
|
async function loadLifeUpdater(engine) {
|
|
4563
|
-
engine.checkVersion("4.5.
|
|
4603
|
+
engine.checkVersion("4.5.2");
|
|
4564
4604
|
await engine.pluginManager.register(e => {
|
|
4565
4605
|
e.pluginManager.addParticleUpdater("life", container => {
|
|
4566
4606
|
return Promise.resolve(new LifeUpdater(container));
|
|
@@ -4586,7 +4626,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4586
4626
|
}
|
|
4587
4627
|
|
|
4588
4628
|
async function loadLineShape(engine) {
|
|
4589
|
-
engine.checkVersion("4.5.
|
|
4629
|
+
engine.checkVersion("4.5.2");
|
|
4590
4630
|
await engine.pluginManager.register(e => {
|
|
4591
4631
|
e.pluginManager.addShape(["line"], () => Promise.resolve(new LineDrawer()));
|
|
4592
4632
|
});
|
|
@@ -4690,7 +4730,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4690
4730
|
}
|
|
4691
4731
|
|
|
4692
4732
|
async function loadRotateUpdater(engine) {
|
|
4693
|
-
engine.checkVersion("4.5.
|
|
4733
|
+
engine.checkVersion("4.5.2");
|
|
4694
4734
|
await engine.pluginManager.register(e => {
|
|
4695
4735
|
e.pluginManager.addParticleUpdater("rotate", container => {
|
|
4696
4736
|
return Promise.resolve(new RotateUpdater(container));
|
|
@@ -5006,7 +5046,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5006
5046
|
}
|
|
5007
5047
|
|
|
5008
5048
|
async function loadSoundsPlugin(engine) {
|
|
5009
|
-
engine.checkVersion("4.5.
|
|
5049
|
+
engine.checkVersion("4.5.2");
|
|
5010
5050
|
await engine.pluginManager.register(e => {
|
|
5011
5051
|
e.pluginManager.addPlugin(new SoundsPlugin(e));
|
|
5012
5052
|
});
|
|
@@ -5014,7 +5054,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5014
5054
|
|
|
5015
5055
|
let initPromise = null;
|
|
5016
5056
|
async function doInitPlugins(engine) {
|
|
5017
|
-
engine.checkVersion("4.5.
|
|
5057
|
+
engine.checkVersion("4.5.2");
|
|
5018
5058
|
await engine.pluginManager.register(async (e) => {
|
|
5019
5059
|
const loadEmittersForFireworks = async (e) => {
|
|
5020
5060
|
await loadEmittersPluginSimple(e);
|
|
@@ -5061,7 +5101,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5061
5101
|
fireworks.init = async () => {
|
|
5062
5102
|
await initPlugins(tsParticles);
|
|
5063
5103
|
};
|
|
5064
|
-
fireworks.version = "4.5.
|
|
5104
|
+
fireworks.version = "4.5.2";
|
|
5065
5105
|
globalThis.fireworks = fireworks;
|
|
5066
5106
|
|
|
5067
5107
|
const globalObject = globalThis;
|
|
@@ -5230,7 +5270,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5230
5270
|
});
|
|
5231
5271
|
}
|
|
5232
5272
|
drawParticles(delta) {
|
|
5233
|
-
const { particles, actualOptions } = this.#container
|
|
5273
|
+
const { particles, actualOptions } = this.#container;
|
|
5274
|
+
this.clear();
|
|
5234
5275
|
particles.update(delta);
|
|
5235
5276
|
this.draw(ctx => {
|
|
5236
5277
|
const width = this.#canvasManager.size.width, height = this.#canvasManager.size.height;
|
|
@@ -5252,9 +5293,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5252
5293
|
}
|
|
5253
5294
|
}
|
|
5254
5295
|
for (const plugin of this.#getLayerPlugins(exports.DrawLayer.BackgroundMask)) {
|
|
5255
|
-
|
|
5256
|
-
plugin.canvasPaint?.();
|
|
5257
|
-
}
|
|
5296
|
+
plugin.canvasPaint?.();
|
|
5258
5297
|
}
|
|
5259
5298
|
for (const plugin of this.#getLayerPlugins(exports.DrawLayer.CanvasSetup)) {
|
|
5260
5299
|
plugin.drawSettingsSetup?.(ctx, delta);
|
|
@@ -5344,6 +5383,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5344
5383
|
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
5345
5384
|
});
|
|
5346
5385
|
}
|
|
5386
|
+
updateBackgroundElement() {
|
|
5387
|
+
this.#resolveBackgroundElement();
|
|
5388
|
+
}
|
|
5347
5389
|
#applyPostDrawUpdaters(particle) {
|
|
5348
5390
|
for (const updater of this.#postDrawUpdaters) {
|
|
5349
5391
|
updater.afterDraw?.(particle);
|
|
@@ -5542,7 +5584,14 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5542
5584
|
}
|
|
5543
5585
|
if (typeof background.element === "string") {
|
|
5544
5586
|
if (typeof document !== "undefined") {
|
|
5545
|
-
|
|
5587
|
+
let node;
|
|
5588
|
+
try {
|
|
5589
|
+
node = document.querySelector(background.element);
|
|
5590
|
+
}
|
|
5591
|
+
catch {
|
|
5592
|
+
this.#warnOnce("background-element-invalid-selector", `Background element selector "${background.element}" is invalid`);
|
|
5593
|
+
return;
|
|
5594
|
+
}
|
|
5546
5595
|
if (node && this.#isSupportedElement(node)) {
|
|
5547
5596
|
this.#backgroundElement = node;
|
|
5548
5597
|
}
|
|
@@ -5988,6 +6037,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5988
6037
|
this.#manageListeners(true);
|
|
5989
6038
|
}
|
|
5990
6039
|
removeListeners() {
|
|
6040
|
+
if (this.#resizeTimeout !== undefined) {
|
|
6041
|
+
clearTimeout(this.#resizeTimeout);
|
|
6042
|
+
this.#resizeTimeout = undefined;
|
|
6043
|
+
}
|
|
5991
6044
|
this.#manageListeners(false);
|
|
5992
6045
|
}
|
|
5993
6046
|
#handleVisibilityChange() {
|
|
@@ -6362,10 +6415,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6362
6415
|
runParticleCreatedPlugins(container, this);
|
|
6363
6416
|
}
|
|
6364
6417
|
isInsideCanvas(direction) {
|
|
6365
|
-
return this.#getInsideCanvasResult(
|
|
6418
|
+
return this.#getInsideCanvasResult(direction).inside;
|
|
6366
6419
|
}
|
|
6367
6420
|
isInsideCanvasForOutMode(outMode, direction) {
|
|
6368
|
-
return this.#getInsideCanvasResult(
|
|
6421
|
+
return this.#getInsideCanvasResult(direction, outMode).inside;
|
|
6369
6422
|
}
|
|
6370
6423
|
isShowingBack() {
|
|
6371
6424
|
if (!this.roll) {
|
|
@@ -6482,7 +6535,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6482
6535
|
});
|
|
6483
6536
|
}
|
|
6484
6537
|
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
6485
|
-
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce;
|
|
6538
|
+
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce || outMode === exports.OutMode.split;
|
|
6486
6539
|
if (direction === exports.OutModeDirection.bottom) {
|
|
6487
6540
|
return {
|
|
6488
6541
|
inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
|
|
@@ -6524,12 +6577,16 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6524
6577
|
radius: this.getRadius(),
|
|
6525
6578
|
};
|
|
6526
6579
|
}
|
|
6527
|
-
#getInsideCanvasResult(
|
|
6528
|
-
const defaultResult = this.#getDefaultInsideCanvasResult(
|
|
6529
|
-
if (!
|
|
6580
|
+
#getInsideCanvasResult(direction, outMode) {
|
|
6581
|
+
const defaultResult = this.#getDefaultInsideCanvasResult(direction, outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined;
|
|
6582
|
+
if (!shapeDrawer?.isInsideCanvas && !effectDrawer?.isInsideCanvas) {
|
|
6530
6583
|
return defaultResult;
|
|
6531
6584
|
}
|
|
6532
|
-
const callbackData = this.#getInsideCanvasCallbackData(
|
|
6585
|
+
const callbackData = this.#getInsideCanvasCallbackData(direction, outMode), shapeResult = shapeDrawer?.isInsideCanvas
|
|
6586
|
+
? this.#normalizeInsideCanvasResult(shapeDrawer.isInsideCanvas(callbackData), "shape")
|
|
6587
|
+
: undefined, effectResult = effectDrawer?.isInsideCanvas
|
|
6588
|
+
? this.#normalizeInsideCanvasResult(effectDrawer.isInsideCanvas(callbackData), "effect")
|
|
6589
|
+
: undefined;
|
|
6533
6590
|
if (shapeResult && effectResult) {
|
|
6534
6591
|
const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
|
|
6535
6592
|
return {
|
|
@@ -6595,8 +6652,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6595
6652
|
}
|
|
6596
6653
|
|
|
6597
6654
|
class SpatialHashGrid {
|
|
6598
|
-
#cellSize;
|
|
6599
6655
|
#cells = new Map();
|
|
6656
|
+
#cellSize;
|
|
6600
6657
|
#circlePool = [];
|
|
6601
6658
|
#circlePoolIdx;
|
|
6602
6659
|
#pendingCellSize;
|
|
@@ -6642,14 +6699,22 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6642
6699
|
return out;
|
|
6643
6700
|
}
|
|
6644
6701
|
queryCircle(position, radius, check, out = []) {
|
|
6645
|
-
const circle = this.#acquireCircle(position.x, position.y, radius)
|
|
6646
|
-
|
|
6647
|
-
|
|
6702
|
+
const circle = this.#acquireCircle(position.x, position.y, radius);
|
|
6703
|
+
try {
|
|
6704
|
+
return this.query(circle, check, out);
|
|
6705
|
+
}
|
|
6706
|
+
finally {
|
|
6707
|
+
this.#circlePoolIdx--;
|
|
6708
|
+
}
|
|
6648
6709
|
}
|
|
6649
6710
|
queryRectangle(position, size, check, out = []) {
|
|
6650
|
-
const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height)
|
|
6651
|
-
|
|
6652
|
-
|
|
6711
|
+
const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
|
|
6712
|
+
try {
|
|
6713
|
+
return this.query(rect, check, out);
|
|
6714
|
+
}
|
|
6715
|
+
finally {
|
|
6716
|
+
this.#rectanglePoolIdx--;
|
|
6717
|
+
}
|
|
6653
6718
|
}
|
|
6654
6719
|
#acquireCircle(x, y, r) {
|
|
6655
6720
|
const idx = this.#circlePoolIdx++;
|
|
@@ -6708,10 +6773,6 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6708
6773
|
}
|
|
6709
6774
|
}
|
|
6710
6775
|
}
|
|
6711
|
-
#releaseShapes() {
|
|
6712
|
-
this.#circlePoolIdx = 0;
|
|
6713
|
-
this.#rectanglePoolIdx = 0;
|
|
6714
|
-
}
|
|
6715
6776
|
}
|
|
6716
6777
|
|
|
6717
6778
|
class ParticlesManager {
|
|
@@ -7250,8 +7311,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
7250
7311
|
particleCreatedPlugins;
|
|
7251
7312
|
particleDestroyedPlugins;
|
|
7252
7313
|
particlePositionPlugins;
|
|
7253
|
-
particleUpdaters;
|
|
7254
7314
|
particles;
|
|
7315
|
+
particleUpdaters;
|
|
7255
7316
|
peakNits;
|
|
7256
7317
|
plugins;
|
|
7257
7318
|
retina;
|
|
@@ -7259,6 +7320,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
7259
7320
|
started;
|
|
7260
7321
|
zLayers;
|
|
7261
7322
|
#delay;
|
|
7323
|
+
#delayResolve;
|
|
7262
7324
|
#delayTimeout;
|
|
7263
7325
|
#delta = { value: 0, factor: 0 };
|
|
7264
7326
|
#dispatchCallback;
|
|
@@ -7497,7 +7559,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
7497
7559
|
await this.init();
|
|
7498
7560
|
this.started = true;
|
|
7499
7561
|
await new Promise(resolve => {
|
|
7562
|
+
this.#delayResolve = resolve;
|
|
7500
7563
|
const start = async () => {
|
|
7564
|
+
this.#delayTimeout = undefined;
|
|
7565
|
+
this.#delayResolve = undefined;
|
|
7501
7566
|
this.#eventListeners.addListeners();
|
|
7502
7567
|
for (const plugin of this.plugins) {
|
|
7503
7568
|
await plugin.start?.();
|
|
@@ -7513,9 +7578,11 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
7513
7578
|
if (!guardCheck(this) || !this.started) {
|
|
7514
7579
|
return;
|
|
7515
7580
|
}
|
|
7516
|
-
if (this.#delayTimeout) {
|
|
7581
|
+
if (this.#delayTimeout !== undefined) {
|
|
7517
7582
|
clearTimeout(this.#delayTimeout);
|
|
7518
7583
|
this.#delayTimeout = undefined;
|
|
7584
|
+
this.#delayResolve?.();
|
|
7585
|
+
this.#delayResolve = undefined;
|
|
7519
7586
|
}
|
|
7520
7587
|
this.#firstStart = true;
|
|
7521
7588
|
this.started = false;
|
|
@@ -7539,6 +7606,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
7539
7606
|
refresh = plugin.updateActualOptions() || refresh;
|
|
7540
7607
|
}
|
|
7541
7608
|
}
|
|
7609
|
+
this.canvas.render.updateBackgroundElement();
|
|
7542
7610
|
return refresh;
|
|
7543
7611
|
}
|
|
7544
7612
|
#initPlugins(allContainerPlugins) {
|
|
@@ -8521,6 +8589,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
8521
8589
|
if (this.options.spawn.stroke?.color) {
|
|
8522
8590
|
this.spawnStrokeColor = rangeColorToHsl(this.#pluginManager, this.options.spawn.stroke.color);
|
|
8523
8591
|
}
|
|
8592
|
+
const spawnFill = this.options.spawn.fill, spawnStroke = this.options.spawn.stroke;
|
|
8593
|
+
this.spawnFillOpacity = spawnFill?.opacity === undefined ? defaultOpacity$1 : getRangeValue(spawnFill.opacity);
|
|
8594
|
+
this.spawnStrokeOpacity = spawnStroke?.opacity === undefined ? defaultOpacity$1 : getRangeValue(spawnStroke.opacity);
|
|
8595
|
+
this.spawnStrokeWidth = spawnStroke?.width === undefined ? defaultStrokeWidth : getRangeValue(spawnStroke.width);
|
|
8524
8596
|
this.#paused = !this.options.autoPlay;
|
|
8525
8597
|
this.#particlesOptions = particlesOptions;
|
|
8526
8598
|
this.#size = this.#calcSize();
|
|
@@ -8668,8 +8740,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
8668
8740
|
this.#lifeCount--;
|
|
8669
8741
|
}
|
|
8670
8742
|
if (this.#lifeCount > minLifeCount || this.#immortal) {
|
|
8671
|
-
|
|
8672
|
-
|
|
8743
|
+
if (!this.#positionOverride) {
|
|
8744
|
+
this.position = this.#calcPosition();
|
|
8745
|
+
this.#shape?.resize(this.position, this.size);
|
|
8746
|
+
}
|
|
8673
8747
|
this.#spawnDelay = container.retina.reduceFactor
|
|
8674
8748
|
? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
|
|
8675
8749
|
container.retina.reduceFactor
|