@tsparticles/updater-out-modes 4.0.4 → 4.1.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/browser/BounceOutMode.js +9 -9
- package/browser/DestroyOutMode.js +3 -6
- package/browser/NoneOutMode.js +3 -3
- package/browser/OutOfCanvasUpdater.js +13 -13
- package/browser/OutOutMode.js +5 -5
- package/browser/Utils.js +10 -12
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/BounceOutMode.js +9 -9
- package/cjs/DestroyOutMode.js +3 -6
- package/cjs/NoneOutMode.js +3 -3
- package/cjs/OutOfCanvasUpdater.js +13 -13
- package/cjs/OutOutMode.js +5 -5
- package/cjs/Utils.js +10 -12
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/BounceOutMode.js +9 -9
- package/esm/DestroyOutMode.js +3 -6
- package/esm/NoneOutMode.js +3 -3
- package/esm/OutOfCanvasUpdater.js +13 -13
- package/esm/OutOutMode.js +5 -5
- package/esm/Utils.js +10 -12
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.updater.out-modes.js +43 -48
- package/tsparticles.updater.out-modes.min.js +1 -1
- package/types/BounceOutMode.d.ts +1 -2
- package/types/DestroyOutMode.d.ts +1 -2
- package/types/IBounceData.d.ts +1 -0
- package/types/NoneOutMode.d.ts +1 -1
- package/types/OutOfCanvasUpdater.d.ts +1 -3
- package/types/OutOutMode.d.ts +1 -1
package/browser/BounceOutMode.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { OutMode, calculateBounds, } from "@tsparticles/engine";
|
|
2
2
|
import { bounceHorizontal, bounceVertical } from "./Utils.js";
|
|
3
3
|
export class BounceOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
6
|
-
|
|
5
|
+
#container;
|
|
6
|
+
#particleBouncePlugins;
|
|
7
7
|
constructor(container) {
|
|
8
|
-
this
|
|
8
|
+
this.#container = container;
|
|
9
9
|
this.modes = [
|
|
10
10
|
OutMode.bounce,
|
|
11
11
|
OutMode.split,
|
|
12
12
|
];
|
|
13
|
-
this
|
|
13
|
+
this.#particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
|
|
14
14
|
}
|
|
15
15
|
update(particle, direction, delta, outMode) {
|
|
16
16
|
if (!this.modes.includes(outMode)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const container = this
|
|
19
|
+
const container = this.#container;
|
|
20
20
|
let handled = false;
|
|
21
|
-
for (const plugin of this
|
|
21
|
+
for (const plugin of this.#particleBouncePlugins) {
|
|
22
22
|
handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
|
|
23
23
|
if (handled) {
|
|
24
24
|
break;
|
|
@@ -27,8 +27,8 @@ export class BounceOutMode {
|
|
|
27
27
|
if (handled) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size;
|
|
31
|
-
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
32
|
-
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
30
|
+
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size, outOfCanvas = !particle.isInsideCanvasForOutMode(outMode, direction);
|
|
31
|
+
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
32
|
+
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { OutMode, ParticleOutType, getDistances,
|
|
1
|
+
import { OutMode, ParticleOutType, getDistances, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0;
|
|
3
3
|
export class DestroyOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
6
|
-
constructor(
|
|
7
|
-
this.container = container;
|
|
5
|
+
constructor(_container) {
|
|
8
6
|
this.modes = [OutMode.destroy];
|
|
9
7
|
}
|
|
10
8
|
update(particle, direction, _delta, outMode) {
|
|
11
9
|
if (!this.modes.includes(outMode)) {
|
|
12
10
|
return;
|
|
13
11
|
}
|
|
14
|
-
const container = this.container;
|
|
15
12
|
switch (particle.outType) {
|
|
16
13
|
case ParticleOutType.normal:
|
|
17
14
|
case ParticleOutType.outside:
|
|
18
|
-
if (
|
|
15
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
18
|
break;
|
package/browser/NoneOutMode.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OutMode, OutModeDirection, isPointInside, originPoint, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0;
|
|
3
3
|
export class NoneOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
5
|
+
#container;
|
|
6
6
|
constructor(container) {
|
|
7
|
-
this
|
|
7
|
+
this.#container = container;
|
|
8
8
|
this.modes = [OutMode.none];
|
|
9
9
|
}
|
|
10
10
|
update(particle, direction, _delta, outMode) {
|
|
@@ -17,7 +17,7 @@ export class NoneOutMode {
|
|
|
17
17
|
(direction === OutModeDirection.top || direction === OutModeDirection.bottom))) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const gravityOptions = particle.options.move.gravity, container = this
|
|
20
|
+
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
21
21
|
if (!gravityOptions.enable) {
|
|
22
22
|
if ((particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius) ||
|
|
23
23
|
(particle.velocity.y < minVelocity && particle.position.y >= -pRadius) ||
|
|
@@ -12,16 +12,16 @@ const checkOutMode = (outModes, outMode) => {
|
|
|
12
12
|
};
|
|
13
13
|
export class OutOfCanvasUpdater {
|
|
14
14
|
updaters;
|
|
15
|
-
container;
|
|
15
|
+
#container;
|
|
16
16
|
constructor(container) {
|
|
17
|
-
this
|
|
17
|
+
this.#container = container;
|
|
18
18
|
this.updaters = new Map();
|
|
19
19
|
}
|
|
20
20
|
init(particle) {
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
21
|
+
this.#addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
|
|
22
|
+
this.#addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
|
|
23
|
+
this.#addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
|
|
24
|
+
this.#addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
|
|
25
25
|
}
|
|
26
26
|
isEnabled(particle) {
|
|
27
27
|
return !particle.destroyed && !particle.spawning;
|
|
@@ -29,18 +29,18 @@ export class OutOfCanvasUpdater {
|
|
|
29
29
|
update(particle, delta) {
|
|
30
30
|
const outModes = particle.options.move.outModes;
|
|
31
31
|
particle.justWarped = false;
|
|
32
|
-
this
|
|
33
|
-
this
|
|
34
|
-
this
|
|
35
|
-
this
|
|
32
|
+
this.#updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
|
|
33
|
+
this.#updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
|
|
34
|
+
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
|
|
35
|
+
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
#addUpdaterIfMissing = (particle, outMode, getUpdater) => {
|
|
38
38
|
const outModes = particle.options.move.outModes;
|
|
39
39
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
40
|
-
this.updaters.set(outMode, getUpdater(this
|
|
40
|
+
this.updaters.set(outMode, getUpdater(this.#container));
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
#updateOutMode = (particle, delta, outMode, direction) => {
|
|
44
44
|
for (const updater of this.updaters.values()) {
|
|
45
45
|
updater.update(particle, direction, delta, outMode);
|
|
46
46
|
}
|
package/browser/OutOutMode.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { OutMode, OutModeDirection, ParticleOutType, Vector, calculateBounds, getDistances, getRandom,
|
|
1
|
+
import { OutMode, OutModeDirection, ParticleOutType, Vector, calculateBounds, getDistances, getRandom, originPoint, randomInRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0, minDistance = 0, updateVector = Vector.origin;
|
|
3
3
|
export class OutOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
5
|
+
#container;
|
|
6
6
|
constructor(container) {
|
|
7
|
-
this
|
|
7
|
+
this.#container = container;
|
|
8
8
|
this.modes = [OutMode.out];
|
|
9
9
|
}
|
|
10
10
|
update(particle, direction, _delta, outMode) {
|
|
11
11
|
if (!this.modes.includes(outMode)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const container = this
|
|
14
|
+
const container = this.#container;
|
|
15
15
|
switch (particle.outType) {
|
|
16
16
|
case ParticleOutType.inside: {
|
|
17
17
|
const { x: vx, y: vy } = particle.velocity;
|
|
@@ -41,7 +41,7 @@ export class OutOutMode {
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
default: {
|
|
44
|
-
if (
|
|
44
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
switch (particle.outType) {
|
package/browser/Utils.js
CHANGED
|
@@ -13,10 +13,9 @@ export function bounceHorizontal(data) {
|
|
|
13
13
|
}
|
|
14
14
|
const velocity = data.particle.velocity.x;
|
|
15
15
|
let bounced = false;
|
|
16
|
-
if (
|
|
17
|
-
data.
|
|
18
|
-
|
|
19
|
-
(data.direction === OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity)) {
|
|
16
|
+
if (data.outOfCanvas &&
|
|
17
|
+
((data.direction === OutModeDirection.right && velocity > minVelocity) ||
|
|
18
|
+
(data.direction === OutModeDirection.left && velocity < minVelocity))) {
|
|
20
19
|
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
21
20
|
data.particle.velocity.x *= -newVelocity;
|
|
22
21
|
bounced = true;
|
|
@@ -25,10 +24,10 @@ export function bounceHorizontal(data) {
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
const minPos = data.offset.x + data.size;
|
|
28
|
-
if (data.
|
|
27
|
+
if (data.outOfCanvas && data.direction === OutModeDirection.right) {
|
|
29
28
|
data.particle.position.x = data.canvasSize.width - minPos;
|
|
30
29
|
}
|
|
31
|
-
else if (data.
|
|
30
|
+
else if (data.outOfCanvas && data.direction === OutModeDirection.left) {
|
|
32
31
|
data.particle.position.x = minPos;
|
|
33
32
|
}
|
|
34
33
|
if (data.outMode === OutMode.split) {
|
|
@@ -48,10 +47,9 @@ export function bounceVertical(data) {
|
|
|
48
47
|
}
|
|
49
48
|
const velocity = data.particle.velocity.y;
|
|
50
49
|
let bounced = false;
|
|
51
|
-
if (
|
|
52
|
-
data.
|
|
53
|
-
|
|
54
|
-
(data.direction === OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity)) {
|
|
50
|
+
if (data.outOfCanvas &&
|
|
51
|
+
((data.direction === OutModeDirection.bottom && velocity > minVelocity) ||
|
|
52
|
+
(data.direction === OutModeDirection.top && velocity < minVelocity))) {
|
|
55
53
|
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
|
|
56
54
|
data.particle.velocity.y *= -newVelocity;
|
|
57
55
|
bounced = true;
|
|
@@ -60,10 +58,10 @@ export function bounceVertical(data) {
|
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
60
|
const minPos = data.offset.y + data.size;
|
|
63
|
-
if (data.
|
|
61
|
+
if (data.outOfCanvas && data.direction === OutModeDirection.bottom) {
|
|
64
62
|
data.particle.position.y = data.canvasSize.height - minPos;
|
|
65
63
|
}
|
|
66
|
-
else if (data.
|
|
64
|
+
else if (data.outOfCanvas && data.direction === OutModeDirection.top) {
|
|
67
65
|
data.particle.position.y = minPos;
|
|
68
66
|
}
|
|
69
67
|
if (data.outMode === OutMode.split) {
|
package/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater.js";
|
|
2
2
|
export async function loadOutModesUpdater(engine) {
|
|
3
|
-
engine.checkVersion("4.0
|
|
3
|
+
engine.checkVersion("4.1.0");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
6
6
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadOutModesUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0
|
|
2
|
+
engine.checkVersion("4.1.0");
|
|
3
3
|
await engine.pluginManager.register(e => {
|
|
4
4
|
e.pluginManager.addParticleUpdater("outModes", async (container) => {
|
|
5
5
|
const { OutOfCanvasUpdater } = await import("./OutOfCanvasUpdater.js");
|
package/cjs/BounceOutMode.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { OutMode, calculateBounds, } from "@tsparticles/engine";
|
|
2
2
|
import { bounceHorizontal, bounceVertical } from "./Utils.js";
|
|
3
3
|
export class BounceOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
6
|
-
|
|
5
|
+
#container;
|
|
6
|
+
#particleBouncePlugins;
|
|
7
7
|
constructor(container) {
|
|
8
|
-
this
|
|
8
|
+
this.#container = container;
|
|
9
9
|
this.modes = [
|
|
10
10
|
OutMode.bounce,
|
|
11
11
|
OutMode.split,
|
|
12
12
|
];
|
|
13
|
-
this
|
|
13
|
+
this.#particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
|
|
14
14
|
}
|
|
15
15
|
update(particle, direction, delta, outMode) {
|
|
16
16
|
if (!this.modes.includes(outMode)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const container = this
|
|
19
|
+
const container = this.#container;
|
|
20
20
|
let handled = false;
|
|
21
|
-
for (const plugin of this
|
|
21
|
+
for (const plugin of this.#particleBouncePlugins) {
|
|
22
22
|
handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
|
|
23
23
|
if (handled) {
|
|
24
24
|
break;
|
|
@@ -27,8 +27,8 @@ export class BounceOutMode {
|
|
|
27
27
|
if (handled) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size;
|
|
31
|
-
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
32
|
-
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
30
|
+
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size, outOfCanvas = !particle.isInsideCanvasForOutMode(outMode, direction);
|
|
31
|
+
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
32
|
+
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
33
33
|
}
|
|
34
34
|
}
|
package/cjs/DestroyOutMode.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { OutMode, ParticleOutType, getDistances,
|
|
1
|
+
import { OutMode, ParticleOutType, getDistances, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0;
|
|
3
3
|
export class DestroyOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
6
|
-
constructor(
|
|
7
|
-
this.container = container;
|
|
5
|
+
constructor(_container) {
|
|
8
6
|
this.modes = [OutMode.destroy];
|
|
9
7
|
}
|
|
10
8
|
update(particle, direction, _delta, outMode) {
|
|
11
9
|
if (!this.modes.includes(outMode)) {
|
|
12
10
|
return;
|
|
13
11
|
}
|
|
14
|
-
const container = this.container;
|
|
15
12
|
switch (particle.outType) {
|
|
16
13
|
case ParticleOutType.normal:
|
|
17
14
|
case ParticleOutType.outside:
|
|
18
|
-
if (
|
|
15
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
18
|
break;
|
package/cjs/NoneOutMode.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OutMode, OutModeDirection, isPointInside, originPoint, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0;
|
|
3
3
|
export class NoneOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
5
|
+
#container;
|
|
6
6
|
constructor(container) {
|
|
7
|
-
this
|
|
7
|
+
this.#container = container;
|
|
8
8
|
this.modes = [OutMode.none];
|
|
9
9
|
}
|
|
10
10
|
update(particle, direction, _delta, outMode) {
|
|
@@ -17,7 +17,7 @@ export class NoneOutMode {
|
|
|
17
17
|
(direction === OutModeDirection.top || direction === OutModeDirection.bottom))) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const gravityOptions = particle.options.move.gravity, container = this
|
|
20
|
+
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
21
21
|
if (!gravityOptions.enable) {
|
|
22
22
|
if ((particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius) ||
|
|
23
23
|
(particle.velocity.y < minVelocity && particle.position.y >= -pRadius) ||
|
|
@@ -12,16 +12,16 @@ const checkOutMode = (outModes, outMode) => {
|
|
|
12
12
|
};
|
|
13
13
|
export class OutOfCanvasUpdater {
|
|
14
14
|
updaters;
|
|
15
|
-
container;
|
|
15
|
+
#container;
|
|
16
16
|
constructor(container) {
|
|
17
|
-
this
|
|
17
|
+
this.#container = container;
|
|
18
18
|
this.updaters = new Map();
|
|
19
19
|
}
|
|
20
20
|
init(particle) {
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
21
|
+
this.#addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
|
|
22
|
+
this.#addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
|
|
23
|
+
this.#addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
|
|
24
|
+
this.#addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
|
|
25
25
|
}
|
|
26
26
|
isEnabled(particle) {
|
|
27
27
|
return !particle.destroyed && !particle.spawning;
|
|
@@ -29,18 +29,18 @@ export class OutOfCanvasUpdater {
|
|
|
29
29
|
update(particle, delta) {
|
|
30
30
|
const outModes = particle.options.move.outModes;
|
|
31
31
|
particle.justWarped = false;
|
|
32
|
-
this
|
|
33
|
-
this
|
|
34
|
-
this
|
|
35
|
-
this
|
|
32
|
+
this.#updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
|
|
33
|
+
this.#updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
|
|
34
|
+
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
|
|
35
|
+
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
#addUpdaterIfMissing = (particle, outMode, getUpdater) => {
|
|
38
38
|
const outModes = particle.options.move.outModes;
|
|
39
39
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
40
|
-
this.updaters.set(outMode, getUpdater(this
|
|
40
|
+
this.updaters.set(outMode, getUpdater(this.#container));
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
#updateOutMode = (particle, delta, outMode, direction) => {
|
|
44
44
|
for (const updater of this.updaters.values()) {
|
|
45
45
|
updater.update(particle, direction, delta, outMode);
|
|
46
46
|
}
|
package/cjs/OutOutMode.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { OutMode, OutModeDirection, ParticleOutType, Vector, calculateBounds, getDistances, getRandom,
|
|
1
|
+
import { OutMode, OutModeDirection, ParticleOutType, Vector, calculateBounds, getDistances, getRandom, originPoint, randomInRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0, minDistance = 0, updateVector = Vector.origin;
|
|
3
3
|
export class OutOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
5
|
+
#container;
|
|
6
6
|
constructor(container) {
|
|
7
|
-
this
|
|
7
|
+
this.#container = container;
|
|
8
8
|
this.modes = [OutMode.out];
|
|
9
9
|
}
|
|
10
10
|
update(particle, direction, _delta, outMode) {
|
|
11
11
|
if (!this.modes.includes(outMode)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const container = this
|
|
14
|
+
const container = this.#container;
|
|
15
15
|
switch (particle.outType) {
|
|
16
16
|
case ParticleOutType.inside: {
|
|
17
17
|
const { x: vx, y: vy } = particle.velocity;
|
|
@@ -41,7 +41,7 @@ export class OutOutMode {
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
default: {
|
|
44
|
-
if (
|
|
44
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
switch (particle.outType) {
|
package/cjs/Utils.js
CHANGED
|
@@ -13,10 +13,9 @@ export function bounceHorizontal(data) {
|
|
|
13
13
|
}
|
|
14
14
|
const velocity = data.particle.velocity.x;
|
|
15
15
|
let bounced = false;
|
|
16
|
-
if (
|
|
17
|
-
data.
|
|
18
|
-
|
|
19
|
-
(data.direction === OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity)) {
|
|
16
|
+
if (data.outOfCanvas &&
|
|
17
|
+
((data.direction === OutModeDirection.right && velocity > minVelocity) ||
|
|
18
|
+
(data.direction === OutModeDirection.left && velocity < minVelocity))) {
|
|
20
19
|
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
21
20
|
data.particle.velocity.x *= -newVelocity;
|
|
22
21
|
bounced = true;
|
|
@@ -25,10 +24,10 @@ export function bounceHorizontal(data) {
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
const minPos = data.offset.x + data.size;
|
|
28
|
-
if (data.
|
|
27
|
+
if (data.outOfCanvas && data.direction === OutModeDirection.right) {
|
|
29
28
|
data.particle.position.x = data.canvasSize.width - minPos;
|
|
30
29
|
}
|
|
31
|
-
else if (data.
|
|
30
|
+
else if (data.outOfCanvas && data.direction === OutModeDirection.left) {
|
|
32
31
|
data.particle.position.x = minPos;
|
|
33
32
|
}
|
|
34
33
|
if (data.outMode === OutMode.split) {
|
|
@@ -48,10 +47,9 @@ export function bounceVertical(data) {
|
|
|
48
47
|
}
|
|
49
48
|
const velocity = data.particle.velocity.y;
|
|
50
49
|
let bounced = false;
|
|
51
|
-
if (
|
|
52
|
-
data.
|
|
53
|
-
|
|
54
|
-
(data.direction === OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity)) {
|
|
50
|
+
if (data.outOfCanvas &&
|
|
51
|
+
((data.direction === OutModeDirection.bottom && velocity > minVelocity) ||
|
|
52
|
+
(data.direction === OutModeDirection.top && velocity < minVelocity))) {
|
|
55
53
|
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
|
|
56
54
|
data.particle.velocity.y *= -newVelocity;
|
|
57
55
|
bounced = true;
|
|
@@ -60,10 +58,10 @@ export function bounceVertical(data) {
|
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
60
|
const minPos = data.offset.y + data.size;
|
|
63
|
-
if (data.
|
|
61
|
+
if (data.outOfCanvas && data.direction === OutModeDirection.bottom) {
|
|
64
62
|
data.particle.position.y = data.canvasSize.height - minPos;
|
|
65
63
|
}
|
|
66
|
-
else if (data.
|
|
64
|
+
else if (data.outOfCanvas && data.direction === OutModeDirection.top) {
|
|
67
65
|
data.particle.position.y = minPos;
|
|
68
66
|
}
|
|
69
67
|
if (data.outMode === OutMode.split) {
|
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater.js";
|
|
2
2
|
export async function loadOutModesUpdater(engine) {
|
|
3
|
-
engine.checkVersion("4.0
|
|
3
|
+
engine.checkVersion("4.1.0");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
6
6
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadOutModesUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0
|
|
2
|
+
engine.checkVersion("4.1.0");
|
|
3
3
|
await engine.pluginManager.register(e => {
|
|
4
4
|
e.pluginManager.addParticleUpdater("outModes", async (container) => {
|
|
5
5
|
const { OutOfCanvasUpdater } = await import("./OutOfCanvasUpdater.js");
|
package/esm/BounceOutMode.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { OutMode, calculateBounds, } from "@tsparticles/engine";
|
|
2
2
|
import { bounceHorizontal, bounceVertical } from "./Utils.js";
|
|
3
3
|
export class BounceOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
6
|
-
|
|
5
|
+
#container;
|
|
6
|
+
#particleBouncePlugins;
|
|
7
7
|
constructor(container) {
|
|
8
|
-
this
|
|
8
|
+
this.#container = container;
|
|
9
9
|
this.modes = [
|
|
10
10
|
OutMode.bounce,
|
|
11
11
|
OutMode.split,
|
|
12
12
|
];
|
|
13
|
-
this
|
|
13
|
+
this.#particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
|
|
14
14
|
}
|
|
15
15
|
update(particle, direction, delta, outMode) {
|
|
16
16
|
if (!this.modes.includes(outMode)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const container = this
|
|
19
|
+
const container = this.#container;
|
|
20
20
|
let handled = false;
|
|
21
|
-
for (const plugin of this
|
|
21
|
+
for (const plugin of this.#particleBouncePlugins) {
|
|
22
22
|
handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
|
|
23
23
|
if (handled) {
|
|
24
24
|
break;
|
|
@@ -27,8 +27,8 @@ export class BounceOutMode {
|
|
|
27
27
|
if (handled) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size;
|
|
31
|
-
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
32
|
-
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
30
|
+
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size, outOfCanvas = !particle.isInsideCanvasForOutMode(outMode, direction);
|
|
31
|
+
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
32
|
+
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
33
33
|
}
|
|
34
34
|
}
|
package/esm/DestroyOutMode.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { OutMode, ParticleOutType, getDistances,
|
|
1
|
+
import { OutMode, ParticleOutType, getDistances, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0;
|
|
3
3
|
export class DestroyOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
6
|
-
constructor(
|
|
7
|
-
this.container = container;
|
|
5
|
+
constructor(_container) {
|
|
8
6
|
this.modes = [OutMode.destroy];
|
|
9
7
|
}
|
|
10
8
|
update(particle, direction, _delta, outMode) {
|
|
11
9
|
if (!this.modes.includes(outMode)) {
|
|
12
10
|
return;
|
|
13
11
|
}
|
|
14
|
-
const container = this.container;
|
|
15
12
|
switch (particle.outType) {
|
|
16
13
|
case ParticleOutType.normal:
|
|
17
14
|
case ParticleOutType.outside:
|
|
18
|
-
if (
|
|
15
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
18
|
break;
|
package/esm/NoneOutMode.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OutMode, OutModeDirection, isPointInside, originPoint, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0;
|
|
3
3
|
export class NoneOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
5
|
+
#container;
|
|
6
6
|
constructor(container) {
|
|
7
|
-
this
|
|
7
|
+
this.#container = container;
|
|
8
8
|
this.modes = [OutMode.none];
|
|
9
9
|
}
|
|
10
10
|
update(particle, direction, _delta, outMode) {
|
|
@@ -17,7 +17,7 @@ export class NoneOutMode {
|
|
|
17
17
|
(direction === OutModeDirection.top || direction === OutModeDirection.bottom))) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const gravityOptions = particle.options.move.gravity, container = this
|
|
20
|
+
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
21
21
|
if (!gravityOptions.enable) {
|
|
22
22
|
if ((particle.velocity.y > minVelocity && particle.position.y <= canvasSize.height + pRadius) ||
|
|
23
23
|
(particle.velocity.y < minVelocity && particle.position.y >= -pRadius) ||
|
|
@@ -12,16 +12,16 @@ const checkOutMode = (outModes, outMode) => {
|
|
|
12
12
|
};
|
|
13
13
|
export class OutOfCanvasUpdater {
|
|
14
14
|
updaters;
|
|
15
|
-
container;
|
|
15
|
+
#container;
|
|
16
16
|
constructor(container) {
|
|
17
|
-
this
|
|
17
|
+
this.#container = container;
|
|
18
18
|
this.updaters = new Map();
|
|
19
19
|
}
|
|
20
20
|
init(particle) {
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
21
|
+
this.#addUpdaterIfMissing(particle, OutMode.bounce, container => new BounceOutMode(container));
|
|
22
|
+
this.#addUpdaterIfMissing(particle, OutMode.out, container => new OutOutMode(container));
|
|
23
|
+
this.#addUpdaterIfMissing(particle, OutMode.destroy, container => new DestroyOutMode(container));
|
|
24
|
+
this.#addUpdaterIfMissing(particle, OutMode.none, container => new NoneOutMode(container));
|
|
25
25
|
}
|
|
26
26
|
isEnabled(particle) {
|
|
27
27
|
return !particle.destroyed && !particle.spawning;
|
|
@@ -29,18 +29,18 @@ export class OutOfCanvasUpdater {
|
|
|
29
29
|
update(particle, delta) {
|
|
30
30
|
const outModes = particle.options.move.outModes;
|
|
31
31
|
particle.justWarped = false;
|
|
32
|
-
this
|
|
33
|
-
this
|
|
34
|
-
this
|
|
35
|
-
this
|
|
32
|
+
this.#updateOutMode(particle, delta, outModes.bottom ?? outModes.default, OutModeDirection.bottom);
|
|
33
|
+
this.#updateOutMode(particle, delta, outModes.left ?? outModes.default, OutModeDirection.left);
|
|
34
|
+
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, OutModeDirection.right);
|
|
35
|
+
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, OutModeDirection.top);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
#addUpdaterIfMissing = (particle, outMode, getUpdater) => {
|
|
38
38
|
const outModes = particle.options.move.outModes;
|
|
39
39
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
40
|
-
this.updaters.set(outMode, getUpdater(this
|
|
40
|
+
this.updaters.set(outMode, getUpdater(this.#container));
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
#updateOutMode = (particle, delta, outMode, direction) => {
|
|
44
44
|
for (const updater of this.updaters.values()) {
|
|
45
45
|
updater.update(particle, direction, delta, outMode);
|
|
46
46
|
}
|
package/esm/OutOutMode.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { OutMode, OutModeDirection, ParticleOutType, Vector, calculateBounds, getDistances, getRandom,
|
|
1
|
+
import { OutMode, OutModeDirection, ParticleOutType, Vector, calculateBounds, getDistances, getRandom, originPoint, randomInRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
const minVelocity = 0, minDistance = 0, updateVector = Vector.origin;
|
|
3
3
|
export class OutOutMode {
|
|
4
|
-
container;
|
|
5
4
|
modes;
|
|
5
|
+
#container;
|
|
6
6
|
constructor(container) {
|
|
7
|
-
this
|
|
7
|
+
this.#container = container;
|
|
8
8
|
this.modes = [OutMode.out];
|
|
9
9
|
}
|
|
10
10
|
update(particle, direction, _delta, outMode) {
|
|
11
11
|
if (!this.modes.includes(outMode)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const container = this
|
|
14
|
+
const container = this.#container;
|
|
15
15
|
switch (particle.outType) {
|
|
16
16
|
case ParticleOutType.inside: {
|
|
17
17
|
const { x: vx, y: vy } = particle.velocity;
|
|
@@ -41,7 +41,7 @@ export class OutOutMode {
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
default: {
|
|
44
|
-
if (
|
|
44
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
switch (particle.outType) {
|
package/esm/Utils.js
CHANGED
|
@@ -13,10 +13,9 @@ export function bounceHorizontal(data) {
|
|
|
13
13
|
}
|
|
14
14
|
const velocity = data.particle.velocity.x;
|
|
15
15
|
let bounced = false;
|
|
16
|
-
if (
|
|
17
|
-
data.
|
|
18
|
-
|
|
19
|
-
(data.direction === OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity)) {
|
|
16
|
+
if (data.outOfCanvas &&
|
|
17
|
+
((data.direction === OutModeDirection.right && velocity > minVelocity) ||
|
|
18
|
+
(data.direction === OutModeDirection.left && velocity < minVelocity))) {
|
|
20
19
|
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
21
20
|
data.particle.velocity.x *= -newVelocity;
|
|
22
21
|
bounced = true;
|
|
@@ -25,10 +24,10 @@ export function bounceHorizontal(data) {
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
const minPos = data.offset.x + data.size;
|
|
28
|
-
if (data.
|
|
27
|
+
if (data.outOfCanvas && data.direction === OutModeDirection.right) {
|
|
29
28
|
data.particle.position.x = data.canvasSize.width - minPos;
|
|
30
29
|
}
|
|
31
|
-
else if (data.
|
|
30
|
+
else if (data.outOfCanvas && data.direction === OutModeDirection.left) {
|
|
32
31
|
data.particle.position.x = minPos;
|
|
33
32
|
}
|
|
34
33
|
if (data.outMode === OutMode.split) {
|
|
@@ -48,10 +47,9 @@ export function bounceVertical(data) {
|
|
|
48
47
|
}
|
|
49
48
|
const velocity = data.particle.velocity.y;
|
|
50
49
|
let bounced = false;
|
|
51
|
-
if (
|
|
52
|
-
data.
|
|
53
|
-
|
|
54
|
-
(data.direction === OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity)) {
|
|
50
|
+
if (data.outOfCanvas &&
|
|
51
|
+
((data.direction === OutModeDirection.bottom && velocity > minVelocity) ||
|
|
52
|
+
(data.direction === OutModeDirection.top && velocity < minVelocity))) {
|
|
55
53
|
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
|
|
56
54
|
data.particle.velocity.y *= -newVelocity;
|
|
57
55
|
bounced = true;
|
|
@@ -60,10 +58,10 @@ export function bounceVertical(data) {
|
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
60
|
const minPos = data.offset.y + data.size;
|
|
63
|
-
if (data.
|
|
61
|
+
if (data.outOfCanvas && data.direction === OutModeDirection.bottom) {
|
|
64
62
|
data.particle.position.y = data.canvasSize.height - minPos;
|
|
65
63
|
}
|
|
66
|
-
else if (data.
|
|
64
|
+
else if (data.outOfCanvas && data.direction === OutModeDirection.top) {
|
|
67
65
|
data.particle.position.y = minPos;
|
|
68
66
|
}
|
|
69
67
|
if (data.outMode === OutMode.split) {
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater.js";
|
|
2
2
|
export async function loadOutModesUpdater(engine) {
|
|
3
|
-
engine.checkVersion("4.0
|
|
3
|
+
engine.checkVersion("4.1.0");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
6
6
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadOutModesUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0
|
|
2
|
+
engine.checkVersion("4.1.0");
|
|
3
3
|
await engine.pluginManager.register(e => {
|
|
4
4
|
e.pluginManager.addParticleUpdater("outModes", async (container) => {
|
|
5
5
|
const { OutOfCanvasUpdater } = await import("./OutOfCanvasUpdater.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-out-modes",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "tsParticles particles out modes updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"./package.json": "./package.json"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
|
-
"@tsparticles/engine": "4.0
|
|
96
|
+
"@tsparticles/engine": "4.1.0"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.updater.out-modes.js","children":[{"name":"dist/browser","children":[{"uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.updater.out-modes.js","children":[{"name":"dist/browser","children":[{"uid":"2ec812d5-1","name":"Utils.js"},{"uid":"2ec812d5-3","name":"BounceOutMode.js"},{"uid":"2ec812d5-5","name":"DestroyOutMode.js"},{"uid":"2ec812d5-7","name":"NoneOutMode.js"},{"uid":"2ec812d5-9","name":"OutOutMode.js"},{"uid":"2ec812d5-11","name":"OutOfCanvasUpdater.js"},{"uid":"2ec812d5-13","name":"index.js"},{"uid":"2ec812d5-15","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"2ec812d5-1":{"renderedLength":3412,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-0"},"2ec812d5-3":{"renderedLength":1417,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-2"},"2ec812d5-5":{"renderedLength":1307,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-4"},"2ec812d5-7":{"renderedLength":2078,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-6"},"2ec812d5-9":{"renderedLength":6782,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-8"},"2ec812d5-11":{"renderedLength":2197,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-10"},"2ec812d5-13":{"renderedLength":320,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-12"},"2ec812d5-15":{"renderedLength":181,"gzipLength":0,"brotliLength":0,"metaUid":"2ec812d5-14"}},"nodeMetas":{"2ec812d5-0":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-1"},"imported":[{"uid":"2ec812d5-16"}],"importedBy":[{"uid":"2ec812d5-2"}]},"2ec812d5-2":{"id":"/dist/browser/BounceOutMode.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-3"},"imported":[{"uid":"2ec812d5-16"},{"uid":"2ec812d5-0"}],"importedBy":[{"uid":"2ec812d5-10"}]},"2ec812d5-4":{"id":"/dist/browser/DestroyOutMode.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-5"},"imported":[{"uid":"2ec812d5-16"}],"importedBy":[{"uid":"2ec812d5-10"}]},"2ec812d5-6":{"id":"/dist/browser/NoneOutMode.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-7"},"imported":[{"uid":"2ec812d5-16"}],"importedBy":[{"uid":"2ec812d5-10"}]},"2ec812d5-8":{"id":"/dist/browser/OutOutMode.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-9"},"imported":[{"uid":"2ec812d5-16"}],"importedBy":[{"uid":"2ec812d5-10"}]},"2ec812d5-10":{"id":"/dist/browser/OutOfCanvasUpdater.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-11"},"imported":[{"uid":"2ec812d5-16"},{"uid":"2ec812d5-2"},{"uid":"2ec812d5-4"},{"uid":"2ec812d5-6"},{"uid":"2ec812d5-8"}],"importedBy":[{"uid":"2ec812d5-12"}]},"2ec812d5-12":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-13"},"imported":[{"uid":"2ec812d5-10"}],"importedBy":[{"uid":"2ec812d5-14"}]},"2ec812d5-14":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.updater.out-modes.js":"2ec812d5-15"},"imported":[{"uid":"2ec812d5-12"}],"importedBy":[],"isEntry":true},"2ec812d5-16":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"2ec812d5-10"},{"uid":"2ec812d5-2"},{"uid":"2ec812d5-4"},{"uid":"2ec812d5-6"},{"uid":"2ec812d5-8"},{"uid":"2ec812d5-0"}],"isExternal":true}},"env":{"rollup":"4.60.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* Updater v4.0
|
|
2
|
+
/* Updater v4.1.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
|
|
@@ -20,10 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
const velocity = data.particle.velocity.x;
|
|
22
22
|
let bounced = false;
|
|
23
|
-
if (
|
|
24
|
-
data.
|
|
25
|
-
|
|
26
|
-
(data.direction === engine.OutModeDirection.left && data.bounds.left <= boundsMin && velocity < minVelocity$3)) {
|
|
23
|
+
if (data.outOfCanvas &&
|
|
24
|
+
((data.direction === engine.OutModeDirection.right && velocity > minVelocity$3) ||
|
|
25
|
+
(data.direction === engine.OutModeDirection.left && velocity < minVelocity$3))) {
|
|
27
26
|
const newVelocity = engine.getRangeValue(data.particle.options.bounce.horizontal.value);
|
|
28
27
|
data.particle.velocity.x *= -newVelocity;
|
|
29
28
|
bounced = true;
|
|
@@ -32,10 +31,10 @@
|
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
const minPos = data.offset.x + data.size;
|
|
35
|
-
if (data.
|
|
34
|
+
if (data.outOfCanvas && data.direction === engine.OutModeDirection.right) {
|
|
36
35
|
data.particle.position.x = data.canvasSize.width - minPos;
|
|
37
36
|
}
|
|
38
|
-
else if (data.
|
|
37
|
+
else if (data.outOfCanvas && data.direction === engine.OutModeDirection.left) {
|
|
39
38
|
data.particle.position.x = minPos;
|
|
40
39
|
}
|
|
41
40
|
if (data.outMode === engine.OutMode.split) {
|
|
@@ -55,10 +54,9 @@
|
|
|
55
54
|
}
|
|
56
55
|
const velocity = data.particle.velocity.y;
|
|
57
56
|
let bounced = false;
|
|
58
|
-
if (
|
|
59
|
-
data.
|
|
60
|
-
|
|
61
|
-
(data.direction === engine.OutModeDirection.top && data.bounds.top <= boundsMin && velocity < minVelocity$3)) {
|
|
57
|
+
if (data.outOfCanvas &&
|
|
58
|
+
((data.direction === engine.OutModeDirection.bottom && velocity > minVelocity$3) ||
|
|
59
|
+
(data.direction === engine.OutModeDirection.top && velocity < minVelocity$3))) {
|
|
62
60
|
const newVelocity = engine.getRangeValue(data.particle.options.bounce.vertical.value);
|
|
63
61
|
data.particle.velocity.y *= -newVelocity;
|
|
64
62
|
bounced = true;
|
|
@@ -67,10 +65,10 @@
|
|
|
67
65
|
return;
|
|
68
66
|
}
|
|
69
67
|
const minPos = data.offset.y + data.size;
|
|
70
|
-
if (data.
|
|
68
|
+
if (data.outOfCanvas && data.direction === engine.OutModeDirection.bottom) {
|
|
71
69
|
data.particle.position.y = data.canvasSize.height - minPos;
|
|
72
70
|
}
|
|
73
|
-
else if (data.
|
|
71
|
+
else if (data.outOfCanvas && data.direction === engine.OutModeDirection.top) {
|
|
74
72
|
data.particle.position.y = minPos;
|
|
75
73
|
}
|
|
76
74
|
if (data.outMode === engine.OutMode.split) {
|
|
@@ -79,24 +77,24 @@
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
class BounceOutMode {
|
|
82
|
-
container;
|
|
83
80
|
modes;
|
|
84
|
-
|
|
81
|
+
#container;
|
|
82
|
+
#particleBouncePlugins;
|
|
85
83
|
constructor(container) {
|
|
86
|
-
this
|
|
84
|
+
this.#container = container;
|
|
87
85
|
this.modes = [
|
|
88
86
|
engine.OutMode.bounce,
|
|
89
87
|
engine.OutMode.split,
|
|
90
88
|
];
|
|
91
|
-
this
|
|
89
|
+
this.#particleBouncePlugins = container.plugins.filter(p => p.particleBounce !== undefined);
|
|
92
90
|
}
|
|
93
91
|
update(particle, direction, delta, outMode) {
|
|
94
92
|
if (!this.modes.includes(outMode)) {
|
|
95
93
|
return;
|
|
96
94
|
}
|
|
97
|
-
const container = this
|
|
95
|
+
const container = this.#container;
|
|
98
96
|
let handled = false;
|
|
99
|
-
for (const plugin of this
|
|
97
|
+
for (const plugin of this.#particleBouncePlugins) {
|
|
100
98
|
handled = plugin.particleBounce?.(particle, delta, direction) ?? false;
|
|
101
99
|
if (handled) {
|
|
102
100
|
break;
|
|
@@ -105,29 +103,26 @@
|
|
|
105
103
|
if (handled) {
|
|
106
104
|
return;
|
|
107
105
|
}
|
|
108
|
-
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = engine.calculateBounds(pos, size), canvasSize = container.canvas.size;
|
|
109
|
-
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
110
|
-
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size });
|
|
106
|
+
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = engine.calculateBounds(pos, size), canvasSize = container.canvas.size, outOfCanvas = !particle.isInsideCanvasForOutMode(outMode, direction);
|
|
107
|
+
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
108
|
+
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, outOfCanvas, size });
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
const minVelocity$2 = 0;
|
|
115
113
|
class DestroyOutMode {
|
|
116
|
-
container;
|
|
117
114
|
modes;
|
|
118
|
-
constructor(
|
|
119
|
-
this.container = container;
|
|
115
|
+
constructor(_container) {
|
|
120
116
|
this.modes = [engine.OutMode.destroy];
|
|
121
117
|
}
|
|
122
118
|
update(particle, direction, _delta, outMode) {
|
|
123
119
|
if (!this.modes.includes(outMode)) {
|
|
124
120
|
return;
|
|
125
121
|
}
|
|
126
|
-
const container = this.container;
|
|
127
122
|
switch (particle.outType) {
|
|
128
123
|
case engine.ParticleOutType.normal:
|
|
129
124
|
case engine.ParticleOutType.outside:
|
|
130
|
-
if (
|
|
125
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
131
126
|
return;
|
|
132
127
|
}
|
|
133
128
|
break;
|
|
@@ -148,10 +143,10 @@
|
|
|
148
143
|
|
|
149
144
|
const minVelocity$1 = 0;
|
|
150
145
|
class NoneOutMode {
|
|
151
|
-
container;
|
|
152
146
|
modes;
|
|
147
|
+
#container;
|
|
153
148
|
constructor(container) {
|
|
154
|
-
this
|
|
149
|
+
this.#container = container;
|
|
155
150
|
this.modes = [engine.OutMode.none];
|
|
156
151
|
}
|
|
157
152
|
update(particle, direction, _delta, outMode) {
|
|
@@ -164,7 +159,7 @@
|
|
|
164
159
|
(direction === engine.OutModeDirection.top || direction === engine.OutModeDirection.bottom))) {
|
|
165
160
|
return;
|
|
166
161
|
}
|
|
167
|
-
const gravityOptions = particle.options.move.gravity, container = this
|
|
162
|
+
const gravityOptions = particle.options.move.gravity, container = this.#container, canvasSize = container.canvas.size, pRadius = particle.getRadius();
|
|
168
163
|
if (!gravityOptions.enable) {
|
|
169
164
|
if ((particle.velocity.y > minVelocity$1 && particle.position.y <= canvasSize.height + pRadius) ||
|
|
170
165
|
(particle.velocity.y < minVelocity$1 && particle.position.y >= -pRadius) ||
|
|
@@ -190,17 +185,17 @@
|
|
|
190
185
|
|
|
191
186
|
const minVelocity = 0, minDistance = 0, updateVector = engine.Vector.origin;
|
|
192
187
|
class OutOutMode {
|
|
193
|
-
container;
|
|
194
188
|
modes;
|
|
189
|
+
#container;
|
|
195
190
|
constructor(container) {
|
|
196
|
-
this
|
|
191
|
+
this.#container = container;
|
|
197
192
|
this.modes = [engine.OutMode.out];
|
|
198
193
|
}
|
|
199
194
|
update(particle, direction, _delta, outMode) {
|
|
200
195
|
if (!this.modes.includes(outMode)) {
|
|
201
196
|
return;
|
|
202
197
|
}
|
|
203
|
-
const container = this
|
|
198
|
+
const container = this.#container;
|
|
204
199
|
switch (particle.outType) {
|
|
205
200
|
case engine.ParticleOutType.inside: {
|
|
206
201
|
const { x: vx, y: vy } = particle.velocity;
|
|
@@ -230,7 +225,7 @@
|
|
|
230
225
|
break;
|
|
231
226
|
}
|
|
232
227
|
default: {
|
|
233
|
-
if (
|
|
228
|
+
if (particle.isInsideCanvasForOutMode(outMode, direction)) {
|
|
234
229
|
return;
|
|
235
230
|
}
|
|
236
231
|
switch (particle.outType) {
|
|
@@ -314,16 +309,16 @@
|
|
|
314
309
|
};
|
|
315
310
|
class OutOfCanvasUpdater {
|
|
316
311
|
updaters;
|
|
317
|
-
container;
|
|
312
|
+
#container;
|
|
318
313
|
constructor(container) {
|
|
319
|
-
this
|
|
314
|
+
this.#container = container;
|
|
320
315
|
this.updaters = new Map();
|
|
321
316
|
}
|
|
322
317
|
init(particle) {
|
|
323
|
-
this
|
|
324
|
-
this
|
|
325
|
-
this
|
|
326
|
-
this
|
|
318
|
+
this.#addUpdaterIfMissing(particle, engine.OutMode.bounce, container => new BounceOutMode(container));
|
|
319
|
+
this.#addUpdaterIfMissing(particle, engine.OutMode.out, container => new OutOutMode(container));
|
|
320
|
+
this.#addUpdaterIfMissing(particle, engine.OutMode.destroy, container => new DestroyOutMode(container));
|
|
321
|
+
this.#addUpdaterIfMissing(particle, engine.OutMode.none, container => new NoneOutMode(container));
|
|
327
322
|
}
|
|
328
323
|
isEnabled(particle) {
|
|
329
324
|
return !particle.destroyed && !particle.spawning;
|
|
@@ -331,18 +326,18 @@
|
|
|
331
326
|
update(particle, delta) {
|
|
332
327
|
const outModes = particle.options.move.outModes;
|
|
333
328
|
particle.justWarped = false;
|
|
334
|
-
this
|
|
335
|
-
this
|
|
336
|
-
this
|
|
337
|
-
this
|
|
329
|
+
this.#updateOutMode(particle, delta, outModes.bottom ?? outModes.default, engine.OutModeDirection.bottom);
|
|
330
|
+
this.#updateOutMode(particle, delta, outModes.left ?? outModes.default, engine.OutModeDirection.left);
|
|
331
|
+
this.#updateOutMode(particle, delta, outModes.right ?? outModes.default, engine.OutModeDirection.right);
|
|
332
|
+
this.#updateOutMode(particle, delta, outModes.top ?? outModes.default, engine.OutModeDirection.top);
|
|
338
333
|
}
|
|
339
|
-
|
|
334
|
+
#addUpdaterIfMissing = (particle, outMode, getUpdater) => {
|
|
340
335
|
const outModes = particle.options.move.outModes;
|
|
341
336
|
if (!this.updaters.has(outMode) && checkOutMode(outModes, outMode)) {
|
|
342
|
-
this.updaters.set(outMode, getUpdater(this
|
|
337
|
+
this.updaters.set(outMode, getUpdater(this.#container));
|
|
343
338
|
}
|
|
344
339
|
};
|
|
345
|
-
|
|
340
|
+
#updateOutMode = (particle, delta, outMode, direction) => {
|
|
346
341
|
for (const updater of this.updaters.values()) {
|
|
347
342
|
updater.update(particle, direction, delta, outMode);
|
|
348
343
|
}
|
|
@@ -350,7 +345,7 @@
|
|
|
350
345
|
}
|
|
351
346
|
|
|
352
347
|
async function loadOutModesUpdater(engine) {
|
|
353
|
-
engine.checkVersion("4.0
|
|
348
|
+
engine.checkVersion("4.1.0");
|
|
354
349
|
await engine.pluginManager.register(e => {
|
|
355
350
|
e.pluginManager.addParticleUpdater("outModes", container => {
|
|
356
351
|
return Promise.resolve(new OutOfCanvasUpdater(container));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.outModes=t.__tsParticlesInternals.updaters.outModes||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class i{container;modes;_particleBouncePlugins;constructor(t){this.container=t,this.modes=[e.OutMode.bounce,e.OutMode.split],this._particleBouncePlugins=t.plugins.filter(t=>void 0!==t.particleBounce)}update(t,i,s,n){if(!this.modes.includes(n))return;const o=this.container;let a=!1;for(const e of this._particleBouncePlugins)if(a=e.particleBounce?.(t,s,i)??!1,a)break;if(a)return;const r=t.getPosition(),l=t.offset,c=t.getRadius(),d=e.calculateBounds(r,c),u=o.canvas.size;!function(t){if(t.outMode!==e.OutMode.bounce&&t.outMode!==e.OutMode.split||t.direction!==e.OutModeDirection.left&&t.direction!==e.OutModeDirection.right)return;t.bounds.right<0&&t.direction===e.OutModeDirection.left?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&t.direction===e.OutModeDirection.right&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);const i=t.particle.velocity.x;let s=!1;if(t.direction===e.OutModeDirection.right&&t.bounds.right>=t.canvasSize.width&&i>0||t.direction===e.OutModeDirection.left&&t.bounds.left<=0&&i<0){const i=e.getRangeValue(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-i,s=!0}if(!s)return;const n=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width&&t.direction===e.OutModeDirection.right?t.particle.position.x=t.canvasSize.width-n:t.bounds.left<=0&&t.direction===e.OutModeDirection.left&&(t.particle.position.x=n),t.outMode===e.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:i,bounds:d,canvasSize:u,offset:l,size:c}),function(t){if(t.outMode!==e.OutMode.bounce&&t.outMode!==e.OutMode.split||t.direction!==e.OutModeDirection.bottom&&t.direction!==e.OutModeDirection.top)return;t.bounds.bottom<0&&t.direction===e.OutModeDirection.top?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&t.direction===e.OutModeDirection.bottom&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);const i=t.particle.velocity.y;let s=!1;if(t.direction===e.OutModeDirection.bottom&&t.bounds.bottom>=t.canvasSize.height&&i>0||t.direction===e.OutModeDirection.top&&t.bounds.top<=0&&i<0){const i=e.getRangeValue(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-i,s=!0}if(!s)return;const n=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height&&t.direction===e.OutModeDirection.bottom?t.particle.position.y=t.canvasSize.height-n:t.bounds.top<=0&&t.direction===e.OutModeDirection.top&&(t.particle.position.y=n),t.outMode===e.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:i,bounds:d,canvasSize:u,offset:l,size:c})}}class s{container;modes;constructor(t){this.container=t,this.modes=[e.OutMode.destroy]}update(t,i,s,n){if(!this.modes.includes(n))return;const o=this.container;switch(t.outType){case e.ParticleOutType.normal:case e.ParticleOutType.outside:if(e.isPointInside(t.position,o.canvas.size,e.originPoint,t.getRadius(),i))return;break;case e.ParticleOutType.inside:{const{dx:i,dy:s}=e.getDistances(t.position,t.moveCenter),{x:n,y:o}=t.velocity;if(n<0&&i>t.moveCenter.radius||o<0&&s>t.moveCenter.radius||n>=0&&i<-t.moveCenter.radius||o>=0&&s<-t.moveCenter.radius)return;break}}t.destroy(!0)}}class n{container;modes;constructor(t){this.container=t,this.modes=[e.OutMode.none]}update(t,i,s,n){if(!this.modes.includes(n))return;if((t.options.move.distance.horizontal&&(i===e.OutModeDirection.left||i===e.OutModeDirection.right))??(t.options.move.distance.vertical&&(i===e.OutModeDirection.top||i===e.OutModeDirection.bottom)))return;const o=t.options.move.gravity,a=this.container,r=a.canvas.size,l=t.getRadius();if(o.enable){const s=t.position;(!o.inverse&&s.y>r.height+l&&i===e.OutModeDirection.bottom||o.inverse&&s.y<-l&&i===e.OutModeDirection.top)&&t.destroy()}else{if(t.velocity.y>0&&t.position.y<=r.height+l||t.velocity.y<0&&t.position.y>=-l||t.velocity.x>0&&t.position.x<=r.width+l||t.velocity.x<0&&t.position.x>=-l)return;e.isPointInside(t.position,a.canvas.size,e.originPoint,l,i)||t.destroy()}}}const o=e.Vector.origin;class a{container;modes;constructor(t){this.container=t,this.modes=[e.OutMode.out]}update(t,i,s,n){if(!this.modes.includes(n))return;const a=this.container;switch(t.outType){case e.ParticleOutType.inside:{const{x:i,y:s}=t.velocity;o.setTo(e.originPoint),o.length=t.moveCenter.radius,o.angle=t.velocity.angle+Math.PI,o.addTo(t.moveCenter);const{dx:n,dy:r}=e.getDistances(t.position,o);if(i<=0&&n>=0||s<=0&&r>=0||i>=0&&n<=0||s>=0&&r<=0)return;t.position.x=Math.floor(e.randomInRangeValue({min:0,max:a.canvas.size.width})),t.position.y=Math.floor(e.randomInRangeValue({min:0,max:a.canvas.size.height}));const{dx:l,dy:c}=e.getDistances(t.position,t.moveCenter);t.direction=Math.atan2(-c,-l),t.velocity.angle=t.direction,t.justWarped=!0;break}default:if(e.isPointInside(t.position,a.canvas.size,e.originPoint,t.getRadius(),i))return;switch(t.outType){case e.ParticleOutType.outside:{t.position.x=Math.floor(e.randomInRangeValue({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor(e.randomInRangeValue({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;const{dx:i,dy:s}=e.getDistances(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(s,i),t.velocity.angle=t.direction),t.justWarped=!0;break}case e.ParticleOutType.normal:{const s=t.options.move.warp,n=a.canvas.size,o={bottom:n.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:n.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),l=e.calculateBounds(t.position,r);i===e.OutModeDirection.right&&l.left>n.width+t.offset.x?(t.position.x=o.left,t.initialPosition.x=t.position.x,s||(t.position.y=e.getRandom()*n.height,t.initialPosition.y=t.position.y),t.justWarped=!0):i===e.OutModeDirection.left&&l.right<-t.offset.x&&(t.position.x=o.right,t.initialPosition.x=t.position.x,s||(t.position.y=e.getRandom()*n.height,t.initialPosition.y=t.position.y),t.justWarped=!0),i===e.OutModeDirection.bottom&&l.top>n.height+t.offset.y?(s||(t.position.x=e.getRandom()*n.width,t.initialPosition.x=t.position.x),t.position.y=o.top,t.initialPosition.y=t.position.y,t.justWarped=!0):i===e.OutModeDirection.top&&l.bottom<-t.offset.y&&(s||(t.position.x=e.getRandom()*n.width,t.initialPosition.x=t.position.x),t.position.y=o.bottom,t.initialPosition.y=t.position.y,t.justWarped=!0);break}}}}}class r{updaters;container;constructor(t){this.container=t,this.updaters=new Map}init(t){this._addUpdaterIfMissing(t,e.OutMode.bounce,t=>new i(t)),this._addUpdaterIfMissing(t,e.OutMode.out,t=>new a(t)),this._addUpdaterIfMissing(t,e.OutMode.destroy,t=>new s(t)),this._addUpdaterIfMissing(t,e.OutMode.none,t=>new n(t))}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,i){const s=t.options.move.outModes;t.justWarped=!1,this._updateOutMode(t,i,s.bottom??s.default,e.OutModeDirection.bottom),this._updateOutMode(t,i,s.left??s.default,e.OutModeDirection.left),this._updateOutMode(t,i,s.right??s.default,e.OutModeDirection.right),this._updateOutMode(t,i,s.top??s.default,e.OutModeDirection.top)}_addUpdaterIfMissing=(t,e,i)=>{const s=t.options.move.outModes;!this.updaters.has(e)&&((t,e)=>t.default===e||t.bottom===e||t.left===e||t.right===e||t.top===e)(s,e)&&this.updaters.set(e,i(this.container))};_updateOutMode=(t,e,i,s)=>{for(const n of this.updaters.values())n.update(t,s,e,i)}}async function l(t){t.checkVersion("4.0.4"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("outModes",t=>Promise.resolve(new r(t)))})}const c=globalThis;c.__tsParticlesInternals=c.__tsParticlesInternals??{},c.loadOutModesUpdater=l,t.loadOutModesUpdater=l}),Object.assign(globalThis.window||globalThis,{loadOutModesUpdater:(globalThis.__tsParticlesInternals.updaters.outModes||{}).loadOutModesUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.outModes=t.__tsParticlesInternals.updaters.outModes||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class s{modes;#t;#e;constructor(t){this.#t=t,this.modes=[e.OutMode.bounce,e.OutMode.split],this.#e=t.plugins.filter(t=>void 0!==t.particleBounce)}update(t,s,i,n){if(!this.modes.includes(n))return;const o=this.#t;let a=!1;for(const e of this.#e)if(a=e.particleBounce?.(t,i,s)??!1,a)break;if(a)return;const r=t.getPosition(),l=t.offset,c=t.getRadius(),d=e.calculateBounds(r,c),u=o.canvas.size,p=!t.isInsideCanvasForOutMode(n,s);!function(t){if(t.outMode!==e.OutMode.bounce&&t.outMode!==e.OutMode.split||t.direction!==e.OutModeDirection.left&&t.direction!==e.OutModeDirection.right)return;t.bounds.right<0&&t.direction===e.OutModeDirection.left?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&t.direction===e.OutModeDirection.right&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);const s=t.particle.velocity.x;let i=!1;if(t.outOfCanvas&&(t.direction===e.OutModeDirection.right&&s>0||t.direction===e.OutModeDirection.left&&s<0)){const s=e.getRangeValue(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-s,i=!0}if(!i)return;const n=t.offset.x+t.size;t.outOfCanvas&&t.direction===e.OutModeDirection.right?t.particle.position.x=t.canvasSize.width-n:t.outOfCanvas&&t.direction===e.OutModeDirection.left&&(t.particle.position.x=n),t.outMode===e.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:s,bounds:d,canvasSize:u,offset:l,outOfCanvas:p,size:c}),function(t){if(t.outMode!==e.OutMode.bounce&&t.outMode!==e.OutMode.split||t.direction!==e.OutModeDirection.bottom&&t.direction!==e.OutModeDirection.top)return;t.bounds.bottom<0&&t.direction===e.OutModeDirection.top?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&t.direction===e.OutModeDirection.bottom&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);const s=t.particle.velocity.y;let i=!1;if(t.outOfCanvas&&(t.direction===e.OutModeDirection.bottom&&s>0||t.direction===e.OutModeDirection.top&&s<0)){const s=e.getRangeValue(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-s,i=!0}if(!i)return;const n=t.offset.y+t.size;t.outOfCanvas&&t.direction===e.OutModeDirection.bottom?t.particle.position.y=t.canvasSize.height-n:t.outOfCanvas&&t.direction===e.OutModeDirection.top&&(t.particle.position.y=n),t.outMode===e.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:s,bounds:d,canvasSize:u,offset:l,outOfCanvas:p,size:c})}}class i{modes;constructor(t){this.modes=[e.OutMode.destroy]}update(t,s,i,n){if(this.modes.includes(n)){switch(t.outType){case e.ParticleOutType.normal:case e.ParticleOutType.outside:if(t.isInsideCanvasForOutMode(n,s))return;break;case e.ParticleOutType.inside:{const{dx:s,dy:i}=e.getDistances(t.position,t.moveCenter),{x:n,y:o}=t.velocity;if(n<0&&s>t.moveCenter.radius||o<0&&i>t.moveCenter.radius||n>=0&&s<-t.moveCenter.radius||o>=0&&i<-t.moveCenter.radius)return;break}}t.destroy(!0)}}}class n{modes;#t;constructor(t){this.#t=t,this.modes=[e.OutMode.none]}update(t,s,i,n){if(!this.modes.includes(n))return;if((t.options.move.distance.horizontal&&(s===e.OutModeDirection.left||s===e.OutModeDirection.right))??(t.options.move.distance.vertical&&(s===e.OutModeDirection.top||s===e.OutModeDirection.bottom)))return;const o=t.options.move.gravity,a=this.#t,r=a.canvas.size,l=t.getRadius();if(o.enable){const i=t.position;(!o.inverse&&i.y>r.height+l&&s===e.OutModeDirection.bottom||o.inverse&&i.y<-l&&s===e.OutModeDirection.top)&&t.destroy()}else{if(t.velocity.y>0&&t.position.y<=r.height+l||t.velocity.y<0&&t.position.y>=-l||t.velocity.x>0&&t.position.x<=r.width+l||t.velocity.x<0&&t.position.x>=-l)return;e.isPointInside(t.position,a.canvas.size,e.originPoint,l,s)||t.destroy()}}}const o=e.Vector.origin;class a{modes;#t;constructor(t){this.#t=t,this.modes=[e.OutMode.out]}update(t,s,i,n){if(!this.modes.includes(n))return;const a=this.#t;switch(t.outType){case e.ParticleOutType.inside:{const{x:s,y:i}=t.velocity;o.setTo(e.originPoint),o.length=t.moveCenter.radius,o.angle=t.velocity.angle+Math.PI,o.addTo(t.moveCenter);const{dx:n,dy:r}=e.getDistances(t.position,o);if(s<=0&&n>=0||i<=0&&r>=0||s>=0&&n<=0||i>=0&&r<=0)return;t.position.x=Math.floor(e.randomInRangeValue({min:0,max:a.canvas.size.width})),t.position.y=Math.floor(e.randomInRangeValue({min:0,max:a.canvas.size.height}));const{dx:l,dy:c}=e.getDistances(t.position,t.moveCenter);t.direction=Math.atan2(-c,-l),t.velocity.angle=t.direction,t.justWarped=!0;break}default:if(t.isInsideCanvasForOutMode(n,s))return;switch(t.outType){case e.ParticleOutType.outside:{t.position.x=Math.floor(e.randomInRangeValue({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor(e.randomInRangeValue({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;const{dx:s,dy:i}=e.getDistances(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(i,s),t.velocity.angle=t.direction),t.justWarped=!0;break}case e.ParticleOutType.normal:{const i=t.options.move.warp,n=a.canvas.size,o={bottom:n.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:n.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),l=e.calculateBounds(t.position,r);s===e.OutModeDirection.right&&l.left>n.width+t.offset.x?(t.position.x=o.left,t.initialPosition.x=t.position.x,i||(t.position.y=e.getRandom()*n.height,t.initialPosition.y=t.position.y),t.justWarped=!0):s===e.OutModeDirection.left&&l.right<-t.offset.x&&(t.position.x=o.right,t.initialPosition.x=t.position.x,i||(t.position.y=e.getRandom()*n.height,t.initialPosition.y=t.position.y),t.justWarped=!0),s===e.OutModeDirection.bottom&&l.top>n.height+t.offset.y?(i||(t.position.x=e.getRandom()*n.width,t.initialPosition.x=t.position.x),t.position.y=o.top,t.initialPosition.y=t.position.y,t.justWarped=!0):s===e.OutModeDirection.top&&l.bottom<-t.offset.y&&(i||(t.position.x=e.getRandom()*n.width,t.initialPosition.x=t.position.x),t.position.y=o.bottom,t.initialPosition.y=t.position.y,t.justWarped=!0);break}}}}}class r{updaters;#t;constructor(t){this.#t=t,this.updaters=new Map}init(t){this.#s(t,e.OutMode.bounce,t=>new s(t)),this.#s(t,e.OutMode.out,t=>new a(t)),this.#s(t,e.OutMode.destroy,t=>new i(t)),this.#s(t,e.OutMode.none,t=>new n(t))}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,s){const i=t.options.move.outModes;t.justWarped=!1,this.#i(t,s,i.bottom??i.default,e.OutModeDirection.bottom),this.#i(t,s,i.left??i.default,e.OutModeDirection.left),this.#i(t,s,i.right??i.default,e.OutModeDirection.right),this.#i(t,s,i.top??i.default,e.OutModeDirection.top)}#s=(t,e,s)=>{const i=t.options.move.outModes;!this.updaters.has(e)&&((t,e)=>t.default===e||t.bottom===e||t.left===e||t.right===e||t.top===e)(i,e)&&this.updaters.set(e,s(this.#t))};#i=(t,e,s,i)=>{for(const n of this.updaters.values())n.update(t,i,e,s)}}async function l(t){t.checkVersion("4.1.0"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("outModes",t=>Promise.resolve(new r(t)))})}const c=globalThis;c.__tsParticlesInternals=c.__tsParticlesInternals??{},c.loadOutModesUpdater=l,t.loadOutModesUpdater=l}),Object.assign(globalThis.window||globalThis,{loadOutModesUpdater:(globalThis.__tsParticlesInternals.updaters.outModes||{}).loadOutModesUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
package/types/BounceOutMode.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type Container, type IDelta, OutMode, type OutModeDirection, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { IOutModeManager } from "./IOutModeManager.js";
|
|
3
3
|
export declare class BounceOutMode implements IOutModeManager {
|
|
4
|
-
private
|
|
4
|
+
#private;
|
|
5
5
|
modes: (OutMode | keyof typeof OutMode)[];
|
|
6
|
-
private readonly _particleBouncePlugins;
|
|
7
6
|
constructor(container: Container);
|
|
8
7
|
update(particle: Particle, direction: OutModeDirection, delta: IDelta, outMode: OutMode | keyof typeof OutMode): void;
|
|
9
8
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type Container, type IDelta, OutMode, type OutModeDirection, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { IOutModeManager } from "./IOutModeManager.js";
|
|
3
3
|
export declare class DestroyOutMode implements IOutModeManager {
|
|
4
|
-
private readonly container;
|
|
5
4
|
modes: (OutMode | keyof typeof OutMode)[];
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(_container: Container);
|
|
7
6
|
update(particle: Particle, direction: OutModeDirection, _delta: IDelta, outMode: OutMode | keyof typeof OutMode): void;
|
|
8
7
|
}
|
package/types/IBounceData.d.ts
CHANGED
package/types/NoneOutMode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Container, type IDelta, OutMode, OutModeDirection, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { IOutModeManager } from "./IOutModeManager.js";
|
|
3
3
|
export declare class NoneOutMode implements IOutModeManager {
|
|
4
|
-
private
|
|
4
|
+
#private;
|
|
5
5
|
modes: (OutMode | keyof typeof OutMode)[];
|
|
6
6
|
constructor(container: Container);
|
|
7
7
|
update(particle: Particle, direction: OutModeDirection, _delta: IDelta, outMode: OutMode | keyof typeof OutMode): void;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type Container, type IDelta, type IParticleUpdater, OutMode, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { IOutModeManager } from "./IOutModeManager.js";
|
|
3
3
|
export declare class OutOfCanvasUpdater implements IParticleUpdater {
|
|
4
|
+
#private;
|
|
4
5
|
updaters: Map<OutMode, IOutModeManager>;
|
|
5
|
-
private readonly container;
|
|
6
6
|
constructor(container: Container);
|
|
7
7
|
init(particle: Particle): void;
|
|
8
8
|
isEnabled(particle: Particle): boolean;
|
|
9
9
|
update(particle: Particle, delta: IDelta): void;
|
|
10
|
-
private readonly _addUpdaterIfMissing;
|
|
11
|
-
private readonly _updateOutMode;
|
|
12
10
|
}
|
package/types/OutOutMode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Container, type IDelta, OutMode, OutModeDirection, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { IOutModeManager } from "./IOutModeManager.js";
|
|
3
3
|
export declare class OutOutMode implements IOutModeManager {
|
|
4
|
-
private
|
|
4
|
+
#private;
|
|
5
5
|
modes: (OutMode | keyof typeof OutMode)[];
|
|
6
6
|
constructor(container: Container);
|
|
7
7
|
update(particle: Particle, direction: OutModeDirection, _delta: IDelta, outMode: OutMode | keyof typeof OutMode): void;
|