@tsparticles/all 3.0.0-beta.2 → 3.0.0-beta.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.
@@ -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.2
7
+ * v3.0.0-beta.3
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -206,6 +206,7 @@ __webpack_require__.d(__webpack_exports__, {
206
206
  rectBounce: () => (/* reexport */ rectBounce),
207
207
  resizeEvent: () => (/* reexport */ resizeEvent),
208
208
  rgbToHsl: () => (/* reexport */ rgbToHsl),
209
+ safeIntersectionObserver: () => (/* reexport */ safeIntersectionObserver),
209
210
  safeMatchMedia: () => (/* reexport */ safeMatchMedia),
210
211
  safeMutationObserver: () => (/* reexport */ safeMutationObserver),
211
212
  setLogger: () => (/* reexport */ setLogger),
@@ -572,6 +573,12 @@ function safeMatchMedia(query) {
572
573
  }
573
574
  return matchMedia(query);
574
575
  }
576
+ function safeIntersectionObserver(callback) {
577
+ if (isSsr() || typeof IntersectionObserver === "undefined") {
578
+ return;
579
+ }
580
+ return new IntersectionObserver(callback);
581
+ }
575
582
  function safeMutationObserver(callback) {
576
583
  if (isSsr() || typeof MutationObserver === "undefined") {
577
584
  return;
@@ -1231,7 +1238,15 @@ function drawParticle(data) {
1231
1238
  if (colorStyles.stroke) {
1232
1239
  context.strokeStyle = colorStyles.stroke;
1233
1240
  }
1234
- drawShape(container, context, particle, radius, opacity, delta);
1241
+ const drawData = {
1242
+ container,
1243
+ context,
1244
+ particle,
1245
+ radius,
1246
+ opacity,
1247
+ delta
1248
+ };
1249
+ drawShape(drawData);
1235
1250
  if (strokeWidth > 0) {
1236
1251
  context.stroke();
1237
1252
  }
@@ -1241,11 +1256,19 @@ function drawParticle(data) {
1241
1256
  if (particle.fill) {
1242
1257
  context.fill();
1243
1258
  }
1244
- drawShapeAfterEffect(container, context, particle, radius, opacity, delta);
1259
+ drawShapeAfterEffect(drawData);
1245
1260
  context.globalCompositeOperation = "source-over";
1246
1261
  context.setTransform(1, 0, 0, 1, 0, 0);
1247
1262
  }
1248
- function drawShape(container, context, particle, radius, opacity, delta) {
1263
+ function drawShape(data) {
1264
+ const {
1265
+ container,
1266
+ context,
1267
+ particle,
1268
+ radius,
1269
+ opacity,
1270
+ delta
1271
+ } = data;
1249
1272
  if (!particle.shape) {
1250
1273
  return;
1251
1274
  }
@@ -1253,9 +1276,24 @@ function drawShape(container, context, particle, radius, opacity, delta) {
1253
1276
  if (!drawer) {
1254
1277
  return;
1255
1278
  }
1256
- drawer.draw(context, particle, radius, opacity, delta, container.retina.pixelRatio);
1279
+ drawer.draw({
1280
+ context,
1281
+ particle,
1282
+ radius,
1283
+ opacity,
1284
+ delta,
1285
+ pixelRatio: container.retina.pixelRatio
1286
+ });
1257
1287
  }
1258
- function drawShapeAfterEffect(container, context, particle, radius, opacity, delta) {
1288
+ function drawShapeAfterEffect(data) {
1289
+ const {
1290
+ container,
1291
+ context,
1292
+ particle,
1293
+ radius,
1294
+ opacity,
1295
+ delta
1296
+ } = data;
1259
1297
  if (!particle.shape) {
1260
1298
  return;
1261
1299
  }
@@ -1263,7 +1301,14 @@ function drawShapeAfterEffect(container, context, particle, radius, opacity, del
1263
1301
  if (!drawer || !drawer.afterEffect) {
1264
1302
  return;
1265
1303
  }
1266
- drawer.afterEffect(context, particle, radius, opacity, delta, container.retina.pixelRatio);
1304
+ drawer.afterEffect({
1305
+ context,
1306
+ particle,
1307
+ radius,
1308
+ opacity,
1309
+ delta,
1310
+ pixelRatio: container.retina.pixelRatio
1311
+ });
1267
1312
  }
1268
1313
  function drawPlugin(context, plugin, delta) {
1269
1314
  if (!plugin.draw) {
@@ -3647,7 +3692,17 @@ class InteractionManager {
3647
3692
 
3648
3693
 
3649
3694
 
3650
- const fixOutMode = data => {
3695
+ function loadShapeData(shape, shapeOptions, id, reduceDuplicates) {
3696
+ const shapeData = shapeOptions.options[shape];
3697
+ if (!shapeData) {
3698
+ return;
3699
+ }
3700
+ return deepExtend({
3701
+ close: shapeOptions.close,
3702
+ fill: shapeOptions.fill
3703
+ }, itemFromSingleOrMultiple(shapeData, id, reduceDuplicates));
3704
+ }
3705
+ function fixOutMode(data) {
3651
3706
  if (!isInArray(data.outMode, data.checkModes)) {
3652
3707
  return;
3653
3708
  }
@@ -3657,7 +3712,7 @@ const fixOutMode = data => {
3657
3712
  } else if (data.coord < diameter) {
3658
3713
  data.setCb(data.radius);
3659
3714
  }
3660
- };
3715
+ }
3661
3716
  class Particle {
3662
3717
  constructor(engine, id, container, position, overrideOptions, group) {
3663
3718
  this.container = container;
@@ -3782,16 +3837,6 @@ class Particle {
3782
3837
  }
3783
3838
  this.offset = Vector.origin;
3784
3839
  };
3785
- this._loadShapeData = (shapeOptions, reduceDuplicates) => {
3786
- const shapeData = shapeOptions.options[this.shape];
3787
- if (!shapeData) {
3788
- return;
3789
- }
3790
- return deepExtend({
3791
- close: shapeOptions.close,
3792
- fill: shapeOptions.fill
3793
- }, itemFromSingleOrMultiple(shapeData, this.id, reduceDuplicates));
3794
- };
3795
3840
  this._engine = engine;
3796
3841
  this.init(id, position, overrideOptions, group);
3797
3842
  }
@@ -3880,7 +3925,7 @@ class Particle {
3880
3925
  shapeOptions.load(overrideOptions.shape);
3881
3926
  }
3882
3927
  }
3883
- this.shapeData = this._loadShapeData(shapeOptions, reduceDuplicates);
3928
+ this.shapeData = loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates);
3884
3929
  particlesOptions.load(overrideOptions);
3885
3930
  const shapeData = this.shapeData;
3886
3931
  if (shapeData) {
@@ -4476,7 +4521,6 @@ function loadContainerOptions(engine, container, ...sourceOptionsArr) {
4476
4521
  }
4477
4522
  class Container {
4478
4523
  constructor(engine, id, sourceOptions) {
4479
- this.id = id;
4480
4524
  this._intersectionManager = entries => {
4481
4525
  if (!guardCheck(this) || !this.actualOptions.pauseOnOutsideViewport) {
4482
4526
  return;
@@ -4515,6 +4559,7 @@ class Container {
4515
4559
  }
4516
4560
  };
4517
4561
  this._engine = engine;
4562
+ this.id = Symbol(id);
4518
4563
  this.fpsLimit = 120;
4519
4564
  this.smooth = false;
4520
4565
  this._delay = 0;
@@ -4544,9 +4589,7 @@ class Container {
4544
4589
  this._options = loadContainerOptions(this._engine, this);
4545
4590
  this.actualOptions = loadContainerOptions(this._engine, this);
4546
4591
  this._eventListeners = new EventListeners(this);
4547
- if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
4548
- this._intersectionObserver = new IntersectionObserver(entries => this._intersectionManager(entries));
4549
- }
4592
+ this._intersectionObserver = safeIntersectionObserver(entries => this._intersectionManager(entries));
4550
4593
  this._engine.dispatchEvent("containerBuilt", {
4551
4594
  container: this
4552
4595
  });
@@ -4989,17 +5032,17 @@ class Engine {
4989
5032
  return res;
4990
5033
  }
4991
5034
  get version() {
4992
- return "3.0.0-beta.2";
5035
+ return "3.0.0-beta.3";
4993
5036
  }
4994
- addConfig(nameOrConfig, config) {
4995
- if (isString(nameOrConfig)) {
4996
- if (config) {
4997
- config.name = nameOrConfig;
4998
- this._configs.set(nameOrConfig, config);
5037
+ addConfig(config) {
5038
+ const name = config.name ?? "default";
5039
+ this._configs.set(name, config);
5040
+ this._eventDispatcher.dispatchEvent("configAdded", {
5041
+ data: {
5042
+ name,
5043
+ config
4999
5044
  }
5000
- } else {
5001
- this._configs.set(nameOrConfig.name ?? "default", nameOrConfig);
5002
- }
5045
+ });
5003
5046
  }
5004
5047
  addEventListener(type, listener) {
5005
5048
  this._eventDispatcher.addEventListener(type, listener);
@@ -5028,44 +5071,11 @@ class Engine {
5028
5071
  (override || !this.getPreset(preset)) && this.presets.set(preset, options);
5029
5072
  await this.refresh(refresh);
5030
5073
  }
5031
- async addShape(shape, drawer, initOrRefresh, afterEffectOrRefresh, destroyOrRefresh, refresh = true) {
5032
- let customDrawer;
5033
- let realRefresh = refresh,
5034
- realInit,
5035
- realAfterEffect,
5036
- realDestroy;
5037
- if (isBoolean(initOrRefresh)) {
5038
- realRefresh = initOrRefresh;
5039
- realInit = undefined;
5040
- } else {
5041
- realInit = initOrRefresh;
5042
- }
5043
- if (isBoolean(afterEffectOrRefresh)) {
5044
- realRefresh = afterEffectOrRefresh;
5045
- realAfterEffect = undefined;
5046
- } else {
5047
- realAfterEffect = afterEffectOrRefresh;
5048
- }
5049
- if (isBoolean(destroyOrRefresh)) {
5050
- realRefresh = destroyOrRefresh;
5051
- realDestroy = undefined;
5052
- } else {
5053
- realDestroy = destroyOrRefresh;
5054
- }
5055
- if (isFunction(drawer)) {
5056
- customDrawer = {
5057
- afterEffect: realAfterEffect,
5058
- destroy: realDestroy,
5059
- draw: drawer,
5060
- init: realInit
5061
- };
5062
- } else {
5063
- customDrawer = drawer;
5064
- }
5074
+ async addShape(shape, drawer, refresh = true) {
5065
5075
  executeOnSingleOrMultiple(shape, type => {
5066
- !this.getShapeDrawer(type) && this.drawers.set(type, customDrawer);
5076
+ !this.getShapeDrawer(type) && this.drawers.set(type, drawer);
5067
5077
  });
5068
- await this.refresh(realRefresh);
5078
+ await this.refresh(refresh);
5069
5079
  }
5070
5080
  clearPlugins(container) {
5071
5081
  this.updaters.delete(container);
@@ -5143,7 +5153,7 @@ class Engine {
5143
5153
  }
5144
5154
  const currentOptions = itemFromSingleOrMultiple(options, index),
5145
5155
  dom = this.dom(),
5146
- oldIndex = dom.findIndex(v => v.id === id);
5156
+ oldIndex = dom.findIndex(v => v.id.description === id);
5147
5157
  if (oldIndex >= 0) {
5148
5158
  const old = this.domItem(oldIndex);
5149
5159
  if (old && !old.destroyed) {
@@ -5425,8 +5435,13 @@ if (!isSsr()) {
5425
5435
  ;// CONCATENATED MODULE: ../../shapes/arrow/dist/browser/ArrowDrawer.js
5426
5436
 
5427
5437
  class ArrowDrawer {
5428
- draw(context, particle, radius) {
5429
- const width = radius * 2,
5438
+ draw(data) {
5439
+ const {
5440
+ context,
5441
+ particle,
5442
+ radius
5443
+ } = data,
5444
+ width = radius * 2,
5430
5445
  heightFactor = particle.heightFactor ?? 0.5,
5431
5446
  headWidthFactor = particle.headWidthFactor ?? 0.2,
5432
5447
  bodyHeightFactor = particle.bodyHeightFactor ?? 0.5,
@@ -5457,14 +5472,22 @@ async function loadArrowShape(engine, refresh = true) {
5457
5472
  }
5458
5473
  ;// CONCATENATED MODULE: ../../shapes/bubble/dist/browser/BubbleDrawer.js
5459
5474
  class BubbleDrawer {
5460
- afterEffect(context, particle, radius) {
5475
+ afterEffect(data) {
5476
+ const {
5477
+ context,
5478
+ radius
5479
+ } = data;
5461
5480
  context.beginPath();
5462
5481
  context.arc(radius / 3, -radius / 3, radius / 3, 0, Math.PI * 2, false);
5463
5482
  context.closePath();
5464
5483
  context.fillStyle = "#fff9";
5465
5484
  context.fill();
5466
5485
  }
5467
- draw(context, particle, radius) {
5486
+ draw(data) {
5487
+ const {
5488
+ context,
5489
+ radius
5490
+ } = data;
5468
5491
  context.arc(0, 0, radius, 0, Math.PI * 2, false);
5469
5492
  }
5470
5493
  }
@@ -5874,18 +5897,22 @@ async function loadCanvasMaskPlugin(engine, refresh = true) {
5874
5897
  await engine.addPlugin(new CanvasMaskPlugin(engine), refresh);
5875
5898
  }
5876
5899
  ;// CONCATENATED MODULE: ../../shapes/cards/dist/browser/Utils.js
5877
- function drawPath(ctx, radius, path) {
5900
+ function drawPath(data, path) {
5878
5901
  if (!path.segments.length || !path.segments[0].values.length) {
5879
5902
  return;
5880
5903
  }
5881
- ctx.moveTo(path.segments[0].values[0].x * radius, path.segments[0].values[0].y * radius);
5904
+ const {
5905
+ context,
5906
+ radius
5907
+ } = data;
5908
+ context.moveTo(path.segments[0].values[0].x * radius, path.segments[0].values[0].y * radius);
5882
5909
  for (let i = 0; i < path.segments.length; i++) {
5883
5910
  const segment = path.segments[i];
5884
- ctx.bezierCurveTo(segment.values[1].x * radius, segment.values[1].y * radius, segment.values[2].x * radius, segment.values[2].y * radius, segment.values[3].x * radius, segment.values[3].y * radius);
5911
+ context.bezierCurveTo(segment.values[1].x * radius, segment.values[1].y * radius, segment.values[2].x * radius, segment.values[2].y * radius, segment.values[3].x * radius, segment.values[3].y * radius);
5885
5912
  }
5886
5913
  for (let i = path.segments.length - 1; i >= 0; i--) {
5887
5914
  const segment = path.segments[i];
5888
- ctx.bezierCurveTo(-segment.values[2].x * radius, segment.values[2].y * radius, -segment.values[1].x * radius, segment.values[1].y * radius, -segment.values[0].x * radius, segment.values[0].y * radius);
5915
+ context.bezierCurveTo(-segment.values[2].x * radius, segment.values[2].y * radius, -segment.values[1].x * radius, segment.values[1].y * radius, -segment.values[0].x * radius, segment.values[0].y * radius);
5889
5916
  }
5890
5917
  }
5891
5918
  const n = 1.0 / 2;
@@ -6130,23 +6157,23 @@ const paths = {
6130
6157
  ;// CONCATENATED MODULE: ../../shapes/cards/dist/browser/CardsSuitsDrawers.js
6131
6158
 
6132
6159
  class SpadeDrawer {
6133
- draw(context, _particle, radius) {
6134
- drawPath(context, radius, paths.spade);
6160
+ draw(data) {
6161
+ drawPath(data, paths.spade);
6135
6162
  }
6136
6163
  }
6137
6164
  class HeartDrawer {
6138
- draw(context, _particle, radius) {
6139
- drawPath(context, radius, paths.heart);
6165
+ draw(data) {
6166
+ drawPath(data, paths.heart);
6140
6167
  }
6141
6168
  }
6142
6169
  class DiamondDrawer {
6143
- draw(context, _particle, radius) {
6144
- drawPath(context, radius, paths.diamond);
6170
+ draw(data) {
6171
+ drawPath(data, paths.diamond);
6145
6172
  }
6146
6173
  }
6147
6174
  class ClubDrawer {
6148
- draw(context, _particle, radius) {
6149
- drawPath(context, radius, paths.club);
6175
+ draw(data) {
6176
+ drawPath(data, paths.club);
6150
6177
  }
6151
6178
  }
6152
6179
  ;// CONCATENATED MODULE: ../../shapes/cards/dist/browser/index.js
@@ -6160,21 +6187,31 @@ async function loadCardsShape(engine, refresh = true) {
6160
6187
  ;// CONCATENATED MODULE: ../../shapes/cog/dist/browser/CogDrawer.js
6161
6188
 
6162
6189
  class CogDrawer {
6163
- afterEffect(ctx, particle, radius) {
6190
+ afterEffect(data) {
6191
+ const {
6192
+ context,
6193
+ particle,
6194
+ radius
6195
+ } = data;
6164
6196
  if (particle.cogHoleRadius === undefined || particle.cogInnerRadius === undefined || particle.cogInnerTaper === undefined || particle.cogNotches === undefined || particle.cogOuterTaper === undefined) {
6165
6197
  return;
6166
6198
  }
6167
6199
  const pi2 = 2 * Math.PI,
6168
6200
  holeRadius = radius * particle.cogHoleRadius / 100;
6169
- ctx.globalCompositeOperation = "destination-out";
6170
- ctx.beginPath();
6171
- ctx.moveTo(holeRadius, 0);
6172
- ctx.arc(0, 0, holeRadius, 0, pi2);
6173
- ctx.closePath();
6174
- ctx.fill();
6175
- ctx.globalCompositeOperation = "source-over";
6176
- }
6177
- draw(ctx, particle, radius) {
6201
+ context.globalCompositeOperation = "destination-out";
6202
+ context.beginPath();
6203
+ context.moveTo(holeRadius, 0);
6204
+ context.arc(0, 0, holeRadius, 0, pi2);
6205
+ context.closePath();
6206
+ context.fill();
6207
+ context.globalCompositeOperation = "source-over";
6208
+ }
6209
+ draw(data) {
6210
+ const {
6211
+ context,
6212
+ particle,
6213
+ radius
6214
+ } = data;
6178
6215
  if (particle.cogHoleRadius === undefined || particle.cogInnerRadius === undefined || particle.cogInnerTaper === undefined || particle.cogNotches === undefined || particle.cogOuterTaper === undefined) {
6179
6216
  return;
6180
6217
  }
@@ -6185,14 +6222,14 @@ class CogDrawer {
6185
6222
  innerRadius = radius * particle.cogInnerRadius / 100;
6186
6223
  let a = angle,
6187
6224
  toggle = false;
6188
- ctx.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
6225
+ context.moveTo(radius * Math.cos(taperAO), radius * Math.sin(taperAO));
6189
6226
  for (; a <= pi2; a += angle) {
6190
6227
  if (toggle) {
6191
- ctx.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
6192
- ctx.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
6228
+ context.lineTo(innerRadius * Math.cos(a - taperAI), innerRadius * Math.sin(a - taperAI));
6229
+ context.lineTo(radius * Math.cos(a + taperAO), radius * Math.sin(a + taperAO));
6193
6230
  } else {
6194
- ctx.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
6195
- ctx.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
6231
+ context.lineTo(radius * Math.cos(a - taperAO), radius * Math.sin(a - taperAO));
6232
+ context.lineTo(innerRadius * Math.cos(a + taperAI), innerRadius * Math.sin(a + taperAI));
6196
6233
  }
6197
6234
  toggle = !toggle;
6198
6235
  }
@@ -8413,7 +8450,12 @@ async function loadBaseMover(engine, refresh = true) {
8413
8450
  ;// CONCATENATED MODULE: ../../shapes/circle/dist/browser/CircleDrawer.js
8414
8451
 
8415
8452
  class CircleDrawer {
8416
- draw(context, particle, radius) {
8453
+ draw(data) {
8454
+ const {
8455
+ context,
8456
+ particle,
8457
+ radius
8458
+ } = data;
8417
8459
  if (!particle.circleRange) {
8418
8460
  particle.circleRange = {
8419
8461
  min: 0,
@@ -11217,8 +11259,15 @@ class ImageDrawer {
11217
11259
  }
11218
11260
  this._engine.images.push(image);
11219
11261
  }
11220
- draw(context, particle, radius, opacity, delta) {
11221
- const image = particle.image,
11262
+ draw(data) {
11263
+ const {
11264
+ context,
11265
+ radius,
11266
+ particle,
11267
+ opacity,
11268
+ delta
11269
+ } = data,
11270
+ image = particle.image,
11222
11271
  element = image?.element;
11223
11272
  if (!image) {
11224
11273
  return;
@@ -11654,8 +11703,13 @@ async function loadLifeUpdater(engine, refresh = true) {
11654
11703
  }
11655
11704
  ;// CONCATENATED MODULE: ../../shapes/line/dist/browser/LineDrawer.js
11656
11705
  class LineDrawer {
11657
- draw(context, particle, radius) {
11658
- const shapeData = particle.shapeData;
11706
+ draw(data) {
11707
+ const {
11708
+ context,
11709
+ particle,
11710
+ radius
11711
+ } = data,
11712
+ shapeData = particle.shapeData;
11659
11713
  context.moveTo(-radius / 2, 0);
11660
11714
  context.lineTo(radius / 2, 0);
11661
11715
  context.lineCap = shapeData?.cap ?? "butt";
@@ -12471,8 +12525,13 @@ async function loadParticlesLinksInteraction(engine, refresh = true) {
12471
12525
  ;// CONCATENATED MODULE: ../../shapes/polygon/dist/browser/PolygonDrawerBase.js
12472
12526
 
12473
12527
  class PolygonDrawerBase {
12474
- draw(context, particle, radius) {
12475
- const start = this.getCenter(particle, radius),
12528
+ draw(data) {
12529
+ const {
12530
+ context,
12531
+ particle,
12532
+ radius
12533
+ } = data,
12534
+ start = this.getCenter(particle, radius),
12476
12535
  side = this.getSidesData(particle, radius),
12477
12536
  sideCount = side.count.numerator * side.count.denominator,
12478
12537
  decimalSides = side.count.numerator / side.count.denominator,
@@ -12706,8 +12765,12 @@ async function loadRotateUpdater(engine, refresh = true) {
12706
12765
  ;// CONCATENATED MODULE: ../../shapes/square/dist/browser/SquareDrawer.js
12707
12766
  const fixFactor = Math.sqrt(2);
12708
12767
  class SquareDrawer {
12709
- draw(context, particle, radius) {
12710
- const fixedRadius = radius / fixFactor,
12768
+ draw(data) {
12769
+ const {
12770
+ context,
12771
+ radius
12772
+ } = data,
12773
+ fixedRadius = radius / fixFactor,
12711
12774
  fixedDiameter = fixedRadius * 2;
12712
12775
  context.rect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter);
12713
12776
  }
@@ -12723,8 +12786,13 @@ async function loadSquareShape(engine, refresh = true) {
12723
12786
  ;// CONCATENATED MODULE: ../../shapes/star/dist/browser/StarDrawer.js
12724
12787
 
12725
12788
  class StarDrawer {
12726
- draw(context, particle, radius) {
12727
- const sides = particle.sides,
12789
+ draw(data) {
12790
+ const {
12791
+ context,
12792
+ particle,
12793
+ radius
12794
+ } = data,
12795
+ sides = particle.sides,
12728
12796
  inset = particle.starInset ?? 2;
12729
12797
  context.moveTo(0, 0 - radius);
12730
12798
  for (let i = 0; i < sides; i++) {
@@ -12862,8 +12930,14 @@ async function loadStrokeColorUpdater(engine, refresh = true) {
12862
12930
 
12863
12931
  const validTypes = ["text", "character", "char"];
12864
12932
  class TextDrawer {
12865
- draw(context, particle, radius, opacity) {
12866
- const character = particle.shapeData;
12933
+ draw(data) {
12934
+ const {
12935
+ context,
12936
+ particle,
12937
+ radius,
12938
+ opacity
12939
+ } = data,
12940
+ character = particle.shapeData;
12867
12941
  if (character === undefined) {
12868
12942
  return;
12869
12943
  }
@@ -13793,7 +13867,11 @@ async function loadGradientUpdater(engine, refresh = true) {
13793
13867
  }
13794
13868
  ;// CONCATENATED MODULE: ../../shapes/heart/dist/browser/HeartDrawer.js
13795
13869
  class HeartDrawer_HeartDrawer {
13796
- draw(context, _particle, radius) {
13870
+ draw(data) {
13871
+ const {
13872
+ context,
13873
+ radius
13874
+ } = data;
13797
13875
  const x = -radius,
13798
13876
  y = -radius;
13799
13877
  context.moveTo(x, y + radius / 2);
@@ -14643,8 +14721,14 @@ class MultilineTextDrawer {
14643
14721
  }
14644
14722
  };
14645
14723
  }
14646
- draw(context, particle, radius, opacity) {
14647
- const character = particle.shapeData;
14724
+ draw(data) {
14725
+ const {
14726
+ particle,
14727
+ context,
14728
+ radius,
14729
+ opacity
14730
+ } = data,
14731
+ character = particle.shapeData;
14648
14732
  if (character === undefined) {
14649
14733
  return;
14650
14734
  }
@@ -14992,7 +15076,12 @@ function Utils_drawPath(ctx, radius, path) {
14992
15076
 
14993
15077
 
14994
15078
  class PathDrawer {
14995
- draw(context, particle, radius) {
15079
+ draw(data) {
15080
+ const {
15081
+ context,
15082
+ particle,
15083
+ radius
15084
+ } = data;
14996
15085
  if (!particle.pathData) {
14997
15086
  return;
14998
15087
  }
@@ -17427,7 +17516,12 @@ function roundedPath(context, path, radius) {
17427
17516
  }
17428
17517
  }
17429
17518
  class RoundedPolygonDrawer {
17430
- draw(context, particle, radius) {
17519
+ draw(data) {
17520
+ const {
17521
+ context,
17522
+ particle,
17523
+ radius
17524
+ } = data;
17431
17525
  roundedPath(context, polygon(particle.sides, radius), particle.borderRadius ?? 5);
17432
17526
  }
17433
17527
  getSidesCount(particle) {
@@ -17472,8 +17566,13 @@ const RoundedRectDrawer_fixFactor = Math.sqrt(2),
17472
17566
  ctx.quadraticCurveTo(x, y, x + radius.topLeft, y);
17473
17567
  };
17474
17568
  class RoundedRectDrawer {
17475
- draw(context, particle, radius) {
17476
- const fixedRadius = radius / RoundedRectDrawer_fixFactor,
17569
+ draw(data) {
17570
+ const {
17571
+ context,
17572
+ particle,
17573
+ radius
17574
+ } = data,
17575
+ fixedRadius = radius / RoundedRectDrawer_fixFactor,
17477
17576
  fixedDiameter = fixedRadius * 2,
17478
17577
  borderRadius = particle.borderRadius ?? 5;
17479
17578
  if ("roundRect" in context) {
@@ -18582,7 +18681,12 @@ async function loadSoundsPlugin(engine, refresh = true) {
18582
18681
  ;// CONCATENATED MODULE: ../../shapes/spiral/dist/browser/SpiralDrawer.js
18583
18682
 
18584
18683
  class SpiralDrawer {
18585
- draw(context, particle, radius) {
18684
+ draw(data) {
18685
+ const {
18686
+ context,
18687
+ particle,
18688
+ radius
18689
+ } = data;
18586
18690
  if (particle.spiralInnerRadius === undefined || particle.spiralLineSpacing === undefined || particle.spiralWidthFactor === undefined) {
18587
18691
  return;
18588
18692
  }