@tsparticles/engine 4.0.0-alpha.3 → 4.0.0-alpha.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/794.min.js +2 -0
- package/794.min.js.LICENSE.txt +1 -0
- package/README.md +2 -5
- package/browser/Core/Canvas.js +3 -3
- package/browser/Core/Container.js +35 -155
- package/browser/Core/Engine.js +10 -51
- package/browser/Core/Particle.js +5 -10
- package/browser/Core/Particles.js +36 -25
- package/browser/Core/Utils/Constants.js +2 -2
- package/browser/Core/Utils/EventListeners.js +5 -250
- package/browser/Options/Classes/Options.js +7 -75
- package/browser/Options/Classes/Particles/ParticlesOptions.js +5 -11
- package/{esm/Options/Classes/Interactivity/Events → browser/Options/Classes}/ResizeEvent.js +1 -1
- package/browser/Utils/ColorUtils.js +7 -5
- package/browser/Utils/Utils.js +25 -32
- package/browser/exports.js +1 -21
- package/cjs/Core/Canvas.js +3 -3
- package/cjs/Core/Container.js +35 -155
- package/cjs/Core/Engine.js +10 -51
- package/cjs/Core/Particle.js +5 -10
- package/cjs/Core/Particles.js +36 -25
- package/cjs/Core/Utils/Constants.js +2 -2
- package/cjs/Core/Utils/EventListeners.js +5 -250
- package/cjs/Options/Classes/Options.js +7 -75
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +5 -11
- package/cjs/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +1 -1
- package/cjs/Utils/ColorUtils.js +7 -5
- package/cjs/Utils/Utils.js +25 -32
- package/cjs/exports.js +1 -21
- package/dist_browser_Core_Container_js.js +6 -16
- package/esm/Core/Canvas.js +3 -3
- package/esm/Core/Container.js +35 -155
- package/esm/Core/Engine.js +10 -51
- package/esm/Core/Particle.js +5 -10
- package/esm/Core/Particles.js +36 -25
- package/esm/Core/Utils/Constants.js +2 -2
- package/esm/Core/Utils/EventListeners.js +5 -250
- package/esm/Options/Classes/Options.js +7 -75
- package/esm/Options/Classes/Particles/ParticlesOptions.js +5 -11
- package/{browser/Options/Classes/Interactivity/Events → esm/Options/Classes}/ResizeEvent.js +1 -1
- package/esm/Utils/ColorUtils.js +7 -5
- package/esm/Utils/Utils.js +25 -32
- package/esm/exports.js +1 -21
- package/package.json +1 -1
- package/report.html +1 -1
- package/tsparticles.engine.js +14 -206
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Container.d.ts +3 -15
- package/types/Core/Engine.d.ts +3 -18
- package/types/Core/Interfaces/IContainerPlugin.d.ts +8 -1
- package/types/Core/Interfaces/IPlugin.d.ts +5 -1
- package/types/Core/Particle.d.ts +0 -2
- package/types/Core/Particles.d.ts +1 -5
- package/types/Core/Utils/Constants.d.ts +2 -2
- package/types/Core/Utils/EventListeners.d.ts +0 -14
- package/types/Options/Classes/Options.d.ts +2 -11
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -2
- package/types/Options/Classes/ResizeEvent.d.ts +9 -0
- package/types/Options/Interfaces/IOptions.d.ts +2 -8
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -3
- package/types/Types/EngineInitializers.d.ts +10 -0
- package/types/Utils/Utils.d.ts +4 -6
- package/types/export-types.d.ts +3 -19
- package/types/exports.d.ts +1 -21
- package/umd/Core/Canvas.js +3 -3
- package/umd/Core/Container.js +35 -155
- package/umd/Core/Engine.js +11 -52
- package/umd/Core/Particle.js +6 -11
- package/umd/Core/Particles.js +37 -26
- package/umd/Core/Utils/Constants.js +3 -3
- package/umd/Core/Utils/EventListeners.js +7 -252
- package/umd/Options/Classes/Options.js +7 -75
- package/umd/Options/Classes/Particles/ParticlesOptions.js +5 -11
- package/umd/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +2 -2
- package/umd/Utils/ColorUtils.js +7 -5
- package/umd/Utils/Utils.js +26 -35
- package/umd/exports.js +2 -22
- package/638.min.js +0 -2
- package/638.min.js.LICENSE.txt +0 -1
- package/browser/Core/Interfaces/IMouseData.js +0 -1
- package/browser/Core/Interfaces/IParticlesInteractor.js +0 -1
- package/browser/Core/Utils/ExternalInteractorBase.js +0 -7
- package/browser/Core/Utils/InteractionManager.js +0 -60
- package/browser/Core/Utils/ParticlesInteractorBase.js +0 -7
- package/browser/Enums/InteractivityDetect.js +0 -6
- package/browser/Enums/Modes/ResponsiveMode.js +0 -5
- package/browser/Enums/Modes/ThemeMode.js +0 -6
- package/browser/Enums/Types/DivType.js +0 -5
- package/browser/Enums/Types/InteractorType.js +0 -5
- package/browser/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
- package/browser/Options/Classes/Interactivity/Events/Events.js +0 -30
- package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
- package/browser/Options/Classes/Interactivity/Events/Parallax.js +0 -22
- package/browser/Options/Classes/Interactivity/Interactivity.js +0 -22
- package/browser/Options/Classes/Interactivity/Modes/Modes.js +0 -25
- package/browser/Options/Classes/ManualParticle.js +0 -21
- package/browser/Options/Classes/Responsive.js +0 -29
- package/browser/Options/Classes/Theme/Theme.js +0 -21
- package/browser/Options/Classes/Theme/ThemeDefault.js +0 -23
- package/browser/Options/Interfaces/IManualParticle.js +0 -1
- package/browser/Options/Interfaces/IResponsive.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
- package/browser/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
- package/browser/Options/Interfaces/Theme/ITheme.js +0 -1
- package/browser/Options/Interfaces/Theme/IThemeDefault.js +0 -1
- package/cjs/Core/Interfaces/IContainerInteractivity.js +0 -1
- package/cjs/Core/Interfaces/IExternalInteractor.js +0 -1
- package/cjs/Core/Interfaces/IInteractor.js +0 -1
- package/cjs/Core/Interfaces/IMouseData.js +0 -1
- package/cjs/Core/Interfaces/IParticlesInteractor.js +0 -1
- package/cjs/Core/Utils/ExternalInteractorBase.js +0 -7
- package/cjs/Core/Utils/InteractionManager.js +0 -60
- package/cjs/Core/Utils/ParticlesInteractorBase.js +0 -7
- package/cjs/Enums/InteractivityDetect.js +0 -6
- package/cjs/Enums/Modes/ResponsiveMode.js +0 -5
- package/cjs/Enums/Modes/ThemeMode.js +0 -6
- package/cjs/Enums/Types/DivType.js +0 -5
- package/cjs/Enums/Types/InteractorType.js +0 -5
- package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
- package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
- package/cjs/Options/Classes/Interactivity/Events/Events.js +0 -30
- package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
- package/cjs/Options/Classes/Interactivity/Events/Parallax.js +0 -22
- package/cjs/Options/Classes/Interactivity/Interactivity.js +0 -22
- package/cjs/Options/Classes/Interactivity/Modes/Modes.js +0 -25
- package/cjs/Options/Classes/ManualParticle.js +0 -21
- package/cjs/Options/Classes/Responsive.js +0 -29
- package/cjs/Options/Classes/Theme/Theme.js +0 -21
- package/cjs/Options/Classes/Theme/ThemeDefault.js +0 -23
- package/cjs/Options/Interfaces/IManualParticle.js +0 -1
- package/cjs/Options/Interfaces/IResponsive.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
- package/cjs/Options/Interfaces/Theme/ITheme.js +0 -1
- package/cjs/Options/Interfaces/Theme/IThemeDefault.js +0 -1
- package/esm/Core/Interfaces/IContainerInteractivity.js +0 -1
- package/esm/Core/Interfaces/IExternalInteractor.js +0 -1
- package/esm/Core/Interfaces/IInteractor.js +0 -1
- package/esm/Core/Interfaces/IMouseData.js +0 -1
- package/esm/Core/Interfaces/IParticlesInteractor.js +0 -1
- package/esm/Core/Utils/ExternalInteractorBase.js +0 -7
- package/esm/Core/Utils/InteractionManager.js +0 -60
- package/esm/Core/Utils/ParticlesInteractorBase.js +0 -7
- package/esm/Enums/InteractivityDetect.js +0 -6
- package/esm/Enums/Modes/ResponsiveMode.js +0 -5
- package/esm/Enums/Modes/ThemeMode.js +0 -6
- package/esm/Enums/Types/DivType.js +0 -5
- package/esm/Enums/Types/InteractorType.js +0 -5
- package/esm/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
- package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
- package/esm/Options/Classes/Interactivity/Events/Events.js +0 -30
- package/esm/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
- package/esm/Options/Classes/Interactivity/Events/Parallax.js +0 -22
- package/esm/Options/Classes/Interactivity/Interactivity.js +0 -22
- package/esm/Options/Classes/Interactivity/Modes/Modes.js +0 -25
- package/esm/Options/Classes/ManualParticle.js +0 -21
- package/esm/Options/Classes/Responsive.js +0 -29
- package/esm/Options/Classes/Theme/Theme.js +0 -21
- package/esm/Options/Classes/Theme/ThemeDefault.js +0 -23
- package/esm/Options/Interfaces/IManualParticle.js +0 -1
- package/esm/Options/Interfaces/IResponsive.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
- package/esm/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
- package/esm/Options/Interfaces/Theme/ITheme.js +0 -1
- package/esm/Options/Interfaces/Theme/IThemeDefault.js +0 -1
- package/types/Core/Interfaces/IContainerInteractivity.d.ts +0 -6
- package/types/Core/Interfaces/IExternalInteractor.d.ts +0 -12
- package/types/Core/Interfaces/IInteractor.d.ts +0 -16
- package/types/Core/Interfaces/IMouseData.d.ts +0 -9
- package/types/Core/Interfaces/IParticlesInteractor.d.ts +0 -7
- package/types/Core/Utils/ExternalInteractorBase.d.ts +0 -15
- package/types/Core/Utils/InteractionManager.d.ts +0 -17
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +0 -15
- package/types/Enums/InteractivityDetect.d.ts +0 -5
- package/types/Enums/Modes/ResponsiveMode.d.ts +0 -4
- package/types/Enums/Modes/ThemeMode.d.ts +0 -5
- package/types/Enums/Types/DivType.d.ts +0 -4
- package/types/Enums/Types/InteractorType.d.ts +0 -4
- package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +0 -10
- package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -13
- package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -16
- package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +0 -12
- package/types/Options/Classes/Interactivity/Events/Parallax.d.ts +0 -10
- package/types/Options/Classes/Interactivity/Events/ResizeEvent.d.ts +0 -9
- package/types/Options/Classes/Interactivity/Interactivity.d.ts +0 -16
- package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +0 -12
- package/types/Options/Classes/ManualParticle.d.ts +0 -10
- package/types/Options/Classes/Responsive.d.ts +0 -12
- package/types/Options/Classes/Theme/Theme.d.ts +0 -12
- package/types/Options/Classes/Theme/ThemeDefault.d.ts +0 -11
- package/types/Options/Interfaces/IManualParticle.d.ts +0 -7
- package/types/Options/Interfaces/IResponsive.d.ts +0 -7
- package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +0 -5
- package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -8
- package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -11
- package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +0 -7
- package/types/Options/Interfaces/Interactivity/Events/IParallax.d.ts +0 -5
- package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -9
- package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -4
- package/types/Options/Interfaces/Interactivity/Modes/IModes.d.ts +0 -1
- package/types/Options/Interfaces/Theme/ITheme.d.ts +0 -7
- package/types/Options/Interfaces/Theme/IThemeDefault.d.ts +0 -6
- package/umd/Core/Interfaces/IExternalInteractor.js +0 -12
- package/umd/Core/Interfaces/IInteractor.js +0 -12
- package/umd/Core/Interfaces/IMouseData.js +0 -12
- package/umd/Core/Interfaces/IParticlesInteractor.js +0 -12
- package/umd/Core/Utils/ExternalInteractorBase.js +0 -21
- package/umd/Core/Utils/InteractionManager.js +0 -74
- package/umd/Core/Utils/ParticlesInteractorBase.js +0 -21
- package/umd/Enums/InteractivityDetect.js +0 -19
- package/umd/Enums/Modes/ResponsiveMode.js +0 -18
- package/umd/Enums/Modes/ThemeMode.js +0 -19
- package/umd/Enums/Types/DivType.js +0 -18
- package/umd/Enums/Types/InteractorType.js +0 -18
- package/umd/Options/Classes/Interactivity/Events/ClickEvent.js +0 -32
- package/umd/Options/Classes/Interactivity/Events/DivEvent.js +0 -41
- package/umd/Options/Classes/Interactivity/Events/Events.js +0 -44
- package/umd/Options/Classes/Interactivity/Events/HoverEvent.js +0 -35
- package/umd/Options/Classes/Interactivity/Events/Parallax.js +0 -36
- package/umd/Options/Classes/Interactivity/Interactivity.js +0 -36
- package/umd/Options/Classes/Interactivity/Modes/Modes.js +0 -39
- package/umd/Options/Classes/ManualParticle.js +0 -35
- package/umd/Options/Classes/Responsive.js +0 -43
- package/umd/Options/Classes/Theme/Theme.js +0 -35
- package/umd/Options/Classes/Theme/ThemeDefault.js +0 -37
- package/umd/Options/Interfaces/IManualParticle.js +0 -12
- package/umd/Options/Interfaces/IResponsive.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IEvents.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IParallax.js +0 -12
- package/umd/Options/Interfaces/Interactivity/IInteractivity.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Modes/IModes.js +0 -12
- package/umd/Options/Interfaces/Theme/ITheme.js +0 -12
- package/umd/Options/Interfaces/Theme/IThemeDefault.js +0 -12
- /package/browser/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/browser/{Core/Interfaces/IContainerInteractivity.js → Types/EngineInitializers.js} +0 -0
- /package/cjs/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/{browser/Core/Interfaces/IExternalInteractor.js → cjs/Types/EngineInitializers.js} +0 -0
- /package/esm/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/{browser/Core/Interfaces/IInteractor.js → esm/Types/EngineInitializers.js} +0 -0
- /package/types/Options/Interfaces/{Interactivity/Events/IResizeEvent.d.ts → IResizeEvent.d.ts} +0 -0
- /package/umd/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/umd/{Core/Interfaces/IContainerInteractivity.js → Types/EngineInitializers.js} +0 -0
package/esm/Core/Container.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { animate, cancelAnimation, getRangeValue } from "../Utils/MathUtils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { defaultFps, defaultFpsLimit, millisecondsToSeconds, minFpsLimit, removeDeleteCount, removeMinIndex, } from "./Utils/Constants.js";
|
|
3
3
|
import { Canvas } from "./Canvas.js";
|
|
4
4
|
import { EventListeners } from "./Utils/EventListeners.js";
|
|
5
5
|
import { EventType } from "../Enums/Types/EventType.js";
|
|
@@ -8,7 +8,6 @@ import { Particles } from "./Particles.js";
|
|
|
8
8
|
import { Retina } from "./Retina.js";
|
|
9
9
|
import { getLogger } from "../Utils/LogUtils.js";
|
|
10
10
|
import { loadOptions } from "../Utils/OptionsUtils.js";
|
|
11
|
-
import { safeIntersectionObserver } from "../Utils/Utils.js";
|
|
12
11
|
function guardCheck(container) {
|
|
13
12
|
return !container.destroyed;
|
|
14
13
|
}
|
|
@@ -24,22 +23,6 @@ function loadContainerOptions(engine, container, ...sourceOptionsArr) {
|
|
|
24
23
|
export class Container {
|
|
25
24
|
constructor(engine, id, sourceOptions) {
|
|
26
25
|
this._delta = { value: 0, factor: 0 };
|
|
27
|
-
this._intersectionManager = entries => {
|
|
28
|
-
if (!guardCheck(this) || !this.actualOptions.pauseOnOutsideViewport) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
for (const entry of entries) {
|
|
32
|
-
if (entry.target !== this.interactivity.element) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (entry.isIntersecting) {
|
|
36
|
-
this.play();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.pause();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
26
|
this._nextFrame = (timestamp) => {
|
|
44
27
|
try {
|
|
45
28
|
if (!this._smooth &&
|
|
@@ -84,28 +67,18 @@ export class Container {
|
|
|
84
67
|
this._lastFrameTime = 0;
|
|
85
68
|
this.zLayers = 100;
|
|
86
69
|
this.pageHidden = false;
|
|
87
|
-
this._clickHandlers = new Map();
|
|
88
70
|
this._sourceOptions = sourceOptions;
|
|
89
71
|
this._initialSourceOptions = sourceOptions;
|
|
90
72
|
this.retina = new Retina(this);
|
|
91
73
|
this.canvas = new Canvas(this, this._engine);
|
|
92
74
|
this.particles = new Particles(this._engine, this);
|
|
93
75
|
this.pathGenerators = new Map();
|
|
94
|
-
this.
|
|
95
|
-
mouse: {
|
|
96
|
-
clicking: false,
|
|
97
|
-
inside: false,
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
this.plugins = new Map();
|
|
76
|
+
this.plugins = [];
|
|
101
77
|
this.effectDrawers = new Map();
|
|
102
78
|
this.shapeDrawers = new Map();
|
|
103
79
|
this._options = loadContainerOptions(this._engine, this);
|
|
104
80
|
this.actualOptions = loadContainerOptions(this._engine, this);
|
|
105
81
|
this._eventListeners = new EventListeners(this);
|
|
106
|
-
this._intersectionObserver = safeIntersectionObserver(entries => {
|
|
107
|
-
this._intersectionManager(entries);
|
|
108
|
-
});
|
|
109
82
|
this._engine.dispatchEvent(EventType.containerBuilt, { container: this });
|
|
110
83
|
}
|
|
111
84
|
get animationStatus() {
|
|
@@ -117,77 +90,6 @@ export class Container {
|
|
|
117
90
|
get sourceOptions() {
|
|
118
91
|
return this._sourceOptions;
|
|
119
92
|
}
|
|
120
|
-
addClickHandler(callback) {
|
|
121
|
-
if (!guardCheck(this)) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const el = this.interactivity.element;
|
|
125
|
-
if (!el) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const clickOrTouchHandler = (e, pos, radius) => {
|
|
129
|
-
if (!guardCheck(this)) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const pxRatio = this.retina.pixelRatio, posRetina = {
|
|
133
|
-
x: pos.x * pxRatio,
|
|
134
|
-
y: pos.y * pxRatio,
|
|
135
|
-
}, particles = this.particles.quadTree.queryCircle(posRetina, radius * pxRatio);
|
|
136
|
-
callback(e, particles);
|
|
137
|
-
}, clickHandler = (e) => {
|
|
138
|
-
if (!guardCheck(this)) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const mouseEvent = e, pos = {
|
|
142
|
-
x: mouseEvent.offsetX || mouseEvent.clientX,
|
|
143
|
-
y: mouseEvent.offsetY || mouseEvent.clientY,
|
|
144
|
-
};
|
|
145
|
-
clickOrTouchHandler(e, pos, clickRadius);
|
|
146
|
-
}, touchStartHandler = () => {
|
|
147
|
-
if (!guardCheck(this)) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
touched = true;
|
|
151
|
-
touchMoved = false;
|
|
152
|
-
}, touchMoveHandler = () => {
|
|
153
|
-
if (!guardCheck(this)) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
touchMoved = true;
|
|
157
|
-
}, touchEndHandler = (e) => {
|
|
158
|
-
if (!guardCheck(this)) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (touched && !touchMoved) {
|
|
162
|
-
const touchEvent = e, lastTouch = touchEvent.touches[touchEvent.touches.length - touchEndLengthOffset];
|
|
163
|
-
if (!lastTouch) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const element = this.canvas.element, canvasRect = element ? element.getBoundingClientRect() : undefined, pos = {
|
|
167
|
-
x: lastTouch.clientX - (canvasRect ? canvasRect.left : minCoordinate),
|
|
168
|
-
y: lastTouch.clientY - (canvasRect ? canvasRect.top : minCoordinate),
|
|
169
|
-
};
|
|
170
|
-
clickOrTouchHandler(e, pos, Math.max(lastTouch.radiusX, lastTouch.radiusY));
|
|
171
|
-
}
|
|
172
|
-
touched = false;
|
|
173
|
-
touchMoved = false;
|
|
174
|
-
}, touchCancelHandler = () => {
|
|
175
|
-
if (!guardCheck(this)) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
touched = false;
|
|
179
|
-
touchMoved = false;
|
|
180
|
-
};
|
|
181
|
-
let touched = false, touchMoved = false;
|
|
182
|
-
this._clickHandlers.set("click", clickHandler);
|
|
183
|
-
this._clickHandlers.set("touchstart", touchStartHandler);
|
|
184
|
-
this._clickHandlers.set("touchmove", touchMoveHandler);
|
|
185
|
-
this._clickHandlers.set("touchend", touchEndHandler);
|
|
186
|
-
this._clickHandlers.set("touchcancel", touchCancelHandler);
|
|
187
|
-
for (const [key, handler] of this._clickHandlers) {
|
|
188
|
-
el.addEventListener(key, handler);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
93
|
addLifeTime(value) {
|
|
192
94
|
this._lifeTime += value;
|
|
193
95
|
}
|
|
@@ -201,21 +103,11 @@ export class Container {
|
|
|
201
103
|
alive() {
|
|
202
104
|
return !this._duration || this._lifeTime <= this._duration;
|
|
203
105
|
}
|
|
204
|
-
clearClickHandlers() {
|
|
205
|
-
if (!guardCheck(this)) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
for (const [key, handler] of this._clickHandlers) {
|
|
209
|
-
this.interactivity.element?.removeEventListener(key, handler);
|
|
210
|
-
}
|
|
211
|
-
this._clickHandlers.clear();
|
|
212
|
-
}
|
|
213
106
|
destroy(remove = true) {
|
|
214
107
|
if (!guardCheck(this)) {
|
|
215
108
|
return;
|
|
216
109
|
}
|
|
217
110
|
this.stop();
|
|
218
|
-
this.clearClickHandlers();
|
|
219
111
|
this.particles.destroy();
|
|
220
112
|
this.canvas.destroy();
|
|
221
113
|
for (const effectDrawer of this.effectDrawers.values()) {
|
|
@@ -226,10 +118,14 @@ export class Container {
|
|
|
226
118
|
shapeDrawer.destroy?.(this);
|
|
227
119
|
}
|
|
228
120
|
this.shapeDrawers.clear();
|
|
121
|
+
for (const plugin of this.plugins) {
|
|
122
|
+
plugin.destroy?.();
|
|
123
|
+
}
|
|
124
|
+
this.plugins.length = 0;
|
|
229
125
|
this._engine.clearPlugins(this);
|
|
230
126
|
this.destroyed = true;
|
|
231
127
|
if (remove) {
|
|
232
|
-
const mainArr = this._engine.items, idx = mainArr.
|
|
128
|
+
const mainArr = this._engine.items, idx = mainArr.indexOf(this);
|
|
233
129
|
if (idx >= removeMinIndex) {
|
|
234
130
|
mainArr.splice(idx, removeDeleteCount);
|
|
235
131
|
}
|
|
@@ -253,7 +149,7 @@ export class Container {
|
|
|
253
149
|
});
|
|
254
150
|
}
|
|
255
151
|
async export(type, options = {}) {
|
|
256
|
-
for (const plugin of this.plugins
|
|
152
|
+
for (const plugin of this.plugins) {
|
|
257
153
|
if (!plugin.export) {
|
|
258
154
|
continue;
|
|
259
155
|
}
|
|
@@ -266,15 +162,6 @@ export class Container {
|
|
|
266
162
|
getLogger().error(`Export plugin with type ${type} not found`);
|
|
267
163
|
return undefined;
|
|
268
164
|
}
|
|
269
|
-
handleClickMode(mode) {
|
|
270
|
-
if (!guardCheck(this)) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
this.particles.handleClickMode(mode);
|
|
274
|
-
for (const plugin of this.plugins.values()) {
|
|
275
|
-
plugin.handleClickMode?.(mode);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
165
|
async init() {
|
|
279
166
|
if (!guardCheck(this)) {
|
|
280
167
|
return;
|
|
@@ -293,12 +180,21 @@ export class Container {
|
|
|
293
180
|
this.shapeDrawers.set(type, drawer);
|
|
294
181
|
}
|
|
295
182
|
}
|
|
183
|
+
const allContainerPlugins = new Map();
|
|
184
|
+
for (const plugin of this._engine.plugins) {
|
|
185
|
+
const containerPlugin = await plugin.getPlugin(this);
|
|
186
|
+
if (containerPlugin.preInit) {
|
|
187
|
+
await containerPlugin.preInit();
|
|
188
|
+
}
|
|
189
|
+
allContainerPlugins.set(plugin, containerPlugin);
|
|
190
|
+
}
|
|
296
191
|
await this.particles.initPlugins();
|
|
297
192
|
this._options = loadContainerOptions(this._engine, this, this._initialSourceOptions, this.sourceOptions);
|
|
298
193
|
this.actualOptions = loadContainerOptions(this._engine, this, this._options);
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
194
|
+
for (const [plugin, containerPlugin] of allContainerPlugins) {
|
|
195
|
+
if (plugin.needsPlugin(this.actualOptions)) {
|
|
196
|
+
this.plugins.push(containerPlugin);
|
|
197
|
+
}
|
|
302
198
|
}
|
|
303
199
|
this.retina.init();
|
|
304
200
|
this.canvas.init();
|
|
@@ -313,30 +209,23 @@ export class Container {
|
|
|
313
209
|
this._lifeTime = 0;
|
|
314
210
|
this.fpsLimit = fpsLimit > minFpsLimit ? fpsLimit : defaultFpsLimit;
|
|
315
211
|
this._smooth = smooth;
|
|
212
|
+
for (const plugin of this.plugins) {
|
|
213
|
+
await plugin.init?.();
|
|
214
|
+
}
|
|
316
215
|
for (const drawer of this.effectDrawers.values()) {
|
|
317
216
|
await drawer.init?.(this);
|
|
318
217
|
}
|
|
319
218
|
for (const drawer of this.shapeDrawers.values()) {
|
|
320
219
|
await drawer.init?.(this);
|
|
321
220
|
}
|
|
322
|
-
for (const plugin of this.plugins.values()) {
|
|
323
|
-
await plugin.init?.();
|
|
324
|
-
}
|
|
325
221
|
this._engine.dispatchEvent(EventType.containerInit, { container: this });
|
|
326
222
|
await this.particles.init();
|
|
327
223
|
this.particles.setDensity();
|
|
328
|
-
for (const plugin of this.plugins
|
|
224
|
+
for (const plugin of this.plugins) {
|
|
329
225
|
plugin.particlesSetup?.();
|
|
330
226
|
}
|
|
331
227
|
this._engine.dispatchEvent(EventType.particlesSetup, { container: this });
|
|
332
228
|
}
|
|
333
|
-
async loadTheme(name) {
|
|
334
|
-
if (!guardCheck(this)) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
this._currentTheme = name;
|
|
338
|
-
await this.refresh();
|
|
339
|
-
}
|
|
340
229
|
pause() {
|
|
341
230
|
if (!guardCheck(this)) {
|
|
342
231
|
return;
|
|
@@ -348,7 +237,7 @@ export class Container {
|
|
|
348
237
|
if (this._paused) {
|
|
349
238
|
return;
|
|
350
239
|
}
|
|
351
|
-
for (const plugin of this.plugins
|
|
240
|
+
for (const plugin of this.plugins) {
|
|
352
241
|
plugin.pause?.();
|
|
353
242
|
}
|
|
354
243
|
if (!this.pageHidden) {
|
|
@@ -369,7 +258,7 @@ export class Container {
|
|
|
369
258
|
this._paused = false;
|
|
370
259
|
}
|
|
371
260
|
if (needsUpdate) {
|
|
372
|
-
for (const plugin of this.plugins
|
|
261
|
+
for (const plugin of this.plugins) {
|
|
373
262
|
if (plugin.play) {
|
|
374
263
|
plugin.play();
|
|
375
264
|
}
|
|
@@ -404,10 +293,7 @@ export class Container {
|
|
|
404
293
|
await new Promise(resolve => {
|
|
405
294
|
const start = async () => {
|
|
406
295
|
this._eventListeners.addListeners();
|
|
407
|
-
|
|
408
|
-
this._intersectionObserver.observe(this.interactivity.element);
|
|
409
|
-
}
|
|
410
|
-
for (const plugin of this.plugins.values()) {
|
|
296
|
+
for (const plugin of this.plugins) {
|
|
411
297
|
await plugin.start?.();
|
|
412
298
|
}
|
|
413
299
|
this._engine.dispatchEvent(EventType.containerStarted, { container: this });
|
|
@@ -431,26 +317,20 @@ export class Container {
|
|
|
431
317
|
this.pause();
|
|
432
318
|
this.particles.clear();
|
|
433
319
|
this.canvas.stop();
|
|
434
|
-
|
|
435
|
-
this._intersectionObserver.unobserve(this.interactivity.element);
|
|
436
|
-
}
|
|
437
|
-
for (const plugin of this.plugins.values()) {
|
|
320
|
+
for (const plugin of this.plugins) {
|
|
438
321
|
plugin.stop?.();
|
|
439
322
|
}
|
|
440
|
-
|
|
441
|
-
this.plugins.delete(key);
|
|
442
|
-
}
|
|
323
|
+
this.plugins.length = 0;
|
|
443
324
|
this._sourceOptions = this._options;
|
|
444
325
|
this._engine.dispatchEvent(EventType.containerStopped, { container: this });
|
|
445
326
|
}
|
|
446
327
|
updateActualOptions() {
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
328
|
+
let refresh = false;
|
|
329
|
+
for (const plugin of this.plugins) {
|
|
330
|
+
if (plugin.updateActualOptions) {
|
|
331
|
+
refresh = plugin.updateActualOptions() || refresh;
|
|
332
|
+
}
|
|
452
333
|
}
|
|
453
|
-
|
|
454
|
-
return true;
|
|
334
|
+
return refresh;
|
|
455
335
|
}
|
|
456
336
|
}
|
package/esm/Core/Engine.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { canvasFirstIndex, canvasTag, generatedAttribute, generatedFalse, generatedTrue, loadMinIndex, loadRandomFactor, none, one, removeDeleteCount, } from "./Utils/Constants.js";
|
|
2
|
-
import { itemFromSingleOrMultiple, safeDocument } from "../Utils/Utils.js";
|
|
2
|
+
import { getItemsFromInitializer, itemFromSingleOrMultiple, safeDocument } from "../Utils/Utils.js";
|
|
3
3
|
import { EventDispatcher } from "../Utils/EventDispatcher.js";
|
|
4
4
|
import { EventType } from "../Enums/Types/EventType.js";
|
|
5
5
|
import { getLogger } from "../Utils/LogUtils.js";
|
|
6
6
|
import { getRandom } from "../Utils/MathUtils.js";
|
|
7
7
|
const fullPercent = "100%";
|
|
8
|
-
async function getItemsFromInitializer(container, map, initializers, force = false) {
|
|
9
|
-
let res = map.get(container);
|
|
10
|
-
if (!res || force) {
|
|
11
|
-
res = await Promise.all([...initializers.values()].map(t => t(container)));
|
|
12
|
-
map.set(container, res);
|
|
13
|
-
}
|
|
14
|
-
return res;
|
|
15
|
-
}
|
|
16
8
|
async function getDataFromUrl(data) {
|
|
17
9
|
const url = itemFromSingleOrMultiple(data.url, data.index);
|
|
18
10
|
if (!url) {
|
|
@@ -49,7 +41,7 @@ const getCanvasFromContainer = (domContainer) => {
|
|
|
49
41
|
return canvasEl;
|
|
50
42
|
}, getDomContainer = (id, source) => {
|
|
51
43
|
const documentSafe = safeDocument();
|
|
52
|
-
let domContainer = source ??
|
|
44
|
+
let domContainer = source ?? documentSafe.getElementById(id);
|
|
53
45
|
if (domContainer) {
|
|
54
46
|
return domContainer;
|
|
55
47
|
}
|
|
@@ -70,11 +62,9 @@ export class Engine {
|
|
|
70
62
|
this.colorManagers = new Map();
|
|
71
63
|
this.easingFunctions = new Map();
|
|
72
64
|
this._initializers = {
|
|
73
|
-
interactors: new Map(),
|
|
74
65
|
movers: new Map(),
|
|
75
66
|
updaters: new Map(),
|
|
76
67
|
};
|
|
77
|
-
this.interactors = new Map();
|
|
78
68
|
this.movers = new Map();
|
|
79
69
|
this.updaters = new Map();
|
|
80
70
|
this.presets = new Map();
|
|
@@ -93,7 +83,7 @@ export class Engine {
|
|
|
93
83
|
return this._domArray;
|
|
94
84
|
}
|
|
95
85
|
get version() {
|
|
96
|
-
return "4.0.0-alpha.
|
|
86
|
+
return "4.0.0-alpha.4";
|
|
97
87
|
}
|
|
98
88
|
addColorManager(manager) {
|
|
99
89
|
this.colorManagers.set(manager.key, manager);
|
|
@@ -118,9 +108,6 @@ export class Engine {
|
|
|
118
108
|
addEventListener(type, listener) {
|
|
119
109
|
this._eventDispatcher.addEventListener(type, listener);
|
|
120
110
|
}
|
|
121
|
-
addInteractor(name, interactorInitializer) {
|
|
122
|
-
this._initializers.interactors.set(name, interactorInitializer);
|
|
123
|
-
}
|
|
124
111
|
addMover(name, moverInitializer) {
|
|
125
112
|
this._initializers.movers.set(name, moverInitializer);
|
|
126
113
|
}
|
|
@@ -162,35 +149,16 @@ export class Engine {
|
|
|
162
149
|
clearPlugins(container) {
|
|
163
150
|
this.updaters.delete(container);
|
|
164
151
|
this.movers.delete(container);
|
|
165
|
-
this.interactors.delete(container);
|
|
166
152
|
}
|
|
167
153
|
dispatchEvent(type, args) {
|
|
168
154
|
this._eventDispatcher.dispatchEvent(type, args);
|
|
169
155
|
}
|
|
170
|
-
dom() {
|
|
171
|
-
return this.items;
|
|
172
|
-
}
|
|
173
|
-
domItem(index) {
|
|
174
|
-
return this.item(index);
|
|
175
|
-
}
|
|
176
|
-
async getAvailablePlugins(container) {
|
|
177
|
-
const res = new Map();
|
|
178
|
-
for (const plugin of this.plugins) {
|
|
179
|
-
if (plugin.needsPlugin(container.actualOptions)) {
|
|
180
|
-
res.set(plugin.id, await plugin.getPlugin(container));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return res;
|
|
184
|
-
}
|
|
185
156
|
getEasing(name) {
|
|
186
157
|
return this.easingFunctions.get(name) ?? ((value) => value);
|
|
187
158
|
}
|
|
188
159
|
getEffectDrawer(type) {
|
|
189
160
|
return this.effectDrawers.get(type);
|
|
190
161
|
}
|
|
191
|
-
async getInteractors(container, force = false) {
|
|
192
|
-
return getItemsFromInitializer(container, this.interactors, this._initializers.interactors, force);
|
|
193
|
-
}
|
|
194
162
|
async getMovers(container, force = false) {
|
|
195
163
|
return getItemsFromInitializer(container, this.movers, this._initializers.movers, force);
|
|
196
164
|
}
|
|
@@ -236,8 +204,12 @@ export class Engine {
|
|
|
236
204
|
allLoaders.add(loader);
|
|
237
205
|
}
|
|
238
206
|
};
|
|
239
|
-
|
|
240
|
-
|
|
207
|
+
try {
|
|
208
|
+
await loader(this);
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
this.register = origRegister;
|
|
212
|
+
}
|
|
241
213
|
stack.unshift(...inner);
|
|
242
214
|
this._loadPromises.delete(loader);
|
|
243
215
|
}
|
|
@@ -257,6 +229,7 @@ export class Engine {
|
|
|
257
229
|
}
|
|
258
230
|
async load(params) {
|
|
259
231
|
await this.init();
|
|
232
|
+
this._loadPromises.clear();
|
|
260
233
|
const { Container } = await import("./Container.js"), id = params.id ??
|
|
261
234
|
params.element?.id ??
|
|
262
235
|
`tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container(this, id, currentOptions);
|
|
@@ -275,11 +248,6 @@ export class Engine {
|
|
|
275
248
|
await newItem.start();
|
|
276
249
|
return newItem;
|
|
277
250
|
}
|
|
278
|
-
loadOptions(options, sourceOptions) {
|
|
279
|
-
this.plugins.forEach(plugin => {
|
|
280
|
-
plugin.loadOptions(options, sourceOptions);
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
251
|
loadParticlesOptions(container, options, ...sourceOptions) {
|
|
284
252
|
const updaters = this.updaters.get(container);
|
|
285
253
|
if (!updaters) {
|
|
@@ -304,13 +272,4 @@ export class Engine {
|
|
|
304
272
|
removeEventListener(type, listener) {
|
|
305
273
|
this._eventDispatcher.removeEventListener(type, listener);
|
|
306
274
|
}
|
|
307
|
-
setOnClickHandler(callback) {
|
|
308
|
-
const { items } = this;
|
|
309
|
-
if (!items.length) {
|
|
310
|
-
throw new Error("Click handlers can only be set after calling tsParticles.load()");
|
|
311
|
-
}
|
|
312
|
-
items.forEach(item => {
|
|
313
|
-
item.addClickHandler(callback);
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
275
|
}
|
package/esm/Core/Particle.js
CHANGED
|
@@ -3,7 +3,6 @@ import { calcExactPositionOrRandomFromSize, clamp, degToRad, getParticleBaseVelo
|
|
|
3
3
|
import { decayOffset, defaultAngle, defaultOpacity, defaultRetryCount, defaultTransform, double, half, identity, millisecondsToSeconds, minZ, none, randomColorValue, rollFactor, squareExp, tryCountIncrement, zIndexFactorOffset, } from "./Utils/Constants.js";
|
|
4
4
|
import { deepExtend, getPosition, initParticleNumericAnimationValue, isInArray, itemFromSingleOrMultiple, } from "../Utils/Utils.js";
|
|
5
5
|
import { EventType } from "../Enums/Types/EventType.js";
|
|
6
|
-
import { Interactivity } from "../Options/Classes/Interactivity/Interactivity.js";
|
|
7
6
|
import { MoveDirection } from "../Enums/Directions/MoveDirection.js";
|
|
8
7
|
import { OutMode } from "../Enums/Modes/OutMode.js";
|
|
9
8
|
import { ParticleOutType } from "../Enums/Types/ParticleOutType.js";
|
|
@@ -53,7 +52,7 @@ export class Particle {
|
|
|
53
52
|
};
|
|
54
53
|
this._calcPosition = (position, zIndex) => {
|
|
55
54
|
let tryCount = defaultRetryCount, posVec = position ? Vector3d.create(position.x, position.y, zIndex) : undefined;
|
|
56
|
-
const container = this.container, plugins = Array.from(container.plugins
|
|
55
|
+
const container = this.container, plugins = Array.from(container.plugins), outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;
|
|
57
56
|
while (!signal.aborted) {
|
|
58
57
|
for (const plugin of plugins) {
|
|
59
58
|
const pluginPos = plugin.particlePosition?.(posVec, this);
|
|
@@ -173,7 +172,7 @@ export class Particle {
|
|
|
173
172
|
this.slow.inRange = false;
|
|
174
173
|
const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = this.shape ? container.shapeDrawers.get(this.shape) : undefined;
|
|
175
174
|
shapeDrawer?.particleDestroy?.(this);
|
|
176
|
-
for (const plugin of container.plugins
|
|
175
|
+
for (const plugin of container.plugins) {
|
|
177
176
|
plugin.particleDestroyed?.(this, override);
|
|
178
177
|
}
|
|
179
178
|
for (const updater of container.particles.updaters) {
|
|
@@ -189,7 +188,7 @@ export class Particle {
|
|
|
189
188
|
}
|
|
190
189
|
draw(delta) {
|
|
191
190
|
const container = this.container, canvas = container.canvas;
|
|
192
|
-
for (const plugin of container.plugins
|
|
191
|
+
for (const plugin of container.plugins) {
|
|
193
192
|
canvas.drawParticlePlugin(plugin, this, delta);
|
|
194
193
|
}
|
|
195
194
|
canvas.drawParticle(this, delta);
|
|
@@ -240,7 +239,7 @@ export class Particle {
|
|
|
240
239
|
return this._cachedTransform;
|
|
241
240
|
}
|
|
242
241
|
init(id, position, overrideOptions, group) {
|
|
243
|
-
const container = this.container
|
|
242
|
+
const container = this.container;
|
|
244
243
|
this.id = id;
|
|
245
244
|
this.group = group;
|
|
246
245
|
this.effectClose = true;
|
|
@@ -300,10 +299,6 @@ export class Particle {
|
|
|
300
299
|
if (shapeData) {
|
|
301
300
|
particlesOptions.load(shapeData.particles);
|
|
302
301
|
}
|
|
303
|
-
const interactivity = new Interactivity(engine, container);
|
|
304
|
-
interactivity.load(container.actualOptions.interactivity);
|
|
305
|
-
interactivity.load(particlesOptions.interactivity);
|
|
306
|
-
this.interactivity = interactivity;
|
|
307
302
|
this.effectFill = effectData?.fill ?? particlesOptions.effect.fill;
|
|
308
303
|
this.effectClose = effectData?.close ?? particlesOptions.effect.close;
|
|
309
304
|
this.shapeFill = shapeData?.fill ?? particlesOptions.shape.fill;
|
|
@@ -372,7 +367,7 @@ export class Particle {
|
|
|
372
367
|
}
|
|
373
368
|
effectDrawer?.particleInit?.(container, this);
|
|
374
369
|
shapeDrawer?.particleInit?.(container, this);
|
|
375
|
-
for (const plugin of container.plugins
|
|
370
|
+
for (const plugin of container.plugins) {
|
|
376
371
|
plugin.particleCreated?.(this);
|
|
377
372
|
}
|
|
378
373
|
}
|