tsparticles 1.41.4 → 1.42.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/Core/Canvas.js +4 -5
- package/Core/Interfaces/ICoordinates.d.ts +8 -0
- package/Core/Interfaces/IParticleGravity.d.ts +5 -0
- package/Core/Interfaces/IParticleGravity.js +2 -0
- package/Core/Interfaces/index.d.ts +1 -0
- package/Core/Interfaces/index.js +1 -0
- package/Core/Particle.d.ts +3 -1
- package/Core/Particle.js +9 -7
- package/Core/Particles.js +2 -1
- package/Core/Retina.js +7 -7
- package/Core/Utils/ParticlesMover.js +2 -2
- package/Interactions/Particles/Links/LinkInstance.js +1 -1
- package/Options/Classes/AnimatableGradient.d.ts +4 -4
- package/Options/Classes/AnimatableGradient.js +4 -4
- package/Options/Classes/AnimationOptions.d.ts +5 -5
- package/Options/Classes/AnimationOptions.js +3 -2
- package/Options/Classes/ColorAnimation.d.ts +2 -2
- package/Options/Classes/ColorAnimation.js +2 -2
- package/Options/Classes/Particles/Move/Attract.d.ts +2 -2
- package/Options/Classes/Particles/Move/Attract.js +2 -1
- package/Options/Classes/Particles/Move/MoveAngle.d.ts +3 -3
- package/Options/Classes/Particles/Move/MoveAngle.js +3 -2
- package/Options/Classes/Particles/Move/MoveGravity.d.ts +5 -5
- package/Options/Classes/Particles/Move/MoveGravity.js +3 -2
- package/Options/Classes/Particles/Orbit/Orbit.d.ts +4 -4
- package/Options/Classes/Particles/Orbit/Orbit.js +4 -3
- package/Options/Classes/Particles/Repulse/Repulse.d.ts +5 -5
- package/Options/Classes/Particles/Repulse/Repulse.js +5 -4
- package/Options/Classes/Particles/Roll/RollLight.d.ts +2 -2
- package/Options/Classes/Particles/Roll/RollLight.js +2 -1
- package/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +2 -2
- package/Options/Classes/Particles/Rotate/RotateAnimation.js +2 -1
- package/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +2 -2
- package/Options/Classes/Particles/Tilt/TiltAnimation.js +2 -1
- package/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
- package/Options/Classes/Particles/Twinkle/TwinkleValues.js +2 -1
- package/Options/Interfaces/IAnimation.d.ts +3 -2
- package/Options/Interfaces/Particles/Move/IAttract.d.ts +3 -2
- package/Options/Interfaces/Particles/Move/IMoveAngle.d.ts +3 -2
- package/Options/Interfaces/Particles/Move/IMoveGravity.d.ts +3 -2
- package/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +4 -3
- package/Options/Interfaces/Particles/Repulse/IRepulse.d.ts +5 -4
- package/Options/Interfaces/Particles/Roll/IRollLight.d.ts +2 -1
- package/Options/Interfaces/Particles/Rotate/IRotateAnimation.d.ts +2 -1
- package/Options/Interfaces/Particles/Tilt/ITiltAnimation.d.ts +2 -1
- package/Options/Interfaces/Particles/Twinkle/ITwinkleValues.d.ts +3 -2
- package/Plugins/Absorbers/AbsorberInstance.js +1 -1
- package/Plugins/Absorbers/Options/Classes/Absorber.d.ts +2 -2
- package/Plugins/Absorbers/Options/Classes/Absorber.js +8 -4
- package/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +2 -2
- package/Plugins/Emitters/EmitterInstance.js +11 -10
- package/Plugins/Emitters/Options/Classes/Emitter.d.ts +2 -2
- package/Plugins/Emitters/Options/Classes/Emitter.js +8 -5
- package/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +2 -2
- package/Updaters/Angle/AngleUpdater.js +2 -1
- package/Updaters/Opacity/OpacityUpdater.js +3 -2
- package/Updaters/Roll/RollUpdater.js +3 -3
- package/Updaters/Tilt/TiltUpdater.js +1 -1
- package/Utils/ColorUtils.js +1 -1
- package/browser/Core/Canvas.js +5 -6
- package/browser/Core/Interfaces/ICoordinates.d.ts +8 -0
- package/browser/Core/Interfaces/IParticleGravity.d.ts +5 -0
- package/browser/Core/Interfaces/IParticleGravity.js +1 -0
- package/browser/Core/Interfaces/index.d.ts +1 -0
- package/browser/Core/Interfaces/index.js +1 -0
- package/browser/Core/Particle.d.ts +3 -1
- package/browser/Core/Particle.js +9 -7
- package/browser/Core/Particles.js +2 -1
- package/browser/Core/Retina.js +7 -7
- package/browser/Core/Utils/ParticlesMover.js +2 -2
- package/browser/Interactions/Particles/Links/LinkInstance.js +2 -2
- package/browser/Options/Classes/AnimatableGradient.d.ts +4 -4
- package/browser/Options/Classes/AnimatableGradient.js +4 -4
- package/browser/Options/Classes/AnimationOptions.d.ts +5 -5
- package/browser/Options/Classes/AnimationOptions.js +3 -2
- package/browser/Options/Classes/ColorAnimation.d.ts +2 -2
- package/browser/Options/Classes/ColorAnimation.js +2 -2
- package/browser/Options/Classes/Particles/Move/Attract.d.ts +2 -2
- package/browser/Options/Classes/Particles/Move/Attract.js +2 -1
- package/browser/Options/Classes/Particles/Move/MoveAngle.d.ts +3 -3
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +3 -2
- package/browser/Options/Classes/Particles/Move/MoveGravity.d.ts +5 -5
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +3 -2
- package/browser/Options/Classes/Particles/Orbit/Orbit.d.ts +4 -4
- package/browser/Options/Classes/Particles/Orbit/Orbit.js +4 -3
- package/browser/Options/Classes/Particles/Repulse/Repulse.d.ts +5 -5
- package/browser/Options/Classes/Particles/Repulse/Repulse.js +5 -4
- package/browser/Options/Classes/Particles/Roll/RollLight.d.ts +2 -2
- package/browser/Options/Classes/Particles/Roll/RollLight.js +2 -1
- package/browser/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +2 -2
- package/browser/Options/Classes/Particles/Rotate/RotateAnimation.js +2 -1
- package/browser/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +2 -2
- package/browser/Options/Classes/Particles/Tilt/TiltAnimation.js +2 -1
- package/browser/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
- package/browser/Options/Classes/Particles/Twinkle/TwinkleValues.js +2 -1
- package/browser/Options/Interfaces/IAnimation.d.ts +3 -2
- package/browser/Options/Interfaces/Particles/Move/IAttract.d.ts +3 -2
- package/browser/Options/Interfaces/Particles/Move/IMoveAngle.d.ts +3 -2
- package/browser/Options/Interfaces/Particles/Move/IMoveGravity.d.ts +3 -2
- package/browser/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +4 -3
- package/browser/Options/Interfaces/Particles/Repulse/IRepulse.d.ts +5 -4
- package/browser/Options/Interfaces/Particles/Roll/IRollLight.d.ts +2 -1
- package/browser/Options/Interfaces/Particles/Rotate/IRotateAnimation.d.ts +2 -1
- package/browser/Options/Interfaces/Particles/Tilt/ITiltAnimation.d.ts +2 -1
- package/browser/Options/Interfaces/Particles/Twinkle/ITwinkleValues.d.ts +3 -2
- package/browser/Plugins/Absorbers/AbsorberInstance.js +1 -1
- package/browser/Plugins/Absorbers/Options/Classes/Absorber.d.ts +2 -2
- package/browser/Plugins/Absorbers/Options/Classes/Absorber.js +8 -4
- package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +2 -2
- package/browser/Plugins/Emitters/EmitterInstance.js +11 -10
- package/browser/Plugins/Emitters/Options/Classes/Emitter.d.ts +2 -2
- package/browser/Plugins/Emitters/Options/Classes/Emitter.js +8 -5
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +2 -2
- package/browser/Updaters/Angle/AngleUpdater.js +2 -1
- package/browser/Updaters/Opacity/OpacityUpdater.js +3 -2
- package/browser/Updaters/Roll/RollUpdater.js +3 -3
- package/browser/Updaters/Tilt/TiltUpdater.js +1 -1
- package/browser/Utils/ColorUtils.js +2 -2
- package/esm/Core/Canvas.js +5 -6
- package/esm/Core/Interfaces/ICoordinates.d.ts +8 -0
- package/esm/Core/Interfaces/IParticleGravity.d.ts +5 -0
- package/esm/Core/Interfaces/IParticleGravity.js +1 -0
- package/esm/Core/Interfaces/index.d.ts +1 -0
- package/esm/Core/Interfaces/index.js +1 -0
- package/esm/Core/Particle.d.ts +3 -1
- package/esm/Core/Particle.js +9 -7
- package/esm/Core/Particles.js +2 -1
- package/esm/Core/Retina.js +7 -7
- package/esm/Core/Utils/ParticlesMover.js +2 -2
- package/esm/Interactions/Particles/Links/LinkInstance.js +2 -2
- package/esm/Options/Classes/AnimatableGradient.d.ts +4 -4
- package/esm/Options/Classes/AnimatableGradient.js +4 -4
- package/esm/Options/Classes/AnimationOptions.d.ts +5 -5
- package/esm/Options/Classes/AnimationOptions.js +3 -2
- package/esm/Options/Classes/ColorAnimation.d.ts +2 -2
- package/esm/Options/Classes/ColorAnimation.js +2 -2
- package/esm/Options/Classes/Particles/Move/Attract.d.ts +2 -2
- package/esm/Options/Classes/Particles/Move/Attract.js +2 -1
- package/esm/Options/Classes/Particles/Move/MoveAngle.d.ts +3 -3
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +3 -2
- package/esm/Options/Classes/Particles/Move/MoveGravity.d.ts +5 -5
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +3 -2
- package/esm/Options/Classes/Particles/Orbit/Orbit.d.ts +4 -4
- package/esm/Options/Classes/Particles/Orbit/Orbit.js +4 -3
- package/esm/Options/Classes/Particles/Repulse/Repulse.d.ts +5 -5
- package/esm/Options/Classes/Particles/Repulse/Repulse.js +5 -4
- package/esm/Options/Classes/Particles/Roll/RollLight.d.ts +2 -2
- package/esm/Options/Classes/Particles/Roll/RollLight.js +2 -1
- package/esm/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +2 -2
- package/esm/Options/Classes/Particles/Rotate/RotateAnimation.js +2 -1
- package/esm/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +2 -2
- package/esm/Options/Classes/Particles/Tilt/TiltAnimation.js +2 -1
- package/esm/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
- package/esm/Options/Classes/Particles/Twinkle/TwinkleValues.js +2 -1
- package/esm/Options/Interfaces/IAnimation.d.ts +3 -2
- package/esm/Options/Interfaces/Particles/Move/IAttract.d.ts +3 -2
- package/esm/Options/Interfaces/Particles/Move/IMoveAngle.d.ts +3 -2
- package/esm/Options/Interfaces/Particles/Move/IMoveGravity.d.ts +3 -2
- package/esm/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +4 -3
- package/esm/Options/Interfaces/Particles/Repulse/IRepulse.d.ts +5 -4
- package/esm/Options/Interfaces/Particles/Roll/IRollLight.d.ts +2 -1
- package/esm/Options/Interfaces/Particles/Rotate/IRotateAnimation.d.ts +2 -1
- package/esm/Options/Interfaces/Particles/Tilt/ITiltAnimation.d.ts +2 -1
- package/esm/Options/Interfaces/Particles/Twinkle/ITwinkleValues.d.ts +3 -2
- package/esm/Plugins/Absorbers/AbsorberInstance.js +1 -1
- package/esm/Plugins/Absorbers/Options/Classes/Absorber.d.ts +2 -2
- package/esm/Plugins/Absorbers/Options/Classes/Absorber.js +8 -4
- package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +2 -2
- package/esm/Plugins/Emitters/EmitterInstance.js +11 -10
- package/esm/Plugins/Emitters/Options/Classes/Emitter.d.ts +2 -2
- package/esm/Plugins/Emitters/Options/Classes/Emitter.js +8 -5
- package/esm/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +2 -2
- package/esm/Updaters/Angle/AngleUpdater.js +2 -1
- package/esm/Updaters/Opacity/OpacityUpdater.js +3 -2
- package/esm/Updaters/Roll/RollUpdater.js +3 -3
- package/esm/Updaters/Tilt/TiltUpdater.js +1 -1
- package/esm/Utils/ColorUtils.js +2 -2
- package/package.json +1 -1
- package/report.html +2 -2
- package/report.slim.html +2 -2
- package/scripts/install.js +11 -2
- package/tsparticles.engine.js +47 -47
- package/tsparticles.engine.min.js +2 -2
- package/tsparticles.interaction.external.attract.js +319 -36
- package/tsparticles.interaction.external.attract.min.js +1 -1
- package/tsparticles.interaction.external.bounce.js +319 -36
- package/tsparticles.interaction.external.bounce.min.js +1 -1
- package/tsparticles.interaction.external.bubble.js +319 -36
- package/tsparticles.interaction.external.bubble.min.js +1 -1
- package/tsparticles.interaction.external.connect.js +319 -36
- package/tsparticles.interaction.external.connect.min.js +1 -1
- package/tsparticles.interaction.external.grab.js +319 -36
- package/tsparticles.interaction.external.grab.min.js +1 -1
- package/tsparticles.interaction.external.repulse.js +319 -36
- package/tsparticles.interaction.external.repulse.min.js +1 -1
- package/tsparticles.interaction.external.trail.js +319 -36
- package/tsparticles.interaction.external.trail.min.js +1 -1
- package/tsparticles.interaction.particles.attract.js +319 -36
- package/tsparticles.interaction.particles.attract.min.js +1 -1
- package/tsparticles.interaction.particles.collisions.js +319 -36
- package/tsparticles.interaction.particles.collisions.min.js +1 -1
- package/tsparticles.interaction.particles.links.js +320 -37
- package/tsparticles.interaction.particles.links.min.js +2 -2
- package/tsparticles.js +81 -74
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.min.js +1 -1
- package/tsparticles.plugins.absorbers.js +327 -41
- package/tsparticles.plugins.absorbers.min.js +2 -2
- package/tsparticles.plugins.emitters.js +438 -151
- package/tsparticles.plugins.emitters.min.js +2 -2
- package/tsparticles.plugins.polygonMask.js +319 -36
- package/tsparticles.plugins.polygonMask.min.js +1 -1
- package/tsparticles.shape.circle.min.js +1 -1
- package/tsparticles.shape.image.js +319 -36
- package/tsparticles.shape.image.min.js +1 -1
- package/tsparticles.shape.line.min.js +1 -1
- package/tsparticles.shape.polygon.min.js +1 -1
- package/tsparticles.shape.square.min.js +1 -1
- package/tsparticles.shape.star.min.js +1 -1
- package/tsparticles.shape.text.js +319 -36
- package/tsparticles.shape.text.min.js +1 -1
- package/tsparticles.slim.js +51 -51
- package/tsparticles.slim.min.js +2 -2
- package/tsparticles.updater.angle.js +320 -37
- package/tsparticles.updater.angle.min.js +2 -2
- package/tsparticles.updater.color.js +319 -36
- package/tsparticles.updater.color.min.js +2 -2
- package/tsparticles.updater.life.js +319 -36
- package/tsparticles.updater.life.min.js +1 -1
- package/tsparticles.updater.opacity.js +321 -38
- package/tsparticles.updater.opacity.min.js +2 -2
- package/tsparticles.updater.outModes.js +319 -36
- package/tsparticles.updater.outModes.min.js +1 -1
- package/tsparticles.updater.roll.js +322 -39
- package/tsparticles.updater.roll.min.js +2 -2
- package/tsparticles.updater.size.js +319 -36
- package/tsparticles.updater.size.min.js +1 -1
- package/tsparticles.updater.strokeColor.js +319 -36
- package/tsparticles.updater.strokeColor.min.js +2 -2
- package/tsparticles.updater.tilt.js +320 -37
- package/tsparticles.updater.tilt.min.js +2 -2
- package/tsparticles.updater.wobble.js +319 -36
- package/tsparticles.updater.wobble.min.js +1 -1
- package/umd/Core/Canvas.js +4 -5
- package/umd/Core/Interfaces/ICoordinates.d.ts +8 -0
- package/umd/Core/Interfaces/IParticleGravity.d.ts +5 -0
- package/umd/Core/Interfaces/IParticleGravity.js +12 -0
- package/umd/Core/Interfaces/index.d.ts +1 -0
- package/umd/Core/Interfaces/index.js +2 -1
- package/umd/Core/Particle.d.ts +3 -1
- package/umd/Core/Particle.js +9 -7
- package/umd/Core/Particles.js +2 -1
- package/umd/Core/Retina.js +7 -7
- package/umd/Core/Utils/ParticlesMover.js +2 -2
- package/umd/Interactions/Particles/Links/LinkInstance.js +1 -1
- package/umd/Options/Classes/AnimatableGradient.d.ts +4 -4
- package/umd/Options/Classes/AnimatableGradient.js +4 -4
- package/umd/Options/Classes/AnimationOptions.d.ts +5 -5
- package/umd/Options/Classes/AnimationOptions.js +4 -3
- package/umd/Options/Classes/ColorAnimation.d.ts +2 -2
- package/umd/Options/Classes/ColorAnimation.js +2 -2
- package/umd/Options/Classes/Particles/Move/Attract.d.ts +2 -2
- package/umd/Options/Classes/Particles/Move/Attract.js +3 -2
- package/umd/Options/Classes/Particles/Move/MoveAngle.d.ts +3 -3
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +4 -3
- package/umd/Options/Classes/Particles/Move/MoveGravity.d.ts +5 -5
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -3
- package/umd/Options/Classes/Particles/Orbit/Orbit.d.ts +4 -4
- package/umd/Options/Classes/Particles/Orbit/Orbit.js +5 -4
- package/umd/Options/Classes/Particles/Repulse/Repulse.d.ts +5 -5
- package/umd/Options/Classes/Particles/Repulse/Repulse.js +6 -5
- package/umd/Options/Classes/Particles/Roll/RollLight.d.ts +2 -2
- package/umd/Options/Classes/Particles/Roll/RollLight.js +3 -2
- package/umd/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +2 -2
- package/umd/Options/Classes/Particles/Rotate/RotateAnimation.js +3 -2
- package/umd/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +2 -2
- package/umd/Options/Classes/Particles/Tilt/TiltAnimation.js +3 -2
- package/umd/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
- package/umd/Options/Classes/Particles/Twinkle/TwinkleValues.js +3 -2
- package/umd/Options/Interfaces/IAnimation.d.ts +3 -2
- package/umd/Options/Interfaces/Particles/Move/IAttract.d.ts +3 -2
- package/umd/Options/Interfaces/Particles/Move/IMoveAngle.d.ts +3 -2
- package/umd/Options/Interfaces/Particles/Move/IMoveGravity.d.ts +3 -2
- package/umd/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +4 -3
- package/umd/Options/Interfaces/Particles/Repulse/IRepulse.d.ts +5 -4
- package/umd/Options/Interfaces/Particles/Roll/IRollLight.d.ts +2 -1
- package/umd/Options/Interfaces/Particles/Rotate/IRotateAnimation.d.ts +2 -1
- package/umd/Options/Interfaces/Particles/Tilt/ITiltAnimation.d.ts +2 -1
- package/umd/Options/Interfaces/Particles/Twinkle/ITwinkleValues.d.ts +3 -2
- package/umd/Plugins/Absorbers/AbsorberInstance.js +1 -1
- package/umd/Plugins/Absorbers/Options/Classes/Absorber.d.ts +2 -2
- package/umd/Plugins/Absorbers/Options/Classes/Absorber.js +9 -5
- package/umd/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +2 -2
- package/umd/Plugins/Emitters/EmitterInstance.js +11 -10
- package/umd/Plugins/Emitters/Options/Classes/Emitter.d.ts +2 -2
- package/umd/Plugins/Emitters/Options/Classes/Emitter.js +9 -6
- package/umd/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +2 -2
- package/umd/Updaters/Angle/AngleUpdater.js +2 -1
- package/umd/Updaters/Opacity/OpacityUpdater.js +3 -2
- package/umd/Updaters/Roll/RollUpdater.js +3 -3
- package/umd/Updaters/Tilt/TiltUpdater.js +1 -1
- package/umd/Utils/ColorUtils.js +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../Utils";
|
|
1
2
|
export class AnimationOptions {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.count = 0;
|
|
@@ -10,13 +11,13 @@ export class AnimationOptions {
|
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
13
|
if (data.count !== undefined) {
|
|
13
|
-
this.count = data.count;
|
|
14
|
+
this.count = setRangeValue(data.count);
|
|
14
15
|
}
|
|
15
16
|
if (data.enable !== undefined) {
|
|
16
17
|
this.enable = data.enable;
|
|
17
18
|
}
|
|
18
19
|
if (data.speed !== undefined) {
|
|
19
|
-
this.speed = data.speed;
|
|
20
|
+
this.speed = setRangeValue(data.speed);
|
|
20
21
|
}
|
|
21
22
|
if (data.sync !== undefined) {
|
|
22
23
|
this.sync = data.sync;
|
|
@@ -2,10 +2,10 @@ import type { RangeValue, RecursivePartial } from "../../Types";
|
|
|
2
2
|
import type { IColorAnimation } from "../Interfaces/IColorAnimation";
|
|
3
3
|
import type { IOptionLoader } from "../Interfaces/IOptionLoader";
|
|
4
4
|
export declare class ColorAnimation implements IColorAnimation, IOptionLoader<IColorAnimation> {
|
|
5
|
-
count:
|
|
5
|
+
count: RangeValue;
|
|
6
6
|
enable: boolean;
|
|
7
7
|
offset: RangeValue;
|
|
8
|
-
speed:
|
|
8
|
+
speed: RangeValue;
|
|
9
9
|
sync: boolean;
|
|
10
10
|
constructor();
|
|
11
11
|
load(data?: RecursivePartial<IColorAnimation>): void;
|
|
@@ -12,7 +12,7 @@ export class ColorAnimation {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
if (data.count !== undefined) {
|
|
15
|
-
this.count = data.count;
|
|
15
|
+
this.count = setRangeValue(data.count);
|
|
16
16
|
}
|
|
17
17
|
if (data.enable !== undefined) {
|
|
18
18
|
this.enable = data.enable;
|
|
@@ -21,7 +21,7 @@ export class ColorAnimation {
|
|
|
21
21
|
this.offset = setRangeValue(data.offset);
|
|
22
22
|
}
|
|
23
23
|
if (data.speed !== undefined) {
|
|
24
|
-
this.speed = data.speed;
|
|
24
|
+
this.speed = setRangeValue(data.speed);
|
|
25
25
|
}
|
|
26
26
|
if (data.sync !== undefined) {
|
|
27
27
|
this.sync = data.sync;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IAttract } from "../../../Interfaces/Particles/Move/IAttract";
|
|
2
3
|
import type { ICoordinates } from "../../../../Core";
|
|
3
4
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
4
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
5
5
|
export declare class Attract implements IAttract, IOptionLoader<IAttract> {
|
|
6
6
|
get rotateX(): number;
|
|
7
7
|
set rotateX(value: number);
|
|
8
8
|
get rotateY(): number;
|
|
9
9
|
set rotateY(value: number);
|
|
10
|
-
distance:
|
|
10
|
+
distance: RangeValue;
|
|
11
11
|
enable: boolean;
|
|
12
12
|
rotate: ICoordinates;
|
|
13
13
|
constructor();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../../../Utils";
|
|
1
2
|
export class Attract {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.distance = 200;
|
|
@@ -25,7 +26,7 @@ export class Attract {
|
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
28
|
if (data.distance !== undefined) {
|
|
28
|
-
this.distance = data.distance;
|
|
29
|
+
this.distance = setRangeValue(data.distance);
|
|
29
30
|
}
|
|
30
31
|
if (data.enable !== undefined) {
|
|
31
32
|
this.enable = data.enable;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IMoveAngle } from "../../../Interfaces/Particles/Move/IMoveAngle";
|
|
2
3
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
3
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
4
4
|
export declare class MoveAngle implements IMoveAngle, IOptionLoader<IMoveAngle> {
|
|
5
|
-
offset:
|
|
6
|
-
value:
|
|
5
|
+
offset: RangeValue;
|
|
6
|
+
value: RangeValue;
|
|
7
7
|
constructor();
|
|
8
8
|
load(data?: RecursivePartial<IMoveAngle>): void;
|
|
9
9
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../../../Utils";
|
|
1
2
|
export class MoveAngle {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.offset = 0;
|
|
@@ -8,10 +9,10 @@ export class MoveAngle {
|
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
11
|
if (data.offset !== undefined) {
|
|
11
|
-
this.offset = data.offset;
|
|
12
|
+
this.offset = setRangeValue(data.offset);
|
|
12
13
|
}
|
|
13
14
|
if (data.value !== undefined) {
|
|
14
|
-
this.value = data.value;
|
|
15
|
+
this.value = setRangeValue(data.value);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
2
|
+
import type { IMoveGravity } from "../../../Interfaces/Particles/Move/IMoveGravity";
|
|
3
|
+
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
4
4
|
export declare class MoveGravity implements IMoveGravity, IOptionLoader<IMoveGravity> {
|
|
5
|
-
acceleration:
|
|
5
|
+
acceleration: RangeValue;
|
|
6
6
|
enable: boolean;
|
|
7
7
|
inverse: boolean;
|
|
8
|
-
maxSpeed:
|
|
8
|
+
maxSpeed: RangeValue;
|
|
9
9
|
constructor();
|
|
10
10
|
load(data?: RecursivePartial<IMoveGravity>): void;
|
|
11
11
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../../../Utils";
|
|
1
2
|
export class MoveGravity {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.acceleration = 9.81;
|
|
@@ -10,7 +11,7 @@ export class MoveGravity {
|
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
13
|
if (data.acceleration !== undefined) {
|
|
13
|
-
this.acceleration = data.acceleration;
|
|
14
|
+
this.acceleration = setRangeValue(data.acceleration);
|
|
14
15
|
}
|
|
15
16
|
if (data.enable !== undefined) {
|
|
16
17
|
this.enable = data.enable;
|
|
@@ -19,7 +20,7 @@ export class MoveGravity {
|
|
|
19
20
|
this.inverse = data.inverse;
|
|
20
21
|
}
|
|
21
22
|
if (data.maxSpeed !== undefined) {
|
|
22
|
-
this.maxSpeed = data.maxSpeed;
|
|
23
|
+
this.maxSpeed = setRangeValue(data.maxSpeed);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import { AnimationOptions } from "../../AnimationOptions";
|
|
2
3
|
import type { IAnimatable } from "../../../Interfaces/IAnimatable";
|
|
3
4
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
4
5
|
import type { IOrbit } from "../../../Interfaces/Particles/Orbit/IOrbit";
|
|
5
6
|
import { OptionsColor } from "../../OptionsColor";
|
|
6
7
|
import { OrbitRotation } from "./OrbitRotation";
|
|
7
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
8
8
|
export declare class Orbit implements IOrbit, IOptionLoader<IOrbit>, IAnimatable<AnimationOptions> {
|
|
9
9
|
animation: AnimationOptions;
|
|
10
10
|
enable: boolean;
|
|
11
|
-
opacity:
|
|
12
|
-
width:
|
|
11
|
+
opacity: RangeValue;
|
|
12
|
+
width: RangeValue;
|
|
13
13
|
color?: OptionsColor;
|
|
14
|
-
radius?:
|
|
14
|
+
radius?: RangeValue;
|
|
15
15
|
rotation: OrbitRotation;
|
|
16
16
|
constructor();
|
|
17
17
|
load(data?: RecursivePartial<IOrbit>): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnimationOptions } from "../../AnimationOptions";
|
|
2
2
|
import { OptionsColor } from "../../OptionsColor";
|
|
3
3
|
import { OrbitRotation } from "./OrbitRotation";
|
|
4
|
+
import { setRangeValue } from "../../../../Utils";
|
|
4
5
|
export class Orbit {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.animation = new AnimationOptions();
|
|
@@ -19,13 +20,13 @@ export class Orbit {
|
|
|
19
20
|
this.enable = data.enable;
|
|
20
21
|
}
|
|
21
22
|
if (data.opacity !== undefined) {
|
|
22
|
-
this.opacity = data.opacity;
|
|
23
|
+
this.opacity = setRangeValue(data.opacity);
|
|
23
24
|
}
|
|
24
25
|
if (data.width !== undefined) {
|
|
25
|
-
this.width = data.width;
|
|
26
|
+
this.width = setRangeValue(data.width);
|
|
26
27
|
}
|
|
27
28
|
if (data.radius !== undefined) {
|
|
28
|
-
this.radius = data.radius;
|
|
29
|
+
this.radius = setRangeValue(data.radius);
|
|
29
30
|
}
|
|
30
31
|
if (data.color !== undefined) {
|
|
31
32
|
this.color = OptionsColor.create(this.color, data.color);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
2
3
|
import type { IRepulse } from "../../../Interfaces/Particles/Repulse/IRepulse";
|
|
3
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
4
4
|
import { ValueWithRandom } from "../../ValueWithRandom";
|
|
5
5
|
export declare class Repulse extends ValueWithRandom implements IRepulse, IOptionLoader<IRepulse> {
|
|
6
6
|
enabled: boolean;
|
|
7
|
-
distance:
|
|
8
|
-
duration:
|
|
9
|
-
factor:
|
|
10
|
-
speed:
|
|
7
|
+
distance: RangeValue;
|
|
8
|
+
duration: RangeValue;
|
|
9
|
+
factor: RangeValue;
|
|
10
|
+
speed: RangeValue;
|
|
11
11
|
constructor();
|
|
12
12
|
load(data?: RecursivePartial<IRepulse>): void;
|
|
13
13
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ValueWithRandom } from "../../ValueWithRandom";
|
|
2
|
+
import { setRangeValue } from "../../../../Utils";
|
|
2
3
|
export class Repulse extends ValueWithRandom {
|
|
3
4
|
constructor() {
|
|
4
5
|
super();
|
|
@@ -17,16 +18,16 @@ export class Repulse extends ValueWithRandom {
|
|
|
17
18
|
this.enabled = data.enabled;
|
|
18
19
|
}
|
|
19
20
|
if (data.distance !== undefined) {
|
|
20
|
-
this.distance = data.distance;
|
|
21
|
+
this.distance = setRangeValue(data.distance);
|
|
21
22
|
}
|
|
22
23
|
if (data.duration !== undefined) {
|
|
23
|
-
this.duration = data.duration;
|
|
24
|
+
this.duration = setRangeValue(data.duration);
|
|
24
25
|
}
|
|
25
26
|
if (data.factor !== undefined) {
|
|
26
|
-
this.factor = data.factor;
|
|
27
|
+
this.factor = setRangeValue(data.factor);
|
|
27
28
|
}
|
|
28
29
|
if (data.speed !== undefined) {
|
|
29
|
-
this.speed = data.speed;
|
|
30
|
+
this.speed = setRangeValue(data.speed);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
2
3
|
import type { IRollLight } from "../../../Interfaces/Particles/Roll/IRollLight";
|
|
3
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
4
4
|
export declare class RollLight implements IRollLight, IOptionLoader<IRollLight> {
|
|
5
5
|
enable: boolean;
|
|
6
|
-
value:
|
|
6
|
+
value: RangeValue;
|
|
7
7
|
constructor();
|
|
8
8
|
load(data?: RecursivePartial<IRollLight>): void;
|
|
9
9
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../../../Utils";
|
|
1
2
|
export class RollLight {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.enable = false;
|
|
@@ -11,7 +12,7 @@ export class RollLight {
|
|
|
11
12
|
this.enable = data.enable;
|
|
12
13
|
}
|
|
13
14
|
if (data.value !== undefined) {
|
|
14
|
-
this.value = data.value;
|
|
15
|
+
this.value = setRangeValue(data.value);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
2
3
|
import type { IRotateAnimation } from "../../../Interfaces/Particles/Rotate/IRotateAnimation";
|
|
3
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
4
4
|
export declare class RotateAnimation implements IRotateAnimation, IOptionLoader<IRotateAnimation> {
|
|
5
5
|
enable: boolean;
|
|
6
|
-
speed:
|
|
6
|
+
speed: RangeValue;
|
|
7
7
|
sync: boolean;
|
|
8
8
|
constructor();
|
|
9
9
|
load(data?: RecursivePartial<IRotateAnimation>): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../../../Utils";
|
|
1
2
|
export class RotateAnimation {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.enable = false;
|
|
@@ -12,7 +13,7 @@ export class RotateAnimation {
|
|
|
12
13
|
this.enable = data.enable;
|
|
13
14
|
}
|
|
14
15
|
if (data.speed !== undefined) {
|
|
15
|
-
this.speed = data.speed;
|
|
16
|
+
this.speed = setRangeValue(data.speed);
|
|
16
17
|
}
|
|
17
18
|
if (data.sync !== undefined) {
|
|
18
19
|
this.sync = data.sync;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
2
3
|
import type { ITiltAnimation } from "../../../Interfaces/Particles/Tilt/ITiltAnimation";
|
|
3
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
4
4
|
export declare class TiltAnimation implements ITiltAnimation, IOptionLoader<ITiltAnimation> {
|
|
5
5
|
enable: boolean;
|
|
6
|
-
speed:
|
|
6
|
+
speed: RangeValue;
|
|
7
7
|
sync: boolean;
|
|
8
8
|
constructor();
|
|
9
9
|
load(data?: RecursivePartial<ITiltAnimation>): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "../../../../Utils";
|
|
1
2
|
export class TiltAnimation {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.enable = false;
|
|
@@ -12,7 +13,7 @@ export class TiltAnimation {
|
|
|
12
13
|
this.enable = data.enable;
|
|
13
14
|
}
|
|
14
15
|
if (data.speed !== undefined) {
|
|
15
|
-
this.speed = data.speed;
|
|
16
|
+
this.speed = setRangeValue(data.speed);
|
|
16
17
|
}
|
|
17
18
|
if (data.sync !== undefined) {
|
|
18
19
|
this.sync = data.sync;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../../../Types";
|
|
1
2
|
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader";
|
|
2
3
|
import type { ITwinkleValues } from "../../../Interfaces/Particles/Twinkle/ITwinkleValues";
|
|
3
4
|
import { OptionsColor } from "../../OptionsColor";
|
|
4
|
-
import type { RecursivePartial } from "../../../../Types";
|
|
5
5
|
export declare class TwinkleValues implements ITwinkleValues, IOptionLoader<ITwinkleValues> {
|
|
6
6
|
color?: OptionsColor;
|
|
7
7
|
enable: boolean;
|
|
8
8
|
frequency: number;
|
|
9
|
-
opacity:
|
|
9
|
+
opacity: RangeValue;
|
|
10
10
|
constructor();
|
|
11
11
|
load(data?: RecursivePartial<ITwinkleValues>): void;
|
|
12
12
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OptionsColor } from "../../OptionsColor";
|
|
2
|
+
import { setRangeValue } from "../../../../Utils";
|
|
2
3
|
export class TwinkleValues {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.enable = false;
|
|
@@ -19,7 +20,7 @@ export class TwinkleValues {
|
|
|
19
20
|
this.frequency = data.frequency;
|
|
20
21
|
}
|
|
21
22
|
if (data.opacity !== undefined) {
|
|
22
|
-
this.opacity = data.opacity;
|
|
23
|
+
this.opacity = setRangeValue(data.opacity);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ICoordinates } from "../../../../Core
|
|
1
|
+
import type { ICoordinates } from "../../../../Core";
|
|
2
|
+
import type { RangeValue } from "../../../../Types";
|
|
2
3
|
export interface IAttract {
|
|
3
|
-
distance:
|
|
4
|
+
distance: RangeValue;
|
|
4
5
|
enable: boolean;
|
|
5
6
|
rotateX: number;
|
|
6
7
|
rotateY: number;
|
|
@@ -2,11 +2,12 @@ import type { IAnimatable } from "../../IAnimatable";
|
|
|
2
2
|
import type { IAnimation } from "../../IAnimation";
|
|
3
3
|
import type { IColor } from "../../../../Core";
|
|
4
4
|
import type { IValueWithRandom } from "../../IValueWithRandom";
|
|
5
|
+
import type { RangeValue } from "../../../../Types";
|
|
5
6
|
export interface IOrbit extends IAnimatable<IAnimation> {
|
|
6
7
|
color?: string | IColor;
|
|
7
8
|
enable: boolean;
|
|
8
|
-
radius?:
|
|
9
|
+
radius?: RangeValue;
|
|
9
10
|
rotation: IValueWithRandom;
|
|
10
|
-
opacity:
|
|
11
|
-
width:
|
|
11
|
+
opacity: RangeValue;
|
|
12
|
+
width: RangeValue;
|
|
12
13
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IValueWithRandom } from "../../IValueWithRandom";
|
|
2
|
+
import type { RangeValue } from "../../../../Types";
|
|
2
3
|
export interface IRepulse extends IValueWithRandom {
|
|
3
4
|
enabled: boolean;
|
|
4
|
-
distance:
|
|
5
|
-
duration:
|
|
6
|
-
factor:
|
|
7
|
-
speed:
|
|
5
|
+
distance: RangeValue;
|
|
6
|
+
duration: RangeValue;
|
|
7
|
+
factor: RangeValue;
|
|
8
|
+
speed: RangeValue;
|
|
8
9
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { IColor } from "../../../../Core
|
|
1
|
+
import type { IColor } from "../../../../Core";
|
|
2
|
+
import type { RangeValue } from "../../../../Types";
|
|
2
3
|
export interface ITwinkleValues {
|
|
3
4
|
color?: string | IColor;
|
|
4
5
|
enable: boolean;
|
|
5
6
|
frequency: number;
|
|
6
|
-
opacity:
|
|
7
|
+
opacity: RangeValue;
|
|
7
8
|
}
|
|
@@ -102,7 +102,7 @@ export class AbsorberInstance {
|
|
|
102
102
|
var _a, _b;
|
|
103
103
|
const container = this.container;
|
|
104
104
|
const percentPosition = this.options.position;
|
|
105
|
-
return Vector.create((((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width, (((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height);
|
|
105
|
+
return Vector.create((getRangeValue((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width, (getRangeValue((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height);
|
|
106
106
|
}
|
|
107
107
|
updateParticlePosition(particle, v) {
|
|
108
108
|
var _a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbsorberSize } from "./AbsorberSize";
|
|
2
2
|
import type { IAbsorber } from "../Interfaces/IAbsorber";
|
|
3
|
-
import type { ICoordinates } from "../../../../Core";
|
|
4
3
|
import type { IOptionLoader } from "../../../../Options/Interfaces/IOptionLoader";
|
|
4
|
+
import type { IRangedCoordinates } from "../../../../Core";
|
|
5
5
|
import { OptionsColor } from "../../../../Options/Classes/OptionsColor";
|
|
6
6
|
import type { RecursivePartial } from "../../../../Types";
|
|
7
7
|
export declare class Absorber implements IAbsorber, IOptionLoader<IAbsorber> {
|
|
@@ -9,7 +9,7 @@ export declare class Absorber implements IAbsorber, IOptionLoader<IAbsorber> {
|
|
|
9
9
|
draggable: boolean;
|
|
10
10
|
name?: string;
|
|
11
11
|
opacity: number;
|
|
12
|
-
position?: RecursivePartial<
|
|
12
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
13
13
|
size: AbsorberSize;
|
|
14
14
|
destroy: boolean;
|
|
15
15
|
orbits: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbsorberSize } from "./AbsorberSize";
|
|
2
2
|
import { OptionsColor } from "../../../../Options/Classes/OptionsColor";
|
|
3
|
+
import { setRangeValue } from "../../../../Utils";
|
|
3
4
|
export class Absorber {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.color = new OptionsColor();
|
|
@@ -25,10 +26,13 @@ export class Absorber {
|
|
|
25
26
|
this.opacity = data.opacity;
|
|
26
27
|
}
|
|
27
28
|
if (data.position !== undefined) {
|
|
28
|
-
this.position = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
29
|
+
this.position = {};
|
|
30
|
+
if (data.position.x !== undefined) {
|
|
31
|
+
this.position.x = setRangeValue(data.position.x);
|
|
32
|
+
}
|
|
33
|
+
if (data.position.y !== undefined) {
|
|
34
|
+
this.position.y = setRangeValue(data.position.y);
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
if (data.size !== undefined) {
|
|
34
38
|
this.size.load(data.size);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { IColor,
|
|
1
|
+
import type { IColor, IRangedCoordinates } from "../../../../Core";
|
|
2
2
|
import type { IAbsorberSize } from "./IAbsorberSize";
|
|
3
3
|
import { RecursivePartial } from "../../../../Types";
|
|
4
4
|
export interface IAbsorber {
|
|
5
5
|
color: IColor | string;
|
|
6
6
|
name?: string;
|
|
7
7
|
opacity: number;
|
|
8
|
-
position?: RecursivePartial<
|
|
8
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
9
9
|
size: IAbsorberSize;
|
|
10
10
|
draggable: boolean;
|
|
11
11
|
destroy: boolean;
|
|
@@ -15,8 +15,8 @@ import { Emitter } from "./Options/Classes/Emitter";
|
|
|
15
15
|
import { EmitterSize } from "./Options/Classes/EmitterSize";
|
|
16
16
|
export class EmitterInstance {
|
|
17
17
|
constructor(engine, emitters, container, options, position) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f;
|
|
19
|
-
var
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
|
+
var _h;
|
|
20
20
|
this.emitters = emitters;
|
|
21
21
|
this.container = container;
|
|
22
22
|
_EmitterInstance_firstSpawn.set(this, void 0);
|
|
@@ -35,22 +35,23 @@ export class EmitterInstance {
|
|
|
35
35
|
this.options.load(options);
|
|
36
36
|
}
|
|
37
37
|
this.spawnDelay = (((_a = this.options.life.delay) !== null && _a !== void 0 ? _a : 0) * 1000) / this.container.retina.reduceFactor;
|
|
38
|
+
this.position = (_b = this.initialPosition) !== null && _b !== void 0 ? _b : this.calcPosition();
|
|
38
39
|
this.name = this.options.name;
|
|
39
|
-
this.shape = (
|
|
40
|
+
this.shape = (_c = __classPrivateFieldGet(this, _EmitterInstance_engine, "f").emitterShapeManager) === null || _c === void 0 ? void 0 : _c.getShape(this.options.shape);
|
|
40
41
|
this.fill = this.options.fill;
|
|
41
42
|
__classPrivateFieldSet(this, _EmitterInstance_firstSpawn, !this.options.life.wait, "f");
|
|
42
43
|
__classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, false, "f");
|
|
43
44
|
let particlesOptions = deepExtend({}, this.options.particles);
|
|
44
45
|
particlesOptions !== null && particlesOptions !== void 0 ? particlesOptions : (particlesOptions = {});
|
|
45
|
-
(
|
|
46
|
-
(
|
|
46
|
+
(_d = particlesOptions.move) !== null && _d !== void 0 ? _d : (particlesOptions.move = {});
|
|
47
|
+
(_e = (_h = particlesOptions.move).direction) !== null && _e !== void 0 ? _e : (_h.direction = this.options.direction);
|
|
47
48
|
if (this.options.spawnColor) {
|
|
48
49
|
this.spawnColor = colorToHsl(this.options.spawnColor);
|
|
49
50
|
}
|
|
50
51
|
this.paused = !this.options.autoPlay;
|
|
51
52
|
this.particlesOptions = particlesOptions;
|
|
52
53
|
this.size =
|
|
53
|
-
(
|
|
54
|
+
(_f = this.options.size) !== null && _f !== void 0 ? _f : (() => {
|
|
54
55
|
const size = new EmitterSize();
|
|
55
56
|
size.load({
|
|
56
57
|
height: 0,
|
|
@@ -59,7 +60,7 @@ export class EmitterInstance {
|
|
|
59
60
|
});
|
|
60
61
|
return size;
|
|
61
62
|
})();
|
|
62
|
-
this.lifeCount = (
|
|
63
|
+
this.lifeCount = (_g = this.options.life.count) !== null && _g !== void 0 ? _g : -1;
|
|
63
64
|
this.immortal = this.lifeCount <= 0;
|
|
64
65
|
this.play();
|
|
65
66
|
}
|
|
@@ -207,8 +208,8 @@ export class EmitterInstance {
|
|
|
207
208
|
const container = this.container;
|
|
208
209
|
const percentPosition = this.options.position;
|
|
209
210
|
return {
|
|
210
|
-
x: (((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width,
|
|
211
|
-
y: (((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height,
|
|
211
|
+
x: (getRangeValue((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width,
|
|
212
|
+
y: (getRangeValue((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height,
|
|
212
213
|
};
|
|
213
214
|
}
|
|
214
215
|
emit() {
|
|
@@ -257,7 +258,7 @@ export class EmitterInstance {
|
|
|
257
258
|
const colorOffset = randomInRange(animation.offset);
|
|
258
259
|
const delay = getRangeValue(this.options.rate.delay);
|
|
259
260
|
const emitFactor = (1000 * delay) / container.retina.reduceFactor;
|
|
260
|
-
const colorSpeed = (_a = animation.speed) !== null && _a !== void 0 ? _a : 0;
|
|
261
|
+
const colorSpeed = getRangeValue((_a = animation.speed) !== null && _a !== void 0 ? _a : 0);
|
|
261
262
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * 3.6) % maxValue;
|
|
262
263
|
}
|
|
263
264
|
}
|