tsparticles 1.41.0 → 1.41.4
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/Core/Container.js +2 -2
- package/Core/Interfaces/IExternalInteractor.d.ts +1 -1
- package/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
- package/Core/Particle.js +2 -2
- package/Core/Particles.d.ts +3 -3
- package/Core/Particles.js +7 -7
- package/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/Core/Utils/FrameManager.d.ts +1 -1
- package/Core/Utils/FrameManager.js +2 -2
- package/Core/Utils/InteractionManager.d.ts +2 -2
- package/Core/Utils/InteractionManager.js +4 -4
- package/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/Interactions/External/Attract/Attractor.d.ts +1 -1
- package/Interactions/External/Attract/Attractor.js +1 -1
- package/Interactions/External/Bounce/Bouncer.d.ts +1 -1
- package/Interactions/External/Bounce/Bouncer.js +1 -1
- package/Interactions/External/Bubble/Bubbler.d.ts +1 -1
- package/Interactions/External/Bubble/Bubbler.js +1 -1
- package/Interactions/External/Connect/Connector.d.ts +1 -1
- package/Interactions/External/Connect/Connector.js +1 -1
- package/Interactions/External/Grab/Grabber.d.ts +1 -1
- package/Interactions/External/Grab/Grabber.js +1 -1
- package/Interactions/External/Repulse/Repulser.d.ts +1 -1
- package/Interactions/External/Repulse/Repulser.js +1 -1
- package/Interactions/External/Trail/TrailMaker.d.ts +1 -1
- package/Interactions/External/Trail/TrailMaker.js +1 -1
- package/Interactions/Particles/Attract/Attractor.d.ts +1 -1
- package/Interactions/Particles/Attract/Attractor.js +1 -1
- package/Interactions/Particles/Collisions/Collider.d.ts +1 -1
- package/Interactions/Particles/Collisions/Collider.js +1 -1
- package/Interactions/Particles/Links/Linker.d.ts +1 -1
- package/Interactions/Particles/Links/Linker.js +1 -1
- package/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
- package/Updaters/Opacity/OpacityUpdater.js +7 -5
- package/Updaters/Size/SizeUpdater.js +6 -5
- package/browser/Core/Container.js +2 -2
- package/browser/Core/Interfaces/IExternalInteractor.d.ts +1 -1
- package/browser/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
- package/browser/Core/Particle.js +2 -2
- package/browser/Core/Particles.d.ts +3 -3
- package/browser/Core/Particles.js +7 -7
- package/browser/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/browser/Core/Utils/FrameManager.d.ts +1 -1
- package/browser/Core/Utils/FrameManager.js +2 -2
- package/browser/Core/Utils/InteractionManager.d.ts +2 -2
- package/browser/Core/Utils/InteractionManager.js +4 -4
- package/browser/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/browser/Interactions/External/Attract/Attractor.d.ts +1 -1
- package/browser/Interactions/External/Attract/Attractor.js +1 -1
- package/browser/Interactions/External/Bounce/Bouncer.d.ts +1 -1
- package/browser/Interactions/External/Bounce/Bouncer.js +1 -1
- package/browser/Interactions/External/Bubble/Bubbler.d.ts +1 -1
- package/browser/Interactions/External/Bubble/Bubbler.js +1 -1
- package/browser/Interactions/External/Connect/Connector.d.ts +1 -1
- package/browser/Interactions/External/Connect/Connector.js +1 -1
- package/browser/Interactions/External/Grab/Grabber.d.ts +1 -1
- package/browser/Interactions/External/Grab/Grabber.js +1 -1
- package/browser/Interactions/External/Repulse/Repulser.d.ts +1 -1
- package/browser/Interactions/External/Repulse/Repulser.js +1 -1
- package/browser/Interactions/External/Trail/TrailMaker.d.ts +1 -1
- package/browser/Interactions/External/Trail/TrailMaker.js +1 -1
- package/browser/Interactions/Particles/Attract/Attractor.d.ts +1 -1
- package/browser/Interactions/Particles/Attract/Attractor.js +1 -1
- package/browser/Interactions/Particles/Collisions/Collider.d.ts +1 -1
- package/browser/Interactions/Particles/Collisions/Collider.js +1 -1
- package/browser/Interactions/Particles/Links/Linker.d.ts +1 -1
- package/browser/Interactions/Particles/Links/Linker.js +1 -1
- package/browser/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
- package/browser/Updaters/Opacity/OpacityUpdater.js +7 -5
- package/browser/Updaters/Size/SizeUpdater.js +6 -5
- package/esm/Core/Container.js +2 -2
- package/esm/Core/Interfaces/IExternalInteractor.d.ts +1 -1
- package/esm/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
- package/esm/Core/Particle.js +2 -2
- package/esm/Core/Particles.d.ts +3 -3
- package/esm/Core/Particles.js +7 -7
- package/esm/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/esm/Core/Utils/FrameManager.d.ts +1 -1
- package/esm/Core/Utils/FrameManager.js +2 -2
- package/esm/Core/Utils/InteractionManager.d.ts +2 -2
- package/esm/Core/Utils/InteractionManager.js +4 -4
- package/esm/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/esm/Interactions/External/Attract/Attractor.d.ts +1 -1
- package/esm/Interactions/External/Attract/Attractor.js +1 -1
- package/esm/Interactions/External/Bounce/Bouncer.d.ts +1 -1
- package/esm/Interactions/External/Bounce/Bouncer.js +1 -1
- package/esm/Interactions/External/Bubble/Bubbler.d.ts +1 -1
- package/esm/Interactions/External/Bubble/Bubbler.js +1 -1
- package/esm/Interactions/External/Connect/Connector.d.ts +1 -1
- package/esm/Interactions/External/Connect/Connector.js +1 -1
- package/esm/Interactions/External/Grab/Grabber.d.ts +1 -1
- package/esm/Interactions/External/Grab/Grabber.js +1 -1
- package/esm/Interactions/External/Repulse/Repulser.d.ts +1 -1
- package/esm/Interactions/External/Repulse/Repulser.js +1 -1
- package/esm/Interactions/External/Trail/TrailMaker.d.ts +1 -1
- package/esm/Interactions/External/Trail/TrailMaker.js +1 -1
- package/esm/Interactions/Particles/Attract/Attractor.d.ts +1 -1
- package/esm/Interactions/Particles/Attract/Attractor.js +1 -1
- package/esm/Interactions/Particles/Collisions/Collider.d.ts +1 -1
- package/esm/Interactions/Particles/Collisions/Collider.js +1 -1
- package/esm/Interactions/Particles/Links/Linker.d.ts +1 -1
- package/esm/Interactions/Particles/Links/Linker.js +1 -1
- package/esm/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
- package/esm/Updaters/Opacity/OpacityUpdater.js +7 -5
- package/esm/Updaters/Size/SizeUpdater.js +6 -5
- package/package.json +1 -1
- package/report.html +6 -5
- package/report.slim.html +6 -5
- package/tsparticles.engine.js +17 -17
- package/tsparticles.engine.min.js +2 -2
- package/tsparticles.interaction.external.attract.js +16 -16
- package/tsparticles.interaction.external.attract.min.js +2 -2
- package/tsparticles.interaction.external.bounce.js +16 -16
- package/tsparticles.interaction.external.bounce.min.js +2 -2
- package/tsparticles.interaction.external.bubble.js +16 -16
- package/tsparticles.interaction.external.bubble.min.js +2 -2
- package/tsparticles.interaction.external.connect.js +16 -16
- package/tsparticles.interaction.external.connect.min.js +2 -2
- package/tsparticles.interaction.external.grab.js +16 -16
- package/tsparticles.interaction.external.grab.min.js +2 -2
- package/tsparticles.interaction.external.repulse.js +16 -16
- package/tsparticles.interaction.external.repulse.min.js +2 -2
- package/tsparticles.interaction.external.trail.js +16 -16
- package/tsparticles.interaction.external.trail.min.js +2 -2
- package/tsparticles.interaction.particles.attract.js +16 -16
- package/tsparticles.interaction.particles.attract.min.js +2 -2
- package/tsparticles.interaction.particles.collisions.js +16 -16
- package/tsparticles.interaction.particles.collisions.min.js +2 -2
- package/tsparticles.interaction.particles.links.js +16 -16
- package/tsparticles.interaction.particles.links.min.js +2 -2
- package/tsparticles.js +35 -35
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.min.js +1 -1
- package/tsparticles.plugins.absorbers.js +15 -15
- package/tsparticles.plugins.absorbers.min.js +1 -1
- package/tsparticles.plugins.emitters.js +15 -15
- package/tsparticles.plugins.emitters.min.js +1 -1
- package/tsparticles.plugins.polygonMask.js +17 -17
- package/tsparticles.plugins.polygonMask.min.js +2 -2
- package/tsparticles.shape.circle.min.js +1 -1
- package/tsparticles.shape.image.js +15 -15
- package/tsparticles.shape.image.min.js +1 -1
- package/tsparticles.shape.line.min.js +1 -1
- package/tsparticles.shape.polygon.min.js +1 -1
- package/tsparticles.shape.square.min.js +1 -1
- package/tsparticles.shape.star.min.js +1 -1
- package/tsparticles.shape.text.js +15 -15
- package/tsparticles.shape.text.min.js +1 -1
- package/tsparticles.slim.js +32 -32
- package/tsparticles.slim.min.js +2 -2
- package/tsparticles.updater.angle.js +15 -15
- package/tsparticles.updater.angle.min.js +1 -1
- package/tsparticles.updater.color.js +15 -15
- package/tsparticles.updater.color.min.js +1 -1
- package/tsparticles.updater.life.js +15 -15
- package/tsparticles.updater.life.min.js +1 -1
- package/tsparticles.updater.opacity.js +18 -18
- package/tsparticles.updater.opacity.min.js +2 -2
- package/tsparticles.updater.outModes.js +15 -15
- package/tsparticles.updater.outModes.min.js +1 -1
- package/tsparticles.updater.roll.js +15 -15
- package/tsparticles.updater.roll.min.js +1 -1
- package/tsparticles.updater.size.js +18 -18
- package/tsparticles.updater.size.min.js +2 -2
- package/tsparticles.updater.strokeColor.js +15 -15
- package/tsparticles.updater.strokeColor.min.js +1 -1
- package/tsparticles.updater.tilt.js +15 -15
- package/tsparticles.updater.tilt.min.js +1 -1
- package/tsparticles.updater.wobble.js +15 -15
- package/tsparticles.updater.wobble.min.js +1 -1
- package/umd/Core/Container.js +2 -2
- package/umd/Core/Interfaces/IExternalInteractor.d.ts +1 -1
- package/umd/Core/Interfaces/IParticlesInteractor.d.ts +1 -1
- package/umd/Core/Particle.js +2 -2
- package/umd/Core/Particles.d.ts +3 -3
- package/umd/Core/Particles.js +7 -7
- package/umd/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/umd/Core/Utils/FrameManager.d.ts +1 -1
- package/umd/Core/Utils/FrameManager.js +2 -2
- package/umd/Core/Utils/InteractionManager.d.ts +2 -2
- package/umd/Core/Utils/InteractionManager.js +4 -4
- package/umd/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/umd/Interactions/External/Attract/Attractor.d.ts +1 -1
- package/umd/Interactions/External/Attract/Attractor.js +1 -1
- package/umd/Interactions/External/Bounce/Bouncer.d.ts +1 -1
- package/umd/Interactions/External/Bounce/Bouncer.js +1 -1
- package/umd/Interactions/External/Bubble/Bubbler.d.ts +1 -1
- package/umd/Interactions/External/Bubble/Bubbler.js +1 -1
- package/umd/Interactions/External/Connect/Connector.d.ts +1 -1
- package/umd/Interactions/External/Connect/Connector.js +1 -1
- package/umd/Interactions/External/Grab/Grabber.d.ts +1 -1
- package/umd/Interactions/External/Grab/Grabber.js +1 -1
- package/umd/Interactions/External/Repulse/Repulser.d.ts +1 -1
- package/umd/Interactions/External/Repulse/Repulser.js +1 -1
- package/umd/Interactions/External/Trail/TrailMaker.d.ts +1 -1
- package/umd/Interactions/External/Trail/TrailMaker.js +1 -1
- package/umd/Interactions/Particles/Attract/Attractor.d.ts +1 -1
- package/umd/Interactions/Particles/Attract/Attractor.js +1 -1
- package/umd/Interactions/Particles/Collisions/Collider.d.ts +1 -1
- package/umd/Interactions/Particles/Collisions/Collider.js +1 -1
- package/umd/Interactions/Particles/Links/Linker.d.ts +1 -1
- package/umd/Interactions/Particles/Links/Linker.js +1 -1
- package/umd/Plugins/PolygonMask/PolygonMaskInstance.js +1 -1
- package/umd/Updaters/Opacity/OpacityUpdater.js +7 -5
- package/umd/Updaters/Size/SizeUpdater.js +6 -5
|
@@ -37,21 +37,21 @@ export class InteractionManager {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
externalInteract(delta) {
|
|
40
|
+
async externalInteract(delta) {
|
|
41
41
|
for (const interactor of this.externalInteractors) {
|
|
42
42
|
if (interactor.isEnabled()) {
|
|
43
|
-
interactor.interact(delta);
|
|
43
|
+
await interactor.interact(delta);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
particlesInteract(particle, delta) {
|
|
47
|
+
async particlesInteract(particle, delta) {
|
|
48
48
|
for (const interactor of this.externalInteractors) {
|
|
49
49
|
interactor.reset(particle);
|
|
50
50
|
}
|
|
51
51
|
/* interaction auto between particles */
|
|
52
52
|
for (const interactor of this.particleInteractors) {
|
|
53
53
|
if (interactor.isEnabled(particle)) {
|
|
54
|
-
interactor.interact(particle, delta);
|
|
54
|
+
await interactor.interact(particle, delta);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -6,7 +6,7 @@ export declare abstract class ParticlesInteractorBase implements IParticlesInter
|
|
|
6
6
|
protected readonly container: Container;
|
|
7
7
|
protected constructor(container: Container);
|
|
8
8
|
type: InteractorType;
|
|
9
|
-
abstract interact(particle: Particle, delta: IDelta): void
|
|
9
|
+
abstract interact(particle: Particle, delta: IDelta): Promise<void>;
|
|
10
10
|
abstract isEnabled(particle: Particle): boolean;
|
|
11
11
|
abstract reset(particle: Particle): void;
|
|
12
12
|
}
|
|
@@ -8,7 +8,7 @@ export declare class Attractor extends ExternalInteractorBase {
|
|
|
8
8
|
constructor(container: Container);
|
|
9
9
|
isEnabled(): boolean;
|
|
10
10
|
reset(): void;
|
|
11
|
-
interact(): void
|
|
11
|
+
interact(): Promise<void>;
|
|
12
12
|
private hoverAttract;
|
|
13
13
|
private processAttract;
|
|
14
14
|
private clickAttract;
|
|
@@ -19,7 +19,7 @@ export class Attractor extends ExternalInteractorBase {
|
|
|
19
19
|
reset() {
|
|
20
20
|
// do nothing
|
|
21
21
|
}
|
|
22
|
-
interact() {
|
|
22
|
+
async interact() {
|
|
23
23
|
const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode;
|
|
24
24
|
if (mouseMoveStatus && hoverEnabled && isInArray("attract" /* attract */, hoverMode)) {
|
|
25
25
|
this.hoverAttract();
|
|
@@ -3,7 +3,7 @@ import type { Container } from "../../../Core";
|
|
|
3
3
|
export declare class Bouncer extends ExternalInteractorBase {
|
|
4
4
|
constructor(container: Container);
|
|
5
5
|
isEnabled(): boolean;
|
|
6
|
-
interact(): void
|
|
6
|
+
interact(): Promise<void>;
|
|
7
7
|
reset(): void;
|
|
8
8
|
private processMouseBounce;
|
|
9
9
|
private singleSelectorBounce;
|
|
@@ -9,7 +9,7 @@ export class Bouncer extends ExternalInteractorBase {
|
|
|
9
9
|
return ((mouse.position && events.onHover.enable && isInArray("bounce" /* bounce */, events.onHover.mode)) ||
|
|
10
10
|
isDivModeEnabled("bounce" /* bounce */, divs));
|
|
11
11
|
}
|
|
12
|
-
interact() {
|
|
12
|
+
async interact() {
|
|
13
13
|
const container = this.container, options = container.actualOptions, events = options.interactivity.events, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, divs = events.onDiv;
|
|
14
14
|
if (mouseMoveStatus && hoverEnabled && isInArray("bounce" /* bounce */, hoverMode)) {
|
|
15
15
|
this.processMouseBounce();
|
|
@@ -9,7 +9,7 @@ export declare class Bubbler extends ExternalInteractorBase {
|
|
|
9
9
|
constructor(container: Container);
|
|
10
10
|
isEnabled(): boolean;
|
|
11
11
|
reset(particle: Particle, force?: boolean): void;
|
|
12
|
-
interact(): void
|
|
12
|
+
interact(): Promise<void>;
|
|
13
13
|
private singleSelectorHover;
|
|
14
14
|
private process;
|
|
15
15
|
private clickBubble;
|
|
@@ -36,7 +36,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
36
36
|
delete particle.bubble.radius;
|
|
37
37
|
delete particle.bubble.color;
|
|
38
38
|
}
|
|
39
|
-
interact() {
|
|
39
|
+
async interact() {
|
|
40
40
|
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
41
41
|
/* on hover event */
|
|
42
42
|
if (hoverEnabled && isInArray("bubble" /* bubble */, hoverMode)) {
|
|
@@ -21,7 +21,7 @@ export class Connector extends ExternalInteractorBase {
|
|
|
21
21
|
/**
|
|
22
22
|
* Connecting particles on hover interactivity
|
|
23
23
|
*/
|
|
24
|
-
interact() {
|
|
24
|
+
async interact() {
|
|
25
25
|
const container = this.container, options = container.actualOptions;
|
|
26
26
|
if (options.interactivity.events.onHover.enable && container.interactivity.status === "mousemove") {
|
|
27
27
|
const mousePos = container.interactivity.mouse.position;
|
|
@@ -15,7 +15,7 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
15
15
|
reset() {
|
|
16
16
|
// do nothing
|
|
17
17
|
}
|
|
18
|
-
interact() {
|
|
18
|
+
async interact() {
|
|
19
19
|
var _a;
|
|
20
20
|
const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
|
|
21
21
|
if (interactivity.events.onHover.enable && container.interactivity.status === Constants.mouseMoveEvent) {
|
|
@@ -8,7 +8,7 @@ export declare class Repulser extends ExternalInteractorBase {
|
|
|
8
8
|
constructor(container: Container);
|
|
9
9
|
isEnabled(): boolean;
|
|
10
10
|
reset(): void;
|
|
11
|
-
interact(): void
|
|
11
|
+
interact(): Promise<void>;
|
|
12
12
|
private singleSelectorRepulse;
|
|
13
13
|
private hoverRepulse;
|
|
14
14
|
private processRepulse;
|
|
@@ -19,7 +19,7 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
19
19
|
reset() {
|
|
20
20
|
// do nothing
|
|
21
21
|
}
|
|
22
|
-
interact() {
|
|
22
|
+
async interact() {
|
|
23
23
|
const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode, divs = events.onDiv;
|
|
24
24
|
if (mouseMoveStatus && hoverEnabled && isInArray("repulse" /* repulse */, hoverMode)) {
|
|
25
25
|
this.hoverRepulse();
|
|
@@ -7,7 +7,7 @@ export declare class TrailMaker extends ExternalInteractorBase {
|
|
|
7
7
|
private delay;
|
|
8
8
|
private lastPosition?;
|
|
9
9
|
constructor(container: Container);
|
|
10
|
-
interact(delta: IDelta): void
|
|
10
|
+
interact(delta: IDelta): Promise<void>;
|
|
11
11
|
isEnabled(): boolean;
|
|
12
12
|
reset(): void;
|
|
13
13
|
}
|
|
@@ -5,7 +5,7 @@ import { ParticlesInteractorBase } from "../../../Core";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class Attractor extends ParticlesInteractorBase {
|
|
7
7
|
constructor(container: Container);
|
|
8
|
-
interact(p1: IParticle): void
|
|
8
|
+
interact(p1: IParticle): Promise<void>;
|
|
9
9
|
isEnabled(particle: Particle): boolean;
|
|
10
10
|
reset(): void;
|
|
11
11
|
}
|
|
@@ -7,7 +7,7 @@ export class Attractor extends ParticlesInteractorBase {
|
|
|
7
7
|
constructor(container) {
|
|
8
8
|
super(container);
|
|
9
9
|
}
|
|
10
|
-
interact(p1) {
|
|
10
|
+
async interact(p1) {
|
|
11
11
|
var _a;
|
|
12
12
|
const container = this.container, distance = (_a = p1.retina.attractDistance) !== null && _a !== void 0 ? _a : container.retina.attractDistance, pos1 = p1.getPosition(), query = container.particles.quadTree.queryCircle(pos1, distance);
|
|
13
13
|
for (const p2 of query) {
|
|
@@ -7,7 +7,7 @@ export declare class Collider extends ParticlesInteractorBase {
|
|
|
7
7
|
constructor(container: Container);
|
|
8
8
|
isEnabled(particle: Particle): boolean;
|
|
9
9
|
reset(): void;
|
|
10
|
-
interact(p1: Particle): void
|
|
10
|
+
interact(p1: Particle): Promise<void>;
|
|
11
11
|
private resolveCollision;
|
|
12
12
|
private absorb;
|
|
13
13
|
}
|
|
@@ -20,9 +20,9 @@ function updateOpacity(particle, delta) {
|
|
|
20
20
|
}
|
|
21
21
|
const minValue = particle.opacity.min;
|
|
22
22
|
const maxValue = particle.opacity.max;
|
|
23
|
-
if (
|
|
24
|
-
particle.opacity.enable
|
|
25
|
-
(((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0)
|
|
23
|
+
if (particle.destroyed ||
|
|
24
|
+
!particle.opacity.enable ||
|
|
25
|
+
(((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) > 0 && ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) > ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0))) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
switch (particle.opacity.status) {
|
|
@@ -100,12 +100,14 @@ export class OpacityUpdater {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
isEnabled(particle) {
|
|
103
|
-
var _a, _b, _c;
|
|
103
|
+
var _a, _b, _c, _d;
|
|
104
104
|
return (!particle.destroyed &&
|
|
105
105
|
!particle.spawning &&
|
|
106
106
|
!!particle.opacity &&
|
|
107
107
|
particle.opacity.enable &&
|
|
108
|
-
(((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 ||
|
|
108
|
+
(((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 ||
|
|
109
|
+
(((_b = particle.opacity.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 &&
|
|
110
|
+
((_c = particle.opacity.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.opacity.maxLoops) !== null && _d !== void 0 ? _d : 0))));
|
|
109
111
|
}
|
|
110
112
|
update(particle, delta) {
|
|
111
113
|
if (!this.isEnabled(particle)) {
|
|
@@ -18,9 +18,9 @@ function updateSize(particle, delta) {
|
|
|
18
18
|
const sizeVelocity = ((_a = particle.size.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor;
|
|
19
19
|
const minValue = particle.size.min;
|
|
20
20
|
const maxValue = particle.size.max;
|
|
21
|
-
if (
|
|
22
|
-
particle.size.enable
|
|
23
|
-
(((_b = particle.size.
|
|
21
|
+
if (particle.destroyed ||
|
|
22
|
+
!particle.size.enable ||
|
|
23
|
+
(((_b = particle.size.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) > ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0))) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
switch (particle.size.status) {
|
|
@@ -58,11 +58,12 @@ export class SizeUpdater {
|
|
|
58
58
|
// nothing
|
|
59
59
|
}
|
|
60
60
|
isEnabled(particle) {
|
|
61
|
-
var _a, _b, _c;
|
|
61
|
+
var _a, _b, _c, _d;
|
|
62
62
|
return (!particle.destroyed &&
|
|
63
63
|
!particle.spawning &&
|
|
64
64
|
particle.size.enable &&
|
|
65
|
-
(((_a = particle.size.
|
|
65
|
+
(((_a = particle.size.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 ||
|
|
66
|
+
(((_b = particle.size.maxLoops) !== null && _b !== void 0 ? _b : 0) > 0 && ((_c = particle.size.loops) !== null && _c !== void 0 ? _c : 0) < ((_d = particle.size.maxLoops) !== null && _d !== void 0 ? _d : 0))));
|
|
66
67
|
}
|
|
67
68
|
update(particle, delta) {
|
|
68
69
|
if (!this.isEnabled(particle)) {
|
package/esm/Core/Container.js
CHANGED
|
@@ -112,12 +112,12 @@ export class Container {
|
|
|
112
112
|
}
|
|
113
113
|
draw(force) {
|
|
114
114
|
let refreshTime = force;
|
|
115
|
-
this.drawAnimationFrame = animate()((timestamp) => {
|
|
115
|
+
this.drawAnimationFrame = animate()(async (timestamp) => {
|
|
116
116
|
if (refreshTime) {
|
|
117
117
|
this.lastFrameTime = undefined;
|
|
118
118
|
refreshTime = false;
|
|
119
119
|
}
|
|
120
|
-
this.drawer.nextFrame(timestamp);
|
|
120
|
+
await this.drawer.nextFrame(timestamp);
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
getAnimationStatus() {
|
|
@@ -3,5 +3,5 @@ import type { IInteractor } from "./IInteractor";
|
|
|
3
3
|
import type { Particle } from "../Particle";
|
|
4
4
|
export interface IParticlesInteractor extends IInteractor {
|
|
5
5
|
isEnabled(particle: Particle): boolean;
|
|
6
|
-
interact(particle: Particle, delta: IDelta): void
|
|
6
|
+
interact(particle: Particle, delta: IDelta): Promise<void>;
|
|
7
7
|
}
|
package/esm/Core/Particle.js
CHANGED
|
@@ -207,10 +207,10 @@ export class Particle {
|
|
|
207
207
|
return (this.getRadius() ** 2 * Math.PI) / 2;
|
|
208
208
|
}
|
|
209
209
|
getFillColor() {
|
|
210
|
-
var _a, _b
|
|
210
|
+
var _a, _b;
|
|
211
211
|
const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
|
|
212
212
|
if (color && this.roll && (this.backColor || this.roll.alter)) {
|
|
213
|
-
const
|
|
213
|
+
const backFactor = this.options.roll.mode === "both" ? 2 : 1, backSum = this.options.roll.mode === "horizontal" ? Math.PI / 2 : 0, rolled = Math.floor((((_b = this.roll.angle) !== null && _b !== void 0 ? _b : 0) + backSum) / (Math.PI / backFactor)) % 2;
|
|
214
214
|
if (rolled) {
|
|
215
215
|
if (this.backColor) {
|
|
216
216
|
return this.backColor;
|
package/esm/Core/Particles.d.ts
CHANGED
|
@@ -26,11 +26,11 @@ export declare class Particles {
|
|
|
26
26
|
private readonly mover;
|
|
27
27
|
constructor(engine: Engine, container: Container);
|
|
28
28
|
init(): void;
|
|
29
|
-
redraw(): void
|
|
29
|
+
redraw(): Promise<void>;
|
|
30
30
|
removeAt(index: number, quantity?: number, group?: string, override?: boolean): void;
|
|
31
31
|
remove(particle: Particle, group?: string, override?: boolean): void;
|
|
32
|
-
update(delta: IDelta): void
|
|
33
|
-
draw(delta: IDelta): void
|
|
32
|
+
update(delta: IDelta): Promise<void>;
|
|
33
|
+
draw(delta: IDelta): Promise<void>;
|
|
34
34
|
clear(): void;
|
|
35
35
|
push(nb: number, mouse?: IMouseData, overrideOptions?: RecursivePartial<IParticles>, group?: string): void;
|
|
36
36
|
addParticle(position?: ICoordinates, overrideOptions?: RecursivePartial<IParticles>, group?: string): Particle | undefined;
|
package/esm/Core/Particles.js
CHANGED
|
@@ -72,10 +72,10 @@ export class Particles {
|
|
|
72
72
|
}
|
|
73
73
|
container.pathGenerator.init(container);
|
|
74
74
|
}
|
|
75
|
-
redraw() {
|
|
75
|
+
async redraw() {
|
|
76
76
|
this.clear();
|
|
77
77
|
this.init();
|
|
78
|
-
this.draw({ value: 0, factor: 0 });
|
|
78
|
+
await this.draw({ value: 0, factor: 0 });
|
|
79
79
|
}
|
|
80
80
|
removeAt(index, quantity = 1, group, override) {
|
|
81
81
|
if (!(index >= 0 && index <= this.count)) {
|
|
@@ -97,7 +97,7 @@ export class Particles {
|
|
|
97
97
|
remove(particle, group, override) {
|
|
98
98
|
this.removeAt(this.array.indexOf(particle), undefined, group, override);
|
|
99
99
|
}
|
|
100
|
-
update(delta) {
|
|
100
|
+
async update(delta) {
|
|
101
101
|
const container = this.container;
|
|
102
102
|
const particlesToDelete = [];
|
|
103
103
|
container.pathGenerator.update();
|
|
@@ -131,23 +131,23 @@ export class Particles {
|
|
|
131
131
|
for (const particle of particlesToDelete) {
|
|
132
132
|
this.remove(particle);
|
|
133
133
|
}
|
|
134
|
-
this.interactionManager.externalInteract(delta);
|
|
134
|
+
await this.interactionManager.externalInteract(delta);
|
|
135
135
|
for (const particle of container.particles.array) {
|
|
136
136
|
for (const updater of this.updaters) {
|
|
137
137
|
updater.update(particle, delta);
|
|
138
138
|
}
|
|
139
139
|
if (!particle.destroyed && !particle.spawning) {
|
|
140
|
-
this.interactionManager.particlesInteract(particle, delta);
|
|
140
|
+
await this.interactionManager.particlesInteract(particle, delta);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
delete container.canvas.resizeFactor;
|
|
144
144
|
}
|
|
145
|
-
draw(delta) {
|
|
145
|
+
async draw(delta) {
|
|
146
146
|
const container = this.container;
|
|
147
147
|
container.canvas.clear();
|
|
148
148
|
const canvasSize = this.container.canvas.size;
|
|
149
149
|
this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, (canvasSize.width * 3) / 2, (canvasSize.height * 3) / 2), 4);
|
|
150
|
-
this.update(delta);
|
|
150
|
+
await this.update(delta);
|
|
151
151
|
if (this.needsSort) {
|
|
152
152
|
this.zArray.sort((a, b) => b.position.z - a.position.z || a.id - b.id);
|
|
153
153
|
this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
|
|
@@ -6,7 +6,7 @@ export declare abstract class ExternalInteractorBase implements IExternalInterac
|
|
|
6
6
|
protected readonly container: Container;
|
|
7
7
|
protected constructor(container: Container);
|
|
8
8
|
type: InteractorType;
|
|
9
|
-
abstract interact(delta: IDelta): void
|
|
9
|
+
abstract interact(delta: IDelta): Promise<void>;
|
|
10
10
|
abstract isEnabled(): boolean;
|
|
11
11
|
abstract reset(particle: Particle): void;
|
|
12
12
|
}
|
|
@@ -2,7 +2,7 @@ export class FrameManager {
|
|
|
2
2
|
constructor(container) {
|
|
3
3
|
this.container = container;
|
|
4
4
|
}
|
|
5
|
-
nextFrame(timestamp) {
|
|
5
|
+
async nextFrame(timestamp) {
|
|
6
6
|
var _a;
|
|
7
7
|
try {
|
|
8
8
|
const container = this.container;
|
|
@@ -23,7 +23,7 @@ export class FrameManager {
|
|
|
23
23
|
container.draw(false);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
container.particles.draw(delta);
|
|
26
|
+
await container.particles.draw(delta);
|
|
27
27
|
if (container.duration > 0 && container.lifeTime > container.duration) {
|
|
28
28
|
container.destroy();
|
|
29
29
|
return;
|
|
@@ -9,6 +9,6 @@ export declare class InteractionManager {
|
|
|
9
9
|
private particleInteractors;
|
|
10
10
|
constructor(engine: Engine, container: Container);
|
|
11
11
|
init(): void;
|
|
12
|
-
externalInteract(delta: IDelta): void
|
|
13
|
-
particlesInteract(particle: Particle, delta: IDelta): void
|
|
12
|
+
externalInteract(delta: IDelta): Promise<void>;
|
|
13
|
+
particlesInteract(particle: Particle, delta: IDelta): Promise<void>;
|
|
14
14
|
}
|
|
@@ -34,20 +34,20 @@ export class InteractionManager {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
externalInteract(delta) {
|
|
37
|
+
async externalInteract(delta) {
|
|
38
38
|
for (const interactor of this.externalInteractors) {
|
|
39
39
|
if (interactor.isEnabled()) {
|
|
40
|
-
interactor.interact(delta);
|
|
40
|
+
await interactor.interact(delta);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
particlesInteract(particle, delta) {
|
|
44
|
+
async particlesInteract(particle, delta) {
|
|
45
45
|
for (const interactor of this.externalInteractors) {
|
|
46
46
|
interactor.reset(particle);
|
|
47
47
|
}
|
|
48
48
|
for (const interactor of this.particleInteractors) {
|
|
49
49
|
if (interactor.isEnabled(particle)) {
|
|
50
|
-
interactor.interact(particle, delta);
|
|
50
|
+
await interactor.interact(particle, delta);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -6,7 +6,7 @@ export declare abstract class ParticlesInteractorBase implements IParticlesInter
|
|
|
6
6
|
protected readonly container: Container;
|
|
7
7
|
protected constructor(container: Container);
|
|
8
8
|
type: InteractorType;
|
|
9
|
-
abstract interact(particle: Particle, delta: IDelta): void
|
|
9
|
+
abstract interact(particle: Particle, delta: IDelta): Promise<void>;
|
|
10
10
|
abstract isEnabled(particle: Particle): boolean;
|
|
11
11
|
abstract reset(particle: Particle): void;
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ export class Attractor extends ExternalInteractorBase {
|
|
|
14
14
|
}
|
|
15
15
|
reset() {
|
|
16
16
|
}
|
|
17
|
-
interact() {
|
|
17
|
+
async interact() {
|
|
18
18
|
const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode;
|
|
19
19
|
if (mouseMoveStatus && hoverEnabled && isInArray("attract", hoverMode)) {
|
|
20
20
|
this.hoverAttract();
|
|
@@ -3,7 +3,7 @@ import type { Container } from "../../../Core";
|
|
|
3
3
|
export declare class Bouncer extends ExternalInteractorBase {
|
|
4
4
|
constructor(container: Container);
|
|
5
5
|
isEnabled(): boolean;
|
|
6
|
-
interact(): void
|
|
6
|
+
interact(): Promise<void>;
|
|
7
7
|
reset(): void;
|
|
8
8
|
private processMouseBounce;
|
|
9
9
|
private singleSelectorBounce;
|
|
@@ -9,7 +9,7 @@ export class Bouncer extends ExternalInteractorBase {
|
|
|
9
9
|
return ((mouse.position && events.onHover.enable && isInArray("bounce", events.onHover.mode)) ||
|
|
10
10
|
isDivModeEnabled("bounce", divs));
|
|
11
11
|
}
|
|
12
|
-
interact() {
|
|
12
|
+
async interact() {
|
|
13
13
|
const container = this.container, options = container.actualOptions, events = options.interactivity.events, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, divs = events.onDiv;
|
|
14
14
|
if (mouseMoveStatus && hoverEnabled && isInArray("bounce", hoverMode)) {
|
|
15
15
|
this.processMouseBounce();
|
|
@@ -5,7 +5,7 @@ export declare class Bubbler extends ExternalInteractorBase {
|
|
|
5
5
|
constructor(container: Container);
|
|
6
6
|
isEnabled(): boolean;
|
|
7
7
|
reset(particle: Particle, force?: boolean): void;
|
|
8
|
-
interact(): void
|
|
8
|
+
interact(): Promise<void>;
|
|
9
9
|
private singleSelectorHover;
|
|
10
10
|
private process;
|
|
11
11
|
private clickBubble;
|
|
@@ -32,7 +32,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
32
32
|
delete particle.bubble.radius;
|
|
33
33
|
delete particle.bubble.color;
|
|
34
34
|
}
|
|
35
|
-
interact() {
|
|
35
|
+
async interact() {
|
|
36
36
|
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
37
37
|
if (hoverEnabled && isInArray("bubble", hoverMode)) {
|
|
38
38
|
this.hoverBubble();
|
|
@@ -13,7 +13,7 @@ export class Connector extends ExternalInteractorBase {
|
|
|
13
13
|
}
|
|
14
14
|
reset() {
|
|
15
15
|
}
|
|
16
|
-
interact() {
|
|
16
|
+
async interact() {
|
|
17
17
|
const container = this.container, options = container.actualOptions;
|
|
18
18
|
if (options.interactivity.events.onHover.enable && container.interactivity.status === "mousemove") {
|
|
19
19
|
const mousePos = container.interactivity.mouse.position;
|
|
@@ -10,7 +10,7 @@ export class Grabber extends ExternalInteractorBase {
|
|
|
10
10
|
}
|
|
11
11
|
reset() {
|
|
12
12
|
}
|
|
13
|
-
interact() {
|
|
13
|
+
async interact() {
|
|
14
14
|
var _a;
|
|
15
15
|
const container = this.container, options = container.actualOptions, interactivity = options.interactivity;
|
|
16
16
|
if (interactivity.events.onHover.enable && container.interactivity.status === Constants.mouseMoveEvent) {
|
|
@@ -4,7 +4,7 @@ export declare class Repulser extends ExternalInteractorBase {
|
|
|
4
4
|
constructor(container: Container);
|
|
5
5
|
isEnabled(): boolean;
|
|
6
6
|
reset(): void;
|
|
7
|
-
interact(): void
|
|
7
|
+
interact(): Promise<void>;
|
|
8
8
|
private singleSelectorRepulse;
|
|
9
9
|
private hoverRepulse;
|
|
10
10
|
private processRepulse;
|
|
@@ -14,7 +14,7 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
14
14
|
}
|
|
15
15
|
reset() {
|
|
16
16
|
}
|
|
17
|
-
interact() {
|
|
17
|
+
async interact() {
|
|
18
18
|
const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode, divs = events.onDiv;
|
|
19
19
|
if (mouseMoveStatus && hoverEnabled && isInArray("repulse", hoverMode)) {
|
|
20
20
|
this.hoverRepulse();
|