@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.
- package/622.min.js +1 -0
- package/README.md +2 -2
- package/browser/Core/Engine.js +1 -18
- package/browser/Core/Particle.js +2 -23
- package/browser/Core/Particles.js +8 -37
- package/browser/Core/Utils/Constants.js +1 -1
- package/browser/Core/Utils/Ranges.js +2 -2
- package/browser/Core/Utils/SpatialHashGrid.js +82 -0
- package/browser/Core/Utils/Vectors.js +12 -16
- package/browser/Options/Classes/Particles/Move/Move.js +0 -4
- package/browser/Utils/CanvasUtils.js +29 -32
- package/browser/Utils/MathUtils.js +8 -1
- package/browser/Utils/Utils.js +10 -14
- package/browser/exports.js +0 -2
- package/cjs/Core/Engine.js +1 -18
- package/cjs/Core/Particle.js +2 -23
- package/cjs/Core/Particles.js +8 -37
- package/cjs/Core/Utils/Constants.js +1 -1
- package/cjs/Core/Utils/Ranges.js +2 -2
- package/cjs/Core/Utils/SpatialHashGrid.js +82 -0
- package/cjs/Core/Utils/Vectors.js +12 -16
- package/cjs/Options/Classes/Particles/Move/Move.js +0 -4
- package/cjs/Utils/CanvasUtils.js +29 -32
- package/cjs/Utils/MathUtils.js +8 -1
- package/cjs/Utils/Utils.js +10 -14
- package/cjs/exports.js +0 -2
- package/dist_browser_Core_Container_js.js +8 -8
- package/esm/Core/Engine.js +1 -18
- package/esm/Core/Particle.js +2 -23
- package/esm/Core/Particles.js +8 -37
- package/esm/Core/Utils/Constants.js +1 -1
- package/esm/Core/Utils/Ranges.js +2 -2
- package/esm/Core/Utils/SpatialHashGrid.js +82 -0
- package/esm/Core/Utils/Vectors.js +12 -16
- package/esm/Options/Classes/Particles/Move/Move.js +0 -4
- package/esm/Utils/CanvasUtils.js +29 -32
- package/esm/Utils/MathUtils.js +8 -1
- package/esm/Utils/Utils.js +10 -14
- package/esm/exports.js +0 -2
- package/package.json +1 -1
- package/report.html +1 -1
- package/scripts/install.js +2 -2
- package/tsparticles.engine.js +11 -31
- package/tsparticles.engine.min.js +2 -2
- package/types/Core/Engine.d.ts +1 -9
- package/types/Core/Particle.d.ts +0 -4
- package/types/Core/Particles.d.ts +2 -7
- package/types/Core/Utils/Constants.d.ts +1 -1
- package/types/Core/Utils/SpatialHashGrid.d.ts +18 -0
- package/types/Core/Utils/Vectors.d.ts +8 -10
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
- package/types/Types/EngineInitializers.d.ts +0 -6
- package/types/Utils/CanvasUtils.d.ts +6 -7
- package/types/Utils/MathUtils.d.ts +2 -0
- package/types/export-types.d.ts +1 -4
- package/types/exports.d.ts +0 -2
- package/umd/Core/Engine.js +1 -18
- package/umd/Core/Particle.js +3 -24
- package/umd/Core/Particles.js +8 -37
- package/umd/Core/Utils/Constants.js +2 -2
- package/umd/Core/Utils/Ranges.js +1 -1
- package/umd/Core/Utils/SpatialHashGrid.js +96 -0
- package/umd/Core/Utils/Vectors.js +12 -16
- package/umd/Options/Classes/Particles/Move/Move.js +1 -5
- package/umd/Utils/CanvasUtils.js +29 -32
- package/umd/Utils/MathUtils.js +10 -1
- package/umd/Utils/Utils.js +10 -14
- package/umd/exports.js +1 -3
- package/515.min.js +0 -1
- package/browser/Core/Interfaces/IMovePathGenerator.js +0 -1
- package/browser/Core/Interfaces/IParticleMover.js +0 -1
- package/browser/Core/Utils/Point.js +0 -8
- package/browser/Core/Utils/QuadTree.js +0 -85
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +0 -36
- package/browser/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
- package/cjs/Core/Interfaces/IMovePathGenerator.js +0 -1
- package/cjs/Core/Interfaces/IParticleMover.js +0 -1
- package/cjs/Core/Utils/Point.js +0 -8
- package/cjs/Core/Utils/QuadTree.js +0 -85
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +0 -36
- package/cjs/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
- package/esm/Core/Interfaces/IMovePathGenerator.js +0 -1
- package/esm/Core/Interfaces/IParticleMover.js +0 -1
- package/esm/Core/Utils/Point.js +0 -8
- package/esm/Core/Utils/QuadTree.js +0 -85
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +0 -36
- package/esm/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +0 -9
- package/types/Core/Interfaces/IParticleMover.d.ts +0 -7
- package/types/Core/Utils/Point.d.ts +0 -7
- package/types/Core/Utils/QuadTree.d.ts +0 -17
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -12
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -7
- package/umd/Core/Interfaces/IMovePathGenerator.js +0 -12
- package/umd/Core/Interfaces/IParticleMover.js +0 -12
- package/umd/Core/Utils/Point.js +0 -22
- package/umd/Core/Utils/QuadTree.js +0 -99
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +0 -50
- package/umd/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -12
package/umd/Core/Utils/Point.js
DELETED
|
@@ -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
|
-
});
|