@tsparticles/particles 4.5.1 → 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/particles.js +2 -2
- package/browser/particles.lazy.js +2 -2
- package/cjs/particles.js +2 -2
- package/cjs/particles.lazy.js +2 -2
- package/esm/particles.js +2 -2
- package/esm/particles.lazy.js +2 -2
- package/package.json +6 -6
- package/report.html +1 -1
- package/tsparticles.particles.bundle.js +142 -74
- package/tsparticles.particles.bundle.min.js +1 -1
- package/tsparticles.particles.js +3 -3
- package/tsparticles.particles.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
|
}
|
|
@@ -947,11 +947,13 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
947
947
|
#domArray = [];
|
|
948
948
|
#eventDispatcher = new EventDispatcher();
|
|
949
949
|
#initialized = false;
|
|
950
|
+
#loadSequence = 0;
|
|
951
|
+
#loadSequences = new Map();
|
|
950
952
|
get items() {
|
|
951
953
|
return this.#domArray;
|
|
952
954
|
}
|
|
953
955
|
get version() {
|
|
954
|
-
return "4.5.
|
|
956
|
+
return "4.5.2";
|
|
955
957
|
}
|
|
956
958
|
addEventListener(type, listener) {
|
|
957
959
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -981,44 +983,60 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
981
983
|
return item;
|
|
982
984
|
}
|
|
983
985
|
async load(params) {
|
|
984
|
-
await this.init();
|
|
985
986
|
let domSourceElement;
|
|
986
987
|
if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
|
|
987
988
|
domSourceElement = params.element;
|
|
988
989
|
}
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
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);
|
|
1001
1019
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
|
|
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;
|
|
1010
1032
|
}
|
|
1011
|
-
|
|
1033
|
+
return newItem;
|
|
1012
1034
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1035
|
+
finally {
|
|
1036
|
+
if (this.#loadSequences.get(id) === loadSequence) {
|
|
1037
|
+
this.#loadSequences.delete(id);
|
|
1038
|
+
}
|
|
1015
1039
|
}
|
|
1016
|
-
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
1017
|
-
? params.element
|
|
1018
|
-
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
1019
|
-
newItem.canvas.loadCanvas(sourceCanvas);
|
|
1020
|
-
await newItem.start();
|
|
1021
|
-
return newItem;
|
|
1022
1040
|
}
|
|
1023
1041
|
async refresh(refresh = true) {
|
|
1024
1042
|
if (!refresh) {
|
|
@@ -2491,6 +2509,13 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2491
2509
|
}
|
|
2492
2510
|
}
|
|
2493
2511
|
|
|
2512
|
+
function hasEnabledBlend(particleOptions) {
|
|
2513
|
+
if (!particleOptions || typeof particleOptions !== "object" || !("blend" in particleOptions)) {
|
|
2514
|
+
return false;
|
|
2515
|
+
}
|
|
2516
|
+
const blend = particleOptions.blend;
|
|
2517
|
+
return !!blend && typeof blend === "object" && "enable" in blend && !!blend.enable;
|
|
2518
|
+
}
|
|
2494
2519
|
class BlendPlugin {
|
|
2495
2520
|
id = "blend";
|
|
2496
2521
|
async getPlugin(container) {
|
|
@@ -2512,12 +2537,31 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2512
2537
|
options.blend.load(source?.blend);
|
|
2513
2538
|
}
|
|
2514
2539
|
needsPlugin(options) {
|
|
2515
|
-
|
|
2540
|
+
if (options?.blend?.enable ||
|
|
2541
|
+
options?.particles?.blend?.enable ||
|
|
2542
|
+
Object.values(options?.particles?.groups ?? {}).some(hasEnabledBlend)) {
|
|
2543
|
+
return true;
|
|
2544
|
+
}
|
|
2545
|
+
const emitters = options?.["emitters"];
|
|
2546
|
+
let emitterList = [];
|
|
2547
|
+
if (Array.isArray(emitters)) {
|
|
2548
|
+
emitterList = emitters;
|
|
2549
|
+
}
|
|
2550
|
+
else if (emitters) {
|
|
2551
|
+
emitterList = [emitters];
|
|
2552
|
+
}
|
|
2553
|
+
return emitterList.some(emitter => {
|
|
2554
|
+
if (!emitter || typeof emitter !== "object" || !("particles" in emitter)) {
|
|
2555
|
+
return false;
|
|
2556
|
+
}
|
|
2557
|
+
const particles = emitter.particles;
|
|
2558
|
+
return Array.isArray(particles) ? particles.some(hasEnabledBlend) : hasEnabledBlend(particles);
|
|
2559
|
+
});
|
|
2516
2560
|
}
|
|
2517
2561
|
}
|
|
2518
2562
|
|
|
2519
2563
|
async function loadBlendPlugin(engine) {
|
|
2520
|
-
engine.checkVersion("4.5.
|
|
2564
|
+
engine.checkVersion("4.5.2");
|
|
2521
2565
|
await engine.pluginManager.register(e => {
|
|
2522
2566
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2523
2567
|
});
|
|
@@ -2554,7 +2598,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2554
2598
|
}
|
|
2555
2599
|
|
|
2556
2600
|
async function loadCircleShape(engine) {
|
|
2557
|
-
engine.checkVersion("4.5.
|
|
2601
|
+
engine.checkVersion("4.5.2");
|
|
2558
2602
|
await engine.pluginManager.register(e => {
|
|
2559
2603
|
e.pluginManager.addShape(["circle"], () => {
|
|
2560
2604
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -2602,7 +2646,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2602
2646
|
}
|
|
2603
2647
|
|
|
2604
2648
|
async function loadHexColorPlugin(engine) {
|
|
2605
|
-
engine.checkVersion("4.5.
|
|
2649
|
+
engine.checkVersion("4.5.2");
|
|
2606
2650
|
await engine.pluginManager.register(e => {
|
|
2607
2651
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
2608
2652
|
});
|
|
@@ -2655,7 +2699,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2655
2699
|
}
|
|
2656
2700
|
|
|
2657
2701
|
async function loadHslColorPlugin(engine) {
|
|
2658
|
-
engine.checkVersion("4.5.
|
|
2702
|
+
engine.checkVersion("4.5.2");
|
|
2659
2703
|
await engine.pluginManager.register(e => {
|
|
2660
2704
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
2661
2705
|
});
|
|
@@ -2687,7 +2731,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2687
2731
|
}
|
|
2688
2732
|
|
|
2689
2733
|
async function loadMovePlugin(engine) {
|
|
2690
|
-
engine.checkVersion("4.5.
|
|
2734
|
+
engine.checkVersion("4.5.2");
|
|
2691
2735
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
2692
2736
|
addErrorMessages(ErrorMessages$2);
|
|
2693
2737
|
}
|
|
@@ -2897,7 +2941,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
2897
2941
|
}
|
|
2898
2942
|
|
|
2899
2943
|
async function loadOpacityUpdater(engine) {
|
|
2900
|
-
engine.checkVersion("4.5.
|
|
2944
|
+
engine.checkVersion("4.5.2");
|
|
2901
2945
|
await engine.pluginManager.register(e => {
|
|
2902
2946
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
2903
2947
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -3226,7 +3270,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3226
3270
|
}
|
|
3227
3271
|
|
|
3228
3272
|
async function loadOutModesUpdater(engine) {
|
|
3229
|
-
engine.checkVersion("4.5.
|
|
3273
|
+
engine.checkVersion("4.5.2");
|
|
3230
3274
|
await engine.pluginManager.register(e => {
|
|
3231
3275
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3232
3276
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3305,7 +3349,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3305
3349
|
}
|
|
3306
3350
|
|
|
3307
3351
|
async function loadPaintUpdater(engine) {
|
|
3308
|
-
engine.checkVersion("4.5.
|
|
3352
|
+
engine.checkVersion("4.5.2");
|
|
3309
3353
|
await engine.pluginManager.register(e => {
|
|
3310
3354
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3311
3355
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3360,7 +3404,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3360
3404
|
}
|
|
3361
3405
|
|
|
3362
3406
|
async function loadRgbColorPlugin(engine) {
|
|
3363
|
-
engine.checkVersion("4.5.
|
|
3407
|
+
engine.checkVersion("4.5.2");
|
|
3364
3408
|
await engine.pluginManager.register(e => {
|
|
3365
3409
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3366
3410
|
});
|
|
@@ -3445,7 +3489,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3445
3489
|
}
|
|
3446
3490
|
|
|
3447
3491
|
async function loadSizeUpdater(engine) {
|
|
3448
|
-
engine.checkVersion("4.5.
|
|
3492
|
+
engine.checkVersion("4.5.2");
|
|
3449
3493
|
await engine.pluginManager.register(e => {
|
|
3450
3494
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3451
3495
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3454,7 +3498,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3454
3498
|
}
|
|
3455
3499
|
|
|
3456
3500
|
async function loadBasic(engine) {
|
|
3457
|
-
engine.checkVersion("4.5.
|
|
3501
|
+
engine.checkVersion("4.5.2");
|
|
3458
3502
|
await engine.pluginManager.register(async (e) => {
|
|
3459
3503
|
await Promise.all([
|
|
3460
3504
|
loadBlendPlugin(e),
|
|
@@ -3660,7 +3704,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3660
3704
|
const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
|
|
3661
3705
|
|
|
3662
3706
|
async function loadInteractivityPlugin(engine) {
|
|
3663
|
-
engine.checkVersion("4.5.
|
|
3707
|
+
engine.checkVersion("4.5.2");
|
|
3664
3708
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
3665
3709
|
addErrorMessages(ErrorMessages$1);
|
|
3666
3710
|
}
|
|
@@ -3817,7 +3861,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3817
3861
|
return (Math.abs(Math.round(this.#ownerZ) - Math.round(neighbor.getPosition().z)) <= ownerRadius + neighbor.getRadius());
|
|
3818
3862
|
};
|
|
3819
3863
|
}
|
|
3820
|
-
separateOverlaps(particle, position) {
|
|
3864
|
+
separateOverlaps(particle, position, margin, maxX, maxY) {
|
|
3821
3865
|
const neighbors = this.#neighbors, particlePosition = particle.position;
|
|
3822
3866
|
particlePosition.setTo(position);
|
|
3823
3867
|
for (let iteration = 0; iteration < separationIterations; iteration++) {
|
|
@@ -3825,6 +3869,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3825
3869
|
this.#projectPair(particle, neighbor);
|
|
3826
3870
|
}
|
|
3827
3871
|
}
|
|
3872
|
+
if (margin !== undefined && maxX !== undefined && maxY !== undefined) {
|
|
3873
|
+
clampToWalls(particlePosition, margin, maxX, maxY);
|
|
3874
|
+
}
|
|
3828
3875
|
}
|
|
3829
3876
|
solve(container, particle) {
|
|
3830
3877
|
const collisionsOptions = particle.options.collisions;
|
|
@@ -3872,7 +3919,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3872
3919
|
if (hasBounds) {
|
|
3873
3920
|
clampToWalls(position, margin, maxX, maxY);
|
|
3874
3921
|
}
|
|
3875
|
-
this.separateOverlaps(particle, position);
|
|
3922
|
+
this.separateOverlaps(particle, position, hasBounds ? margin : undefined, maxX, maxY);
|
|
3876
3923
|
this.#dampContacts(particle);
|
|
3877
3924
|
if (hasBounds) {
|
|
3878
3925
|
this.#cancelWallVelocity(particle, margin, maxX, maxY);
|
|
@@ -3925,10 +3972,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
3925
3972
|
}
|
|
3926
3973
|
}
|
|
3927
3974
|
#queryNeighbors(container, particle, radius, maxNeighbors) {
|
|
3975
|
+
this.#neighbors.length = 0;
|
|
3928
3976
|
if (radius <= minRadius || maxNeighbors <= minCount) {
|
|
3929
3977
|
return;
|
|
3930
3978
|
}
|
|
3931
|
-
this.#neighbors.length = 0;
|
|
3932
3979
|
container.particles.grid.queryCircle(particle.getPosition(), radius, this.#isNeighbor, this.#neighbors);
|
|
3933
3980
|
}
|
|
3934
3981
|
}
|
|
@@ -4112,7 +4159,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4112
4159
|
}
|
|
4113
4160
|
|
|
4114
4161
|
async function loadParticlesCollisionsInteraction(engine) {
|
|
4115
|
-
engine.checkVersion("4.5.
|
|
4162
|
+
engine.checkVersion("4.5.2");
|
|
4116
4163
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
4117
4164
|
addErrorMessages(ErrorMessages);
|
|
4118
4165
|
}
|
|
@@ -4132,8 +4179,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4132
4179
|
this.#canvasSize = canvasSize;
|
|
4133
4180
|
}
|
|
4134
4181
|
contains(point) {
|
|
4135
|
-
if (super.contains(point))
|
|
4182
|
+
if (super.contains(point)) {
|
|
4136
4183
|
return true;
|
|
4184
|
+
}
|
|
4137
4185
|
const { width, height } = this.#canvasSize, { x, y } = point;
|
|
4138
4186
|
return (super.contains({ x: x - width, y }) ||
|
|
4139
4187
|
super.contains({ x: x + width, y }) ||
|
|
@@ -4145,8 +4193,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4145
4193
|
super.contains({ x: x + width, y: y - height }));
|
|
4146
4194
|
}
|
|
4147
4195
|
intersects(range) {
|
|
4148
|
-
if (super.intersects(range))
|
|
4196
|
+
if (super.intersects(range)) {
|
|
4149
4197
|
return true;
|
|
4198
|
+
}
|
|
4150
4199
|
const { width, height } = this.#canvasSize, pos = range.position, shifts = [
|
|
4151
4200
|
{ x: -width, y: 0 },
|
|
4152
4201
|
{ x: width, y: 0 },
|
|
@@ -4167,8 +4216,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4167
4216
|
const rect = range;
|
|
4168
4217
|
shiftedRange = new Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
|
|
4169
4218
|
}
|
|
4170
|
-
if (super.intersects(shiftedRange))
|
|
4219
|
+
if (super.intersects(shiftedRange)) {
|
|
4171
4220
|
return true;
|
|
4221
|
+
}
|
|
4172
4222
|
}
|
|
4173
4223
|
return false;
|
|
4174
4224
|
}
|
|
@@ -4178,14 +4228,18 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4178
4228
|
return grid.query(this);
|
|
4179
4229
|
}
|
|
4180
4230
|
const xShifts = [originPoint.x], yShifts = [originPoint.y];
|
|
4181
|
-
if (crossesLeft)
|
|
4231
|
+
if (crossesLeft) {
|
|
4182
4232
|
xShifts.push(width);
|
|
4183
|
-
|
|
4233
|
+
}
|
|
4234
|
+
if (crossesRight) {
|
|
4184
4235
|
xShifts.push(-width);
|
|
4185
|
-
|
|
4236
|
+
}
|
|
4237
|
+
if (crossesTop) {
|
|
4186
4238
|
yShifts.push(height);
|
|
4187
|
-
|
|
4239
|
+
}
|
|
4240
|
+
if (crossesBottom) {
|
|
4188
4241
|
yShifts.push(-height);
|
|
4242
|
+
}
|
|
4189
4243
|
const particles = new Set();
|
|
4190
4244
|
for (const dx of xShifts) {
|
|
4191
4245
|
for (const dy of yShifts) {
|
|
@@ -4395,7 +4449,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4395
4449
|
}
|
|
4396
4450
|
|
|
4397
4451
|
async function loadParticlesLinksInteraction(engine) {
|
|
4398
|
-
engine.checkVersion("4.5.
|
|
4452
|
+
engine.checkVersion("4.5.2");
|
|
4399
4453
|
await engine.pluginManager.register((e) => {
|
|
4400
4454
|
const pluginManager = e.pluginManager;
|
|
4401
4455
|
ensureInteractivityPluginLoaded(e);
|
|
@@ -4408,7 +4462,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4408
4462
|
|
|
4409
4463
|
let initPromise = null;
|
|
4410
4464
|
async function doInitPlugins(engine) {
|
|
4411
|
-
engine.checkVersion("4.5.
|
|
4465
|
+
engine.checkVersion("4.5.2");
|
|
4412
4466
|
await engine.pluginManager.register(async (e) => {
|
|
4413
4467
|
const loadParticlesInteractivity = async (e) => {
|
|
4414
4468
|
await loadInteractivityPlugin(e);
|
|
@@ -4451,7 +4505,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4451
4505
|
particles.init = async () => {
|
|
4452
4506
|
await initPlugins(tsParticles);
|
|
4453
4507
|
};
|
|
4454
|
-
particles.version = "4.5.
|
|
4508
|
+
particles.version = "4.5.2";
|
|
4455
4509
|
globalThis.particles = particles;
|
|
4456
4510
|
|
|
4457
4511
|
const globalObject = globalThis;
|
|
@@ -4620,7 +4674,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4620
4674
|
});
|
|
4621
4675
|
}
|
|
4622
4676
|
drawParticles(delta) {
|
|
4623
|
-
const { particles, actualOptions } = this.#container
|
|
4677
|
+
const { particles, actualOptions } = this.#container;
|
|
4678
|
+
this.clear();
|
|
4624
4679
|
particles.update(delta);
|
|
4625
4680
|
this.draw(ctx => {
|
|
4626
4681
|
const width = this.#canvasManager.size.width, height = this.#canvasManager.size.height;
|
|
@@ -4642,9 +4697,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4642
4697
|
}
|
|
4643
4698
|
}
|
|
4644
4699
|
for (const plugin of this.#getLayerPlugins(exports.DrawLayer.BackgroundMask)) {
|
|
4645
|
-
|
|
4646
|
-
plugin.canvasPaint?.();
|
|
4647
|
-
}
|
|
4700
|
+
plugin.canvasPaint?.();
|
|
4648
4701
|
}
|
|
4649
4702
|
for (const plugin of this.#getLayerPlugins(exports.DrawLayer.CanvasSetup)) {
|
|
4650
4703
|
plugin.drawSettingsSetup?.(ctx, delta);
|
|
@@ -4734,6 +4787,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4734
4787
|
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
4735
4788
|
});
|
|
4736
4789
|
}
|
|
4790
|
+
updateBackgroundElement() {
|
|
4791
|
+
this.#resolveBackgroundElement();
|
|
4792
|
+
}
|
|
4737
4793
|
#applyPostDrawUpdaters(particle) {
|
|
4738
4794
|
for (const updater of this.#postDrawUpdaters) {
|
|
4739
4795
|
updater.afterDraw?.(particle);
|
|
@@ -4932,7 +4988,14 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
4932
4988
|
}
|
|
4933
4989
|
if (typeof background.element === "string") {
|
|
4934
4990
|
if (typeof document !== "undefined") {
|
|
4935
|
-
|
|
4991
|
+
let node;
|
|
4992
|
+
try {
|
|
4993
|
+
node = document.querySelector(background.element);
|
|
4994
|
+
}
|
|
4995
|
+
catch {
|
|
4996
|
+
this.#warnOnce("background-element-invalid-selector", `Background element selector "${background.element}" is invalid`);
|
|
4997
|
+
return;
|
|
4998
|
+
}
|
|
4936
4999
|
if (node && this.#isSupportedElement(node)) {
|
|
4937
5000
|
this.#backgroundElement = node;
|
|
4938
5001
|
}
|
|
@@ -5756,10 +5819,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5756
5819
|
runParticleCreatedPlugins(container, this);
|
|
5757
5820
|
}
|
|
5758
5821
|
isInsideCanvas(direction) {
|
|
5759
|
-
return this.#getInsideCanvasResult(
|
|
5822
|
+
return this.#getInsideCanvasResult(direction).inside;
|
|
5760
5823
|
}
|
|
5761
5824
|
isInsideCanvasForOutMode(outMode, direction) {
|
|
5762
|
-
return this.#getInsideCanvasResult(
|
|
5825
|
+
return this.#getInsideCanvasResult(direction, outMode).inside;
|
|
5763
5826
|
}
|
|
5764
5827
|
isShowingBack() {
|
|
5765
5828
|
if (!this.roll) {
|
|
@@ -5876,7 +5939,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5876
5939
|
});
|
|
5877
5940
|
}
|
|
5878
5941
|
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
5879
|
-
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce;
|
|
5942
|
+
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === exports.OutMode.bounce || outMode === exports.OutMode.split;
|
|
5880
5943
|
if (direction === exports.OutModeDirection.bottom) {
|
|
5881
5944
|
return {
|
|
5882
5945
|
inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
|
|
@@ -5918,12 +5981,16 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5918
5981
|
radius: this.getRadius(),
|
|
5919
5982
|
};
|
|
5920
5983
|
}
|
|
5921
|
-
#getInsideCanvasResult(
|
|
5922
|
-
const defaultResult = this.#getDefaultInsideCanvasResult(
|
|
5923
|
-
if (!
|
|
5984
|
+
#getInsideCanvasResult(direction, outMode) {
|
|
5985
|
+
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;
|
|
5986
|
+
if (!shapeDrawer?.isInsideCanvas && !effectDrawer?.isInsideCanvas) {
|
|
5924
5987
|
return defaultResult;
|
|
5925
5988
|
}
|
|
5926
|
-
const callbackData = this.#getInsideCanvasCallbackData(
|
|
5989
|
+
const callbackData = this.#getInsideCanvasCallbackData(direction, outMode), shapeResult = shapeDrawer?.isInsideCanvas
|
|
5990
|
+
? this.#normalizeInsideCanvasResult(shapeDrawer.isInsideCanvas(callbackData), "shape")
|
|
5991
|
+
: undefined, effectResult = effectDrawer?.isInsideCanvas
|
|
5992
|
+
? this.#normalizeInsideCanvasResult(effectDrawer.isInsideCanvas(callbackData), "effect")
|
|
5993
|
+
: undefined;
|
|
5927
5994
|
if (shapeResult && effectResult) {
|
|
5928
5995
|
const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
|
|
5929
5996
|
return {
|
|
@@ -5989,8 +6056,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
5989
6056
|
}
|
|
5990
6057
|
|
|
5991
6058
|
class SpatialHashGrid {
|
|
5992
|
-
#cellSize;
|
|
5993
6059
|
#cells = new Map();
|
|
6060
|
+
#cellSize;
|
|
5994
6061
|
#circlePool = [];
|
|
5995
6062
|
#circlePoolIdx;
|
|
5996
6063
|
#pendingCellSize;
|
|
@@ -6648,8 +6715,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6648
6715
|
particleCreatedPlugins;
|
|
6649
6716
|
particleDestroyedPlugins;
|
|
6650
6717
|
particlePositionPlugins;
|
|
6651
|
-
particleUpdaters;
|
|
6652
6718
|
particles;
|
|
6719
|
+
particleUpdaters;
|
|
6653
6720
|
peakNits;
|
|
6654
6721
|
plugins;
|
|
6655
6722
|
retina;
|
|
@@ -6943,6 +7010,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
|
|
|
6943
7010
|
refresh = plugin.updateActualOptions() || refresh;
|
|
6944
7011
|
}
|
|
6945
7012
|
}
|
|
7013
|
+
this.canvas.render.updateBackgroundElement();
|
|
6946
7014
|
return refresh;
|
|
6947
7015
|
}
|
|
6948
7016
|
#initPlugins(allContainerPlugins) {
|