tsparticles 1.41.6 → 1.42.2
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.d.ts +1 -1
- package/Core/Canvas.js +8 -4
- 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 +2 -1
- package/Core/Particle.js +8 -7
- 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 +3 -3
- 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.d.ts +1 -1
- package/browser/Core/Canvas.js +9 -5
- 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 +2 -1
- package/browser/Core/Particle.js +8 -7
- 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 +3 -3
- 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.d.ts +1 -1
- package/esm/Core/Canvas.js +9 -5
- 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 +2 -1
- package/esm/Core/Particle.js +8 -7
- 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 +3 -3
- 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 +15 -3
- package/report.html +2 -2
- package/report.slim.html +2 -2
- package/scripts/install.js +11 -2
- package/tsparticles.engine.js +48 -45
- package/tsparticles.engine.min.js +2 -2
- package/tsparticles.interaction.external.attract.js +320 -34
- package/tsparticles.interaction.external.attract.min.js +1 -1
- package/tsparticles.interaction.external.bounce.js +320 -34
- package/tsparticles.interaction.external.bounce.min.js +1 -1
- package/tsparticles.interaction.external.bubble.js +320 -34
- package/tsparticles.interaction.external.bubble.min.js +1 -1
- package/tsparticles.interaction.external.connect.js +320 -34
- package/tsparticles.interaction.external.connect.min.js +1 -1
- package/tsparticles.interaction.external.grab.js +320 -34
- package/tsparticles.interaction.external.grab.min.js +1 -1
- package/tsparticles.interaction.external.repulse.js +320 -34
- package/tsparticles.interaction.external.repulse.min.js +1 -1
- package/tsparticles.interaction.external.trail.js +320 -34
- package/tsparticles.interaction.external.trail.min.js +1 -1
- package/tsparticles.interaction.particles.attract.js +320 -34
- package/tsparticles.interaction.particles.attract.min.js +1 -1
- package/tsparticles.interaction.particles.collisions.js +320 -34
- package/tsparticles.interaction.particles.collisions.min.js +1 -1
- package/tsparticles.interaction.particles.links.js +321 -35
- package/tsparticles.interaction.particles.links.min.js +2 -2
- package/tsparticles.js +74 -65
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.min.js +1 -1
- package/tsparticles.plugins.absorbers.js +328 -39
- package/tsparticles.plugins.absorbers.min.js +2 -2
- package/tsparticles.plugins.emitters.js +431 -142
- package/tsparticles.plugins.emitters.min.js +2 -2
- package/tsparticles.plugins.polygonMask.js +320 -34
- package/tsparticles.plugins.polygonMask.min.js +1 -1
- package/tsparticles.shape.circle.min.js +1 -1
- package/tsparticles.shape.image.js +320 -34
- 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 +320 -34
- package/tsparticles.shape.text.min.js +1 -1
- package/tsparticles.slim.js +52 -49
- package/tsparticles.slim.min.js +2 -2
- package/tsparticles.updater.angle.js +321 -35
- package/tsparticles.updater.angle.min.js +2 -2
- package/tsparticles.updater.color.js +320 -34
- package/tsparticles.updater.color.min.js +2 -2
- package/tsparticles.updater.life.js +320 -34
- package/tsparticles.updater.life.min.js +1 -1
- package/tsparticles.updater.opacity.js +322 -36
- package/tsparticles.updater.opacity.min.js +2 -2
- package/tsparticles.updater.outModes.js +320 -34
- package/tsparticles.updater.outModes.min.js +1 -1
- package/tsparticles.updater.roll.js +323 -37
- package/tsparticles.updater.roll.min.js +2 -2
- package/tsparticles.updater.size.js +320 -34
- package/tsparticles.updater.size.min.js +1 -1
- package/tsparticles.updater.strokeColor.js +320 -34
- package/tsparticles.updater.strokeColor.min.js +2 -2
- package/tsparticles.updater.tilt.js +321 -35
- package/tsparticles.updater.tilt.min.js +2 -2
- package/tsparticles.updater.wobble.js +320 -34
- package/tsparticles.updater.wobble.min.js +1 -1
- package/umd/Core/Canvas.d.ts +1 -1
- package/umd/Core/Canvas.js +8 -4
- 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 +2 -1
- package/umd/Core/Particle.js +8 -7
- 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 +3 -3
- 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,5 +1,6 @@
|
|
|
1
1
|
import { AbsorberSize } from "./AbsorberSize";
|
|
2
2
|
import { OptionsColor } from "../../../../Options/Classes/OptionsColor";
|
|
3
|
+
import { setRangeValue } from "../../../../Utils";
|
|
3
4
|
/**
|
|
4
5
|
* [[include:Options/Plugins/Absorbers.md]]
|
|
5
6
|
* @category Absorbers Plugin
|
|
@@ -29,10 +30,13 @@ export class Absorber {
|
|
|
29
30
|
this.opacity = data.opacity;
|
|
30
31
|
}
|
|
31
32
|
if (data.position !== undefined) {
|
|
32
|
-
this.position = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
this.position = {};
|
|
34
|
+
if (data.position.x !== undefined) {
|
|
35
|
+
this.position.x = setRangeValue(data.position.x);
|
|
36
|
+
}
|
|
37
|
+
if (data.position.y !== undefined) {
|
|
38
|
+
this.position.y = setRangeValue(data.position.y);
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
if (data.size !== undefined) {
|
|
38
42
|
this.size.load(data.size);
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
/**
|
|
@@ -22,7 +22,7 @@ export interface IAbsorber {
|
|
|
22
22
|
/**
|
|
23
23
|
* Absorber position, percent values calculated on canvas size
|
|
24
24
|
*/
|
|
25
|
-
position?: RecursivePartial<
|
|
25
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
26
26
|
/**
|
|
27
27
|
* Absorber size, these values will be used as pixels
|
|
28
28
|
*/
|
|
@@ -211,8 +211,8 @@ export class EmitterInstance {
|
|
|
211
211
|
const container = this.container;
|
|
212
212
|
const percentPosition = this.options.position;
|
|
213
213
|
return {
|
|
214
|
-
x: (((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width,
|
|
215
|
-
y: (((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height,
|
|
214
|
+
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,
|
|
215
|
+
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,
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
emit() {
|
|
@@ -261,7 +261,7 @@ export class EmitterInstance {
|
|
|
261
261
|
const colorOffset = randomInRange(animation.offset);
|
|
262
262
|
const delay = getRangeValue(this.options.rate.delay);
|
|
263
263
|
const emitFactor = (1000 * delay) / container.retina.reduceFactor;
|
|
264
|
-
const colorSpeed = (_a = animation.speed) !== null && _a !== void 0 ? _a : 0;
|
|
264
|
+
const colorSpeed = getRangeValue((_a = animation.speed) !== null && _a !== void 0 ? _a : 0);
|
|
265
265
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * 3.6) % maxValue;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -4,10 +4,10 @@ import { EmitterLife } from "./EmitterLife";
|
|
|
4
4
|
import { EmitterRate } from "./EmitterRate";
|
|
5
5
|
import { EmitterShapeType } from "../../Enums";
|
|
6
6
|
import { EmitterSize } from "./EmitterSize";
|
|
7
|
-
import type { ICoordinates } from "../../../../Core";
|
|
8
7
|
import type { IEmitter } from "../Interfaces/IEmitter";
|
|
9
8
|
import type { IOptionLoader } from "../../../../Options/Interfaces/IOptionLoader";
|
|
10
9
|
import type { IParticles } from "../../../../Options/Interfaces/Particles/IParticles";
|
|
10
|
+
import type { IRangedCoordinates } from "../../../../Core";
|
|
11
11
|
import type { RecursivePartial } from "../../../../Types";
|
|
12
12
|
/**
|
|
13
13
|
* [[include:Options/Plugins/Emitters.md]]
|
|
@@ -22,7 +22,7 @@ export declare class Emitter implements IEmitter, IOptionLoader<IEmitter> {
|
|
|
22
22
|
life: EmitterLife;
|
|
23
23
|
name?: string;
|
|
24
24
|
particles?: RecursivePartial<IParticles>;
|
|
25
|
-
position?: RecursivePartial<
|
|
25
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
26
26
|
rate: EmitterRate;
|
|
27
27
|
shape: EmitterShapeType | keyof typeof EmitterShapeType;
|
|
28
28
|
spawnColor?: AnimatableColor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { deepExtend, setRangeValue } from "../../../../Utils";
|
|
1
2
|
import { AnimatableColor } from "../../../../Options/Classes/AnimatableColor";
|
|
2
3
|
import { EmitterLife } from "./EmitterLife";
|
|
3
4
|
import { EmitterRate } from "./EmitterRate";
|
|
4
5
|
import { EmitterSize } from "./EmitterSize";
|
|
5
|
-
import { deepExtend } from "../../../../Utils";
|
|
6
6
|
/**
|
|
7
7
|
* [[include:Options/Plugins/Emitters.md]]
|
|
8
8
|
* @category Emitters Plugin
|
|
@@ -46,10 +46,13 @@ export class Emitter {
|
|
|
46
46
|
this.shape = data.shape;
|
|
47
47
|
}
|
|
48
48
|
if (data.position !== undefined) {
|
|
49
|
-
this.position = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
49
|
+
this.position = {};
|
|
50
|
+
if (data.position.x !== undefined) {
|
|
51
|
+
this.position.x = setRangeValue(data.position.x);
|
|
52
|
+
}
|
|
53
|
+
if (data.position.y !== undefined) {
|
|
54
|
+
this.position.y = setRangeValue(data.position.y);
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
if (data.spawnColor !== undefined) {
|
|
55
58
|
if (this.spawnColor === undefined) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { MoveDirection, MoveDirectionAlt } from "../../../../Enums";
|
|
2
2
|
import type { EmitterShapeType } from "../../Enums";
|
|
3
3
|
import type { IAnimatableColor } from "../../../../Options/Interfaces/IAnimatableColor";
|
|
4
|
-
import type { ICoordinates } from "../../../../Core";
|
|
5
4
|
import type { IEmitterLife } from "./IEmitterLife";
|
|
6
5
|
import type { IEmitterRate } from "./IEmitterRate";
|
|
7
6
|
import type { IEmitterSize } from "./IEmitterSize";
|
|
8
7
|
import type { IParticles } from "../../../../Options/Interfaces/Particles/IParticles";
|
|
8
|
+
import type { IRangedCoordinates } from "../../../../Core";
|
|
9
9
|
import type { RecursivePartial } from "../../../../Types";
|
|
10
10
|
/**
|
|
11
11
|
* Particles emitter object options
|
|
@@ -51,7 +51,7 @@ export interface IEmitter {
|
|
|
51
51
|
* The relative position (in percent) of the emitter, where particles spawns.
|
|
52
52
|
* If size is specified the position will be the center of the size options
|
|
53
53
|
*/
|
|
54
|
-
position?: RecursivePartial<
|
|
54
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
55
55
|
/**
|
|
56
56
|
* The particles emitting rate options
|
|
57
57
|
*/
|
|
@@ -54,7 +54,8 @@ export class AngleUpdater {
|
|
|
54
54
|
}
|
|
55
55
|
const rotateAnimation = particle.options.rotate.animation;
|
|
56
56
|
if (rotateAnimation.enable) {
|
|
57
|
-
particle.rotate.velocity =
|
|
57
|
+
particle.rotate.velocity =
|
|
58
|
+
(getRangeValue(rotateAnimation.speed) / 360) * this.container.retina.reduceFactor;
|
|
58
59
|
if (!rotateAnimation.sync) {
|
|
59
60
|
particle.rotate.velocity *= Math.random();
|
|
60
61
|
}
|
|
@@ -69,7 +69,7 @@ export class OpacityUpdater {
|
|
|
69
69
|
min: getRangeMin(opacityOptions.value),
|
|
70
70
|
value: getRangeValue(opacityOptions.value),
|
|
71
71
|
loops: 0,
|
|
72
|
-
maxLoops: opacityOptions.animation.count,
|
|
72
|
+
maxLoops: getRangeValue(opacityOptions.animation.count),
|
|
73
73
|
};
|
|
74
74
|
const opacityAnimation = opacityOptions.animation;
|
|
75
75
|
if (opacityAnimation.enable) {
|
|
@@ -93,7 +93,8 @@ export class OpacityUpdater {
|
|
|
93
93
|
particle.opacity.status = 1 /* decreasing */;
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
|
-
particle.opacity.velocity =
|
|
96
|
+
particle.opacity.velocity =
|
|
97
|
+
(getRangeValue(opacityAnimation.speed) / 100) * this.container.retina.reduceFactor;
|
|
97
98
|
if (!opacityAnimation.sync) {
|
|
98
99
|
particle.opacity.velocity *= Math.random();
|
|
99
100
|
}
|
|
@@ -26,19 +26,19 @@ export class RollUpdater {
|
|
|
26
26
|
const alterType = Math.random() >= 0.5 ? "darken" /* darken */ : "enlighten" /* enlighten */;
|
|
27
27
|
particle.roll.alter = {
|
|
28
28
|
type: alterType,
|
|
29
|
-
value: alterType === "darken" /* darken */ ? rollOpt.darken.value : rollOpt.enlighten.value,
|
|
29
|
+
value: getRangeValue(alterType === "darken" /* darken */ ? rollOpt.darken.value : rollOpt.enlighten.value),
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
else if (rollOpt.darken.enable) {
|
|
33
33
|
particle.roll.alter = {
|
|
34
34
|
type: "darken" /* darken */,
|
|
35
|
-
value: rollOpt.darken.value,
|
|
35
|
+
value: getRangeValue(rollOpt.darken.value),
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
else if (rollOpt.enlighten.enable) {
|
|
39
39
|
particle.roll.alter = {
|
|
40
40
|
type: "enlighten" /* enlighten */,
|
|
41
|
-
value: rollOpt.enlighten.value,
|
|
41
|
+
value: getRangeValue(rollOpt.enlighten.value),
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -55,7 +55,7 @@ export class TiltUpdater {
|
|
|
55
55
|
}
|
|
56
56
|
const tiltAnimation = particle.options.tilt.animation;
|
|
57
57
|
if (tiltAnimation.enable) {
|
|
58
|
-
particle.tilt.velocity = (tiltAnimation.speed / 360) * this.container.retina.reduceFactor;
|
|
58
|
+
particle.tilt.velocity = (getRangeValue(tiltAnimation.speed) / 360) * this.container.retina.reduceFactor;
|
|
59
59
|
if (!tiltAnimation.sync) {
|
|
60
60
|
particle.tilt.velocity *= Math.random();
|
|
61
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mix, randomInRange, setRangeValue } from "./NumberUtils";
|
|
1
|
+
import { getRangeValue, mix, randomInRange, setRangeValue } from "./NumberUtils";
|
|
2
2
|
import { Constants } from "../Core";
|
|
3
3
|
import { itemFromArray } from "./Utils";
|
|
4
4
|
/**
|
|
@@ -465,7 +465,7 @@ export function getHslAnimationFromHsl(hsl, animationOptions, reduceFactor) {
|
|
|
465
465
|
function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
466
466
|
colorValue.enable = colorAnimation.enable;
|
|
467
467
|
if (colorValue.enable) {
|
|
468
|
-
colorValue.velocity = (colorAnimation.speed / 100) * reduceFactor;
|
|
468
|
+
colorValue.velocity = (getRangeValue(colorAnimation.speed) / 100) * reduceFactor;
|
|
469
469
|
if (colorAnimation.sync) {
|
|
470
470
|
return;
|
|
471
471
|
}
|
package/esm/Core/Canvas.d.ts
CHANGED
package/esm/Core/Canvas.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clear, colorToHsl, colorToRgb, deepExtend, drawConnectLine, drawGrabLine, drawParticle, drawParticlePlugin, drawPlugin, getStyleFromHsl, getStyleFromRgb, gradient, paintBase, } from "../Utils";
|
|
1
|
+
import { clear, colorToHsl, colorToRgb, deepExtend, drawConnectLine, drawGrabLine, drawParticle, drawParticlePlugin, drawPlugin, getRangeValue, getStyleFromHsl, getStyleFromRgb, gradient, paintBase, } from "../Utils";
|
|
2
2
|
import { Constants } from "./Utils";
|
|
3
3
|
export class Canvas {
|
|
4
4
|
constructor(container) {
|
|
@@ -47,9 +47,9 @@ export class Canvas {
|
|
|
47
47
|
paint() {
|
|
48
48
|
const options = this.container.actualOptions;
|
|
49
49
|
this.draw((ctx) => {
|
|
50
|
-
if (options.backgroundMask.enable && options.backgroundMask.cover
|
|
50
|
+
if (options.backgroundMask.enable && options.backgroundMask.cover) {
|
|
51
51
|
clear(ctx, this.size);
|
|
52
|
-
this.paintBase(
|
|
52
|
+
this.paintBase(this.coverColorStyle);
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
this.paintBase();
|
|
@@ -154,7 +154,9 @@ export class Canvas {
|
|
|
154
154
|
const zIndexOptions = particle.options.zIndex;
|
|
155
155
|
const zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate;
|
|
156
156
|
const radius = particle.getRadius();
|
|
157
|
-
const opacity = twinkling
|
|
157
|
+
const opacity = twinkling
|
|
158
|
+
? getRangeValue(twinkle.opacity)
|
|
159
|
+
: (_d = (_b = particle.bubble.opacity) !== null && _b !== void 0 ? _b : (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1;
|
|
158
160
|
const strokeOpacity = (_f = (_e = particle.stroke) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : opacity;
|
|
159
161
|
const zOpacity = opacity * zOpacityFactor;
|
|
160
162
|
const fillColorValue = fColor ? getStyleFromHsl(fColor, zOpacity) : undefined;
|
|
@@ -224,12 +226,14 @@ export class Canvas {
|
|
|
224
226
|
const color = cover.color;
|
|
225
227
|
const coverRgb = colorToRgb(color);
|
|
226
228
|
if (coverRgb) {
|
|
227
|
-
|
|
229
|
+
const coverColor = {
|
|
228
230
|
r: coverRgb.r,
|
|
229
231
|
g: coverRgb.g,
|
|
230
232
|
b: coverRgb.b,
|
|
231
233
|
a: cover.opacity,
|
|
232
234
|
};
|
|
235
|
+
this.coverColorStyle = getStyleFromRgb(coverColor, coverColor.a);
|
|
236
|
+
console.log(this.coverColorStyle);
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
239
|
initTrail() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RangeValue } from "../../Types";
|
|
1
2
|
export interface ICoordinates {
|
|
2
3
|
x: number;
|
|
3
4
|
y: number;
|
|
@@ -5,3 +6,10 @@ export interface ICoordinates {
|
|
|
5
6
|
export interface ICoordinates3d extends ICoordinates {
|
|
6
7
|
z: number;
|
|
7
8
|
}
|
|
9
|
+
export interface IRangedCoordinates {
|
|
10
|
+
x: RangeValue;
|
|
11
|
+
y: RangeValue;
|
|
12
|
+
}
|
|
13
|
+
export interface IRangedCoordinates3d extends IRangedCoordinates {
|
|
14
|
+
z: RangeValue;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,6 +18,7 @@ export * from "./IMovePathGenerator";
|
|
|
18
18
|
export * from "./IParticle";
|
|
19
19
|
export * from "./IParticleGradientAnimation";
|
|
20
20
|
export * from "./IParticleGradientColorAnimation";
|
|
21
|
+
export * from "./IParticleGravity";
|
|
21
22
|
export * from "./IParticleHslAnimation";
|
|
22
23
|
export * from "./IParticlesInteractor";
|
|
23
24
|
export * from "./IParticleLife";
|
|
@@ -18,6 +18,7 @@ export * from "./IMovePathGenerator";
|
|
|
18
18
|
export * from "./IParticle";
|
|
19
19
|
export * from "./IParticleGradientAnimation";
|
|
20
20
|
export * from "./IParticleGradientColorAnimation";
|
|
21
|
+
export * from "./IParticleGravity";
|
|
21
22
|
export * from "./IParticleHslAnimation";
|
|
22
23
|
export * from "./IParticlesInteractor";
|
|
23
24
|
export * from "./IParticleLife";
|
package/esm/Core/Particle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShapeType } from "../Enums";
|
|
2
|
-
import type { IBubbleParticleData, ICoordinates, ICoordinates3d, IDelta, IHsl, IParticle, IParticleGradientAnimation, IParticleHslAnimation, IParticleLife, IParticleNumericValueAnimation, IParticleRetinaProps, IParticleRoll, IParticleSpin, IParticleTiltValueAnimation, IParticleValueAnimation, IParticleWobble, IRgb, IShapeValues } from "./Interfaces";
|
|
2
|
+
import type { IBubbleParticleData, ICoordinates, ICoordinates3d, IDelta, IHsl, IParticle, IParticleGradientAnimation, IParticleGravity, IParticleHslAnimation, IParticleLife, IParticleNumericValueAnimation, IParticleRetinaProps, IParticleRoll, IParticleSpin, IParticleTiltValueAnimation, IParticleValueAnimation, IParticleWobble, IRgb, IShapeValues } from "./Interfaces";
|
|
3
3
|
import { Vector, Vector3d } from "./Utils";
|
|
4
4
|
import type { Container } from "./Container";
|
|
5
5
|
import type { Engine } from "../engine";
|
|
@@ -37,6 +37,7 @@ export declare class Particle implements IParticle {
|
|
|
37
37
|
strokeWidth?: number;
|
|
38
38
|
stroke?: Stroke;
|
|
39
39
|
strokeColor?: IParticleHslAnimation;
|
|
40
|
+
readonly gravity: IParticleGravity;
|
|
40
41
|
readonly moveDecay: number;
|
|
41
42
|
readonly direction: number;
|
|
42
43
|
readonly position: Vector3d;
|
package/esm/Core/Particle.js
CHANGED
|
@@ -86,7 +86,7 @@ export class Particle {
|
|
|
86
86
|
max: getRangeMax(sizeRange) * pxRatio,
|
|
87
87
|
min: getRangeMin(sizeRange) * pxRatio,
|
|
88
88
|
loops: 0,
|
|
89
|
-
maxLoops: sizeOptions.animation.count,
|
|
89
|
+
maxLoops: getRangeValue(sizeOptions.animation.count),
|
|
90
90
|
};
|
|
91
91
|
const sizeAnimation = sizeOptions.animation;
|
|
92
92
|
if (sizeAnimation.enable) {
|
|
@@ -120,6 +120,12 @@ export class Particle {
|
|
|
120
120
|
this.initialVelocity = this.calculateVelocity();
|
|
121
121
|
this.velocity = this.initialVelocity.copy();
|
|
122
122
|
this.moveDecay = 1 - getRangeValue(this.options.move.decay);
|
|
123
|
+
const gravityOptions = this.options.move.gravity;
|
|
124
|
+
this.gravity = {
|
|
125
|
+
enable: gravityOptions.enable,
|
|
126
|
+
acceleration: getRangeValue(gravityOptions.acceleration),
|
|
127
|
+
inverse: gravityOptions.inverse,
|
|
128
|
+
};
|
|
123
129
|
this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
|
|
124
130
|
this.initialPosition = this.position.copy();
|
|
125
131
|
this.offset = Vector.origin;
|
|
@@ -327,12 +333,7 @@ export class Particle {
|
|
|
327
333
|
return overlaps;
|
|
328
334
|
}
|
|
329
335
|
calculateVelocity() {
|
|
330
|
-
const baseVelocity = getParticleBaseVelocity(this.direction)
|
|
331
|
-
const res = baseVelocity.copy();
|
|
332
|
-
const moveOptions = this.options.move;
|
|
333
|
-
const rad = (Math.PI / 180) * moveOptions.angle.value;
|
|
334
|
-
const radOffset = (Math.PI / 180) * moveOptions.angle.offset;
|
|
335
|
-
const range = {
|
|
336
|
+
const baseVelocity = getParticleBaseVelocity(this.direction), res = baseVelocity.copy(), moveOptions = this.options.move, rad = (Math.PI / 180) * getRangeValue(moveOptions.angle.value), radOffset = (Math.PI / 180) * getRangeValue(moveOptions.angle.offset), range = {
|
|
336
337
|
left: radOffset - rad / 2,
|
|
337
338
|
right: radOffset + rad / 2,
|
|
338
339
|
};
|
package/esm/Core/Retina.js
CHANGED
|
@@ -40,13 +40,13 @@ export class Retina {
|
|
|
40
40
|
container.canvas.size.height = element.offsetHeight * ratio;
|
|
41
41
|
}
|
|
42
42
|
const particles = options.particles;
|
|
43
|
-
this.attractDistance = particles.move.attract.distance * ratio;
|
|
43
|
+
this.attractDistance = getRangeValue(particles.move.attract.distance) * ratio;
|
|
44
44
|
this.linksDistance = particles.links.distance * ratio;
|
|
45
45
|
this.linksWidth = particles.links.width * ratio;
|
|
46
|
-
this.sizeAnimationSpeed = particles.size.animation.speed * ratio;
|
|
47
|
-
this.maxSpeed = particles.move.gravity.maxSpeed * ratio;
|
|
46
|
+
this.sizeAnimationSpeed = getRangeValue(particles.size.animation.speed) * ratio;
|
|
47
|
+
this.maxSpeed = getRangeValue(particles.move.gravity.maxSpeed) * ratio;
|
|
48
48
|
if (particles.orbit.radius !== undefined) {
|
|
49
|
-
this.orbitRadius = particles.orbit.radius * this.container.retina.pixelRatio;
|
|
49
|
+
this.orbitRadius = getRangeValue(particles.orbit.radius) * this.container.retina.pixelRatio;
|
|
50
50
|
}
|
|
51
51
|
const modes = options.interactivity.modes;
|
|
52
52
|
this.connectModeDistance = modes.connect.distance * ratio;
|
|
@@ -66,19 +66,19 @@ export class Retina {
|
|
|
66
66
|
const ratio = this.pixelRatio;
|
|
67
67
|
const moveDistance = options.move.distance;
|
|
68
68
|
const props = particle.retina;
|
|
69
|
-
props.attractDistance = options.move.attract.distance * ratio;
|
|
69
|
+
props.attractDistance = getRangeValue(options.move.attract.distance) * ratio;
|
|
70
70
|
props.linksDistance = options.links.distance * ratio;
|
|
71
71
|
props.linksWidth = options.links.width * ratio;
|
|
72
72
|
props.moveDrift = getRangeValue(options.move.drift) * ratio;
|
|
73
73
|
props.moveSpeed = getRangeValue(options.move.speed) * ratio;
|
|
74
|
-
props.sizeAnimationSpeed = options.size.animation.speed * ratio;
|
|
74
|
+
props.sizeAnimationSpeed = getRangeValue(options.size.animation.speed) * ratio;
|
|
75
75
|
if (particle.spin) {
|
|
76
76
|
props.spinAcceleration = getRangeValue(options.move.spin.acceleration) * ratio;
|
|
77
77
|
}
|
|
78
78
|
const maxDistance = props.maxDistance;
|
|
79
79
|
maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
|
|
80
80
|
maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
|
|
81
|
-
props.maxSpeed = options.move.gravity.maxSpeed * ratio;
|
|
81
|
+
props.maxSpeed = getRangeValue(options.move.gravity.maxSpeed) * ratio;
|
|
82
82
|
}
|
|
83
83
|
handleMotionChange(mediaQuery) {
|
|
84
84
|
const options = this.container.actualOptions;
|
|
@@ -52,7 +52,7 @@ export class ParticlesMover {
|
|
|
52
52
|
const container = this.container, slowFactor = this.getProximitySpeedFactor(particle), baseSpeed = ((_a = (_d = particle.retina).moveSpeed) !== null && _a !== void 0 ? _a : (_d.moveSpeed = getRangeValue(moveOptions.speed) * container.retina.pixelRatio)) *
|
|
53
53
|
container.retina.reduceFactor, moveDrift = ((_b = (_e = particle.retina).moveDrift) !== null && _b !== void 0 ? _b : (_e.moveDrift = getRangeValue(particle.options.move.drift) * container.retina.pixelRatio)), maxSize = getRangeMax(particleOptions.size.value) * container.retina.pixelRatio, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : 1, diffFactor = 2, speedFactor = (sizeFactor * slowFactor * (delta.factor || 1)) / diffFactor, moveSpeed = baseSpeed * speedFactor;
|
|
54
54
|
this.applyPath(particle, delta);
|
|
55
|
-
const gravityOptions =
|
|
55
|
+
const gravityOptions = particle.gravity;
|
|
56
56
|
const gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
|
|
57
57
|
if (gravityOptions.enable && moveSpeed) {
|
|
58
58
|
particle.velocity.y += (gravityFactor * (gravityOptions.acceleration * delta.factor)) / (60 * moveSpeed);
|
|
@@ -67,7 +67,7 @@ export class ParticlesMover {
|
|
|
67
67
|
const velocity = particle.velocity.mult(moveSpeed);
|
|
68
68
|
const maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
|
|
69
69
|
if (gravityOptions.enable &&
|
|
70
|
-
|
|
70
|
+
maxSpeed > 0 &&
|
|
71
71
|
((!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed) ||
|
|
72
72
|
(gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed))) {
|
|
73
73
|
velocity.y = gravityFactor * maxSpeed;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { colorToRgb, drawLinkLine, drawLinkTriangle, getDistance, getLinkColor } from "../../../Utils";
|
|
1
|
+
import { colorToRgb, drawLinkLine, drawLinkTriangle, getDistance, getLinkColor, getRangeValue } from "../../../Utils";
|
|
2
2
|
export class LinkInstance {
|
|
3
3
|
constructor(container) {
|
|
4
4
|
this.container = container;
|
|
@@ -99,7 +99,7 @@ export class LinkInstance {
|
|
|
99
99
|
const twinkling = Math.random() < twinkleFreq;
|
|
100
100
|
if (twinkling && twinkleRgb !== undefined) {
|
|
101
101
|
colorLine = twinkleRgb;
|
|
102
|
-
opacity = twinkle.opacity;
|
|
102
|
+
opacity = getRangeValue(twinkle.opacity);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
if (!colorLine) {
|
|
@@ -35,17 +35,17 @@ export declare class AnimatableGradientColor implements IAnimatableGradientColor
|
|
|
35
35
|
load(data?: RecursivePartial<IAnimatableGradientColor>): void;
|
|
36
36
|
}
|
|
37
37
|
export declare class GradientAngleAnimation implements IAnimation, IOptionLoader<IAnimation> {
|
|
38
|
-
count:
|
|
38
|
+
count: RangeValue;
|
|
39
39
|
enable: boolean;
|
|
40
|
-
speed:
|
|
40
|
+
speed: RangeValue;
|
|
41
41
|
sync: boolean;
|
|
42
42
|
constructor();
|
|
43
43
|
load(data?: RecursivePartial<IAnimation>): void;
|
|
44
44
|
}
|
|
45
45
|
export declare class GradientColorOpacityAnimation implements IGradientColorOpacityAnimation, IOptionLoader<IGradientColorOpacityAnimation> {
|
|
46
|
-
count:
|
|
46
|
+
count: RangeValue;
|
|
47
47
|
enable: boolean;
|
|
48
|
-
speed:
|
|
48
|
+
speed: RangeValue;
|
|
49
49
|
sync: boolean;
|
|
50
50
|
startValue: StartValueType | keyof typeof StartValueType;
|
|
51
51
|
constructor();
|
|
@@ -93,13 +93,13 @@ export class GradientAngleAnimation {
|
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
if (data.count !== undefined) {
|
|
96
|
-
this.count = data.count;
|
|
96
|
+
this.count = setRangeValue(data.count);
|
|
97
97
|
}
|
|
98
98
|
if (data.enable !== undefined) {
|
|
99
99
|
this.enable = data.enable;
|
|
100
100
|
}
|
|
101
101
|
if (data.speed !== undefined) {
|
|
102
|
-
this.speed = data.speed;
|
|
102
|
+
this.speed = setRangeValue(data.speed);
|
|
103
103
|
}
|
|
104
104
|
if (data.sync !== undefined) {
|
|
105
105
|
this.sync = data.sync;
|
|
@@ -119,13 +119,13 @@ export class GradientColorOpacityAnimation {
|
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
if (data.count !== undefined) {
|
|
122
|
-
this.count = data.count;
|
|
122
|
+
this.count = setRangeValue(data.count);
|
|
123
123
|
}
|
|
124
124
|
if (data.enable !== undefined) {
|
|
125
125
|
this.enable = data.enable;
|
|
126
126
|
}
|
|
127
127
|
if (data.speed !== undefined) {
|
|
128
|
-
this.speed = data.speed;
|
|
128
|
+
this.speed = setRangeValue(data.speed);
|
|
129
129
|
}
|
|
130
130
|
if (data.sync !== undefined) {
|
|
131
131
|
this.sync = data.sync;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { RangeValue, RecursivePartial } from "../../Types";
|
|
2
|
+
import type { IAnimation } from "../Interfaces/IAnimation";
|
|
3
|
+
import type { IOptionLoader } from "../Interfaces/IOptionLoader";
|
|
4
4
|
export declare class AnimationOptions implements IAnimation, IOptionLoader<IAnimation> {
|
|
5
|
-
count:
|
|
5
|
+
count: RangeValue;
|
|
6
6
|
enable: boolean;
|
|
7
|
-
speed:
|
|
7
|
+
speed: RangeValue;
|
|
8
8
|
sync: boolean;
|
|
9
9
|
constructor();
|
|
10
10
|
load(data?: RecursivePartial<IAnimation>): void;
|
|
@@ -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
|
}
|