@tsparticles/engine 4.0.0-alpha.5 → 4.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/164.min.js +1 -0
- package/README.md +41 -7
- package/browser/Core/Canvas.js +250 -143
- package/browser/Core/Container.js +80 -74
- package/browser/Core/Engine.js +44 -67
- package/browser/Core/Particle.js +202 -173
- package/browser/Core/Particles.js +187 -138
- package/browser/Core/Retina.js +5 -0
- package/browser/Core/Utils/Constants.js +2 -2
- package/browser/Core/Utils/EventListeners.js +67 -63
- package/browser/Core/Utils/Ranges.js +29 -10
- package/browser/Core/Utils/SpatialHashGrid.js +102 -0
- package/browser/Core/Utils/Vectors.js +17 -18
- package/browser/Enums/Types/EasingType.js +18 -3
- package/browser/Options/Classes/AnimatableColor.js +1 -0
- package/browser/Options/Classes/AnimationOptions.js +8 -0
- package/browser/Options/Classes/Background/Background.js +6 -0
- package/browser/Options/Classes/ColorAnimation.js +12 -1
- package/browser/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/browser/Options/Classes/HslAnimation.js +4 -5
- package/browser/Options/Classes/Options.js +63 -4
- package/browser/Options/Classes/OptionsColor.js +1 -0
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/browser/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/browser/Options/Classes/Particles/Fill.js +28 -0
- package/browser/Options/Classes/Particles/Move/Move.js +17 -3
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/browser/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/browser/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/browser/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/browser/Options/Classes/Particles/Move/Spin.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/browser/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/browser/Options/Classes/Particles/Size/Size.js +1 -0
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/browser/Options/Classes/Particles/Stroke.js +3 -0
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/browser/Options/Classes/ResizeEvent.js +2 -0
- package/browser/Options/Classes/ValueWithRandom.js +3 -4
- package/browser/Utils/CanvasUtils.js +43 -62
- package/browser/Utils/ColorUtils.js +30 -19
- package/browser/Utils/EventDispatcher.js +1 -0
- package/browser/Utils/MathUtils.js +12 -7
- package/browser/Utils/Utils.js +109 -31
- package/browser/exports.js +1 -2
- package/cjs/Core/Canvas.js +250 -143
- package/cjs/Core/Container.js +80 -74
- package/cjs/Core/Engine.js +44 -67
- package/cjs/Core/Particle.js +202 -173
- package/cjs/Core/Particles.js +187 -138
- package/cjs/Core/Retina.js +5 -0
- package/cjs/Core/Utils/Constants.js +2 -2
- package/cjs/Core/Utils/EventListeners.js +67 -63
- package/cjs/Core/Utils/Ranges.js +29 -10
- package/cjs/Core/Utils/SpatialHashGrid.js +102 -0
- package/cjs/Core/Utils/Vectors.js +17 -18
- package/cjs/Enums/Types/EasingType.js +18 -3
- package/cjs/Options/Classes/AnimatableColor.js +1 -0
- package/cjs/Options/Classes/AnimationOptions.js +8 -0
- package/cjs/Options/Classes/Background/Background.js +6 -0
- package/cjs/Options/Classes/ColorAnimation.js +12 -1
- package/cjs/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/cjs/Options/Classes/HslAnimation.js +4 -5
- package/cjs/Options/Classes/Options.js +63 -4
- package/cjs/Options/Classes/OptionsColor.js +1 -0
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/cjs/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/cjs/Options/Classes/Particles/Fill.js +28 -0
- package/cjs/Options/Classes/Particles/Move/Move.js +17 -3
- package/cjs/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/cjs/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/cjs/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Spin.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/cjs/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/cjs/Options/Classes/Particles/Size/Size.js +1 -0
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/Stroke.js +3 -0
- package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/cjs/Options/Classes/ResizeEvent.js +2 -0
- package/cjs/Options/Classes/ValueWithRandom.js +3 -4
- package/cjs/Utils/CanvasUtils.js +43 -62
- package/cjs/Utils/ColorUtils.js +30 -19
- package/cjs/Utils/EventDispatcher.js +1 -0
- package/cjs/Utils/MathUtils.js +12 -7
- package/cjs/Utils/Utils.js +109 -31
- package/cjs/exports.js +1 -2
- package/dist_browser_Core_Container_js.js +12 -12
- package/esm/Core/Canvas.js +250 -143
- package/esm/Core/Container.js +80 -74
- package/esm/Core/Engine.js +44 -67
- package/esm/Core/Particle.js +202 -173
- package/esm/Core/Particles.js +187 -138
- package/esm/Core/Retina.js +5 -0
- package/esm/Core/Utils/Constants.js +2 -2
- package/esm/Core/Utils/EventListeners.js +67 -63
- package/esm/Core/Utils/Ranges.js +29 -10
- package/esm/Core/Utils/SpatialHashGrid.js +102 -0
- package/esm/Core/Utils/Vectors.js +17 -18
- package/esm/Enums/Types/EasingType.js +18 -3
- package/esm/Options/Classes/AnimatableColor.js +1 -0
- package/esm/Options/Classes/AnimationOptions.js +8 -0
- package/esm/Options/Classes/Background/Background.js +6 -0
- package/esm/Options/Classes/ColorAnimation.js +12 -1
- package/esm/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/esm/Options/Classes/HslAnimation.js +4 -5
- package/esm/Options/Classes/Options.js +63 -4
- package/esm/Options/Classes/OptionsColor.js +1 -0
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/esm/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/esm/Options/Classes/Particles/Fill.js +28 -0
- package/esm/Options/Classes/Particles/Move/Move.js +17 -3
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/esm/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/esm/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/esm/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/esm/Options/Classes/Particles/Move/Spin.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/esm/Options/Classes/Particles/ParticlesOptions.js +25 -5
- package/esm/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/esm/Options/Classes/Particles/Size/Size.js +1 -0
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/esm/Options/Classes/Particles/Stroke.js +3 -0
- package/esm/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/esm/Options/Classes/ResizeEvent.js +2 -0
- package/esm/Options/Classes/ValueWithRandom.js +3 -4
- package/esm/Utils/CanvasUtils.js +43 -62
- package/esm/Utils/ColorUtils.js +30 -19
- package/esm/Utils/EventDispatcher.js +1 -0
- package/esm/Utils/MathUtils.js +12 -7
- package/esm/Utils/Utils.js +109 -31
- package/esm/exports.js +1 -2
- package/package.json +1 -1
- package/report.html +3 -3
- package/scripts/install.js +4 -20
- package/tsparticles.engine.js +93 -91
- package/tsparticles.engine.min.js +2 -2
- package/types/Core/Canvas.d.ts +17 -4
- package/types/Core/Container.d.ts +3 -7
- package/types/Core/Engine.d.ts +13 -20
- package/types/Core/Interfaces/IColorManager.d.ts +0 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +6 -1
- package/types/Core/Interfaces/IPalette.d.ts +7 -0
- package/types/Core/Interfaces/IParticleOpacityData.d.ts +1 -0
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +3 -3
- package/types/Core/Interfaces/IShapeDrawData.d.ts +8 -0
- package/types/Core/Interfaces/IShapeDrawer.d.ts +0 -1
- package/types/Core/Interfaces/IShapeValues.d.ts +0 -1
- package/types/Core/Particle.d.ts +4 -7
- package/types/Core/Particles.d.ts +15 -7
- package/types/Core/Utils/Constants.d.ts +2 -2
- package/types/Core/Utils/Ranges.d.ts +4 -1
- package/types/Core/Utils/SpatialHashGrid.d.ts +25 -0
- package/types/Core/Utils/Vectors.d.ts +8 -10
- package/types/Enums/Types/EasingType.d.ts +20 -5
- package/types/Options/Classes/ColorAnimation.d.ts +3 -1
- package/types/Options/Classes/HslAnimation.d.ts +3 -4
- package/types/Options/Classes/Options.d.ts +2 -0
- package/types/Options/Classes/Particles/Effect/Effect.d.ts +0 -1
- package/types/Options/Classes/Particles/Fill.d.ts +12 -0
- package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +2 -2
- package/types/Options/Classes/Particles/Shape/Shape.d.ts +0 -1
- package/types/Options/Classes/ValueWithRandom.d.ts +0 -1
- package/types/Options/Interfaces/IColorAnimation.d.ts +2 -0
- package/types/Options/Interfaces/IOptions.d.ts +1 -0
- package/types/Options/Interfaces/Particles/Effect/IEffect.d.ts +0 -1
- package/types/Options/Interfaces/Particles/IFill.d.ts +9 -0
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -2
- package/types/Options/Interfaces/Particles/IStroke.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
- package/types/Options/Interfaces/Particles/Shape/IShape.d.ts +0 -1
- package/types/Types/EngineInitializers.d.ts +6 -3
- package/types/Utils/CanvasUtils.d.ts +6 -14
- package/types/Utils/ColorUtils.d.ts +3 -2
- package/types/Utils/MathUtils.d.ts +2 -0
- package/types/Utils/Utils.d.ts +8 -1
- package/types/export-types.d.ts +3 -5
- package/types/exports.d.ts +1 -2
- package/umd/Core/Canvas.js +248 -141
- package/umd/Core/Container.js +80 -74
- package/umd/Core/Engine.js +43 -66
- package/umd/Core/Particle.js +203 -174
- package/umd/Core/Particles.js +187 -138
- package/umd/Core/Retina.js +5 -0
- package/umd/Core/Utils/Constants.js +3 -3
- package/umd/Core/Utils/EventListeners.js +67 -63
- package/umd/Core/Utils/Ranges.js +28 -9
- package/umd/Core/Utils/SpatialHashGrid.js +116 -0
- package/umd/Core/Utils/Vectors.js +17 -18
- package/umd/Enums/Types/EasingType.js +18 -3
- package/umd/Options/Classes/AnimatableColor.js +1 -0
- package/umd/Options/Classes/AnimationOptions.js +8 -0
- package/umd/Options/Classes/Background/Background.js +6 -0
- package/umd/Options/Classes/ColorAnimation.js +12 -1
- package/umd/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/umd/Options/Classes/HslAnimation.js +5 -6
- package/umd/Options/Classes/Options.js +63 -4
- package/umd/Options/Classes/OptionsColor.js +1 -0
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/umd/Options/Classes/Particles/Effect/Effect.js +3 -4
- package/umd/Options/Classes/Particles/Fill.js +42 -0
- package/umd/Options/Classes/Particles/Move/Move.js +18 -4
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/umd/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/umd/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/umd/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/umd/Options/Classes/Particles/ParticlesOptions.js +26 -6
- package/umd/Options/Classes/Particles/Shape/Shape.js +3 -4
- package/umd/Options/Classes/Particles/Size/Size.js +1 -0
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/umd/Options/Classes/Particles/Stroke.js +3 -0
- package/umd/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/umd/Options/Classes/ResizeEvent.js +2 -0
- package/umd/Options/Classes/ValueWithRandom.js +3 -4
- package/umd/Utils/CanvasUtils.js +43 -66
- package/umd/Utils/ColorUtils.js +30 -18
- package/umd/Utils/EventDispatcher.js +1 -0
- package/umd/Utils/MathUtils.js +14 -7
- package/umd/Utils/Utils.js +111 -32
- package/umd/exports.js +2 -3
- package/794.min.js +0 -2
- package/794.min.js.LICENSE.txt +0 -1
- package/browser/Core/Utils/Point.js +0 -6
- package/browser/Core/Utils/QuadTree.js +0 -59
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/cjs/Core/Utils/Point.js +0 -6
- package/cjs/Core/Utils/QuadTree.js +0 -59
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/esm/Core/Interfaces/IMovePathGenerator.js +0 -1
- package/esm/Core/Interfaces/IParticleMover.js +0 -1
- package/esm/Core/Utils/Point.js +0 -6
- package/esm/Core/Utils/QuadTree.js +0 -59
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +0 -33
- package/esm/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -1
- package/tsparticles.engine.min.js.LICENSE.txt +0 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +0 -10
- package/types/Core/Interfaces/IParticleMover.d.ts +0 -7
- package/types/Core/Utils/Point.d.ts +0 -7
- package/types/Core/Utils/QuadTree.d.ts +0 -18
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +0 -12
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +0 -7
- package/umd/Core/Utils/Point.js +0 -20
- package/umd/Core/Utils/QuadTree.js +0 -73
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +0 -47
- package/umd/Options/Interfaces/Particles/Move/IMoveAttract.js +0 -12
- /package/browser/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
- /package/browser/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Move/IMoveAttract.js → cjs/Core/Interfaces/IPalette.js} +0 -0
- /package/cjs/{Core/Interfaces/IMovePathGenerator.js → Options/Interfaces/Particles/IFill.js} +0 -0
- /package/{cjs/Core/Interfaces/IParticleMover.js → esm/Core/Interfaces/IPalette.js} +0 -0
- /package/{cjs/Options/Interfaces/Particles/Move/IMoveAttract.js → esm/Options/Interfaces/Particles/IFill.js} +0 -0
- /package/umd/Core/Interfaces/{IMovePathGenerator.js → IPalette.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleMover.js → Options/Interfaces/Particles/IFill.js} +0 -0
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
14
14
|
const MathUtils_js_1 = require("../../../../Utils/MathUtils.js");
|
|
15
15
|
class MoveGravity {
|
|
16
|
+
acceleration;
|
|
17
|
+
enable;
|
|
18
|
+
inverse;
|
|
19
|
+
maxSpeed;
|
|
16
20
|
constructor() {
|
|
17
21
|
this.acceleration = 9.81;
|
|
18
22
|
this.enable = false;
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
const OutMode_js_1 = require("../../../../Enums/Modes/OutMode.js");
|
|
14
14
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
15
15
|
class OutModes {
|
|
16
|
+
bottom;
|
|
17
|
+
default;
|
|
18
|
+
left;
|
|
19
|
+
right;
|
|
20
|
+
top;
|
|
16
21
|
constructor() {
|
|
17
22
|
this.default = OutMode_js_1.OutMode.out;
|
|
18
23
|
}
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
const Utils_js_1 = require("../../../../../Utils/Utils.js");
|
|
15
15
|
const TypeUtils_js_1 = require("../../../../../Utils/TypeUtils.js");
|
|
16
16
|
class MovePath {
|
|
17
|
+
clamp;
|
|
18
|
+
delay;
|
|
19
|
+
enable;
|
|
20
|
+
generator;
|
|
21
|
+
options;
|
|
17
22
|
constructor() {
|
|
18
23
|
this.clamp = true;
|
|
19
24
|
this.delay = new ValueWithRandom_js_1.ValueWithRandom();
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
15
15
|
const MathUtils_js_1 = require("../../../../Utils/MathUtils.js");
|
|
16
16
|
class Spin {
|
|
17
|
+
acceleration;
|
|
18
|
+
enable;
|
|
19
|
+
position;
|
|
17
20
|
constructor() {
|
|
18
21
|
this.acceleration = 0;
|
|
19
22
|
this.enable = false;
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
const ParticlesNumberLimit_js_1 = require("./ParticlesNumberLimit.js");
|
|
15
15
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
16
16
|
class ParticlesNumber {
|
|
17
|
+
density;
|
|
18
|
+
limit;
|
|
19
|
+
value;
|
|
17
20
|
constructor() {
|
|
18
21
|
this.density = new ParticlesDensity_js_1.ParticlesDensity();
|
|
19
22
|
this.limit = new ParticlesNumberLimit_js_1.ParticlesNumberLimit();
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
const LimitMode_js_1 = require("../../../../Enums/Modes/LimitMode.js");
|
|
14
14
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
15
15
|
class ParticlesNumberLimit {
|
|
16
|
+
mode;
|
|
17
|
+
value;
|
|
16
18
|
constructor() {
|
|
17
19
|
this.mode = LimitMode_js_1.LimitMode.delete;
|
|
18
20
|
this.value = 0;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const ValueWithRandom_js_1 = require("../../ValueWithRandom.js");
|
|
15
15
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
16
16
|
class Opacity extends ValueWithRandom_js_1.RangedAnimationValueWithRandom {
|
|
17
|
+
animation;
|
|
17
18
|
constructor() {
|
|
18
19
|
super();
|
|
19
20
|
this.animation = new OpacityAnimation_js_1.OpacityAnimation();
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const AnimationOptions_js_1 = require("../../AnimationOptions.js");
|
|
15
15
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
16
16
|
class OpacityAnimation extends AnimationOptions_js_1.RangedAnimationOptions {
|
|
17
|
+
destroy;
|
|
17
18
|
constructor() {
|
|
18
19
|
super();
|
|
19
20
|
this.destroy = DestroyType_js_1.DestroyType.none;
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "../../../Utils/Utils.js", "
|
|
7
|
+
define(["require", "exports", "../../../Utils/Utils.js", "./Effect/Effect.js", "./Fill.js", "./Move/Move.js", "./Opacity/Opacity.js", "./Bounce/ParticlesBounce.js", "./Number/ParticlesNumber.js", "./Shape/Shape.js", "./Size/Size.js", "./Stroke.js", "./ZIndex/ZIndex.js", "../../../Utils/TypeUtils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ParticlesOptions = void 0;
|
|
13
13
|
const Utils_js_1 = require("../../../Utils/Utils.js");
|
|
14
|
-
const AnimatableColor_js_1 = require("../AnimatableColor.js");
|
|
15
14
|
const Effect_js_1 = require("./Effect/Effect.js");
|
|
15
|
+
const Fill_js_1 = require("./Fill.js");
|
|
16
16
|
const Move_js_1 = require("./Move/Move.js");
|
|
17
17
|
const Opacity_js_1 = require("./Opacity/Opacity.js");
|
|
18
18
|
const ParticlesBounce_js_1 = require("./Bounce/ParticlesBounce.js");
|
|
@@ -23,13 +23,26 @@
|
|
|
23
23
|
const ZIndex_js_1 = require("./ZIndex/ZIndex.js");
|
|
24
24
|
const TypeUtils_js_1 = require("../../../Utils/TypeUtils.js");
|
|
25
25
|
class ParticlesOptions {
|
|
26
|
+
bounce;
|
|
27
|
+
effect;
|
|
28
|
+
fill;
|
|
29
|
+
groups;
|
|
30
|
+
move;
|
|
31
|
+
number;
|
|
32
|
+
opacity;
|
|
33
|
+
reduceDuplicates;
|
|
34
|
+
shape;
|
|
35
|
+
size;
|
|
36
|
+
stroke;
|
|
37
|
+
zIndex;
|
|
38
|
+
_container;
|
|
39
|
+
_engine;
|
|
26
40
|
constructor(engine, container) {
|
|
27
41
|
this._engine = engine;
|
|
28
42
|
this._container = container;
|
|
29
43
|
this.bounce = new ParticlesBounce_js_1.ParticlesBounce();
|
|
30
|
-
this.color = new AnimatableColor_js_1.AnimatableColor();
|
|
31
|
-
this.color.value = "#fff";
|
|
32
44
|
this.effect = new Effect_js_1.Effect();
|
|
45
|
+
this.fill = new Fill_js_1.Fill();
|
|
33
46
|
this.groups = {};
|
|
34
47
|
this.move = new Move_js_1.Move();
|
|
35
48
|
this.number = new ParticlesNumber_js_1.ParticlesNumber();
|
|
@@ -46,7 +59,7 @@
|
|
|
46
59
|
}
|
|
47
60
|
if (data.groups !== undefined) {
|
|
48
61
|
for (const group of Object.keys(data.groups)) {
|
|
49
|
-
if (!
|
|
62
|
+
if (!(group in data.groups)) {
|
|
50
63
|
continue;
|
|
51
64
|
}
|
|
52
65
|
const item = data.groups[group];
|
|
@@ -59,7 +72,6 @@
|
|
|
59
72
|
this.reduceDuplicates = data.reduceDuplicates;
|
|
60
73
|
}
|
|
61
74
|
this.bounce.load(data.bounce);
|
|
62
|
-
this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
|
|
63
75
|
this.effect.load(data.effect);
|
|
64
76
|
this.move.load(data.move);
|
|
65
77
|
this.number.load(data.number);
|
|
@@ -67,6 +79,14 @@
|
|
|
67
79
|
this.shape.load(data.shape);
|
|
68
80
|
this.size.load(data.size);
|
|
69
81
|
this.zIndex.load(data.zIndex);
|
|
82
|
+
const fillToLoad = data.fill;
|
|
83
|
+
if (fillToLoad) {
|
|
84
|
+
this.fill = (0, Utils_js_1.executeOnSingleOrMultiple)(fillToLoad, t => {
|
|
85
|
+
const tmp = new Fill_js_1.Fill();
|
|
86
|
+
tmp.load(t);
|
|
87
|
+
return tmp;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
70
90
|
const strokeToLoad = data.stroke;
|
|
71
91
|
if (strokeToLoad) {
|
|
72
92
|
this.stroke = (0, Utils_js_1.executeOnSingleOrMultiple)(strokeToLoad, t => {
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
const Utils_js_1 = require("../../../../Utils/Utils.js");
|
|
14
14
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
15
15
|
class Shape {
|
|
16
|
+
close;
|
|
17
|
+
options;
|
|
18
|
+
type;
|
|
16
19
|
constructor() {
|
|
17
20
|
this.close = true;
|
|
18
|
-
this.fill = true;
|
|
19
21
|
this.options = {};
|
|
20
22
|
this.type = "circle";
|
|
21
23
|
}
|
|
@@ -35,9 +37,6 @@
|
|
|
35
37
|
if (data.close !== undefined) {
|
|
36
38
|
this.close = data.close;
|
|
37
39
|
}
|
|
38
|
-
if (data.fill !== undefined) {
|
|
39
|
-
this.fill = data.fill;
|
|
40
|
-
}
|
|
41
40
|
if (data.type !== undefined) {
|
|
42
41
|
this.type = data.type;
|
|
43
42
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const SizeAnimation_js_1 = require("./SizeAnimation.js");
|
|
15
15
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
16
16
|
class Size extends ValueWithRandom_js_1.RangedAnimationValueWithRandom {
|
|
17
|
+
animation;
|
|
17
18
|
constructor() {
|
|
18
19
|
super();
|
|
19
20
|
this.animation = new SizeAnimation_js_1.SizeAnimation();
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const AnimationOptions_js_1 = require("../../AnimationOptions.js");
|
|
15
15
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
16
16
|
class SizeAnimation extends AnimationOptions_js_1.RangedAnimationOptions {
|
|
17
|
+
destroy;
|
|
17
18
|
constructor() {
|
|
18
19
|
super();
|
|
19
20
|
this.destroy = DestroyType_js_1.DestroyType.none;
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
const ValueWithRandom_js_1 = require("../../ValueWithRandom.js");
|
|
14
14
|
const TypeUtils_js_1 = require("../../../../Utils/TypeUtils.js");
|
|
15
15
|
class ZIndex extends ValueWithRandom_js_1.ValueWithRandom {
|
|
16
|
+
opacityRate;
|
|
17
|
+
sizeRate;
|
|
18
|
+
velocityRate;
|
|
16
19
|
constructor() {
|
|
17
20
|
super();
|
|
18
21
|
this.opacityRate = 1;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const TypeUtils_js_1 = require("../../Utils/TypeUtils.js");
|
|
15
15
|
const MathUtils_js_1 = require("../../Utils/MathUtils.js");
|
|
16
16
|
class ValueWithRandom {
|
|
17
|
+
value;
|
|
17
18
|
constructor() {
|
|
18
19
|
this.value = 0;
|
|
19
20
|
}
|
|
@@ -28,10 +29,7 @@
|
|
|
28
29
|
}
|
|
29
30
|
exports.ValueWithRandom = ValueWithRandom;
|
|
30
31
|
class AnimationValueWithRandom extends ValueWithRandom {
|
|
31
|
-
|
|
32
|
-
super();
|
|
33
|
-
this.animation = new AnimationOptions_js_1.AnimationOptions();
|
|
34
|
-
}
|
|
32
|
+
animation = new AnimationOptions_js_1.AnimationOptions();
|
|
35
33
|
load(data) {
|
|
36
34
|
super.load(data);
|
|
37
35
|
if ((0, TypeUtils_js_1.isNull)(data)) {
|
|
@@ -45,6 +43,7 @@
|
|
|
45
43
|
}
|
|
46
44
|
exports.AnimationValueWithRandom = AnimationValueWithRandom;
|
|
47
45
|
class RangedAnimationValueWithRandom extends AnimationValueWithRandom {
|
|
46
|
+
animation;
|
|
48
47
|
constructor() {
|
|
49
48
|
super();
|
|
50
49
|
this.animation = new AnimationOptions_js_1.RangedAnimationOptions();
|
package/umd/Utils/CanvasUtils.js
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "../Core/Utils/Constants.js"
|
|
7
|
+
define(["require", "exports", "../Core/Utils/Constants.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.clearDrawPlugin = clearDrawPlugin;
|
|
13
|
-
exports.drawLine = drawLine;
|
|
14
12
|
exports.paintBase = paintBase;
|
|
15
13
|
exports.paintImage = paintImage;
|
|
16
14
|
exports.clear = clear;
|
|
@@ -20,23 +18,8 @@
|
|
|
20
18
|
exports.drawShape = drawShape;
|
|
21
19
|
exports.drawShapeAfterDraw = drawShapeAfterDraw;
|
|
22
20
|
exports.drawShapeBeforeDraw = drawShapeBeforeDraw;
|
|
23
|
-
exports.drawPlugin = drawPlugin;
|
|
24
21
|
exports.drawParticlePlugin = drawParticlePlugin;
|
|
25
|
-
exports.alterHsl = alterHsl;
|
|
26
22
|
const Constants_js_1 = require("../Core/Utils/Constants.js");
|
|
27
|
-
const AlterType_js_1 = require("../Enums/Types/AlterType.js");
|
|
28
|
-
function clearDrawPlugin(context, plugin, delta) {
|
|
29
|
-
if (!plugin.clearDraw) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
plugin.clearDraw(context, delta);
|
|
33
|
-
}
|
|
34
|
-
function drawLine(context, begin, end) {
|
|
35
|
-
context.beginPath();
|
|
36
|
-
context.moveTo(begin.x, begin.y);
|
|
37
|
-
context.lineTo(end.x, end.y);
|
|
38
|
-
context.closePath();
|
|
39
|
-
}
|
|
40
23
|
function paintBase(context, dimension, baseColor) {
|
|
41
24
|
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
42
25
|
context.fillRect(Constants_js_1.originPoint.x, Constants_js_1.originPoint.y, dimension.width, dimension.height);
|
|
@@ -45,20 +28,24 @@
|
|
|
45
28
|
if (!image) {
|
|
46
29
|
return;
|
|
47
30
|
}
|
|
31
|
+
const prevAlpha = context.globalAlpha;
|
|
48
32
|
context.globalAlpha = opacity;
|
|
49
33
|
context.drawImage(image, Constants_js_1.originPoint.x, Constants_js_1.originPoint.y, dimension.width, dimension.height);
|
|
50
|
-
context.globalAlpha =
|
|
34
|
+
context.globalAlpha = prevAlpha;
|
|
51
35
|
}
|
|
52
36
|
function clear(context, dimension) {
|
|
53
37
|
context.clearRect(Constants_js_1.originPoint.x, Constants_js_1.originPoint.y, dimension.width, dimension.height);
|
|
54
38
|
}
|
|
55
39
|
function drawParticle(data) {
|
|
56
|
-
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, pos = particle.getPosition(), transformData = particle.getTransformData(transform)
|
|
40
|
+
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, { effectDrawers, shapeDrawers } = container.particles, pos = particle.getPosition(), transformData = particle.getTransformData(transform), drawScale = Constants_js_1.defaultZoom, drawPosition = {
|
|
41
|
+
x: pos.x,
|
|
42
|
+
y: pos.y,
|
|
43
|
+
};
|
|
57
44
|
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
58
45
|
if (colorStyles.fill) {
|
|
59
46
|
context.fillStyle = colorStyles.fill;
|
|
60
47
|
}
|
|
61
|
-
const strokeWidth = particle.strokeWidth ?? Constants_js_1.minStrokeWidth;
|
|
48
|
+
const fillEnabled = !!particle.fillEnabled, strokeWidth = particle.strokeWidth ?? Constants_js_1.minStrokeWidth;
|
|
62
49
|
context.lineWidth = strokeWidth;
|
|
63
50
|
if (colorStyles.stroke) {
|
|
64
51
|
context.strokeStyle = colorStyles.stroke;
|
|
@@ -67,49 +54,54 @@
|
|
|
67
54
|
context,
|
|
68
55
|
particle,
|
|
69
56
|
radius,
|
|
57
|
+
drawRadius: radius * drawScale,
|
|
70
58
|
opacity,
|
|
71
59
|
delta,
|
|
72
60
|
pixelRatio: container.retina.pixelRatio,
|
|
73
|
-
fill:
|
|
74
|
-
stroke: strokeWidth > Constants_js_1.minStrokeWidth
|
|
61
|
+
fill: fillEnabled,
|
|
62
|
+
stroke: strokeWidth > Constants_js_1.minStrokeWidth,
|
|
75
63
|
transformData,
|
|
64
|
+
position: { ...pos },
|
|
65
|
+
drawPosition,
|
|
66
|
+
drawScale,
|
|
76
67
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
for (const plugin of container.plugins) {
|
|
69
|
+
plugin.drawParticleTransform?.(drawData);
|
|
70
|
+
}
|
|
71
|
+
const effect = particle.effect ? effectDrawers.get(particle.effect) : undefined, shape = particle.shape ? shapeDrawers.get(particle.shape) : undefined;
|
|
72
|
+
drawBeforeEffect(effect, drawData);
|
|
73
|
+
drawShapeBeforeDraw(shape, drawData);
|
|
74
|
+
drawShape(shape, drawData);
|
|
75
|
+
drawShapeAfterDraw(shape, drawData);
|
|
76
|
+
drawAfterEffect(effect, drawData);
|
|
82
77
|
context.resetTransform();
|
|
83
78
|
}
|
|
84
|
-
function drawAfterEffect(
|
|
79
|
+
function drawAfterEffect(drawer, data) {
|
|
80
|
+
if (!drawer?.drawAfter) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
85
83
|
const { particle } = data;
|
|
86
84
|
if (!particle.effect) {
|
|
87
85
|
return;
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
drawer.drawAfter(data);
|
|
88
|
+
}
|
|
89
|
+
function drawBeforeEffect(drawer, data) {
|
|
90
|
+
if (!drawer?.drawBefore) {
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
drawFunc(data);
|
|
94
|
-
}
|
|
95
|
-
function drawBeforeEffect(container, data) {
|
|
96
93
|
const { particle } = data;
|
|
97
94
|
if (!particle.effect) {
|
|
98
95
|
return;
|
|
99
96
|
}
|
|
100
|
-
const drawer = container.effectDrawers.get(particle.effect);
|
|
101
|
-
if (!drawer?.drawBefore) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
97
|
drawer.drawBefore(data);
|
|
105
98
|
}
|
|
106
|
-
function drawShape(
|
|
107
|
-
|
|
108
|
-
if (!particle.shape) {
|
|
99
|
+
function drawShape(drawer, data) {
|
|
100
|
+
if (!drawer) {
|
|
109
101
|
return;
|
|
110
102
|
}
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
103
|
+
const { context, fill, particle, stroke } = data;
|
|
104
|
+
if (!particle.shape) {
|
|
113
105
|
return;
|
|
114
106
|
}
|
|
115
107
|
context.beginPath();
|
|
@@ -120,37 +112,29 @@
|
|
|
120
112
|
if (stroke) {
|
|
121
113
|
context.stroke();
|
|
122
114
|
}
|
|
123
|
-
if (
|
|
115
|
+
if (fill) {
|
|
124
116
|
context.fill();
|
|
125
117
|
}
|
|
126
118
|
}
|
|
127
|
-
function drawShapeAfterDraw(
|
|
128
|
-
const { particle } = data;
|
|
129
|
-
if (!particle.shape) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const drawer = container.shapeDrawers.get(particle.shape);
|
|
119
|
+
function drawShapeAfterDraw(drawer, data) {
|
|
133
120
|
if (!drawer?.afterDraw) {
|
|
134
121
|
return;
|
|
135
122
|
}
|
|
136
|
-
drawer.afterDraw(data);
|
|
137
|
-
}
|
|
138
|
-
function drawShapeBeforeDraw(container, data) {
|
|
139
123
|
const { particle } = data;
|
|
140
124
|
if (!particle.shape) {
|
|
141
125
|
return;
|
|
142
126
|
}
|
|
143
|
-
|
|
127
|
+
drawer.afterDraw(data);
|
|
128
|
+
}
|
|
129
|
+
function drawShapeBeforeDraw(drawer, data) {
|
|
144
130
|
if (!drawer?.beforeDraw) {
|
|
145
131
|
return;
|
|
146
132
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
function drawPlugin(context, plugin, delta) {
|
|
150
|
-
if (!plugin.draw) {
|
|
133
|
+
const { particle } = data;
|
|
134
|
+
if (!particle.shape) {
|
|
151
135
|
return;
|
|
152
136
|
}
|
|
153
|
-
|
|
137
|
+
drawer.beforeDraw(data);
|
|
154
138
|
}
|
|
155
139
|
function drawParticlePlugin(context, plugin, particle, delta) {
|
|
156
140
|
if (!plugin.drawParticle) {
|
|
@@ -158,11 +142,4 @@
|
|
|
158
142
|
}
|
|
159
143
|
plugin.drawParticle(context, particle, delta);
|
|
160
144
|
}
|
|
161
|
-
function alterHsl(color, type, value) {
|
|
162
|
-
return {
|
|
163
|
-
h: color.h,
|
|
164
|
-
s: color.s,
|
|
165
|
-
l: color.l + (type === AlterType_js_1.AlterType.darken ? -Constants_js_1.lFactor : Constants_js_1.lFactor) * value,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
145
|
});
|
package/umd/Utils/ColorUtils.js
CHANGED
|
@@ -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", "./MathUtils.js", "../Core/Utils/Constants.js", "./TypeUtils.js", "../Enums/AnimationStatus.js", "./Utils.js"], factory);
|
|
7
|
+
define(["require", "exports", "./MathUtils.js", "../Core/Utils/Constants.js", "./TypeUtils.js", "../Enums/Types/AlterType.js", "../Enums/AnimationStatus.js", "./Utils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
exports.getHslAnimationFromHsl = getHslAnimationFromHsl;
|
|
29
29
|
exports.updateColorValue = updateColorValue;
|
|
30
30
|
exports.updateColor = updateColor;
|
|
31
|
+
exports.alterHsl = alterHsl;
|
|
31
32
|
const MathUtils_js_1 = require("./MathUtils.js");
|
|
32
33
|
const Constants_js_1 = require("../Core/Utils/Constants.js");
|
|
33
34
|
const TypeUtils_js_1 = require("./TypeUtils.js");
|
|
35
|
+
const AlterType_js_1 = require("../Enums/Types/AlterType.js");
|
|
34
36
|
const AnimationStatus_js_1 = require("../Enums/AnimationStatus.js");
|
|
35
37
|
const Utils_js_1 = require("./Utils.js");
|
|
36
38
|
const styleCache = new Map(), maxCacheSize = 1000, firstIndex = 0, rgbFixedPrecision = 2, hslFixedPrecision = 2;
|
|
@@ -219,10 +221,10 @@
|
|
|
219
221
|
}
|
|
220
222
|
function colorMix(color1, color2, size1, size2) {
|
|
221
223
|
let rgb1 = color1, rgb2 = color2;
|
|
222
|
-
if (!
|
|
224
|
+
if (!("r" in rgb1)) {
|
|
223
225
|
rgb1 = hslToRgb(color1);
|
|
224
226
|
}
|
|
225
|
-
if (!
|
|
227
|
+
if (!("r" in rgb2)) {
|
|
226
228
|
rgb2 = hslToRgb(color2);
|
|
227
229
|
}
|
|
228
230
|
return {
|
|
@@ -275,27 +277,33 @@
|
|
|
275
277
|
}
|
|
276
278
|
}
|
|
277
279
|
function getHslFromAnimation(animation) {
|
|
278
|
-
return animation
|
|
279
|
-
?
|
|
280
|
+
return animation === undefined
|
|
281
|
+
? undefined
|
|
282
|
+
: {
|
|
280
283
|
h: animation.h.value,
|
|
281
284
|
s: animation.s.value,
|
|
282
285
|
l: animation.l.value,
|
|
283
|
-
}
|
|
284
|
-
: undefined;
|
|
286
|
+
};
|
|
285
287
|
}
|
|
286
288
|
function getHslAnimationFromHsl(hsl, animationOptions, reduceFactor) {
|
|
287
289
|
const resColor = {
|
|
288
290
|
h: {
|
|
289
291
|
enable: false,
|
|
290
292
|
value: hsl.h,
|
|
293
|
+
min: Constants_js_1.hMin,
|
|
294
|
+
max: Constants_js_1.hMax,
|
|
291
295
|
},
|
|
292
296
|
s: {
|
|
293
297
|
enable: false,
|
|
294
298
|
value: hsl.s,
|
|
299
|
+
min: Constants_js_1.sMin,
|
|
300
|
+
max: Constants_js_1.sMax,
|
|
295
301
|
},
|
|
296
302
|
l: {
|
|
297
303
|
enable: false,
|
|
298
304
|
value: hsl.l,
|
|
305
|
+
min: Constants_js_1.lMin,
|
|
306
|
+
max: Constants_js_1.lMax,
|
|
299
307
|
},
|
|
300
308
|
};
|
|
301
309
|
if (animationOptions) {
|
|
@@ -307,6 +315,8 @@
|
|
|
307
315
|
}
|
|
308
316
|
function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
309
317
|
colorValue.enable = colorAnimation.enable;
|
|
318
|
+
colorValue.min = colorAnimation.min;
|
|
319
|
+
colorValue.max = colorAnimation.max;
|
|
310
320
|
if (colorValue.enable) {
|
|
311
321
|
colorValue.velocity = ((0, MathUtils_js_1.getRangeValue)(colorAnimation.speed) / Constants_js_1.percentDenominator) * reduceFactor;
|
|
312
322
|
colorValue.decay = Constants_js_1.decayOffset - (0, MathUtils_js_1.getRangeValue)(colorAnimation.decay);
|
|
@@ -326,7 +336,7 @@
|
|
|
326
336
|
colorValue.velocity = Constants_js_1.defaultVelocity;
|
|
327
337
|
}
|
|
328
338
|
}
|
|
329
|
-
function updateColorValue(data,
|
|
339
|
+
function updateColorValue(data, decrease, delta) {
|
|
330
340
|
const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minOffset = 0, velocityFactor = 3.6;
|
|
331
341
|
if (!data.enable ||
|
|
332
342
|
((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
|
|
@@ -339,7 +349,7 @@
|
|
|
339
349
|
if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
|
|
340
350
|
return;
|
|
341
351
|
}
|
|
342
|
-
const offset = data.offset ? (0, MathUtils_js_1.randomInRangeValue)(data.offset) : minOffset, velocity = (data.velocity ?? minVelocity) * delta.factor + offset * velocityFactor, decay = data.decay ?? identity, max =
|
|
352
|
+
const offset = data.offset ? (0, MathUtils_js_1.randomInRangeValue)(data.offset) : minOffset, velocity = (data.velocity ?? minVelocity) * delta.factor + offset * velocityFactor, decay = data.decay ?? identity, max = data.max, min = data.min;
|
|
343
353
|
if (!decrease || data.status === AnimationStatus_js_1.AnimationStatus.increasing) {
|
|
344
354
|
data.value += velocity;
|
|
345
355
|
if (data.value > max) {
|
|
@@ -355,8 +365,7 @@
|
|
|
355
365
|
}
|
|
356
366
|
else {
|
|
357
367
|
data.value -= velocity;
|
|
358
|
-
|
|
359
|
-
if (data.value < minValue) {
|
|
368
|
+
if (data.value < min) {
|
|
360
369
|
data.loops ??= 0;
|
|
361
370
|
data.loops++;
|
|
362
371
|
data.status = AnimationStatus_js_1.AnimationStatus.increasing;
|
|
@@ -371,13 +380,16 @@
|
|
|
371
380
|
if (!color) {
|
|
372
381
|
return;
|
|
373
382
|
}
|
|
374
|
-
const { h, s, l } = color
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
383
|
+
const { h, s, l } = color;
|
|
384
|
+
updateColorValue(h, false, delta);
|
|
385
|
+
updateColorValue(s, true, delta);
|
|
386
|
+
updateColorValue(l, true, delta);
|
|
387
|
+
}
|
|
388
|
+
function alterHsl(color, type, value) {
|
|
389
|
+
return {
|
|
390
|
+
h: color.h,
|
|
391
|
+
s: color.s,
|
|
392
|
+
l: color.l + (type === AlterType_js_1.AlterType.darken ? -Constants_js_1.lFactor : Constants_js_1.lFactor) * value,
|
|
378
393
|
};
|
|
379
|
-
updateColorValue(h, ranges.h, false, delta);
|
|
380
|
-
updateColorValue(s, ranges.s, true, delta);
|
|
381
|
-
updateColorValue(l, ranges.l, true, delta);
|
|
382
394
|
}
|
|
383
395
|
});
|