@tsparticles/engine 3.2.1 → 3.3.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.
Files changed (144) hide show
  1. package/174.min.js +2 -0
  2. package/174.min.js.LICENSE.txt +1 -0
  3. package/browser/Core/Canvas.js +9 -9
  4. package/browser/Core/Container.js +7 -7
  5. package/browser/Core/Engine.js +1 -1
  6. package/browser/Core/Particle.js +12 -13
  7. package/browser/Core/Particles.js +30 -30
  8. package/browser/Core/Utils/EventListeners.js +4 -3
  9. package/browser/Core/Utils/InteractionManager.js +4 -4
  10. package/browser/Core/Utils/QuadTree.js +4 -5
  11. package/browser/Core/Utils/Ranges.js +55 -0
  12. package/browser/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
  13. package/browser/Options/Classes/AnimatableColor.js +1 -1
  14. package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
  15. package/browser/Options/Classes/Options.js +2 -1
  16. package/browser/Options/Classes/OptionsColor.js +1 -1
  17. package/browser/Options/Classes/Particles/Move/Move.js +1 -1
  18. package/browser/Types/RangeType.js +1 -0
  19. package/browser/Utils/CanvasUtils.js +14 -14
  20. package/browser/Utils/ColorUtils.js +2 -1
  21. package/browser/Utils/NumberUtils.js +2 -2
  22. package/browser/Utils/TypeUtils.js +18 -0
  23. package/browser/Utils/Utils.js +2 -19
  24. package/browser/exports.js +3 -5
  25. package/cjs/Core/Canvas.js +9 -9
  26. package/cjs/Core/Container.js +7 -7
  27. package/cjs/Core/Engine.js +2 -25
  28. package/cjs/Core/Particle.js +15 -16
  29. package/cjs/Core/Particles.js +32 -55
  30. package/cjs/Core/Utils/EventListeners.js +4 -3
  31. package/cjs/Core/Utils/InteractionManager.js +4 -4
  32. package/cjs/Core/Utils/QuadTree.js +7 -8
  33. package/cjs/Core/Utils/Ranges.js +61 -0
  34. package/cjs/Core/Utils/{Vector3d.js → Vectors.js} +18 -3
  35. package/cjs/Options/Classes/AnimatableColor.js +2 -2
  36. package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +2 -2
  37. package/cjs/Options/Classes/Options.js +2 -1
  38. package/cjs/Options/Classes/OptionsColor.js +2 -2
  39. package/cjs/Options/Classes/Particles/Move/Move.js +4 -4
  40. package/cjs/Types/RangeType.js +2 -0
  41. package/cjs/Utils/CanvasUtils.js +14 -14
  42. package/cjs/Utils/ColorUtils.js +9 -8
  43. package/cjs/Utils/NumberUtils.js +9 -9
  44. package/cjs/Utils/TypeUtils.js +27 -0
  45. package/cjs/Utils/Utils.js +13 -36
  46. package/cjs/exports.js +3 -5
  47. package/dist_browser_Core_Container_js.js +17 -7
  48. package/esm/Core/Canvas.js +9 -9
  49. package/esm/Core/Container.js +7 -7
  50. package/esm/Core/Engine.js +1 -1
  51. package/esm/Core/Particle.js +12 -13
  52. package/esm/Core/Particles.js +30 -30
  53. package/esm/Core/Utils/EventListeners.js +4 -3
  54. package/esm/Core/Utils/InteractionManager.js +4 -4
  55. package/esm/Core/Utils/QuadTree.js +4 -5
  56. package/esm/Core/Utils/Ranges.js +55 -0
  57. package/esm/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
  58. package/esm/Options/Classes/AnimatableColor.js +1 -1
  59. package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
  60. package/esm/Options/Classes/Options.js +2 -1
  61. package/esm/Options/Classes/OptionsColor.js +1 -1
  62. package/esm/Options/Classes/Particles/Move/Move.js +1 -1
  63. package/esm/Types/RangeType.js +1 -0
  64. package/esm/Utils/CanvasUtils.js +14 -14
  65. package/esm/Utils/ColorUtils.js +2 -1
  66. package/esm/Utils/NumberUtils.js +2 -2
  67. package/esm/Utils/TypeUtils.js +18 -0
  68. package/esm/Utils/Utils.js +2 -19
  69. package/esm/exports.js +3 -5
  70. package/package.json +1 -1
  71. package/report.html +1 -1
  72. package/tsparticles.engine.js +32 -52
  73. package/tsparticles.engine.min.js +1 -1
  74. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  75. package/types/Core/Canvas.d.ts +4 -4
  76. package/types/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  77. package/types/Core/Interfaces/IContainerPlugin.d.ts +4 -4
  78. package/types/Core/Interfaces/IEffectDrawer.d.ts +3 -3
  79. package/types/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  80. package/types/Core/Interfaces/IMovePathGenerator.d.ts +3 -3
  81. package/types/Core/Interfaces/IParticleMover.d.ts +2 -2
  82. package/types/Core/Interfaces/IParticleUpdater.d.ts +2 -2
  83. package/types/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
  84. package/types/Core/Interfaces/IShapeDrawer.d.ts +4 -4
  85. package/types/Core/Particle.d.ts +3 -4
  86. package/types/Core/Particles.d.ts +7 -7
  87. package/types/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  88. package/types/Core/Utils/InteractionManager.d.ts +2 -2
  89. package/types/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  90. package/types/Core/Utils/QuadTree.d.ts +2 -3
  91. package/types/Core/Utils/Ranges.d.ts +21 -0
  92. package/types/Core/Utils/{Vector3d.d.ts → Vectors.d.ts} +6 -0
  93. package/types/Types/RangeType.d.ts +4 -0
  94. package/types/Utils/CanvasUtils.d.ts +6 -6
  95. package/types/Utils/NumberUtils.d.ts +1 -1
  96. package/types/Utils/TypeUtils.d.ts +6 -0
  97. package/types/Utils/Utils.d.ts +0 -6
  98. package/types/exports.d.ts +3 -5
  99. package/umd/Core/Canvas.js +9 -9
  100. package/umd/Core/Container.js +7 -7
  101. package/umd/Core/Engine.js +1 -1
  102. package/umd/Core/Particle.js +16 -17
  103. package/umd/Core/Particles.js +33 -57
  104. package/umd/Core/Utils/EventListeners.js +5 -4
  105. package/umd/Core/Utils/InteractionManager.js +4 -4
  106. package/umd/Core/Utils/QuadTree.js +8 -9
  107. package/umd/Core/Utils/Ranges.js +71 -0
  108. package/umd/Core/Utils/{Vector3d.js → Vectors.js} +19 -4
  109. package/umd/Options/Classes/AnimatableColor.js +3 -3
  110. package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +3 -3
  111. package/umd/Options/Classes/Options.js +3 -2
  112. package/umd/Options/Classes/OptionsColor.js +3 -3
  113. package/umd/Options/Classes/Particles/Move/Move.js +5 -5
  114. package/umd/{Core/Utils/Range.js → Types/RangeType.js} +0 -10
  115. package/umd/Utils/CanvasUtils.js +14 -14
  116. package/umd/Utils/ColorUtils.js +10 -9
  117. package/umd/Utils/NumberUtils.js +10 -10
  118. package/umd/Utils/TypeUtils.js +37 -0
  119. package/umd/Utils/Utils.js +14 -37
  120. package/umd/exports.js +4 -6
  121. package/373.min.js +0 -2
  122. package/373.min.js.LICENSE.txt +0 -1
  123. package/438.min.js +0 -2
  124. package/438.min.js.LICENSE.txt +0 -1
  125. package/browser/Core/Utils/Circle.js +0 -28
  126. package/browser/Core/Utils/Range.js +0 -8
  127. package/browser/Core/Utils/Rectangle.js +0 -22
  128. package/browser/Core/Utils/Vector.js +0 -20
  129. package/cjs/Core/Utils/Circle.js +0 -32
  130. package/cjs/Core/Utils/Range.js +0 -12
  131. package/cjs/Core/Utils/Rectangle.js +0 -26
  132. package/cjs/Core/Utils/Vector.js +0 -24
  133. package/dist_browser_Core_Particle_js.js +0 -32
  134. package/esm/Core/Utils/Circle.js +0 -28
  135. package/esm/Core/Utils/Range.js +0 -8
  136. package/esm/Core/Utils/Rectangle.js +0 -22
  137. package/esm/Core/Utils/Vector.js +0 -20
  138. package/types/Core/Utils/Circle.d.ts +0 -8
  139. package/types/Core/Utils/Range.d.ts +0 -7
  140. package/types/Core/Utils/Rectangle.d.ts +0 -9
  141. package/types/Core/Utils/Vector.d.ts +0 -8
  142. package/umd/Core/Utils/Circle.js +0 -42
  143. package/umd/Core/Utils/Rectangle.js +0 -36
  144. package/umd/Core/Utils/Vector.js +0 -34
@@ -0,0 +1,71 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "../../Utils/NumberUtils.js"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Rectangle = exports.Circle = exports.BaseRange = void 0;
13
+ const NumberUtils_js_1 = require("../../Utils/NumberUtils.js");
14
+ const squareExp = 2;
15
+ class BaseRange {
16
+ constructor(x, y, type) {
17
+ this.position = {
18
+ x: x,
19
+ y: y,
20
+ };
21
+ this.type = type;
22
+ }
23
+ }
24
+ exports.BaseRange = BaseRange;
25
+ class Circle extends BaseRange {
26
+ constructor(x, y, radius) {
27
+ super(x, y, "circle");
28
+ this.radius = radius;
29
+ }
30
+ contains(point) {
31
+ return (0, NumberUtils_js_1.getDistance)(point, this.position) <= this.radius;
32
+ }
33
+ intersects(range) {
34
+ const pos1 = this.position, pos2 = range.position, distPos = { x: Math.abs(pos2.x - pos1.x), y: Math.abs(pos2.y - pos1.y) }, r = this.radius;
35
+ if (range instanceof Circle || range.type === "circle") {
36
+ const circleRange = range, rSum = r + circleRange.radius, dist = Math.sqrt(distPos.x ** squareExp + distPos.y ** squareExp);
37
+ return rSum > dist;
38
+ }
39
+ else if (range instanceof Rectangle || range.type === "rectangle") {
40
+ const rectRange = range, { width, height } = rectRange.size, edges = Math.pow(distPos.x - width, squareExp) + Math.pow(distPos.y - height, squareExp);
41
+ return (edges <= r ** squareExp ||
42
+ (distPos.x <= r + width && distPos.y <= r + height) ||
43
+ distPos.x <= width ||
44
+ distPos.y <= height);
45
+ }
46
+ return false;
47
+ }
48
+ }
49
+ exports.Circle = Circle;
50
+ class Rectangle extends BaseRange {
51
+ constructor(x, y, width, height) {
52
+ super(x, y, "rectangle");
53
+ this.size = {
54
+ height: height,
55
+ width: width,
56
+ };
57
+ }
58
+ contains(point) {
59
+ const w = this.size.width, h = this.size.height, pos = this.position;
60
+ return point.x >= pos.x && point.x <= pos.x + w && point.y >= pos.y && point.y <= pos.y + h;
61
+ }
62
+ intersects(range) {
63
+ if (range instanceof Circle) {
64
+ return range.intersects(this);
65
+ }
66
+ const w = this.size.width, h = this.size.height, pos1 = this.position, pos2 = range.position, size2 = range instanceof Rectangle ? range.size : { width: 0, height: 0 }, w2 = size2.width, h2 = size2.height;
67
+ return pos2.x < pos1.x + w && pos2.x + w2 > pos1.x && pos2.y < pos1.y + h && pos2.y + h2 > pos1.y;
68
+ }
69
+ }
70
+ exports.Rectangle = Rectangle;
71
+ });
@@ -4,14 +4,14 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Constants.js", "../../Utils/Utils.js"], factory);
7
+ define(["require", "exports", "./Constants.js", "../../Utils/TypeUtils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Vector3d = void 0;
12
+ exports.Vector = exports.Vector3d = void 0;
13
13
  const Constants_js_1 = require("./Constants.js");
14
- const Utils_js_1 = require("../../Utils/Utils.js");
14
+ const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
15
15
  const origin = {
16
16
  x: 0,
17
17
  y: 0,
@@ -23,7 +23,7 @@
23
23
  this.x = Math.cos(angle) * length;
24
24
  this.y = Math.sin(angle) * length;
25
25
  };
26
- if (!(0, Utils_js_1.isNumber)(xOrCoords) && xOrCoords) {
26
+ if (!(0, TypeUtils_js_1.isNumber)(xOrCoords) && xOrCoords) {
27
27
  this.x = xOrCoords.x;
28
28
  this.y = xOrCoords.y;
29
29
  const coords3d = xOrCoords;
@@ -120,4 +120,19 @@
120
120
  }
121
121
  }
122
122
  exports.Vector3d = Vector3d;
123
+ class Vector extends Vector3d {
124
+ constructor(xOrCoords, y) {
125
+ super(xOrCoords, y, origin.z);
126
+ }
127
+ static get origin() {
128
+ return Vector.create(origin.x, origin.y);
129
+ }
130
+ static clone(source) {
131
+ return Vector.create(source.x, source.y);
132
+ }
133
+ static create(x, y) {
134
+ return new Vector(x, y);
135
+ }
136
+ }
137
+ exports.Vector = Vector;
123
138
  });
@@ -4,13 +4,13 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../../Utils/Utils.js", "./HslAnimation.js", "./OptionsColor.js"], factory);
7
+ define(["require", "exports", "../../Utils/TypeUtils.js", "./HslAnimation.js", "./OptionsColor.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AnimatableColor = void 0;
13
- const Utils_js_1 = require("../../Utils/Utils.js");
13
+ const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
14
14
  const HslAnimation_js_1 = require("./HslAnimation.js");
15
15
  const OptionsColor_js_1 = require("./OptionsColor.js");
16
16
  class AnimatableColor extends OptionsColor_js_1.OptionsColor {
@@ -22,7 +22,7 @@
22
22
  const color = new AnimatableColor();
23
23
  color.load(source);
24
24
  if (data !== undefined) {
25
- if ((0, Utils_js_1.isString)(data) || (0, Utils_js_1.isArray)(data)) {
25
+ if ((0, TypeUtils_js_1.isString)(data) || (0, TypeUtils_js_1.isArray)(data)) {
26
26
  color.load({ value: data });
27
27
  }
28
28
  else {
@@ -4,14 +4,14 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./BackgroundMaskCover.js", "../../../Utils/Utils.js"], factory);
7
+ define(["require", "exports", "./BackgroundMaskCover.js", "../../../Utils/TypeUtils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BackgroundMask = void 0;
13
13
  const BackgroundMaskCover_js_1 = require("./BackgroundMaskCover.js");
14
- const Utils_js_1 = require("../../../Utils/Utils.js");
14
+ const TypeUtils_js_1 = require("../../../Utils/TypeUtils.js");
15
15
  class BackgroundMask {
16
16
  constructor() {
17
17
  this.composite = "destination-out";
@@ -26,7 +26,7 @@
26
26
  this.composite = data.composite;
27
27
  }
28
28
  if (data.cover !== undefined) {
29
- const cover = data.cover, color = ((0, Utils_js_1.isString)(data.cover) ? { color: data.cover } : data.cover);
29
+ const cover = data.cover, color = ((0, TypeUtils_js_1.isString)(data.cover) ? { color: data.cover } : data.cover);
30
30
  this.cover.load(cover.color !== undefined || cover.image !== undefined ? cover : { color: color });
31
31
  }
32
32
  if (data.enable !== undefined) {
@@ -4,7 +4,7 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../../Utils/Utils.js", "./Background/Background.js", "./BackgroundMask/BackgroundMask.js", "./FullScreen/FullScreen.js", "./Interactivity/Interactivity.js", "./ManualParticle.js", "./Responsive.js", "./Theme/Theme.js", "../../Utils/OptionsUtils.js", "../../Utils/NumberUtils.js"], factory);
7
+ define(["require", "exports", "../../Utils/Utils.js", "./Background/Background.js", "./BackgroundMask/BackgroundMask.js", "./FullScreen/FullScreen.js", "./Interactivity/Interactivity.js", "./ManualParticle.js", "./Responsive.js", "./Theme/Theme.js", "../../Utils/TypeUtils.js", "../../Utils/OptionsUtils.js", "../../Utils/NumberUtils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -18,6 +18,7 @@
18
18
  const ManualParticle_js_1 = require("./ManualParticle.js");
19
19
  const Responsive_js_1 = require("./Responsive.js");
20
20
  const Theme_js_1 = require("./Theme/Theme.js");
21
+ const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
21
22
  const OptionsUtils_js_1 = require("../../Utils/OptionsUtils.js");
22
23
  const NumberUtils_js_1 = require("../../Utils/NumberUtils.js");
23
24
  class Options {
@@ -96,7 +97,7 @@
96
97
  }
97
98
  this.background.load(data.background);
98
99
  const fullScreen = data.fullScreen;
99
- if ((0, Utils_js_1.isBoolean)(fullScreen)) {
100
+ if ((0, TypeUtils_js_1.isBoolean)(fullScreen)) {
100
101
  this.fullScreen.enable = fullScreen;
101
102
  }
102
103
  else {
@@ -4,13 +4,13 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../../Utils/Utils.js"], factory);
7
+ define(["require", "exports", "../../Utils/TypeUtils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OptionsColor = void 0;
13
- const Utils_js_1 = require("../../Utils/Utils.js");
13
+ const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
14
14
  class OptionsColor {
15
15
  constructor() {
16
16
  this.value = "";
@@ -19,7 +19,7 @@
19
19
  const color = new OptionsColor();
20
20
  color.load(source);
21
21
  if (data !== undefined) {
22
- if ((0, Utils_js_1.isString)(data) || (0, Utils_js_1.isArray)(data)) {
22
+ if ((0, TypeUtils_js_1.isString)(data) || (0, TypeUtils_js_1.isArray)(data)) {
23
23
  color.load({ value: data });
24
24
  }
25
25
  else {
@@ -4,13 +4,13 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../../../../Utils/Utils.js", "./MoveAngle.js", "./MoveAttract.js", "./MoveCenter.js", "./MoveGravity.js", "./Path/MovePath.js", "./MoveTrail.js", "./OutModes.js", "./Spin.js", "../../../../Utils/NumberUtils.js"], factory);
7
+ define(["require", "exports", "../../../../Utils/TypeUtils.js", "./MoveAngle.js", "./MoveAttract.js", "./MoveCenter.js", "./MoveGravity.js", "./Path/MovePath.js", "./MoveTrail.js", "./OutModes.js", "./Spin.js", "../../../../Utils/NumberUtils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Move = void 0;
13
- const Utils_js_1 = require("../../../../Utils/Utils.js");
13
+ const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
14
14
  const MoveAngle_js_1 = require("./MoveAngle.js");
15
15
  const MoveAttract_js_1 = require("./MoveAttract.js");
16
16
  const MoveCenter_js_1 = require("./MoveCenter.js");
@@ -46,7 +46,7 @@
46
46
  if (!data) {
47
47
  return;
48
48
  }
49
- this.angle.load((0, Utils_js_1.isNumber)(data.angle) ? { value: data.angle } : data.angle);
49
+ this.angle.load((0, TypeUtils_js_1.isNumber)(data.angle) ? { value: data.angle } : data.angle);
50
50
  this.attract.load(data.attract);
51
51
  this.center.load(data.center);
52
52
  if (data.decay !== undefined) {
@@ -56,7 +56,7 @@
56
56
  this.direction = data.direction;
57
57
  }
58
58
  if (data.distance !== undefined) {
59
- this.distance = (0, Utils_js_1.isNumber)(data.distance)
59
+ this.distance = (0, TypeUtils_js_1.isNumber)(data.distance)
60
60
  ? {
61
61
  horizontal: data.distance,
62
62
  vertical: data.distance,
@@ -72,7 +72,7 @@
72
72
  this.gravity.load(data.gravity);
73
73
  const outModes = data.outModes;
74
74
  if (outModes !== undefined) {
75
- if ((0, Utils_js_1.isObject)(outModes)) {
75
+ if ((0, TypeUtils_js_1.isObject)(outModes)) {
76
76
  this.outModes.load(outModes);
77
77
  }
78
78
  else {
@@ -9,14 +9,4 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Range = void 0;
13
- class Range {
14
- constructor(x, y) {
15
- this.position = {
16
- x: x,
17
- y: y,
18
- };
19
- }
20
- }
21
- exports.Range = Range;
22
12
  });
@@ -37,7 +37,7 @@
37
37
  context.clearRect(origin.x, origin.y, dimension.width, dimension.height);
38
38
  }
39
39
  exports.clear = clear;
40
- async function drawParticle(data) {
40
+ function drawParticle(data) {
41
41
  const { container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow, transform, } = data, pos = particle.getPosition(), defaultAngle = 0, angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : defaultAngle), rotateData = {
42
42
  sin: Math.sin(angle),
43
43
  cos: Math.cos(angle),
@@ -76,14 +76,14 @@
76
76
  transformData,
77
77
  strokeWidth,
78
78
  };
79
- await drawShape(drawData);
80
- await drawShapeAfterDraw(drawData);
81
- await drawEffect(drawData);
79
+ drawShape(drawData);
80
+ drawShapeAfterDraw(drawData);
81
+ drawEffect(drawData);
82
82
  context.globalCompositeOperation = "source-over";
83
83
  context.resetTransform();
84
84
  }
85
85
  exports.drawParticle = drawParticle;
86
- async function drawEffect(data) {
86
+ function drawEffect(data) {
87
87
  const { container, context, particle, radius, opacity, delta, transformData } = data;
88
88
  if (!particle.effect) {
89
89
  return;
@@ -92,7 +92,7 @@
92
92
  if (!drawer) {
93
93
  return;
94
94
  }
95
- await drawer.draw({
95
+ drawer.draw({
96
96
  context,
97
97
  particle,
98
98
  radius,
@@ -103,7 +103,7 @@
103
103
  });
104
104
  }
105
105
  exports.drawEffect = drawEffect;
106
- async function drawShape(data) {
106
+ function drawShape(data) {
107
107
  const { container, context, particle, radius, opacity, delta, strokeWidth, transformData } = data, minStrokeWidth = 0;
108
108
  if (!particle.shape) {
109
109
  return;
@@ -113,7 +113,7 @@
113
113
  return;
114
114
  }
115
115
  context.beginPath();
116
- await drawer.draw({
116
+ drawer.draw({
117
117
  context,
118
118
  particle,
119
119
  radius,
@@ -133,7 +133,7 @@
133
133
  }
134
134
  }
135
135
  exports.drawShape = drawShape;
136
- async function drawShapeAfterDraw(data) {
136
+ function drawShapeAfterDraw(data) {
137
137
  const { container, context, particle, radius, opacity, delta, transformData } = data;
138
138
  if (!particle.shape) {
139
139
  return;
@@ -142,7 +142,7 @@
142
142
  if (!drawer?.afterDraw) {
143
143
  return;
144
144
  }
145
- await drawer.afterDraw({
145
+ drawer.afterDraw({
146
146
  context,
147
147
  particle,
148
148
  radius,
@@ -153,18 +153,18 @@
153
153
  });
154
154
  }
155
155
  exports.drawShapeAfterDraw = drawShapeAfterDraw;
156
- async function drawPlugin(context, plugin, delta) {
156
+ function drawPlugin(context, plugin, delta) {
157
157
  if (!plugin.draw) {
158
158
  return;
159
159
  }
160
- await plugin.draw(context, delta);
160
+ plugin.draw(context, delta);
161
161
  }
162
162
  exports.drawPlugin = drawPlugin;
163
- async function drawParticlePlugin(context, plugin, particle, delta) {
163
+ function drawParticlePlugin(context, plugin, particle, delta) {
164
164
  if (!plugin.drawParticle) {
165
165
  return;
166
166
  }
167
- await plugin.drawParticle(context, particle, delta);
167
+ plugin.drawParticle(context, particle, delta);
168
168
  }
169
169
  exports.drawParticlePlugin = drawParticlePlugin;
170
170
  function alterHsl(color, type, value) {
@@ -4,15 +4,16 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./NumberUtils.js", "./Utils.js", "../Core/Utils/Constants.js"], factory);
7
+ define(["require", "exports", "./NumberUtils.js", "./TypeUtils.js", "../Core/Utils/Constants.js", "./Utils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.updateColor = exports.updateColorValue = exports.getHslAnimationFromHsl = exports.getHslFromAnimation = exports.getLinkRandomColor = exports.getLinkColor = exports.colorMix = exports.getStyleFromHsl = exports.getStyleFromRgb = exports.getRandomRgbColor = exports.hslaToRgba = exports.hslToRgb = exports.stringToRgb = exports.stringToAlpha = exports.rgbToHsl = exports.rangeColorToHsl = exports.colorToHsl = exports.colorToRgb = exports.rangeColorToRgb = exports.addColorManager = void 0;
13
13
  const NumberUtils_js_1 = require("./NumberUtils.js");
14
- const Utils_js_1 = require("./Utils.js");
14
+ const TypeUtils_js_1 = require("./TypeUtils.js");
15
15
  const Constants_js_1 = require("../Core/Utils/Constants.js");
16
+ const Utils_js_1 = require("./Utils.js");
16
17
  const randomColorValue = "random", midColorValue = "mid", colorManagers = new Map();
17
18
  function addColorManager(manager) {
18
19
  colorManagers.set(manager.key, manager);
@@ -42,11 +43,11 @@
42
43
  if (!input) {
43
44
  return;
44
45
  }
45
- const color = (0, Utils_js_1.isString)(input) ? { value: input } : input;
46
- if ((0, Utils_js_1.isString)(color.value)) {
46
+ const color = (0, TypeUtils_js_1.isString)(input) ? { value: input } : input;
47
+ if ((0, TypeUtils_js_1.isString)(color.value)) {
47
48
  return colorToRgb(color.value, index, useIndex);
48
49
  }
49
- if ((0, Utils_js_1.isArray)(color.value)) {
50
+ if ((0, TypeUtils_js_1.isArray)(color.value)) {
50
51
  return rangeColorToRgb({
51
52
  value: (0, Utils_js_1.itemFromArray)(color.value, index, useIndex),
52
53
  });
@@ -63,11 +64,11 @@
63
64
  if (!input) {
64
65
  return;
65
66
  }
66
- const color = (0, Utils_js_1.isString)(input) ? { value: input } : input;
67
- if ((0, Utils_js_1.isString)(color.value)) {
67
+ const color = (0, TypeUtils_js_1.isString)(input) ? { value: input } : input;
68
+ if ((0, TypeUtils_js_1.isString)(color.value)) {
68
69
  return color.value === randomColorValue ? getRandomRgbColor() : stringToRgb(color.value);
69
70
  }
70
- if ((0, Utils_js_1.isArray)(color.value)) {
71
+ if ((0, TypeUtils_js_1.isArray)(color.value)) {
71
72
  return colorToRgb({
72
73
  value: (0, Utils_js_1.itemFromArray)(color.value, index, useIndex),
73
74
  });
@@ -220,7 +221,7 @@
220
221
  }
221
222
  exports.getLinkColor = getLinkColor;
222
223
  function getLinkRandomColor(optColor, blink, consent) {
223
- const color = (0, Utils_js_1.isString)(optColor) ? optColor : optColor.value;
224
+ const color = (0, TypeUtils_js_1.isString)(optColor) ? optColor : optColor.value;
224
225
  if (color === randomColorValue) {
225
226
  if (consent) {
226
227
  return rangeColorToRgb({
@@ -4,14 +4,14 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../Core/Utils/Vector.js", "./Utils.js", "../Core/Utils/Constants.js"], factory);
7
+ define(["require", "exports", "../Core/Utils/Vectors.js", "./TypeUtils.js", "../Core/Utils/Constants.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.parseAlpha = exports.calcExactPositionOrRandomFromSizeRanged = exports.calcExactPositionOrRandomFromSize = exports.calcPositionOrRandomFromSizeRanged = exports.calcPositionOrRandomFromSize = exports.calcPositionFromSize = exports.collisionVelocity = exports.getParticleBaseVelocity = exports.getParticleDirectionAngle = exports.degToRad = exports.getDistance = exports.getDistances = exports.setRangeValue = exports.getRangeMax = exports.getRangeMin = exports.getRangeValue = exports.randomInRange = exports.mix = exports.clamp = exports.getRandom = exports.setRandom = exports.getEasing = exports.addEasing = void 0;
13
- const Vector_js_1 = require("../Core/Utils/Vector.js");
14
- const Utils_js_1 = require("./Utils.js");
13
+ const Vectors_js_1 = require("../Core/Utils/Vectors.js");
14
+ const TypeUtils_js_1 = require("./TypeUtils.js");
15
15
  const Constants_js_1 = require("../Core/Utils/Constants.js");
16
16
  let _random = Math.random;
17
17
  const easings = new Map(), double = 2, doublePI = Math.PI * double;
@@ -53,19 +53,19 @@
53
53
  }
54
54
  exports.randomInRange = randomInRange;
55
55
  function getRangeValue(value) {
56
- return (0, Utils_js_1.isNumber)(value) ? value : randomInRange(value);
56
+ return (0, TypeUtils_js_1.isNumber)(value) ? value : randomInRange(value);
57
57
  }
58
58
  exports.getRangeValue = getRangeValue;
59
59
  function getRangeMin(value) {
60
- return (0, Utils_js_1.isNumber)(value) ? value : value.min;
60
+ return (0, TypeUtils_js_1.isNumber)(value) ? value : value.min;
61
61
  }
62
62
  exports.getRangeMin = getRangeMin;
63
63
  function getRangeMax(value) {
64
- return (0, Utils_js_1.isNumber)(value) ? value : value.max;
64
+ return (0, TypeUtils_js_1.isNumber)(value) ? value : value.max;
65
65
  }
66
66
  exports.getRangeMax = getRangeMax;
67
67
  function setRangeValue(source, value) {
68
- if (source === value || (value === undefined && (0, Utils_js_1.isNumber)(source))) {
68
+ if (source === value || (value === undefined && (0, TypeUtils_js_1.isNumber)(source))) {
69
69
  return source;
70
70
  }
71
71
  const min = getRangeMin(source), max = getRangeMax(source);
@@ -92,7 +92,7 @@
92
92
  }
93
93
  exports.degToRad = degToRad;
94
94
  function getParticleDirectionAngle(direction, position, center) {
95
- if ((0, Utils_js_1.isNumber)(direction)) {
95
+ if ((0, TypeUtils_js_1.isNumber)(direction)) {
96
96
  return degToRad(direction);
97
97
  }
98
98
  const empty = 0, half = 0.5, quarter = 0.25, threeQuarter = half + quarter;
@@ -123,7 +123,7 @@
123
123
  }
124
124
  exports.getParticleDirectionAngle = getParticleDirectionAngle;
125
125
  function getParticleBaseVelocity(direction) {
126
- const baseVelocity = Vector_js_1.Vector.origin;
126
+ const baseVelocity = Vectors_js_1.Vector.origin;
127
127
  baseVelocity.length = 1;
128
128
  baseVelocity.angle = direction;
129
129
  return baseVelocity;
@@ -131,7 +131,7 @@
131
131
  exports.getParticleBaseVelocity = getParticleBaseVelocity;
132
132
  function collisionVelocity(v1, v2, m1, m2) {
133
133
  const double = 2;
134
- return Vector_js_1.Vector.create((v1.x * (m1 - m2)) / (m1 + m2) + (v2.x * double * m2) / (m1 + m2), v1.y);
134
+ return Vectors_js_1.Vector.create((v1.x * (m1 - m2)) / (m1 + m2) + (v2.x * double * m2) / (m1 + m2), v1.y);
135
135
  }
136
136
  exports.collisionVelocity = collisionVelocity;
137
137
  function calcPositionFromSize(data) {
@@ -0,0 +1,37 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isArray = exports.isObject = exports.isFunction = exports.isNumber = exports.isString = exports.isBoolean = void 0;
13
+ function isBoolean(arg) {
14
+ return typeof arg === "boolean";
15
+ }
16
+ exports.isBoolean = isBoolean;
17
+ function isString(arg) {
18
+ return typeof arg === "string";
19
+ }
20
+ exports.isString = isString;
21
+ function isNumber(arg) {
22
+ return typeof arg === "number";
23
+ }
24
+ exports.isNumber = isNumber;
25
+ function isFunction(arg) {
26
+ return typeof arg === "function";
27
+ }
28
+ exports.isFunction = isFunction;
29
+ function isObject(arg) {
30
+ return typeof arg === "object" && arg !== null;
31
+ }
32
+ exports.isObject = isObject;
33
+ function isArray(arg) {
34
+ return Array.isArray(arg);
35
+ }
36
+ exports.isArray = isArray;
37
+ });