@tsparticles/fireworks 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
- /* tsParticles v4.5.1 */
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 != none) {
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.1";
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 { Container } = await Promise.resolve().then(function () { return Container$1; }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
990
- dispatchCallback: (eventType, args) => {
991
- this.dispatchEvent(eventType, args);
992
- },
993
- id,
994
- onDestroy: (remove) => {
995
- if (!remove) {
996
- return;
997
- }
998
- const mainArr = this.items, idx = mainArr.indexOf(newItem);
999
- if (idx >= removeMinIndex) {
1000
- mainArr.splice(idx, removeDeleteCount);
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
- pluginManager: this.pluginManager,
1004
- sourceOptions: currentOptions,
1005
- });
1006
- if (oldIndex >= loadMinIndex) {
1007
- const old = this.item(oldIndex), deleteCount = old ? one : none;
1008
- if (old && !old.destroyed) {
1009
- old.destroy(false);
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
- items.splice(oldIndex, deleteCount, newItem);
1033
+ return newItem;
1012
1034
  }
1013
- else {
1014
- items.push(newItem);
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) {
@@ -2718,6 +2736,13 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2718
2736
  }
2719
2737
  }
2720
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
+ }
2721
2746
  class BlendPlugin {
2722
2747
  id = "blend";
2723
2748
  async getPlugin(container) {
@@ -2739,12 +2764,31 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2739
2764
  options.blend.load(source?.blend);
2740
2765
  }
2741
2766
  needsPlugin(options) {
2742
- return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
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
+ });
2743
2787
  }
2744
2788
  }
2745
2789
 
2746
2790
  async function loadBlendPlugin(engine) {
2747
- engine.checkVersion("4.5.1");
2791
+ engine.checkVersion("4.5.2");
2748
2792
  await engine.pluginManager.register(e => {
2749
2793
  e.pluginManager.addPlugin(new BlendPlugin());
2750
2794
  });
@@ -2781,7 +2825,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2781
2825
  }
2782
2826
 
2783
2827
  async function loadCircleShape(engine) {
2784
- engine.checkVersion("4.5.1");
2828
+ engine.checkVersion("4.5.2");
2785
2829
  await engine.pluginManager.register(e => {
2786
2830
  e.pluginManager.addShape(["circle"], () => {
2787
2831
  return Promise.resolve(new CircleDrawer());
@@ -2829,7 +2873,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2829
2873
  }
2830
2874
 
2831
2875
  async function loadHexColorPlugin(engine) {
2832
- engine.checkVersion("4.5.1");
2876
+ engine.checkVersion("4.5.2");
2833
2877
  await engine.pluginManager.register(e => {
2834
2878
  e.pluginManager.addColorManager("hex", new HexColorManager());
2835
2879
  });
@@ -2882,7 +2926,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2882
2926
  }
2883
2927
 
2884
2928
  async function loadHslColorPlugin(engine) {
2885
- engine.checkVersion("4.5.1");
2929
+ engine.checkVersion("4.5.2");
2886
2930
  await engine.pluginManager.register(e => {
2887
2931
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2888
2932
  });
@@ -2914,7 +2958,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2914
2958
  }
2915
2959
 
2916
2960
  async function loadMovePlugin(engine) {
2917
- engine.checkVersion("4.5.1");
2961
+ engine.checkVersion("4.5.2");
2918
2962
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
2919
2963
  addErrorMessages(ErrorMessages$1);
2920
2964
  }
@@ -3130,7 +3174,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3130
3174
  }
3131
3175
 
3132
3176
  async function loadOpacityUpdater(engine) {
3133
- engine.checkVersion("4.5.1");
3177
+ engine.checkVersion("4.5.2");
3134
3178
  await engine.pluginManager.register(e => {
3135
3179
  e.pluginManager.addParticleUpdater("opacity", container => {
3136
3180
  return Promise.resolve(new OpacityUpdater(container));
@@ -3459,7 +3503,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3459
3503
  }
3460
3504
 
3461
3505
  async function loadOutModesUpdater(engine) {
3462
- engine.checkVersion("4.5.1");
3506
+ engine.checkVersion("4.5.2");
3463
3507
  await engine.pluginManager.register(e => {
3464
3508
  e.pluginManager.addParticleUpdater("outModes", container => {
3465
3509
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3538,7 +3582,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3538
3582
  }
3539
3583
 
3540
3584
  async function loadPaintUpdater(engine) {
3541
- engine.checkVersion("4.5.1");
3585
+ engine.checkVersion("4.5.2");
3542
3586
  await engine.pluginManager.register(e => {
3543
3587
  e.pluginManager.addParticleUpdater("paint", container => {
3544
3588
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3593,7 +3637,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3593
3637
  }
3594
3638
 
3595
3639
  async function loadRgbColorPlugin(engine) {
3596
- engine.checkVersion("4.5.1");
3640
+ engine.checkVersion("4.5.2");
3597
3641
  await engine.pluginManager.register(e => {
3598
3642
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3599
3643
  });
@@ -3678,7 +3722,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3678
3722
  }
3679
3723
 
3680
3724
  async function loadSizeUpdater(engine) {
3681
- engine.checkVersion("4.5.1");
3725
+ engine.checkVersion("4.5.2");
3682
3726
  await engine.pluginManager.register(e => {
3683
3727
  e.pluginManager.addParticleUpdater("size", container => {
3684
3728
  return Promise.resolve(new SizeUpdater(container));
@@ -3687,7 +3731,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3687
3731
  }
3688
3732
 
3689
3733
  async function loadBasic(engine) {
3690
- engine.checkVersion("4.5.1");
3734
+ engine.checkVersion("4.5.2");
3691
3735
  await engine.pluginManager.register(async (e) => {
3692
3736
  await Promise.all([
3693
3737
  loadBlendPlugin(e),
@@ -4018,7 +4062,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4018
4062
  }
4019
4063
 
4020
4064
  async function loadDestroyUpdater(engine) {
4021
- engine.checkVersion("4.5.1");
4065
+ engine.checkVersion("4.5.2");
4022
4066
  await engine.pluginManager.register(e => {
4023
4067
  e.pluginManager.addParticleUpdater("destroy", container => {
4024
4068
  return Promise.resolve(new DestroyUpdater(e.pluginManager, container));
@@ -4263,7 +4307,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4263
4307
  })(EmitterClickMode || (EmitterClickMode = {}));
4264
4308
 
4265
4309
  async function loadEmittersPluginSimple(engine) {
4266
- engine.checkVersion("4.5.1");
4310
+ engine.checkVersion("4.5.2");
4267
4311
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
4268
4312
  addErrorMessages(ErrorMessages);
4269
4313
  }
@@ -4412,7 +4456,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4412
4456
  }
4413
4457
 
4414
4458
  async function loadEmittersShapeSquare(engine) {
4415
- engine.checkVersion("4.5.1");
4459
+ engine.checkVersion("4.5.2");
4416
4460
  await engine.pluginManager.register((e) => {
4417
4461
  ensureEmittersPluginLoaded(e);
4418
4462
  e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
@@ -4556,7 +4600,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4556
4600
  }
4557
4601
 
4558
4602
  async function loadLifeUpdater(engine) {
4559
- engine.checkVersion("4.5.1");
4603
+ engine.checkVersion("4.5.2");
4560
4604
  await engine.pluginManager.register(e => {
4561
4605
  e.pluginManager.addParticleUpdater("life", container => {
4562
4606
  return Promise.resolve(new LifeUpdater(container));
@@ -4582,7 +4626,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4582
4626
  }
4583
4627
 
4584
4628
  async function loadLineShape(engine) {
4585
- engine.checkVersion("4.5.1");
4629
+ engine.checkVersion("4.5.2");
4586
4630
  await engine.pluginManager.register(e => {
4587
4631
  e.pluginManager.addShape(["line"], () => Promise.resolve(new LineDrawer()));
4588
4632
  });
@@ -4686,7 +4730,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4686
4730
  }
4687
4731
 
4688
4732
  async function loadRotateUpdater(engine) {
4689
- engine.checkVersion("4.5.1");
4733
+ engine.checkVersion("4.5.2");
4690
4734
  await engine.pluginManager.register(e => {
4691
4735
  e.pluginManager.addParticleUpdater("rotate", container => {
4692
4736
  return Promise.resolve(new RotateUpdater(container));
@@ -5002,7 +5046,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5002
5046
  }
5003
5047
 
5004
5048
  async function loadSoundsPlugin(engine) {
5005
- engine.checkVersion("4.5.1");
5049
+ engine.checkVersion("4.5.2");
5006
5050
  await engine.pluginManager.register(e => {
5007
5051
  e.pluginManager.addPlugin(new SoundsPlugin(e));
5008
5052
  });
@@ -5010,7 +5054,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5010
5054
 
5011
5055
  let initPromise = null;
5012
5056
  async function doInitPlugins(engine) {
5013
- engine.checkVersion("4.5.1");
5057
+ engine.checkVersion("4.5.2");
5014
5058
  await engine.pluginManager.register(async (e) => {
5015
5059
  const loadEmittersForFireworks = async (e) => {
5016
5060
  await loadEmittersPluginSimple(e);
@@ -5057,7 +5101,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5057
5101
  fireworks.init = async () => {
5058
5102
  await initPlugins(tsParticles);
5059
5103
  };
5060
- fireworks.version = "4.5.1";
5104
+ fireworks.version = "4.5.2";
5061
5105
  globalThis.fireworks = fireworks;
5062
5106
 
5063
5107
  const globalObject = globalThis;
@@ -5226,7 +5270,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5226
5270
  });
5227
5271
  }
5228
5272
  drawParticles(delta) {
5229
- const { particles, actualOptions } = this.#container, clearedPlugin = this.clear();
5273
+ const { particles, actualOptions } = this.#container;
5274
+ this.clear();
5230
5275
  particles.update(delta);
5231
5276
  this.draw(ctx => {
5232
5277
  const width = this.#canvasManager.size.width, height = this.#canvasManager.size.height;
@@ -5248,9 +5293,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5248
5293
  }
5249
5294
  }
5250
5295
  for (const plugin of this.#getLayerPlugins(exports.DrawLayer.BackgroundMask)) {
5251
- if (plugin !== clearedPlugin) {
5252
- plugin.canvasPaint?.();
5253
- }
5296
+ plugin.canvasPaint?.();
5254
5297
  }
5255
5298
  for (const plugin of this.#getLayerPlugins(exports.DrawLayer.CanvasSetup)) {
5256
5299
  plugin.drawSettingsSetup?.(ctx, delta);
@@ -5340,6 +5383,9 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5340
5383
  ctx.clearRect(originPoint.x, originPoint.y, this.#canvasManager.size.width, this.#canvasManager.size.height);
5341
5384
  });
5342
5385
  }
5386
+ updateBackgroundElement() {
5387
+ this.#resolveBackgroundElement();
5388
+ }
5343
5389
  #applyPostDrawUpdaters(particle) {
5344
5390
  for (const updater of this.#postDrawUpdaters) {
5345
5391
  updater.afterDraw?.(particle);
@@ -5538,7 +5584,14 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5538
5584
  }
5539
5585
  if (typeof background.element === "string") {
5540
5586
  if (typeof document !== "undefined") {
5541
- const node = document.querySelector(background.element);
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
+ }
5542
5595
  if (node && this.#isSupportedElement(node)) {
5543
5596
  this.#backgroundElement = node;
5544
5597
  }
@@ -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({ direction }).inside;
6418
+ return this.#getInsideCanvasResult(direction).inside;
6366
6419
  }
6367
6420
  isInsideCanvasForOutMode(outMode, direction) {
6368
- return this.#getInsideCanvasResult({ direction, outMode }).inside;
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(data) {
6528
- const defaultResult = this.#getDefaultInsideCanvasResult(data.direction, data.outMode), container = this.#container, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined, effectDrawer = this.effect ? container.effectDrawers.get(this.effect) : undefined, shapeCheck = shapeDrawer?.isInsideCanvas, effectCheck = effectDrawer?.isInsideCanvas;
6529
- if (!shapeCheck && !effectCheck) {
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(data.direction, data.outMode), shapeResult = shapeCheck ? this.#normalizeInsideCanvasResult(shapeCheck(callbackData), "shape") : undefined, effectResult = effectCheck ? this.#normalizeInsideCanvasResult(effectCheck(callbackData), "effect") : undefined;
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;
@@ -7254,8 +7311,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
7254
7311
  particleCreatedPlugins;
7255
7312
  particleDestroyedPlugins;
7256
7313
  particlePositionPlugins;
7257
- particleUpdaters;
7258
7314
  particles;
7315
+ particleUpdaters;
7259
7316
  peakNits;
7260
7317
  plugins;
7261
7318
  retina;
@@ -7549,6 +7606,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
7549
7606
  refresh = plugin.updateActualOptions() || refresh;
7550
7607
  }
7551
7608
  }
7609
+ this.canvas.render.updateBackgroundElement();
7552
7610
  return refresh;
7553
7611
  }
7554
7612
  #initPlugins(allContainerPlugins) {
@@ -8531,6 +8589,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
8531
8589
  if (this.options.spawn.stroke?.color) {
8532
8590
  this.spawnStrokeColor = rangeColorToHsl(this.#pluginManager, this.options.spawn.stroke.color);
8533
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);
8534
8596
  this.#paused = !this.options.autoPlay;
8535
8597
  this.#particlesOptions = particlesOptions;
8536
8598
  this.#size = this.#calcSize();