@tsparticles/engine 4.0.0-alpha.2 → 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 +18 -22
- package/browser/Core/Container.js +44 -169
- package/browser/Core/Engine.js +40 -61
- package/browser/Core/Particle.js +99 -58
- 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/CanvasUtils.js +26 -83
- package/browser/Utils/ColorUtils.js +17 -2
- package/browser/Utils/MathUtils.js +3 -2
- package/browser/Utils/Utils.js +26 -33
- package/browser/exports.js +1 -21
- package/cjs/Core/Canvas.js +18 -22
- package/cjs/Core/Container.js +44 -169
- package/cjs/Core/Engine.js +40 -61
- package/cjs/Core/Particle.js +99 -58
- 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/CanvasUtils.js +26 -83
- package/cjs/Utils/ColorUtils.js +17 -2
- package/cjs/Utils/MathUtils.js +3 -2
- package/cjs/Utils/Utils.js +26 -33
- package/cjs/exports.js +1 -21
- package/dist_browser_Core_Container_js.js +6 -16
- package/esm/Core/Canvas.js +18 -22
- package/esm/Core/Container.js +44 -169
- package/esm/Core/Engine.js +40 -61
- package/esm/Core/Particle.js +99 -58
- 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/CanvasUtils.js +26 -83
- package/esm/Utils/ColorUtils.js +17 -2
- package/esm/Utils/MathUtils.js +3 -2
- package/esm/Utils/Utils.js +26 -33
- package/esm/exports.js +1 -21
- package/package.json +1 -1
- package/report.html +1 -1
- package/tsparticles.engine.js +16 -208
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +3 -0
- package/types/Core/Container.d.ts +4 -15
- package/types/Core/Engine.d.ts +4 -19
- package/types/Core/Interfaces/IContainerPlugin.d.ts +8 -1
- package/types/Core/Interfaces/IDrawParticleParams.d.ts +1 -1
- package/types/Core/Interfaces/IParticleOpacityData.d.ts +4 -0
- package/types/Core/Interfaces/IParticleRotateData.d.ts +4 -0
- package/types/Core/Interfaces/IParticleTransformValues.d.ts +4 -4
- package/types/Core/Interfaces/IParticleUpdater.d.ts +1 -1
- package/types/Core/Interfaces/IPlugin.d.ts +5 -1
- package/types/Core/Particle.d.ts +12 -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/CustomEventListener.d.ts +1 -1
- package/types/Types/EngineInitializers.d.ts +10 -0
- package/types/Utils/CanvasUtils.d.ts +6 -21
- package/types/Utils/EventDispatcher.d.ts +1 -1
- 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 +17 -21
- package/umd/Core/Container.js +44 -169
- package/umd/Core/Engine.js +41 -62
- package/umd/Core/Particle.js +99 -58
- 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/CanvasUtils.js +25 -82
- package/umd/Utils/ColorUtils.js +17 -2
- package/umd/Utils/MathUtils.js +3 -2
- package/umd/Utils/Utils.js +27 -36
- package/umd/exports.js +2 -22
- package/638.min.js +0 -2
- package/638.min.js.LICENSE.txt +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/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/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/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
- /package/browser/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
- /package/browser/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/browser/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
- /package/{browser/Core/Interfaces/IMouseData.js → cjs/Core/Interfaces/IParticleOpacityData.js} +0 -0
- /package/{browser/Core/Interfaces/IParticlesInteractor.js → cjs/Core/Interfaces/IParticleRotateData.js} +0 -0
- /package/cjs/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/{browser/Options/Interfaces/IManualParticle.js → cjs/Types/EngineInitializers.js} +0 -0
- /package/{browser/Options/Interfaces/IResponsive.js → esm/Core/Interfaces/IParticleOpacityData.js} +0 -0
- /package/{browser/Options/Interfaces/Interactivity/Events/IClickEvent.js → esm/Core/Interfaces/IParticleRotateData.js} +0 -0
- /package/esm/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/{browser/Options/Interfaces/Interactivity/Events/IDivEvent.js → esm/Types/EngineInitializers.js} +0 -0
- /package/types/Options/Interfaces/{Interactivity/Events/IResizeEvent.d.ts → IResizeEvent.d.ts} +0 -0
- /package/umd/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
- /package/umd/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
- /package/umd/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/umd/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
|
@@ -3,7 +3,6 @@ import type { Engine } from "./Engine.js";
|
|
|
3
3
|
import type { ICoordinates } from "./Interfaces/ICoordinates.js";
|
|
4
4
|
import type { IDelta } from "./Interfaces/IDelta.js";
|
|
5
5
|
import type { IDimension } from "./Interfaces/IDimension.js";
|
|
6
|
-
import type { IMouseData } from "./Interfaces/IMouseData.js";
|
|
7
6
|
import type { IParticleMover } from "./Interfaces/IParticleMover.js";
|
|
8
7
|
import type { IParticleUpdater } from "./Interfaces/IParticleUpdater.js";
|
|
9
8
|
import type { IParticlesOptions } from "../Options/Interfaces/Particles/IParticlesOptions.js";
|
|
@@ -18,7 +17,6 @@ export declare class Particles {
|
|
|
18
17
|
private readonly _container;
|
|
19
18
|
private readonly _engine;
|
|
20
19
|
private readonly _groupLimits;
|
|
21
|
-
private readonly _interactionManager;
|
|
22
20
|
private _lastZIndex;
|
|
23
21
|
private _limit;
|
|
24
22
|
private _needsSort;
|
|
@@ -29,7 +27,6 @@ export declare class Particles {
|
|
|
29
27
|
private _zArray;
|
|
30
28
|
constructor(engine: Engine, container: Container);
|
|
31
29
|
get count(): number;
|
|
32
|
-
addManualParticles(): void;
|
|
33
30
|
addParticle(position?: ICoordinates, overrideOptions?: RecursivePartial<IParticlesOptions>, group?: string, initializer?: (particle: Particle) => boolean): Particle | undefined;
|
|
34
31
|
clear(): void;
|
|
35
32
|
destroy(): void;
|
|
@@ -37,10 +34,9 @@ export declare class Particles {
|
|
|
37
34
|
filter(condition: (particle: Particle) => boolean): Particle[];
|
|
38
35
|
find(condition: (particle: Particle) => boolean): Particle | undefined;
|
|
39
36
|
get(index: number): Particle | undefined;
|
|
40
|
-
handleClickMode(mode: string): void;
|
|
41
37
|
init(): Promise<void>;
|
|
42
38
|
initPlugins(): Promise<void>;
|
|
43
|
-
push(nb: number,
|
|
39
|
+
push(nb: number, position?: ICoordinates, overrideOptions?: RecursivePartial<IParticlesOptions>, group?: string): void;
|
|
44
40
|
redraw(): Promise<void>;
|
|
45
41
|
remove(particle: Particle, group?: string, override?: boolean): void;
|
|
46
42
|
removeAt(index: number, quantity?: number, group?: string, override?: boolean): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ICoordinates3d } from "../Interfaces/ICoordinates.js";
|
|
2
|
-
export declare const generatedAttribute = "generated",
|
|
2
|
+
export declare const generatedAttribute = "generated", resizeEvent = "resize", visibilityChangeEvent = "visibilitychange", percentDenominator = 100, half = 0.5, millisecondsToSeconds = 1000, originPoint: ICoordinates3d, defaultTransform: {
|
|
3
3
|
a: number;
|
|
4
4
|
b: number;
|
|
5
5
|
c: number;
|
|
6
6
|
d: number;
|
|
7
|
-
}, randomColorValue = "random", midColorValue = "mid", double = 2, doublePI: number, defaultFps = 60, defaultAlpha = 1, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, qTreeCapacity = 4, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, subdivideCount = 4, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter: number, minVelocity = 0, defaultTransformValue = 1, minimumSize = 0, minimumLength = 0, zIndexFactorOffset = 1, defaultOpacity = 1, clickRadius = 1, touchEndLengthOffset = 1, minCoordinate = 0, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, decayOffset = 1, tryCountIncrement = 1, minRetries = 0, rollFactor = 1, minZ = 0, defaultRadius = 0, posOffset: number, sizeFactor = 1.5, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0,
|
|
7
|
+
}, randomColorValue = "random", midColorValue = "mid", double = 2, doublePI: number, defaultFps = 60, defaultAlpha = 1, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, qTreeCapacity = 4, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, subdivideCount = 4, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter: number, minVelocity = 0, defaultTransformValue = 1, minimumSize = 0, minimumLength = 0, zIndexFactorOffset = 1, defaultOpacity = 1, clickRadius = 1, touchEndLengthOffset = 1, minCoordinate = 0, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, decayOffset = 1, tryCountIncrement = 1, minRetries = 0, rollFactor = 1, minZ = 0, defaultRadius = 0, posOffset: number, sizeFactor = 1.5, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0, lengthOffset = 1, defaultDensityFactor = 1, deleteCount = 1, touchDelay = 500, manualDefaultPosition = 50, defaultAngle = 0, identity = 1, minStrokeWidth = 0, lFactor = 1, lMin = 0, triple = 3, sextuple = 6, sNormalizedOffset = 1, phaseNumerator = 1, defaultRgbMin = 0, defaultVelocity = 0, defaultLoops = 0, defaultTime = 0;
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import type { Container } from "../Container.js";
|
|
2
2
|
export declare class EventListeners {
|
|
3
3
|
private readonly container;
|
|
4
|
-
private _canPush;
|
|
5
4
|
private readonly _handlers;
|
|
6
|
-
private readonly _matchMedia;
|
|
7
5
|
private _resizeObserver?;
|
|
8
6
|
private _resizeTimeout?;
|
|
9
|
-
private readonly _touches;
|
|
10
7
|
constructor(container: Container);
|
|
11
8
|
addListeners(): void;
|
|
12
9
|
removeListeners(): void;
|
|
13
|
-
private readonly _doMouseTouchClick;
|
|
14
|
-
private readonly _handleThemeChange;
|
|
15
10
|
private readonly _handleVisibilityChange;
|
|
16
11
|
private readonly _handleWindowResize;
|
|
17
|
-
private readonly _manageInteractivityListeners;
|
|
18
12
|
private readonly _manageListeners;
|
|
19
|
-
private readonly _manageMediaMatch;
|
|
20
13
|
private readonly _manageResize;
|
|
21
|
-
private readonly _mouseDown;
|
|
22
|
-
private readonly _mouseTouchClick;
|
|
23
|
-
private readonly _mouseTouchFinish;
|
|
24
|
-
private readonly _mouseTouchMove;
|
|
25
|
-
private readonly _touchEnd;
|
|
26
|
-
private readonly _touchEndClick;
|
|
27
|
-
private readonly _touchStart;
|
|
28
14
|
}
|
|
@@ -5,13 +5,10 @@ import { FullScreen } from "./FullScreen/FullScreen.js";
|
|
|
5
5
|
import type { IOptionLoader } from "../Interfaces/IOptionLoader.js";
|
|
6
6
|
import type { IOptions } from "../Interfaces/IOptions.js";
|
|
7
7
|
import type { ISourceOptions } from "../../Types/ISourceOptions.js";
|
|
8
|
-
import { Interactivity } from "./Interactivity/Interactivity.js";
|
|
9
|
-
import { ManualParticle } from "./ManualParticle.js";
|
|
10
8
|
import type { RangeValue } from "../../Types/RangeValue.js";
|
|
11
9
|
import type { RecursivePartial } from "../../Types/RecursivePartial.js";
|
|
12
|
-
import {
|
|
10
|
+
import { ResizeEvent } from "./ResizeEvent.js";
|
|
13
11
|
import type { SingleOrMultiple } from "../../Types/SingleOrMultiple.js";
|
|
14
|
-
import { Theme } from "./Theme/Theme.js";
|
|
15
12
|
interface DefaultThemes {
|
|
16
13
|
dark?: string;
|
|
17
14
|
light?: string;
|
|
@@ -28,26 +25,20 @@ export declare class Options implements IOptions, IOptionLoader<IOptions> {
|
|
|
28
25
|
fpsLimit: number;
|
|
29
26
|
readonly fullScreen: FullScreen;
|
|
30
27
|
hdr: boolean;
|
|
31
|
-
readonly interactivity: Interactivity;
|
|
32
28
|
key?: string;
|
|
33
|
-
manualParticles: ManualParticle[];
|
|
34
29
|
name?: string;
|
|
35
30
|
readonly particles: import("./Particles/ParticlesOptions.js").ParticlesOptions;
|
|
36
31
|
pauseOnBlur: boolean;
|
|
37
32
|
pauseOnOutsideViewport: boolean;
|
|
38
33
|
preset?: SingleOrMultiple<string>;
|
|
39
|
-
|
|
34
|
+
readonly resize: ResizeEvent;
|
|
40
35
|
smooth: boolean;
|
|
41
36
|
style: RecursivePartial<CSSStyleDeclaration>;
|
|
42
|
-
readonly themes: Theme[];
|
|
43
37
|
zLayers: number;
|
|
44
38
|
private readonly _container;
|
|
45
39
|
private readonly _engine;
|
|
46
40
|
constructor(engine: Engine, container: Container);
|
|
47
41
|
load(data?: ISourceOptions): void;
|
|
48
|
-
setResponsive(width: number, pxRatio: number, defaultOptions: IOptions): number | undefined;
|
|
49
|
-
setTheme(name?: string): void;
|
|
50
|
-
private readonly _findDefaultTheme;
|
|
51
42
|
private readonly _importPreset;
|
|
52
43
|
}
|
|
53
44
|
export {};
|
|
@@ -2,7 +2,6 @@ import { AnimatableColor } from "../AnimatableColor.js";
|
|
|
2
2
|
import type { Container } from "../../../Core/Container.js";
|
|
3
3
|
import { Effect } from "./Effect/Effect.js";
|
|
4
4
|
import type { Engine } from "../../../Core/Engine.js";
|
|
5
|
-
import type { IInteractivity } from "../../Interfaces/Interactivity/IInteractivity.js";
|
|
6
5
|
import type { IOptionLoader } from "../../Interfaces/IOptionLoader.js";
|
|
7
6
|
import type { IParticlesOptions } from "../../Interfaces/Particles/IParticlesOptions.js";
|
|
8
7
|
import { Move } from "./Move/Move.js";
|
|
@@ -22,7 +21,6 @@ export declare class ParticlesOptions implements IParticlesOptions, IOptionLoade
|
|
|
22
21
|
color: AnimatableColor;
|
|
23
22
|
readonly effect: Effect;
|
|
24
23
|
readonly groups: ParticlesGroups;
|
|
25
|
-
interactivity?: RecursivePartial<IInteractivity>;
|
|
26
24
|
readonly move: Move;
|
|
27
25
|
readonly number: ParticlesNumber;
|
|
28
26
|
readonly opacity: Opacity;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IOptionLoader } from "../Interfaces/IOptionLoader.js";
|
|
2
|
+
import type { IResizeEvent } from "../Interfaces/IResizeEvent.js";
|
|
3
|
+
import type { RecursivePartial } from "../../Types/RecursivePartial.js";
|
|
4
|
+
export declare class ResizeEvent implements IResizeEvent, IOptionLoader<IResizeEvent> {
|
|
5
|
+
delay: number;
|
|
6
|
+
enable: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
load(data?: RecursivePartial<IResizeEvent>): void;
|
|
9
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { IBackground } from "./Background/IBackground.js";
|
|
2
2
|
import type { IFullScreen } from "./FullScreen/IFullScreen.js";
|
|
3
|
-
import type { IInteractivity } from "./Interactivity/IInteractivity.js";
|
|
4
|
-
import type { IManualParticle } from "./IManualParticle.js";
|
|
5
3
|
import type { IParticlesOptions } from "./Particles/IParticlesOptions.js";
|
|
6
|
-
import type {
|
|
7
|
-
import type { ITheme } from "./Theme/ITheme.js";
|
|
4
|
+
import type { IResizeEvent } from "./IResizeEvent.js";
|
|
8
5
|
import type { RangeValue } from "../../Types/RangeValue.js";
|
|
9
6
|
import type { RecursivePartial } from "../../Types/RecursivePartial.js";
|
|
10
7
|
import type { SingleOrMultiple } from "../../Types/SingleOrMultiple.js";
|
|
@@ -19,17 +16,14 @@ export interface IOptions {
|
|
|
19
16
|
fpsLimit: number;
|
|
20
17
|
fullScreen: RecursivePartial<IFullScreen> | boolean;
|
|
21
18
|
hdr: boolean;
|
|
22
|
-
interactivity: IInteractivity;
|
|
23
19
|
key?: string;
|
|
24
|
-
manualParticles: IManualParticle[];
|
|
25
20
|
name?: string;
|
|
26
21
|
particles: IParticlesOptions;
|
|
27
22
|
pauseOnBlur: boolean;
|
|
28
23
|
pauseOnOutsideViewport: boolean;
|
|
29
24
|
preset?: SingleOrMultiple<string>;
|
|
30
|
-
|
|
25
|
+
resize: IResizeEvent;
|
|
31
26
|
smooth: boolean;
|
|
32
27
|
style: RecursivePartial<CSSStyleDeclaration>;
|
|
33
|
-
themes: ITheme[];
|
|
34
28
|
zLayers: number;
|
|
35
29
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IAnimatableColor } from "../IAnimatableColor.js";
|
|
2
2
|
import type { IEffect } from "./Effect/IEffect.js";
|
|
3
|
-
import type { IInteractivity } from "../Interactivity/IInteractivity.js";
|
|
4
3
|
import type { IMove } from "./Move/IMove.js";
|
|
5
4
|
import type { IOpacity } from "./Opacity/IOpacity.js";
|
|
6
5
|
import type { IParticlesBounce } from "./Bounce/IParticlesBounce.js";
|
|
@@ -10,7 +9,6 @@ import type { ISize } from "./Size/ISize.js";
|
|
|
10
9
|
import type { IStroke } from "./IStroke.js";
|
|
11
10
|
import type { IZIndex } from "./ZIndex/IZIndex.js";
|
|
12
11
|
import type { ParticlesGroups } from "../../../Types/ParticlesGroups.js";
|
|
13
|
-
import type { RecursivePartial } from "../../../Types/RecursivePartial.js";
|
|
14
12
|
import type { SingleOrMultiple } from "../../../Types/SingleOrMultiple.js";
|
|
15
13
|
export interface IParticlesOptions {
|
|
16
14
|
[name: string]: unknown;
|
|
@@ -18,7 +16,6 @@ export interface IParticlesOptions {
|
|
|
18
16
|
color: IAnimatableColor;
|
|
19
17
|
effect: IEffect;
|
|
20
18
|
groups: ParticlesGroups;
|
|
21
|
-
interactivity?: RecursivePartial<IInteractivity>;
|
|
22
19
|
move: IMove;
|
|
23
20
|
number: IParticlesNumber;
|
|
24
21
|
opacity: IOpacity;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { CustomEventArgs } from "./CustomEventArgs.js";
|
|
2
|
-
export type CustomEventListener = (args
|
|
2
|
+
export type CustomEventListener = (args?: CustomEventArgs) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Container } from "../Core/Container.js";
|
|
2
|
+
import type { IParticleMover } from "../Core/Interfaces/IParticleMover.js";
|
|
3
|
+
import type { IParticleUpdater } from "../Core/Interfaces/IParticleUpdater.js";
|
|
4
|
+
export type GenericInitializer<T> = (container: Container) => Promise<T>;
|
|
5
|
+
export type MoverInitializer = GenericInitializer<IParticleMover>;
|
|
6
|
+
export type UpdaterInitializer = GenericInitializer<IParticleUpdater>;
|
|
7
|
+
export interface Initializers {
|
|
8
|
+
movers: Map<string, MoverInitializer>;
|
|
9
|
+
updaters: Map<string, UpdaterInitializer>;
|
|
10
|
+
}
|
|
@@ -6,6 +6,7 @@ import type { IDelta } from "../Core/Interfaces/IDelta.js";
|
|
|
6
6
|
import type { IDimension } from "../Core/Interfaces/IDimension.js";
|
|
7
7
|
import type { IDrawParticleParams } from "../Core/Interfaces/IDrawParticleParams.js";
|
|
8
8
|
import type { IHsl } from "../Core/Interfaces/Colors.js";
|
|
9
|
+
import type { IShapeDrawData } from "../export-types.js";
|
|
9
10
|
import type { Particle } from "../Core/Particle.js";
|
|
10
11
|
export declare function clearDrawPlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, delta: IDelta): void;
|
|
11
12
|
export declare function drawLine(context: CanvasRenderingContext2D, begin: ICoordinates, end: ICoordinates): void;
|
|
@@ -13,27 +14,11 @@ export declare function paintBase(context: CanvasRenderingContext2D, dimension:
|
|
|
13
14
|
export declare function paintImage(context: CanvasRenderingContext2D, dimension: IDimension, image: HTMLImageElement | undefined, opacity: number): void;
|
|
14
15
|
export declare function clear(context: CanvasRenderingContext2D, dimension: IDimension): void;
|
|
15
16
|
export declare function drawParticle(data: IDrawParticleParams): void;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
particle: Particle;
|
|
22
|
-
radius: number;
|
|
23
|
-
strokeWidth: number;
|
|
24
|
-
transformData: {
|
|
25
|
-
a: number;
|
|
26
|
-
b: number;
|
|
27
|
-
c: number;
|
|
28
|
-
d: number;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export declare function drawAfterEffect(data: DrawShapeData): void;
|
|
32
|
-
export declare function drawBeforeEffect(data: DrawShapeData): void;
|
|
33
|
-
export declare function drawShape(data: DrawShapeData): void;
|
|
34
|
-
export declare function drawShapeAfterDraw(data: DrawShapeData): void;
|
|
35
|
-
export declare function drawShapeBeforeDraw(data: DrawShapeData): void;
|
|
17
|
+
export declare function drawAfterEffect(container: Container, data: IShapeDrawData): void;
|
|
18
|
+
export declare function drawBeforeEffect(container: Container, data: IShapeDrawData): void;
|
|
19
|
+
export declare function drawShape(container: Container, data: IShapeDrawData): void;
|
|
20
|
+
export declare function drawShapeAfterDraw(container: Container, data: IShapeDrawData): void;
|
|
21
|
+
export declare function drawShapeBeforeDraw(container: Container, data: IShapeDrawData): void;
|
|
36
22
|
export declare function drawPlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, delta: IDelta): void;
|
|
37
23
|
export declare function drawParticlePlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, particle: Particle, delta: IDelta): void;
|
|
38
24
|
export declare function alterHsl(color: IHsl, type: AlterType, value: number): IHsl;
|
|
39
|
-
export {};
|
|
@@ -4,7 +4,7 @@ export declare class EventDispatcher {
|
|
|
4
4
|
private _listeners;
|
|
5
5
|
constructor();
|
|
6
6
|
addEventListener(type: string, listener: CustomEventListener): void;
|
|
7
|
-
dispatchEvent(type: string, args
|
|
7
|
+
dispatchEvent(type: string, args?: CustomEventArgs): void;
|
|
8
8
|
hasEventListener(type: string): boolean;
|
|
9
9
|
removeAllEventListeners(type?: string): void;
|
|
10
10
|
removeEventListener(type: string, listener: CustomEventListener): void;
|
package/types/Utils/Utils.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ICoordinates, ICoordinatesWithMode } from "../Core/Interfaces/ICoordinates.js";
|
|
2
2
|
import type { IDimension, IDimensionWithMode } from "../Core/Interfaces/IDimension.js";
|
|
3
|
+
import type { Container } from "../Core/Container.js";
|
|
3
4
|
import { DestroyType } from "../Enums/Types/DestroyType.js";
|
|
4
|
-
import type {
|
|
5
|
+
import type { GenericInitializer } from "../Types/EngineInitializers.js";
|
|
5
6
|
import type { IBounds } from "../Core/Interfaces/IBounds.js";
|
|
6
7
|
import type { ICircleBouncer } from "../Core/Interfaces/ICircleBouncer.js";
|
|
7
8
|
import type { IDelta } from "../Core/Interfaces/IDelta.js";
|
|
8
|
-
import type { IModeDiv } from "../Options/Interfaces/Interactivity/Modes/IModeDiv.js";
|
|
9
9
|
import type { IParticleNumericValueAnimation } from "../Core/Interfaces/IParticleValueAnimation.js";
|
|
10
10
|
import { OutModeDirection } from "../Enums/Directions/OutModeDirection.js";
|
|
11
11
|
import type { Particle } from "../Core/Particle.js";
|
|
@@ -24,10 +24,6 @@ export declare function isPointInside(point: ICoordinates, size: IDimension, off
|
|
|
24
24
|
export declare function areBoundsInside(bounds: IBounds, size: IDimension, offset: ICoordinates, direction?: OutModeDirection): boolean;
|
|
25
25
|
export declare function calculateBounds(point: ICoordinates, radius: number): IBounds;
|
|
26
26
|
export declare function deepExtend(destination: unknown, ...sources: unknown[]): unknown;
|
|
27
|
-
export declare function isDivModeEnabled(mode: string, divs: SingleOrMultiple<DivEvent>): boolean;
|
|
28
|
-
export declare function divModeExecute(mode: string, divs: SingleOrMultiple<DivEvent>, callback: (id: string, div: DivEvent) => void): void;
|
|
29
|
-
export declare function singleDivModeExecute(div: DivEvent, callback: (selector: string, div: DivEvent) => void): void;
|
|
30
|
-
export declare function divMode<T extends IModeDiv>(divs?: SingleOrMultiple<T>, element?: HTMLElement): T | undefined;
|
|
31
27
|
export declare function circleBounceDataFromParticle(p: Particle): ICircleBouncer;
|
|
32
28
|
export declare function circleBounce(p1: ICircleBouncer, p2: ICircleBouncer): void;
|
|
33
29
|
export declare function executeOnSingleOrMultiple<T, U = void>(obj: SingleOrMultiple<T>, callback: (obj: T, index: number) => U): SingleOrMultiple<U>;
|
|
@@ -39,3 +35,5 @@ export declare function getSize(size: IDimensionWithMode, canvasSize: IDimension
|
|
|
39
35
|
export declare function updateAnimation(particle: Particle, data: IParticleNumericValueAnimation, changeDirection: boolean, destroyType: DestroyType | keyof typeof DestroyType, delta: IDelta): void;
|
|
40
36
|
export declare function cloneStyle(style: Partial<CSSStyleDeclaration>): CSSStyleDeclaration;
|
|
41
37
|
export declare const getFullScreenStyle: (zIndex: number) => CSSStyleDeclaration;
|
|
38
|
+
export declare function manageListener(element: HTMLElement | Node | Window | MediaQueryList | typeof globalThis, event: string, handler: EventListenerOrEventListenerObject, add: boolean, options?: boolean | AddEventListenerOptions | EventListenerObject): void;
|
|
39
|
+
export declare function getItemsFromInitializer<TItem, TInitializer extends GenericInitializer<TItem>>(container: Container, map: Map<Container, TItem[]>, initializers: Map<string, TInitializer>, force?: boolean): Promise<TItem[]>;
|
package/types/export-types.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export type * from "./Core/Interfaces/IBounds.js";
|
|
|
3
3
|
export type * from "./Core/Interfaces/IBubbleParticleData.js";
|
|
4
4
|
export type * from "./Core/Interfaces/ICircleBouncer.js";
|
|
5
5
|
export type * from "./Core/Interfaces/IColorManager.js";
|
|
6
|
-
export type * from "./Core/Interfaces/IContainerInteractivity.js";
|
|
7
6
|
export type * from "./Core/Interfaces/IContainerPlugin.js";
|
|
8
7
|
export type * from "./Core/Interfaces/ICoordinates.js";
|
|
9
8
|
export type * from "./Core/Interfaces/IDelta.js";
|
|
@@ -11,10 +10,7 @@ export type * from "./Core/Interfaces/IDimension.js";
|
|
|
11
10
|
export type * from "./Core/Interfaces/IDistance.js";
|
|
12
11
|
export type * from "./Core/Interfaces/IDrawParticleParams.js";
|
|
13
12
|
export type * from "./Core/Interfaces/IEffectDrawer.js";
|
|
14
|
-
export type * from "./Core/Interfaces/IExternalInteractor.js";
|
|
15
|
-
export type * from "./Core/Interfaces/IInteractor.js";
|
|
16
13
|
export type * from "./Core/Interfaces/ILoadParams.js";
|
|
17
|
-
export type * from "./Core/Interfaces/IMouseData.js";
|
|
18
14
|
export type * from "./Core/Interfaces/IMovePathGenerator.js";
|
|
19
15
|
export type * from "./Core/Interfaces/IParticleColorStyle.js";
|
|
20
16
|
export type * from "./Core/Interfaces/IParticleHslAnimation.js";
|
|
@@ -25,7 +21,6 @@ export type * from "./Core/Interfaces/IParticleRoll.js";
|
|
|
25
21
|
export type * from "./Core/Interfaces/IParticleTransformValues.js";
|
|
26
22
|
export type * from "./Core/Interfaces/IParticleUpdater.js";
|
|
27
23
|
export type * from "./Core/Interfaces/IParticleValueAnimation.js";
|
|
28
|
-
export type * from "./Core/Interfaces/IParticlesInteractor.js";
|
|
29
24
|
export type * from "./Core/Interfaces/IPlugin.js";
|
|
30
25
|
export type * from "./Core/Interfaces/IPositionFromSizeParams.js";
|
|
31
26
|
export type * from "./Core/Interfaces/IRangeValue.js";
|
|
@@ -40,21 +35,11 @@ export type * from "./Options/Interfaces/IAnimatableColor.js";
|
|
|
40
35
|
export type * from "./Options/Interfaces/IAnimation.js";
|
|
41
36
|
export type * from "./Options/Interfaces/IColorAnimation.js";
|
|
42
37
|
export type * from "./Options/Interfaces/IHslAnimation.js";
|
|
43
|
-
export type * from "./Options/Interfaces/IManualParticle.js";
|
|
44
38
|
export type * from "./Options/Interfaces/IOptionLoader.js";
|
|
45
39
|
export type * from "./Options/Interfaces/IOptions.js";
|
|
46
40
|
export type * from "./Options/Interfaces/IOptionsColor.js";
|
|
47
|
-
export type * from "./Options/Interfaces/
|
|
41
|
+
export type * from "./Options/Interfaces/IResizeEvent.js";
|
|
48
42
|
export type * from "./Options/Interfaces/IValueWithRandom.js";
|
|
49
|
-
export type * from "./Options/Interfaces/Interactivity/Events/IClickEvent.js";
|
|
50
|
-
export type * from "./Options/Interfaces/Interactivity/Events/IDivEvent.js";
|
|
51
|
-
export type * from "./Options/Interfaces/Interactivity/Events/IEvents.js";
|
|
52
|
-
export type * from "./Options/Interfaces/Interactivity/Events/IHoverEvent.js";
|
|
53
|
-
export type * from "./Options/Interfaces/Interactivity/Events/IParallax.js";
|
|
54
|
-
export type * from "./Options/Interfaces/Interactivity/Events/IResizeEvent.js";
|
|
55
|
-
export type * from "./Options/Interfaces/Interactivity/Modes/IModeDiv.js";
|
|
56
|
-
export type * from "./Options/Interfaces/Interactivity/Modes/IModes.js";
|
|
57
|
-
export type * from "./Options/Interfaces/Interactivity/IInteractivity.js";
|
|
58
43
|
export type * from "./Options/Interfaces/Particles/Bounce/IParticlesBounce.js";
|
|
59
44
|
export type * from "./Options/Interfaces/Particles/Effect/IEffect.js";
|
|
60
45
|
export type * from "./Options/Interfaces/Particles/IParticlesOptions.js";
|
|
@@ -76,10 +61,10 @@ export type * from "./Options/Interfaces/Particles/Shape/IShape.js";
|
|
|
76
61
|
export type * from "./Options/Interfaces/Particles/Size/ISize.js";
|
|
77
62
|
export type * from "./Options/Interfaces/Particles/Size/ISizeAnimation.js";
|
|
78
63
|
export type * from "./Options/Interfaces/Particles/ZIndex/IZIndex.js";
|
|
79
|
-
export type * from "./Options/Interfaces/Theme/ITheme.js";
|
|
80
|
-
export type * from "./Options/Interfaces/Theme/IThemeDefault.js";
|
|
81
64
|
export type * from "./Types/CustomEventArgs.js";
|
|
82
65
|
export type * from "./Types/CustomEventListener.js";
|
|
66
|
+
export type * from "./Types/EasingFunction.js";
|
|
67
|
+
export type * from "./Types/EngineInitializers.js";
|
|
83
68
|
export type * from "./Types/ExportResult.js";
|
|
84
69
|
export type * from "./Types/ISourceOptions.js";
|
|
85
70
|
export type * from "./Types/ParticlesGroups.js";
|
|
@@ -89,7 +74,6 @@ export type * from "./Types/RecursivePartial.js";
|
|
|
89
74
|
export type * from "./Types/ShapeData.js";
|
|
90
75
|
export type * from "./Types/SingleOrMultiple.js";
|
|
91
76
|
export type { EventListeners } from "./Core/Utils/EventListeners.js";
|
|
92
|
-
export type { InteractionManager } from "./Core/Utils/InteractionManager.js";
|
|
93
77
|
export type { QuadTree } from "./Core/Utils/QuadTree.js";
|
|
94
78
|
export type { Canvas } from "./Core/Canvas.js";
|
|
95
79
|
export type { Container } from "./Core/Container.js";
|
package/types/exports.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from "./Core/Utils/Constants.js";
|
|
2
|
-
export * from "./Core/Utils/ExternalInteractorBase.js";
|
|
3
|
-
export * from "./Core/Utils/ParticlesInteractorBase.js";
|
|
4
2
|
export * from "./Core/Utils/Point.js";
|
|
5
3
|
export * from "./Core/Utils/Ranges.js";
|
|
6
4
|
export * from "./Core/Utils/Vectors.js";
|
|
@@ -11,36 +9,20 @@ export * from "./Enums/Modes/AnimationMode.js";
|
|
|
11
9
|
export * from "./Enums/Modes/LimitMode.js";
|
|
12
10
|
export * from "./Enums/Modes/OutMode.js";
|
|
13
11
|
export * from "./Enums/Modes/PixelMode.js";
|
|
14
|
-
export * from "./Enums/Modes/ThemeMode.js";
|
|
15
|
-
export * from "./Enums/Modes/ResponsiveMode.js";
|
|
16
12
|
export * from "./Enums/Types/AlterType.js";
|
|
17
13
|
export * from "./Enums/Types/DestroyType.js";
|
|
18
14
|
export * from "./Enums/Types/GradientType.js";
|
|
19
|
-
export * from "./Enums/Types/InteractorType.js";
|
|
20
15
|
export * from "./Enums/Types/ParticleOutType.js";
|
|
21
16
|
export * from "./Enums/Types/StartValueType.js";
|
|
22
|
-
export * from "./Enums/Types/DivType.js";
|
|
23
17
|
export * from "./Enums/Types/EasingType.js";
|
|
24
18
|
export * from "./Enums/Types/EventType.js";
|
|
25
19
|
export * from "./Enums/AnimationStatus.js";
|
|
26
|
-
export * from "./Enums/InteractivityDetect.js";
|
|
27
20
|
export * from "./Options/Classes/AnimatableColor.js";
|
|
28
21
|
export * from "./Options/Classes/AnimationOptions.js";
|
|
29
22
|
export * from "./Options/Classes/Background/Background.js";
|
|
30
23
|
export * from "./Options/Classes/ColorAnimation.js";
|
|
31
24
|
export * from "./Options/Classes/FullScreen/FullScreen.js";
|
|
32
25
|
export * from "./Options/Classes/HslAnimation.js";
|
|
33
|
-
export * from "./Options/Classes/Interactivity/Events/ClickEvent.js";
|
|
34
|
-
export * from "./Options/Classes/Interactivity/Events/DivEvent.js";
|
|
35
|
-
export * from "./Options/Classes/Interactivity/Events/ClickEvent.js";
|
|
36
|
-
export * from "./Options/Classes/Interactivity/Events/DivEvent.js";
|
|
37
|
-
export * from "./Options/Classes/Interactivity/Events/Events.js";
|
|
38
|
-
export * from "./Options/Classes/Interactivity/Events/HoverEvent.js";
|
|
39
|
-
export * from "./Options/Classes/Interactivity/Events/Parallax.js";
|
|
40
|
-
export * from "./Options/Classes/Interactivity/Events/ResizeEvent.js";
|
|
41
|
-
export * from "./Options/Classes/Interactivity/Interactivity.js";
|
|
42
|
-
export * from "./Options/Classes/Interactivity/Modes/Modes.js";
|
|
43
|
-
export * from "./Options/Classes/ManualParticle.js";
|
|
44
26
|
export * from "./Options/Classes/Options.js";
|
|
45
27
|
export * from "./Options/Classes/OptionsColor.js";
|
|
46
28
|
export * from "./Options/Classes/Particles/Bounce/ParticlesBounce.js";
|
|
@@ -64,9 +46,7 @@ export * from "./Options/Classes/Particles/Shape/Shape.js";
|
|
|
64
46
|
export * from "./Options/Classes/Particles/Size/Size.js";
|
|
65
47
|
export * from "./Options/Classes/Particles/Size/SizeAnimation.js";
|
|
66
48
|
export * from "./Options/Classes/Particles/ZIndex/ZIndex.js";
|
|
67
|
-
export * from "./Options/Classes/
|
|
68
|
-
export * from "./Options/Classes/Theme/Theme.js";
|
|
69
|
-
export * from "./Options/Classes/Theme/ThemeDefault.js";
|
|
49
|
+
export * from "./Options/Classes/ResizeEvent.js";
|
|
70
50
|
export * from "./Options/Classes/ValueWithRandom.js";
|
|
71
51
|
export * from "./Utils/CanvasUtils.js";
|
|
72
52
|
export * from "./Utils/ColorUtils.js";
|
package/umd/Core/Canvas.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const Utils_js_1 = require("../Utils/Utils.js");
|
|
15
15
|
const Constants_js_1 = require("./Utils/Constants.js");
|
|
16
16
|
const ColorUtils_js_1 = require("../Utils/ColorUtils.js");
|
|
17
|
+
const fColorIndex = 0, sColorIndex = 1;
|
|
17
18
|
function setTransformValue(factor, newFactor, key) {
|
|
18
19
|
const newValue = newFactor[key];
|
|
19
20
|
if (newValue !== undefined) {
|
|
@@ -52,6 +53,9 @@
|
|
|
52
53
|
class Canvas {
|
|
53
54
|
constructor(container, engine) {
|
|
54
55
|
this.container = container;
|
|
56
|
+
this._reusableColorStyles = {};
|
|
57
|
+
this._reusablePluginColors = [undefined, undefined];
|
|
58
|
+
this._reusableTransform = {};
|
|
55
59
|
this._applyPostDrawUpdaters = particle => {
|
|
56
60
|
for (const updater of this._postDrawUpdaters) {
|
|
57
61
|
updater.afterDraw?.(particle);
|
|
@@ -95,7 +99,9 @@
|
|
|
95
99
|
break;
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
|
-
|
|
102
|
+
this._reusablePluginColors[fColorIndex] = fColor;
|
|
103
|
+
this._reusablePluginColors[sColorIndex] = sColor;
|
|
104
|
+
return this._reusablePluginColors;
|
|
99
105
|
};
|
|
100
106
|
this._initStyle = () => {
|
|
101
107
|
const element = this.element, options = this.container.actualOptions;
|
|
@@ -109,7 +115,7 @@
|
|
|
109
115
|
this._resetOriginalStyle();
|
|
110
116
|
}
|
|
111
117
|
for (const key in options.style) {
|
|
112
|
-
if (!key || !Object.
|
|
118
|
+
if (!key || !Object.hasOwn(options.style, key)) {
|
|
113
119
|
continue;
|
|
114
120
|
}
|
|
115
121
|
const value = options.style[key];
|
|
@@ -190,7 +196,7 @@
|
|
|
190
196
|
}
|
|
191
197
|
clear() {
|
|
192
198
|
let pluginHandled = false;
|
|
193
|
-
for (const plugin of this.container.plugins
|
|
199
|
+
for (const plugin of this.container.plugins) {
|
|
194
200
|
if (!pluginHandled && plugin.canvasClear) {
|
|
195
201
|
pluginHandled = plugin.canvasClear();
|
|
196
202
|
}
|
|
@@ -242,22 +248,12 @@
|
|
|
242
248
|
if (!fColor && !sColor) {
|
|
243
249
|
return;
|
|
244
250
|
}
|
|
245
|
-
const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - particle.zIndexFactor,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return (0, ColorUtils_js_1.getStyleFromHsl)(fColor, container.hdr, zOpacity);
|
|
250
|
-
}, colorStyles = {
|
|
251
|
-
fill: getFillStyle(),
|
|
252
|
-
}, getStrokestyle = () => {
|
|
253
|
-
if (!sColor) {
|
|
254
|
-
return colorStyles.fill;
|
|
255
|
-
}
|
|
256
|
-
return (0, ColorUtils_js_1.getStyleFromHsl)(sColor, container.hdr, zStrokeOpacity);
|
|
257
|
-
};
|
|
258
|
-
colorStyles.stroke = getStrokestyle();
|
|
251
|
+
const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - particle.zIndexFactor, { opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? (0, ColorUtils_js_1.getStyleFromHsl)(fColor, container.hdr, opacity) : undefined, stroke = sColor ? (0, ColorUtils_js_1.getStyleFromHsl)(sColor, container.hdr, strokeOpacity) : fill;
|
|
252
|
+
transform.a = transform.b = transform.c = transform.d = undefined;
|
|
253
|
+
colorStyles.fill = fill;
|
|
254
|
+
colorStyles.stroke = stroke;
|
|
259
255
|
this.draw((context) => {
|
|
260
|
-
this._applyPreDrawUpdaters(context, particle, radius,
|
|
256
|
+
this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
|
|
261
257
|
(0, CanvasUtils_js_1.drawParticle)({
|
|
262
258
|
container,
|
|
263
259
|
context,
|
|
@@ -265,7 +261,7 @@
|
|
|
265
261
|
delta,
|
|
266
262
|
colorStyles,
|
|
267
263
|
radius: radius * zIndexFactor ** zIndexOptions.sizeRate,
|
|
268
|
-
opacity:
|
|
264
|
+
opacity: opacity,
|
|
269
265
|
transform,
|
|
270
266
|
});
|
|
271
267
|
});
|
|
@@ -338,7 +334,7 @@
|
|
|
338
334
|
}
|
|
339
335
|
initPlugins() {
|
|
340
336
|
this._resizePlugins = [];
|
|
341
|
-
for (const plugin of this.container.plugins
|
|
337
|
+
for (const plugin of this.container.plugins) {
|
|
342
338
|
if (plugin.resize) {
|
|
343
339
|
this._resizePlugins.push(plugin);
|
|
344
340
|
}
|
|
@@ -396,7 +392,7 @@
|
|
|
396
392
|
}
|
|
397
393
|
paint() {
|
|
398
394
|
let handled = false;
|
|
399
|
-
for (const plugin of this.container.plugins
|
|
395
|
+
for (const plugin of this.container.plugins) {
|
|
400
396
|
if (handled) {
|
|
401
397
|
break;
|
|
402
398
|
}
|