@tsparticles/preset-matrix 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.
|
@@ -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
|
-
/* Preset v4.5.
|
|
3
|
+
/* Preset v4.5.2 */
|
|
4
4
|
g.__tsParticlesInternals = g.__tsParticlesInternals || {};
|
|
5
5
|
g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
6
6
|
(function (exports) {
|
|
@@ -120,7 +120,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
120
120
|
}
|
|
121
121
|
normalize() {
|
|
122
122
|
const length = this.length;
|
|
123
|
-
if (length
|
|
123
|
+
if (length !== none) {
|
|
124
124
|
this.multTo(inverseFactorNumerator / length);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -864,11 +864,13 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
864
864
|
#domArray = [];
|
|
865
865
|
#eventDispatcher = new EventDispatcher();
|
|
866
866
|
#initialized = false;
|
|
867
|
+
#loadSequence = 0;
|
|
868
|
+
#loadSequences = new Map();
|
|
867
869
|
get items() {
|
|
868
870
|
return this.#domArray;
|
|
869
871
|
}
|
|
870
872
|
get version() {
|
|
871
|
-
return "4.5.
|
|
873
|
+
return "4.5.2";
|
|
872
874
|
}
|
|
873
875
|
addEventListener(type, listener) {
|
|
874
876
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -898,44 +900,60 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
898
900
|
return item;
|
|
899
901
|
}
|
|
900
902
|
async load(params) {
|
|
901
|
-
await this.init();
|
|
902
903
|
let domSourceElement;
|
|
903
904
|
if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
|
|
904
905
|
domSourceElement = params.element;
|
|
905
906
|
}
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
907
|
+
const id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, loadSequence = ++this.#loadSequence;
|
|
908
|
+
this.#loadSequences.set(id, loadSequence);
|
|
909
|
+
try {
|
|
910
|
+
await this.init();
|
|
911
|
+
const { Container } = await Promise.resolve().then(function () { return Container$1; }), { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options;
|
|
912
|
+
if (this.#loadSequences.get(id) !== loadSequence) {
|
|
913
|
+
return undefined;
|
|
914
|
+
}
|
|
915
|
+
const currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
|
|
916
|
+
dispatchCallback: (eventType, args) => {
|
|
917
|
+
this.dispatchEvent(eventType, args);
|
|
918
|
+
},
|
|
919
|
+
id,
|
|
920
|
+
onDestroy: (remove) => {
|
|
921
|
+
if (!remove) {
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
const mainArr = this.items, idx = mainArr.indexOf(newItem);
|
|
925
|
+
if (idx >= removeMinIndex) {
|
|
926
|
+
mainArr.splice(idx, removeDeleteCount);
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
pluginManager: this.pluginManager,
|
|
930
|
+
sourceOptions: currentOptions,
|
|
931
|
+
});
|
|
932
|
+
if (oldIndex >= loadMinIndex) {
|
|
933
|
+
const old = this.item(oldIndex), deleteCount = old ? one : none;
|
|
934
|
+
if (old && !old.destroyed) {
|
|
935
|
+
old.destroy(false);
|
|
918
936
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
if (oldIndex >= loadMinIndex) {
|
|
924
|
-
const old = this.item(oldIndex), deleteCount = old ? one : none;
|
|
925
|
-
if (old && !old.destroyed) {
|
|
926
|
-
old.destroy(false);
|
|
937
|
+
items.splice(oldIndex, deleteCount, newItem);
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
items.push(newItem);
|
|
927
941
|
}
|
|
928
|
-
|
|
942
|
+
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
943
|
+
? params.element
|
|
944
|
+
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
945
|
+
newItem.canvas.loadCanvas(sourceCanvas);
|
|
946
|
+
await newItem.start();
|
|
947
|
+
if (newItem.destroyed) {
|
|
948
|
+
return undefined;
|
|
949
|
+
}
|
|
950
|
+
return newItem;
|
|
929
951
|
}
|
|
930
|
-
|
|
931
|
-
|
|
952
|
+
finally {
|
|
953
|
+
if (this.#loadSequences.get(id) === loadSequence) {
|
|
954
|
+
this.#loadSequences.delete(id);
|
|
955
|
+
}
|
|
932
956
|
}
|
|
933
|
-
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
934
|
-
? params.element
|
|
935
|
-
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
936
|
-
newItem.canvas.loadCanvas(sourceCanvas);
|
|
937
|
-
await newItem.start();
|
|
938
|
-
return newItem;
|
|
939
957
|
}
|
|
940
958
|
async refresh(refresh = true) {
|
|
941
959
|
if (!refresh) {
|
|
@@ -2243,6 +2261,13 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2243
2261
|
}
|
|
2244
2262
|
}
|
|
2245
2263
|
|
|
2264
|
+
function hasEnabledBlend(particleOptions) {
|
|
2265
|
+
if (!particleOptions || typeof particleOptions !== "object" || !("blend" in particleOptions)) {
|
|
2266
|
+
return false;
|
|
2267
|
+
}
|
|
2268
|
+
const blend = particleOptions.blend;
|
|
2269
|
+
return !!blend && typeof blend === "object" && "enable" in blend && !!blend.enable;
|
|
2270
|
+
}
|
|
2246
2271
|
class BlendPlugin {
|
|
2247
2272
|
id = "blend";
|
|
2248
2273
|
async getPlugin(container) {
|
|
@@ -2264,12 +2289,31 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2264
2289
|
options.blend.load(source?.blend);
|
|
2265
2290
|
}
|
|
2266
2291
|
needsPlugin(options) {
|
|
2267
|
-
|
|
2292
|
+
if (options?.blend?.enable ||
|
|
2293
|
+
options?.particles?.blend?.enable ||
|
|
2294
|
+
Object.values(options?.particles?.groups ?? {}).some(hasEnabledBlend)) {
|
|
2295
|
+
return true;
|
|
2296
|
+
}
|
|
2297
|
+
const emitters = options?.["emitters"];
|
|
2298
|
+
let emitterList = [];
|
|
2299
|
+
if (Array.isArray(emitters)) {
|
|
2300
|
+
emitterList = emitters;
|
|
2301
|
+
}
|
|
2302
|
+
else if (emitters) {
|
|
2303
|
+
emitterList = [emitters];
|
|
2304
|
+
}
|
|
2305
|
+
return emitterList.some(emitter => {
|
|
2306
|
+
if (!emitter || typeof emitter !== "object" || !("particles" in emitter)) {
|
|
2307
|
+
return false;
|
|
2308
|
+
}
|
|
2309
|
+
const particles = emitter.particles;
|
|
2310
|
+
return Array.isArray(particles) ? particles.some(hasEnabledBlend) : hasEnabledBlend(particles);
|
|
2311
|
+
});
|
|
2268
2312
|
}
|
|
2269
2313
|
}
|
|
2270
2314
|
|
|
2271
2315
|
async function loadBlendPlugin(engine) {
|
|
2272
|
-
engine.checkVersion("4.5.
|
|
2316
|
+
engine.checkVersion("4.5.2");
|
|
2273
2317
|
await engine.pluginManager.register(e => {
|
|
2274
2318
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2275
2319
|
});
|
|
@@ -2306,7 +2350,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2306
2350
|
}
|
|
2307
2351
|
|
|
2308
2352
|
async function loadCircleShape(engine) {
|
|
2309
|
-
engine.checkVersion("4.5.
|
|
2353
|
+
engine.checkVersion("4.5.2");
|
|
2310
2354
|
await engine.pluginManager.register(e => {
|
|
2311
2355
|
e.pluginManager.addShape(["circle"], () => {
|
|
2312
2356
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -2354,7 +2398,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2354
2398
|
}
|
|
2355
2399
|
|
|
2356
2400
|
async function loadHexColorPlugin(engine) {
|
|
2357
|
-
engine.checkVersion("4.5.
|
|
2401
|
+
engine.checkVersion("4.5.2");
|
|
2358
2402
|
await engine.pluginManager.register(e => {
|
|
2359
2403
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
2360
2404
|
});
|
|
@@ -2407,7 +2451,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2407
2451
|
}
|
|
2408
2452
|
|
|
2409
2453
|
async function loadHslColorPlugin(engine) {
|
|
2410
|
-
engine.checkVersion("4.5.
|
|
2454
|
+
engine.checkVersion("4.5.2");
|
|
2411
2455
|
await engine.pluginManager.register(e => {
|
|
2412
2456
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
2413
2457
|
});
|
|
@@ -2439,7 +2483,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2439
2483
|
}
|
|
2440
2484
|
|
|
2441
2485
|
async function loadMovePlugin(engine) {
|
|
2442
|
-
engine.checkVersion("4.5.
|
|
2486
|
+
engine.checkVersion("4.5.2");
|
|
2443
2487
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
2444
2488
|
addErrorMessages(ErrorMessages);
|
|
2445
2489
|
}
|
|
@@ -2649,7 +2693,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2649
2693
|
}
|
|
2650
2694
|
|
|
2651
2695
|
async function loadOpacityUpdater(engine) {
|
|
2652
|
-
engine.checkVersion("4.5.
|
|
2696
|
+
engine.checkVersion("4.5.2");
|
|
2653
2697
|
await engine.pluginManager.register(e => {
|
|
2654
2698
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
2655
2699
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -2978,7 +3022,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2978
3022
|
}
|
|
2979
3023
|
|
|
2980
3024
|
async function loadOutModesUpdater(engine) {
|
|
2981
|
-
engine.checkVersion("4.5.
|
|
3025
|
+
engine.checkVersion("4.5.2");
|
|
2982
3026
|
await engine.pluginManager.register(e => {
|
|
2983
3027
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
2984
3028
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3057,7 +3101,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3057
3101
|
}
|
|
3058
3102
|
|
|
3059
3103
|
async function loadPaintUpdater(engine) {
|
|
3060
|
-
engine.checkVersion("4.5.
|
|
3104
|
+
engine.checkVersion("4.5.2");
|
|
3061
3105
|
await engine.pluginManager.register(e => {
|
|
3062
3106
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3063
3107
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3112,7 +3156,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3112
3156
|
}
|
|
3113
3157
|
|
|
3114
3158
|
async function loadRgbColorPlugin(engine) {
|
|
3115
|
-
engine.checkVersion("4.5.
|
|
3159
|
+
engine.checkVersion("4.5.2");
|
|
3116
3160
|
await engine.pluginManager.register(e => {
|
|
3117
3161
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3118
3162
|
});
|
|
@@ -3197,7 +3241,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3197
3241
|
}
|
|
3198
3242
|
|
|
3199
3243
|
async function loadSizeUpdater(engine) {
|
|
3200
|
-
engine.checkVersion("4.5.
|
|
3244
|
+
engine.checkVersion("4.5.2");
|
|
3201
3245
|
await engine.pluginManager.register(e => {
|
|
3202
3246
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3203
3247
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3206,7 +3250,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3206
3250
|
}
|
|
3207
3251
|
|
|
3208
3252
|
async function loadBasic(engine) {
|
|
3209
|
-
engine.checkVersion("4.5.
|
|
3253
|
+
engine.checkVersion("4.5.2");
|
|
3210
3254
|
await engine.pluginManager.register(async (e) => {
|
|
3211
3255
|
await Promise.all([
|
|
3212
3256
|
loadBlendPlugin(e),
|
|
@@ -3438,7 +3482,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3438
3482
|
}
|
|
3439
3483
|
|
|
3440
3484
|
async function loadMatrixShape(engine) {
|
|
3441
|
-
engine.checkVersion("4.5.
|
|
3485
|
+
engine.checkVersion("4.5.2");
|
|
3442
3486
|
await engine.pluginManager.register(e => {
|
|
3443
3487
|
e.pluginManager.addShape(["matrix"], () => Promise.resolve(new MatrixDrawer()));
|
|
3444
3488
|
});
|
|
@@ -3483,7 +3527,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3483
3527
|
}
|
|
3484
3528
|
|
|
3485
3529
|
async function loadPoissonDiscPlugin(engine) {
|
|
3486
|
-
engine.checkVersion("4.5.
|
|
3530
|
+
engine.checkVersion("4.5.2");
|
|
3487
3531
|
await engine.pluginManager.register(e => {
|
|
3488
3532
|
e.pluginManager.addPlugin(new PoissonDiscPlugin());
|
|
3489
3533
|
});
|
|
@@ -3525,7 +3569,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3525
3569
|
}
|
|
3526
3570
|
|
|
3527
3571
|
async function loadShadowEffect(engine) {
|
|
3528
|
-
engine.checkVersion("4.5.
|
|
3572
|
+
engine.checkVersion("4.5.2");
|
|
3529
3573
|
await engine.pluginManager.register(e => {
|
|
3530
3574
|
e.pluginManager.addEffect("shadow", container => {
|
|
3531
3575
|
return Promise.resolve(new ShadowDrawer(e.pluginManager, container));
|
|
@@ -3589,7 +3633,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3589
3633
|
}
|
|
3590
3634
|
|
|
3591
3635
|
async function loadTrailPlugin(engine) {
|
|
3592
|
-
engine.checkVersion("4.5.
|
|
3636
|
+
engine.checkVersion("4.5.2");
|
|
3593
3637
|
await engine.pluginManager.register(e => {
|
|
3594
3638
|
e.pluginManager.addPlugin(new TrailPlugin(e.pluginManager));
|
|
3595
3639
|
});
|
|
@@ -3853,7 +3897,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3853
3897
|
});
|
|
3854
3898
|
}
|
|
3855
3899
|
drawParticles(delta) {
|
|
3856
|
-
const { particles, actualOptions } = this.#container
|
|
3900
|
+
const { particles, actualOptions } = this.#container;
|
|
3901
|
+
this.clear();
|
|
3857
3902
|
particles.update(delta);
|
|
3858
3903
|
this.draw(ctx => {
|
|
3859
3904
|
const width = this.#canvasManager.size.width, height = this.#canvasManager.size.height;
|
|
@@ -3875,9 +3920,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3875
3920
|
}
|
|
3876
3921
|
}
|
|
3877
3922
|
for (const plugin of this.#getLayerPlugins(DrawLayer.BackgroundMask)) {
|
|
3878
|
-
|
|
3879
|
-
plugin.canvasPaint?.();
|
|
3880
|
-
}
|
|
3923
|
+
plugin.canvasPaint?.();
|
|
3881
3924
|
}
|
|
3882
3925
|
for (const plugin of this.#getLayerPlugins(DrawLayer.CanvasSetup)) {
|
|
3883
3926
|
plugin.drawSettingsSetup?.(ctx, delta);
|
|
@@ -3967,6 +4010,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3967
4010
|
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
3968
4011
|
});
|
|
3969
4012
|
}
|
|
4013
|
+
updateBackgroundElement() {
|
|
4014
|
+
this.#resolveBackgroundElement();
|
|
4015
|
+
}
|
|
3970
4016
|
#applyPostDrawUpdaters(particle) {
|
|
3971
4017
|
for (const updater of this.#postDrawUpdaters) {
|
|
3972
4018
|
updater.afterDraw?.(particle);
|
|
@@ -4165,7 +4211,14 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4165
4211
|
}
|
|
4166
4212
|
if (typeof background.element === "string") {
|
|
4167
4213
|
if (typeof document !== "undefined") {
|
|
4168
|
-
|
|
4214
|
+
let node;
|
|
4215
|
+
try {
|
|
4216
|
+
node = document.querySelector(background.element);
|
|
4217
|
+
}
|
|
4218
|
+
catch {
|
|
4219
|
+
this.#warnOnce("background-element-invalid-selector", `Background element selector "${background.element}" is invalid`);
|
|
4220
|
+
return;
|
|
4221
|
+
}
|
|
4169
4222
|
if (node && this.#isSupportedElement(node)) {
|
|
4170
4223
|
this.#backgroundElement = node;
|
|
4171
4224
|
}
|
|
@@ -4989,10 +5042,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4989
5042
|
runParticleCreatedPlugins(container, this);
|
|
4990
5043
|
}
|
|
4991
5044
|
isInsideCanvas(direction) {
|
|
4992
|
-
return this.#getInsideCanvasResult(
|
|
5045
|
+
return this.#getInsideCanvasResult(direction).inside;
|
|
4993
5046
|
}
|
|
4994
5047
|
isInsideCanvasForOutMode(outMode, direction) {
|
|
4995
|
-
return this.#getInsideCanvasResult(
|
|
5048
|
+
return this.#getInsideCanvasResult(direction, outMode).inside;
|
|
4996
5049
|
}
|
|
4997
5050
|
isShowingBack() {
|
|
4998
5051
|
if (!this.roll) {
|
|
@@ -5109,7 +5162,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5109
5162
|
});
|
|
5110
5163
|
}
|
|
5111
5164
|
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
5112
|
-
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce;
|
|
5165
|
+
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce || outMode === OutMode.split;
|
|
5113
5166
|
if (direction === OutModeDirection.bottom) {
|
|
5114
5167
|
return {
|
|
5115
5168
|
inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
|
|
@@ -5151,12 +5204,16 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5151
5204
|
radius: this.getRadius(),
|
|
5152
5205
|
};
|
|
5153
5206
|
}
|
|
5154
|
-
#getInsideCanvasResult(
|
|
5155
|
-
const defaultResult = this.#getDefaultInsideCanvasResult(
|
|
5156
|
-
if (!
|
|
5207
|
+
#getInsideCanvasResult(direction, outMode) {
|
|
5208
|
+
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;
|
|
5209
|
+
if (!shapeDrawer?.isInsideCanvas && !effectDrawer?.isInsideCanvas) {
|
|
5157
5210
|
return defaultResult;
|
|
5158
5211
|
}
|
|
5159
|
-
const callbackData = this.#getInsideCanvasCallbackData(
|
|
5212
|
+
const callbackData = this.#getInsideCanvasCallbackData(direction, outMode), shapeResult = shapeDrawer?.isInsideCanvas
|
|
5213
|
+
? this.#normalizeInsideCanvasResult(shapeDrawer.isInsideCanvas(callbackData), "shape")
|
|
5214
|
+
: undefined, effectResult = effectDrawer?.isInsideCanvas
|
|
5215
|
+
? this.#normalizeInsideCanvasResult(effectDrawer.isInsideCanvas(callbackData), "effect")
|
|
5216
|
+
: undefined;
|
|
5160
5217
|
if (shapeResult && effectResult) {
|
|
5161
5218
|
const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
|
|
5162
5219
|
return {
|
|
@@ -5222,8 +5279,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5222
5279
|
}
|
|
5223
5280
|
|
|
5224
5281
|
class SpatialHashGrid {
|
|
5225
|
-
#cellSize;
|
|
5226
5282
|
#cells = new Map();
|
|
5283
|
+
#cellSize;
|
|
5227
5284
|
#circlePool = [];
|
|
5228
5285
|
#circlePoolIdx;
|
|
5229
5286
|
#pendingCellSize;
|
|
@@ -5881,8 +5938,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5881
5938
|
particleCreatedPlugins;
|
|
5882
5939
|
particleDestroyedPlugins;
|
|
5883
5940
|
particlePositionPlugins;
|
|
5884
|
-
particleUpdaters;
|
|
5885
5941
|
particles;
|
|
5942
|
+
particleUpdaters;
|
|
5886
5943
|
peakNits;
|
|
5887
5944
|
plugins;
|
|
5888
5945
|
retina;
|
|
@@ -6176,6 +6233,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6176
6233
|
refresh = plugin.updateActualOptions() || refresh;
|
|
6177
6234
|
}
|
|
6178
6235
|
}
|
|
6236
|
+
this.canvas.render.updateBackgroundElement();
|
|
6179
6237
|
return refresh;
|
|
6180
6238
|
}
|
|
6181
6239
|
#initPlugins(allContainerPlugins) {
|