tsparticles 2.0.2 → 2.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.
@@ -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
- * v2.0.2
7
+ * v2.0.3
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -509,28 +509,6 @@ __webpack_require__.d(__webpack_exports__, {
509
509
  "visibilityChangeEvent": () => (/* reexport */ visibilityChangeEvent)
510
510
  });
511
511
 
512
- ;// CONCATENATED MODULE: ../../plugins/absorbers/dist/Options/Classes/AbsorberSizeLimit.js
513
- class AbsorberSizeLimit {
514
- constructor() {
515
- this.radius = 0;
516
- this.mass = 0;
517
- }
518
-
519
- load(data) {
520
- if (!data) {
521
- return;
522
- }
523
-
524
- if (data.mass !== undefined) {
525
- this.mass = data.mass;
526
- }
527
-
528
- if (data.radius !== undefined) {
529
- this.radius = data.radius;
530
- }
531
- }
532
-
533
- }
534
512
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Utils/NumberUtils.js
535
513
 
536
514
  function clamp(num, min, max) {
@@ -694,7 +672,7 @@ class ColorAnimation {
694
672
  }
695
673
 
696
674
  if (data.count !== undefined) {
697
- this.count = data.count;
675
+ this.count = setRangeValue(data.count);
698
676
  }
699
677
 
700
678
  if (data.enable !== undefined) {
@@ -706,7 +684,7 @@ class ColorAnimation {
706
684
  }
707
685
 
708
686
  if (data.speed !== undefined) {
709
- this.speed = data.speed;
687
+ this.speed = setRangeValue(data.speed);
710
688
  }
711
689
 
712
690
  if (data.sync !== undefined) {
@@ -929,7 +907,7 @@ class GradientAngleAnimation {
929
907
  }
930
908
 
931
909
  if (data.count !== undefined) {
932
- this.count = data.count;
910
+ this.count = setRangeValue(data.count);
933
911
  }
934
912
 
935
913
  if (data.enable !== undefined) {
@@ -937,7 +915,7 @@ class GradientAngleAnimation {
937
915
  }
938
916
 
939
917
  if (data.speed !== undefined) {
940
- this.speed = data.speed;
918
+ this.speed = setRangeValue(data.speed);
941
919
  }
942
920
 
943
921
  if (data.sync !== undefined) {
@@ -961,7 +939,7 @@ class GradientColorOpacityAnimation {
961
939
  }
962
940
 
963
941
  if (data.count !== undefined) {
964
- this.count = data.count;
942
+ this.count = setRangeValue(data.count);
965
943
  }
966
944
 
967
945
  if (data.enable !== undefined) {
@@ -969,7 +947,7 @@ class GradientColorOpacityAnimation {
969
947
  }
970
948
 
971
949
  if (data.speed !== undefined) {
972
- this.speed = data.speed;
950
+ this.speed = setRangeValue(data.speed);
973
951
  }
974
952
 
975
953
  if (data.sync !== undefined) {
@@ -983,6 +961,7 @@ class GradientColorOpacityAnimation {
983
961
 
984
962
  }
985
963
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/AnimationOptions.js
964
+
986
965
  class AnimationOptions {
987
966
  constructor() {
988
967
  this.count = 0;
@@ -997,7 +976,7 @@ class AnimationOptions {
997
976
  }
998
977
 
999
978
  if (data.count !== undefined) {
1000
- this.count = data.count;
979
+ this.count = setRangeValue(data.count);
1001
980
  }
1002
981
 
1003
982
  if (data.enable !== undefined) {
@@ -1005,7 +984,7 @@ class AnimationOptions {
1005
984
  }
1006
985
 
1007
986
  if (data.speed !== undefined) {
1008
- this.speed = data.speed;
987
+ this.speed = setRangeValue(data.speed);
1009
988
  }
1010
989
 
1011
990
  if (data.sync !== undefined) {
@@ -2874,6 +2853,7 @@ class Links {
2874
2853
 
2875
2854
  }
2876
2855
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveAttract.js
2856
+
2877
2857
  class MoveAttract {
2878
2858
  constructor() {
2879
2859
  this.distance = 200;
@@ -2908,7 +2888,7 @@ class MoveAttract {
2908
2888
  }
2909
2889
 
2910
2890
  if (data.distance !== undefined) {
2911
- this.distance = data.distance;
2891
+ this.distance = setRangeValue(data.distance);
2912
2892
  }
2913
2893
 
2914
2894
  if (data.enable !== undefined) {
@@ -2930,6 +2910,7 @@ class MoveAttract {
2930
2910
 
2931
2911
  }
2932
2912
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveAngle.js
2913
+
2933
2914
  class MoveAngle {
2934
2915
  constructor() {
2935
2916
  this.offset = 0;
@@ -2942,16 +2923,17 @@ class MoveAngle {
2942
2923
  }
2943
2924
 
2944
2925
  if (data.offset !== undefined) {
2945
- this.offset = data.offset;
2926
+ this.offset = setRangeValue(data.offset);
2946
2927
  }
2947
2928
 
2948
2929
  if (data.value !== undefined) {
2949
- this.value = data.value;
2930
+ this.value = setRangeValue(data.value);
2950
2931
  }
2951
2932
  }
2952
2933
 
2953
2934
  }
2954
2935
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Move/MoveGravity.js
2936
+
2955
2937
  class MoveGravity {
2956
2938
  constructor() {
2957
2939
  this.acceleration = 9.81;
@@ -2966,7 +2948,7 @@ class MoveGravity {
2966
2948
  }
2967
2949
 
2968
2950
  if (data.acceleration !== undefined) {
2969
- this.acceleration = data.acceleration;
2951
+ this.acceleration = setRangeValue(data.acceleration);
2970
2952
  }
2971
2953
 
2972
2954
  if (data.enable !== undefined) {
@@ -2978,7 +2960,7 @@ class MoveGravity {
2978
2960
  }
2979
2961
 
2980
2962
  if (data.maxSpeed !== undefined) {
2981
- this.maxSpeed = data.maxSpeed;
2963
+ this.maxSpeed = setRangeValue(data.maxSpeed);
2982
2964
  }
2983
2965
  }
2984
2966
 
@@ -3389,6 +3371,7 @@ class OrbitRotation extends ValueWithRandom {
3389
3371
 
3390
3372
 
3391
3373
 
3374
+
3392
3375
  class Orbit {
3393
3376
  constructor() {
3394
3377
  this.animation = new AnimationOptions();
@@ -3411,15 +3394,15 @@ class Orbit {
3411
3394
  }
3412
3395
 
3413
3396
  if (data.opacity !== undefined) {
3414
- this.opacity = data.opacity;
3397
+ this.opacity = setRangeValue(data.opacity);
3415
3398
  }
3416
3399
 
3417
3400
  if (data.width !== undefined) {
3418
- this.width = data.width;
3401
+ this.width = setRangeValue(data.width);
3419
3402
  }
3420
3403
 
3421
3404
  if (data.radius !== undefined) {
3422
- this.radius = data.radius;
3405
+ this.radius = setRangeValue(data.radius);
3423
3406
  }
3424
3407
 
3425
3408
  if (data.color !== undefined) {
@@ -3508,6 +3491,7 @@ class ParticlesNumber {
3508
3491
  }
3509
3492
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Repulse/ParticlesRepulse.js
3510
3493
 
3494
+
3511
3495
  class ParticlesRepulse extends ValueWithRandom {
3512
3496
  constructor() {
3513
3497
  super();
@@ -3530,19 +3514,19 @@ class ParticlesRepulse extends ValueWithRandom {
3530
3514
  }
3531
3515
 
3532
3516
  if (data.distance !== undefined) {
3533
- this.distance = data.distance;
3517
+ this.distance = setRangeValue(data.distance);
3534
3518
  }
3535
3519
 
3536
3520
  if (data.duration !== undefined) {
3537
- this.duration = data.duration;
3521
+ this.duration = setRangeValue(data.duration);
3538
3522
  }
3539
3523
 
3540
3524
  if (data.factor !== undefined) {
3541
- this.factor = data.factor;
3525
+ this.factor = setRangeValue(data.factor);
3542
3526
  }
3543
3527
 
3544
3528
  if (data.speed !== undefined) {
3545
- this.speed = data.speed;
3529
+ this.speed = setRangeValue(data.speed);
3546
3530
  }
3547
3531
  }
3548
3532
 
@@ -3550,6 +3534,7 @@ class ParticlesRepulse extends ValueWithRandom {
3550
3534
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Repulse/index.js
3551
3535
 
3552
3536
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Roll/RollLight.js
3537
+
3553
3538
  class RollLight {
3554
3539
  constructor() {
3555
3540
  this.enable = false;
@@ -3566,7 +3551,7 @@ class RollLight {
3566
3551
  }
3567
3552
 
3568
3553
  if (data.value !== undefined) {
3569
- this.value = data.value;
3554
+ this.value = setRangeValue(data.value);
3570
3555
  }
3571
3556
  }
3572
3557
 
@@ -3615,6 +3600,7 @@ class Roll {
3615
3600
 
3616
3601
 
3617
3602
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Rotate/RotateAnimation.js
3603
+
3618
3604
  class RotateAnimation {
3619
3605
  constructor() {
3620
3606
  this.enable = false;
@@ -3632,7 +3618,7 @@ class RotateAnimation {
3632
3618
  }
3633
3619
 
3634
3620
  if (data.speed !== undefined) {
3635
- this.speed = data.speed;
3621
+ this.speed = setRangeValue(data.speed);
3636
3622
  }
3637
3623
 
3638
3624
  if (data.sync !== undefined) {
@@ -3971,6 +3957,7 @@ class Stroke {
3971
3957
 
3972
3958
  }
3973
3959
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Tilt/TiltAnimation.js
3960
+
3974
3961
  class TiltAnimation {
3975
3962
  constructor() {
3976
3963
  this.enable = false;
@@ -3988,7 +3975,7 @@ class TiltAnimation {
3988
3975
  }
3989
3976
 
3990
3977
  if (data.speed !== undefined) {
3991
- this.speed = data.speed;
3978
+ this.speed = setRangeValue(data.speed);
3992
3979
  }
3993
3980
 
3994
3981
  if (data.sync !== undefined) {
@@ -4033,6 +4020,7 @@ class Tilt extends ValueWithRandom {
4033
4020
 
4034
4021
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Twinkle/TwinkleValues.js
4035
4022
 
4023
+
4036
4024
  class TwinkleValues {
4037
4025
  constructor() {
4038
4026
  this.enable = false;
@@ -4058,7 +4046,7 @@ class TwinkleValues {
4058
4046
  }
4059
4047
 
4060
4048
  if (data.opacity !== undefined) {
4061
- this.opacity = data.opacity;
4049
+ this.opacity = setRangeValue(data.opacity);
4062
4050
  }
4063
4051
  }
4064
4052
 
@@ -4081,6 +4069,9 @@ class Twinkle {
4081
4069
  }
4082
4070
 
4083
4071
  }
4072
+ ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Twinkle/index.js
4073
+
4074
+
4084
4075
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Wobble/Wobble.js
4085
4076
 
4086
4077
  class Wobble {
@@ -4311,9 +4302,6 @@ class ParticlesOptions {
4311
4302
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Number/index.js
4312
4303
 
4313
4304
 
4314
- ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/Twinkle/index.js
4315
-
4316
-
4317
4305
  ;// CONCATENATED MODULE: ../../engine/dist/esm/Options/Classes/Particles/index.js
4318
4306
 
4319
4307
 
@@ -5092,7 +5080,7 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
5092
5080
  colorValue.enable = colorAnimation.enable;
5093
5081
 
5094
5082
  if (colorValue.enable) {
5095
- colorValue.velocity = colorAnimation.speed / 100 * reduceFactor;
5083
+ colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
5096
5084
 
5097
5085
  if (colorAnimation.sync) {
5098
5086
  return;
@@ -6649,10 +6637,7 @@ class Canvas {
6649
6637
  const container = this.container;
6650
6638
  const pxRatio = container.retina.pixelRatio;
6651
6639
  const size = container.canvas.size;
6652
- const oldSize = {
6653
- width: size.width,
6654
- height: size.height
6655
- };
6640
+ const oldSize = Object.assign({}, size);
6656
6641
  size.width = this.element.offsetWidth * pxRatio;
6657
6642
  size.height = this.element.offsetHeight * pxRatio;
6658
6643
  this.element.width = size.width;
@@ -6727,7 +6712,7 @@ class Canvas {
6727
6712
  const zIndexOptions = particle.options.zIndex;
6728
6713
  const zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate;
6729
6714
  const radius = particle.getRadius();
6730
- const opacity = twinkling ? twinkle.opacity : (_d = (_b = particle.bubble.opacity) !== null && _b !== void 0 ? _b : (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1;
6715
+ const opacity = twinkling ? getRangeValue(twinkle.opacity) : (_d = (_b = particle.bubble.opacity) !== null && _b !== void 0 ? _b : (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1;
6731
6716
  const strokeOpacity = (_f = (_e = particle.stroke) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : opacity;
6732
6717
  const zOpacity = opacity * zOpacityFactor;
6733
6718
  const fillColorValue = fColor ? getStyleFromHsl(fColor, zOpacity) : undefined;
@@ -6969,6 +6954,7 @@ class Particle {
6969
6954
  maxDistance: {}
6970
6955
  };
6971
6956
  this.outType = "normal";
6957
+ this.ignoresResizeRatio = true;
6972
6958
  const pxRatio = container.retina.pixelRatio;
6973
6959
  const mainOptions = container.actualOptions;
6974
6960
  const particlesOptions = loadParticlesOptions(mainOptions.particles);
@@ -7014,7 +7000,7 @@ class Particle {
7014
7000
  max: getRangeMax(sizeRange) * pxRatio,
7015
7001
  min: getRangeMin(sizeRange) * pxRatio,
7016
7002
  loops: 0,
7017
- maxLoops: sizeOptions.animation.count
7003
+ maxLoops: getRangeValue(sizeOptions.animation.count)
7018
7004
  };
7019
7005
  const sizeAnimation = sizeOptions.animation;
7020
7006
 
@@ -7073,6 +7059,12 @@ class Particle {
7073
7059
  this.initialVelocity = this.calculateVelocity();
7074
7060
  this.velocity = this.initialVelocity.copy();
7075
7061
  this.moveDecay = 1 - getRangeValue(this.options.move.decay);
7062
+ const gravityOptions = this.options.move.gravity;
7063
+ this.gravity = {
7064
+ enable: gravityOptions.enable,
7065
+ acceleration: getRangeValue(gravityOptions.acceleration),
7066
+ inverse: gravityOptions.inverse
7067
+ };
7076
7068
  this.offset = Vector.origin;
7077
7069
  const particles = container.particles;
7078
7070
  particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
@@ -7334,8 +7326,8 @@ class Particle {
7334
7326
  return res;
7335
7327
  }
7336
7328
 
7337
- const rad = Math.PI / 180 * moveOptions.angle.value;
7338
- const radOffset = Math.PI / 180 * moveOptions.angle.offset;
7329
+ const rad = Math.PI / 180 * getRangeValue(moveOptions.angle.value);
7330
+ const radOffset = Math.PI / 180 * getRangeValue(moveOptions.angle.offset);
7339
7331
  const range = {
7340
7332
  left: radOffset - rad / 2,
7341
7333
  right: radOffset + rad / 2
@@ -7532,11 +7524,12 @@ class Particles {
7532
7524
  for (const particle of this.array) {
7533
7525
  const resizeFactor = container.canvas.resizeFactor;
7534
7526
 
7535
- if (resizeFactor) {
7527
+ if (resizeFactor && !particle.ignoresResizeRatio) {
7536
7528
  particle.position.x *= resizeFactor.width;
7537
7529
  particle.position.y *= resizeFactor.height;
7538
7530
  }
7539
7531
 
7532
+ particle.ignoresResizeRatio = false;
7540
7533
  particle.bubble.inRange = false;
7541
7534
 
7542
7535
  for (const [, plugin] of this.container.plugins) {
@@ -7857,14 +7850,14 @@ class Retina {
7857
7850
  }
7858
7851
 
7859
7852
  const particles = options.particles;
7860
- this.attractDistance = particles.move.attract.distance * ratio;
7853
+ this.attractDistance = getRangeValue(particles.move.attract.distance) * ratio;
7861
7854
  this.linksDistance = particles.links.distance * ratio;
7862
7855
  this.linksWidth = particles.links.width * ratio;
7863
- this.sizeAnimationSpeed = particles.size.animation.speed * ratio;
7864
- this.maxSpeed = particles.move.gravity.maxSpeed * ratio;
7856
+ this.sizeAnimationSpeed = getRangeValue(particles.size.animation.speed) * ratio;
7857
+ this.maxSpeed = getRangeValue(particles.move.gravity.maxSpeed) * ratio;
7865
7858
 
7866
7859
  if (particles.orbit.radius !== undefined) {
7867
- this.orbitRadius = particles.orbit.radius * this.container.retina.pixelRatio;
7860
+ this.orbitRadius = getRangeValue(particles.orbit.radius) * this.container.retina.pixelRatio;
7868
7861
  }
7869
7862
 
7870
7863
  const modes = options.interactivity.modes;
@@ -7887,16 +7880,16 @@ class Retina {
7887
7880
  const ratio = this.pixelRatio;
7888
7881
  const moveDistance = options.move.distance;
7889
7882
  const props = particle.retina;
7890
- props.attractDistance = options.move.attract.distance * ratio;
7883
+ props.attractDistance = getRangeValue(options.move.attract.distance) * ratio;
7891
7884
  props.linksDistance = options.links.distance * ratio;
7892
7885
  props.linksWidth = options.links.width * ratio;
7893
7886
  props.moveDrift = getRangeValue(options.move.drift) * ratio;
7894
7887
  props.moveSpeed = getRangeValue(options.move.speed) * ratio;
7895
- props.sizeAnimationSpeed = options.size.animation.speed * ratio;
7888
+ props.sizeAnimationSpeed = getRangeValue(options.size.animation.speed) * ratio;
7896
7889
  const maxDistance = props.maxDistance;
7897
7890
  maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
7898
7891
  maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
7899
- props.maxSpeed = options.move.gravity.maxSpeed * ratio;
7892
+ props.maxSpeed = getRangeValue(options.move.gravity.maxSpeed) * ratio;
7900
7893
  }
7901
7894
 
7902
7895
  handleMotionChange(mediaQuery) {
@@ -8823,6 +8816,28 @@ tsParticles.init();
8823
8816
 
8824
8817
 
8825
8818
 
8819
+ ;// CONCATENATED MODULE: ../../plugins/absorbers/dist/Options/Classes/AbsorberSizeLimit.js
8820
+ class AbsorberSizeLimit {
8821
+ constructor() {
8822
+ this.radius = 0;
8823
+ this.mass = 0;
8824
+ }
8825
+
8826
+ load(data) {
8827
+ if (!data) {
8828
+ return;
8829
+ }
8830
+
8831
+ if (data.mass !== undefined) {
8832
+ this.mass = data.mass;
8833
+ }
8834
+
8835
+ if (data.radius !== undefined) {
8836
+ this.radius = data.radius;
8837
+ }
8838
+ }
8839
+
8840
+ }
8826
8841
  ;// CONCATENATED MODULE: ../../plugins/absorbers/dist/Options/Classes/AbsorberSize.js
8827
8842
 
8828
8843
 
@@ -8887,10 +8902,15 @@ class Absorber {
8887
8902
  }
8888
8903
 
8889
8904
  if (data.position !== undefined) {
8890
- this.position = {
8891
- x: data.position.x,
8892
- y: data.position.y
8893
- };
8905
+ this.position = {};
8906
+
8907
+ if (data.position.x !== undefined) {
8908
+ this.position.x = setRangeValue(data.position.x);
8909
+ }
8910
+
8911
+ if (data.position.y !== undefined) {
8912
+ this.position.y = setRangeValue(data.position.y);
8913
+ }
8894
8914
  }
8895
8915
 
8896
8916
  if (data.size !== undefined) {
@@ -9024,7 +9044,7 @@ class AbsorberInstance {
9024
9044
 
9025
9045
  const container = this.container;
9026
9046
  const percentPosition = this.options.position;
9027
- return Vector.create(((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width, ((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height);
9047
+ return Vector.create(getRangeValue((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width, getRangeValue((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height);
9028
9048
  }
9029
9049
 
9030
9050
  updateParticlePosition(particle, v) {
@@ -9507,10 +9527,15 @@ class Emitter {
9507
9527
  }
9508
9528
 
9509
9529
  if (data.position !== undefined) {
9510
- this.position = {
9511
- x: data.position.x,
9512
- y: data.position.y
9513
- };
9530
+ this.position = {};
9531
+
9532
+ if (data.position.x !== undefined) {
9533
+ this.position.x = setRangeValue(data.position.x);
9534
+ }
9535
+
9536
+ if (data.position.y !== undefined) {
9537
+ this.position.y = setRangeValue(data.position.y);
9538
+ }
9514
9539
  }
9515
9540
 
9516
9541
  if (data.spawnColor !== undefined) {
@@ -9548,9 +9573,9 @@ var _EmitterInstance_firstSpawn, _EmitterInstance_startParticlesAdded, _EmitterI
9548
9573
 
9549
9574
  class EmitterInstance {
9550
9575
  constructor(engine, emitters, container, options, position) {
9551
- var _a, _b, _c, _d, _e, _f;
9576
+ var _a, _b, _c, _d, _e, _f, _g;
9552
9577
 
9553
- var _g;
9578
+ var _h;
9554
9579
 
9555
9580
  this.emitters = emitters;
9556
9581
  this.container = container;
@@ -9576,8 +9601,9 @@ class EmitterInstance {
9576
9601
  }
9577
9602
 
9578
9603
  this.spawnDelay = ((_a = this.options.life.delay) !== null && _a !== void 0 ? _a : 0) * 1000 / this.container.retina.reduceFactor;
9604
+ this.position = (_b = this.initialPosition) !== null && _b !== void 0 ? _b : this.calcPosition();
9579
9605
  this.name = this.options.name;
9580
- this.shape = (_b = EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_engine, "f").emitterShapeManager) === null || _b === void 0 ? void 0 : _b.getShape(this.options.shape);
9606
+ this.shape = (_c = EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_engine, "f").emitterShapeManager) === null || _c === void 0 ? void 0 : _c.getShape(this.options.shape);
9581
9607
  this.fill = this.options.fill;
9582
9608
 
9583
9609
  EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_firstSpawn, !this.options.life.wait, "f");
@@ -9586,8 +9612,8 @@ class EmitterInstance {
9586
9612
 
9587
9613
  let particlesOptions = deepExtend({}, this.options.particles);
9588
9614
  particlesOptions !== null && particlesOptions !== void 0 ? particlesOptions : particlesOptions = {};
9589
- (_c = particlesOptions.move) !== null && _c !== void 0 ? _c : particlesOptions.move = {};
9590
- (_d = (_g = particlesOptions.move).direction) !== null && _d !== void 0 ? _d : _g.direction = this.options.direction;
9615
+ (_d = particlesOptions.move) !== null && _d !== void 0 ? _d : particlesOptions.move = {};
9616
+ (_e = (_h = particlesOptions.move).direction) !== null && _e !== void 0 ? _e : _h.direction = this.options.direction;
9591
9617
 
9592
9618
  if (this.options.spawnColor) {
9593
9619
  this.spawnColor = colorToHsl(this.options.spawnColor);
@@ -9595,7 +9621,7 @@ class EmitterInstance {
9595
9621
 
9596
9622
  this.paused = !this.options.autoPlay;
9597
9623
  this.particlesOptions = particlesOptions;
9598
- this.size = (_e = this.options.size) !== null && _e !== void 0 ? _e : (() => {
9624
+ this.size = (_f = this.options.size) !== null && _f !== void 0 ? _f : (() => {
9599
9625
  const size = new EmitterSize();
9600
9626
  size.load({
9601
9627
  height: 0,
@@ -9604,7 +9630,7 @@ class EmitterInstance {
9604
9630
  });
9605
9631
  return size;
9606
9632
  })();
9607
- this.lifeCount = (_f = this.options.life.count) !== null && _f !== void 0 ? _f : -1;
9633
+ this.lifeCount = (_g = this.options.life.count) !== null && _g !== void 0 ? _g : -1;
9608
9634
  this.immortal = this.lifeCount <= 0;
9609
9635
 
9610
9636
  EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_engine, "f").dispatchEvent("emitterCreated", {
@@ -9798,8 +9824,8 @@ class EmitterInstance {
9798
9824
  const container = this.container;
9799
9825
  const percentPosition = this.options.position;
9800
9826
  return {
9801
- x: ((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width,
9802
- y: ((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height
9827
+ x: getRangeValue((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width,
9828
+ y: getRangeValue((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height
9803
9829
  };
9804
9830
  }
9805
9831
 
@@ -9861,7 +9887,7 @@ class EmitterInstance {
9861
9887
  const colorOffset = randomInRange(animation.offset);
9862
9888
  const delay = getRangeValue(this.options.rate.delay);
9863
9889
  const emitFactor = 1000 * delay / container.retina.reduceFactor;
9864
- const colorSpeed = (_a = animation.speed) !== null && _a !== void 0 ? _a : 0;
9890
+ const colorSpeed = getRangeValue((_a = animation.speed) !== null && _a !== void 0 ? _a : 0);
9865
9891
  return (initValue + colorSpeed * container.fpsLimit / emitFactor + colorOffset * 3.6) % maxValue;
9866
9892
  }
9867
9893
 
@@ -11429,17 +11455,17 @@ class RollUpdater {
11429
11455
  const alterType = Math.random() >= 0.5 ? "darken" : "enlighten";
11430
11456
  particle.roll.alter = {
11431
11457
  type: alterType,
11432
- value: alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value
11458
+ value: getRangeValue(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value)
11433
11459
  };
11434
11460
  } else if (rollOpt.darken.enable) {
11435
11461
  particle.roll.alter = {
11436
11462
  type: "darken",
11437
- value: rollOpt.darken.value
11463
+ value: getRangeValue(rollOpt.darken.value)
11438
11464
  };
11439
11465
  } else if (rollOpt.enlighten.enable) {
11440
11466
  particle.roll.alter = {
11441
11467
  type: "enlighten",
11442
- value: rollOpt.enlighten.value
11468
+ value: getRangeValue(rollOpt.enlighten.value)
11443
11469
  };
11444
11470
  }
11445
11471
  } else {
@@ -11578,7 +11604,7 @@ class AngleUpdater {
11578
11604
  const rotateAnimation = particle.options.rotate.animation;
11579
11605
 
11580
11606
  if (rotateAnimation.enable) {
11581
- particle.rotate.velocity = rotateAnimation.speed / 360 * this.container.retina.reduceFactor;
11607
+ particle.rotate.velocity = getRangeValue(rotateAnimation.speed) / 360 * this.container.retina.reduceFactor;
11582
11608
 
11583
11609
  if (!rotateAnimation.sync) {
11584
11610
  particle.rotate.velocity *= Math.random();
@@ -11821,7 +11847,7 @@ class BaseMover {
11821
11847
  diffFactor = 2,
11822
11848
  moveSpeed = baseSpeed * speedFactor / diffFactor;
11823
11849
  applyPath(particle, delta);
11824
- const gravityOptions = moveOptions.gravity,
11850
+ const gravityOptions = particle.gravity,
11825
11851
  gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
11826
11852
 
11827
11853
  if (gravityOptions.enable && moveSpeed) {
@@ -11841,7 +11867,7 @@ class BaseMover {
11841
11867
  const velocity = particle.velocity.mult(moveSpeed),
11842
11868
  maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
11843
11869
 
11844
- if (gravityOptions.enable && gravityOptions.maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
11870
+ if (gravityOptions.enable && maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
11845
11871
  velocity.y = gravityFactor * maxSpeed;
11846
11872
 
11847
11873
  if (moveSpeed) {
@@ -14303,7 +14329,7 @@ class OpacityUpdater {
14303
14329
  min: getRangeMin(opacityOptions.value),
14304
14330
  value: getRangeValue(opacityOptions.value),
14305
14331
  loops: 0,
14306
- maxLoops: opacityOptions.animation.count
14332
+ maxLoops: getRangeValue(opacityOptions.animation.count)
14307
14333
  };
14308
14334
  const opacityAnimation = opacityOptions.animation;
14309
14335
 
@@ -14331,7 +14357,7 @@ class OpacityUpdater {
14331
14357
  break;
14332
14358
  }
14333
14359
 
14334
- particle.opacity.velocity = opacityAnimation.speed / 100 * this.container.retina.reduceFactor;
14360
+ particle.opacity.velocity = getRangeValue(opacityAnimation.speed) / 100 * this.container.retina.reduceFactor;
14335
14361
 
14336
14362
  if (!opacityAnimation.sync) {
14337
14363
  particle.opacity.velocity *= Math.random();
@@ -15618,7 +15644,7 @@ class LinkInstance {
15618
15644
 
15619
15645
  if (twinkling && twinkleRgb !== undefined) {
15620
15646
  colorLine = twinkleRgb;
15621
- opacity = twinkle.opacity;
15647
+ opacity = getRangeValue(twinkle.opacity);
15622
15648
  }
15623
15649
  }
15624
15650
 
@@ -16576,7 +16602,7 @@ class TiltUpdater {
16576
16602
  const tiltAnimation = particle.options.tilt.animation;
16577
16603
 
16578
16604
  if (tiltAnimation.enable) {
16579
- particle.tilt.velocity = tiltAnimation.speed / 360 * this.container.retina.reduceFactor;
16605
+ particle.tilt.velocity = getRangeValue(tiltAnimation.speed) / 360 * this.container.retina.reduceFactor;
16580
16606
 
16581
16607
  if (!tiltAnimation.sync) {
16582
16608
  particle.tilt.velocity *= Math.random();