@tsparticles/preset-hyperspace 4.0.1 → 4.0.3

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,5 +1,5 @@
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);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Preset v4.0.1 */
2
+ /* Preset v4.0.3 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5
5
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1012,7 +1012,7 @@
1012
1012
  return this._domArray;
1013
1013
  }
1014
1014
  get version() {
1015
- return "4.0.1";
1015
+ return "4.0.3";
1016
1016
  }
1017
1017
  addEventListener(type, listener) {
1018
1018
  this._eventDispatcher.addEventListener(type, listener);
@@ -2839,6 +2839,58 @@
2839
2839
 
2840
2840
  const tsParticles = initEngine();
2841
2841
 
2842
+ class Blend {
2843
+ enable;
2844
+ mode;
2845
+ constructor() {
2846
+ this.mode = "destination-out";
2847
+ this.enable = false;
2848
+ }
2849
+ load(data) {
2850
+ if (isNull(data)) {
2851
+ return;
2852
+ }
2853
+ if (data.mode !== undefined) {
2854
+ this.mode = data.mode;
2855
+ }
2856
+ if (data.enable !== undefined) {
2857
+ this.enable = data.enable;
2858
+ }
2859
+ }
2860
+ }
2861
+
2862
+ class BlendPlugin {
2863
+ id = "blend";
2864
+ async getPlugin(container) {
2865
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
2866
+ return new BlendPluginInstance(container);
2867
+ }
2868
+ loadOptions(_container, options, source) {
2869
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
2870
+ return;
2871
+ }
2872
+ let blendOptions = options.blend;
2873
+ if (!blendOptions?.load) {
2874
+ options.blend = blendOptions = new Blend();
2875
+ }
2876
+ blendOptions.load(source?.blend);
2877
+ }
2878
+ loadParticlesOptions(_container, options, source) {
2879
+ options.blend ??= new Blend();
2880
+ options.blend.load(source?.blend);
2881
+ }
2882
+ needsPlugin(options) {
2883
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
2884
+ }
2885
+ }
2886
+
2887
+ async function loadBlendPlugin(engine) {
2888
+ engine.checkVersion("4.0.3");
2889
+ await engine.pluginManager.register(e => {
2890
+ e.pluginManager.addPlugin(new BlendPlugin());
2891
+ });
2892
+ }
2893
+
2842
2894
  const minAngle$1 = 0;
2843
2895
  function drawCircle(data) {
2844
2896
  const { context, particle, radius } = data;
@@ -2870,7 +2922,7 @@
2870
2922
  }
2871
2923
 
2872
2924
  async function loadCircleShape(engine) {
2873
- engine.checkVersion("4.0.1");
2925
+ engine.checkVersion("4.0.3");
2874
2926
  await engine.pluginManager.register(e => {
2875
2927
  e.pluginManager.addShape(["circle"], () => {
2876
2928
  return Promise.resolve(new CircleDrawer());
@@ -2918,7 +2970,7 @@
2918
2970
  }
2919
2971
 
2920
2972
  async function loadHexColorPlugin(engine) {
2921
- engine.checkVersion("4.0.1");
2973
+ engine.checkVersion("4.0.3");
2922
2974
  await engine.pluginManager.register(e => {
2923
2975
  e.pluginManager.addColorManager("hex", new HexColorManager());
2924
2976
  });
@@ -2971,7 +3023,7 @@
2971
3023
  }
2972
3024
 
2973
3025
  async function loadHslColorPlugin(engine) {
2974
- engine.checkVersion("4.0.1");
3026
+ engine.checkVersion("4.0.3");
2975
3027
  await engine.pluginManager.register(e => {
2976
3028
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2977
3029
  });
@@ -2995,7 +3047,7 @@
2995
3047
  }
2996
3048
 
2997
3049
  async function loadMovePlugin(engine) {
2998
- engine.checkVersion("4.0.1");
3050
+ engine.checkVersion("4.0.3");
2999
3051
  await engine.pluginManager.register(e => {
3000
3052
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3001
3053
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3056,7 +3108,7 @@
3056
3108
  }
3057
3109
 
3058
3110
  async function loadOpacityUpdater(engine) {
3059
- engine.checkVersion("4.0.1");
3111
+ engine.checkVersion("4.0.3");
3060
3112
  await engine.pluginManager.register(e => {
3061
3113
  e.pluginManager.addParticleUpdater("opacity", container => {
3062
3114
  return Promise.resolve(new OpacityUpdater(container));
@@ -3408,7 +3460,7 @@
3408
3460
  }
3409
3461
 
3410
3462
  async function loadOutModesUpdater(engine) {
3411
- engine.checkVersion("4.0.1");
3463
+ engine.checkVersion("4.0.3");
3412
3464
  await engine.pluginManager.register(e => {
3413
3465
  e.pluginManager.addParticleUpdater("outModes", container => {
3414
3466
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3479,7 +3531,7 @@
3479
3531
  }
3480
3532
 
3481
3533
  async function loadPaintUpdater(engine) {
3482
- engine.checkVersion("4.0.1");
3534
+ engine.checkVersion("4.0.3");
3483
3535
  await engine.pluginManager.register(e => {
3484
3536
  e.pluginManager.addParticleUpdater("paint", container => {
3485
3537
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3534,7 +3586,7 @@
3534
3586
  }
3535
3587
 
3536
3588
  async function loadRgbColorPlugin(engine) {
3537
- engine.checkVersion("4.0.1");
3589
+ engine.checkVersion("4.0.3");
3538
3590
  await engine.pluginManager.register(e => {
3539
3591
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3540
3592
  });
@@ -3577,7 +3629,7 @@
3577
3629
  }
3578
3630
 
3579
3631
  async function loadSizeUpdater(engine) {
3580
- engine.checkVersion("4.0.1");
3632
+ engine.checkVersion("4.0.3");
3581
3633
  await engine.pluginManager.register(e => {
3582
3634
  e.pluginManager.addParticleUpdater("size", container => {
3583
3635
  return Promise.resolve(new SizeUpdater(container));
@@ -3586,9 +3638,10 @@
3586
3638
  }
3587
3639
 
3588
3640
  async function loadBasic(engine) {
3589
- engine.checkVersion("4.0.1");
3641
+ engine.checkVersion("4.0.3");
3590
3642
  await engine.pluginManager.register(async (e) => {
3591
3643
  await Promise.all([
3644
+ loadBlendPlugin(e),
3592
3645
  loadHexColorPlugin(e),
3593
3646
  loadHslColorPlugin(e),
3594
3647
  loadRgbColorPlugin(e),
@@ -3887,7 +3940,7 @@
3887
3940
  })(EmitterClickMode || (EmitterClickMode = {}));
3888
3941
 
3889
3942
  async function loadEmittersPluginSimple(engine) {
3890
- engine.checkVersion("4.0.1");
3943
+ engine.checkVersion("4.0.3");
3891
3944
  await engine.pluginManager.register(async (e) => {
3892
3945
  const instancesManager = await getEmittersInstancesManager(e);
3893
3946
  await addEmittersShapesManager(e);
@@ -3975,7 +4028,7 @@
3975
4028
  }
3976
4029
 
3977
4030
  async function loadEmittersShapeSquare(engine) {
3978
- engine.checkVersion("4.0.1");
4031
+ engine.checkVersion("4.0.3");
3979
4032
  await engine.pluginManager.register((e) => {
3980
4033
  ensureEmittersPluginLoaded(e);
3981
4034
  e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
@@ -4141,7 +4194,7 @@
4141
4194
  }
4142
4195
 
4143
4196
  async function loadLifeUpdater(engine) {
4144
- engine.checkVersion("4.0.1");
4197
+ engine.checkVersion("4.0.3");
4145
4198
  await engine.pluginManager.register(e => {
4146
4199
  e.pluginManager.addParticleUpdater("life", container => {
4147
4200
  return Promise.resolve(new LifeUpdater(container));
@@ -4216,7 +4269,7 @@
4216
4269
  }
4217
4270
 
4218
4271
  async function loadTrailPlugin(engine) {
4219
- engine.checkVersion("4.0.1");
4272
+ engine.checkVersion("4.0.3");
4220
4273
  await engine.pluginManager.register(e => {
4221
4274
  e.pluginManager.addPlugin(new TrailPlugin(e.pluginManager));
4222
4275
  });
@@ -6370,6 +6423,44 @@
6370
6423
  Container: Container
6371
6424
  });
6372
6425
 
6426
+ class BlendPluginInstance {
6427
+ _container;
6428
+ _defaultCompositeValue;
6429
+ constructor(container) {
6430
+ this._container = container;
6431
+ }
6432
+ drawParticleCleanup(context, particle) {
6433
+ if (!particle.options.blend?.enable) {
6434
+ return;
6435
+ }
6436
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
6437
+ particle.originalBlendMode = undefined;
6438
+ }
6439
+ drawParticleSetup(context, particle) {
6440
+ if (!particle.options.blend?.enable) {
6441
+ return;
6442
+ }
6443
+ particle.originalBlendMode = context.globalCompositeOperation;
6444
+ context.globalCompositeOperation = particle.options.blend.mode;
6445
+ }
6446
+ drawSettingsCleanup(context) {
6447
+ if (!this._defaultCompositeValue) {
6448
+ return;
6449
+ }
6450
+ context.globalCompositeOperation = this._defaultCompositeValue;
6451
+ }
6452
+ drawSettingsSetup(context) {
6453
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
6454
+ this._defaultCompositeValue = previousComposite;
6455
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
6456
+ }
6457
+ }
6458
+
6459
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
6460
+ __proto__: null,
6461
+ BlendPluginInstance: BlendPluginInstance
6462
+ });
6463
+
6373
6464
  const minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
6374
6465
  function applyDistance(particle) {
6375
6466
  const initialPosition = particle.initialPosition, { dx, dy } = getDistances(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;