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
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
}
|
|
639
639
|
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) * 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;
|
|
640
640
|
this.applyPath(particle, delta);
|
|
641
|
-
const gravityOptions =
|
|
641
|
+
const gravityOptions = particle.gravity;
|
|
642
642
|
const gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
|
|
643
643
|
if (gravityOptions.enable && moveSpeed) {
|
|
644
644
|
particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (60 * moveSpeed);
|
|
@@ -652,7 +652,7 @@
|
|
|
652
652
|
}
|
|
653
653
|
const velocity = particle.velocity.mult(moveSpeed);
|
|
654
654
|
const maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
|
|
655
|
-
if (gravityOptions.enable &&
|
|
655
|
+
if (gravityOptions.enable && maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
|
|
656
656
|
velocity.y = gravityFactor * maxSpeed;
|
|
657
657
|
if (moveSpeed) {
|
|
658
658
|
particle.velocity.y = velocity.y / moveSpeed;
|
|
@@ -1011,10 +1011,7 @@
|
|
|
1011
1011
|
const container = this.container;
|
|
1012
1012
|
const pxRatio = container.retina.pixelRatio;
|
|
1013
1013
|
const size = container.canvas.size;
|
|
1014
|
-
const oldSize = {
|
|
1015
|
-
width: size.width,
|
|
1016
|
-
height: size.height
|
|
1017
|
-
};
|
|
1014
|
+
const oldSize = Object.assign({}, size);
|
|
1018
1015
|
size.width = this.element.offsetWidth * pxRatio;
|
|
1019
1016
|
size.height = this.element.offsetHeight * pxRatio;
|
|
1020
1017
|
this.element.width = size.width;
|
|
@@ -1073,7 +1070,7 @@
|
|
|
1073
1070
|
const zIndexOptions = particle.options.zIndex;
|
|
1074
1071
|
const zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate;
|
|
1075
1072
|
const radius = particle.getRadius();
|
|
1076
|
-
const opacity = twinkling ? twinkle.opacity : (_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;
|
|
1073
|
+
const opacity = twinkling ? getRangeValue(twinkle.opacity) : (_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;
|
|
1077
1074
|
const strokeOpacity = (_f = (_e = particle.stroke) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : opacity;
|
|
1078
1075
|
const zOpacity = opacity * zOpacityFactor;
|
|
1079
1076
|
const fillColorValue = fColor ? getStyleFromHsl(fColor, zOpacity) : undefined;
|
|
@@ -1331,6 +1328,109 @@
|
|
|
1331
1328
|
}
|
|
1332
1329
|
}
|
|
1333
1330
|
}
|
|
1331
|
+
class ColorAnimation {
|
|
1332
|
+
constructor() {
|
|
1333
|
+
this.count = 0;
|
|
1334
|
+
this.enable = false;
|
|
1335
|
+
this.offset = 0;
|
|
1336
|
+
this.speed = 1;
|
|
1337
|
+
this.sync = true;
|
|
1338
|
+
}
|
|
1339
|
+
load(data) {
|
|
1340
|
+
if (data === undefined) {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
if (data.count !== undefined) {
|
|
1344
|
+
this.count = NumberUtils_setRangeValue(data.count);
|
|
1345
|
+
}
|
|
1346
|
+
if (data.enable !== undefined) {
|
|
1347
|
+
this.enable = data.enable;
|
|
1348
|
+
}
|
|
1349
|
+
if (data.offset !== undefined) {
|
|
1350
|
+
this.offset = NumberUtils_setRangeValue(data.offset);
|
|
1351
|
+
}
|
|
1352
|
+
if (data.speed !== undefined) {
|
|
1353
|
+
this.speed = NumberUtils_setRangeValue(data.speed);
|
|
1354
|
+
}
|
|
1355
|
+
if (data.sync !== undefined) {
|
|
1356
|
+
this.sync = data.sync;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
class HslAnimation {
|
|
1361
|
+
constructor() {
|
|
1362
|
+
this.h = new ColorAnimation;
|
|
1363
|
+
this.s = new ColorAnimation;
|
|
1364
|
+
this.l = new ColorAnimation;
|
|
1365
|
+
}
|
|
1366
|
+
load(data) {
|
|
1367
|
+
if (!data) {
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
this.h.load(data.h);
|
|
1371
|
+
this.s.load(data.s);
|
|
1372
|
+
this.l.load(data.l);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
class OptionsColor_OptionsColor {
|
|
1376
|
+
constructor() {
|
|
1377
|
+
this.value = "#fff";
|
|
1378
|
+
}
|
|
1379
|
+
static create(source, data) {
|
|
1380
|
+
const color = new OptionsColor_OptionsColor;
|
|
1381
|
+
color.load(source);
|
|
1382
|
+
if (data !== undefined) {
|
|
1383
|
+
if (typeof data === "string" || data instanceof Array) {
|
|
1384
|
+
color.load({
|
|
1385
|
+
value: data
|
|
1386
|
+
});
|
|
1387
|
+
} else {
|
|
1388
|
+
color.load(data);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
return color;
|
|
1392
|
+
}
|
|
1393
|
+
load(data) {
|
|
1394
|
+
if ((data === null || data === void 0 ? void 0 : data.value) === undefined) {
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
this.value = data.value;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
class AnimatableColor_AnimatableColor extends OptionsColor_OptionsColor {
|
|
1401
|
+
constructor() {
|
|
1402
|
+
super();
|
|
1403
|
+
this.animation = new HslAnimation;
|
|
1404
|
+
}
|
|
1405
|
+
static create(source, data) {
|
|
1406
|
+
const color = new AnimatableColor_AnimatableColor;
|
|
1407
|
+
color.load(source);
|
|
1408
|
+
if (data !== undefined) {
|
|
1409
|
+
if (typeof data === "string" || data instanceof Array) {
|
|
1410
|
+
color.load({
|
|
1411
|
+
value: data
|
|
1412
|
+
});
|
|
1413
|
+
} else {
|
|
1414
|
+
color.load(data);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
return color;
|
|
1418
|
+
}
|
|
1419
|
+
load(data) {
|
|
1420
|
+
super.load(data);
|
|
1421
|
+
if (!data) {
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
const colorAnimation = data.animation;
|
|
1425
|
+
if (colorAnimation !== undefined) {
|
|
1426
|
+
if (colorAnimation.enable !== undefined) {
|
|
1427
|
+
this.animation.h.load(colorAnimation);
|
|
1428
|
+
} else {
|
|
1429
|
+
this.animation.load(data.animation);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1334
1434
|
class AnimatableGradient_AnimatableGradient {
|
|
1335
1435
|
constructor() {
|
|
1336
1436
|
this.angle = new GradientAngle;
|
|
@@ -1423,13 +1523,13 @@
|
|
|
1423
1523
|
return;
|
|
1424
1524
|
}
|
|
1425
1525
|
if (data.count !== undefined) {
|
|
1426
|
-
this.count = data.count;
|
|
1526
|
+
this.count = setRangeValue(data.count);
|
|
1427
1527
|
}
|
|
1428
1528
|
if (data.enable !== undefined) {
|
|
1429
1529
|
this.enable = data.enable;
|
|
1430
1530
|
}
|
|
1431
1531
|
if (data.speed !== undefined) {
|
|
1432
|
-
this.speed = data.speed;
|
|
1532
|
+
this.speed = setRangeValue(data.speed);
|
|
1433
1533
|
}
|
|
1434
1534
|
if (data.sync !== undefined) {
|
|
1435
1535
|
this.sync = data.sync;
|
|
@@ -1449,13 +1549,13 @@
|
|
|
1449
1549
|
return;
|
|
1450
1550
|
}
|
|
1451
1551
|
if (data.count !== undefined) {
|
|
1452
|
-
this.count = data.count;
|
|
1552
|
+
this.count = setRangeValue(data.count);
|
|
1453
1553
|
}
|
|
1454
1554
|
if (data.enable !== undefined) {
|
|
1455
1555
|
this.enable = data.enable;
|
|
1456
1556
|
}
|
|
1457
1557
|
if (data.speed !== undefined) {
|
|
1458
|
-
this.speed = data.speed;
|
|
1558
|
+
this.speed = setRangeValue(data.speed);
|
|
1459
1559
|
}
|
|
1460
1560
|
if (data.sync !== undefined) {
|
|
1461
1561
|
this.sync = data.sync;
|
|
@@ -1627,6 +1727,90 @@
|
|
|
1627
1727
|
this.duration.load(data.duration);
|
|
1628
1728
|
}
|
|
1629
1729
|
}
|
|
1730
|
+
class Attract_Attract {
|
|
1731
|
+
constructor() {
|
|
1732
|
+
this.distance = 200;
|
|
1733
|
+
this.enable = false;
|
|
1734
|
+
this.rotate = {
|
|
1735
|
+
x: 3e3,
|
|
1736
|
+
y: 3e3
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
get rotateX() {
|
|
1740
|
+
return this.rotate.x;
|
|
1741
|
+
}
|
|
1742
|
+
set rotateX(value) {
|
|
1743
|
+
this.rotate.x = value;
|
|
1744
|
+
}
|
|
1745
|
+
get rotateY() {
|
|
1746
|
+
return this.rotate.y;
|
|
1747
|
+
}
|
|
1748
|
+
set rotateY(value) {
|
|
1749
|
+
this.rotate.y = value;
|
|
1750
|
+
}
|
|
1751
|
+
load(data) {
|
|
1752
|
+
var _a, _b, _c, _d;
|
|
1753
|
+
if (!data) {
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
if (data.distance !== undefined) {
|
|
1757
|
+
this.distance = setRangeValue(data.distance);
|
|
1758
|
+
}
|
|
1759
|
+
if (data.enable !== undefined) {
|
|
1760
|
+
this.enable = data.enable;
|
|
1761
|
+
}
|
|
1762
|
+
const rotateX = (_b = (_a = data.rotate) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : data.rotateX;
|
|
1763
|
+
if (rotateX !== undefined) {
|
|
1764
|
+
this.rotate.x = rotateX;
|
|
1765
|
+
}
|
|
1766
|
+
const rotateY = (_d = (_c = data.rotate) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : data.rotateY;
|
|
1767
|
+
if (rotateY !== undefined) {
|
|
1768
|
+
this.rotate.y = rotateY;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
class MoveAngle_MoveAngle {
|
|
1773
|
+
constructor() {
|
|
1774
|
+
this.offset = 0;
|
|
1775
|
+
this.value = 90;
|
|
1776
|
+
}
|
|
1777
|
+
load(data) {
|
|
1778
|
+
if (data === undefined) {
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
if (data.offset !== undefined) {
|
|
1782
|
+
this.offset = setRangeValue(data.offset);
|
|
1783
|
+
}
|
|
1784
|
+
if (data.value !== undefined) {
|
|
1785
|
+
this.value = setRangeValue(data.value);
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
class MoveGravity_MoveGravity {
|
|
1790
|
+
constructor() {
|
|
1791
|
+
this.acceleration = 9.81;
|
|
1792
|
+
this.enable = false;
|
|
1793
|
+
this.inverse = false;
|
|
1794
|
+
this.maxSpeed = 50;
|
|
1795
|
+
}
|
|
1796
|
+
load(data) {
|
|
1797
|
+
if (!data) {
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
if (data.acceleration !== undefined) {
|
|
1801
|
+
this.acceleration = setRangeValue(data.acceleration);
|
|
1802
|
+
}
|
|
1803
|
+
if (data.enable !== undefined) {
|
|
1804
|
+
this.enable = data.enable;
|
|
1805
|
+
}
|
|
1806
|
+
if (data.inverse !== undefined) {
|
|
1807
|
+
this.inverse = data.inverse;
|
|
1808
|
+
}
|
|
1809
|
+
if (data.maxSpeed !== undefined) {
|
|
1810
|
+
this.maxSpeed = setRangeValue(data.maxSpeed);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1630
1814
|
class PathDelay_PathDelay extends(null && ValueWithRandom){
|
|
1631
1815
|
constructor() {
|
|
1632
1816
|
super();
|
|
@@ -1788,6 +1972,70 @@
|
|
|
1788
1972
|
}
|
|
1789
1973
|
}
|
|
1790
1974
|
}
|
|
1975
|
+
class AnimationOptions_AnimationOptions {
|
|
1976
|
+
constructor() {
|
|
1977
|
+
this.count = 0;
|
|
1978
|
+
this.enable = false;
|
|
1979
|
+
this.speed = 1;
|
|
1980
|
+
this.sync = false;
|
|
1981
|
+
}
|
|
1982
|
+
load(data) {
|
|
1983
|
+
if (!data) {
|
|
1984
|
+
return;
|
|
1985
|
+
}
|
|
1986
|
+
if (data.count !== undefined) {
|
|
1987
|
+
this.count = setRangeValue(data.count);
|
|
1988
|
+
}
|
|
1989
|
+
if (data.enable !== undefined) {
|
|
1990
|
+
this.enable = data.enable;
|
|
1991
|
+
}
|
|
1992
|
+
if (data.speed !== undefined) {
|
|
1993
|
+
this.speed = setRangeValue(data.speed);
|
|
1994
|
+
}
|
|
1995
|
+
if (data.sync !== undefined) {
|
|
1996
|
+
this.sync = data.sync;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
class OpacityAnimation_OpacityAnimation extends(null && AnimationOptions){
|
|
2001
|
+
constructor() {
|
|
2002
|
+
super();
|
|
2003
|
+
this.destroy = "none";
|
|
2004
|
+
this.enable = false;
|
|
2005
|
+
this.speed = 2;
|
|
2006
|
+
this.startValue = "random";
|
|
2007
|
+
this.sync = false;
|
|
2008
|
+
}
|
|
2009
|
+
get opacity_min() {
|
|
2010
|
+
return this.minimumValue;
|
|
2011
|
+
}
|
|
2012
|
+
set opacity_min(value) {
|
|
2013
|
+
this.minimumValue = value;
|
|
2014
|
+
}
|
|
2015
|
+
load(data) {
|
|
2016
|
+
var _a;
|
|
2017
|
+
if (data === undefined) {
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2020
|
+
super.load(data);
|
|
2021
|
+
if (data.destroy !== undefined) {
|
|
2022
|
+
this.destroy = data.destroy;
|
|
2023
|
+
}
|
|
2024
|
+
if (data.enable !== undefined) {
|
|
2025
|
+
this.enable = data.enable;
|
|
2026
|
+
}
|
|
2027
|
+
this.minimumValue = (_a = data.minimumValue) !== null && _a !== void 0 ? _a : data.opacity_min;
|
|
2028
|
+
if (data.speed !== undefined) {
|
|
2029
|
+
this.speed = data.speed;
|
|
2030
|
+
}
|
|
2031
|
+
if (data.startValue !== undefined) {
|
|
2032
|
+
this.startValue = data.startValue;
|
|
2033
|
+
}
|
|
2034
|
+
if (data.sync !== undefined) {
|
|
2035
|
+
this.sync = data.sync;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
1791
2039
|
class Opacity_Opacity extends(null && ValueWithRandom){
|
|
1792
2040
|
constructor() {
|
|
1793
2041
|
super();
|
|
@@ -1846,13 +2094,13 @@
|
|
|
1846
2094
|
this.enable = data.enable;
|
|
1847
2095
|
}
|
|
1848
2096
|
if (data.opacity !== undefined) {
|
|
1849
|
-
this.opacity = data.opacity;
|
|
2097
|
+
this.opacity = setRangeValue(data.opacity);
|
|
1850
2098
|
}
|
|
1851
2099
|
if (data.width !== undefined) {
|
|
1852
|
-
this.width = data.width;
|
|
2100
|
+
this.width = setRangeValue(data.width);
|
|
1853
2101
|
}
|
|
1854
2102
|
if (data.radius !== undefined) {
|
|
1855
|
-
this.radius = data.radius;
|
|
2103
|
+
this.radius = setRangeValue(data.radius);
|
|
1856
2104
|
}
|
|
1857
2105
|
if (data.color !== undefined) {
|
|
1858
2106
|
this.color = OptionsColor.create(this.color, data.color);
|
|
@@ -1877,16 +2125,33 @@
|
|
|
1877
2125
|
this.enabled = data.enabled;
|
|
1878
2126
|
}
|
|
1879
2127
|
if (data.distance !== undefined) {
|
|
1880
|
-
this.distance = data.distance;
|
|
2128
|
+
this.distance = setRangeValue(data.distance);
|
|
1881
2129
|
}
|
|
1882
2130
|
if (data.duration !== undefined) {
|
|
1883
|
-
this.duration = data.duration;
|
|
2131
|
+
this.duration = setRangeValue(data.duration);
|
|
1884
2132
|
}
|
|
1885
2133
|
if (data.factor !== undefined) {
|
|
1886
|
-
this.factor = data.factor;
|
|
2134
|
+
this.factor = setRangeValue(data.factor);
|
|
1887
2135
|
}
|
|
1888
2136
|
if (data.speed !== undefined) {
|
|
1889
|
-
this.speed = data.speed;
|
|
2137
|
+
this.speed = setRangeValue(data.speed);
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
class RollLight_RollLight {
|
|
2142
|
+
constructor() {
|
|
2143
|
+
this.enable = false;
|
|
2144
|
+
this.value = 0;
|
|
2145
|
+
}
|
|
2146
|
+
load(data) {
|
|
2147
|
+
if (!data) {
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
if (data.enable !== undefined) {
|
|
2151
|
+
this.enable = data.enable;
|
|
2152
|
+
}
|
|
2153
|
+
if (data.value !== undefined) {
|
|
2154
|
+
this.value = setRangeValue(data.value);
|
|
1890
2155
|
}
|
|
1891
2156
|
}
|
|
1892
2157
|
}
|
|
@@ -1918,6 +2183,27 @@
|
|
|
1918
2183
|
}
|
|
1919
2184
|
}
|
|
1920
2185
|
}
|
|
2186
|
+
class RotateAnimation_RotateAnimation {
|
|
2187
|
+
constructor() {
|
|
2188
|
+
this.enable = false;
|
|
2189
|
+
this.speed = 0;
|
|
2190
|
+
this.sync = false;
|
|
2191
|
+
}
|
|
2192
|
+
load(data) {
|
|
2193
|
+
if (data === undefined) {
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2196
|
+
if (data.enable !== undefined) {
|
|
2197
|
+
this.enable = data.enable;
|
|
2198
|
+
}
|
|
2199
|
+
if (data.speed !== undefined) {
|
|
2200
|
+
this.speed = setRangeValue(data.speed);
|
|
2201
|
+
}
|
|
2202
|
+
if (data.sync !== undefined) {
|
|
2203
|
+
this.sync = data.sync;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
1921
2207
|
class Rotate_Rotate extends(null && ValueWithRandom){
|
|
1922
2208
|
constructor() {
|
|
1923
2209
|
super();
|
|
@@ -2036,6 +2322,45 @@
|
|
|
2036
2322
|
}
|
|
2037
2323
|
}
|
|
2038
2324
|
}
|
|
2325
|
+
class SizeAnimation_SizeAnimation extends(null && AnimationOptions){
|
|
2326
|
+
constructor() {
|
|
2327
|
+
super();
|
|
2328
|
+
this.destroy = "none";
|
|
2329
|
+
this.enable = false;
|
|
2330
|
+
this.speed = 5;
|
|
2331
|
+
this.startValue = "random";
|
|
2332
|
+
this.sync = false;
|
|
2333
|
+
}
|
|
2334
|
+
get size_min() {
|
|
2335
|
+
return this.minimumValue;
|
|
2336
|
+
}
|
|
2337
|
+
set size_min(value) {
|
|
2338
|
+
this.minimumValue = value;
|
|
2339
|
+
}
|
|
2340
|
+
load(data) {
|
|
2341
|
+
var _a;
|
|
2342
|
+
if (data === undefined) {
|
|
2343
|
+
return;
|
|
2344
|
+
}
|
|
2345
|
+
super.load(data);
|
|
2346
|
+
if (data.destroy !== undefined) {
|
|
2347
|
+
this.destroy = data.destroy;
|
|
2348
|
+
}
|
|
2349
|
+
if (data.enable !== undefined) {
|
|
2350
|
+
this.enable = data.enable;
|
|
2351
|
+
}
|
|
2352
|
+
this.minimumValue = (_a = data.minimumValue) !== null && _a !== void 0 ? _a : data.size_min;
|
|
2353
|
+
if (data.speed !== undefined) {
|
|
2354
|
+
this.speed = data.speed;
|
|
2355
|
+
}
|
|
2356
|
+
if (data.startValue !== undefined) {
|
|
2357
|
+
this.startValue = data.startValue;
|
|
2358
|
+
}
|
|
2359
|
+
if (data.sync !== undefined) {
|
|
2360
|
+
this.sync = data.sync;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2039
2364
|
class Size_Size extends(null && ValueWithRandom){
|
|
2040
2365
|
constructor() {
|
|
2041
2366
|
super();
|
|
@@ -2081,6 +2406,27 @@
|
|
|
2081
2406
|
}
|
|
2082
2407
|
}
|
|
2083
2408
|
}
|
|
2409
|
+
class TiltAnimation_TiltAnimation {
|
|
2410
|
+
constructor() {
|
|
2411
|
+
this.enable = false;
|
|
2412
|
+
this.speed = 0;
|
|
2413
|
+
this.sync = false;
|
|
2414
|
+
}
|
|
2415
|
+
load(data) {
|
|
2416
|
+
if (data === undefined) {
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
if (data.enable !== undefined) {
|
|
2420
|
+
this.enable = data.enable;
|
|
2421
|
+
}
|
|
2422
|
+
if (data.speed !== undefined) {
|
|
2423
|
+
this.speed = setRangeValue(data.speed);
|
|
2424
|
+
}
|
|
2425
|
+
if (data.sync !== undefined) {
|
|
2426
|
+
this.sync = data.sync;
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2084
2430
|
class Tilt_Tilt extends(null && ValueWithRandom){
|
|
2085
2431
|
constructor() {
|
|
2086
2432
|
super();
|
|
@@ -2103,6 +2449,43 @@
|
|
|
2103
2449
|
}
|
|
2104
2450
|
}
|
|
2105
2451
|
}
|
|
2452
|
+
class TwinkleValues_TwinkleValues {
|
|
2453
|
+
constructor() {
|
|
2454
|
+
this.enable = false;
|
|
2455
|
+
this.frequency = .05;
|
|
2456
|
+
this.opacity = 1;
|
|
2457
|
+
}
|
|
2458
|
+
load(data) {
|
|
2459
|
+
if (data === undefined) {
|
|
2460
|
+
return;
|
|
2461
|
+
}
|
|
2462
|
+
if (data.color !== undefined) {
|
|
2463
|
+
this.color = OptionsColor.create(this.color, data.color);
|
|
2464
|
+
}
|
|
2465
|
+
if (data.enable !== undefined) {
|
|
2466
|
+
this.enable = data.enable;
|
|
2467
|
+
}
|
|
2468
|
+
if (data.frequency !== undefined) {
|
|
2469
|
+
this.frequency = data.frequency;
|
|
2470
|
+
}
|
|
2471
|
+
if (data.opacity !== undefined) {
|
|
2472
|
+
this.opacity = setRangeValue(data.opacity);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
class Twinkle_Twinkle {
|
|
2477
|
+
constructor() {
|
|
2478
|
+
this.lines = new TwinkleValues;
|
|
2479
|
+
this.particles = new TwinkleValues;
|
|
2480
|
+
}
|
|
2481
|
+
load(data) {
|
|
2482
|
+
if (data === undefined) {
|
|
2483
|
+
return;
|
|
2484
|
+
}
|
|
2485
|
+
this.lines.load(data.lines);
|
|
2486
|
+
this.particles.load(data.particles);
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2106
2489
|
class Wobble_Wobble {
|
|
2107
2490
|
constructor() {
|
|
2108
2491
|
this.distance = 5;
|
|
@@ -2500,6 +2883,7 @@
|
|
|
2500
2883
|
this.retina = {
|
|
2501
2884
|
maxDistance: {}
|
|
2502
2885
|
};
|
|
2886
|
+
this.ignoresResizeRatio = true;
|
|
2503
2887
|
const pxRatio = container.retina.pixelRatio;
|
|
2504
2888
|
const mainOptions = container.actualOptions;
|
|
2505
2889
|
const particlesOptions = new ParticlesOptions;
|
|
@@ -2539,7 +2923,7 @@
|
|
|
2539
2923
|
max: getRangeMax(sizeRange) * pxRatio,
|
|
2540
2924
|
min: getRangeMin(sizeRange) * pxRatio,
|
|
2541
2925
|
loops: 0,
|
|
2542
|
-
maxLoops: sizeOptions.animation.count
|
|
2926
|
+
maxLoops: getRangeValue(sizeOptions.animation.count)
|
|
2543
2927
|
};
|
|
2544
2928
|
const sizeAnimation = sizeOptions.animation;
|
|
2545
2929
|
if (sizeAnimation.enable) {
|
|
@@ -2573,6 +2957,12 @@
|
|
|
2573
2957
|
this.initialVelocity = this.calculateVelocity();
|
|
2574
2958
|
this.velocity = this.initialVelocity.copy();
|
|
2575
2959
|
this.moveDecay = 1 - getRangeValue(this.options.move.decay);
|
|
2960
|
+
const gravityOptions = this.options.move.gravity;
|
|
2961
|
+
this.gravity = {
|
|
2962
|
+
enable: gravityOptions.enable,
|
|
2963
|
+
acceleration: getRangeValue(gravityOptions.acceleration),
|
|
2964
|
+
inverse: gravityOptions.inverse
|
|
2965
|
+
};
|
|
2576
2966
|
this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
|
|
2577
2967
|
this.initialPosition = this.position.copy();
|
|
2578
2968
|
this.offset = Vector.origin;
|
|
@@ -2780,12 +3170,7 @@
|
|
|
2780
3170
|
return overlaps;
|
|
2781
3171
|
}
|
|
2782
3172
|
calculateVelocity() {
|
|
2783
|
-
const baseVelocity = getParticleBaseVelocity(this.direction)
|
|
2784
|
-
const res = baseVelocity.copy();
|
|
2785
|
-
const moveOptions = this.options.move;
|
|
2786
|
-
const rad = Math.PI / 180 * moveOptions.angle.value;
|
|
2787
|
-
const radOffset = Math.PI / 180 * moveOptions.angle.offset;
|
|
2788
|
-
const range = {
|
|
3173
|
+
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 = {
|
|
2789
3174
|
left: radOffset - rad / 2,
|
|
2790
3175
|
right: radOffset + rad / 2
|
|
2791
3176
|
};
|
|
@@ -2935,10 +3320,11 @@
|
|
|
2935
3320
|
}
|
|
2936
3321
|
for (const particle of this.array) {
|
|
2937
3322
|
const resizeFactor = container.canvas.resizeFactor;
|
|
2938
|
-
if (resizeFactor) {
|
|
3323
|
+
if (resizeFactor && !particle.ignoresResizeRatio) {
|
|
2939
3324
|
particle.position.x *= resizeFactor.width;
|
|
2940
3325
|
particle.position.y *= resizeFactor.height;
|
|
2941
3326
|
}
|
|
3327
|
+
particle.ignoresResizeRatio = false;
|
|
2942
3328
|
particle.bubble.inRange = false;
|
|
2943
3329
|
for (const [, plugin] of this.container.plugins) {
|
|
2944
3330
|
if (particle.destroyed) {
|
|
@@ -3174,13 +3560,13 @@
|
|
|
3174
3560
|
container.canvas.size.height = element.offsetHeight * ratio;
|
|
3175
3561
|
}
|
|
3176
3562
|
const particles = options.particles;
|
|
3177
|
-
this.attractDistance = particles.move.attract.distance * ratio;
|
|
3563
|
+
this.attractDistance = getRangeValue(particles.move.attract.distance) * ratio;
|
|
3178
3564
|
this.linksDistance = particles.links.distance * ratio;
|
|
3179
3565
|
this.linksWidth = particles.links.width * ratio;
|
|
3180
|
-
this.sizeAnimationSpeed = particles.size.animation.speed * ratio;
|
|
3181
|
-
this.maxSpeed = particles.move.gravity.maxSpeed * ratio;
|
|
3566
|
+
this.sizeAnimationSpeed = getRangeValue(particles.size.animation.speed) * ratio;
|
|
3567
|
+
this.maxSpeed = getRangeValue(particles.move.gravity.maxSpeed) * ratio;
|
|
3182
3568
|
if (particles.orbit.radius !== undefined) {
|
|
3183
|
-
this.orbitRadius = particles.orbit.radius * this.container.retina.pixelRatio;
|
|
3569
|
+
this.orbitRadius = getRangeValue(particles.orbit.radius) * this.container.retina.pixelRatio;
|
|
3184
3570
|
}
|
|
3185
3571
|
const modes = options.interactivity.modes;
|
|
3186
3572
|
this.connectModeDistance = modes.connect.distance * ratio;
|
|
@@ -3200,19 +3586,19 @@
|
|
|
3200
3586
|
const ratio = this.pixelRatio;
|
|
3201
3587
|
const moveDistance = options.move.distance;
|
|
3202
3588
|
const props = particle.retina;
|
|
3203
|
-
props.attractDistance = options.move.attract.distance * ratio;
|
|
3589
|
+
props.attractDistance = getRangeValue(options.move.attract.distance) * ratio;
|
|
3204
3590
|
props.linksDistance = options.links.distance * ratio;
|
|
3205
3591
|
props.linksWidth = options.links.width * ratio;
|
|
3206
3592
|
props.moveDrift = getRangeValue(options.move.drift) * ratio;
|
|
3207
3593
|
props.moveSpeed = getRangeValue(options.move.speed) * ratio;
|
|
3208
|
-
props.sizeAnimationSpeed = options.size.animation.speed * ratio;
|
|
3594
|
+
props.sizeAnimationSpeed = getRangeValue(options.size.animation.speed) * ratio;
|
|
3209
3595
|
if (particle.spin) {
|
|
3210
3596
|
props.spinAcceleration = getRangeValue(options.move.spin.acceleration) * ratio;
|
|
3211
3597
|
}
|
|
3212
3598
|
const maxDistance = props.maxDistance;
|
|
3213
3599
|
maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
|
|
3214
3600
|
maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
|
|
3215
|
-
props.maxSpeed = options.move.gravity.maxSpeed * ratio;
|
|
3601
|
+
props.maxSpeed = getRangeValue(options.move.gravity.maxSpeed) * ratio;
|
|
3216
3602
|
}
|
|
3217
3603
|
handleMotionChange(mediaQuery) {
|
|
3218
3604
|
const options = this.container.actualOptions;
|
|
@@ -4544,7 +4930,7 @@
|
|
|
4544
4930
|
function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
4545
4931
|
colorValue.enable = colorAnimation.enable;
|
|
4546
4932
|
if (colorValue.enable) {
|
|
4547
|
-
colorValue.velocity = colorAnimation.speed / 100 * reduceFactor;
|
|
4933
|
+
colorValue.velocity = getRangeValue(colorAnimation.speed) / 100 * reduceFactor;
|
|
4548
4934
|
if (colorAnimation.sync) {
|
|
4549
4935
|
return;
|
|
4550
4936
|
}
|
|
@@ -4835,109 +5221,6 @@
|
|
|
4835
5221
|
l: color.l + (type === "darken" ? -1 : 1) * value
|
|
4836
5222
|
};
|
|
4837
5223
|
}
|
|
4838
|
-
class ColorAnimation {
|
|
4839
|
-
constructor() {
|
|
4840
|
-
this.count = 0;
|
|
4841
|
-
this.enable = false;
|
|
4842
|
-
this.offset = 0;
|
|
4843
|
-
this.speed = 1;
|
|
4844
|
-
this.sync = true;
|
|
4845
|
-
}
|
|
4846
|
-
load(data) {
|
|
4847
|
-
if (data === undefined) {
|
|
4848
|
-
return;
|
|
4849
|
-
}
|
|
4850
|
-
if (data.count !== undefined) {
|
|
4851
|
-
this.count = data.count;
|
|
4852
|
-
}
|
|
4853
|
-
if (data.enable !== undefined) {
|
|
4854
|
-
this.enable = data.enable;
|
|
4855
|
-
}
|
|
4856
|
-
if (data.offset !== undefined) {
|
|
4857
|
-
this.offset = NumberUtils_setRangeValue(data.offset);
|
|
4858
|
-
}
|
|
4859
|
-
if (data.speed !== undefined) {
|
|
4860
|
-
this.speed = data.speed;
|
|
4861
|
-
}
|
|
4862
|
-
if (data.sync !== undefined) {
|
|
4863
|
-
this.sync = data.sync;
|
|
4864
|
-
}
|
|
4865
|
-
}
|
|
4866
|
-
}
|
|
4867
|
-
class HslAnimation {
|
|
4868
|
-
constructor() {
|
|
4869
|
-
this.h = new ColorAnimation;
|
|
4870
|
-
this.s = new ColorAnimation;
|
|
4871
|
-
this.l = new ColorAnimation;
|
|
4872
|
-
}
|
|
4873
|
-
load(data) {
|
|
4874
|
-
if (!data) {
|
|
4875
|
-
return;
|
|
4876
|
-
}
|
|
4877
|
-
this.h.load(data.h);
|
|
4878
|
-
this.s.load(data.s);
|
|
4879
|
-
this.l.load(data.l);
|
|
4880
|
-
}
|
|
4881
|
-
}
|
|
4882
|
-
class OptionsColor_OptionsColor {
|
|
4883
|
-
constructor() {
|
|
4884
|
-
this.value = "#fff";
|
|
4885
|
-
}
|
|
4886
|
-
static create(source, data) {
|
|
4887
|
-
const color = new OptionsColor_OptionsColor;
|
|
4888
|
-
color.load(source);
|
|
4889
|
-
if (data !== undefined) {
|
|
4890
|
-
if (typeof data === "string" || data instanceof Array) {
|
|
4891
|
-
color.load({
|
|
4892
|
-
value: data
|
|
4893
|
-
});
|
|
4894
|
-
} else {
|
|
4895
|
-
color.load(data);
|
|
4896
|
-
}
|
|
4897
|
-
}
|
|
4898
|
-
return color;
|
|
4899
|
-
}
|
|
4900
|
-
load(data) {
|
|
4901
|
-
if ((data === null || data === void 0 ? void 0 : data.value) === undefined) {
|
|
4902
|
-
return;
|
|
4903
|
-
}
|
|
4904
|
-
this.value = data.value;
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
|
-
class AnimatableColor_AnimatableColor extends OptionsColor_OptionsColor {
|
|
4908
|
-
constructor() {
|
|
4909
|
-
super();
|
|
4910
|
-
this.animation = new HslAnimation;
|
|
4911
|
-
}
|
|
4912
|
-
static create(source, data) {
|
|
4913
|
-
const color = new AnimatableColor_AnimatableColor;
|
|
4914
|
-
color.load(source);
|
|
4915
|
-
if (data !== undefined) {
|
|
4916
|
-
if (typeof data === "string" || data instanceof Array) {
|
|
4917
|
-
color.load({
|
|
4918
|
-
value: data
|
|
4919
|
-
});
|
|
4920
|
-
} else {
|
|
4921
|
-
color.load(data);
|
|
4922
|
-
}
|
|
4923
|
-
}
|
|
4924
|
-
return color;
|
|
4925
|
-
}
|
|
4926
|
-
load(data) {
|
|
4927
|
-
super.load(data);
|
|
4928
|
-
if (!data) {
|
|
4929
|
-
return;
|
|
4930
|
-
}
|
|
4931
|
-
const colorAnimation = data.animation;
|
|
4932
|
-
if (colorAnimation !== undefined) {
|
|
4933
|
-
if (colorAnimation.enable !== undefined) {
|
|
4934
|
-
this.animation.h.load(colorAnimation);
|
|
4935
|
-
} else {
|
|
4936
|
-
this.animation.load(data.animation);
|
|
4937
|
-
}
|
|
4938
|
-
}
|
|
4939
|
-
}
|
|
4940
|
-
}
|
|
4941
5224
|
class EmitterLife {
|
|
4942
5225
|
constructor() {
|
|
4943
5226
|
this.wait = false;
|
|
@@ -5037,10 +5320,13 @@
|
|
|
5037
5320
|
this.shape = data.shape;
|
|
5038
5321
|
}
|
|
5039
5322
|
if (data.position !== undefined) {
|
|
5040
|
-
this.position = {
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
}
|
|
5323
|
+
this.position = {};
|
|
5324
|
+
if (data.position.x) {
|
|
5325
|
+
this.position.x = NumberUtils_setRangeValue(data.position.x);
|
|
5326
|
+
}
|
|
5327
|
+
if (data.position.y) {
|
|
5328
|
+
this.position.y = NumberUtils_setRangeValue(data.position.y);
|
|
5329
|
+
}
|
|
5044
5330
|
}
|
|
5045
5331
|
if (data.spawnColor !== undefined) {
|
|
5046
5332
|
if (this.spawnColor === undefined) {
|
|
@@ -5068,8 +5354,8 @@
|
|
|
5068
5354
|
var _EmitterInstance_firstSpawn, _EmitterInstance_startParticlesAdded, _EmitterInstance_engine;
|
|
5069
5355
|
class EmitterInstance {
|
|
5070
5356
|
constructor(engine, emitters, container, options, position) {
|
|
5071
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5072
|
-
var
|
|
5357
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5358
|
+
var _h;
|
|
5073
5359
|
this.emitters = emitters;
|
|
5074
5360
|
this.container = container;
|
|
5075
5361
|
_EmitterInstance_firstSpawn.set(this, void 0);
|
|
@@ -5087,21 +5373,22 @@
|
|
|
5087
5373
|
this.options.load(options);
|
|
5088
5374
|
}
|
|
5089
5375
|
this.spawnDelay = ((_a = this.options.life.delay) !== null && _a !== void 0 ? _a : 0) * 1e3 / this.container.retina.reduceFactor;
|
|
5376
|
+
this.position = (_b = this.initialPosition) !== null && _b !== void 0 ? _b : this.calcPosition();
|
|
5090
5377
|
this.name = this.options.name;
|
|
5091
|
-
this.shape = (
|
|
5378
|
+
this.shape = (_c = EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_engine, "f").emitterShapeManager) === null || _c === void 0 ? void 0 : _c.getShape(this.options.shape);
|
|
5092
5379
|
this.fill = this.options.fill;
|
|
5093
5380
|
EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_firstSpawn, !this.options.life.wait, "f");
|
|
5094
5381
|
EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, false, "f");
|
|
5095
5382
|
let particlesOptions = Utils_deepExtend({}, this.options.particles);
|
|
5096
5383
|
particlesOptions !== null && particlesOptions !== void 0 ? particlesOptions : particlesOptions = {};
|
|
5097
|
-
(
|
|
5098
|
-
(
|
|
5384
|
+
(_d = particlesOptions.move) !== null && _d !== void 0 ? _d : particlesOptions.move = {};
|
|
5385
|
+
(_e = (_h = particlesOptions.move).direction) !== null && _e !== void 0 ? _e : _h.direction = this.options.direction;
|
|
5099
5386
|
if (this.options.spawnColor) {
|
|
5100
5387
|
this.spawnColor = ColorUtils_colorToHsl(this.options.spawnColor);
|
|
5101
5388
|
}
|
|
5102
5389
|
this.paused = !this.options.autoPlay;
|
|
5103
5390
|
this.particlesOptions = particlesOptions;
|
|
5104
|
-
this.size = (
|
|
5391
|
+
this.size = (_f = this.options.size) !== null && _f !== void 0 ? _f : (() => {
|
|
5105
5392
|
const size = new EmitterSize;
|
|
5106
5393
|
size.load({
|
|
5107
5394
|
height: 0,
|
|
@@ -5110,7 +5397,7 @@
|
|
|
5110
5397
|
});
|
|
5111
5398
|
return size;
|
|
5112
5399
|
})();
|
|
5113
|
-
this.lifeCount = (
|
|
5400
|
+
this.lifeCount = (_g = this.options.life.count) !== null && _g !== void 0 ? _g : -1;
|
|
5114
5401
|
this.immortal = this.lifeCount <= 0;
|
|
5115
5402
|
this.play();
|
|
5116
5403
|
}
|
|
@@ -5245,8 +5532,8 @@
|
|
|
5245
5532
|
const container = this.container;
|
|
5246
5533
|
const percentPosition = this.options.position;
|
|
5247
5534
|
return {
|
|
5248
|
-
x: ((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width,
|
|
5249
|
-
y: ((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height
|
|
5535
|
+
x: NumberUtils_getRangeValue((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width,
|
|
5536
|
+
y: NumberUtils_getRangeValue((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height
|
|
5250
5537
|
};
|
|
5251
5538
|
}
|
|
5252
5539
|
emit() {
|
|
@@ -5294,7 +5581,7 @@
|
|
|
5294
5581
|
const colorOffset = NumberUtils_randomInRange(animation.offset);
|
|
5295
5582
|
const delay = NumberUtils_getRangeValue(this.options.rate.delay);
|
|
5296
5583
|
const emitFactor = 1e3 * delay / container.retina.reduceFactor;
|
|
5297
|
-
const colorSpeed = (_a = animation.speed) !== null && _a !== void 0 ? _a : 0;
|
|
5584
|
+
const colorSpeed = NumberUtils_getRangeValue((_a = animation.speed) !== null && _a !== void 0 ? _a : 0);
|
|
5298
5585
|
return (initValue + colorSpeed * container.fpsLimit / emitFactor + colorOffset * 3.6) % maxValue;
|
|
5299
5586
|
}
|
|
5300
5587
|
}
|