@tsparticles/all 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";
@@ -5536,6 +5537,377 @@ if (!isSsr()) {
5536
5537
 
5537
5538
 
5538
5539
 
5540
+ ;// CONCATENATED MODULE: ../pjs/dist/browser/marcbruederlin/Particles.js
5541
+
5542
+ class Particles_Particles {
5543
+ static init(options) {
5544
+ const particles = new Particles_Particles(),
5545
+ selector = options.selector;
5546
+ if (!selector) {
5547
+ throw new Error("No selector provided");
5548
+ }
5549
+ const el = document.querySelector(selector);
5550
+ if (!el) {
5551
+ throw new Error("No element found for selector");
5552
+ }
5553
+ tsParticles.load({
5554
+ id: selector.replace(".", "").replace("!", ""),
5555
+ element: el,
5556
+ options: {
5557
+ fullScreen: {
5558
+ enable: false
5559
+ },
5560
+ particles: {
5561
+ color: {
5562
+ value: options.color ?? "!000000"
5563
+ },
5564
+ links: {
5565
+ color: "random",
5566
+ distance: options.minDistance ?? 120,
5567
+ enable: options.connectParticles ?? false
5568
+ },
5569
+ move: {
5570
+ enable: true,
5571
+ speed: options.speed ?? 0.5
5572
+ },
5573
+ number: {
5574
+ value: options.maxParticles ?? 100
5575
+ },
5576
+ size: {
5577
+ value: {
5578
+ min: 1,
5579
+ max: options.sizeVariations ?? 3
5580
+ }
5581
+ }
5582
+ },
5583
+ responsive: options.responsive?.map(responsive => ({
5584
+ maxWidth: responsive.breakpoint,
5585
+ options: {
5586
+ particles: {
5587
+ color: {
5588
+ value: responsive.options?.color
5589
+ },
5590
+ links: {
5591
+ distance: responsive.options?.minDistance,
5592
+ enable: responsive.options?.connectParticles
5593
+ },
5594
+ number: {
5595
+ value: options.maxParticles
5596
+ },
5597
+ move: {
5598
+ enable: true,
5599
+ speed: responsive.options?.speed
5600
+ },
5601
+ size: {
5602
+ value: responsive.options?.sizeVariations
5603
+ }
5604
+ }
5605
+ }
5606
+ }))
5607
+ }
5608
+ }).then(container => {
5609
+ particles._container = container;
5610
+ });
5611
+ return particles;
5612
+ }
5613
+ destroy() {
5614
+ const container = this._container;
5615
+ container && container.destroy();
5616
+ }
5617
+ pauseAnimation() {
5618
+ const container = this._container;
5619
+ container && container.pause();
5620
+ }
5621
+ resumeAnimation() {
5622
+ const container = this._container;
5623
+ container && container.play();
5624
+ }
5625
+ }
5626
+ ;// CONCATENATED MODULE: ../pjs/dist/browser/VincentGarreau/particles.js
5627
+
5628
+ const defaultPjsOptions = {
5629
+ particles: {
5630
+ number: {
5631
+ value: 400,
5632
+ density: {
5633
+ enable: true,
5634
+ value_area: 800
5635
+ }
5636
+ },
5637
+ color: {
5638
+ value: "#fff"
5639
+ },
5640
+ shape: {
5641
+ type: "circle",
5642
+ stroke: {
5643
+ width: 0,
5644
+ color: "#ff0000"
5645
+ },
5646
+ polygon: {
5647
+ nb_sides: 5
5648
+ },
5649
+ image: {
5650
+ src: "",
5651
+ width: 100,
5652
+ height: 100
5653
+ }
5654
+ },
5655
+ opacity: {
5656
+ value: 1,
5657
+ random: false,
5658
+ anim: {
5659
+ enable: false,
5660
+ speed: 2,
5661
+ opacity_min: 0,
5662
+ sync: false
5663
+ }
5664
+ },
5665
+ size: {
5666
+ value: 20,
5667
+ random: false,
5668
+ anim: {
5669
+ enable: false,
5670
+ speed: 20,
5671
+ size_min: 0,
5672
+ sync: false
5673
+ }
5674
+ },
5675
+ line_linked: {
5676
+ enable: true,
5677
+ distance: 100,
5678
+ color: "#fff",
5679
+ opacity: 1,
5680
+ width: 1
5681
+ },
5682
+ move: {
5683
+ enable: true,
5684
+ speed: 2,
5685
+ direction: "none",
5686
+ random: false,
5687
+ straight: false,
5688
+ out_mode: "out",
5689
+ bounce: false,
5690
+ attract: {
5691
+ enable: false,
5692
+ rotateX: 3000,
5693
+ rotateY: 3000
5694
+ }
5695
+ }
5696
+ },
5697
+ interactivity: {
5698
+ detect_on: "canvas",
5699
+ events: {
5700
+ onhover: {
5701
+ enable: true,
5702
+ mode: "grab"
5703
+ },
5704
+ onclick: {
5705
+ enable: true,
5706
+ mode: "push"
5707
+ },
5708
+ resize: true
5709
+ },
5710
+ modes: {
5711
+ grab: {
5712
+ distance: 100,
5713
+ line_linked: {
5714
+ opacity: 1
5715
+ }
5716
+ },
5717
+ bubble: {
5718
+ distance: 200,
5719
+ size: 80,
5720
+ duration: 0.4,
5721
+ opacity: 1,
5722
+ speed: 3
5723
+ },
5724
+ repulse: {
5725
+ distance: 200,
5726
+ duration: 0.4
5727
+ },
5728
+ push: {
5729
+ particles_nb: 4
5730
+ },
5731
+ remove: {
5732
+ particles_nb: 2
5733
+ }
5734
+ }
5735
+ },
5736
+ retina_detect: false
5737
+ };
5738
+ const initParticlesJS = engine => {
5739
+ const particlesJS = (tagId, options) => {
5740
+ const fixedOptions = deepExtend(defaultPjsOptions, options);
5741
+ return engine.load({
5742
+ id: tagId,
5743
+ options: {
5744
+ fullScreen: {
5745
+ enable: false
5746
+ },
5747
+ detectRetina: fixedOptions.retina_detect,
5748
+ smooth: true,
5749
+ interactivity: {
5750
+ detectsOn: fixedOptions.interactivity.detect_on,
5751
+ events: {
5752
+ onHover: {
5753
+ enable: fixedOptions.interactivity.events.onhover.enable,
5754
+ mode: fixedOptions.interactivity.events.onhover.mode
5755
+ },
5756
+ onClick: {
5757
+ enable: fixedOptions.interactivity.events.onclick.enable,
5758
+ mode: fixedOptions.interactivity.events.onclick.mode
5759
+ },
5760
+ resize: {
5761
+ enable: fixedOptions.interactivity.events.resize
5762
+ }
5763
+ },
5764
+ modes: {
5765
+ grab: {
5766
+ distance: fixedOptions.interactivity.modes.grab.distance,
5767
+ links: {
5768
+ opacity: fixedOptions.interactivity.modes.grab.line_linked.opacity
5769
+ }
5770
+ },
5771
+ bubble: {
5772
+ distance: fixedOptions.interactivity.modes.bubble.distance,
5773
+ size: fixedOptions.interactivity.modes.bubble.size,
5774
+ duration: fixedOptions.interactivity.modes.bubble.duration,
5775
+ opacity: fixedOptions.interactivity.modes.bubble.opacity,
5776
+ speed: fixedOptions.interactivity.modes.bubble.speed
5777
+ },
5778
+ repulse: {
5779
+ distance: fixedOptions.interactivity.modes.repulse.distance,
5780
+ duration: fixedOptions.interactivity.modes.repulse.duration
5781
+ },
5782
+ push: {
5783
+ quantity: fixedOptions.interactivity.modes.push.particles_nb
5784
+ },
5785
+ remove: {
5786
+ quantity: fixedOptions.interactivity.modes.remove.particles_nb
5787
+ }
5788
+ }
5789
+ },
5790
+ particles: {
5791
+ collisions: {
5792
+ enable: fixedOptions.particles.move.bounce
5793
+ },
5794
+ number: {
5795
+ value: fixedOptions.particles.number.value,
5796
+ density: {
5797
+ enable: fixedOptions.particles.number.density.enable,
5798
+ width: fixedOptions.particles.number.density.value_area
5799
+ }
5800
+ },
5801
+ color: {
5802
+ value: fixedOptions.particles.color.value
5803
+ },
5804
+ stroke: {
5805
+ width: fixedOptions.particles.shape.stroke.width,
5806
+ color: {
5807
+ value: fixedOptions.particles.shape.stroke.color
5808
+ }
5809
+ },
5810
+ shape: {
5811
+ type: fixedOptions.particles.shape.type,
5812
+ options: {
5813
+ polygon: {
5814
+ sides: fixedOptions.particles.shape.polygon.nb_sides
5815
+ },
5816
+ image: {
5817
+ src: fixedOptions.particles.shape.image.src,
5818
+ width: fixedOptions.particles.shape.image.width,
5819
+ height: fixedOptions.particles.shape.image.height
5820
+ }
5821
+ }
5822
+ },
5823
+ opacity: {
5824
+ value: fixedOptions.particles.opacity.random ? {
5825
+ min: fixedOptions.particles.opacity.anim.enable ? fixedOptions.particles.opacity.anim.opacity_min : 0,
5826
+ max: fixedOptions.particles.opacity.value
5827
+ } : fixedOptions.particles.opacity.value,
5828
+ animation: {
5829
+ enable: fixedOptions.particles.opacity.anim.enable,
5830
+ speed: fixedOptions.particles.opacity.anim.speed,
5831
+ sync: fixedOptions.particles.opacity.anim.sync
5832
+ }
5833
+ },
5834
+ size: {
5835
+ value: fixedOptions.particles.size.random ? {
5836
+ min: fixedOptions.particles.size.anim.enable ? fixedOptions.particles.size.anim.size_min : 0,
5837
+ max: fixedOptions.particles.size.value
5838
+ } : fixedOptions.particles.size.value,
5839
+ animation: {
5840
+ enable: fixedOptions.particles.size.anim.enable,
5841
+ speed: fixedOptions.particles.size.anim.speed,
5842
+ sync: fixedOptions.particles.size.anim.sync
5843
+ }
5844
+ },
5845
+ links: {
5846
+ enable: fixedOptions.particles.line_linked.enable,
5847
+ distance: fixedOptions.particles.line_linked.distance,
5848
+ color: fixedOptions.particles.line_linked.color,
5849
+ opacity: fixedOptions.particles.line_linked.opacity,
5850
+ width: fixedOptions.particles.line_linked.width
5851
+ },
5852
+ move: {
5853
+ enable: fixedOptions.particles.move.enable,
5854
+ speed: fixedOptions.particles.move.speed / 3,
5855
+ direction: fixedOptions.particles.move.direction,
5856
+ random: fixedOptions.particles.move.random,
5857
+ straight: fixedOptions.particles.move.straight,
5858
+ outModes: fixedOptions.particles.move.out_mode,
5859
+ attract: {
5860
+ enable: fixedOptions.particles.move.attract.enable,
5861
+ rotate: {
5862
+ x: fixedOptions.particles.move.attract.rotateX,
5863
+ y: fixedOptions.particles.move.attract.rotateY
5864
+ }
5865
+ }
5866
+ }
5867
+ }
5868
+ }
5869
+ });
5870
+ };
5871
+ particlesJS.load = (tagId, pathConfigJson, callback) => {
5872
+ engine.load({
5873
+ id: tagId,
5874
+ url: pathConfigJson
5875
+ }).then(container => {
5876
+ if (container) {
5877
+ callback(container);
5878
+ }
5879
+ }).catch(() => {
5880
+ callback(undefined);
5881
+ });
5882
+ };
5883
+ particlesJS.setOnClickHandler = callback => {
5884
+ engine.setOnClickHandler(callback);
5885
+ };
5886
+ const pJSDom = engine.dom();
5887
+ return {
5888
+ particlesJS,
5889
+ pJSDom
5890
+ };
5891
+ };
5892
+
5893
+ ;// CONCATENATED MODULE: ../pjs/dist/browser/index.js
5894
+
5895
+
5896
+ const initPjs = engine => {
5897
+ const {
5898
+ particlesJS,
5899
+ pJSDom
5900
+ } = initParticlesJS(engine);
5901
+ window.particlesJS = particlesJS;
5902
+ window.pJSDom = pJSDom;
5903
+ window.Particles = Particles_Particles;
5904
+ return {
5905
+ particlesJS,
5906
+ pJSDom,
5907
+ Particles: Particles_Particles
5908
+ };
5909
+ };
5910
+
5539
5911
  ;// CONCATENATED MODULE: ../../shapes/arrow/dist/browser/ArrowDrawer.js
5540
5912
 
5541
5913
  class ArrowDrawer {
@@ -9446,172 +9818,38 @@ class RollUpdater {
9446
9818
  const roll = particle.roll?.enable && particle.roll,
9447
9819
  rollHorizontal = roll && roll.horizontal,
9448
9820
  rollVertical = roll && roll.vertical;
9449
- return {
9450
- a: rollHorizontal ? Math.cos(roll.angle) : undefined,
9451
- d: rollVertical ? Math.sin(roll.angle) : undefined
9452
- };
9453
- }
9454
- init(particle) {
9455
- initParticle(particle);
9456
- }
9457
- isEnabled(particle) {
9458
- const roll = particle.options.roll;
9459
- return !particle.destroyed && !particle.spawning && !!roll?.enable;
9460
- }
9461
- loadOptions(options, ...sources) {
9462
- if (!options.roll) {
9463
- options.roll = new Roll();
9464
- }
9465
- for (const source of sources) {
9466
- options.roll.load(source?.roll);
9467
- }
9468
- }
9469
- update(particle, delta) {
9470
- if (!this.isEnabled(particle)) {
9471
- return;
9472
- }
9473
- updateRoll(particle, delta);
9474
- }
9475
- }
9476
- ;// CONCATENATED MODULE: ../../updaters/roll/dist/browser/index.js
9477
-
9478
- async function loadRollUpdater(engine, refresh = true) {
9479
- await engine.addParticleUpdater("roll", () => new RollUpdater(), refresh);
9480
- }
9481
- ;// CONCATENATED MODULE: ../pjs/dist/browser/marcbruederlin/Particles.js
9482
-
9483
- class Particles_Particles {
9484
- static init(options) {
9485
- const particles = new Particles_Particles(),
9486
- selector = options.selector;
9487
- if (!selector) {
9488
- throw new Error("No selector provided");
9489
- }
9490
- const el = document.querySelector(selector);
9491
- if (!el) {
9492
- throw new Error("No element found for selector");
9493
- }
9494
- tsParticles.load({
9495
- id: selector.replace(".", "").replace("!", ""),
9496
- element: el,
9497
- options: {
9498
- fullScreen: {
9499
- enable: false
9500
- },
9501
- particles: {
9502
- color: {
9503
- value: options.color ?? "!000000"
9504
- },
9505
- links: {
9506
- color: "random",
9507
- distance: options.minDistance ?? 120,
9508
- enable: options.connectParticles ?? false
9509
- },
9510
- move: {
9511
- enable: true,
9512
- speed: options.speed ?? 0.5
9513
- },
9514
- number: {
9515
- value: options.maxParticles ?? 100
9516
- },
9517
- size: {
9518
- value: {
9519
- min: 1,
9520
- max: options.sizeVariations ?? 3
9521
- }
9522
- }
9523
- },
9524
- responsive: options.responsive?.map(responsive => ({
9525
- maxWidth: responsive.breakpoint,
9526
- options: {
9527
- particles: {
9528
- color: {
9529
- value: responsive.options?.color
9530
- },
9531
- links: {
9532
- distance: responsive.options?.minDistance,
9533
- enable: responsive.options?.connectParticles
9534
- },
9535
- number: {
9536
- value: options.maxParticles
9537
- },
9538
- move: {
9539
- enable: true,
9540
- speed: responsive.options?.speed
9541
- },
9542
- size: {
9543
- value: responsive.options?.sizeVariations
9544
- }
9545
- }
9546
- }
9547
- }))
9548
- }
9549
- }).then(container => {
9550
- particles._container = container;
9551
- });
9552
- return particles;
9821
+ return {
9822
+ a: rollHorizontal ? Math.cos(roll.angle) : undefined,
9823
+ d: rollVertical ? Math.sin(roll.angle) : undefined
9824
+ };
9553
9825
  }
9554
- destroy() {
9555
- const container = this._container;
9556
- container && container.destroy();
9826
+ init(particle) {
9827
+ initParticle(particle);
9557
9828
  }
9558
- pauseAnimation() {
9559
- const container = this._container;
9560
- container && container.pause();
9829
+ isEnabled(particle) {
9830
+ const roll = particle.options.roll;
9831
+ return !particle.destroyed && !particle.spawning && !!roll?.enable;
9561
9832
  }
9562
- resumeAnimation() {
9563
- const container = this._container;
9564
- container && container.play();
9833
+ loadOptions(options, ...sources) {
9834
+ if (!options.roll) {
9835
+ options.roll = new Roll();
9836
+ }
9837
+ for (const source of sources) {
9838
+ options.roll.load(source?.roll);
9839
+ }
9840
+ }
9841
+ update(particle, delta) {
9842
+ if (!this.isEnabled(particle)) {
9843
+ return;
9844
+ }
9845
+ updateRoll(particle, delta);
9565
9846
  }
9566
9847
  }
9567
- ;// CONCATENATED MODULE: ../pjs/dist/browser/VincentGarreau/particles.js
9568
- const initParticlesJS = engine => {
9569
- const particlesJS = (tagId, options) => {
9570
- return engine.load({
9571
- id: tagId,
9572
- options
9573
- });
9574
- };
9575
- particlesJS.load = (tagId, pathConfigJson, callback) => {
9576
- engine.load({
9577
- id: tagId,
9578
- url: pathConfigJson
9579
- }).then(container => {
9580
- if (container) {
9581
- callback(container);
9582
- }
9583
- }).catch(() => {
9584
- callback(undefined);
9585
- });
9586
- };
9587
- particlesJS.setOnClickHandler = callback => {
9588
- engine.setOnClickHandler(callback);
9589
- };
9590
- const pJSDom = engine.dom();
9591
- return {
9592
- particlesJS,
9593
- pJSDom
9594
- };
9595
- };
9596
-
9597
- ;// CONCATENATED MODULE: ../pjs/dist/browser/index.js
9598
-
9599
-
9600
- const initPjs = engine => {
9601
- const {
9602
- particlesJS,
9603
- pJSDom
9604
- } = initParticlesJS(engine);
9605
- window.particlesJS = particlesJS;
9606
- window.pJSDom = pJSDom;
9607
- window.Particles = Particles_Particles;
9608
- return {
9609
- particlesJS,
9610
- pJSDom,
9611
- Particles: Particles_Particles
9612
- };
9613
- };
9848
+ ;// CONCATENATED MODULE: ../../updaters/roll/dist/browser/index.js
9614
9849
 
9850
+ async function loadRollUpdater(engine, refresh = true) {
9851
+ await engine.addParticleUpdater("roll", () => new RollUpdater(), refresh);
9852
+ }
9615
9853
  ;// CONCATENATED MODULE: ../../move/base/dist/browser/Utils.js
9616
9854
 
9617
9855
  function applyDistance(particle) {
@@ -10513,6 +10751,88 @@ async function loadEasingQuadPlugin() {
10513
10751
  addEasing("ease-out-quad", value => 1 - (1 - value) ** 2);
10514
10752
  addEasing("ease-in-out-quad", value => value < 0.5 ? 2 * value ** 2 : 1 - (-2 * value + 2) ** 2 / 2);
10515
10753
  }
10754
+ ;// CONCATENATED MODULE: ../../shapes/emoji/dist/browser/EmojiDrawer.js
10755
+
10756
+ const validTypes = ["emoji"];
10757
+ const defaultFont = '"Twemoji Mozilla", Apple Color Emoji, "Segoe UI Emoji", "Noto Color Emoji", "EmojiOne Color"';
10758
+ class EmojiDrawer {
10759
+ constructor() {
10760
+ this._emojiShapeDict = new Map();
10761
+ }
10762
+ destroy() {
10763
+ for (const [, emojiData] of this._emojiShapeDict) {
10764
+ emojiData?.close();
10765
+ }
10766
+ }
10767
+ draw(data) {
10768
+ const {
10769
+ context,
10770
+ particle,
10771
+ radius,
10772
+ opacity
10773
+ } = data,
10774
+ emojiData = particle.emojiData;
10775
+ if (!emojiData) {
10776
+ return;
10777
+ }
10778
+ context.globalAlpha = opacity;
10779
+ context.drawImage(emojiData, -radius, -radius, radius * 2, radius * 2);
10780
+ context.globalAlpha = 1;
10781
+ }
10782
+ async init(container) {
10783
+ const options = container.actualOptions;
10784
+ if (validTypes.find(t => isInArray(t, options.particles.shape.type))) {
10785
+ const promises = [loadFont(defaultFont)],
10786
+ shapeOptions = validTypes.map(t => options.particles.shape.options[t]).find(t => !!t);
10787
+ if (shapeOptions) {
10788
+ executeOnSingleOrMultiple(shapeOptions, shape => {
10789
+ shape.font && promises.push(loadFont(shape.font));
10790
+ });
10791
+ }
10792
+ await Promise.all(promises);
10793
+ }
10794
+ }
10795
+ particleDestroy(particle) {
10796
+ delete particle.emojiData;
10797
+ }
10798
+ particleInit(container, particle) {
10799
+ if (!particle.emojiData) {
10800
+ const shapeData = particle.shapeData;
10801
+ if (!shapeData?.value) {
10802
+ return;
10803
+ }
10804
+ const emoji = itemFromSingleOrMultiple(shapeData.value, particle.randomIndexData),
10805
+ font = shapeData.font ?? defaultFont;
10806
+ if (!emoji) {
10807
+ return;
10808
+ }
10809
+ const key = `${emoji}_${font}`,
10810
+ existingData = this._emojiShapeDict.get(key);
10811
+ if (existingData) {
10812
+ particle.emojiData = existingData;
10813
+ return;
10814
+ }
10815
+ const canvasSize = getRangeMax(particle.size.value) * 2,
10816
+ canvas = new OffscreenCanvas(canvasSize, canvasSize);
10817
+ const context = canvas.getContext("2d");
10818
+ if (!context) {
10819
+ return;
10820
+ }
10821
+ context.font = `400 ${getRangeMax(particle.size.value) * 2}px ${font}`;
10822
+ context.textBaseline = "middle";
10823
+ context.textAlign = "center";
10824
+ context.fillText(emoji, getRangeMax(particle.size.value), getRangeMax(particle.size.value));
10825
+ const emojiData = canvas.transferToImageBitmap();
10826
+ this._emojiShapeDict.set(key, emojiData);
10827
+ particle.emojiData = emojiData;
10828
+ }
10829
+ }
10830
+ }
10831
+ ;// CONCATENATED MODULE: ../../shapes/emoji/dist/browser/index.js
10832
+
10833
+ async function loadEmojiShape(engine, refresh = true) {
10834
+ await engine.addShape(validTypes, new EmojiDrawer(), refresh);
10835
+ }
10516
10836
  ;// CONCATENATED MODULE: ../../interactions/external/attract/dist/browser/Options/Classes/Attract.js
10517
10837
  class Attract {
10518
10838
  constructor() {
@@ -11413,18 +11733,6 @@ class Grab {
11413
11733
  this.distance = 100;
11414
11734
  this.links = new GrabLinks();
11415
11735
  }
11416
- get lineLinked() {
11417
- return this.links;
11418
- }
11419
- set lineLinked(value) {
11420
- this.links = value;
11421
- }
11422
- get line_linked() {
11423
- return this.links;
11424
- }
11425
- set line_linked(value) {
11426
- this.links = value;
11427
- }
11428
11736
  load(data) {
11429
11737
  if (!data) {
11430
11738
  return;
@@ -11432,7 +11740,7 @@ class Grab {
11432
11740
  if (data.distance !== undefined) {
11433
11741
  this.distance = data.distance;
11434
11742
  }
11435
- this.links.load(data.links ?? data.lineLinked ?? data.line_linked);
11743
+ this.links.load(data.links);
11436
11744
  }
11437
11745
  }
11438
11746
  ;// CONCATENATED MODULE: ../../interactions/external/grab/dist/browser/Utils.js
@@ -11571,12 +11879,6 @@ class Push {
11571
11879
  this.groups = [];
11572
11880
  this.quantity = 4;
11573
11881
  }
11574
- get particles_nb() {
11575
- return this.quantity;
11576
- }
11577
- set particles_nb(value) {
11578
- this.quantity = setRangeValue(value);
11579
- }
11580
11882
  load(data) {
11581
11883
  if (!data) {
11582
11884
  return;
@@ -11590,7 +11892,7 @@ class Push {
11590
11892
  if (!this.groups.length) {
11591
11893
  this.default = true;
11592
11894
  }
11593
- const quantity = data.quantity ?? data.particles_nb;
11895
+ const quantity = data.quantity;
11594
11896
  if (quantity !== undefined) {
11595
11897
  this.quantity = setRangeValue(quantity);
11596
11898
  }
@@ -11651,17 +11953,11 @@ class Remove {
11651
11953
  constructor() {
11652
11954
  this.quantity = 2;
11653
11955
  }
11654
- get particles_nb() {
11655
- return this.quantity;
11656
- }
11657
- set particles_nb(value) {
11658
- this.quantity = setRangeValue(value);
11659
- }
11660
11956
  load(data) {
11661
11957
  if (!data) {
11662
11958
  return;
11663
11959
  }
11664
- const quantity = data.quantity ?? data.particles_nb;
11960
+ const quantity = data.quantity;
11665
11961
  if (quantity !== undefined) {
11666
11962
  this.quantity = setRangeValue(quantity);
11667
11963
  }
@@ -12724,8 +13020,9 @@ class ImageDrawer {
12724
13020
  pos = {
12725
13021
  x: -radius,
12726
13022
  y: -radius
12727
- };
12728
- context.drawImage(element, pos.x, pos.y, radius * 2, radius * 2 / ratio);
13023
+ },
13024
+ diameter = radius * 2;
13025
+ context.drawImage(element, pos.x, pos.y, diameter, diameter / ratio);
12729
13026
  }
12730
13027
  context.globalAlpha = 1;
12731
13028
  }
@@ -13562,7 +13859,7 @@ class Linker extends ParticlesInteractorBase {
13562
13859
  options.links = new Links();
13563
13860
  }
13564
13861
  for (const source of sources) {
13565
- options.links.load(source?.links ?? source?.lineLinked ?? source?.line_linked);
13862
+ options.links.load(source?.links);
13566
13863
  }
13567
13864
  }
13568
13865
  reset() {}
@@ -14315,9 +14612,62 @@ class StrokeColorUpdater {
14315
14612
  async function loadStrokeColorUpdater(engine, refresh = true) {
14316
14613
  await engine.addParticleUpdater("strokeColor", container => new StrokeColorUpdater(container), refresh);
14317
14614
  }
14615
+ ;// CONCATENATED MODULE: ../slim/dist/browser/index.js
14616
+
14617
+
14618
+
14619
+
14620
+
14621
+
14622
+
14623
+
14624
+
14625
+
14626
+
14627
+
14628
+
14629
+
14630
+
14631
+
14632
+
14633
+
14634
+
14635
+
14636
+
14637
+
14638
+
14639
+
14640
+
14641
+ async function loadSlim(engine, refresh = true) {
14642
+ await loadParallaxMover(engine, false);
14643
+ await loadExternalAttractInteraction(engine, false);
14644
+ await loadExternalBounceInteraction(engine, false);
14645
+ await loadExternalBubbleInteraction(engine, false);
14646
+ await loadExternalConnectInteraction(engine, false);
14647
+ await loadExternalGrabInteraction(engine, false);
14648
+ await loadExternalPauseInteraction(engine, false);
14649
+ await loadExternalPushInteraction(engine, false);
14650
+ await loadExternalRemoveInteraction(engine, false);
14651
+ await loadExternalRepulseInteraction(engine, false);
14652
+ await loadExternalSlowInteraction(engine, false);
14653
+ await loadParticlesAttractInteraction(engine, false);
14654
+ await loadParticlesCollisionsInteraction(engine, false);
14655
+ await loadParticlesLinksInteraction(engine, false);
14656
+ await loadEasingQuadPlugin();
14657
+ await loadEmojiShape(engine, false);
14658
+ await loadImageShape(engine, false);
14659
+ await loadLineShape(engine, false);
14660
+ await loadPolygonShape(engine, false);
14661
+ await loadSquareShape(engine, false);
14662
+ await loadStarShape(engine, false);
14663
+ await loadLifeUpdater(engine, false);
14664
+ await loadRotateUpdater(engine, false);
14665
+ await loadStrokeColorUpdater(engine, false);
14666
+ await loadBasic(engine, refresh);
14667
+ }
14318
14668
  ;// CONCATENATED MODULE: ../../shapes/text/dist/browser/TextDrawer.js
14319
14669
 
14320
- const validTypes = ["text", "character", "char", "multiline-text"];
14670
+ const TextDrawer_validTypes = ["text", "character", "char", "multiline-text"];
14321
14671
  class TextDrawer {
14322
14672
  constructor() {
14323
14673
  this._drawLine = (context, line, radius, opacity, index, fill) => {
@@ -14325,11 +14675,12 @@ class TextDrawer {
14325
14675
  pos = {
14326
14676
  x: -offsetX,
14327
14677
  y: radius / 2
14328
- };
14678
+ },
14679
+ diameter = radius * 2;
14329
14680
  if (fill) {
14330
- context.fillText(line, pos.x, pos.y + radius * 2 * index);
14681
+ context.fillText(line, pos.x, pos.y + diameter * index);
14331
14682
  } else {
14332
- context.strokeText(line, pos.x, pos.y + radius * 2 * index);
14683
+ context.strokeText(line, pos.x, pos.y + diameter * index);
14333
14684
  }
14334
14685
  };
14335
14686
  }
@@ -14370,8 +14721,8 @@ class TextDrawer {
14370
14721
  }
14371
14722
  async init(container) {
14372
14723
  const options = container.actualOptions;
14373
- if (validTypes.find(t => isInArray(t, options.particles.shape.type))) {
14374
- const shapeOptions = validTypes.map(t => options.particles.shape.options[t]).find(t => !!t),
14724
+ if (TextDrawer_validTypes.find(t => isInArray(t, options.particles.shape.type))) {
14725
+ const shapeOptions = TextDrawer_validTypes.map(t => options.particles.shape.options[t]).find(t => !!t),
14375
14726
  promises = [];
14376
14727
  executeOnSingleOrMultiple(shapeOptions, shape => {
14377
14728
  promises.push(loadFont(shape.font, shape.weight));
@@ -14380,7 +14731,7 @@ class TextDrawer {
14380
14731
  }
14381
14732
  }
14382
14733
  particleInit(container, particle) {
14383
- if (!particle.shape || !validTypes.includes(particle.shape)) {
14734
+ if (!particle.shape || !TextDrawer_validTypes.includes(particle.shape)) {
14384
14735
  return;
14385
14736
  }
14386
14737
  const character = particle.shapeData;
@@ -14397,62 +14748,7 @@ class TextDrawer {
14397
14748
  ;// CONCATENATED MODULE: ../../shapes/text/dist/browser/index.js
14398
14749
 
14399
14750
  async function loadTextShape(engine, refresh = true) {
14400
- await engine.addShape(validTypes, new TextDrawer(), refresh);
14401
- }
14402
- ;// CONCATENATED MODULE: ../slim/dist/browser/index.js
14403
-
14404
-
14405
-
14406
-
14407
-
14408
-
14409
-
14410
-
14411
-
14412
-
14413
-
14414
-
14415
-
14416
-
14417
-
14418
-
14419
-
14420
-
14421
-
14422
-
14423
-
14424
-
14425
-
14426
-
14427
-
14428
-
14429
- async function loadSlim(engine, refresh = true) {
14430
- initPjs(engine);
14431
- await loadParallaxMover(engine, false);
14432
- await loadExternalAttractInteraction(engine, false);
14433
- await loadExternalBounceInteraction(engine, false);
14434
- await loadExternalBubbleInteraction(engine, false);
14435
- await loadExternalConnectInteraction(engine, false);
14436
- await loadExternalGrabInteraction(engine, false);
14437
- await loadExternalPauseInteraction(engine, false);
14438
- await loadExternalPushInteraction(engine, false);
14439
- await loadExternalRemoveInteraction(engine, false);
14440
- await loadExternalRepulseInteraction(engine, false);
14441
- await loadExternalSlowInteraction(engine, false);
14442
- await loadParticlesAttractInteraction(engine, false);
14443
- await loadParticlesCollisionsInteraction(engine, false);
14444
- await loadParticlesLinksInteraction(engine, false);
14445
- await loadEasingQuadPlugin();
14446
- await loadImageShape(engine, false);
14447
- await loadLineShape(engine, false);
14448
- await loadPolygonShape(engine, false);
14449
- await loadSquareShape(engine, false);
14450
- await loadStarShape(engine, false);
14451
- await loadTextShape(engine, false);
14452
- await loadLifeUpdater(engine, false);
14453
- await loadRotateUpdater(engine, false);
14454
- await loadStrokeColorUpdater(engine, false);
14455
- await loadBasic(engine, refresh);
14751
+ await engine.addShape(TextDrawer_validTypes, new TextDrawer(), refresh);
14456
14752
  }
14457
14753
  ;// CONCATENATED MODULE: ../../updaters/tilt/dist/browser/Options/Classes/TiltAnimation.js
14458
14754
 
@@ -14840,12 +15136,14 @@ async function loadWobbleUpdater(engine, refresh = true) {
14840
15136
 
14841
15137
 
14842
15138
 
15139
+
14843
15140
  async function loadFull(engine, refresh = true) {
14844
15141
  await loadDestroyUpdater(engine, false);
14845
15142
  await loadRollUpdater(engine, false);
14846
15143
  await loadTiltUpdater(engine, false);
14847
15144
  await loadTwinkleUpdater(engine, false);
14848
15145
  await loadWobbleUpdater(engine, false);
15146
+ await loadTextShape(engine, false);
14849
15147
  await loadExternalTrailInteraction(engine, false);
14850
15148
  await loadAbsorbersPlugin(engine, false);
14851
15149
  await loadEmittersPlugin(engine, false);
@@ -15270,20 +15568,23 @@ async function loadGradientUpdater(engine, refresh = true) {
15270
15568
  class HeartDrawer_HeartDrawer {
15271
15569
  draw(data) {
15272
15570
  const {
15273
- context,
15274
- radius
15275
- } = data;
15276
- const x = -radius,
15571
+ context,
15572
+ radius
15573
+ } = data,
15574
+ diameter = radius * 2,
15575
+ halfRadius = radius * 0.5,
15576
+ radiusAndHalf = radius + halfRadius,
15577
+ x = -radius,
15277
15578
  y = -radius;
15278
15579
  context.moveTo(x, y + radius / 2);
15279
- context.quadraticCurveTo(x, y, x + radius / 2, y);
15280
- context.quadraticCurveTo(x + radius, y, x + radius, y + radius / 2);
15281
- context.quadraticCurveTo(x + radius, y, x + radius * 3 / 2, y);
15282
- context.quadraticCurveTo(x + radius * 2, y, x + radius * 2, y + radius / 2);
15283
- context.quadraticCurveTo(x + radius * 2, y + radius, x + radius * 3 / 2, y + radius * 3 / 2);
15284
- context.lineTo(x + radius, y + radius * 2);
15285
- context.lineTo(x + radius / 2, y + radius * 3 / 2);
15286
- context.quadraticCurveTo(x, y + radius, x, y + radius / 2);
15580
+ context.quadraticCurveTo(x, y, x + halfRadius, y);
15581
+ context.quadraticCurveTo(x + radius, y, x + radius, y + halfRadius);
15582
+ context.quadraticCurveTo(x + radius, y, x + radiusAndHalf, y);
15583
+ context.quadraticCurveTo(x + diameter, y, x + diameter, y + halfRadius);
15584
+ context.quadraticCurveTo(x + diameter, y + radius, x + radiusAndHalf, y + radiusAndHalf);
15585
+ context.lineTo(x + radius, y + diameter);
15586
+ context.lineTo(x + halfRadius, y + radiusAndHalf);
15587
+ context.quadraticCurveTo(x, y + radius, x, y + halfRadius);
15287
15588
  }
15288
15589
  }
15289
15590
  ;// CONCATENATED MODULE: ../../shapes/heart/dist/browser/index.js
@@ -19996,6 +20297,7 @@ class TrailDrawer {
19996
20297
  radius,
19997
20298
  particle
19998
20299
  } = data,
20300
+ diameter = radius * 2,
19999
20301
  pxRatio = particle.container.retina.pixelRatio,
20000
20302
  currentPos = particle.getPosition();
20001
20303
  if (!particle.trail || !particle.trailLength) {
@@ -20024,13 +20326,13 @@ class TrailDrawer {
20024
20326
  for (let i = trailLength; i > 0; i--) {
20025
20327
  const step = particle.trail[i - 1],
20026
20328
  position = step.position;
20027
- if (getDistance(lastPos, position) > radius * 2) {
20329
+ if (getDistance(lastPos, position) > diameter) {
20028
20330
  continue;
20029
20331
  }
20030
20332
  context.beginPath();
20031
20333
  context.moveTo(lastPos.x - offsetPos.x, lastPos.y - offsetPos.y);
20032
20334
  context.lineTo(position.x - offsetPos.x, position.y - offsetPos.y);
20033
- const width = Math.max(i / trailLength * radius * 2, pxRatio, particle.trailMinWidth ?? -1);
20335
+ const width = Math.max(i / trailLength * diameter, pxRatio, particle.trailMinWidth ?? -1);
20034
20336
  context.lineWidth = particle.trailMaxWidth ? Math.min(width, particle.trailMaxWidth) : width;
20035
20337
  context.strokeStyle = step.color;
20036
20338
  context.stroke();
@@ -20091,9 +20393,11 @@ async function loadTrailEffect(engine, refresh = true) {
20091
20393
 
20092
20394
 
20093
20395
 
20396
+
20094
20397
 
20095
20398
 
20096
20399
  async function loadAll(engine, refresh = true) {
20400
+ initPjs(engine);
20097
20401
  await loadFull(engine, false);
20098
20402
  await loadHsvColorPlugin();
20099
20403
  await loadEasingBackPlugin();