@tsparticles/fireworks 3.0.0-beta.4 → 3.0.0

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
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -1227,7 +1227,8 @@ function drawParticle(data) {
1227
1227
  particle,
1228
1228
  radius,
1229
1229
  opacity,
1230
- delta
1230
+ delta,
1231
+ transformData
1231
1232
  };
1232
1233
  context.beginPath();
1233
1234
  drawShape(drawData);
@@ -1252,7 +1253,8 @@ function drawEffect(data) {
1252
1253
  particle,
1253
1254
  radius,
1254
1255
  opacity,
1255
- delta
1256
+ delta,
1257
+ transformData
1256
1258
  } = data;
1257
1259
  if (!particle.effect) {
1258
1260
  return;
@@ -1267,7 +1269,10 @@ function drawEffect(data) {
1267
1269
  radius,
1268
1270
  opacity,
1269
1271
  delta,
1270
- pixelRatio: container.retina.pixelRatio
1272
+ pixelRatio: container.retina.pixelRatio,
1273
+ transformData: {
1274
+ ...transformData
1275
+ }
1271
1276
  });
1272
1277
  }
1273
1278
  function drawShape(data) {
@@ -1277,7 +1282,8 @@ function drawShape(data) {
1277
1282
  particle,
1278
1283
  radius,
1279
1284
  opacity,
1280
- delta
1285
+ delta,
1286
+ transformData
1281
1287
  } = data;
1282
1288
  if (!particle.shape) {
1283
1289
  return;
@@ -1292,7 +1298,10 @@ function drawShape(data) {
1292
1298
  radius,
1293
1299
  opacity,
1294
1300
  delta,
1295
- pixelRatio: container.retina.pixelRatio
1301
+ pixelRatio: container.retina.pixelRatio,
1302
+ transformData: {
1303
+ ...transformData
1304
+ }
1296
1305
  });
1297
1306
  }
1298
1307
  function drawShapeAfterDraw(data) {
@@ -1302,7 +1311,8 @@ function drawShapeAfterDraw(data) {
1302
1311
  particle,
1303
1312
  radius,
1304
1313
  opacity,
1305
- delta
1314
+ delta,
1315
+ transformData
1306
1316
  } = data;
1307
1317
  if (!particle.shape) {
1308
1318
  return;
@@ -1317,7 +1327,10 @@ function drawShapeAfterDraw(data) {
1317
1327
  radius,
1318
1328
  opacity,
1319
1329
  delta,
1320
- pixelRatio: container.retina.pixelRatio
1330
+ pixelRatio: container.retina.pixelRatio,
1331
+ transformData: {
1332
+ ...transformData
1333
+ }
1321
1334
  });
1322
1335
  }
1323
1336
  function drawPlugin(context, plugin, delta) {
@@ -1554,7 +1567,7 @@ class Canvas {
1554
1567
  } else if (trailFill.image) {
1555
1568
  this._paintImage(trailFill.image, trailFill.opacity);
1556
1569
  }
1557
- } else {
1570
+ } else if (options.clear) {
1558
1571
  this.draw(ctx => {
1559
1572
  clear(ctx, this.size);
1560
1573
  });
@@ -2401,11 +2414,7 @@ class Events {
2401
2414
  });
2402
2415
  }
2403
2416
  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
- }
2417
+ this.resize.load(data.resize);
2409
2418
  }
2410
2419
  }
2411
2420
  ;// CONCATENATED MODULE: ../../engine/dist/browser/Options/Classes/Interactivity/Modes/Modes.js
@@ -3430,23 +3439,26 @@ class ParticlesOptions {
3430
3439
  if (!data) {
3431
3440
  return;
3432
3441
  }
3433
- this.bounce.load(data.bounce);
3434
- this.color.load(AnimatableColor.create(this.color, data.color));
3435
- this.effect.load(data.effect);
3436
3442
  if (data.groups !== undefined) {
3437
- for (const group in data.groups) {
3443
+ for (const group of Object.keys(data.groups)) {
3444
+ if (!Object.hasOwn(data.groups, group)) {
3445
+ continue;
3446
+ }
3438
3447
  const item = data.groups[group];
3439
3448
  if (item !== undefined) {
3440
3449
  this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
3441
3450
  }
3442
3451
  }
3443
3452
  }
3444
- this.move.load(data.move);
3445
- this.number.load(data.number);
3446
- this.opacity.load(data.opacity);
3447
3453
  if (data.reduceDuplicates !== undefined) {
3448
3454
  this.reduceDuplicates = data.reduceDuplicates;
3449
3455
  }
3456
+ this.bounce.load(data.bounce);
3457
+ this.color.load(AnimatableColor.create(this.color, data.color));
3458
+ this.effect.load(data.effect);
3459
+ this.move.load(data.move);
3460
+ this.number.load(data.number);
3461
+ this.opacity.load(data.opacity);
3450
3462
  this.shape.load(data.shape);
3451
3463
  this.size.load(data.size);
3452
3464
  this.shadow.load(data.shadow);
@@ -3519,6 +3531,7 @@ class Options {
3519
3531
  this.autoPlay = true;
3520
3532
  this.background = new Background();
3521
3533
  this.backgroundMask = new BackgroundMask();
3534
+ this.clear = true;
3522
3535
  this.defaultThemes = {};
3523
3536
  this.delay = 0;
3524
3537
  this.fullScreen = new FullScreen();
@@ -3546,6 +3559,12 @@ class Options {
3546
3559
  if (data.autoPlay !== undefined) {
3547
3560
  this.autoPlay = data.autoPlay;
3548
3561
  }
3562
+ if (data.clear !== undefined) {
3563
+ this.clear = data.clear;
3564
+ }
3565
+ if (data.name !== undefined) {
3566
+ this.name = data.name;
3567
+ }
3549
3568
  if (data.delay !== undefined) {
3550
3569
  this.delay = setRangeValue(data.delay);
3551
3570
  }
@@ -3871,7 +3890,9 @@ class Particle {
3871
3890
  this.bubble.inRange = false;
3872
3891
  this.slow.inRange = false;
3873
3892
  const container = this.container,
3874
- pathGenerator = this.pathGenerator;
3893
+ pathGenerator = this.pathGenerator,
3894
+ shapeDrawer = container.shapeDrawers.get(this.shape);
3895
+ shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
3875
3896
  for (const [, plugin] of container.plugins) {
3876
3897
  plugin.particleDestroyed && plugin.particleDestroyed(this, override);
3877
3898
  }
@@ -5125,7 +5146,7 @@ class Engine {
5125
5146
  return res;
5126
5147
  }
5127
5148
  get version() {
5128
- return "3.0.0-beta.4";
5149
+ return "3.0.0";
5129
5150
  }
5130
5151
  addConfig(config) {
5131
5152
  const name = config.name ?? "default";
@@ -6302,7 +6323,7 @@ class OutOutMode {
6302
6323
  }
6303
6324
  case "normal":
6304
6325
  {
6305
- const wrap = particle.options.move.warp,
6326
+ const warp = particle.options.move.warp,
6306
6327
  canvasSize = container.canvas.size,
6307
6328
  newPos = {
6308
6329
  bottom: canvasSize.height + particle.getRadius() + particle.offset.y,
@@ -6315,27 +6336,27 @@ class OutOutMode {
6315
6336
  if (direction === "right" && nextBounds.left > canvasSize.width + particle.offset.x) {
6316
6337
  particle.position.x = newPos.left;
6317
6338
  particle.initialPosition.x = particle.position.x;
6318
- if (!wrap) {
6339
+ if (!warp) {
6319
6340
  particle.position.y = getRandom() * canvasSize.height;
6320
6341
  particle.initialPosition.y = particle.position.y;
6321
6342
  }
6322
6343
  } else if (direction === "left" && nextBounds.right < -particle.offset.x) {
6323
6344
  particle.position.x = newPos.right;
6324
6345
  particle.initialPosition.x = particle.position.x;
6325
- if (!wrap) {
6346
+ if (!warp) {
6326
6347
  particle.position.y = getRandom() * canvasSize.height;
6327
6348
  particle.initialPosition.y = particle.position.y;
6328
6349
  }
6329
6350
  }
6330
6351
  if (direction === "bottom" && nextBounds.top > canvasSize.height + particle.offset.y) {
6331
- if (!wrap) {
6352
+ if (!warp) {
6332
6353
  particle.position.x = getRandom() * canvasSize.width;
6333
6354
  particle.initialPosition.x = particle.position.x;
6334
6355
  }
6335
6356
  particle.position.y = newPos.top;
6336
6357
  particle.initialPosition.y = particle.position.y;
6337
6358
  } else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
6338
- if (!wrap) {
6359
+ if (!warp) {
6339
6360
  particle.position.x = getRandom() * canvasSize.width;
6340
6361
  particle.initialPosition.x = particle.position.x;
6341
6362
  }