@tsparticles/engine 3.0.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/373.min.js +2 -0
- package/373.min.js.LICENSE.txt +1 -0
- package/438.min.js +2 -0
- package/438.min.js.LICENSE.txt +1 -0
- package/README.md +337 -216
- package/browser/Core/Canvas.js +102 -49
- package/browser/Core/Container.js +53 -41
- package/browser/Core/Engine.js +47 -32
- package/browser/Core/Particle.js +46 -48
- package/browser/Core/Particles.js +70 -57
- package/browser/Core/Retina.js +5 -4
- package/browser/Core/Utils/Circle.js +4 -3
- package/browser/Core/Utils/Constants.js +3 -0
- package/browser/Core/Utils/EventListeners.js +19 -16
- package/browser/Core/Utils/ExternalInteractorBase.js +1 -1
- package/browser/Core/Utils/InteractionManager.js +17 -8
- package/browser/Core/Utils/ParticlesInteractorBase.js +1 -1
- package/browser/Core/Utils/QuadTree.js +5 -3
- package/browser/Core/Utils/Vector.js +7 -2
- package/browser/Core/Utils/Vector3d.js +14 -9
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/browser/Options/Classes/ManualParticle.js +3 -2
- package/browser/Options/Classes/Options.js +3 -0
- package/browser/Utils/CanvasUtils.js +50 -40
- package/browser/Utils/ColorUtils.js +124 -45
- package/browser/Utils/EventDispatcher.js +6 -5
- package/browser/Utils/HslColorManager.js +5 -5
- package/browser/Utils/NumberUtils.js +35 -23
- package/browser/Utils/RgbColorManager.js +5 -5
- package/browser/Utils/Utils.js +102 -19
- package/cjs/Core/Canvas.js +102 -49
- package/cjs/Core/Container.js +53 -41
- package/cjs/Core/Engine.js +70 -32
- package/cjs/Core/Particle.js +45 -47
- package/cjs/Core/Particles.js +93 -57
- package/cjs/Core/Retina.js +5 -4
- package/cjs/Core/Utils/Circle.js +4 -3
- package/cjs/Core/Utils/Constants.js +4 -1
- package/cjs/Core/Utils/EventListeners.js +18 -15
- package/cjs/Core/Utils/ExternalInteractorBase.js +1 -1
- package/cjs/Core/Utils/InteractionManager.js +17 -8
- package/cjs/Core/Utils/ParticlesInteractorBase.js +1 -1
- package/cjs/Core/Utils/QuadTree.js +5 -3
- package/cjs/Core/Utils/Vector.js +7 -2
- package/cjs/Core/Utils/Vector3d.js +14 -9
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/cjs/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/cjs/Options/Classes/ManualParticle.js +3 -2
- package/cjs/Options/Classes/Options.js +3 -0
- package/cjs/Utils/CanvasUtils.js +50 -40
- package/cjs/Utils/ColorUtils.js +126 -45
- package/cjs/Utils/EventDispatcher.js +6 -5
- package/cjs/Utils/HslColorManager.js +5 -5
- package/cjs/Utils/NumberUtils.js +37 -24
- package/cjs/Utils/RgbColorManager.js +5 -5
- package/cjs/Utils/Utils.js +103 -19
- package/dist_browser_Core_Container_js.js +92 -0
- package/dist_browser_Core_Particle_js.js +32 -0
- package/esm/Core/Canvas.js +102 -49
- package/esm/Core/Container.js +53 -41
- package/esm/Core/Engine.js +47 -32
- package/esm/Core/Particle.js +46 -48
- package/esm/Core/Particles.js +70 -57
- package/esm/Core/Retina.js +5 -4
- package/esm/Core/Utils/Circle.js +4 -3
- package/esm/Core/Utils/Constants.js +3 -0
- package/esm/Core/Utils/EventListeners.js +19 -16
- package/esm/Core/Utils/ExternalInteractorBase.js +1 -1
- package/esm/Core/Utils/InteractionManager.js +17 -8
- package/esm/Core/Utils/ParticlesInteractorBase.js +1 -1
- package/esm/Core/Utils/QuadTree.js +5 -3
- package/esm/Core/Utils/Vector.js +7 -2
- package/esm/Core/Utils/Vector3d.js +14 -9
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/esm/Options/Classes/ManualParticle.js +3 -2
- package/esm/Options/Classes/Options.js +3 -0
- package/esm/Utils/CanvasUtils.js +50 -40
- package/esm/Utils/ColorUtils.js +124 -45
- package/esm/Utils/EventDispatcher.js +6 -5
- package/esm/Utils/HslColorManager.js +5 -5
- package/esm/Utils/NumberUtils.js +35 -23
- package/esm/Utils/RgbColorManager.js +5 -5
- package/esm/Utils/Utils.js +102 -19
- package/package.json +1 -1
- package/report.html +3 -3
- package/tsparticles.engine.js +894 -5461
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -1
- package/types/Core/Canvas.d.ts +5 -3
- package/types/Core/Container.d.ts +1 -1
- package/types/Core/Engine.d.ts +13 -8
- package/types/Core/Interfaces/IContainerPlugin.d.ts +3 -3
- package/types/Core/Interfaces/IEffectDrawer.d.ts +3 -3
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +2 -2
- package/types/Core/Interfaces/IParticleHslAnimation.d.ts +4 -4
- package/types/Core/Interfaces/IParticleMover.d.ts +2 -2
- package/types/Core/Interfaces/IParticleUpdater.d.ts +2 -2
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +4 -0
- package/types/Core/Interfaces/IPlugin.d.ts +1 -1
- package/types/Core/Interfaces/IShapeDrawData.d.ts +2 -2
- package/types/Core/Interfaces/IShapeDrawer.d.ts +4 -4
- package/types/Core/Particle.d.ts +3 -3
- package/types/Core/Particles.d.ts +12 -8
- package/types/Core/Utils/Constants.d.ts +3 -0
- package/types/Core/Utils/ExternalInteractorBase.d.ts +1 -1
- package/types/Core/Utils/InteractionManager.d.ts +3 -3
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
- package/types/Core/Utils/Point.d.ts +1 -1
- package/types/Enums/Modes/OutMode.d.ts +0 -3
- package/types/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +2 -1
- package/types/Options/Classes/Options.d.ts +1 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +1 -2
- package/types/Options/Classes/Particles/Move/OutModes.d.ts +5 -6
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +2 -1
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.d.ts +2 -1
- package/types/Options/Interfaces/IOptions.d.ts +1 -0
- package/types/Options/Interfaces/Interactivity/Modes/IModes.d.ts +1 -3
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Move/IOutModes.d.ts +6 -6
- package/types/Types/CustomEventArgs.d.ts +2 -2
- package/types/Types/ExportResult.d.ts +2 -2
- package/types/Types/ParticlesGroups.d.ts +1 -3
- package/types/Types/PathOptions.d.ts +1 -3
- package/types/Types/ShapeData.d.ts +1 -3
- package/types/Utils/CanvasUtils.d.ts +9 -8
- package/types/Utils/ColorUtils.d.ts +5 -0
- package/types/Utils/NumberUtils.d.ts +2 -2
- package/types/Utils/Utils.d.ts +9 -6
- package/umd/Core/Canvas.js +102 -49
- package/umd/Core/Container.js +54 -42
- package/umd/Core/Engine.js +72 -33
- package/umd/Core/Particle.js +46 -48
- package/umd/Core/Particles.js +95 -58
- package/umd/Core/Retina.js +5 -4
- package/umd/Core/Utils/Circle.js +4 -3
- package/umd/Core/Utils/Constants.js +4 -1
- package/umd/Core/Utils/EventListeners.js +18 -15
- package/umd/Core/Utils/ExternalInteractorBase.js +1 -1
- package/umd/Core/Utils/InteractionManager.js +17 -8
- package/umd/Core/Utils/ParticlesInteractorBase.js +1 -1
- package/umd/Core/Utils/QuadTree.js +5 -3
- package/umd/Core/Utils/Vector.js +7 -2
- package/umd/Core/Utils/Vector3d.js +14 -9
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +1 -1
- package/umd/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -2
- package/umd/Options/Classes/ManualParticle.js +3 -2
- package/umd/Options/Classes/Options.js +3 -0
- package/umd/Utils/CanvasUtils.js +50 -40
- package/umd/Utils/ColorUtils.js +127 -46
- package/umd/Utils/EventDispatcher.js +6 -5
- package/umd/Utils/HslColorManager.js +5 -5
- package/umd/Utils/NumberUtils.js +38 -25
- package/umd/Utils/RgbColorManager.js +5 -5
- package/umd/Utils/Utils.js +104 -20
|
@@ -4,14 +4,16 @@ 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
6
|
import type { IMouseData } from "./Interfaces/IMouseData.js";
|
|
7
|
+
import type { IParticleMover } from "./Interfaces/IParticleMover.js";
|
|
8
|
+
import type { IParticleUpdater } from "./Interfaces/IParticleUpdater.js";
|
|
7
9
|
import type { IParticlesOptions } from "../Options/Interfaces/Particles/IParticlesOptions.js";
|
|
8
|
-
import { Particle } from "./Particle.js";
|
|
10
|
+
import type { Particle } from "./Particle.js";
|
|
9
11
|
import { QuadTree } from "./Utils/QuadTree.js";
|
|
10
12
|
import type { RecursivePartial } from "../Types/RecursivePartial.js";
|
|
11
13
|
export declare class Particles {
|
|
12
|
-
movers:
|
|
14
|
+
movers: IParticleMover[];
|
|
13
15
|
quadTree: QuadTree;
|
|
14
|
-
updaters:
|
|
16
|
+
updaters: IParticleUpdater[];
|
|
15
17
|
private _array;
|
|
16
18
|
private readonly _container;
|
|
17
19
|
private readonly _engine;
|
|
@@ -21,13 +23,14 @@ export declare class Particles {
|
|
|
21
23
|
private _limit;
|
|
22
24
|
private _needsSort;
|
|
23
25
|
private _nextId;
|
|
26
|
+
private _pluginsInitialized;
|
|
24
27
|
private readonly _pool;
|
|
25
28
|
private _resizeFactor?;
|
|
26
29
|
private _zArray;
|
|
27
30
|
constructor(engine: Engine, container: Container);
|
|
28
31
|
get count(): number;
|
|
29
|
-
addManualParticles(): void
|
|
30
|
-
addParticle(position?: ICoordinates, overrideOptions?: RecursivePartial<IParticlesOptions>, group?: string, initializer?: (particle: Particle) => boolean): Particle | undefined
|
|
32
|
+
addManualParticles(): Promise<void>;
|
|
33
|
+
addParticle(position?: ICoordinates, overrideOptions?: RecursivePartial<IParticlesOptions>, group?: string, initializer?: (particle: Particle) => boolean): Promise<Particle | undefined>;
|
|
31
34
|
clear(): void;
|
|
32
35
|
destroy(): void;
|
|
33
36
|
draw(delta: IDelta): Promise<void>;
|
|
@@ -35,13 +38,14 @@ export declare class Particles {
|
|
|
35
38
|
find(condition: (particle: Particle) => boolean): Particle | undefined;
|
|
36
39
|
get(index: number): Particle | undefined;
|
|
37
40
|
handleClickMode(mode: string): void;
|
|
38
|
-
init(): void
|
|
39
|
-
|
|
41
|
+
init(): Promise<void>;
|
|
42
|
+
initPlugins(): Promise<void>;
|
|
43
|
+
push(nb: number, mouse?: IMouseData, overrideOptions?: RecursivePartial<IParticlesOptions>, group?: string): Promise<void>;
|
|
40
44
|
redraw(): Promise<void>;
|
|
41
45
|
remove(particle: Particle, group?: string, override?: boolean): void;
|
|
42
46
|
removeAt(index: number, quantity?: number, group?: string, override?: boolean): void;
|
|
43
47
|
removeQuantity(quantity: number, group?: string): void;
|
|
44
|
-
setDensity(): void
|
|
48
|
+
setDensity(): Promise<void>;
|
|
45
49
|
setLastZIndex(zIndex: number): void;
|
|
46
50
|
setResizeFactor(factor: IDimension): void;
|
|
47
51
|
update(delta: IDelta): Promise<void>;
|
|
@@ -11,3 +11,6 @@ export declare const touchCancelEvent = "touchcancel";
|
|
|
11
11
|
export declare const resizeEvent = "resize";
|
|
12
12
|
export declare const visibilityChangeEvent = "visibilitychange";
|
|
13
13
|
export declare const errorPrefix = "tsParticles - Error";
|
|
14
|
+
export declare const percentDenominator = 100;
|
|
15
|
+
export declare const halfRandom = 0.5;
|
|
16
|
+
export declare const millisecondsToSeconds = 1000;
|
|
@@ -4,8 +4,8 @@ import type { IExternalInteractor } from "../Interfaces/IExternalInteractor.js";
|
|
|
4
4
|
import { InteractorType } from "../../Enums/Types/InteractorType.js";
|
|
5
5
|
import type { Particle } from "../Particle.js";
|
|
6
6
|
export declare abstract class ExternalInteractorBase<TContainer extends Container = Container, TParticle extends Particle = Particle> implements IExternalInteractor<TParticle> {
|
|
7
|
-
protected readonly container: TContainer;
|
|
8
7
|
type: InteractorType;
|
|
8
|
+
protected readonly container: TContainer;
|
|
9
9
|
protected constructor(container: TContainer);
|
|
10
10
|
abstract clear(particle: TParticle, delta: IDelta): void;
|
|
11
11
|
abstract init(): void;
|
|
@@ -6,12 +6,12 @@ export declare class InteractionManager {
|
|
|
6
6
|
private readonly container;
|
|
7
7
|
private readonly _engine;
|
|
8
8
|
private _externalInteractors;
|
|
9
|
-
private
|
|
9
|
+
private _interactors;
|
|
10
10
|
private _particleInteractors;
|
|
11
11
|
constructor(engine: Engine, container: Container);
|
|
12
12
|
externalInteract(delta: IDelta): Promise<void>;
|
|
13
13
|
handleClickMode(mode: string): void;
|
|
14
|
-
init(): void
|
|
14
|
+
init(): Promise<void>;
|
|
15
15
|
particlesInteract(particle: Particle, delta: IDelta): Promise<void>;
|
|
16
|
-
reset(particle: Particle):
|
|
16
|
+
reset(particle: Particle): void;
|
|
17
17
|
}
|
|
@@ -4,8 +4,8 @@ import type { IParticlesInteractor } from "../Interfaces/IParticlesInteractor.js
|
|
|
4
4
|
import { InteractorType } from "../../Enums/Types/InteractorType.js";
|
|
5
5
|
import type { Particle } from "../Particle.js";
|
|
6
6
|
export declare abstract class ParticlesInteractorBase<TContainer extends Container = Container, TParticle extends Particle = Particle> implements IParticlesInteractor<TParticle> {
|
|
7
|
-
protected readonly container: TContainer;
|
|
8
7
|
type: InteractorType;
|
|
8
|
+
protected readonly container: TContainer;
|
|
9
9
|
protected constructor(container: TContainer);
|
|
10
10
|
abstract clear(particle: TParticle, delta: IDelta): void;
|
|
11
11
|
abstract init(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ICoordinates } from "../Interfaces/ICoordinates.js";
|
|
2
2
|
import type { Particle } from "../Particle.js";
|
|
3
3
|
export declare class Point {
|
|
4
|
-
readonly position: ICoordinates;
|
|
5
4
|
readonly particle: Particle;
|
|
5
|
+
readonly position: ICoordinates;
|
|
6
6
|
constructor(position: ICoordinates, particle: Particle);
|
|
7
7
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
export declare const enum OutMode {
|
|
2
2
|
bounce = "bounce",
|
|
3
|
-
bounceHorizontal = "bounce-horizontal",
|
|
4
|
-
bounceVertical = "bounce-vertical",
|
|
5
3
|
none = "none",
|
|
6
4
|
out = "out",
|
|
7
5
|
destroy = "destroy",
|
|
8
6
|
split = "split"
|
|
9
7
|
}
|
|
10
|
-
export type OutModeAlt = "bounce-horizontal" | "bounce-vertical";
|
|
@@ -3,7 +3,8 @@ import type { IOptionLoader } from "../../Interfaces/IOptionLoader.js";
|
|
|
3
3
|
import { OptionsColor } from "../OptionsColor.js";
|
|
4
4
|
import type { RecursivePartial } from "../../../Types/RecursivePartial.js";
|
|
5
5
|
export declare class BackgroundMaskCover implements IBackgroundMaskCover, IOptionLoader<IBackgroundMaskCover> {
|
|
6
|
-
color
|
|
6
|
+
color?: OptionsColor;
|
|
7
|
+
image?: string;
|
|
7
8
|
opacity: number;
|
|
8
9
|
constructor();
|
|
9
10
|
load(data?: RecursivePartial<IBackgroundMaskCover> | undefined): void;
|
|
@@ -29,6 +29,7 @@ export declare class Options implements IOptions, IOptionLoader<IOptions> {
|
|
|
29
29
|
fpsLimit: number;
|
|
30
30
|
readonly fullScreen: FullScreen;
|
|
31
31
|
readonly interactivity: Interactivity;
|
|
32
|
+
key?: string;
|
|
32
33
|
manualParticles: ManualParticle[];
|
|
33
34
|
name?: string;
|
|
34
35
|
readonly particles: import("./Particles/ParticlesOptions.js").ParticlesOptions;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { MoveDirection, type MoveDirectionAlt } from "../../../../Enums/Directions/MoveDirection.js";
|
|
1
2
|
import type { IDistance } from "../../../../Core/Interfaces/IDistance.js";
|
|
2
3
|
import type { IMove } from "../../../Interfaces/Particles/Move/IMove.js";
|
|
3
4
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
|
|
4
5
|
import { MoveAngle } from "./MoveAngle.js";
|
|
5
6
|
import { MoveAttract } from "./MoveAttract.js";
|
|
6
7
|
import { MoveCenter } from "./MoveCenter.js";
|
|
7
|
-
import { MoveDirection } from "../../../../Enums/Directions/MoveDirection.js";
|
|
8
|
-
import type { MoveDirectionAlt } from "../../../../Enums/Directions/MoveDirection.js";
|
|
9
8
|
import { MoveGravity } from "./MoveGravity.js";
|
|
10
9
|
import { MovePath } from "./Path/MovePath.js";
|
|
11
10
|
import { MoveTrail } from "./MoveTrail.js";
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
|
|
2
2
|
import type { IOutModes } from "../../../Interfaces/Particles/Move/IOutModes.js";
|
|
3
3
|
import { OutMode } from "../../../../Enums/Modes/OutMode.js";
|
|
4
|
-
import type { OutModeAlt } from "../../../../Enums/Modes/OutMode.js";
|
|
5
4
|
import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
|
|
6
5
|
export declare class OutModes implements IOutModes, IOptionLoader<IOutModes> {
|
|
7
|
-
bottom?: OutMode | keyof typeof OutMode
|
|
8
|
-
default: OutMode | keyof typeof OutMode
|
|
9
|
-
left?: OutMode | keyof typeof OutMode
|
|
10
|
-
right?: OutMode | keyof typeof OutMode
|
|
11
|
-
top?: OutMode | keyof typeof OutMode
|
|
6
|
+
bottom?: OutMode | keyof typeof OutMode;
|
|
7
|
+
default: OutMode | keyof typeof OutMode;
|
|
8
|
+
left?: OutMode | keyof typeof OutMode;
|
|
9
|
+
right?: OutMode | keyof typeof OutMode;
|
|
10
|
+
top?: OutMode | keyof typeof OutMode;
|
|
12
11
|
constructor();
|
|
13
12
|
load(data?: RecursivePartial<IOutModes>): void;
|
|
14
13
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { IBackgroundMaskCover } from "./IBackgroundMaskCover.js";
|
|
2
2
|
import type { IColor } from "../../../Core/Interfaces/Colors.js";
|
|
3
|
+
import type { RecursivePartial } from "../../../Types/RecursivePartial.js";
|
|
3
4
|
export interface IBackgroundMask {
|
|
4
5
|
composite: GlobalCompositeOperation;
|
|
5
|
-
cover: IBackgroundMaskCover | IColor | string;
|
|
6
|
+
cover: RecursivePartial<IBackgroundMaskCover> | IColor | string;
|
|
6
7
|
enable: boolean;
|
|
7
8
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MoveDirection, MoveDirectionAlt } from "../../../../Enums/Directions/MoveDirection.js";
|
|
2
|
-
import type { OutMode, OutModeAlt } from "../../../../Enums/Modes/OutMode.js";
|
|
3
2
|
import type { IDistance } from "../../../../Core/Interfaces/IDistance.js";
|
|
4
3
|
import type { IMoveAngle } from "./IMoveAngle.js";
|
|
5
4
|
import type { IMoveAttract } from "./IMoveAttract.js";
|
|
@@ -9,6 +8,7 @@ import type { IMovePath } from "./Path/IMovePath.js";
|
|
|
9
8
|
import type { IMoveTrail } from "./IMoveTrail.js";
|
|
10
9
|
import type { IOutModes } from "./IOutModes.js";
|
|
11
10
|
import type { ISpin } from "./ISpin.js";
|
|
11
|
+
import type { OutMode } from "../../../../Enums/Modes/OutMode.js";
|
|
12
12
|
import type { RangeValue } from "../../../../Types/RangeValue.js";
|
|
13
13
|
export interface IMove {
|
|
14
14
|
angle: number | IMoveAngle;
|
|
@@ -20,7 +20,7 @@ export interface IMove {
|
|
|
20
20
|
drift: RangeValue;
|
|
21
21
|
enable: boolean;
|
|
22
22
|
gravity: IMoveGravity;
|
|
23
|
-
outModes: IOutModes | OutMode | keyof typeof OutMode
|
|
23
|
+
outModes: IOutModes | OutMode | keyof typeof OutMode;
|
|
24
24
|
path: IMovePath;
|
|
25
25
|
random: boolean;
|
|
26
26
|
size: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { OutMode
|
|
1
|
+
import type { OutMode } from "../../../../Enums/Modes/OutMode.js";
|
|
2
2
|
export interface IOutModes {
|
|
3
|
-
bottom?: OutMode | keyof typeof OutMode
|
|
4
|
-
default: OutMode | keyof typeof OutMode
|
|
5
|
-
left?: OutMode | keyof typeof OutMode
|
|
6
|
-
right?: OutMode | keyof typeof OutMode
|
|
7
|
-
top?: OutMode | keyof typeof OutMode
|
|
3
|
+
bottom?: OutMode | keyof typeof OutMode;
|
|
4
|
+
default: OutMode | keyof typeof OutMode;
|
|
5
|
+
left?: OutMode | keyof typeof OutMode;
|
|
6
|
+
right?: OutMode | keyof typeof OutMode;
|
|
7
|
+
top?: OutMode | keyof typeof OutMode;
|
|
8
8
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { IShapeValues } from "../Core/Interfaces/IShapeValues.js";
|
|
2
2
|
import type { SingleOrMultiple } from "./SingleOrMultiple.js";
|
|
3
|
-
export type ShapeData =
|
|
4
|
-
[type: string]: SingleOrMultiple<IShapeValues>;
|
|
5
|
-
};
|
|
3
|
+
export type ShapeData = Record<string, SingleOrMultiple<IShapeValues>>;
|
|
@@ -11,25 +11,26 @@ export declare function drawLine(context: CanvasRenderingContext2D, begin: ICoor
|
|
|
11
11
|
export declare function paintBase(context: CanvasRenderingContext2D, dimension: IDimension, baseColor?: string): void;
|
|
12
12
|
export declare function paintImage(context: CanvasRenderingContext2D, dimension: IDimension, image: HTMLImageElement | undefined, opacity: number): void;
|
|
13
13
|
export declare function clear(context: CanvasRenderingContext2D, dimension: IDimension): void;
|
|
14
|
-
export declare function drawParticle(data: IDrawParticleParams): void
|
|
15
|
-
|
|
14
|
+
export declare function drawParticle(data: IDrawParticleParams): Promise<void>;
|
|
15
|
+
interface DrawShapeData {
|
|
16
16
|
container: Container;
|
|
17
17
|
context: CanvasRenderingContext2D;
|
|
18
18
|
delta: IDelta;
|
|
19
19
|
opacity: number;
|
|
20
20
|
particle: Particle;
|
|
21
21
|
radius: number;
|
|
22
|
+
strokeWidth: number;
|
|
22
23
|
transformData: {
|
|
23
24
|
a: number;
|
|
24
25
|
b: number;
|
|
25
26
|
c: number;
|
|
26
27
|
d: number;
|
|
27
28
|
};
|
|
28
|
-
}
|
|
29
|
-
export declare function drawEffect(data: DrawShapeData): void
|
|
30
|
-
export declare function drawShape(data: DrawShapeData): void
|
|
31
|
-
export declare function drawShapeAfterDraw(data: DrawShapeData): void
|
|
32
|
-
export declare function drawPlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, delta: IDelta): void
|
|
33
|
-
export declare function drawParticlePlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, particle: Particle, delta: IDelta): void
|
|
29
|
+
}
|
|
30
|
+
export declare function drawEffect(data: DrawShapeData): Promise<void>;
|
|
31
|
+
export declare function drawShape(data: DrawShapeData): Promise<void>;
|
|
32
|
+
export declare function drawShapeAfterDraw(data: DrawShapeData): Promise<void>;
|
|
33
|
+
export declare function drawPlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, delta: IDelta): Promise<void>;
|
|
34
|
+
export declare function drawParticlePlugin(context: CanvasRenderingContext2D, plugin: IContainerPlugin, particle: Particle, delta: IDelta): Promise<void>;
|
|
34
35
|
export declare function alterHsl(color: IHsl, type: AlterType, value: number): IHsl;
|
|
35
36
|
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { IColor, IHsl, IHsla, IRangeColor, IRgb, IRgba } from "../Core/Interfaces/Colors.js";
|
|
2
2
|
import type { HslAnimation } from "../Options/Classes/HslAnimation.js";
|
|
3
3
|
import type { IColorManager } from "../Core/Interfaces/IColorManager.js";
|
|
4
|
+
import type { IDelta } from "../Core/Interfaces/IDelta.js";
|
|
4
5
|
import type { IOptionsColor } from "../Options/Interfaces/IOptionsColor.js";
|
|
6
|
+
import type { IParticleColorAnimation } from "../Core/Interfaces/IParticleValueAnimation.js";
|
|
5
7
|
import type { IParticleHslAnimation } from "../Core/Interfaces/IParticleHslAnimation.js";
|
|
8
|
+
import type { IRangeValue } from "../Core/Interfaces/IRangeValue.js";
|
|
6
9
|
import type { Particle } from "../Core/Particle.js";
|
|
7
10
|
export declare function addColorManager(manager: IColorManager): void;
|
|
8
11
|
export declare function rangeColorToRgb(input?: string | IRangeColor, index?: number, useIndex?: boolean): IRgb | undefined;
|
|
@@ -22,3 +25,5 @@ export declare function getLinkColor(p1: Particle, p2?: Particle, linkColor?: st
|
|
|
22
25
|
export declare function getLinkRandomColor(optColor: string | IOptionsColor, blink: boolean, consent: boolean): IRgb | string | undefined;
|
|
23
26
|
export declare function getHslFromAnimation(animation?: IParticleHslAnimation): IHsl | undefined;
|
|
24
27
|
export declare function getHslAnimationFromHsl(hsl: IHsl, animationOptions: HslAnimation | undefined, reduceFactor: number): IParticleHslAnimation;
|
|
28
|
+
export declare function updateColorValue(data: IParticleColorAnimation, range: IRangeValue, decrease: boolean, delta: IDelta): void;
|
|
29
|
+
export declare function updateColor(color: IParticleHslAnimation | undefined, delta: IDelta): void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { EasingType, EasingTypeAlt } from "../Enums/Types/EasingType.js";
|
|
2
2
|
import type { IPositionFromSizeParams, IRangedPositionFromSizeParams } from "../Core/Interfaces/IPositionFromSizeParams.js";
|
|
3
|
+
import { MoveDirection, type MoveDirectionAlt } from "../Enums/Directions/MoveDirection.js";
|
|
3
4
|
import type { ICoordinates } from "../Core/Interfaces/ICoordinates.js";
|
|
4
|
-
import { MoveDirection } from "../Enums/Directions/MoveDirection.js";
|
|
5
|
-
import type { MoveDirectionAlt } from "../Enums/Directions/MoveDirection.js";
|
|
6
5
|
import type { RangeValue } from "../Types/RangeValue.js";
|
|
7
6
|
import { Vector } from "../Core/Utils/Vector.js";
|
|
8
7
|
type EasingFunction = (value: number) => number;
|
|
@@ -23,6 +22,7 @@ export declare function getDistances(pointA: ICoordinates, pointB: ICoordinates)
|
|
|
23
22
|
dy: number;
|
|
24
23
|
};
|
|
25
24
|
export declare function getDistance(pointA: ICoordinates, pointB: ICoordinates): number;
|
|
25
|
+
export declare function degToRad(degrees: number): number;
|
|
26
26
|
export declare function getParticleDirectionAngle(direction: MoveDirection | keyof typeof MoveDirection | MoveDirectionAlt | number, position: ICoordinates, center: ICoordinates): number;
|
|
27
27
|
export declare function getParticleBaseVelocity(direction: number): Vector;
|
|
28
28
|
export declare function collisionVelocity(v1: Vector, v2: Vector, m1: number, m2: number): Vector;
|
package/types/Utils/Utils.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ICoordinates, ICoordinatesWithMode } from "../Core/Interfaces/ICoordinates.js";
|
|
2
2
|
import type { IDimension, IDimensionWithMode } from "../Core/Interfaces/IDimension.js";
|
|
3
|
+
import { DestroyType } from "../Enums/Types/DestroyType.js";
|
|
3
4
|
import type { DivEvent } from "../Options/Classes/Interactivity/Events/DivEvent.js";
|
|
4
5
|
import type { IBounds } from "../Core/Interfaces/IBounds.js";
|
|
5
6
|
import type { ICircleBouncer } from "../Core/Interfaces/ICircleBouncer.js";
|
|
7
|
+
import type { IDelta } from "../Core/Interfaces/IDelta.js";
|
|
6
8
|
import type { IModeDiv } from "../Options/Interfaces/Interactivity/Modes/IModeDiv.js";
|
|
7
9
|
import type { IParticleNumericValueAnimation } from "../Core/Interfaces/IParticleValueAnimation.js";
|
|
8
10
|
import { OutModeDirection } from "../Enums/Directions/OutModeDirection.js";
|
|
@@ -10,12 +12,12 @@ import type { Particle } from "../Core/Particle.js";
|
|
|
10
12
|
import type { RangedAnimationValueWithRandom } from "../Options/Classes/ValueWithRandom.js";
|
|
11
13
|
import type { SingleOrMultiple } from "../Types/SingleOrMultiple.js";
|
|
12
14
|
interface ILogger {
|
|
13
|
-
debug(message?: unknown, ...optionalParams: unknown[]): void;
|
|
14
|
-
error(message?: unknown, ...optionalParams: unknown[]): void;
|
|
15
|
-
info(message?: unknown, ...optionalParams: unknown[]): void;
|
|
16
|
-
log(message?: unknown, ...optionalParams: unknown[]): void;
|
|
17
|
-
verbose(message?: unknown, ...optionalParams: unknown[]): void;
|
|
18
|
-
warning(message?: unknown, ...optionalParams: unknown[]): void;
|
|
15
|
+
debug(this: void, message?: unknown, ...optionalParams: unknown[]): void;
|
|
16
|
+
error(this: void, message?: unknown, ...optionalParams: unknown[]): void;
|
|
17
|
+
info(this: void, message?: unknown, ...optionalParams: unknown[]): void;
|
|
18
|
+
log(this: void, message?: unknown, ...optionalParams: unknown[]): void;
|
|
19
|
+
verbose(this: void, message?: unknown, ...optionalParams: unknown[]): void;
|
|
20
|
+
warning(this: void, message?: unknown, ...optionalParams: unknown[]): void;
|
|
19
21
|
}
|
|
20
22
|
export declare function setLogger(logger: ILogger): void;
|
|
21
23
|
export declare function getLogger(): ILogger;
|
|
@@ -51,4 +53,5 @@ export declare function isNumber(arg: unknown): arg is number;
|
|
|
51
53
|
export declare function isFunction(arg: unknown): arg is Function;
|
|
52
54
|
export declare function isObject<T extends object>(arg: unknown): arg is T;
|
|
53
55
|
export declare function isArray<T>(arg: unknown): arg is T[];
|
|
56
|
+
export declare function updateAnimation(particle: Particle, data: IParticleNumericValueAnimation, changeDirection: boolean, destroyType: DestroyType | keyof typeof DestroyType, delta: IDelta): void;
|
|
54
57
|
export {};
|