@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
|
@@ -20,20 +20,7 @@
|
|
|
20
20
|
y: 3000,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
get rotateX() {
|
|
24
|
-
return this.rotate.x;
|
|
25
|
-
}
|
|
26
|
-
set rotateX(value) {
|
|
27
|
-
this.rotate.x = value;
|
|
28
|
-
}
|
|
29
|
-
get rotateY() {
|
|
30
|
-
return this.rotate.y;
|
|
31
|
-
}
|
|
32
|
-
set rotateY(value) {
|
|
33
|
-
this.rotate.y = value;
|
|
34
|
-
}
|
|
35
23
|
load(data) {
|
|
36
|
-
var _a, _b, _c, _d;
|
|
37
24
|
if (!data) {
|
|
38
25
|
return;
|
|
39
26
|
}
|
|
@@ -43,13 +30,15 @@
|
|
|
43
30
|
if (data.enable !== undefined) {
|
|
44
31
|
this.enable = data.enable;
|
|
45
32
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
33
|
+
if (data.rotate) {
|
|
34
|
+
const rotateX = data.rotate.x;
|
|
35
|
+
if (rotateX !== undefined) {
|
|
36
|
+
this.rotate.x = rotateX;
|
|
37
|
+
}
|
|
38
|
+
const rotateY = data.rotate.y;
|
|
39
|
+
if (rotateY !== undefined) {
|
|
40
|
+
this.rotate.y = rotateY;
|
|
41
|
+
}
|
|
53
42
|
}
|
|
54
43
|
}
|
|
55
44
|
}
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
this.length = 10;
|
|
18
18
|
this.fill = new MoveTrailFill_1.MoveTrailFill();
|
|
19
19
|
}
|
|
20
|
-
get fillColor() {
|
|
21
|
-
return this.fill.color;
|
|
22
|
-
}
|
|
23
|
-
set fillColor(value) {
|
|
24
|
-
this.fill.load({ color: value });
|
|
25
|
-
}
|
|
26
20
|
load(data) {
|
|
27
21
|
if (!data) {
|
|
28
22
|
return;
|
|
@@ -30,8 +24,8 @@
|
|
|
30
24
|
if (data.enable !== undefined) {
|
|
31
25
|
this.enable = data.enable;
|
|
32
26
|
}
|
|
33
|
-
if (data.fill !== undefined
|
|
34
|
-
this.fill.load(data.fill
|
|
27
|
+
if (data.fill !== undefined) {
|
|
28
|
+
this.fill.load(data.fill);
|
|
35
29
|
}
|
|
36
30
|
if (data.length !== undefined) {
|
|
37
31
|
this.length = data.length;
|
|
@@ -15,17 +15,16 @@
|
|
|
15
15
|
this.default = "out";
|
|
16
16
|
}
|
|
17
17
|
load(data) {
|
|
18
|
-
var _a, _b, _c, _d;
|
|
19
18
|
if (!data) {
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
22
21
|
if (data.default !== undefined) {
|
|
23
22
|
this.default = data.default;
|
|
24
23
|
}
|
|
25
|
-
this.bottom =
|
|
26
|
-
this.left =
|
|
27
|
-
this.right =
|
|
28
|
-
this.top =
|
|
24
|
+
this.bottom = data.bottom ?? data.default;
|
|
25
|
+
this.left = data.left ?? data.default;
|
|
26
|
+
this.right = data.right ?? data.default;
|
|
27
|
+
this.top = data.top ?? data.default;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
exports.OutModes = OutModes;
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
if (data.enable !== undefined) {
|
|
28
28
|
this.enable = data.enable;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
if (data.position) {
|
|
31
|
+
this.position = (0, Utils_1.deepExtend)({}, data.position);
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
exports.Spin = Spin;
|
|
@@ -16,37 +16,18 @@
|
|
|
16
16
|
this.width = 1920;
|
|
17
17
|
this.height = 1080;
|
|
18
18
|
}
|
|
19
|
-
get area() {
|
|
20
|
-
return this.width;
|
|
21
|
-
}
|
|
22
|
-
set area(value) {
|
|
23
|
-
this.width = value;
|
|
24
|
-
}
|
|
25
|
-
get factor() {
|
|
26
|
-
return this.height;
|
|
27
|
-
}
|
|
28
|
-
set factor(value) {
|
|
29
|
-
this.height = value;
|
|
30
|
-
}
|
|
31
|
-
get value_area() {
|
|
32
|
-
return this.area;
|
|
33
|
-
}
|
|
34
|
-
set value_area(value) {
|
|
35
|
-
this.area = value;
|
|
36
|
-
}
|
|
37
19
|
load(data) {
|
|
38
|
-
var _a, _b, _c;
|
|
39
20
|
if (!data) {
|
|
40
21
|
return;
|
|
41
22
|
}
|
|
42
23
|
if (data.enable !== undefined) {
|
|
43
24
|
this.enable = data.enable;
|
|
44
25
|
}
|
|
45
|
-
const width =
|
|
26
|
+
const width = data.width;
|
|
46
27
|
if (width !== undefined) {
|
|
47
28
|
this.width = width;
|
|
48
29
|
}
|
|
49
|
-
const height =
|
|
30
|
+
const height = data.height;
|
|
50
31
|
if (height !== undefined) {
|
|
51
32
|
this.height = height;
|
|
52
33
|
}
|
|
@@ -15,21 +15,14 @@
|
|
|
15
15
|
constructor() {
|
|
16
16
|
this.density = new ParticlesDensity_1.ParticlesDensity();
|
|
17
17
|
this.limit = 0;
|
|
18
|
-
this.value =
|
|
19
|
-
}
|
|
20
|
-
get max() {
|
|
21
|
-
return this.limit;
|
|
22
|
-
}
|
|
23
|
-
set max(value) {
|
|
24
|
-
this.limit = value;
|
|
18
|
+
this.value = 0;
|
|
25
19
|
}
|
|
26
20
|
load(data) {
|
|
27
|
-
var _a;
|
|
28
21
|
if (!data) {
|
|
29
22
|
return;
|
|
30
23
|
}
|
|
31
24
|
this.density.load(data.density);
|
|
32
|
-
const limit =
|
|
25
|
+
const limit = data.limit;
|
|
33
26
|
if (limit !== undefined) {
|
|
34
27
|
this.limit = limit;
|
|
35
28
|
}
|
|
@@ -12,18 +12,22 @@
|
|
|
12
12
|
exports.Opacity = void 0;
|
|
13
13
|
const OpacityAnimation_1 = require("./OpacityAnimation");
|
|
14
14
|
const ValueWithRandom_1 = require("../../ValueWithRandom");
|
|
15
|
-
class Opacity extends ValueWithRandom_1.
|
|
15
|
+
class Opacity extends ValueWithRandom_1.ValueWithRandom {
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
this.animation = new OpacityAnimation_1.OpacityAnimation();
|
|
19
19
|
this.random.minimumValue = 0.1;
|
|
20
20
|
this.value = 1;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
load(data) {
|
|
23
|
+
if (!data) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
super.load(data);
|
|
27
|
+
const animation = data.animation;
|
|
28
|
+
if (animation !== undefined) {
|
|
29
|
+
this.animation.load(animation);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
exports.Opacity = Opacity;
|
|
@@ -17,16 +17,7 @@
|
|
|
17
17
|
this.destroy = "none";
|
|
18
18
|
this.speed = 2;
|
|
19
19
|
}
|
|
20
|
-
get opacity_min() {
|
|
21
|
-
return this.minimumValue;
|
|
22
|
-
}
|
|
23
|
-
set opacity_min(value) {
|
|
24
|
-
this.minimumValue = value;
|
|
25
|
-
}
|
|
26
20
|
load(data) {
|
|
27
|
-
if ((data === null || data === void 0 ? void 0 : data.opacity_min) !== undefined && data.minimumValue === undefined) {
|
|
28
|
-
data.minimumValue = data.opacity_min;
|
|
29
|
-
}
|
|
30
21
|
super.load(data);
|
|
31
22
|
if (!data) {
|
|
32
23
|
return;
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
this.zIndex = new ZIndex_1.ZIndex();
|
|
43
43
|
}
|
|
44
44
|
load(data) {
|
|
45
|
-
var _a, _b, _c, _d;
|
|
46
45
|
if (!data) {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
@@ -52,7 +51,7 @@
|
|
|
52
51
|
for (const group in data.groups) {
|
|
53
52
|
const item = data.groups[group];
|
|
54
53
|
if (item !== undefined) {
|
|
55
|
-
this.groups[group] = (0, Utils_1.deepExtend)(
|
|
54
|
+
this.groups[group] = (0, Utils_1.deepExtend)(this.groups[group] ?? {}, item);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
}
|
|
@@ -66,24 +65,20 @@
|
|
|
66
65
|
this.size.load(data.size);
|
|
67
66
|
this.shadow.load(data.shadow);
|
|
68
67
|
this.zIndex.load(data.zIndex);
|
|
69
|
-
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;
|
|
70
|
-
if (collisions !== undefined) {
|
|
71
|
-
this.collisions.enable = collisions;
|
|
72
|
-
}
|
|
73
68
|
this.collisions.load(data.collisions);
|
|
74
69
|
if (data.interactivity !== undefined) {
|
|
75
70
|
this.interactivity = (0, Utils_1.deepExtend)({}, data.interactivity);
|
|
76
71
|
}
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
this.stroke = (0, Utils_1.executeOnSingleOrMultiple)(
|
|
72
|
+
const strokeToLoad = data.stroke;
|
|
73
|
+
if (strokeToLoad) {
|
|
74
|
+
this.stroke = (0, Utils_1.executeOnSingleOrMultiple)(strokeToLoad, (t) => {
|
|
80
75
|
const tmp = new Stroke_1.Stroke();
|
|
81
76
|
tmp.load(t);
|
|
82
77
|
return tmp;
|
|
83
78
|
});
|
|
84
79
|
}
|
|
85
80
|
if (this._container) {
|
|
86
|
-
const updaters = this._engine.
|
|
81
|
+
const updaters = this._engine.updaters.get(this._container);
|
|
87
82
|
if (updaters) {
|
|
88
83
|
for (const updater of updaters) {
|
|
89
84
|
if (updater.loadOptions) {
|
|
@@ -91,7 +86,7 @@
|
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
|
-
const interactors = this._engine.
|
|
89
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
95
90
|
if (interactors) {
|
|
96
91
|
for (const interactor of interactors) {
|
|
97
92
|
if (interactor.loadParticlesOptions) {
|
|
@@ -13,31 +13,30 @@
|
|
|
13
13
|
const Utils_1 = require("../../../../Utils/Utils");
|
|
14
14
|
class Shape {
|
|
15
15
|
constructor() {
|
|
16
|
-
this.options = {};
|
|
17
|
-
this.type = "circle";
|
|
18
16
|
this.close = true;
|
|
19
17
|
this.fill = true;
|
|
18
|
+
this.options = {};
|
|
19
|
+
this.type = "circle";
|
|
20
20
|
}
|
|
21
21
|
load(data) {
|
|
22
|
-
var _a;
|
|
23
22
|
if (!data) {
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
|
-
if (data.close !== undefined) {
|
|
27
|
-
this.close = data.close;
|
|
28
|
-
}
|
|
29
|
-
if (data.fill !== undefined) {
|
|
30
|
-
this.fill = data.fill;
|
|
31
|
-
}
|
|
32
25
|
const options = data.options;
|
|
33
26
|
if (options !== undefined) {
|
|
34
27
|
for (const shape in options) {
|
|
35
28
|
const item = options[shape];
|
|
36
29
|
if (item) {
|
|
37
|
-
this.options[shape] = (0, Utils_1.deepExtend)(
|
|
30
|
+
this.options[shape] = (0, Utils_1.deepExtend)(this.options[shape] ?? {}, item);
|
|
38
31
|
}
|
|
39
32
|
}
|
|
40
33
|
}
|
|
34
|
+
if (data.close !== undefined) {
|
|
35
|
+
this.close = data.close;
|
|
36
|
+
}
|
|
37
|
+
if (data.fill !== undefined) {
|
|
38
|
+
this.fill = data.fill;
|
|
39
|
+
}
|
|
41
40
|
if (data.type !== undefined) {
|
|
42
41
|
this.type = data.type;
|
|
43
42
|
}
|
|
@@ -4,26 +4,30 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "
|
|
7
|
+
define(["require", "exports", "./SizeAnimation", "../../ValueWithRandom"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Size = void 0;
|
|
13
|
-
const ValueWithRandom_1 = require("../../ValueWithRandom");
|
|
14
13
|
const SizeAnimation_1 = require("./SizeAnimation");
|
|
15
|
-
|
|
14
|
+
const ValueWithRandom_1 = require("../../ValueWithRandom");
|
|
15
|
+
class Size extends ValueWithRandom_1.ValueWithRandom {
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
this.animation = new SizeAnimation_1.SizeAnimation();
|
|
19
19
|
this.random.minimumValue = 1;
|
|
20
20
|
this.value = 3;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
load(data) {
|
|
23
|
+
super.load(data);
|
|
24
|
+
if (!data) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const animation = data.animation;
|
|
28
|
+
if (animation !== undefined) {
|
|
29
|
+
this.animation.load(animation);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
exports.Size = Size;
|
|
@@ -17,16 +17,7 @@
|
|
|
17
17
|
this.destroy = "none";
|
|
18
18
|
this.speed = 5;
|
|
19
19
|
}
|
|
20
|
-
get size_min() {
|
|
21
|
-
return this.minimumValue;
|
|
22
|
-
}
|
|
23
|
-
set size_min(value) {
|
|
24
|
-
this.minimumValue = value;
|
|
25
|
-
}
|
|
26
20
|
load(data) {
|
|
27
|
-
if ((data === null || data === void 0 ? void 0 : data.size_min) !== undefined && data.minimumValue === undefined) {
|
|
28
|
-
data.minimumValue = data.size_min;
|
|
29
|
-
}
|
|
30
21
|
super.load(data);
|
|
31
22
|
if (!data) {
|
|
32
23
|
return;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./AnimationOptions", "./Random", "
|
|
7
|
+
define(["require", "exports", "./AnimationOptions", "./Random", "../../Utils/Utils", "../../Utils/NumberUtils"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
exports.RangedAnimationValueWithRandom = exports.AnimationValueWithRandom = exports.ValueWithRandom = void 0;
|
|
13
13
|
const AnimationOptions_1 = require("./AnimationOptions");
|
|
14
14
|
const Random_1 = require("./Random");
|
|
15
|
-
const
|
|
15
|
+
const Utils_1 = require("../../Utils/Utils");
|
|
16
16
|
const NumberUtils_1 = require("../../Utils/NumberUtils");
|
|
17
17
|
class ValueWithRandom {
|
|
18
18
|
constructor() {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
if (!data) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
26
|
+
if ((0, Utils_1.isBoolean)(data.random)) {
|
|
27
27
|
this.random.enable = data.random;
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
@@ -40,19 +40,12 @@
|
|
|
40
40
|
super();
|
|
41
41
|
this.animation = new AnimationOptions_1.AnimationOptions();
|
|
42
42
|
}
|
|
43
|
-
get anim() {
|
|
44
|
-
return this.animation;
|
|
45
|
-
}
|
|
46
|
-
set anim(value) {
|
|
47
|
-
this.animation = value;
|
|
48
|
-
}
|
|
49
43
|
load(data) {
|
|
50
|
-
var _a;
|
|
51
44
|
super.load(data);
|
|
52
45
|
if (!data) {
|
|
53
46
|
return;
|
|
54
47
|
}
|
|
55
|
-
const animation =
|
|
48
|
+
const animation = data.animation;
|
|
56
49
|
if (animation !== undefined) {
|
|
57
50
|
this.animation.load(animation);
|
|
58
51
|
}
|
|
@@ -62,16 +55,10 @@
|
|
|
62
55
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
63
56
|
constructor() {
|
|
64
57
|
super();
|
|
65
|
-
this.animation = new
|
|
58
|
+
this.animation = new AnimationOptions_1.RangedAnimationOptions();
|
|
66
59
|
}
|
|
67
60
|
load(data) {
|
|
68
61
|
super.load(data);
|
|
69
|
-
if (!data) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (data.animation !== undefined) {
|
|
73
|
-
this.value = (0, NumberUtils_1.setRangeValue)(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
|
|
74
|
-
}
|
|
75
62
|
}
|
|
76
63
|
}
|
|
77
64
|
exports.RangedAnimationValueWithRandom = RangedAnimationValueWithRandom;
|
package/umd/Utils/CanvasUtils.js
CHANGED
|
@@ -9,58 +9,8 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.alterHsl = exports.drawParticlePlugin = exports.drawPlugin = exports.drawShapeAfterEffect = exports.drawShape = exports.drawParticle = exports.clear = exports.
|
|
12
|
+
exports.alterHsl = exports.drawParticlePlugin = exports.drawPlugin = exports.drawShapeAfterEffect = exports.drawShape = exports.drawParticle = exports.clear = exports.paintImage = exports.paintBase = exports.drawTriangle = exports.drawLine = void 0;
|
|
13
13
|
const ColorUtils_1 = require("./ColorUtils");
|
|
14
|
-
function paintBase(context, dimension, baseColor) {
|
|
15
|
-
context.fillStyle = baseColor !== null && baseColor !== void 0 ? baseColor : "rgba(0,0,0,0)";
|
|
16
|
-
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
17
|
-
}
|
|
18
|
-
function paintImage(context, dimension, image, opacity) {
|
|
19
|
-
if (!image) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
context.globalAlpha = opacity;
|
|
23
|
-
context.drawImage(image, 0, 0, dimension.width, dimension.height);
|
|
24
|
-
context.globalAlpha = 1;
|
|
25
|
-
}
|
|
26
|
-
function getContext(canvas) {
|
|
27
|
-
const context = canvas.getContext("2d");
|
|
28
|
-
if (!context) {
|
|
29
|
-
throw new Error("Error tsParticles - No canvas context found");
|
|
30
|
-
}
|
|
31
|
-
return context;
|
|
32
|
-
}
|
|
33
|
-
exports.getContext = getContext;
|
|
34
|
-
function clearCanvas(context, size, options, trailFill, coverColorStyle) {
|
|
35
|
-
if (options.backgroundMask.enable) {
|
|
36
|
-
paintCanvas(context, size, options, coverColorStyle);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
const trail = options.particles.move.trail;
|
|
40
|
-
if (trail.enable && trail.length > 0 && trailFill) {
|
|
41
|
-
if (trailFill.color) {
|
|
42
|
-
paintBase(context, size, (0, ColorUtils_1.getStyleFromRgb)(trailFill.color, trailFill.opacity));
|
|
43
|
-
}
|
|
44
|
-
else if (trailFill.image) {
|
|
45
|
-
paintImage(context, size, trailFill.image, trailFill.opacity);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
clear(context, size);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.clearCanvas = clearCanvas;
|
|
54
|
-
function paintCanvas(context, size, options, coverColorStyle) {
|
|
55
|
-
if (options.backgroundMask.enable && coverColorStyle) {
|
|
56
|
-
clear(context, size);
|
|
57
|
-
paintBase(context, size, coverColorStyle);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
paintBase(context, size);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.paintCanvas = paintCanvas;
|
|
64
14
|
function drawLine(context, begin, end) {
|
|
65
15
|
context.beginPath();
|
|
66
16
|
context.moveTo(begin.x, begin.y);
|
|
@@ -76,21 +26,34 @@
|
|
|
76
26
|
context.closePath();
|
|
77
27
|
}
|
|
78
28
|
exports.drawTriangle = drawTriangle;
|
|
29
|
+
function paintBase(context, dimension, baseColor) {
|
|
30
|
+
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
31
|
+
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
32
|
+
}
|
|
33
|
+
exports.paintBase = paintBase;
|
|
34
|
+
function paintImage(context, dimension, image, opacity) {
|
|
35
|
+
if (!image) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
context.globalAlpha = opacity;
|
|
39
|
+
context.drawImage(image, 0, 0, dimension.width, dimension.height);
|
|
40
|
+
context.globalAlpha = 1;
|
|
41
|
+
}
|
|
42
|
+
exports.paintImage = paintImage;
|
|
79
43
|
function clear(context, dimension) {
|
|
80
44
|
context.clearRect(0, 0, dimension.width, dimension.height);
|
|
81
45
|
}
|
|
82
46
|
exports.clear = clear;
|
|
83
47
|
function drawParticle(data) {
|
|
84
|
-
var _a, _b, _c, _d, _e;
|
|
85
48
|
const { container, context, particle, delta, colorStyles, backgroundMask, composite, radius, opacity, shadow, transform, } = data;
|
|
86
49
|
const pos = particle.getPosition(), angle = particle.rotation + (particle.pathRotation ? particle.velocity.angle : 0), rotateData = {
|
|
87
50
|
sin: Math.sin(angle),
|
|
88
51
|
cos: Math.cos(angle),
|
|
89
52
|
}, transformData = {
|
|
90
|
-
a: rotateData.cos * (
|
|
91
|
-
b: rotateData.sin * (
|
|
92
|
-
c: -rotateData.sin * (
|
|
93
|
-
d: rotateData.cos * (
|
|
53
|
+
a: rotateData.cos * (transform.a ?? 1),
|
|
54
|
+
b: rotateData.sin * (transform.b ?? 1),
|
|
55
|
+
c: -rotateData.sin * (transform.c ?? 1),
|
|
56
|
+
d: rotateData.cos * (transform.d ?? 1),
|
|
94
57
|
};
|
|
95
58
|
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
96
59
|
context.beginPath();
|
|
@@ -107,7 +70,7 @@
|
|
|
107
70
|
if (colorStyles.fill) {
|
|
108
71
|
context.fillStyle = colorStyles.fill;
|
|
109
72
|
}
|
|
110
|
-
const strokeWidth =
|
|
73
|
+
const strokeWidth = particle.strokeWidth ?? 0;
|
|
111
74
|
context.lineWidth = strokeWidth;
|
|
112
75
|
if (colorStyles.stroke) {
|
|
113
76
|
context.strokeStyle = colorStyles.stroke;
|
|
@@ -143,7 +106,7 @@
|
|
|
143
106
|
return;
|
|
144
107
|
}
|
|
145
108
|
const drawer = container.drawers.get(particle.shape);
|
|
146
|
-
if (!
|
|
109
|
+
if (!drawer || !drawer.afterEffect) {
|
|
147
110
|
return;
|
|
148
111
|
}
|
|
149
112
|
drawer.afterEffect(context, particle, radius, opacity, delta, container.retina.pixelRatio);
|
package/umd/Utils/ColorUtils.js
CHANGED
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
if (!input) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const color =
|
|
61
|
-
if (
|
|
60
|
+
const color = (0, Utils_1.isString)(input) ? { value: input } : input;
|
|
61
|
+
if ((0, Utils_1.isString)(color.value)) {
|
|
62
62
|
return colorToRgb(color.value, index, useIndex);
|
|
63
63
|
}
|
|
64
|
-
if (color.value
|
|
64
|
+
if ((0, Utils_1.isArray)(color.value)) {
|
|
65
65
|
return rangeColorToRgb({
|
|
66
66
|
value: (0, Utils_1.itemFromArray)(color.value, index, useIndex),
|
|
67
67
|
});
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
if (!input) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
const color =
|
|
82
|
-
if (
|
|
81
|
+
const color = (0, Utils_1.isString)(input) ? { value: input } : input;
|
|
82
|
+
if ((0, Utils_1.isString)(color.value)) {
|
|
83
83
|
return color.value === randomColorValue ? getRandomRgbColor() : stringToRgb(color.value);
|
|
84
84
|
}
|
|
85
|
-
if (color.value
|
|
85
|
+
if ((0, Utils_1.isArray)(color.value)) {
|
|
86
86
|
return colorToRgb({
|
|
87
87
|
value: (0, Utils_1.itemFromArray)(color.value, index, useIndex),
|
|
88
88
|
});
|
|
@@ -131,8 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
exports.rgbToHsl = rgbToHsl;
|
|
133
133
|
function stringToAlpha(input) {
|
|
134
|
-
|
|
135
|
-
return (_a = stringToRgba(input)) === null || _a === void 0 ? void 0 : _a.a;
|
|
134
|
+
return stringToRgba(input)?.a;
|
|
136
135
|
}
|
|
137
136
|
exports.stringToAlpha = stringToAlpha;
|
|
138
137
|
function stringToRgb(input) {
|
|
@@ -146,9 +145,7 @@
|
|
|
146
145
|
s: hsl.s / 100,
|
|
147
146
|
};
|
|
148
147
|
if (!hslPercent.s) {
|
|
149
|
-
result.b = hslPercent.l;
|
|
150
|
-
result.g = hslPercent.l;
|
|
151
|
-
result.r = hslPercent.l;
|
|
148
|
+
result.r = result.g = result.b = hslPercent.l;
|
|
152
149
|
}
|
|
153
150
|
else {
|
|
154
151
|
const q = hslPercent.l < 0.5
|
|
@@ -175,7 +172,7 @@
|
|
|
175
172
|
}
|
|
176
173
|
exports.hslaToRgba = hslaToRgba;
|
|
177
174
|
function getRandomRgbColor(min) {
|
|
178
|
-
const fixedMin = min
|
|
175
|
+
const fixedMin = min ?? 0;
|
|
179
176
|
return {
|
|
180
177
|
b: Math.floor((0, NumberUtils_1.randomInRange)((0, NumberUtils_1.setRangeValue)(fixedMin, 256))),
|
|
181
178
|
g: Math.floor((0, NumberUtils_1.randomInRange)((0, NumberUtils_1.setRangeValue)(fixedMin, 256))),
|
|
@@ -184,11 +181,11 @@
|
|
|
184
181
|
}
|
|
185
182
|
exports.getRandomRgbColor = getRandomRgbColor;
|
|
186
183
|
function getStyleFromRgb(color, opacity) {
|
|
187
|
-
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity
|
|
184
|
+
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity ?? 1})`;
|
|
188
185
|
}
|
|
189
186
|
exports.getStyleFromRgb = getStyleFromRgb;
|
|
190
187
|
function getStyleFromHsl(color, opacity) {
|
|
191
|
-
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity
|
|
188
|
+
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity ?? 1})`;
|
|
192
189
|
}
|
|
193
190
|
exports.getStyleFromHsl = getStyleFromHsl;
|
|
194
191
|
function colorMix(color1, color2, size1, size2) {
|
|
@@ -207,17 +204,16 @@
|
|
|
207
204
|
}
|
|
208
205
|
exports.colorMix = colorMix;
|
|
209
206
|
function getLinkColor(p1, p2, linkColor) {
|
|
210
|
-
var _a, _b;
|
|
211
207
|
if (linkColor === randomColorValue) {
|
|
212
208
|
return getRandomRgbColor();
|
|
213
209
|
}
|
|
214
210
|
else if (linkColor === midColorValue) {
|
|
215
|
-
const sourceColor =
|
|
211
|
+
const sourceColor = p1.getFillColor() ?? p1.getStrokeColor(), destColor = p2?.getFillColor() ?? p2?.getStrokeColor();
|
|
216
212
|
if (sourceColor && destColor && p2) {
|
|
217
213
|
return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
|
|
218
214
|
}
|
|
219
215
|
else {
|
|
220
|
-
const hslColor = sourceColor
|
|
216
|
+
const hslColor = sourceColor ?? destColor;
|
|
221
217
|
if (hslColor) {
|
|
222
218
|
return hslToRgb(hslColor);
|
|
223
219
|
}
|
|
@@ -229,7 +225,7 @@
|
|
|
229
225
|
}
|
|
230
226
|
exports.getLinkColor = getLinkColor;
|
|
231
227
|
function getLinkRandomColor(optColor, blink, consent) {
|
|
232
|
-
const color =
|
|
228
|
+
const color = (0, Utils_1.isString)(optColor) ? optColor : optColor.value;
|
|
233
229
|
if (color === randomColorValue) {
|
|
234
230
|
if (consent) {
|
|
235
231
|
return rangeColorToRgb({
|
|
@@ -292,6 +288,8 @@
|
|
|
292
288
|
colorValue.status = "increasing";
|
|
293
289
|
colorValue.loops = 0;
|
|
294
290
|
colorValue.maxLoops = (0, NumberUtils_1.getRangeValue)(colorAnimation.count);
|
|
291
|
+
colorValue.time = 0;
|
|
292
|
+
colorValue.delayTime = (0, NumberUtils_1.getRangeValue)(colorAnimation.delay) * 1000;
|
|
295
293
|
if (!colorAnimation.sync) {
|
|
296
294
|
colorValue.velocity *= (0, NumberUtils_1.getRandom)();
|
|
297
295
|
colorValue.value *= (0, NumberUtils_1.getRandom)();
|