@tsparticles/preset-confetti-explosions 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
|
}
|
|
@@ -877,11 +877,13 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
877
877
|
#domArray = [];
|
|
878
878
|
#eventDispatcher = new EventDispatcher();
|
|
879
879
|
#initialized = false;
|
|
880
|
+
#loadSequence = 0;
|
|
881
|
+
#loadSequences = new Map();
|
|
880
882
|
get items() {
|
|
881
883
|
return this.#domArray;
|
|
882
884
|
}
|
|
883
885
|
get version() {
|
|
884
|
-
return "4.5.
|
|
886
|
+
return "4.5.2";
|
|
885
887
|
}
|
|
886
888
|
addEventListener(type, listener) {
|
|
887
889
|
this.#eventDispatcher.addEventListener(type, listener);
|
|
@@ -911,44 +913,60 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
911
913
|
return item;
|
|
912
914
|
}
|
|
913
915
|
async load(params) {
|
|
914
|
-
await this.init();
|
|
915
916
|
let domSourceElement;
|
|
916
917
|
if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
|
|
917
918
|
domSourceElement = params.element;
|
|
918
919
|
}
|
|
919
|
-
const
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
920
|
+
const id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, loadSequence = ++this.#loadSequence;
|
|
921
|
+
this.#loadSequences.set(id, loadSequence);
|
|
922
|
+
try {
|
|
923
|
+
await this.init();
|
|
924
|
+
const { Container } = await Promise.resolve().then(function () { return Container$1; }), { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options;
|
|
925
|
+
if (this.#loadSequences.get(id) !== loadSequence) {
|
|
926
|
+
return undefined;
|
|
927
|
+
}
|
|
928
|
+
const currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
|
|
929
|
+
dispatchCallback: (eventType, args) => {
|
|
930
|
+
this.dispatchEvent(eventType, args);
|
|
931
|
+
},
|
|
932
|
+
id,
|
|
933
|
+
onDestroy: (remove) => {
|
|
934
|
+
if (!remove) {
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
const mainArr = this.items, idx = mainArr.indexOf(newItem);
|
|
938
|
+
if (idx >= removeMinIndex) {
|
|
939
|
+
mainArr.splice(idx, removeDeleteCount);
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
pluginManager: this.pluginManager,
|
|
943
|
+
sourceOptions: currentOptions,
|
|
944
|
+
});
|
|
945
|
+
if (oldIndex >= loadMinIndex) {
|
|
946
|
+
const old = this.item(oldIndex), deleteCount = old ? one : none;
|
|
947
|
+
if (old && !old.destroyed) {
|
|
948
|
+
old.destroy(false);
|
|
931
949
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
if (oldIndex >= loadMinIndex) {
|
|
937
|
-
const old = this.item(oldIndex), deleteCount = old ? one : none;
|
|
938
|
-
if (old && !old.destroyed) {
|
|
939
|
-
old.destroy(false);
|
|
950
|
+
items.splice(oldIndex, deleteCount, newItem);
|
|
951
|
+
}
|
|
952
|
+
else {
|
|
953
|
+
items.push(newItem);
|
|
940
954
|
}
|
|
941
|
-
|
|
955
|
+
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
956
|
+
? params.element
|
|
957
|
+
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
958
|
+
newItem.canvas.loadCanvas(sourceCanvas);
|
|
959
|
+
await newItem.start();
|
|
960
|
+
if (newItem.destroyed) {
|
|
961
|
+
return undefined;
|
|
962
|
+
}
|
|
963
|
+
return newItem;
|
|
942
964
|
}
|
|
943
|
-
|
|
944
|
-
|
|
965
|
+
finally {
|
|
966
|
+
if (this.#loadSequences.get(id) === loadSequence) {
|
|
967
|
+
this.#loadSequences.delete(id);
|
|
968
|
+
}
|
|
945
969
|
}
|
|
946
|
-
const sourceCanvas = typeof OffscreenCanvas !== "undefined" && params.element instanceof OffscreenCanvas
|
|
947
|
-
? params.element
|
|
948
|
-
: getCanvasFromContainer(getDomContainer(id, domSourceElement));
|
|
949
|
-
newItem.canvas.loadCanvas(sourceCanvas);
|
|
950
|
-
await newItem.start();
|
|
951
|
-
return newItem;
|
|
952
970
|
}
|
|
953
971
|
async refresh(refresh = true) {
|
|
954
972
|
if (!refresh) {
|
|
@@ -2256,6 +2274,13 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2256
2274
|
}
|
|
2257
2275
|
}
|
|
2258
2276
|
|
|
2277
|
+
function hasEnabledBlend(particleOptions) {
|
|
2278
|
+
if (!particleOptions || typeof particleOptions !== "object" || !("blend" in particleOptions)) {
|
|
2279
|
+
return false;
|
|
2280
|
+
}
|
|
2281
|
+
const blend = particleOptions.blend;
|
|
2282
|
+
return !!blend && typeof blend === "object" && "enable" in blend && !!blend.enable;
|
|
2283
|
+
}
|
|
2259
2284
|
class BlendPlugin {
|
|
2260
2285
|
id = "blend";
|
|
2261
2286
|
async getPlugin(container) {
|
|
@@ -2277,12 +2302,31 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2277
2302
|
options.blend.load(source?.blend);
|
|
2278
2303
|
}
|
|
2279
2304
|
needsPlugin(options) {
|
|
2280
|
-
|
|
2305
|
+
if (options?.blend?.enable ||
|
|
2306
|
+
options?.particles?.blend?.enable ||
|
|
2307
|
+
Object.values(options?.particles?.groups ?? {}).some(hasEnabledBlend)) {
|
|
2308
|
+
return true;
|
|
2309
|
+
}
|
|
2310
|
+
const emitters = options?.["emitters"];
|
|
2311
|
+
let emitterList = [];
|
|
2312
|
+
if (Array.isArray(emitters)) {
|
|
2313
|
+
emitterList = emitters;
|
|
2314
|
+
}
|
|
2315
|
+
else if (emitters) {
|
|
2316
|
+
emitterList = [emitters];
|
|
2317
|
+
}
|
|
2318
|
+
return emitterList.some(emitter => {
|
|
2319
|
+
if (!emitter || typeof emitter !== "object" || !("particles" in emitter)) {
|
|
2320
|
+
return false;
|
|
2321
|
+
}
|
|
2322
|
+
const particles = emitter.particles;
|
|
2323
|
+
return Array.isArray(particles) ? particles.some(hasEnabledBlend) : hasEnabledBlend(particles);
|
|
2324
|
+
});
|
|
2281
2325
|
}
|
|
2282
2326
|
}
|
|
2283
2327
|
|
|
2284
2328
|
async function loadBlendPlugin(engine) {
|
|
2285
|
-
engine.checkVersion("4.5.
|
|
2329
|
+
engine.checkVersion("4.5.2");
|
|
2286
2330
|
await engine.pluginManager.register(e => {
|
|
2287
2331
|
e.pluginManager.addPlugin(new BlendPlugin());
|
|
2288
2332
|
});
|
|
@@ -2319,7 +2363,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2319
2363
|
}
|
|
2320
2364
|
|
|
2321
2365
|
async function loadCircleShape(engine) {
|
|
2322
|
-
engine.checkVersion("4.5.
|
|
2366
|
+
engine.checkVersion("4.5.2");
|
|
2323
2367
|
await engine.pluginManager.register(e => {
|
|
2324
2368
|
e.pluginManager.addShape(["circle"], () => {
|
|
2325
2369
|
return Promise.resolve(new CircleDrawer());
|
|
@@ -2367,7 +2411,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2367
2411
|
}
|
|
2368
2412
|
|
|
2369
2413
|
async function loadHexColorPlugin(engine) {
|
|
2370
|
-
engine.checkVersion("4.5.
|
|
2414
|
+
engine.checkVersion("4.5.2");
|
|
2371
2415
|
await engine.pluginManager.register(e => {
|
|
2372
2416
|
e.pluginManager.addColorManager("hex", new HexColorManager());
|
|
2373
2417
|
});
|
|
@@ -2420,7 +2464,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2420
2464
|
}
|
|
2421
2465
|
|
|
2422
2466
|
async function loadHslColorPlugin(engine) {
|
|
2423
|
-
engine.checkVersion("4.5.
|
|
2467
|
+
engine.checkVersion("4.5.2");
|
|
2424
2468
|
await engine.pluginManager.register(e => {
|
|
2425
2469
|
e.pluginManager.addColorManager("hsl", new HslColorManager());
|
|
2426
2470
|
});
|
|
@@ -2452,7 +2496,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2452
2496
|
}
|
|
2453
2497
|
|
|
2454
2498
|
async function loadMovePlugin(engine) {
|
|
2455
|
-
engine.checkVersion("4.5.
|
|
2499
|
+
engine.checkVersion("4.5.2");
|
|
2456
2500
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
2457
2501
|
addErrorMessages(ErrorMessages$1);
|
|
2458
2502
|
}
|
|
@@ -2668,7 +2712,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2668
2712
|
}
|
|
2669
2713
|
|
|
2670
2714
|
async function loadOpacityUpdater(engine) {
|
|
2671
|
-
engine.checkVersion("4.5.
|
|
2715
|
+
engine.checkVersion("4.5.2");
|
|
2672
2716
|
await engine.pluginManager.register(e => {
|
|
2673
2717
|
e.pluginManager.addParticleUpdater("opacity", container => {
|
|
2674
2718
|
return Promise.resolve(new OpacityUpdater(container));
|
|
@@ -2997,7 +3041,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
2997
3041
|
}
|
|
2998
3042
|
|
|
2999
3043
|
async function loadOutModesUpdater(engine) {
|
|
3000
|
-
engine.checkVersion("4.5.
|
|
3044
|
+
engine.checkVersion("4.5.2");
|
|
3001
3045
|
await engine.pluginManager.register(e => {
|
|
3002
3046
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
3003
3047
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -3076,7 +3120,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3076
3120
|
}
|
|
3077
3121
|
|
|
3078
3122
|
async function loadPaintUpdater(engine) {
|
|
3079
|
-
engine.checkVersion("4.5.
|
|
3123
|
+
engine.checkVersion("4.5.2");
|
|
3080
3124
|
await engine.pluginManager.register(e => {
|
|
3081
3125
|
e.pluginManager.addParticleUpdater("paint", container => {
|
|
3082
3126
|
return Promise.resolve(new PaintUpdater(e.pluginManager, container));
|
|
@@ -3131,7 +3175,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3131
3175
|
}
|
|
3132
3176
|
|
|
3133
3177
|
async function loadRgbColorPlugin(engine) {
|
|
3134
|
-
engine.checkVersion("4.5.
|
|
3178
|
+
engine.checkVersion("4.5.2");
|
|
3135
3179
|
await engine.pluginManager.register(e => {
|
|
3136
3180
|
e.pluginManager.addColorManager("rgb", new RgbColorManager());
|
|
3137
3181
|
});
|
|
@@ -3216,7 +3260,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3216
3260
|
}
|
|
3217
3261
|
|
|
3218
3262
|
async function loadSizeUpdater(engine) {
|
|
3219
|
-
engine.checkVersion("4.5.
|
|
3263
|
+
engine.checkVersion("4.5.2");
|
|
3220
3264
|
await engine.pluginManager.register(e => {
|
|
3221
3265
|
e.pluginManager.addParticleUpdater("size", container => {
|
|
3222
3266
|
return Promise.resolve(new SizeUpdater(container));
|
|
@@ -3225,7 +3269,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3225
3269
|
}
|
|
3226
3270
|
|
|
3227
3271
|
async function loadBasic(engine) {
|
|
3228
|
-
engine.checkVersion("4.5.
|
|
3272
|
+
engine.checkVersion("4.5.2");
|
|
3229
3273
|
await engine.pluginManager.register(async (e) => {
|
|
3230
3274
|
await Promise.all([
|
|
3231
3275
|
loadBlendPlugin(e),
|
|
@@ -3490,7 +3534,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3490
3534
|
})(EmitterClickMode || (EmitterClickMode = {}));
|
|
3491
3535
|
|
|
3492
3536
|
async function loadEmittersPluginSimple(engine) {
|
|
3493
|
-
engine.checkVersion("4.5.
|
|
3537
|
+
engine.checkVersion("4.5.2");
|
|
3494
3538
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
3495
3539
|
addErrorMessages(ErrorMessages);
|
|
3496
3540
|
}
|
|
@@ -3547,7 +3591,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3547
3591
|
}
|
|
3548
3592
|
|
|
3549
3593
|
async function loadMotionPlugin(engine) {
|
|
3550
|
-
engine.checkVersion("4.5.
|
|
3594
|
+
engine.checkVersion("4.5.2");
|
|
3551
3595
|
await engine.pluginManager.register(e => {
|
|
3552
3596
|
e.pluginManager.addPlugin(new MotionPlugin());
|
|
3553
3597
|
});
|
|
@@ -3680,7 +3724,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3680
3724
|
}
|
|
3681
3725
|
|
|
3682
3726
|
async function loadRollUpdater(engine) {
|
|
3683
|
-
engine.checkVersion("4.5.
|
|
3727
|
+
engine.checkVersion("4.5.2");
|
|
3684
3728
|
await engine.pluginManager.register(e => {
|
|
3685
3729
|
e.pluginManager.addParticleUpdater("roll", () => {
|
|
3686
3730
|
return Promise.resolve(new RollUpdater(e.pluginManager));
|
|
@@ -3786,7 +3830,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3786
3830
|
}
|
|
3787
3831
|
|
|
3788
3832
|
async function loadRotateUpdater(engine) {
|
|
3789
|
-
engine.checkVersion("4.5.
|
|
3833
|
+
engine.checkVersion("4.5.2");
|
|
3790
3834
|
await engine.pluginManager.register(e => {
|
|
3791
3835
|
e.pluginManager.addParticleUpdater("rotate", container => {
|
|
3792
3836
|
return Promise.resolve(new RotateUpdater(container));
|
|
@@ -3810,7 +3854,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3810
3854
|
}
|
|
3811
3855
|
|
|
3812
3856
|
async function loadSquareShape(engine) {
|
|
3813
|
-
engine.checkVersion("4.5.
|
|
3857
|
+
engine.checkVersion("4.5.2");
|
|
3814
3858
|
await engine.pluginManager.register(e => {
|
|
3815
3859
|
e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
|
|
3816
3860
|
});
|
|
@@ -3919,7 +3963,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
3919
3963
|
}
|
|
3920
3964
|
|
|
3921
3965
|
async function loadTiltUpdater(engine) {
|
|
3922
|
-
engine.checkVersion("4.5.
|
|
3966
|
+
engine.checkVersion("4.5.2");
|
|
3923
3967
|
await engine.pluginManager.register(e => {
|
|
3924
3968
|
e.pluginManager.addParticleUpdater("tilt", container => {
|
|
3925
3969
|
return Promise.resolve(new TiltUpdater(container));
|
|
@@ -4021,7 +4065,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4021
4065
|
}
|
|
4022
4066
|
|
|
4023
4067
|
async function loadWobbleUpdater(engine) {
|
|
4024
|
-
engine.checkVersion("4.5.
|
|
4068
|
+
engine.checkVersion("4.5.2");
|
|
4025
4069
|
await engine.pluginManager.register(e => {
|
|
4026
4070
|
e.pluginManager.addParticleUpdater("wobble", container => {
|
|
4027
4071
|
return Promise.resolve(new WobbleUpdater(container));
|
|
@@ -4345,7 +4389,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4345
4389
|
});
|
|
4346
4390
|
}
|
|
4347
4391
|
drawParticles(delta) {
|
|
4348
|
-
const { particles, actualOptions } = this.#container
|
|
4392
|
+
const { particles, actualOptions } = this.#container;
|
|
4393
|
+
this.clear();
|
|
4349
4394
|
particles.update(delta);
|
|
4350
4395
|
this.draw(ctx => {
|
|
4351
4396
|
const width = this.#canvasManager.size.width, height = this.#canvasManager.size.height;
|
|
@@ -4367,9 +4412,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4367
4412
|
}
|
|
4368
4413
|
}
|
|
4369
4414
|
for (const plugin of this.#getLayerPlugins(DrawLayer.BackgroundMask)) {
|
|
4370
|
-
|
|
4371
|
-
plugin.canvasPaint?.();
|
|
4372
|
-
}
|
|
4415
|
+
plugin.canvasPaint?.();
|
|
4373
4416
|
}
|
|
4374
4417
|
for (const plugin of this.#getLayerPlugins(DrawLayer.CanvasSetup)) {
|
|
4375
4418
|
plugin.drawSettingsSetup?.(ctx, delta);
|
|
@@ -4459,6 +4502,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4459
4502
|
ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
|
|
4460
4503
|
});
|
|
4461
4504
|
}
|
|
4505
|
+
updateBackgroundElement() {
|
|
4506
|
+
this.#resolveBackgroundElement();
|
|
4507
|
+
}
|
|
4462
4508
|
#applyPostDrawUpdaters(particle) {
|
|
4463
4509
|
for (const updater of this.#postDrawUpdaters) {
|
|
4464
4510
|
updater.afterDraw?.(particle);
|
|
@@ -4657,7 +4703,14 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
4657
4703
|
}
|
|
4658
4704
|
if (typeof background.element === "string") {
|
|
4659
4705
|
if (typeof document !== "undefined") {
|
|
4660
|
-
|
|
4706
|
+
let node;
|
|
4707
|
+
try {
|
|
4708
|
+
node = document.querySelector(background.element);
|
|
4709
|
+
}
|
|
4710
|
+
catch {
|
|
4711
|
+
this.#warnOnce("background-element-invalid-selector", `Background element selector "${background.element}" is invalid`);
|
|
4712
|
+
return;
|
|
4713
|
+
}
|
|
4661
4714
|
if (node && this.#isSupportedElement(node)) {
|
|
4662
4715
|
this.#backgroundElement = node;
|
|
4663
4716
|
}
|
|
@@ -5481,10 +5534,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5481
5534
|
runParticleCreatedPlugins(container, this);
|
|
5482
5535
|
}
|
|
5483
5536
|
isInsideCanvas(direction) {
|
|
5484
|
-
return this.#getInsideCanvasResult(
|
|
5537
|
+
return this.#getInsideCanvasResult(direction).inside;
|
|
5485
5538
|
}
|
|
5486
5539
|
isInsideCanvasForOutMode(outMode, direction) {
|
|
5487
|
-
return this.#getInsideCanvasResult(
|
|
5540
|
+
return this.#getInsideCanvasResult(direction, outMode).inside;
|
|
5488
5541
|
}
|
|
5489
5542
|
isShowingBack() {
|
|
5490
5543
|
if (!this.roll) {
|
|
@@ -5601,7 +5654,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5601
5654
|
});
|
|
5602
5655
|
}
|
|
5603
5656
|
#getDefaultInsideCanvasResult(direction, outMode) {
|
|
5604
|
-
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce;
|
|
5657
|
+
const radius = this.getRadius(), canvasSize = this.#container.canvas.size, position = this.position, isBounce = outMode === OutMode.bounce || outMode === OutMode.split;
|
|
5605
5658
|
if (direction === OutModeDirection.bottom) {
|
|
5606
5659
|
return {
|
|
5607
5660
|
inside: isBounce ? position.y + radius < canvasSize.height : position.y - radius < canvasSize.height,
|
|
@@ -5643,12 +5696,16 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5643
5696
|
radius: this.getRadius(),
|
|
5644
5697
|
};
|
|
5645
5698
|
}
|
|
5646
|
-
#getInsideCanvasResult(
|
|
5647
|
-
const defaultResult = this.#getDefaultInsideCanvasResult(
|
|
5648
|
-
if (!
|
|
5699
|
+
#getInsideCanvasResult(direction, outMode) {
|
|
5700
|
+
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;
|
|
5701
|
+
if (!shapeDrawer?.isInsideCanvas && !effectDrawer?.isInsideCanvas) {
|
|
5649
5702
|
return defaultResult;
|
|
5650
5703
|
}
|
|
5651
|
-
const callbackData = this.#getInsideCanvasCallbackData(
|
|
5704
|
+
const callbackData = this.#getInsideCanvasCallbackData(direction, outMode), shapeResult = shapeDrawer?.isInsideCanvas
|
|
5705
|
+
? this.#normalizeInsideCanvasResult(shapeDrawer.isInsideCanvas(callbackData), "shape")
|
|
5706
|
+
: undefined, effectResult = effectDrawer?.isInsideCanvas
|
|
5707
|
+
? this.#normalizeInsideCanvasResult(effectDrawer.isInsideCanvas(callbackData), "effect")
|
|
5708
|
+
: undefined;
|
|
5652
5709
|
if (shapeResult && effectResult) {
|
|
5653
5710
|
const margin = Math.max(shapeResult.margin ?? defaultAngle, effectResult.margin ?? defaultAngle);
|
|
5654
5711
|
return {
|
|
@@ -5714,8 +5771,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
5714
5771
|
}
|
|
5715
5772
|
|
|
5716
5773
|
class SpatialHashGrid {
|
|
5717
|
-
#cellSize;
|
|
5718
5774
|
#cells = new Map();
|
|
5775
|
+
#cellSize;
|
|
5719
5776
|
#circlePool = [];
|
|
5720
5777
|
#circlePoolIdx;
|
|
5721
5778
|
#pendingCellSize;
|
|
@@ -6373,8 +6430,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6373
6430
|
particleCreatedPlugins;
|
|
6374
6431
|
particleDestroyedPlugins;
|
|
6375
6432
|
particlePositionPlugins;
|
|
6376
|
-
particleUpdaters;
|
|
6377
6433
|
particles;
|
|
6434
|
+
particleUpdaters;
|
|
6378
6435
|
peakNits;
|
|
6379
6436
|
plugins;
|
|
6380
6437
|
retina;
|
|
@@ -6668,6 +6725,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
6668
6725
|
refresh = plugin.updateActualOptions() || refresh;
|
|
6669
6726
|
}
|
|
6670
6727
|
}
|
|
6728
|
+
this.canvas.render.updateBackgroundElement();
|
|
6671
6729
|
return refresh;
|
|
6672
6730
|
}
|
|
6673
6731
|
#initPlugins(allContainerPlugins) {
|
|
@@ -7279,6 +7337,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
|
|
|
7279
7337
|
if (this.options.spawn.stroke?.color) {
|
|
7280
7338
|
this.spawnStrokeColor = rangeColorToHsl(this.#pluginManager, this.options.spawn.stroke.color);
|
|
7281
7339
|
}
|
|
7340
|
+
const spawnFill = this.options.spawn.fill, spawnStroke = this.options.spawn.stroke;
|
|
7341
|
+
this.spawnFillOpacity = spawnFill?.opacity === undefined ? defaultOpacity$1 : getRangeValue(spawnFill.opacity);
|
|
7342
|
+
this.spawnStrokeOpacity = spawnStroke?.opacity === undefined ? defaultOpacity$1 : getRangeValue(spawnStroke.opacity);
|
|
7343
|
+
this.spawnStrokeWidth = spawnStroke?.width === undefined ? defaultStrokeWidth : getRangeValue(spawnStroke.width);
|
|
7282
7344
|
this.#paused = !this.options.autoPlay;
|
|
7283
7345
|
this.#particlesOptions = particlesOptions;
|
|
7284
7346
|
this.#size = this.#calcSize();
|