@tsparticles/engine 4.0.0-alpha.24 → 4.0.0-alpha.26

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 (100) hide show
  1. package/622.min.js +1 -0
  2. package/README.md +2 -2
  3. package/browser/Core/Engine.js +1 -18
  4. package/browser/Core/Particle.js +2 -23
  5. package/browser/Core/Particles.js +8 -37
  6. package/browser/Core/Utils/Constants.js +1 -1
  7. package/browser/Core/Utils/Ranges.js +2 -2
  8. package/browser/Core/Utils/SpatialHashGrid.js +82 -0
  9. package/browser/Core/Utils/Vectors.js +12 -16
  10. package/browser/Options/Classes/Particles/Move/Move.js +0 -4
  11. package/browser/Utils/CanvasUtils.js +29 -32
  12. package/browser/Utils/MathUtils.js +8 -1
  13. package/browser/Utils/Utils.js +10 -14
  14. package/browser/exports.js +0 -2
  15. package/cjs/Core/Engine.js +1 -18
  16. package/cjs/Core/Particle.js +2 -23
  17. package/cjs/Core/Particles.js +8 -37
  18. package/cjs/Core/Utils/Constants.js +1 -1
  19. package/cjs/Core/Utils/Ranges.js +2 -2
  20. package/cjs/Core/Utils/SpatialHashGrid.js +82 -0
  21. package/cjs/Core/Utils/Vectors.js +12 -16
  22. package/cjs/Options/Classes/Particles/Move/Move.js +0 -4
  23. package/cjs/Utils/CanvasUtils.js +29 -32
  24. package/cjs/Utils/MathUtils.js +8 -1
  25. package/cjs/Utils/Utils.js +10 -14
  26. package/cjs/exports.js +0 -2
  27. package/dist_browser_Core_Container_js.js +8 -8
  28. package/esm/Core/Engine.js +1 -18
  29. package/esm/Core/Particle.js +2 -23
  30. package/esm/Core/Particles.js +8 -37
  31. package/esm/Core/Utils/Constants.js +1 -1
  32. package/esm/Core/Utils/Ranges.js +2 -2
  33. package/esm/Core/Utils/SpatialHashGrid.js +82 -0
  34. package/esm/Core/Utils/Vectors.js +12 -16
  35. package/esm/Options/Classes/Particles/Move/Move.js +0 -4
  36. package/esm/Utils/CanvasUtils.js +29 -32
  37. package/esm/Utils/MathUtils.js +8 -1
  38. package/esm/Utils/Utils.js +10 -14
  39. package/esm/exports.js +0 -2
  40. package/package.json +1 -1
  41. package/report.html +1 -1
  42. package/scripts/install.js +2 -2
  43. package/tsparticles.engine.js +11 -31
  44. package/tsparticles.engine.min.js +2 -2
  45. package/types/Core/Engine.d.ts +1 -9
  46. package/types/Core/Particle.d.ts +0 -4
  47. package/types/Core/Particles.d.ts +2 -7
  48. package/types/Core/Utils/Constants.d.ts +1 -1
  49. package/types/Core/Utils/SpatialHashGrid.d.ts +18 -0
  50. package/types/Core/Utils/Vectors.d.ts +8 -10
  51. package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
  52. package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
  53. package/types/Types/EngineInitializers.d.ts +0 -6
  54. package/types/Utils/CanvasUtils.d.ts +6 -7
  55. package/types/Utils/MathUtils.d.ts +2 -0
  56. package/types/export-types.d.ts +1 -4
  57. package/types/exports.d.ts +0 -2
  58. package/umd/Core/Engine.js +1 -18
  59. package/umd/Core/Particle.js +3 -24
  60. package/umd/Core/Particles.js +8 -37
  61. package/umd/Core/Utils/Constants.js +2 -2
  62. package/umd/Core/Utils/Ranges.js +1 -1
  63. package/umd/Core/Utils/SpatialHashGrid.js +96 -0
  64. package/umd/Core/Utils/Vectors.js +12 -16
  65. package/umd/Options/Classes/Particles/Move/Move.js +1 -5
  66. package/umd/Utils/CanvasUtils.js +29 -32
  67. package/umd/Utils/MathUtils.js +10 -1
  68. package/umd/Utils/Utils.js +10 -14
  69. package/umd/exports.js +1 -3
  70. package/515.min.js +0 -1
  71. package/browser/Core/Interfaces/IMovePathGenerator.js +0 -1
  72. package/browser/Core/Interfaces/IParticleMover.js +0 -1
  73. package/browser/Core/Utils/Point.js +0 -8
  74. package/browser/Core/Utils/QuadTree.js +0 -85
  75. package/browser/Options/Classes/Particles/Move/MoveAttract.js +0 -36
  76. package/browser/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
  77. package/cjs/Core/Interfaces/IMovePathGenerator.js +0 -1
  78. package/cjs/Core/Interfaces/IParticleMover.js +0 -1
  79. package/cjs/Core/Utils/Point.js +0 -8
  80. package/cjs/Core/Utils/QuadTree.js +0 -85
  81. package/cjs/Options/Classes/Particles/Move/MoveAttract.js +0 -36
  82. package/cjs/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
  83. package/esm/Core/Interfaces/IMovePathGenerator.js +0 -1
  84. package/esm/Core/Interfaces/IParticleMover.js +0 -1
  85. package/esm/Core/Utils/Point.js +0 -8
  86. package/esm/Core/Utils/QuadTree.js +0 -85
  87. package/esm/Options/Classes/Particles/Move/MoveAttract.js +0 -36
  88. package/esm/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
  89. package/types/Core/Interfaces/IMovePathGenerator.d.ts +0 -9
  90. package/types/Core/Interfaces/IParticleMover.d.ts +0 -7
  91. package/types/Core/Utils/Point.d.ts +0 -7
  92. package/types/Core/Utils/QuadTree.d.ts +0 -17
  93. package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -12
  94. package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -7
  95. package/umd/Core/Interfaces/IMovePathGenerator.js +0 -12
  96. package/umd/Core/Interfaces/IParticleMover.js +0 -12
  97. package/umd/Core/Utils/Point.js +0 -22
  98. package/umd/Core/Utils/QuadTree.js +0 -99
  99. package/umd/Options/Classes/Particles/Move/MoveAttract.js +0 -50
  100. package/umd/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -12
@@ -1,22 +0,0 @@
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.Point = void 0;
13
- class Point {
14
- particle;
15
- position;
16
- constructor(position, particle) {
17
- this.position = position;
18
- this.particle = particle;
19
- }
20
- }
21
- exports.Point = Point;
22
- });
@@ -1,99 +0,0 @@
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", "./Ranges.js", "./Constants.js", "../../Utils/MathUtils.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.QuadTree = void 0;
13
- const Ranges_js_1 = require("./Ranges.js");
14
- const Constants_js_1 = require("./Constants.js");
15
- const MathUtils_js_1 = require("../../Utils/MathUtils.js");
16
- class QuadTree {
17
- rectangle;
18
- capacity;
19
- _points = [];
20
- _subs = null;
21
- constructor(rectangle, capacity) {
22
- this.rectangle = rectangle;
23
- this.capacity = capacity;
24
- }
25
- insert(point) {
26
- if (!this.rectangle.contains(point.position)) {
27
- return false;
28
- }
29
- const subs = this._subs;
30
- if (!subs) {
31
- if (this._points.length < this.capacity) {
32
- this._points.push(point);
33
- return true;
34
- }
35
- this._subdivide();
36
- const newSubs = this._subs;
37
- for (const p of this._points) {
38
- for (let s = 0; s < Constants_js_1.subdivideCount; s++) {
39
- if (newSubs?.[s]?.insert(p)) {
40
- break;
41
- }
42
- }
43
- }
44
- this._points.length = 0;
45
- for (let s = 0; s < Constants_js_1.subdivideCount; s++) {
46
- if (newSubs?.[s]?.insert(point)) {
47
- return true;
48
- }
49
- }
50
- return false;
51
- }
52
- for (let s = 0; s < Constants_js_1.subdivideCount; s++) {
53
- if (subs[s]?.insert(point)) {
54
- return true;
55
- }
56
- }
57
- return false;
58
- }
59
- query(range, check, out = []) {
60
- if (!range.intersects(this.rectangle)) {
61
- return out;
62
- }
63
- const points = this._points;
64
- for (const p of points) {
65
- const particle = p.particle;
66
- if (!range.contains(p.position) && (0, MathUtils_js_1.getDistance)(range.position, p.position) > particle.getRadius()) {
67
- continue;
68
- }
69
- if (check && !check(particle)) {
70
- continue;
71
- }
72
- out.push(particle);
73
- }
74
- const subs = this._subs;
75
- if (subs) {
76
- for (const s of subs) {
77
- s.query(range, check, out);
78
- }
79
- }
80
- return out;
81
- }
82
- queryCircle(position, radius, check) {
83
- return this.query(new Ranges_js_1.Circle(position.x, position.y, radius), check);
84
- }
85
- queryRectangle(position, size, check) {
86
- return this.query(new Ranges_js_1.Rectangle(position.x, position.y, size.width, size.height), check);
87
- }
88
- _subdivide() {
89
- const rect = this.rectangle, { x, y } = rect.position, { width, height } = rect.size, halfWidth = width * Constants_js_1.half, halfHeight = height * Constants_js_1.half, capacity = this.capacity;
90
- this._subs = [
91
- new QuadTree(new Ranges_js_1.Rectangle(x, y, halfWidth, halfHeight), capacity),
92
- new QuadTree(new Ranges_js_1.Rectangle(x + halfWidth, y, halfWidth, halfHeight), capacity),
93
- new QuadTree(new Ranges_js_1.Rectangle(x, y + halfHeight, halfWidth, halfHeight), capacity),
94
- new QuadTree(new Ranges_js_1.Rectangle(x + halfWidth, y + halfHeight, halfWidth, halfHeight), capacity),
95
- ];
96
- }
97
- }
98
- exports.QuadTree = QuadTree;
99
- });
@@ -1,50 +0,0 @@
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/TypeUtils.js", "../../../../Utils/MathUtils.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MoveAttract = void 0;
13
- const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
14
- const MathUtils_js_1 = require("../../../../Utils/MathUtils.js");
15
- class MoveAttract {
16
- distance;
17
- enable;
18
- rotate;
19
- constructor() {
20
- this.distance = 200;
21
- this.enable = false;
22
- this.rotate = {
23
- x: 3000,
24
- y: 3000,
25
- };
26
- }
27
- load(data) {
28
- if ((0, TypeUtils_js_1.isNull)(data)) {
29
- return;
30
- }
31
- if (data.distance !== undefined) {
32
- this.distance = (0, MathUtils_js_1.setRangeValue)(data.distance);
33
- }
34
- if (data.enable !== undefined) {
35
- this.enable = data.enable;
36
- }
37
- if (data.rotate) {
38
- const rotateX = data.rotate.x;
39
- if (rotateX !== undefined) {
40
- this.rotate.x = rotateX;
41
- }
42
- const rotateY = data.rotate.y;
43
- if (rotateY !== undefined) {
44
- this.rotate.y = rotateY;
45
- }
46
- }
47
- }
48
- }
49
- exports.MoveAttract = MoveAttract;
50
- });
@@ -1,12 +0,0 @@
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
- });