@tsparticles/confetti 3.0.0-beta.4 → 3.0.0-beta.5

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.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.0-beta.4
7
+ * v3.0.0-beta.5
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -2401,11 +2401,7 @@ class Events {
2401
2401
  });
2402
2402
  }
2403
2403
  this.onHover.load(data.onHover);
2404
- if (isBoolean(data.resize)) {
2405
- this.resize.enable = data.resize;
2406
- } else {
2407
- this.resize.load(data.resize);
2408
- }
2404
+ this.resize.load(data.resize);
2409
2405
  }
2410
2406
  }
2411
2407
  ;// CONCATENATED MODULE: ../../engine/dist/browser/Options/Classes/Interactivity/Modes/Modes.js
@@ -3430,23 +3426,26 @@ class ParticlesOptions {
3430
3426
  if (!data) {
3431
3427
  return;
3432
3428
  }
3433
- this.bounce.load(data.bounce);
3434
- this.color.load(AnimatableColor.create(this.color, data.color));
3435
- this.effect.load(data.effect);
3436
3429
  if (data.groups !== undefined) {
3437
- for (const group in data.groups) {
3430
+ for (const group of Object.keys(data.groups)) {
3431
+ if (!Object.hasOwn(data.groups, group)) {
3432
+ continue;
3433
+ }
3438
3434
  const item = data.groups[group];
3439
3435
  if (item !== undefined) {
3440
3436
  this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
3441
3437
  }
3442
3438
  }
3443
3439
  }
3444
- this.move.load(data.move);
3445
- this.number.load(data.number);
3446
- this.opacity.load(data.opacity);
3447
3440
  if (data.reduceDuplicates !== undefined) {
3448
3441
  this.reduceDuplicates = data.reduceDuplicates;
3449
3442
  }
3443
+ this.bounce.load(data.bounce);
3444
+ this.color.load(AnimatableColor.create(this.color, data.color));
3445
+ this.effect.load(data.effect);
3446
+ this.move.load(data.move);
3447
+ this.number.load(data.number);
3448
+ this.opacity.load(data.opacity);
3450
3449
  this.shape.load(data.shape);
3451
3450
  this.size.load(data.size);
3452
3451
  this.shadow.load(data.shadow);
@@ -3871,7 +3870,9 @@ class Particle {
3871
3870
  this.bubble.inRange = false;
3872
3871
  this.slow.inRange = false;
3873
3872
  const container = this.container,
3874
- pathGenerator = this.pathGenerator;
3873
+ pathGenerator = this.pathGenerator,
3874
+ shapeDrawer = container.shapeDrawers.get(this.shape);
3875
+ shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
3875
3876
  for (const [, plugin] of container.plugins) {
3876
3877
  plugin.particleDestroyed && plugin.particleDestroyed(this, override);
3877
3878
  }
@@ -5125,7 +5126,7 @@ class Engine {
5125
5126
  return res;
5126
5127
  }
5127
5128
  get version() {
5128
- return "3.0.0-beta.4";
5129
+ return "3.0.0-beta.5";
5129
5130
  }
5130
5131
  addConfig(config) {
5131
5132
  const name = config.name ?? "default";
@@ -7544,20 +7545,23 @@ async function loadEmittersPlugin(engine, refresh = true) {
7544
7545
  class HeartDrawer_HeartDrawer {
7545
7546
  draw(data) {
7546
7547
  const {
7547
- context,
7548
- radius
7549
- } = data;
7550
- const x = -radius,
7548
+ context,
7549
+ radius
7550
+ } = data,
7551
+ diameter = radius * 2,
7552
+ halfRadius = radius * 0.5,
7553
+ radiusAndHalf = radius + halfRadius,
7554
+ x = -radius,
7551
7555
  y = -radius;
7552
7556
  context.moveTo(x, y + radius / 2);
7553
- context.quadraticCurveTo(x, y, x + radius / 2, y);
7554
- context.quadraticCurveTo(x + radius, y, x + radius, y + radius / 2);
7555
- context.quadraticCurveTo(x + radius, y, x + radius * 3 / 2, y);
7556
- context.quadraticCurveTo(x + radius * 2, y, x + radius * 2, y + radius / 2);
7557
- context.quadraticCurveTo(x + radius * 2, y + radius, x + radius * 3 / 2, y + radius * 3 / 2);
7558
- context.lineTo(x + radius, y + radius * 2);
7559
- context.lineTo(x + radius / 2, y + radius * 3 / 2);
7560
- context.quadraticCurveTo(x, y + radius, x, y + radius / 2);
7557
+ context.quadraticCurveTo(x, y, x + halfRadius, y);
7558
+ context.quadraticCurveTo(x + radius, y, x + radius, y + halfRadius);
7559
+ context.quadraticCurveTo(x + radius, y, x + radiusAndHalf, y);
7560
+ context.quadraticCurveTo(x + diameter, y, x + diameter, y + halfRadius);
7561
+ context.quadraticCurveTo(x + diameter, y + radius, x + radiusAndHalf, y + radiusAndHalf);
7562
+ context.lineTo(x + radius, y + diameter);
7563
+ context.lineTo(x + halfRadius, y + radiusAndHalf);
7564
+ context.quadraticCurveTo(x, y + radius, x, y + halfRadius);
7561
7565
  }
7562
7566
  }
7563
7567
  ;// CONCATENATED MODULE: ../../shapes/heart/dist/browser/index.js
@@ -8207,8 +8211,9 @@ class ImageDrawer {
8207
8211
  pos = {
8208
8212
  x: -radius,
8209
8213
  y: -radius
8210
- };
8211
- context.drawImage(element, pos.x, pos.y, radius * 2, radius * 2 / ratio);
8214
+ },
8215
+ diameter = radius * 2;
8216
+ context.drawImage(element, pos.x, pos.y, diameter, diameter / ratio);
8212
8217
  }
8213
8218
  context.globalAlpha = 1;
8214
8219
  }
@@ -9115,11 +9120,12 @@ class TextDrawer {
9115
9120
  pos = {
9116
9121
  x: -offsetX,
9117
9122
  y: radius / 2
9118
- };
9123
+ },
9124
+ diameter = radius * 2;
9119
9125
  if (fill) {
9120
- context.fillText(line, pos.x, pos.y + radius * 2 * index);
9126
+ context.fillText(line, pos.x, pos.y + diameter * index);
9121
9127
  } else {
9122
- context.strokeText(line, pos.x, pos.y + radius * 2 * index);
9128
+ context.strokeText(line, pos.x, pos.y + diameter * index);
9123
9129
  }
9124
9130
  };
9125
9131
  }