@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.
- package/174.min.js +2 -0
- package/174.min.js.LICENSE.txt +1 -0
- package/browser/Core/Canvas.js +9 -9
- package/browser/Core/Container.js +7 -7
- package/browser/Core/Engine.js +1 -1
- package/browser/Core/Particle.js +12 -13
- package/browser/Core/Particles.js +30 -30
- package/browser/Core/Utils/EventListeners.js +4 -3
- package/browser/Core/Utils/InteractionManager.js +4 -4
- package/browser/Core/Utils/QuadTree.js +4 -5
- package/browser/Core/Utils/Ranges.js +55 -0
- package/browser/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
- package/browser/Options/Classes/AnimatableColor.js +1 -1
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/browser/Options/Classes/Options.js +2 -1
- package/browser/Options/Classes/OptionsColor.js +1 -1
- package/browser/Options/Classes/Particles/Move/Move.js +1 -1
- package/browser/Types/RangeType.js +1 -0
- package/browser/Utils/CanvasUtils.js +14 -14
- package/browser/Utils/ColorUtils.js +2 -1
- package/browser/Utils/NumberUtils.js +2 -2
- package/browser/Utils/TypeUtils.js +18 -0
- package/browser/Utils/Utils.js +2 -19
- package/browser/exports.js +3 -5
- package/cjs/Core/Canvas.js +9 -9
- package/cjs/Core/Container.js +7 -7
- package/cjs/Core/Engine.js +2 -25
- package/cjs/Core/Particle.js +15 -16
- package/cjs/Core/Particles.js +32 -55
- package/cjs/Core/Utils/EventListeners.js +4 -3
- package/cjs/Core/Utils/InteractionManager.js +4 -4
- package/cjs/Core/Utils/QuadTree.js +7 -8
- package/cjs/Core/Utils/Ranges.js +61 -0
- package/cjs/Core/Utils/{Vector3d.js → Vectors.js} +18 -3
- package/cjs/Options/Classes/AnimatableColor.js +2 -2
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +2 -2
- package/cjs/Options/Classes/Options.js +2 -1
- package/cjs/Options/Classes/OptionsColor.js +2 -2
- package/cjs/Options/Classes/Particles/Move/Move.js +4 -4
- package/cjs/Types/RangeType.js +2 -0
- package/cjs/Utils/CanvasUtils.js +14 -14
- package/cjs/Utils/ColorUtils.js +9 -8
- package/cjs/Utils/NumberUtils.js +9 -9
- package/cjs/Utils/TypeUtils.js +27 -0
- package/cjs/Utils/Utils.js +13 -36
- package/cjs/exports.js +3 -5
- package/dist_browser_Core_Container_js.js +17 -7
- package/esm/Core/Canvas.js +9 -9
- package/esm/Core/Container.js +7 -7
- package/esm/Core/Engine.js +1 -1
- package/esm/Core/Particle.js +12 -13
- package/esm/Core/Particles.js +30 -30
- package/esm/Core/Utils/EventListeners.js +4 -3
- package/esm/Core/Utils/InteractionManager.js +4 -4
- package/esm/Core/Utils/QuadTree.js +4 -5
- package/esm/Core/Utils/Ranges.js +55 -0
- package/esm/Core/Utils/{Vector3d.js → Vectors.js} +15 -1
- package/esm/Options/Classes/AnimatableColor.js +1 -1
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/esm/Options/Classes/Options.js +2 -1
- package/esm/Options/Classes/OptionsColor.js +1 -1
- package/esm/Options/Classes/Particles/Move/Move.js +1 -1
- package/esm/Types/RangeType.js +1 -0
- package/esm/Utils/CanvasUtils.js +14 -14
- package/esm/Utils/ColorUtils.js +2 -1
- package/esm/Utils/NumberUtils.js +2 -2
- package/esm/Utils/TypeUtils.js +18 -0
- package/esm/Utils/Utils.js +2 -19
- package/esm/exports.js +3 -5
- package/package.json +1 -1
- package/report.html +1 -1
- package/tsparticles.engine.js +32 -52
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +4 -4
- package/types/Core/Interfaces/ICircleBouncer.d.ts +1 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +4 -4
- package/types/Core/Interfaces/IEffectDrawer.d.ts +3 -3
- package/types/Core/Interfaces/IExternalInteractor.d.ts +1 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +3 -3
- package/types/Core/Interfaces/IParticleMover.d.ts +2 -2
- package/types/Core/Interfaces/IParticleUpdater.d.ts +2 -2
- package/types/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
- package/types/Core/Interfaces/IShapeDrawer.d.ts +4 -4
- package/types/Core/Particle.d.ts +3 -4
- package/types/Core/Particles.d.ts +7 -7
- package/types/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/types/Core/Utils/InteractionManager.d.ts +2 -2
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/types/Core/Utils/QuadTree.d.ts +2 -3
- package/types/Core/Utils/Ranges.d.ts +21 -0
- package/types/Core/Utils/{Vector3d.d.ts → Vectors.d.ts} +6 -0
- package/types/Types/RangeType.d.ts +4 -0
- package/types/Utils/CanvasUtils.d.ts +6 -6
- package/types/Utils/NumberUtils.d.ts +1 -1
- package/types/Utils/TypeUtils.d.ts +6 -0
- package/types/Utils/Utils.d.ts +0 -6
- package/types/exports.d.ts +3 -5
- package/umd/Core/Canvas.js +9 -9
- package/umd/Core/Container.js +7 -7
- package/umd/Core/Engine.js +1 -1
- package/umd/Core/Particle.js +16 -17
- package/umd/Core/Particles.js +33 -57
- package/umd/Core/Utils/EventListeners.js +5 -4
- package/umd/Core/Utils/InteractionManager.js +4 -4
- package/umd/Core/Utils/QuadTree.js +8 -9
- package/umd/Core/Utils/Ranges.js +71 -0
- package/umd/Core/Utils/{Vector3d.js → Vectors.js} +19 -4
- package/umd/Options/Classes/AnimatableColor.js +3 -3
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +3 -3
- package/umd/Options/Classes/Options.js +3 -2
- package/umd/Options/Classes/OptionsColor.js +3 -3
- package/umd/Options/Classes/Particles/Move/Move.js +5 -5
- package/umd/{Core/Utils/Range.js → Types/RangeType.js} +0 -10
- package/umd/Utils/CanvasUtils.js +14 -14
- package/umd/Utils/ColorUtils.js +10 -9
- package/umd/Utils/NumberUtils.js +10 -10
- package/umd/Utils/TypeUtils.js +37 -0
- package/umd/Utils/Utils.js +14 -37
- package/umd/exports.js +4 -6
- package/373.min.js +0 -2
- package/373.min.js.LICENSE.txt +0 -1
- package/438.min.js +0 -2
- package/438.min.js.LICENSE.txt +0 -1
- package/browser/Core/Utils/Circle.js +0 -28
- package/browser/Core/Utils/Range.js +0 -8
- package/browser/Core/Utils/Rectangle.js +0 -22
- package/browser/Core/Utils/Vector.js +0 -20
- package/cjs/Core/Utils/Circle.js +0 -32
- package/cjs/Core/Utils/Range.js +0 -12
- package/cjs/Core/Utils/Rectangle.js +0 -26
- package/cjs/Core/Utils/Vector.js +0 -24
- package/dist_browser_Core_Particle_js.js +0 -32
- package/esm/Core/Utils/Circle.js +0 -28
- package/esm/Core/Utils/Range.js +0 -8
- package/esm/Core/Utils/Rectangle.js +0 -22
- package/esm/Core/Utils/Vector.js +0 -20
- package/types/Core/Utils/Circle.d.ts +0 -8
- package/types/Core/Utils/Range.d.ts +0 -7
- package/types/Core/Utils/Rectangle.d.ts +0 -9
- package/types/Core/Utils/Vector.d.ts +0 -8
- package/umd/Core/Utils/Circle.js +0 -42
- package/umd/Core/Utils/Rectangle.js +0 -36
- package/umd/Core/Utils/Vector.js +0 -34
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ICoordinates } from "../Interfaces/ICoordinates.js";
|
|
2
|
-
export declare abstract class Range {
|
|
3
|
-
readonly position: ICoordinates;
|
|
4
|
-
protected constructor(x: number, y: number);
|
|
5
|
-
abstract contains(point: ICoordinates): boolean;
|
|
6
|
-
abstract intersects(range: Range): boolean;
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ICoordinates } from "../Interfaces/ICoordinates.js";
|
|
2
|
-
import type { IDimension } from "../Interfaces/IDimension.js";
|
|
3
|
-
import { Range } from "./Range.js";
|
|
4
|
-
export declare class Rectangle extends Range {
|
|
5
|
-
readonly size: IDimension;
|
|
6
|
-
constructor(x: number, y: number, width: number, height: number);
|
|
7
|
-
contains(point: ICoordinates): boolean;
|
|
8
|
-
intersects(range: Range): boolean;
|
|
9
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ICoordinates } from "../Interfaces/ICoordinates.js";
|
|
2
|
-
import { Vector3d } from "./Vector3d.js";
|
|
3
|
-
export declare class Vector extends Vector3d {
|
|
4
|
-
protected constructor(xOrCoords: number | ICoordinates, y?: number);
|
|
5
|
-
static get origin(): Vector;
|
|
6
|
-
static clone(source: Vector): Vector;
|
|
7
|
-
static create(x: number | ICoordinates, y?: number): Vector;
|
|
8
|
-
}
|
package/umd/Core/Utils/Circle.js
DELETED
|
@@ -1,42 +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", "./Range.js", "./Rectangle.js", "../../Utils/NumberUtils.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Circle = void 0;
|
|
13
|
-
const Range_js_1 = require("./Range.js");
|
|
14
|
-
const Rectangle_js_1 = require("./Rectangle.js");
|
|
15
|
-
const NumberUtils_js_1 = require("../../Utils/NumberUtils.js");
|
|
16
|
-
const squareExp = 2;
|
|
17
|
-
class Circle extends Range_js_1.Range {
|
|
18
|
-
constructor(x, y, radius) {
|
|
19
|
-
super(x, y);
|
|
20
|
-
this.radius = radius;
|
|
21
|
-
}
|
|
22
|
-
contains(point) {
|
|
23
|
-
return (0, NumberUtils_js_1.getDistance)(point, this.position) <= this.radius;
|
|
24
|
-
}
|
|
25
|
-
intersects(range) {
|
|
26
|
-
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;
|
|
27
|
-
if (range instanceof Circle) {
|
|
28
|
-
const rSum = r + range.radius, dist = Math.sqrt(distPos.x ** squareExp + distPos.y ** squareExp);
|
|
29
|
-
return rSum > dist;
|
|
30
|
-
}
|
|
31
|
-
else if (range instanceof Rectangle_js_1.Rectangle) {
|
|
32
|
-
const { width, height } = range.size, edges = Math.pow(distPos.x - width, squareExp) + Math.pow(distPos.y - height, squareExp);
|
|
33
|
-
return (edges <= r ** squareExp ||
|
|
34
|
-
(distPos.x <= r + width && distPos.y <= r + height) ||
|
|
35
|
-
distPos.x <= width ||
|
|
36
|
-
distPos.y <= height);
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.Circle = Circle;
|
|
42
|
-
});
|
|
@@ -1,36 +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", "./Circle.js", "./Range.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Rectangle = void 0;
|
|
13
|
-
const Circle_js_1 = require("./Circle.js");
|
|
14
|
-
const Range_js_1 = require("./Range.js");
|
|
15
|
-
class Rectangle extends Range_js_1.Range {
|
|
16
|
-
constructor(x, y, width, height) {
|
|
17
|
-
super(x, y);
|
|
18
|
-
this.size = {
|
|
19
|
-
height: height,
|
|
20
|
-
width: width,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
contains(point) {
|
|
24
|
-
const w = this.size.width, h = this.size.height, pos = this.position;
|
|
25
|
-
return point.x >= pos.x && point.x <= pos.x + w && point.y >= pos.y && point.y <= pos.y + h;
|
|
26
|
-
}
|
|
27
|
-
intersects(range) {
|
|
28
|
-
if (range instanceof Circle_js_1.Circle) {
|
|
29
|
-
range.intersects(this);
|
|
30
|
-
}
|
|
31
|
-
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;
|
|
32
|
-
return pos2.x < pos1.x + w && pos2.x + w2 > pos1.x && pos2.y < pos1.y + h && pos2.y + h2 > pos1.y;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.Rectangle = Rectangle;
|
|
36
|
-
});
|
package/umd/Core/Utils/Vector.js
DELETED
|
@@ -1,34 +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", "./Vector3d.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Vector = void 0;
|
|
13
|
-
const Vector3d_js_1 = require("./Vector3d.js");
|
|
14
|
-
const origin = {
|
|
15
|
-
x: 0,
|
|
16
|
-
y: 0,
|
|
17
|
-
z: 0,
|
|
18
|
-
};
|
|
19
|
-
class Vector extends Vector3d_js_1.Vector3d {
|
|
20
|
-
constructor(xOrCoords, y) {
|
|
21
|
-
super(xOrCoords, y, origin.z);
|
|
22
|
-
}
|
|
23
|
-
static get origin() {
|
|
24
|
-
return Vector.create(origin.x, origin.y);
|
|
25
|
-
}
|
|
26
|
-
static clone(source) {
|
|
27
|
-
return Vector.create(source.x, source.y);
|
|
28
|
-
}
|
|
29
|
-
static create(x, y) {
|
|
30
|
-
return new Vector(x, y);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.Vector = Vector;
|
|
34
|
-
});
|