@tsparticles/engine 3.0.0-alpha.1 → 3.0.0-beta.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/README.md +244 -188
- package/browser/Core/Canvas.js +271 -241
- package/browser/Core/Container.js +90 -106
- package/browser/Core/Engine.js +271 -0
- package/browser/Core/Particle.js +158 -165
- package/browser/Core/Particles.js +148 -143
- package/browser/Core/Retina.js +15 -13
- package/browser/Core/Utils/Circle.js +10 -6
- package/browser/Core/Utils/Constants.js +4 -3
- package/browser/Core/Utils/EventListeners.js +258 -234
- package/browser/Core/Utils/InteractionManager.js +6 -16
- package/browser/Core/Utils/QuadTree.js +14 -20
- package/browser/Core/Utils/Vector3d.js +17 -9
- package/browser/Options/Classes/AnimatableColor.js +2 -1
- package/browser/Options/Classes/AnimationOptions.js +4 -3
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +2 -1
- package/browser/Options/Classes/ColorAnimation.js +4 -0
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/browser/Options/Classes/Interactivity/Events/Events.js +5 -24
- package/browser/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/browser/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/browser/Options/Classes/ManualParticle.js +5 -6
- package/browser/Options/Classes/Options.js +19 -39
- package/browser/Options/Classes/OptionsColor.js +3 -2
- package/browser/Options/Classes/Particles/Collisions/Collisions.js +5 -0
- package/browser/Options/Classes/Particles/Move/Move.js +11 -41
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/browser/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/browser/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/browser/Options/Classes/Particles/Move/Spin.js +3 -1
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +11 -7
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/browser/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/browser/Options/Classes/Particles/Shape/Shape.js +9 -10
- package/browser/Options/Classes/Particles/Size/Size.js +11 -7
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/browser/Options/Classes/ValueWithRandom.js +4 -17
- package/browser/Utils/CanvasUtils.js +18 -54
- package/browser/Utils/ColorUtils.js +17 -19
- package/browser/Utils/EventDispatcher.js +7 -6
- package/browser/Utils/HslColorManager.js +2 -4
- package/browser/Utils/NumberUtils.js +41 -45
- package/browser/Utils/RgbColorManager.js +2 -4
- package/browser/Utils/Utils.js +133 -62
- package/browser/bundle.js +4 -97
- package/browser/export-types.js +97 -0
- package/browser/exports.js +89 -0
- package/browser/index.js +8 -199
- package/browser/init.js +12 -0
- package/cjs/Core/Canvas.js +269 -239
- package/cjs/Core/Container.js +90 -106
- package/cjs/Core/Engine.js +275 -0
- package/cjs/Core/Particle.js +157 -164
- package/cjs/Core/Particles.js +148 -143
- package/cjs/Core/Retina.js +15 -13
- package/cjs/Core/Utils/Circle.js +10 -6
- package/cjs/Core/Utils/Constants.js +5 -4
- package/cjs/Core/Utils/EventListeners.js +257 -233
- package/cjs/Core/Utils/InteractionManager.js +6 -16
- package/cjs/Core/Utils/QuadTree.js +14 -20
- package/cjs/Core/Utils/Vector3d.js +17 -9
- package/cjs/Options/Classes/AnimatableColor.js +2 -1
- package/cjs/Options/Classes/AnimationOptions.js +4 -3
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +2 -1
- package/cjs/Options/Classes/ColorAnimation.js +4 -0
- package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/cjs/Options/Classes/Interactivity/Events/Events.js +5 -24
- package/cjs/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/cjs/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/cjs/Options/Classes/ManualParticle.js +5 -6
- package/cjs/Options/Classes/Options.js +18 -38
- package/cjs/Options/Classes/OptionsColor.js +3 -2
- package/cjs/Options/Classes/Particles/Collisions/Collisions.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Move.js +11 -41
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/cjs/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/cjs/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/cjs/Options/Classes/Particles/Move/Spin.js +3 -1
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +10 -6
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/cjs/Options/Classes/Particles/Shape/Shape.js +9 -10
- package/cjs/Options/Classes/Particles/Size/Size.js +11 -7
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/cjs/Options/Classes/ValueWithRandom.js +4 -17
- package/cjs/Utils/CanvasUtils.js +21 -58
- package/cjs/Utils/ColorUtils.js +16 -18
- package/cjs/Utils/EventDispatcher.js +7 -6
- package/cjs/Utils/HslColorManager.js +2 -4
- package/cjs/Utils/NumberUtils.js +41 -45
- package/cjs/Utils/RgbColorManager.js +2 -4
- package/cjs/Utils/Utils.js +146 -66
- package/cjs/bundle.js +4 -97
- package/cjs/export-types.js +113 -0
- package/cjs/exports.js +105 -0
- package/cjs/index.js +8 -199
- package/cjs/init.js +16 -0
- package/esm/Core/Canvas.js +271 -241
- package/esm/Core/Container.js +90 -106
- package/esm/Core/Engine.js +271 -0
- package/esm/Core/Particle.js +158 -165
- package/esm/Core/Particles.js +148 -143
- package/esm/Core/Retina.js +15 -13
- package/esm/Core/Utils/Circle.js +10 -6
- package/esm/Core/Utils/Constants.js +4 -3
- package/esm/Core/Utils/EventListeners.js +258 -234
- package/esm/Core/Utils/InteractionManager.js +6 -16
- package/esm/Core/Utils/QuadTree.js +14 -20
- package/esm/Core/Utils/Vector3d.js +17 -9
- package/esm/Options/Classes/AnimatableColor.js +2 -1
- package/esm/Options/Classes/AnimationOptions.js +4 -3
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +2 -1
- package/esm/Options/Classes/ColorAnimation.js +4 -0
- package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/esm/Options/Classes/Interactivity/Events/Events.js +5 -24
- package/esm/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/esm/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/esm/Options/Classes/ManualParticle.js +5 -6
- package/esm/Options/Classes/Options.js +19 -39
- package/esm/Options/Classes/OptionsColor.js +3 -2
- package/esm/Options/Classes/Particles/Collisions/Collisions.js +5 -0
- package/esm/Options/Classes/Particles/Move/Move.js +11 -41
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/esm/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/esm/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/esm/Options/Classes/Particles/Move/Spin.js +3 -1
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +11 -7
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/esm/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/esm/Options/Classes/Particles/Shape/Shape.js +9 -10
- package/esm/Options/Classes/Particles/Size/Size.js +11 -7
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/esm/Options/Classes/ValueWithRandom.js +4 -17
- package/esm/Utils/CanvasUtils.js +18 -54
- package/esm/Utils/ColorUtils.js +17 -19
- package/esm/Utils/EventDispatcher.js +7 -6
- package/esm/Utils/HslColorManager.js +2 -4
- package/esm/Utils/NumberUtils.js +41 -45
- package/esm/Utils/RgbColorManager.js +2 -4
- package/esm/Utils/Utils.js +133 -62
- package/esm/bundle.js +4 -97
- package/esm/export-types.js +97 -0
- package/esm/exports.js +89 -0
- package/esm/index.js +8 -199
- package/esm/init.js +12 -0
- package/package.json +17 -2
- package/report.html +4 -4
- package/scripts/install.js +90 -33
- package/tsparticles.engine.js +1832 -2007
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -10
- package/types/Core/Canvas.d.ts +20 -16
- package/types/Core/Container.d.ts +10 -14
- package/types/Core/Engine.d.ts +71 -0
- package/types/Core/Interfaces/IContainerPlugin.d.ts +2 -0
- package/types/Core/Interfaces/ICoordinates.d.ts +2 -2
- package/types/Core/Interfaces/IDimension.d.ts +2 -2
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +2 -1
- package/types/Core/Interfaces/IParticleUpdater.d.ts +0 -2
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +2 -0
- package/types/Core/Interfaces/IPlugin.d.ts +4 -3
- package/types/Core/Particle.d.ts +7 -7
- package/types/Core/Particles.d.ts +14 -11
- package/types/Core/Utils/Constants.d.ts +4 -3
- package/types/Core/Utils/EventListeners.d.ts +20 -18
- package/types/Core/Utils/InteractionManager.d.ts +1 -1
- package/types/Core/Utils/QuadTree.d.ts +2 -5
- package/types/Core/Utils/Vector3d.d.ts +2 -1
- package/types/Enums/Modes/{SizeMode.d.ts → PixelMode.d.ts} +1 -1
- package/types/Options/Classes/AnimationOptions.d.ts +1 -1
- package/types/Options/Classes/ColorAnimation.d.ts +1 -0
- package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -6
- package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -6
- package/types/Options/Classes/Interactivity/Interactivity.d.ts +1 -3
- package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +1 -1
- package/types/Options/Classes/Options.d.ts +5 -12
- package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +2 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -11
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -4
- package/types/Options/Classes/Particles/Move/MoveCenter.d.ts +2 -2
- package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +0 -3
- package/types/Options/Classes/Particles/Number/ParticlesDensity.d.ts +0 -6
- package/types/Options/Classes/Particles/Number/ParticlesNumber.d.ts +0 -2
- package/types/Options/Classes/Particles/Opacity/Opacity.d.ts +4 -4
- package/types/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +0 -2
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +1 -1
- package/types/Options/Classes/Particles/Size/Size.d.ts +4 -4
- package/types/Options/Classes/Particles/Size/SizeAnimation.d.ts +0 -2
- package/types/Options/Classes/Responsive.d.ts +3 -3
- package/types/Options/Classes/Theme/Theme.d.ts +2 -2
- package/types/Options/Classes/ValueWithRandom.d.ts +2 -6
- package/types/Options/Interfaces/IAnimation.d.ts +1 -1
- package/types/Options/Interfaces/IOptions.d.ts +1 -4
- package/types/Options/Interfaces/IResponsive.d.ts +4 -3
- package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -3
- package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -3
- package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -1
- package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Collisions/ICollisions.d.ts +2 -0
- package/types/Options/Interfaces/Particles/IStroke.d.ts +2 -1
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -5
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Move/IMoveTrail.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Number/IParticlesDensity.d.ts +0 -3
- package/types/Options/Interfaces/Particles/Number/IParticlesNumber.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Opacity/IOpacity.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Opacity/IOpacityAnimation.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Size/ISize.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Size/ISizeAnimation.d.ts +0 -1
- package/types/Options/Interfaces/Theme/ITheme.d.ts +3 -2
- package/types/Types/ExportResult.d.ts +5 -0
- package/types/Utils/CanvasUtils.d.ts +2 -5
- package/types/Utils/OptionsUtils.d.ts +1 -1
- package/types/Utils/Utils.d.ts +22 -4
- package/types/bundle.d.ts +2 -91
- package/types/export-types.d.ts +107 -0
- package/types/exports.d.ts +89 -0
- package/types/index.d.ts +3 -204
- package/types/init.d.ts +2 -0
- package/umd/Core/Canvas.js +269 -239
- package/umd/Core/Container.js +91 -107
- package/umd/Core/Engine.js +285 -0
- package/umd/Core/Particle.js +158 -165
- package/umd/Core/Particles.js +149 -144
- package/umd/Core/Retina.js +15 -13
- package/umd/Core/Utils/Circle.js +11 -7
- package/umd/Core/Utils/Constants.js +5 -4
- package/umd/Core/Utils/EventListeners.js +257 -233
- package/umd/Core/Utils/InteractionManager.js +6 -16
- package/umd/Core/Utils/QuadTree.js +14 -20
- package/umd/Core/Utils/Vector3d.js +18 -10
- package/umd/Options/Classes/AnimatableColor.js +3 -2
- package/umd/Options/Classes/AnimationOptions.js +4 -3
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +3 -2
- package/umd/Options/Classes/ColorAnimation.js +4 -0
- package/umd/Options/Classes/Interactivity/Events/DivEvent.js +1 -25
- package/umd/Options/Classes/Interactivity/Events/Events.js +6 -25
- package/umd/Options/Classes/Interactivity/Interactivity.js +1 -8
- package/umd/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/umd/Options/Classes/ManualParticle.js +5 -6
- package/umd/Options/Classes/Options.js +18 -38
- package/umd/Options/Classes/OptionsColor.js +4 -3
- package/umd/Options/Classes/Particles/Collisions/Collisions.js +6 -1
- package/umd/Options/Classes/Particles/Move/Move.js +12 -42
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +9 -20
- package/umd/Options/Classes/Particles/Move/MoveTrail.js +2 -8
- package/umd/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -1
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +2 -9
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +10 -6
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +0 -9
- package/umd/Options/Classes/Particles/ParticlesOptions.js +6 -11
- package/umd/Options/Classes/Particles/Shape/Shape.js +9 -10
- package/umd/Options/Classes/Particles/Size/Size.js +12 -8
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +0 -9
- package/umd/Options/Classes/ValueWithRandom.js +5 -18
- package/umd/Utils/CanvasUtils.js +21 -58
- package/umd/Utils/ColorUtils.js +16 -18
- package/umd/Utils/EventDispatcher.js +7 -6
- package/umd/Utils/HslColorManager.js +2 -4
- package/umd/Utils/NumberUtils.js +42 -46
- package/umd/Utils/RgbColorManager.js +2 -4
- package/umd/Utils/Utils.js +146 -66
- package/umd/bundle.js +5 -98
- package/umd/export-types.js +123 -0
- package/umd/exports.js +115 -0
- package/umd/index.js +9 -200
- package/umd/init.js +26 -0
- package/browser/Core/Utils/FrameManager.js +0 -42
- package/browser/Core/Utils/Plugins.js +0 -112
- package/browser/Options/Interfaces/Particles/Shape/IImageShape.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IStarShape.js +0 -1
- package/browser/engine.js +0 -175
- package/cjs/Core/Utils/FrameManager.js +0 -46
- package/cjs/Core/Utils/Plugins.js +0 -116
- package/cjs/Enums/Modes/SizeMode.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IImageShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -17
- package/cjs/Options/Interfaces/Particles/Shape/IStarShape.js +0 -2
- package/cjs/engine.js +0 -179
- package/esm/Core/Interfaces/IParticleOverride.js +0 -1
- package/esm/Core/Interfaces/IParticlesMover.js +0 -1
- package/esm/Core/Utils/FrameManager.js +0 -42
- package/esm/Core/Utils/Plugins.js +0 -112
- package/esm/Enums/Modes/SizeMode.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IImageShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IStarShape.js +0 -1
- package/esm/engine.js +0 -175
- package/types/Core/Interfaces/IParticleOverride.d.ts +0 -6
- package/types/Core/Interfaces/IParticlesMover.d.ts +0 -7
- package/types/Core/Utils/FrameManager.d.ts +0 -6
- package/types/Core/Utils/Plugins.d.ts +0 -51
- package/types/Options/Interfaces/Particles/Shape/ICharacterShape.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Shape/IImageShape.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Shape/IPolygonShape.d.ts +0 -5
- package/types/Options/Interfaces/Particles/Shape/IShapeValues.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Shape/IStarShape.d.ts +0 -6
- package/types/engine.d.ts +0 -39
- package/umd/Core/Utils/FrameManager.js +0 -56
- package/umd/Core/Utils/Plugins.js +0 -126
- package/umd/Enums/Modes/SizeMode.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IImageShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -27
- package/umd/Options/Interfaces/Particles/Shape/IStarShape.js +0 -12
- package/umd/engine.js +0 -189
- /package/browser/{Core/Interfaces/IParticleOverride.js → Enums/Modes/PixelMode.js} +0 -0
- /package/browser/{Core/Interfaces/IParticlesMover.js → Types/ExportResult.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticleOverride.js → Enums/Modes/PixelMode.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticlesMover.js → Types/ExportResult.js} +0 -0
- /package/{browser/Enums/Modes/SizeMode.js → esm/Enums/Modes/PixelMode.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/ICharacterShape.js → esm/Types/ExportResult.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleOverride.js → Enums/Modes/PixelMode.js} +0 -0
- /package/umd/{Core/Interfaces/IParticlesMover.js → Types/ExportResult.js} +0 -0
|
@@ -4,37 +4,18 @@ export class ParticlesDensity {
|
|
|
4
4
|
this.width = 1920;
|
|
5
5
|
this.height = 1080;
|
|
6
6
|
}
|
|
7
|
-
get area() {
|
|
8
|
-
return this.width;
|
|
9
|
-
}
|
|
10
|
-
set area(value) {
|
|
11
|
-
this.width = value;
|
|
12
|
-
}
|
|
13
|
-
get factor() {
|
|
14
|
-
return this.height;
|
|
15
|
-
}
|
|
16
|
-
set factor(value) {
|
|
17
|
-
this.height = value;
|
|
18
|
-
}
|
|
19
|
-
get value_area() {
|
|
20
|
-
return this.area;
|
|
21
|
-
}
|
|
22
|
-
set value_area(value) {
|
|
23
|
-
this.area = value;
|
|
24
|
-
}
|
|
25
7
|
load(data) {
|
|
26
|
-
var _a, _b, _c;
|
|
27
8
|
if (!data) {
|
|
28
9
|
return;
|
|
29
10
|
}
|
|
30
11
|
if (data.enable !== undefined) {
|
|
31
12
|
this.enable = data.enable;
|
|
32
13
|
}
|
|
33
|
-
const width =
|
|
14
|
+
const width = data.width;
|
|
34
15
|
if (width !== undefined) {
|
|
35
16
|
this.width = width;
|
|
36
17
|
}
|
|
37
|
-
const height =
|
|
18
|
+
const height = data.height;
|
|
38
19
|
if (height !== undefined) {
|
|
39
20
|
this.height = height;
|
|
40
21
|
}
|
|
@@ -3,21 +3,14 @@ export class ParticlesNumber {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
this.density = new ParticlesDensity();
|
|
5
5
|
this.limit = 0;
|
|
6
|
-
this.value =
|
|
7
|
-
}
|
|
8
|
-
get max() {
|
|
9
|
-
return this.limit;
|
|
10
|
-
}
|
|
11
|
-
set max(value) {
|
|
12
|
-
this.limit = value;
|
|
6
|
+
this.value = 0;
|
|
13
7
|
}
|
|
14
8
|
load(data) {
|
|
15
|
-
var _a;
|
|
16
9
|
if (!data) {
|
|
17
10
|
return;
|
|
18
11
|
}
|
|
19
12
|
this.density.load(data.density);
|
|
20
|
-
const limit =
|
|
13
|
+
const limit = data.limit;
|
|
21
14
|
if (limit !== undefined) {
|
|
22
15
|
this.limit = limit;
|
|
23
16
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { OpacityAnimation } from "./OpacityAnimation";
|
|
2
|
-
import {
|
|
3
|
-
export class Opacity extends
|
|
2
|
+
import { ValueWithRandom } from "../../ValueWithRandom";
|
|
3
|
+
export class Opacity extends ValueWithRandom {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
6
6
|
this.animation = new OpacityAnimation();
|
|
7
7
|
this.random.minimumValue = 0.1;
|
|
8
8
|
this.value = 1;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
load(data) {
|
|
11
|
+
if (!data) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
super.load(data);
|
|
15
|
+
const animation = data.animation;
|
|
16
|
+
if (animation !== undefined) {
|
|
17
|
+
this.animation.load(animation);
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
}
|
|
@@ -5,16 +5,7 @@ export class OpacityAnimation extends RangedAnimationOptions {
|
|
|
5
5
|
this.destroy = "none";
|
|
6
6
|
this.speed = 2;
|
|
7
7
|
}
|
|
8
|
-
get opacity_min() {
|
|
9
|
-
return this.minimumValue;
|
|
10
|
-
}
|
|
11
|
-
set opacity_min(value) {
|
|
12
|
-
this.minimumValue = value;
|
|
13
|
-
}
|
|
14
8
|
load(data) {
|
|
15
|
-
if ((data === null || data === void 0 ? void 0 : data.opacity_min) !== undefined && data.minimumValue === undefined) {
|
|
16
|
-
data.minimumValue = data.opacity_min;
|
|
17
|
-
}
|
|
18
9
|
super.load(data);
|
|
19
10
|
if (!data) {
|
|
20
11
|
return;
|
|
@@ -30,7 +30,6 @@ export class ParticlesOptions {
|
|
|
30
30
|
this.zIndex = new ZIndex();
|
|
31
31
|
}
|
|
32
32
|
load(data) {
|
|
33
|
-
var _a, _b, _c, _d;
|
|
34
33
|
if (!data) {
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
@@ -40,7 +39,7 @@ export class ParticlesOptions {
|
|
|
40
39
|
for (const group in data.groups) {
|
|
41
40
|
const item = data.groups[group];
|
|
42
41
|
if (item !== undefined) {
|
|
43
|
-
this.groups[group] = deepExtend(
|
|
42
|
+
this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -54,24 +53,20 @@ export class ParticlesOptions {
|
|
|
54
53
|
this.size.load(data.size);
|
|
55
54
|
this.shadow.load(data.shadow);
|
|
56
55
|
this.zIndex.load(data.zIndex);
|
|
57
|
-
const collisions = (_c = (_b = data.move) === null || _b === void 0 ? void 0 : _b.collisions) !== null && _c !== void 0 ? _c : (_d = data.move) === null || _d === void 0 ? void 0 : _d.bounce;
|
|
58
|
-
if (collisions !== undefined) {
|
|
59
|
-
this.collisions.enable = collisions;
|
|
60
|
-
}
|
|
61
56
|
this.collisions.load(data.collisions);
|
|
62
57
|
if (data.interactivity !== undefined) {
|
|
63
58
|
this.interactivity = deepExtend({}, data.interactivity);
|
|
64
59
|
}
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
this.stroke = executeOnSingleOrMultiple(
|
|
60
|
+
const strokeToLoad = data.stroke;
|
|
61
|
+
if (strokeToLoad) {
|
|
62
|
+
this.stroke = executeOnSingleOrMultiple(strokeToLoad, (t) => {
|
|
68
63
|
const tmp = new Stroke();
|
|
69
64
|
tmp.load(t);
|
|
70
65
|
return tmp;
|
|
71
66
|
});
|
|
72
67
|
}
|
|
73
68
|
if (this._container) {
|
|
74
|
-
const updaters = this._engine.
|
|
69
|
+
const updaters = this._engine.updaters.get(this._container);
|
|
75
70
|
if (updaters) {
|
|
76
71
|
for (const updater of updaters) {
|
|
77
72
|
if (updater.loadOptions) {
|
|
@@ -79,7 +74,7 @@ export class ParticlesOptions {
|
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
}
|
|
82
|
-
const interactors = this._engine.
|
|
77
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
83
78
|
if (interactors) {
|
|
84
79
|
for (const interactor of interactors) {
|
|
85
80
|
if (interactor.loadParticlesOptions) {
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { deepExtend } from "../../../../Utils/Utils";
|
|
2
2
|
export class Shape {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.options = {};
|
|
5
|
-
this.type = "circle";
|
|
6
4
|
this.close = true;
|
|
7
5
|
this.fill = true;
|
|
6
|
+
this.options = {};
|
|
7
|
+
this.type = "circle";
|
|
8
8
|
}
|
|
9
9
|
load(data) {
|
|
10
|
-
var _a;
|
|
11
10
|
if (!data) {
|
|
12
11
|
return;
|
|
13
12
|
}
|
|
14
|
-
if (data.close !== undefined) {
|
|
15
|
-
this.close = data.close;
|
|
16
|
-
}
|
|
17
|
-
if (data.fill !== undefined) {
|
|
18
|
-
this.fill = data.fill;
|
|
19
|
-
}
|
|
20
13
|
const options = data.options;
|
|
21
14
|
if (options !== undefined) {
|
|
22
15
|
for (const shape in options) {
|
|
23
16
|
const item = options[shape];
|
|
24
17
|
if (item) {
|
|
25
|
-
this.options[shape] = deepExtend(
|
|
18
|
+
this.options[shape] = deepExtend(this.options[shape] ?? {}, item);
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
}
|
|
22
|
+
if (data.close !== undefined) {
|
|
23
|
+
this.close = data.close;
|
|
24
|
+
}
|
|
25
|
+
if (data.fill !== undefined) {
|
|
26
|
+
this.fill = data.fill;
|
|
27
|
+
}
|
|
29
28
|
if (data.type !== undefined) {
|
|
30
29
|
this.type = data.type;
|
|
31
30
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { RangedAnimationValueWithRandom } from "../../ValueWithRandom";
|
|
2
1
|
import { SizeAnimation } from "./SizeAnimation";
|
|
3
|
-
|
|
2
|
+
import { ValueWithRandom } from "../../ValueWithRandom";
|
|
3
|
+
export class Size extends ValueWithRandom {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
6
6
|
this.animation = new SizeAnimation();
|
|
7
7
|
this.random.minimumValue = 1;
|
|
8
8
|
this.value = 3;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
load(data) {
|
|
11
|
+
super.load(data);
|
|
12
|
+
if (!data) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const animation = data.animation;
|
|
16
|
+
if (animation !== undefined) {
|
|
17
|
+
this.animation.load(animation);
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
}
|
|
@@ -5,16 +5,7 @@ export class SizeAnimation extends RangedAnimationOptions {
|
|
|
5
5
|
this.destroy = "none";
|
|
6
6
|
this.speed = 5;
|
|
7
7
|
}
|
|
8
|
-
get size_min() {
|
|
9
|
-
return this.minimumValue;
|
|
10
|
-
}
|
|
11
|
-
set size_min(value) {
|
|
12
|
-
this.minimumValue = value;
|
|
13
|
-
}
|
|
14
8
|
load(data) {
|
|
15
|
-
if ((data === null || data === void 0 ? void 0 : data.size_min) !== undefined && data.minimumValue === undefined) {
|
|
16
|
-
data.minimumValue = data.size_min;
|
|
17
|
-
}
|
|
18
9
|
super.load(data);
|
|
19
10
|
if (!data) {
|
|
20
11
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnimationOptions } from "./AnimationOptions";
|
|
1
|
+
import { AnimationOptions, RangedAnimationOptions } from "./AnimationOptions";
|
|
2
2
|
import { Random } from "./Random";
|
|
3
|
-
import {
|
|
3
|
+
import { isBoolean } from "../../Utils/Utils";
|
|
4
4
|
import { setRangeValue } from "../../Utils/NumberUtils";
|
|
5
5
|
export class ValueWithRandom {
|
|
6
6
|
constructor() {
|
|
@@ -11,7 +11,7 @@ export class ValueWithRandom {
|
|
|
11
11
|
if (!data) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
if (
|
|
14
|
+
if (isBoolean(data.random)) {
|
|
15
15
|
this.random.enable = data.random;
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
@@ -27,19 +27,12 @@ export class AnimationValueWithRandom extends ValueWithRandom {
|
|
|
27
27
|
super();
|
|
28
28
|
this.animation = new AnimationOptions();
|
|
29
29
|
}
|
|
30
|
-
get anim() {
|
|
31
|
-
return this.animation;
|
|
32
|
-
}
|
|
33
|
-
set anim(value) {
|
|
34
|
-
this.animation = value;
|
|
35
|
-
}
|
|
36
30
|
load(data) {
|
|
37
|
-
var _a;
|
|
38
31
|
super.load(data);
|
|
39
32
|
if (!data) {
|
|
40
33
|
return;
|
|
41
34
|
}
|
|
42
|
-
const animation =
|
|
35
|
+
const animation = data.animation;
|
|
43
36
|
if (animation !== undefined) {
|
|
44
37
|
this.animation.load(animation);
|
|
45
38
|
}
|
|
@@ -52,11 +45,5 @@ export class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
|
52
45
|
}
|
|
53
46
|
load(data) {
|
|
54
47
|
super.load(data);
|
|
55
|
-
if (!data) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (data.animation !== undefined) {
|
|
59
|
-
this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
|
|
60
|
-
}
|
|
61
48
|
}
|
|
62
49
|
}
|
|
@@ -1,51 +1,4 @@
|
|
|
1
1
|
import { getStyleFromRgb } from "./ColorUtils";
|
|
2
|
-
function paintBase(context, dimension, baseColor) {
|
|
3
|
-
context.fillStyle = baseColor !== null && baseColor !== void 0 ? baseColor : "rgba(0,0,0,0)";
|
|
4
|
-
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
5
|
-
}
|
|
6
|
-
function paintImage(context, dimension, image, opacity) {
|
|
7
|
-
if (!image) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
context.globalAlpha = opacity;
|
|
11
|
-
context.drawImage(image, 0, 0, dimension.width, dimension.height);
|
|
12
|
-
context.globalAlpha = 1;
|
|
13
|
-
}
|
|
14
|
-
export function getContext(canvas) {
|
|
15
|
-
const context = canvas.getContext("2d");
|
|
16
|
-
if (!context) {
|
|
17
|
-
throw new Error("Error tsParticles - No canvas context found");
|
|
18
|
-
}
|
|
19
|
-
return context;
|
|
20
|
-
}
|
|
21
|
-
export function clearCanvas(context, size, options, trailFill, coverColorStyle) {
|
|
22
|
-
if (options.backgroundMask.enable) {
|
|
23
|
-
paintCanvas(context, size, options, coverColorStyle);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const trail = options.particles.move.trail;
|
|
27
|
-
if (trail.enable && trail.length > 0 && trailFill) {
|
|
28
|
-
if (trailFill.color) {
|
|
29
|
-
paintBase(context, size, getStyleFromRgb(trailFill.color, trailFill.opacity));
|
|
30
|
-
}
|
|
31
|
-
else if (trailFill.image) {
|
|
32
|
-
paintImage(context, size, trailFill.image, trailFill.opacity);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
clear(context, size);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export function paintCanvas(context, size, options, coverColorStyle) {
|
|
41
|
-
if (options.backgroundMask.enable && coverColorStyle) {
|
|
42
|
-
clear(context, size);
|
|
43
|
-
paintBase(context, size, coverColorStyle);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
paintBase(context, size);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
2
|
export function drawLine(context, begin, end) {
|
|
50
3
|
context.beginPath();
|
|
51
4
|
context.moveTo(begin.x, begin.y);
|
|
@@ -59,20 +12,31 @@ export function drawTriangle(context, p1, p2, p3) {
|
|
|
59
12
|
context.lineTo(p3.x, p3.y);
|
|
60
13
|
context.closePath();
|
|
61
14
|
}
|
|
15
|
+
export function paintBase(context, dimension, baseColor) {
|
|
16
|
+
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
17
|
+
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
18
|
+
}
|
|
19
|
+
export function paintImage(context, dimension, image, opacity) {
|
|
20
|
+
if (!image) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
context.globalAlpha = opacity;
|
|
24
|
+
context.drawImage(image, 0, 0, dimension.width, dimension.height);
|
|
25
|
+
context.globalAlpha = 1;
|
|
26
|
+
}
|
|
62
27
|
export function clear(context, dimension) {
|
|
63
28
|
context.clearRect(0, 0, dimension.width, dimension.height);
|
|
64
29
|
}
|
|
65
30
|
export function drawParticle(data) {
|
|
66
|
-
var _a, _b, _c, _d, _e;
|
|
67
31
|
const { container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow, transform, } = data;
|
|
68
32
|
const pos = particle.getPosition(), angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : 0), rotateData = {
|
|
69
33
|
sin: Math.sin(angle),
|
|
70
34
|
cos: Math.cos(angle),
|
|
71
35
|
}, transformData = {
|
|
72
|
-
a: rotateData.cos * (
|
|
73
|
-
b: rotateData.sin * (
|
|
74
|
-
c: -rotateData.sin * (
|
|
75
|
-
d: rotateData.cos * (
|
|
36
|
+
a: rotateData.cos * (transform.a ?? 1),
|
|
37
|
+
b: rotateData.sin * (transform.b ?? 1),
|
|
38
|
+
c: -rotateData.sin * (transform.c ?? 1),
|
|
39
|
+
d: rotateData.cos * (transform.d ?? 1),
|
|
76
40
|
};
|
|
77
41
|
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
78
42
|
context.beginPath();
|
|
@@ -89,7 +53,7 @@ export function drawParticle(data) {
|
|
|
89
53
|
if (colorStyles.fill) {
|
|
90
54
|
context.fillStyle = colorStyles.fill;
|
|
91
55
|
}
|
|
92
|
-
const strokeWidth =
|
|
56
|
+
const strokeWidth = particle.strokeWidth ?? 0;
|
|
93
57
|
context.lineWidth = strokeWidth;
|
|
94
58
|
if (colorStyles.stroke) {
|
|
95
59
|
context.strokeStyle = colorStyles.stroke;
|
|
@@ -123,7 +87,7 @@ export function drawShapeAfterEffect(container, context, particle, radius, opaci
|
|
|
123
87
|
return;
|
|
124
88
|
}
|
|
125
89
|
const drawer = container.drawers.get(particle.shape);
|
|
126
|
-
if (!
|
|
90
|
+
if (!drawer || !drawer.afterEffect) {
|
|
127
91
|
return;
|
|
128
92
|
}
|
|
129
93
|
drawer.afterEffect(context, particle, radius, opacity, delta, container.retina.pixelRatio);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRandom, getRangeValue, mix, randomInRange, setRangeValue } from "./NumberUtils";
|
|
2
|
-
import { itemFromArray } from "./Utils";
|
|
2
|
+
import { isArray, isString, itemFromArray } from "./Utils";
|
|
3
3
|
const randomColorValue = "random", midColorValue = "mid", colorManagers = new Map();
|
|
4
4
|
export function addColorManager(manager) {
|
|
5
5
|
colorManagers.set(manager.key, manager);
|
|
@@ -44,11 +44,11 @@ export function rangeColorToRgb(input, index, useIndex = true) {
|
|
|
44
44
|
if (!input) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const color =
|
|
48
|
-
if (
|
|
47
|
+
const color = isString(input) ? { value: input } : input;
|
|
48
|
+
if (isString(color.value)) {
|
|
49
49
|
return colorToRgb(color.value, index, useIndex);
|
|
50
50
|
}
|
|
51
|
-
if (color.value
|
|
51
|
+
if (isArray(color.value)) {
|
|
52
52
|
return rangeColorToRgb({
|
|
53
53
|
value: itemFromArray(color.value, index, useIndex),
|
|
54
54
|
});
|
|
@@ -64,11 +64,11 @@ export function colorToRgb(input, index, useIndex = true) {
|
|
|
64
64
|
if (!input) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const color =
|
|
68
|
-
if (
|
|
67
|
+
const color = isString(input) ? { value: input } : input;
|
|
68
|
+
if (isString(color.value)) {
|
|
69
69
|
return color.value === randomColorValue ? getRandomRgbColor() : stringToRgb(color.value);
|
|
70
70
|
}
|
|
71
|
-
if (color.value
|
|
71
|
+
if (isArray(color.value)) {
|
|
72
72
|
return colorToRgb({
|
|
73
73
|
value: itemFromArray(color.value, index, useIndex),
|
|
74
74
|
});
|
|
@@ -113,8 +113,7 @@ export function rgbToHsl(color) {
|
|
|
113
113
|
return res;
|
|
114
114
|
}
|
|
115
115
|
export function stringToAlpha(input) {
|
|
116
|
-
|
|
117
|
-
return (_a = stringToRgba(input)) === null || _a === void 0 ? void 0 : _a.a;
|
|
116
|
+
return stringToRgba(input)?.a;
|
|
118
117
|
}
|
|
119
118
|
export function stringToRgb(input) {
|
|
120
119
|
return stringToRgba(input);
|
|
@@ -126,9 +125,7 @@ export function hslToRgb(hsl) {
|
|
|
126
125
|
s: hsl.s / 100,
|
|
127
126
|
};
|
|
128
127
|
if (!hslPercent.s) {
|
|
129
|
-
result.b = hslPercent.l;
|
|
130
|
-
result.g = hslPercent.l;
|
|
131
|
-
result.r = hslPercent.l;
|
|
128
|
+
result.r = result.g = result.b = hslPercent.l;
|
|
132
129
|
}
|
|
133
130
|
else {
|
|
134
131
|
const q = hslPercent.l < 0.5
|
|
@@ -153,7 +150,7 @@ export function hslaToRgba(hsla) {
|
|
|
153
150
|
};
|
|
154
151
|
}
|
|
155
152
|
export function getRandomRgbColor(min) {
|
|
156
|
-
const fixedMin = min
|
|
153
|
+
const fixedMin = min ?? 0;
|
|
157
154
|
return {
|
|
158
155
|
b: Math.floor(randomInRange(setRangeValue(fixedMin, 256))),
|
|
159
156
|
g: Math.floor(randomInRange(setRangeValue(fixedMin, 256))),
|
|
@@ -161,10 +158,10 @@ export function getRandomRgbColor(min) {
|
|
|
161
158
|
};
|
|
162
159
|
}
|
|
163
160
|
export function getStyleFromRgb(color, opacity) {
|
|
164
|
-
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity
|
|
161
|
+
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity ?? 1})`;
|
|
165
162
|
}
|
|
166
163
|
export function getStyleFromHsl(color, opacity) {
|
|
167
|
-
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity
|
|
164
|
+
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity ?? 1})`;
|
|
168
165
|
}
|
|
169
166
|
export function colorMix(color1, color2, size1, size2) {
|
|
170
167
|
let rgb1 = color1, rgb2 = color2;
|
|
@@ -181,17 +178,16 @@ export function colorMix(color1, color2, size1, size2) {
|
|
|
181
178
|
};
|
|
182
179
|
}
|
|
183
180
|
export function getLinkColor(p1, p2, linkColor) {
|
|
184
|
-
var _a, _b;
|
|
185
181
|
if (linkColor === randomColorValue) {
|
|
186
182
|
return getRandomRgbColor();
|
|
187
183
|
}
|
|
188
184
|
else if (linkColor === midColorValue) {
|
|
189
|
-
const sourceColor =
|
|
185
|
+
const sourceColor = p1.getFillColor() ?? p1.getStrokeColor(), destColor = p2?.getFillColor() ?? p2?.getStrokeColor();
|
|
190
186
|
if (sourceColor && destColor && p2) {
|
|
191
187
|
return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
|
|
192
188
|
}
|
|
193
189
|
else {
|
|
194
|
-
const hslColor = sourceColor
|
|
190
|
+
const hslColor = sourceColor ?? destColor;
|
|
195
191
|
if (hslColor) {
|
|
196
192
|
return hslToRgb(hslColor);
|
|
197
193
|
}
|
|
@@ -202,7 +198,7 @@ export function getLinkColor(p1, p2, linkColor) {
|
|
|
202
198
|
}
|
|
203
199
|
}
|
|
204
200
|
export function getLinkRandomColor(optColor, blink, consent) {
|
|
205
|
-
const color =
|
|
201
|
+
const color = isString(optColor) ? optColor : optColor.value;
|
|
206
202
|
if (color === randomColorValue) {
|
|
207
203
|
if (consent) {
|
|
208
204
|
return rangeColorToRgb({
|
|
@@ -262,6 +258,8 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
|
262
258
|
colorValue.status = "increasing";
|
|
263
259
|
colorValue.loops = 0;
|
|
264
260
|
colorValue.maxLoops = getRangeValue(colorAnimation.count);
|
|
261
|
+
colorValue.time = 0;
|
|
262
|
+
colorValue.delayTime = getRangeValue(colorAnimation.delay) * 1000;
|
|
265
263
|
if (!colorAnimation.sync) {
|
|
266
264
|
colorValue.velocity *= getRandom();
|
|
267
265
|
colorValue.value *= getRandom();
|
|
@@ -3,16 +3,17 @@ export class EventDispatcher {
|
|
|
3
3
|
this._listeners = new Map();
|
|
4
4
|
}
|
|
5
5
|
addEventListener(type, listener) {
|
|
6
|
-
var _a;
|
|
7
6
|
this.removeEventListener(type, listener);
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
let arr = this._listeners.get(type);
|
|
8
|
+
if (!arr) {
|
|
9
|
+
arr = [];
|
|
10
|
+
this._listeners.set(type, arr);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
arr.push(listener);
|
|
12
13
|
}
|
|
13
14
|
dispatchEvent(type, args) {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const listeners = this._listeners.get(type);
|
|
16
|
+
listeners && listeners.forEach((handler) => handler(args));
|
|
16
17
|
}
|
|
17
18
|
hasEventListener(type) {
|
|
18
19
|
return !!this._listeners.get(type);
|
|
@@ -6,15 +6,13 @@ export class HslColorManager {
|
|
|
6
6
|
this.stringPrefix = "hsl";
|
|
7
7
|
}
|
|
8
8
|
handleColor(color) {
|
|
9
|
-
|
|
10
|
-
const colorValue = color.value, hslColor = (_a = colorValue.hsl) !== null && _a !== void 0 ? _a : color.value;
|
|
9
|
+
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
11
10
|
if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
|
|
12
11
|
return hslToRgb(hslColor);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
handleRangeColor(color) {
|
|
16
|
-
|
|
17
|
-
const colorValue = color.value, hslColor = (_a = colorValue.hsl) !== null && _a !== void 0 ? _a : color.value;
|
|
15
|
+
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
18
16
|
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
19
17
|
return hslToRgb({
|
|
20
18
|
h: getRangeValue(hslColor.h),
|