@tsparticles/engine 3.0.0-alpha.0 → 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 +246 -211
- 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 -162
- package/browser/Core/Particles.js +148 -134
- 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 +259 -220
- 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 +7 -2
- 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 -5
- 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 -2
- 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 +150 -59
- package/browser/bundle.js +4 -96
- package/browser/export-types.js +97 -0
- package/browser/exports.js +89 -0
- package/browser/index.js +8 -198
- 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 -161
- package/cjs/Core/Particles.js +148 -134
- 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 +258 -219
- 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 +7 -2
- 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 -5
- 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 -2
- 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 +163 -63
- package/cjs/bundle.js +4 -96
- package/cjs/export-types.js +113 -0
- package/cjs/exports.js +105 -0
- package/cjs/index.js +8 -198
- 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 -162
- package/esm/Core/Particles.js +148 -134
- 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 +259 -220
- 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 +7 -2
- 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 -5
- 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 -2
- 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 +150 -59
- package/esm/bundle.js +4 -96
- package/esm/export-types.js +97 -0
- package/esm/exports.js +89 -0
- package/esm/index.js +8 -198
- 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 +1848 -1961
- 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 +5 -3
- package/types/Core/Interfaces/IDimension.d.ts +4 -0
- 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 -10
- package/types/Core/Utils/Constants.d.ts +4 -3
- package/types/Core/Utils/EventListeners.d.ts +20 -14
- 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/AnimationMode.d.ts +6 -0
- package/types/Enums/Modes/{SizeMode.d.ts → PixelMode.d.ts} +1 -1
- package/types/Options/Classes/AnimationOptions.d.ts +3 -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/ManualParticle.d.ts +2 -2
- 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/Move/Spin.d.ts +2 -2
- 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/Shape/Shape.d.ts +2 -0
- 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 +3 -1
- package/types/Options/Interfaces/IManualParticle.d.ts +2 -2
- 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/Move/ISpin.d.ts +2 -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/Shape/IShape.d.ts +2 -0
- 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 -90
- package/types/export-types.d.ts +107 -0
- package/types/exports.d.ts +89 -0
- package/types/index.d.ts +3 -203
- 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 -162
- package/umd/Core/Particles.js +149 -135
- 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 +258 -219
- 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 +7 -2
- 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 -5
- 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 -2
- 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 +163 -63
- package/umd/bundle.js +5 -97
- package/umd/export-types.js +123 -0
- package/umd/exports.js +115 -0
- package/umd/index.js +9 -199
- 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/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/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/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/AnimationMode.js} +0 -0
- /package/browser/{Core/Interfaces/IParticlesMover.js → Enums/Modes/PixelMode.js} +0 -0
- /package/browser/{Enums/Modes/SizeMode.js → Types/ExportResult.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticleOverride.js → Enums/Modes/AnimationMode.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticlesMover.js → Enums/Modes/PixelMode.js} +0 -0
- /package/cjs/{Enums/Modes/SizeMode.js → Types/ExportResult.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/ICharacterShape.js → esm/Enums/Modes/AnimationMode.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/IImageShape.js → esm/Enums/Modes/PixelMode.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/IPolygonShape.js → esm/Types/ExportResult.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleOverride.js → Enums/Modes/AnimationMode.js} +0 -0
- /package/umd/{Core/Interfaces/IParticlesMover.js → Enums/Modes/PixelMode.js} +0 -0
- /package/umd/{Enums/Modes/SizeMode.js → Types/ExportResult.js} +0 -0
|
@@ -6,17 +6,16 @@ class OutModes {
|
|
|
6
6
|
this.default = "out";
|
|
7
7
|
}
|
|
8
8
|
load(data) {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
10
9
|
if (!data) {
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
12
|
if (data.default !== undefined) {
|
|
14
13
|
this.default = data.default;
|
|
15
14
|
}
|
|
16
|
-
this.bottom =
|
|
17
|
-
this.left =
|
|
18
|
-
this.right =
|
|
19
|
-
this.top =
|
|
15
|
+
this.bottom = data.bottom ?? data.default;
|
|
16
|
+
this.left = data.left ?? data.default;
|
|
17
|
+
this.right = data.right ?? data.default;
|
|
18
|
+
this.top = data.top ?? data.default;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
exports.OutModes = OutModes;
|
|
@@ -18,7 +18,9 @@ class Spin {
|
|
|
18
18
|
if (data.enable !== undefined) {
|
|
19
19
|
this.enable = data.enable;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
if (data.position) {
|
|
22
|
+
this.position = (0, Utils_1.deepExtend)({}, data.position);
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
exports.Spin = Spin;
|
|
@@ -7,37 +7,18 @@ class ParticlesDensity {
|
|
|
7
7
|
this.width = 1920;
|
|
8
8
|
this.height = 1080;
|
|
9
9
|
}
|
|
10
|
-
get area() {
|
|
11
|
-
return this.width;
|
|
12
|
-
}
|
|
13
|
-
set area(value) {
|
|
14
|
-
this.width = value;
|
|
15
|
-
}
|
|
16
|
-
get factor() {
|
|
17
|
-
return this.height;
|
|
18
|
-
}
|
|
19
|
-
set factor(value) {
|
|
20
|
-
this.height = value;
|
|
21
|
-
}
|
|
22
|
-
get value_area() {
|
|
23
|
-
return this.area;
|
|
24
|
-
}
|
|
25
|
-
set value_area(value) {
|
|
26
|
-
this.area = value;
|
|
27
|
-
}
|
|
28
10
|
load(data) {
|
|
29
|
-
var _a, _b, _c;
|
|
30
11
|
if (!data) {
|
|
31
12
|
return;
|
|
32
13
|
}
|
|
33
14
|
if (data.enable !== undefined) {
|
|
34
15
|
this.enable = data.enable;
|
|
35
16
|
}
|
|
36
|
-
const width =
|
|
17
|
+
const width = data.width;
|
|
37
18
|
if (width !== undefined) {
|
|
38
19
|
this.width = width;
|
|
39
20
|
}
|
|
40
|
-
const height =
|
|
21
|
+
const height = data.height;
|
|
41
22
|
if (height !== undefined) {
|
|
42
23
|
this.height = height;
|
|
43
24
|
}
|
|
@@ -6,21 +6,14 @@ class ParticlesNumber {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.density = new ParticlesDensity_1.ParticlesDensity();
|
|
8
8
|
this.limit = 0;
|
|
9
|
-
this.value =
|
|
10
|
-
}
|
|
11
|
-
get max() {
|
|
12
|
-
return this.limit;
|
|
13
|
-
}
|
|
14
|
-
set max(value) {
|
|
15
|
-
this.limit = value;
|
|
9
|
+
this.value = 0;
|
|
16
10
|
}
|
|
17
11
|
load(data) {
|
|
18
|
-
var _a;
|
|
19
12
|
if (!data) {
|
|
20
13
|
return;
|
|
21
14
|
}
|
|
22
15
|
this.density.load(data.density);
|
|
23
|
-
const limit =
|
|
16
|
+
const limit = data.limit;
|
|
24
17
|
if (limit !== undefined) {
|
|
25
18
|
this.limit = limit;
|
|
26
19
|
}
|
|
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Opacity = void 0;
|
|
4
4
|
const OpacityAnimation_1 = require("./OpacityAnimation");
|
|
5
5
|
const ValueWithRandom_1 = require("../../ValueWithRandom");
|
|
6
|
-
class Opacity extends ValueWithRandom_1.
|
|
6
|
+
class Opacity extends ValueWithRandom_1.ValueWithRandom {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
9
|
this.animation = new OpacityAnimation_1.OpacityAnimation();
|
|
10
10
|
this.random.minimumValue = 0.1;
|
|
11
11
|
this.value = 1;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
load(data) {
|
|
14
|
+
if (!data) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
super.load(data);
|
|
18
|
+
const animation = data.animation;
|
|
19
|
+
if (animation !== undefined) {
|
|
20
|
+
this.animation.load(animation);
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
exports.Opacity = Opacity;
|
|
@@ -8,16 +8,7 @@ class OpacityAnimation extends AnimationOptions_1.RangedAnimationOptions {
|
|
|
8
8
|
this.destroy = "none";
|
|
9
9
|
this.speed = 2;
|
|
10
10
|
}
|
|
11
|
-
get opacity_min() {
|
|
12
|
-
return this.minimumValue;
|
|
13
|
-
}
|
|
14
|
-
set opacity_min(value) {
|
|
15
|
-
this.minimumValue = value;
|
|
16
|
-
}
|
|
17
11
|
load(data) {
|
|
18
|
-
if ((data === null || data === void 0 ? void 0 : data.opacity_min) !== undefined && data.minimumValue === undefined) {
|
|
19
|
-
data.minimumValue = data.opacity_min;
|
|
20
|
-
}
|
|
21
12
|
super.load(data);
|
|
22
13
|
if (!data) {
|
|
23
14
|
return;
|
|
@@ -33,7 +33,6 @@ class ParticlesOptions {
|
|
|
33
33
|
this.zIndex = new ZIndex_1.ZIndex();
|
|
34
34
|
}
|
|
35
35
|
load(data) {
|
|
36
|
-
var _a, _b, _c, _d;
|
|
37
36
|
if (!data) {
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
@@ -43,7 +42,7 @@ class ParticlesOptions {
|
|
|
43
42
|
for (const group in data.groups) {
|
|
44
43
|
const item = data.groups[group];
|
|
45
44
|
if (item !== undefined) {
|
|
46
|
-
this.groups[group] = (0, Utils_1.deepExtend)(
|
|
45
|
+
this.groups[group] = (0, Utils_1.deepExtend)(this.groups[group] ?? {}, item);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -57,24 +56,20 @@ class ParticlesOptions {
|
|
|
57
56
|
this.size.load(data.size);
|
|
58
57
|
this.shadow.load(data.shadow);
|
|
59
58
|
this.zIndex.load(data.zIndex);
|
|
60
|
-
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;
|
|
61
|
-
if (collisions !== undefined) {
|
|
62
|
-
this.collisions.enable = collisions;
|
|
63
|
-
}
|
|
64
59
|
this.collisions.load(data.collisions);
|
|
65
60
|
if (data.interactivity !== undefined) {
|
|
66
61
|
this.interactivity = (0, Utils_1.deepExtend)({}, data.interactivity);
|
|
67
62
|
}
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
this.stroke = (0, Utils_1.executeOnSingleOrMultiple)(
|
|
63
|
+
const strokeToLoad = data.stroke;
|
|
64
|
+
if (strokeToLoad) {
|
|
65
|
+
this.stroke = (0, Utils_1.executeOnSingleOrMultiple)(strokeToLoad, (t) => {
|
|
71
66
|
const tmp = new Stroke_1.Stroke();
|
|
72
67
|
tmp.load(t);
|
|
73
68
|
return tmp;
|
|
74
69
|
});
|
|
75
70
|
}
|
|
76
71
|
if (this._container) {
|
|
77
|
-
const updaters = this._engine.
|
|
72
|
+
const updaters = this._engine.updaters.get(this._container);
|
|
78
73
|
if (updaters) {
|
|
79
74
|
for (const updater of updaters) {
|
|
80
75
|
if (updater.loadOptions) {
|
|
@@ -82,7 +77,7 @@ class ParticlesOptions {
|
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
79
|
}
|
|
85
|
-
const interactors = this._engine.
|
|
80
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
86
81
|
if (interactors) {
|
|
87
82
|
for (const interactor of interactors) {
|
|
88
83
|
if (interactor.loadParticlesOptions) {
|
|
@@ -4,11 +4,12 @@ exports.Shape = void 0;
|
|
|
4
4
|
const Utils_1 = require("../../../../Utils/Utils");
|
|
5
5
|
class Shape {
|
|
6
6
|
constructor() {
|
|
7
|
+
this.close = true;
|
|
8
|
+
this.fill = true;
|
|
7
9
|
this.options = {};
|
|
8
10
|
this.type = "circle";
|
|
9
11
|
}
|
|
10
12
|
load(data) {
|
|
11
|
-
var _a;
|
|
12
13
|
if (!data) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
@@ -17,10 +18,16 @@ class Shape {
|
|
|
17
18
|
for (const shape in options) {
|
|
18
19
|
const item = options[shape];
|
|
19
20
|
if (item) {
|
|
20
|
-
this.options[shape] = (0, Utils_1.deepExtend)(
|
|
21
|
+
this.options[shape] = (0, Utils_1.deepExtend)(this.options[shape] ?? {}, item);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
if (data.close !== undefined) {
|
|
26
|
+
this.close = data.close;
|
|
27
|
+
}
|
|
28
|
+
if (data.fill !== undefined) {
|
|
29
|
+
this.fill = data.fill;
|
|
30
|
+
}
|
|
24
31
|
if (data.type !== undefined) {
|
|
25
32
|
this.type = data.type;
|
|
26
33
|
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Size = void 0;
|
|
4
|
-
const ValueWithRandom_1 = require("../../ValueWithRandom");
|
|
5
4
|
const SizeAnimation_1 = require("./SizeAnimation");
|
|
6
|
-
|
|
5
|
+
const ValueWithRandom_1 = require("../../ValueWithRandom");
|
|
6
|
+
class Size extends ValueWithRandom_1.ValueWithRandom {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
9
|
this.animation = new SizeAnimation_1.SizeAnimation();
|
|
10
10
|
this.random.minimumValue = 1;
|
|
11
11
|
this.value = 3;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
load(data) {
|
|
14
|
+
super.load(data);
|
|
15
|
+
if (!data) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const animation = data.animation;
|
|
19
|
+
if (animation !== undefined) {
|
|
20
|
+
this.animation.load(animation);
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
exports.Size = Size;
|
|
@@ -8,16 +8,7 @@ class SizeAnimation extends AnimationOptions_1.RangedAnimationOptions {
|
|
|
8
8
|
this.destroy = "none";
|
|
9
9
|
this.speed = 5;
|
|
10
10
|
}
|
|
11
|
-
get size_min() {
|
|
12
|
-
return this.minimumValue;
|
|
13
|
-
}
|
|
14
|
-
set size_min(value) {
|
|
15
|
-
this.minimumValue = value;
|
|
16
|
-
}
|
|
17
11
|
load(data) {
|
|
18
|
-
if ((data === null || data === void 0 ? void 0 : data.size_min) !== undefined && data.minimumValue === undefined) {
|
|
19
|
-
data.minimumValue = data.size_min;
|
|
20
|
-
}
|
|
21
12
|
super.load(data);
|
|
22
13
|
if (!data) {
|
|
23
14
|
return;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RangedAnimationValueWithRandom = exports.AnimationValueWithRandom = exports.ValueWithRandom = void 0;
|
|
4
4
|
const AnimationOptions_1 = require("./AnimationOptions");
|
|
5
5
|
const Random_1 = require("./Random");
|
|
6
|
-
const
|
|
6
|
+
const Utils_1 = require("../../Utils/Utils");
|
|
7
7
|
const NumberUtils_1 = require("../../Utils/NumberUtils");
|
|
8
8
|
class ValueWithRandom {
|
|
9
9
|
constructor() {
|
|
@@ -14,7 +14,7 @@ class ValueWithRandom {
|
|
|
14
14
|
if (!data) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
17
|
+
if ((0, Utils_1.isBoolean)(data.random)) {
|
|
18
18
|
this.random.enable = data.random;
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
@@ -31,19 +31,12 @@ class AnimationValueWithRandom extends ValueWithRandom {
|
|
|
31
31
|
super();
|
|
32
32
|
this.animation = new AnimationOptions_1.AnimationOptions();
|
|
33
33
|
}
|
|
34
|
-
get anim() {
|
|
35
|
-
return this.animation;
|
|
36
|
-
}
|
|
37
|
-
set anim(value) {
|
|
38
|
-
this.animation = value;
|
|
39
|
-
}
|
|
40
34
|
load(data) {
|
|
41
|
-
var _a;
|
|
42
35
|
super.load(data);
|
|
43
36
|
if (!data) {
|
|
44
37
|
return;
|
|
45
38
|
}
|
|
46
|
-
const animation =
|
|
39
|
+
const animation = data.animation;
|
|
47
40
|
if (animation !== undefined) {
|
|
48
41
|
this.animation.load(animation);
|
|
49
42
|
}
|
|
@@ -53,16 +46,10 @@ exports.AnimationValueWithRandom = AnimationValueWithRandom;
|
|
|
53
46
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
54
47
|
constructor() {
|
|
55
48
|
super();
|
|
56
|
-
this.animation = new
|
|
49
|
+
this.animation = new AnimationOptions_1.RangedAnimationOptions();
|
|
57
50
|
}
|
|
58
51
|
load(data) {
|
|
59
52
|
super.load(data);
|
|
60
|
-
if (!data) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (data.animation !== undefined) {
|
|
64
|
-
this.value = (0, NumberUtils_1.setRangeValue)(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
|
|
65
|
-
}
|
|
66
53
|
}
|
|
67
54
|
}
|
|
68
55
|
exports.RangedAnimationValueWithRandom = RangedAnimationValueWithRandom;
|
package/cjs/Utils/CanvasUtils.js
CHANGED
|
@@ -1,57 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alterHsl = exports.drawParticlePlugin = exports.drawPlugin = exports.drawShapeAfterEffect = exports.drawShape = exports.drawParticle = exports.clear = exports.
|
|
3
|
+
exports.alterHsl = exports.drawParticlePlugin = exports.drawPlugin = exports.drawShapeAfterEffect = exports.drawShape = exports.drawParticle = exports.clear = exports.paintImage = exports.paintBase = exports.drawTriangle = exports.drawLine = void 0;
|
|
4
4
|
const ColorUtils_1 = require("./ColorUtils");
|
|
5
|
-
function paintBase(context, dimension, baseColor) {
|
|
6
|
-
context.fillStyle = baseColor !== null && baseColor !== void 0 ? baseColor : "rgba(0,0,0,0)";
|
|
7
|
-
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
8
|
-
}
|
|
9
|
-
function paintImage(context, dimension, image, opacity) {
|
|
10
|
-
if (!image) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
context.globalAlpha = opacity;
|
|
14
|
-
context.drawImage(image, 0, 0, dimension.width, dimension.height);
|
|
15
|
-
context.globalAlpha = 1;
|
|
16
|
-
}
|
|
17
|
-
function getContext(canvas) {
|
|
18
|
-
const context = canvas.getContext("2d");
|
|
19
|
-
if (!context) {
|
|
20
|
-
throw new Error("Error tsParticles - No canvas context found");
|
|
21
|
-
}
|
|
22
|
-
return context;
|
|
23
|
-
}
|
|
24
|
-
exports.getContext = getContext;
|
|
25
|
-
function clearCanvas(context, size, options, trailFill, coverColorStyle) {
|
|
26
|
-
if (options.backgroundMask.enable) {
|
|
27
|
-
paintCanvas(context, size, options, coverColorStyle);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const trail = options.particles.move.trail;
|
|
31
|
-
if (trail.enable && trail.length > 0 && trailFill) {
|
|
32
|
-
if (trailFill.color) {
|
|
33
|
-
paintBase(context, size, (0, ColorUtils_1.getStyleFromRgb)(trailFill.color, trailFill.opacity));
|
|
34
|
-
}
|
|
35
|
-
else if (trailFill.image) {
|
|
36
|
-
paintImage(context, size, trailFill.image, trailFill.opacity);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
clear(context, size);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.clearCanvas = clearCanvas;
|
|
45
|
-
function paintCanvas(context, size, options, coverColorStyle) {
|
|
46
|
-
if (options.backgroundMask.enable && coverColorStyle) {
|
|
47
|
-
clear(context, size);
|
|
48
|
-
paintBase(context, size, coverColorStyle);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
paintBase(context, size);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.paintCanvas = paintCanvas;
|
|
55
5
|
function drawLine(context, begin, end) {
|
|
56
6
|
context.beginPath();
|
|
57
7
|
context.moveTo(begin.x, begin.y);
|
|
@@ -67,21 +17,34 @@ function drawTriangle(context, p1, p2, p3) {
|
|
|
67
17
|
context.closePath();
|
|
68
18
|
}
|
|
69
19
|
exports.drawTriangle = drawTriangle;
|
|
20
|
+
function paintBase(context, dimension, baseColor) {
|
|
21
|
+
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
22
|
+
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
23
|
+
}
|
|
24
|
+
exports.paintBase = paintBase;
|
|
25
|
+
function paintImage(context, dimension, image, opacity) {
|
|
26
|
+
if (!image) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
context.globalAlpha = opacity;
|
|
30
|
+
context.drawImage(image, 0, 0, dimension.width, dimension.height);
|
|
31
|
+
context.globalAlpha = 1;
|
|
32
|
+
}
|
|
33
|
+
exports.paintImage = paintImage;
|
|
70
34
|
function clear(context, dimension) {
|
|
71
35
|
context.clearRect(0, 0, dimension.width, dimension.height);
|
|
72
36
|
}
|
|
73
37
|
exports.clear = clear;
|
|
74
38
|
function drawParticle(data) {
|
|
75
|
-
var _a, _b, _c, _d, _e;
|
|
76
39
|
const { container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow, transform, } = data;
|
|
77
40
|
const pos = particle.getPosition(), angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : 0), rotateData = {
|
|
78
41
|
sin: Math.sin(angle),
|
|
79
42
|
cos: Math.cos(angle),
|
|
80
43
|
}, transformData = {
|
|
81
|
-
a: rotateData.cos * (
|
|
82
|
-
b: rotateData.sin * (
|
|
83
|
-
c: -rotateData.sin * (
|
|
84
|
-
d: rotateData.cos * (
|
|
44
|
+
a: rotateData.cos * (transform.a ?? 1),
|
|
45
|
+
b: rotateData.sin * (transform.b ?? 1),
|
|
46
|
+
c: -rotateData.sin * (transform.c ?? 1),
|
|
47
|
+
d: rotateData.cos * (transform.d ?? 1),
|
|
85
48
|
};
|
|
86
49
|
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
87
50
|
context.beginPath();
|
|
@@ -98,7 +61,7 @@ function drawParticle(data) {
|
|
|
98
61
|
if (colorStyles.fill) {
|
|
99
62
|
context.fillStyle = colorStyles.fill;
|
|
100
63
|
}
|
|
101
|
-
const strokeWidth =
|
|
64
|
+
const strokeWidth = particle.strokeWidth ?? 0;
|
|
102
65
|
context.lineWidth = strokeWidth;
|
|
103
66
|
if (colorStyles.stroke) {
|
|
104
67
|
context.strokeStyle = colorStyles.stroke;
|
|
@@ -134,7 +97,7 @@ function drawShapeAfterEffect(container, context, particle, radius, opacity, del
|
|
|
134
97
|
return;
|
|
135
98
|
}
|
|
136
99
|
const drawer = container.drawers.get(particle.shape);
|
|
137
|
-
if (!
|
|
100
|
+
if (!drawer || !drawer.afterEffect) {
|
|
138
101
|
return;
|
|
139
102
|
}
|
|
140
103
|
drawer.afterEffect(context, particle, radius, opacity, delta, container.retina.pixelRatio);
|
package/cjs/Utils/ColorUtils.js
CHANGED
|
@@ -48,11 +48,11 @@ function rangeColorToRgb(input, index, useIndex = true) {
|
|
|
48
48
|
if (!input) {
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
const color =
|
|
52
|
-
if (
|
|
51
|
+
const color = (0, Utils_1.isString)(input) ? { value: input } : input;
|
|
52
|
+
if ((0, Utils_1.isString)(color.value)) {
|
|
53
53
|
return colorToRgb(color.value, index, useIndex);
|
|
54
54
|
}
|
|
55
|
-
if (color.value
|
|
55
|
+
if ((0, Utils_1.isArray)(color.value)) {
|
|
56
56
|
return rangeColorToRgb({
|
|
57
57
|
value: (0, Utils_1.itemFromArray)(color.value, index, useIndex),
|
|
58
58
|
});
|
|
@@ -69,11 +69,11 @@ function colorToRgb(input, index, useIndex = true) {
|
|
|
69
69
|
if (!input) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
const color =
|
|
73
|
-
if (
|
|
72
|
+
const color = (0, Utils_1.isString)(input) ? { value: input } : input;
|
|
73
|
+
if ((0, Utils_1.isString)(color.value)) {
|
|
74
74
|
return color.value === randomColorValue ? getRandomRgbColor() : stringToRgb(color.value);
|
|
75
75
|
}
|
|
76
|
-
if (color.value
|
|
76
|
+
if ((0, Utils_1.isArray)(color.value)) {
|
|
77
77
|
return colorToRgb({
|
|
78
78
|
value: (0, Utils_1.itemFromArray)(color.value, index, useIndex),
|
|
79
79
|
});
|
|
@@ -122,8 +122,7 @@ function rgbToHsl(color) {
|
|
|
122
122
|
}
|
|
123
123
|
exports.rgbToHsl = rgbToHsl;
|
|
124
124
|
function stringToAlpha(input) {
|
|
125
|
-
|
|
126
|
-
return (_a = stringToRgba(input)) === null || _a === void 0 ? void 0 : _a.a;
|
|
125
|
+
return stringToRgba(input)?.a;
|
|
127
126
|
}
|
|
128
127
|
exports.stringToAlpha = stringToAlpha;
|
|
129
128
|
function stringToRgb(input) {
|
|
@@ -137,9 +136,7 @@ function hslToRgb(hsl) {
|
|
|
137
136
|
s: hsl.s / 100,
|
|
138
137
|
};
|
|
139
138
|
if (!hslPercent.s) {
|
|
140
|
-
result.b = hslPercent.l;
|
|
141
|
-
result.g = hslPercent.l;
|
|
142
|
-
result.r = hslPercent.l;
|
|
139
|
+
result.r = result.g = result.b = hslPercent.l;
|
|
143
140
|
}
|
|
144
141
|
else {
|
|
145
142
|
const q = hslPercent.l < 0.5
|
|
@@ -166,7 +163,7 @@ function hslaToRgba(hsla) {
|
|
|
166
163
|
}
|
|
167
164
|
exports.hslaToRgba = hslaToRgba;
|
|
168
165
|
function getRandomRgbColor(min) {
|
|
169
|
-
const fixedMin = min
|
|
166
|
+
const fixedMin = min ?? 0;
|
|
170
167
|
return {
|
|
171
168
|
b: Math.floor((0, NumberUtils_1.randomInRange)((0, NumberUtils_1.setRangeValue)(fixedMin, 256))),
|
|
172
169
|
g: Math.floor((0, NumberUtils_1.randomInRange)((0, NumberUtils_1.setRangeValue)(fixedMin, 256))),
|
|
@@ -175,11 +172,11 @@ function getRandomRgbColor(min) {
|
|
|
175
172
|
}
|
|
176
173
|
exports.getRandomRgbColor = getRandomRgbColor;
|
|
177
174
|
function getStyleFromRgb(color, opacity) {
|
|
178
|
-
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity
|
|
175
|
+
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity ?? 1})`;
|
|
179
176
|
}
|
|
180
177
|
exports.getStyleFromRgb = getStyleFromRgb;
|
|
181
178
|
function getStyleFromHsl(color, opacity) {
|
|
182
|
-
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity
|
|
179
|
+
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity ?? 1})`;
|
|
183
180
|
}
|
|
184
181
|
exports.getStyleFromHsl = getStyleFromHsl;
|
|
185
182
|
function colorMix(color1, color2, size1, size2) {
|
|
@@ -198,17 +195,16 @@ function colorMix(color1, color2, size1, size2) {
|
|
|
198
195
|
}
|
|
199
196
|
exports.colorMix = colorMix;
|
|
200
197
|
function getLinkColor(p1, p2, linkColor) {
|
|
201
|
-
var _a, _b;
|
|
202
198
|
if (linkColor === randomColorValue) {
|
|
203
199
|
return getRandomRgbColor();
|
|
204
200
|
}
|
|
205
201
|
else if (linkColor === midColorValue) {
|
|
206
|
-
const sourceColor =
|
|
202
|
+
const sourceColor = p1.getFillColor() ?? p1.getStrokeColor(), destColor = p2?.getFillColor() ?? p2?.getStrokeColor();
|
|
207
203
|
if (sourceColor && destColor && p2) {
|
|
208
204
|
return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
|
|
209
205
|
}
|
|
210
206
|
else {
|
|
211
|
-
const hslColor = sourceColor
|
|
207
|
+
const hslColor = sourceColor ?? destColor;
|
|
212
208
|
if (hslColor) {
|
|
213
209
|
return hslToRgb(hslColor);
|
|
214
210
|
}
|
|
@@ -220,7 +216,7 @@ function getLinkColor(p1, p2, linkColor) {
|
|
|
220
216
|
}
|
|
221
217
|
exports.getLinkColor = getLinkColor;
|
|
222
218
|
function getLinkRandomColor(optColor, blink, consent) {
|
|
223
|
-
const color =
|
|
219
|
+
const color = (0, Utils_1.isString)(optColor) ? optColor : optColor.value;
|
|
224
220
|
if (color === randomColorValue) {
|
|
225
221
|
if (consent) {
|
|
226
222
|
return rangeColorToRgb({
|
|
@@ -283,6 +279,8 @@ function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
|
283
279
|
colorValue.status = "increasing";
|
|
284
280
|
colorValue.loops = 0;
|
|
285
281
|
colorValue.maxLoops = (0, NumberUtils_1.getRangeValue)(colorAnimation.count);
|
|
282
|
+
colorValue.time = 0;
|
|
283
|
+
colorValue.delayTime = (0, NumberUtils_1.getRangeValue)(colorAnimation.delay) * 1000;
|
|
286
284
|
if (!colorAnimation.sync) {
|
|
287
285
|
colorValue.velocity *= (0, NumberUtils_1.getRandom)();
|
|
288
286
|
colorValue.value *= (0, NumberUtils_1.getRandom)();
|
|
@@ -6,16 +6,17 @@ class EventDispatcher {
|
|
|
6
6
|
this._listeners = new Map();
|
|
7
7
|
}
|
|
8
8
|
addEventListener(type, listener) {
|
|
9
|
-
var _a;
|
|
10
9
|
this.removeEventListener(type, listener);
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
let arr = this._listeners.get(type);
|
|
11
|
+
if (!arr) {
|
|
12
|
+
arr = [];
|
|
13
|
+
this._listeners.set(type, arr);
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
arr.push(listener);
|
|
15
16
|
}
|
|
16
17
|
dispatchEvent(type, args) {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const listeners = this._listeners.get(type);
|
|
19
|
+
listeners && listeners.forEach((handler) => handler(args));
|
|
19
20
|
}
|
|
20
21
|
hasEventListener(type) {
|
|
21
22
|
return !!this._listeners.get(type);
|
|
@@ -9,15 +9,13 @@ class HslColorManager {
|
|
|
9
9
|
this.stringPrefix = "hsl";
|
|
10
10
|
}
|
|
11
11
|
handleColor(color) {
|
|
12
|
-
|
|
13
|
-
const colorValue = color.value, hslColor = (_a = colorValue.hsl) !== null && _a !== void 0 ? _a : color.value;
|
|
12
|
+
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
14
13
|
if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
|
|
15
14
|
return (0, ColorUtils_1.hslToRgb)(hslColor);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
handleRangeColor(color) {
|
|
19
|
-
|
|
20
|
-
const colorValue = color.value, hslColor = (_a = colorValue.hsl) !== null && _a !== void 0 ? _a : color.value;
|
|
18
|
+
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
21
19
|
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
22
20
|
return (0, ColorUtils_1.hslToRgb)({
|
|
23
21
|
h: (0, NumberUtils_1.getRangeValue)(hslColor.h),
|