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,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TiltAnimation = void 0;
|
|
4
|
+
const Utils_1 = require("../../../../Utils");
|
|
4
5
|
class TiltAnimation {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.enable = false;
|
|
@@ -15,7 +16,7 @@ class TiltAnimation {
|
|
|
15
16
|
this.enable = data.enable;
|
|
16
17
|
}
|
|
17
18
|
if (data.speed !== undefined) {
|
|
18
|
-
this.speed = data.speed;
|
|
19
|
+
this.speed = (0, Utils_1.setRangeValue)(data.speed);
|
|
19
20
|
}
|
|
20
21
|
if (data.sync !== undefined) {
|
|
21
22
|
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
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TwinkleValues = void 0;
|
|
4
4
|
const OptionsColor_1 = require("../../OptionsColor");
|
|
5
|
+
const Utils_1 = require("../../../../Utils");
|
|
5
6
|
class TwinkleValues {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.enable = false;
|
|
@@ -22,7 +23,7 @@ class TwinkleValues {
|
|
|
22
23
|
this.frequency = data.frequency;
|
|
23
24
|
}
|
|
24
25
|
if (data.opacity !== undefined) {
|
|
25
|
-
this.opacity = data.opacity;
|
|
26
|
+
this.opacity = (0, Utils_1.setRangeValue)(data.opacity);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -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
|
}
|
|
@@ -105,7 +105,7 @@ class AbsorberInstance {
|
|
|
105
105
|
var _a, _b;
|
|
106
106
|
const container = this.container;
|
|
107
107
|
const percentPosition = this.options.position;
|
|
108
|
-
return Core_1.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);
|
|
108
|
+
return Core_1.Vector.create(((0, Utils_1.getRangeValue)((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width, ((0, Utils_1.getRangeValue)((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height);
|
|
109
109
|
}
|
|
110
110
|
updateParticlePosition(particle, v) {
|
|
111
111
|
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;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Absorber = void 0;
|
|
4
4
|
const AbsorberSize_1 = require("./AbsorberSize");
|
|
5
5
|
const OptionsColor_1 = require("../../../../Options/Classes/OptionsColor");
|
|
6
|
+
const Utils_1 = require("../../../../Utils");
|
|
6
7
|
class Absorber {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.color = new OptionsColor_1.OptionsColor();
|
|
@@ -28,10 +29,13 @@ class Absorber {
|
|
|
28
29
|
this.opacity = data.opacity;
|
|
29
30
|
}
|
|
30
31
|
if (data.position !== undefined) {
|
|
31
|
-
this.position = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
this.position = {};
|
|
33
|
+
if (data.position.x !== undefined) {
|
|
34
|
+
this.position.x = (0, Utils_1.setRangeValue)(data.position.x);
|
|
35
|
+
}
|
|
36
|
+
if (data.position.y !== undefined) {
|
|
37
|
+
this.position.y = (0, Utils_1.setRangeValue)(data.position.y);
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
if (data.size !== undefined) {
|
|
37
41
|
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;
|
|
@@ -18,8 +18,8 @@ const Emitter_1 = require("./Options/Classes/Emitter");
|
|
|
18
18
|
const EmitterSize_1 = require("./Options/Classes/EmitterSize");
|
|
19
19
|
class EmitterInstance {
|
|
20
20
|
constructor(engine, emitters, container, options, position) {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f;
|
|
22
|
-
var
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
22
|
+
var _h;
|
|
23
23
|
this.emitters = emitters;
|
|
24
24
|
this.container = container;
|
|
25
25
|
_EmitterInstance_firstSpawn.set(this, void 0);
|
|
@@ -38,22 +38,23 @@ class EmitterInstance {
|
|
|
38
38
|
this.options.load(options);
|
|
39
39
|
}
|
|
40
40
|
this.spawnDelay = (((_a = this.options.life.delay) !== null && _a !== void 0 ? _a : 0) * 1000) / this.container.retina.reduceFactor;
|
|
41
|
+
this.position = (_b = this.initialPosition) !== null && _b !== void 0 ? _b : this.calcPosition();
|
|
41
42
|
this.name = this.options.name;
|
|
42
|
-
this.shape = (
|
|
43
|
+
this.shape = (_c = __classPrivateFieldGet(this, _EmitterInstance_engine, "f").emitterShapeManager) === null || _c === void 0 ? void 0 : _c.getShape(this.options.shape);
|
|
43
44
|
this.fill = this.options.fill;
|
|
44
45
|
__classPrivateFieldSet(this, _EmitterInstance_firstSpawn, !this.options.life.wait, "f");
|
|
45
46
|
__classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, false, "f");
|
|
46
47
|
let particlesOptions = (0, Utils_1.deepExtend)({}, this.options.particles);
|
|
47
48
|
particlesOptions !== null && particlesOptions !== void 0 ? particlesOptions : (particlesOptions = {});
|
|
48
|
-
(
|
|
49
|
-
(
|
|
49
|
+
(_d = particlesOptions.move) !== null && _d !== void 0 ? _d : (particlesOptions.move = {});
|
|
50
|
+
(_e = (_h = particlesOptions.move).direction) !== null && _e !== void 0 ? _e : (_h.direction = this.options.direction);
|
|
50
51
|
if (this.options.spawnColor) {
|
|
51
52
|
this.spawnColor = (0, Utils_1.colorToHsl)(this.options.spawnColor);
|
|
52
53
|
}
|
|
53
54
|
this.paused = !this.options.autoPlay;
|
|
54
55
|
this.particlesOptions = particlesOptions;
|
|
55
56
|
this.size =
|
|
56
|
-
(
|
|
57
|
+
(_f = this.options.size) !== null && _f !== void 0 ? _f : (() => {
|
|
57
58
|
const size = new EmitterSize_1.EmitterSize();
|
|
58
59
|
size.load({
|
|
59
60
|
height: 0,
|
|
@@ -62,7 +63,7 @@ class EmitterInstance {
|
|
|
62
63
|
});
|
|
63
64
|
return size;
|
|
64
65
|
})();
|
|
65
|
-
this.lifeCount = (
|
|
66
|
+
this.lifeCount = (_g = this.options.life.count) !== null && _g !== void 0 ? _g : -1;
|
|
66
67
|
this.immortal = this.lifeCount <= 0;
|
|
67
68
|
this.play();
|
|
68
69
|
}
|
|
@@ -210,8 +211,8 @@ class EmitterInstance {
|
|
|
210
211
|
const container = this.container;
|
|
211
212
|
const percentPosition = this.options.position;
|
|
212
213
|
return {
|
|
213
|
-
x: (((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100) * container.canvas.size.width,
|
|
214
|
-
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: ((0, Utils_1.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: ((0, Utils_1.getRangeValue)((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100) * container.canvas.size.height,
|
|
215
216
|
};
|
|
216
217
|
}
|
|
217
218
|
emit() {
|
|
@@ -260,7 +261,7 @@ class EmitterInstance {
|
|
|
260
261
|
const colorOffset = (0, Utils_1.randomInRange)(animation.offset);
|
|
261
262
|
const delay = (0, Utils_1.getRangeValue)(this.options.rate.delay);
|
|
262
263
|
const emitFactor = (1000 * delay) / container.retina.reduceFactor;
|
|
263
|
-
const colorSpeed = (_a = animation.speed) !== null && _a !== void 0 ? _a : 0;
|
|
264
|
+
const colorSpeed = (0, Utils_1.getRangeValue)((_a = animation.speed) !== null && _a !== void 0 ? _a : 0);
|
|
264
265
|
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * 3.6) % maxValue;
|
|
265
266
|
}
|
|
266
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
|
export declare class Emitter implements IEmitter, IOptionLoader<IEmitter> {
|
|
13
13
|
autoPlay: boolean;
|
|
@@ -18,7 +18,7 @@ export declare class Emitter implements IEmitter, IOptionLoader<IEmitter> {
|
|
|
18
18
|
life: EmitterLife;
|
|
19
19
|
name?: string;
|
|
20
20
|
particles?: RecursivePartial<IParticles>;
|
|
21
|
-
position?: RecursivePartial<
|
|
21
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
22
22
|
rate: EmitterRate;
|
|
23
23
|
shape: EmitterShapeType | keyof typeof EmitterShapeType;
|
|
24
24
|
spawnColor?: AnimatableColor;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Emitter = void 0;
|
|
4
|
+
const Utils_1 = require("../../../../Utils");
|
|
4
5
|
const AnimatableColor_1 = require("../../../../Options/Classes/AnimatableColor");
|
|
5
6
|
const EmitterLife_1 = require("./EmitterLife");
|
|
6
7
|
const EmitterRate_1 = require("./EmitterRate");
|
|
7
8
|
const EmitterSize_1 = require("./EmitterSize");
|
|
8
|
-
const Utils_1 = require("../../../../Utils");
|
|
9
9
|
class Emitter {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.autoPlay = true;
|
|
@@ -45,10 +45,13 @@ class Emitter {
|
|
|
45
45
|
this.shape = data.shape;
|
|
46
46
|
}
|
|
47
47
|
if (data.position !== undefined) {
|
|
48
|
-
this.position = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
48
|
+
this.position = {};
|
|
49
|
+
if (data.position.x) {
|
|
50
|
+
this.position.x = (0, Utils_1.setRangeValue)(data.position.x);
|
|
51
|
+
}
|
|
52
|
+
if (data.position.y) {
|
|
53
|
+
this.position.y = (0, Utils_1.setRangeValue)(data.position.y);
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
if (data.spawnColor !== undefined) {
|
|
54
57
|
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
|
export interface IEmitter {
|
|
11
11
|
autoPlay: boolean;
|
|
@@ -16,7 +16,7 @@ export interface IEmitter {
|
|
|
16
16
|
life: IEmitterLife;
|
|
17
17
|
name?: string;
|
|
18
18
|
particles?: RecursivePartial<IParticles>;
|
|
19
|
-
position?: RecursivePartial<
|
|
19
|
+
position?: RecursivePartial<IRangedCoordinates>;
|
|
20
20
|
rate: IEmitterRate;
|
|
21
21
|
shape: EmitterShapeType | keyof typeof EmitterShapeType;
|
|
22
22
|
spawnColor?: IAnimatableColor;
|
|
@@ -57,7 +57,8 @@ class AngleUpdater {
|
|
|
57
57
|
}
|
|
58
58
|
const rotateAnimation = particle.options.rotate.animation;
|
|
59
59
|
if (rotateAnimation.enable) {
|
|
60
|
-
particle.rotate.velocity =
|
|
60
|
+
particle.rotate.velocity =
|
|
61
|
+
((0, Utils_1.getRangeValue)(rotateAnimation.speed) / 360) * this.container.retina.reduceFactor;
|
|
61
62
|
if (!rotateAnimation.sync) {
|
|
62
63
|
particle.rotate.velocity *= Math.random();
|
|
63
64
|
}
|
|
@@ -71,7 +71,7 @@ class OpacityUpdater {
|
|
|
71
71
|
min: (0, Utils_1.getRangeMin)(opacityOptions.value),
|
|
72
72
|
value: (0, Utils_1.getRangeValue)(opacityOptions.value),
|
|
73
73
|
loops: 0,
|
|
74
|
-
maxLoops: opacityOptions.animation.count,
|
|
74
|
+
maxLoops: (0, Utils_1.getRangeValue)(opacityOptions.animation.count),
|
|
75
75
|
};
|
|
76
76
|
const opacityAnimation = opacityOptions.animation;
|
|
77
77
|
if (opacityAnimation.enable) {
|
|
@@ -95,7 +95,8 @@ class OpacityUpdater {
|
|
|
95
95
|
particle.opacity.status = 1;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
|
-
particle.opacity.velocity =
|
|
98
|
+
particle.opacity.velocity =
|
|
99
|
+
((0, Utils_1.getRangeValue)(opacityAnimation.speed) / 100) * this.container.retina.reduceFactor;
|
|
99
100
|
if (!opacityAnimation.sync) {
|
|
100
101
|
particle.opacity.velocity *= Math.random();
|
|
101
102
|
}
|
|
@@ -29,19 +29,19 @@ class RollUpdater {
|
|
|
29
29
|
const alterType = Math.random() >= 0.5 ? "darken" : "enlighten";
|
|
30
30
|
particle.roll.alter = {
|
|
31
31
|
type: alterType,
|
|
32
|
-
value: alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value,
|
|
32
|
+
value: (0, Utils_1.getRangeValue)(alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value),
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
else if (rollOpt.darken.enable) {
|
|
36
36
|
particle.roll.alter = {
|
|
37
37
|
type: "darken",
|
|
38
|
-
value: rollOpt.darken.value,
|
|
38
|
+
value: (0, Utils_1.getRangeValue)(rollOpt.darken.value),
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
else if (rollOpt.enlighten.enable) {
|
|
42
42
|
particle.roll.alter = {
|
|
43
43
|
type: "enlighten",
|
|
44
|
-
value: rollOpt.enlighten.value,
|
|
44
|
+
value: (0, Utils_1.getRangeValue)(rollOpt.enlighten.value),
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -58,7 +58,7 @@ class TiltUpdater {
|
|
|
58
58
|
}
|
|
59
59
|
const tiltAnimation = particle.options.tilt.animation;
|
|
60
60
|
if (tiltAnimation.enable) {
|
|
61
|
-
particle.tilt.velocity = (tiltAnimation.speed / 360) * this.container.retina.reduceFactor;
|
|
61
|
+
particle.tilt.velocity = ((0, Utils_1.getRangeValue)(tiltAnimation.speed) / 360) * this.container.retina.reduceFactor;
|
|
62
62
|
if (!tiltAnimation.sync) {
|
|
63
63
|
particle.tilt.velocity *= Math.random();
|
|
64
64
|
}
|
package/Utils/ColorUtils.js
CHANGED
|
@@ -460,7 +460,7 @@ exports.getHslAnimationFromHsl = getHslAnimationFromHsl;
|
|
|
460
460
|
function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
461
461
|
colorValue.enable = colorAnimation.enable;
|
|
462
462
|
if (colorValue.enable) {
|
|
463
|
-
colorValue.velocity = (colorAnimation.speed / 100) * reduceFactor;
|
|
463
|
+
colorValue.velocity = ((0, NumberUtils_1.getRangeValue)(colorAnimation.speed) / 100) * reduceFactor;
|
|
464
464
|
if (colorAnimation.sync) {
|
|
465
465
|
return;
|
|
466
466
|
}
|
package/browser/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
|
/**
|
|
4
4
|
* Canvas manager
|
|
@@ -117,10 +117,7 @@ export class Canvas {
|
|
|
117
117
|
const container = this.container;
|
|
118
118
|
const pxRatio = container.retina.pixelRatio;
|
|
119
119
|
const size = container.canvas.size;
|
|
120
|
-
const oldSize = {
|
|
121
|
-
width: size.width,
|
|
122
|
-
height: size.height,
|
|
123
|
-
};
|
|
120
|
+
const oldSize = Object.assign({}, size);
|
|
124
121
|
size.width = this.element.offsetWidth * pxRatio;
|
|
125
122
|
size.height = this.element.offsetHeight * pxRatio;
|
|
126
123
|
this.element.width = size.width;
|
|
@@ -179,7 +176,9 @@ export class Canvas {
|
|
|
179
176
|
const zIndexOptions = particle.options.zIndex;
|
|
180
177
|
const zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate;
|
|
181
178
|
const radius = particle.getRadius();
|
|
182
|
-
const opacity = twinkling
|
|
179
|
+
const opacity = twinkling
|
|
180
|
+
? getRangeValue(twinkle.opacity)
|
|
181
|
+
: (_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;
|
|
183
182
|
const strokeOpacity = (_f = (_e = particle.stroke) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : opacity;
|
|
184
183
|
const zOpacity = opacity * zOpacityFactor;
|
|
185
184
|
const fillColorValue = fColor ? getStyleFromHsl(fColor, zOpacity) : undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @category Interfaces
|
|
3
3
|
*/
|
|
4
|
+
import type { RangeValue } from "../../Types";
|
|
4
5
|
export interface ICoordinates {
|
|
5
6
|
x: number;
|
|
6
7
|
y: number;
|
|
@@ -8,3 +9,10 @@ export interface ICoordinates {
|
|
|
8
9
|
export interface ICoordinates3d extends ICoordinates {
|
|
9
10
|
z: number;
|
|
10
11
|
}
|
|
12
|
+
export interface IRangedCoordinates {
|
|
13
|
+
x: RangeValue;
|
|
14
|
+
y: RangeValue;
|
|
15
|
+
}
|
|
16
|
+
export interface IRangedCoordinates3d extends IRangedCoordinates {
|
|
17
|
+
z: RangeValue;
|
|
18
|
+
}
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -17,6 +17,7 @@ export declare class Particle implements IParticle {
|
|
|
17
17
|
readonly container: Container;
|
|
18
18
|
readonly group?: string | undefined;
|
|
19
19
|
destroyed: boolean;
|
|
20
|
+
ignoresResizeRatio: boolean;
|
|
20
21
|
lastPathTime: number;
|
|
21
22
|
misplaced: boolean;
|
|
22
23
|
spawning: boolean;
|
|
@@ -40,6 +41,7 @@ export declare class Particle implements IParticle {
|
|
|
40
41
|
strokeWidth?: number;
|
|
41
42
|
stroke?: Stroke;
|
|
42
43
|
strokeColor?: IParticleHslAnimation;
|
|
44
|
+
readonly gravity: IParticleGravity;
|
|
43
45
|
readonly moveDecay: number;
|
|
44
46
|
readonly direction: number;
|
|
45
47
|
readonly position: Vector3d;
|
package/browser/Core/Particle.js
CHANGED
|
@@ -46,6 +46,7 @@ export class Particle {
|
|
|
46
46
|
this.retina = {
|
|
47
47
|
maxDistance: {},
|
|
48
48
|
};
|
|
49
|
+
this.ignoresResizeRatio = true;
|
|
49
50
|
const pxRatio = container.retina.pixelRatio;
|
|
50
51
|
const mainOptions = container.actualOptions;
|
|
51
52
|
const particlesOptions = new ParticlesOptions();
|
|
@@ -90,7 +91,7 @@ export class Particle {
|
|
|
90
91
|
max: getRangeMax(sizeRange) * pxRatio,
|
|
91
92
|
min: getRangeMin(sizeRange) * pxRatio,
|
|
92
93
|
loops: 0,
|
|
93
|
-
maxLoops: sizeOptions.animation.count,
|
|
94
|
+
maxLoops: getRangeValue(sizeOptions.animation.count),
|
|
94
95
|
};
|
|
95
96
|
const sizeAnimation = sizeOptions.animation;
|
|
96
97
|
if (sizeAnimation.enable) {
|
|
@@ -125,6 +126,12 @@ export class Particle {
|
|
|
125
126
|
this.initialVelocity = this.calculateVelocity();
|
|
126
127
|
this.velocity = this.initialVelocity.copy();
|
|
127
128
|
this.moveDecay = 1 - getRangeValue(this.options.move.decay);
|
|
129
|
+
const gravityOptions = this.options.move.gravity;
|
|
130
|
+
this.gravity = {
|
|
131
|
+
enable: gravityOptions.enable,
|
|
132
|
+
acceleration: getRangeValue(gravityOptions.acceleration),
|
|
133
|
+
inverse: gravityOptions.inverse,
|
|
134
|
+
};
|
|
128
135
|
/* position */
|
|
129
136
|
this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
|
|
130
137
|
this.initialPosition = this.position.copy();
|
|
@@ -339,12 +346,7 @@ export class Particle {
|
|
|
339
346
|
return overlaps;
|
|
340
347
|
}
|
|
341
348
|
calculateVelocity() {
|
|
342
|
-
const baseVelocity = getParticleBaseVelocity(this.direction)
|
|
343
|
-
const res = baseVelocity.copy();
|
|
344
|
-
const moveOptions = this.options.move;
|
|
345
|
-
const rad = (Math.PI / 180) * moveOptions.angle.value;
|
|
346
|
-
const radOffset = (Math.PI / 180) * moveOptions.angle.offset;
|
|
347
|
-
const range = {
|
|
349
|
+
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 = {
|
|
348
350
|
left: radOffset - rad / 2,
|
|
349
351
|
right: radOffset + rad / 2,
|
|
350
352
|
};
|
|
@@ -121,10 +121,11 @@ export class Particles {
|
|
|
121
121
|
// p.vy = f * Math.sin(t);
|
|
122
122
|
// }
|
|
123
123
|
const resizeFactor = container.canvas.resizeFactor;
|
|
124
|
-
if (resizeFactor) {
|
|
124
|
+
if (resizeFactor && !particle.ignoresResizeRatio) {
|
|
125
125
|
particle.position.x *= resizeFactor.width;
|
|
126
126
|
particle.position.y *= resizeFactor.height;
|
|
127
127
|
}
|
|
128
|
+
particle.ignoresResizeRatio = false;
|
|
128
129
|
particle.bubble.inRange = false;
|
|
129
130
|
for (const [, plugin] of this.container.plugins) {
|
|
130
131
|
if (particle.destroyed) {
|