@tsparticles/engine 3.0.0-alpha.1 → 3.0.0-beta.1
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/README.md +244 -188
- package/browser/Core/Canvas.js +273 -243
- package/browser/Core/Container.js +97 -113
- package/browser/Core/Engine.js +271 -0
- package/browser/Core/Particle.js +165 -172
- package/browser/Core/Particles.js +153 -148
- package/browser/Core/Retina.js +17 -15
- package/browser/Core/Utils/Circle.js +12 -8
- package/browser/Core/Utils/Constants.js +4 -3
- package/browser/Core/Utils/EventListeners.js +259 -235
- package/browser/Core/Utils/InteractionManager.js +6 -16
- package/browser/Core/Utils/QuadTree.js +17 -23
- package/browser/Core/Utils/Rectangle.js +2 -2
- package/browser/Core/Utils/Vector.js +1 -1
- package/browser/Core/Utils/Vector3d.js +17 -9
- package/browser/Options/Classes/AnimatableColor.js +4 -3
- package/browser/Options/Classes/AnimationOptions.js +5 -4
- package/browser/Options/Classes/Background/Background.js +1 -1
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +3 -2
- package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.js +1 -1
- package/browser/Options/Classes/ColorAnimation.js +5 -1
- package/browser/Options/Classes/HslAnimation.js +1 -1
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/browser/Options/Classes/Interactivity/Events/Events.js +9 -28
- package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +1 -1
- package/browser/Options/Classes/Interactivity/Interactivity.js +3 -10
- package/browser/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/browser/Options/Classes/ManualParticle.js +6 -7
- package/browser/Options/Classes/Options.js +28 -48
- package/browser/Options/Classes/OptionsColor.js +3 -2
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounce.js +1 -1
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +1 -1
- package/browser/Options/Classes/Particles/Collisions/Collisions.js +8 -3
- package/browser/Options/Classes/Particles/Move/Move.js +20 -50
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +1 -1
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +10 -21
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +1 -1
- package/browser/Options/Classes/Particles/Move/MoveTrail.js +3 -9
- package/browser/Options/Classes/Particles/Move/MoveTrailFill.js +1 -1
- package/browser/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/browser/Options/Classes/Particles/Move/Path/MovePath.js +2 -2
- package/browser/Options/Classes/Particles/Move/Spin.js +5 -3
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -10
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +12 -8
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -10
- package/browser/Options/Classes/Particles/ParticlesOptions.js +18 -23
- package/browser/Options/Classes/Particles/Shadow.js +1 -1
- package/browser/Options/Classes/Particles/Shape/Shape.js +10 -11
- package/browser/Options/Classes/Particles/Size/Size.js +12 -8
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +1 -10
- package/browser/Options/Classes/Particles/Stroke.js +2 -2
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +1 -1
- package/browser/Options/Classes/Responsive.js +1 -1
- package/browser/Options/Classes/Theme/Theme.js +2 -2
- package/browser/Options/Classes/ValueWithRandom.js +6 -19
- package/browser/Utils/CanvasUtils.js +19 -55
- package/browser/Utils/ColorUtils.js +18 -20
- package/browser/Utils/EventDispatcher.js +7 -6
- package/browser/Utils/HslColorManager.js +4 -6
- package/browser/Utils/NumberUtils.js +42 -46
- package/browser/Utils/OptionsUtils.js +1 -1
- package/browser/Utils/RgbColorManager.js +3 -5
- package/browser/Utils/Utils.js +135 -64
- package/browser/bundle.js +4 -97
- package/browser/export-types.js +97 -0
- package/browser/exports.js +89 -0
- package/browser/index.js +8 -199
- package/browser/init.js +12 -0
- package/browser/package.json +1 -0
- package/cjs/Core/Canvas.js +278 -248
- package/cjs/Core/Container.js +104 -120
- package/cjs/Core/Engine.js +275 -0
- package/cjs/Core/Particle.js +173 -180
- package/cjs/Core/Particles.js +154 -149
- package/cjs/Core/Retina.js +20 -18
- package/cjs/Core/Utils/Circle.js +14 -10
- package/cjs/Core/Utils/Constants.js +5 -4
- package/cjs/Core/Utils/EventListeners.js +267 -243
- package/cjs/Core/Utils/InteractionManager.js +6 -16
- package/cjs/Core/Utils/QuadTree.js +20 -26
- package/cjs/Core/Utils/Rectangle.js +4 -4
- package/cjs/Core/Utils/Vector.js +2 -2
- package/cjs/Core/Utils/Vector3d.js +17 -9
- package/cjs/Options/Classes/AnimatableColor.js +6 -5
- package/cjs/Options/Classes/AnimationOptions.js +8 -7
- package/cjs/Options/Classes/Background/Background.js +3 -3
- package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +4 -3
- package/cjs/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -3
- package/cjs/Options/Classes/ColorAnimation.js +9 -5
- package/cjs/Options/Classes/HslAnimation.js +4 -4
- package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/cjs/Options/Classes/Interactivity/Events/Events.js +15 -34
- package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +2 -2
- package/cjs/Options/Classes/Interactivity/Interactivity.js +5 -12
- package/cjs/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/cjs/Options/Classes/ManualParticle.js +7 -8
- package/cjs/Options/Classes/Options.js +41 -61
- package/cjs/Options/Classes/OptionsColor.js +3 -2
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +3 -3
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +2 -2
- package/cjs/Options/Classes/Particles/Collisions/Collisions.js +11 -6
- package/cjs/Options/Classes/Particles/Move/Move.js +31 -61
- package/cjs/Options/Classes/Particles/Move/MoveAngle.js +3 -3
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +11 -22
- package/cjs/Options/Classes/Particles/Move/MoveGravity.js +3 -3
- package/cjs/Options/Classes/Particles/Move/MoveTrail.js +4 -10
- package/cjs/Options/Classes/Particles/Move/MoveTrailFill.js +2 -2
- package/cjs/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +4 -4
- package/cjs/Options/Classes/Particles/Move/Spin.js +6 -4
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +4 -11
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +13 -9
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -11
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +32 -37
- package/cjs/Options/Classes/Particles/Shadow.js +3 -3
- package/cjs/Options/Classes/Particles/Shape/Shape.js +10 -11
- package/cjs/Options/Classes/Particles/Size/Size.js +13 -9
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +2 -11
- package/cjs/Options/Classes/Particles/Stroke.js +5 -5
- package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +2 -2
- package/cjs/Options/Classes/Responsive.js +2 -2
- package/cjs/Options/Classes/Theme/Theme.js +4 -4
- package/cjs/Options/Classes/ValueWithRandom.js +10 -23
- package/cjs/Utils/CanvasUtils.js +23 -60
- package/cjs/Utils/ColorUtils.js +31 -33
- package/cjs/Utils/EventDispatcher.js +7 -6
- package/cjs/Utils/HslColorManager.js +11 -13
- package/cjs/Utils/NumberUtils.js +44 -48
- package/cjs/Utils/OptionsUtils.js +2 -2
- package/cjs/Utils/RgbColorManager.js +7 -9
- package/cjs/Utils/Utils.js +157 -77
- package/cjs/bundle.js +4 -97
- package/cjs/export-types.js +113 -0
- package/cjs/exports.js +105 -0
- package/cjs/index.js +8 -199
- package/cjs/init.js +16 -0
- package/cjs/package.json +1 -0
- package/esm/Core/Canvas.js +273 -243
- package/esm/Core/Container.js +97 -113
- package/esm/Core/Engine.js +271 -0
- package/esm/Core/Particle.js +165 -172
- package/esm/Core/Particles.js +153 -148
- package/esm/Core/Retina.js +17 -15
- package/esm/Core/Utils/Circle.js +12 -8
- package/esm/Core/Utils/Constants.js +4 -3
- package/esm/Core/Utils/EventListeners.js +259 -235
- package/esm/Core/Utils/InteractionManager.js +6 -16
- package/esm/Core/Utils/QuadTree.js +17 -23
- package/esm/Core/Utils/Rectangle.js +2 -2
- package/esm/Core/Utils/Vector.js +1 -1
- package/esm/Core/Utils/Vector3d.js +17 -9
- package/esm/Options/Classes/AnimatableColor.js +4 -3
- package/esm/Options/Classes/AnimationOptions.js +5 -4
- package/esm/Options/Classes/Background/Background.js +1 -1
- package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +3 -2
- package/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.js +1 -1
- package/esm/Options/Classes/ColorAnimation.js +5 -1
- package/esm/Options/Classes/HslAnimation.js +1 -1
- package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -24
- package/esm/Options/Classes/Interactivity/Events/Events.js +9 -28
- package/esm/Options/Classes/Interactivity/Events/HoverEvent.js +1 -1
- package/esm/Options/Classes/Interactivity/Interactivity.js +3 -10
- package/esm/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/esm/Options/Classes/ManualParticle.js +6 -7
- package/esm/Options/Classes/Options.js +28 -48
- package/esm/Options/Classes/OptionsColor.js +3 -2
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js +1 -1
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +1 -1
- package/esm/Options/Classes/Particles/Collisions/Collisions.js +8 -3
- package/esm/Options/Classes/Particles/Move/Move.js +20 -50
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +1 -1
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +10 -21
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +1 -1
- package/esm/Options/Classes/Particles/Move/MoveTrail.js +3 -9
- package/esm/Options/Classes/Particles/Move/MoveTrailFill.js +1 -1
- package/esm/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/esm/Options/Classes/Particles/Move/Path/MovePath.js +2 -2
- package/esm/Options/Classes/Particles/Move/Spin.js +5 -3
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -10
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +12 -8
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -10
- package/esm/Options/Classes/Particles/ParticlesOptions.js +18 -23
- package/esm/Options/Classes/Particles/Shadow.js +1 -1
- package/esm/Options/Classes/Particles/Shape/Shape.js +10 -11
- package/esm/Options/Classes/Particles/Size/Size.js +12 -8
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +1 -10
- package/esm/Options/Classes/Particles/Stroke.js +2 -2
- package/esm/Options/Classes/Particles/ZIndex/ZIndex.js +1 -1
- package/esm/Options/Classes/Responsive.js +1 -1
- package/esm/Options/Classes/Theme/Theme.js +2 -2
- package/esm/Options/Classes/ValueWithRandom.js +6 -19
- package/esm/Utils/CanvasUtils.js +19 -55
- package/esm/Utils/ColorUtils.js +18 -20
- package/esm/Utils/EventDispatcher.js +7 -6
- package/esm/Utils/HslColorManager.js +4 -6
- package/esm/Utils/NumberUtils.js +42 -46
- package/esm/Utils/OptionsUtils.js +1 -1
- package/esm/Utils/RgbColorManager.js +3 -5
- package/esm/Utils/Utils.js +135 -64
- package/esm/bundle.js +4 -97
- package/esm/export-types.js +97 -0
- package/esm/exports.js +89 -0
- package/esm/index.js +8 -199
- package/esm/init.js +12 -0
- package/esm/package.json +1 -0
- package/package.json +21 -4
- package/report.html +4 -4
- package/scripts/install.js +90 -33
- package/tsparticles.engine.js +1832 -2007
- package/tsparticles.engine.min.js +1 -1
- package/tsparticles.engine.min.js.LICENSE.txt +1 -10
- package/types/Core/Canvas.d.ts +25 -21
- package/types/Core/Container.d.ts +21 -25
- package/types/Core/Engine.d.ts +71 -0
- package/types/Core/Interfaces/Colors.d.ts +2 -2
- package/types/Core/Interfaces/IBubbleParticleData.d.ts +1 -1
- package/types/Core/Interfaces/ICircleBouncer.d.ts +2 -2
- package/types/Core/Interfaces/IColorManager.d.ts +1 -1
- package/types/Core/Interfaces/IContainerInteractivity.d.ts +1 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +8 -6
- package/types/Core/Interfaces/ICoordinates.d.ts +3 -3
- package/types/Core/Interfaces/IDimension.d.ts +2 -2
- package/types/Core/Interfaces/IDrawParticleParams.d.ts +6 -6
- package/types/Core/Interfaces/IExternalInteractor.d.ts +7 -7
- package/types/Core/Interfaces/IInteractor.d.ts +8 -8
- package/types/Core/Interfaces/ILoadParams.d.ts +2 -2
- package/types/Core/Interfaces/IMouseData.d.ts +1 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +5 -4
- package/types/Core/Interfaces/IParticle.d.ts +11 -11
- package/types/Core/Interfaces/IParticleHslAnimation.d.ts +1 -1
- package/types/Core/Interfaces/IParticleMover.d.ts +2 -2
- package/types/Core/Interfaces/IParticleRetinaProps.d.ts +1 -1
- package/types/Core/Interfaces/IParticleRoll.d.ts +1 -1
- package/types/Core/Interfaces/IParticleUpdater.d.ts +7 -9
- package/types/Core/Interfaces/IParticleValueAnimation.d.ts +3 -1
- package/types/Core/Interfaces/IParticlesInteractor.d.ts +3 -3
- package/types/Core/Interfaces/IPlugin.d.ts +7 -6
- package/types/Core/Interfaces/IPositionFromSizeParams.d.ts +2 -2
- package/types/Core/Interfaces/IShapeDrawer.d.ts +1 -1
- package/types/Core/Interfaces/IShapeValues.d.ts +2 -2
- package/types/Core/Interfaces/ITrailFillData.d.ts +1 -1
- package/types/Core/Particle.d.ts +27 -27
- package/types/Core/Particles.d.ts +24 -21
- package/types/Core/Retina.d.ts +2 -2
- package/types/Core/Utils/Circle.d.ts +2 -2
- package/types/Core/Utils/Constants.d.ts +4 -3
- package/types/Core/Utils/EventListeners.d.ts +21 -19
- package/types/Core/Utils/ExternalInteractorBase.d.ts +5 -5
- package/types/Core/Utils/InteractionManager.d.ts +5 -5
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +5 -5
- package/types/Core/Utils/Point.d.ts +2 -2
- package/types/Core/Utils/QuadTree.d.ts +8 -11
- package/types/Core/Utils/Range.d.ts +1 -1
- package/types/Core/Utils/Rectangle.d.ts +3 -3
- package/types/Core/Utils/Vector.d.ts +2 -2
- package/types/Core/Utils/Vector3d.d.ts +3 -2
- package/types/Enums/Modes/{SizeMode.d.ts → PixelMode.d.ts} +1 -1
- package/types/Options/Classes/AnimatableColor.d.ts +6 -6
- package/types/Options/Classes/AnimationOptions.d.ts +7 -7
- package/types/Options/Classes/Background/Background.d.ts +4 -4
- package/types/Options/Classes/BackgroundMask/BackgroundMask.d.ts +4 -4
- package/types/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +4 -4
- package/types/Options/Classes/ColorAnimation.d.ts +5 -4
- package/types/Options/Classes/FullScreen/FullScreen.d.ts +3 -3
- package/types/Options/Classes/HslAnimation.d.ts +4 -4
- package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +5 -5
- package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +6 -12
- package/types/Options/Classes/Interactivity/Events/Events.d.ts +8 -14
- package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +6 -6
- package/types/Options/Classes/Interactivity/Events/Parallax.d.ts +3 -3
- package/types/Options/Classes/Interactivity/Events/ResizeEvent.d.ts +3 -3
- package/types/Options/Classes/Interactivity/Interactivity.d.ts +8 -10
- package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +5 -5
- package/types/Options/Classes/ManualParticle.d.ts +5 -5
- package/types/Options/Classes/Options.d.ts +19 -26
- package/types/Options/Classes/OptionsColor.d.ts +5 -5
- package/types/Options/Classes/Particles/Bounce/ParticlesBounce.d.ts +4 -4
- package/types/Options/Classes/Particles/Bounce/ParticlesBounceFactor.d.ts +1 -1
- package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +9 -7
- package/types/Options/Classes/Particles/Collisions/CollisionsAbsorb.d.ts +3 -3
- package/types/Options/Classes/Particles/Collisions/CollisionsOverlap.d.ts +3 -3
- package/types/Options/Classes/Particles/Move/Move.d.ts +15 -26
- package/types/Options/Classes/Particles/Move/MoveAngle.d.ts +4 -4
- package/types/Options/Classes/Particles/Move/MoveAttract.d.ts +5 -9
- package/types/Options/Classes/Particles/Move/MoveCenter.d.ts +5 -5
- package/types/Options/Classes/Particles/Move/MoveGravity.d.ts +4 -4
- package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +4 -7
- package/types/Options/Classes/Particles/Move/MoveTrailFill.d.ts +4 -4
- package/types/Options/Classes/Particles/Move/OutModes.d.ts +5 -5
- package/types/Options/Classes/Particles/Move/Path/MovePath.d.ts +5 -5
- package/types/Options/Classes/Particles/Move/Spin.d.ts +5 -5
- package/types/Options/Classes/Particles/Number/ParticlesDensity.d.ts +3 -9
- package/types/Options/Classes/Particles/Number/ParticlesNumber.d.ts +4 -6
- package/types/Options/Classes/Particles/Opacity/Opacity.d.ts +7 -7
- package/types/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +5 -7
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +19 -19
- package/types/Options/Classes/Particles/Shadow.d.ts +5 -5
- package/types/Options/Classes/Particles/Shape/Shape.d.ts +5 -5
- package/types/Options/Classes/Particles/Size/Size.d.ts +7 -7
- package/types/Options/Classes/Particles/Size/SizeAnimation.d.ts +5 -7
- package/types/Options/Classes/Particles/Stroke.d.ts +5 -5
- package/types/Options/Classes/Particles/ZIndex/ZIndex.d.ts +4 -4
- package/types/Options/Classes/Random.d.ts +3 -3
- package/types/Options/Classes/Responsive.d.ts +7 -7
- package/types/Options/Classes/Theme/Theme.d.ts +6 -6
- package/types/Options/Classes/Theme/ThemeDefault.d.ts +4 -4
- package/types/Options/Classes/ValueWithRandom.d.ts +7 -11
- package/types/Options/Interfaces/Background/IBackground.d.ts +1 -1
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +2 -2
- package/types/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.d.ts +1 -1
- package/types/Options/Interfaces/IAnimatable.d.ts +1 -1
- package/types/Options/Interfaces/IAnimatableColor.d.ts +3 -3
- package/types/Options/Interfaces/IAnimation.d.ts +4 -4
- package/types/Options/Interfaces/IColorAnimation.d.ts +2 -2
- package/types/Options/Interfaces/IHslAnimation.d.ts +1 -1
- package/types/Options/Interfaces/IManualParticle.d.ts +3 -3
- package/types/Options/Interfaces/IOptionLoader.d.ts +1 -1
- package/types/Options/Interfaces/IOptions.d.ts +12 -15
- package/types/Options/Interfaces/IOptionsColor.d.ts +1 -1
- package/types/Options/Interfaces/IResponsive.d.ts +5 -4
- package/types/Options/Interfaces/IValueWithRandom.d.ts +3 -3
- package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +2 -2
- package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +3 -6
- package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +5 -8
- package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +3 -3
- package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +3 -4
- package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +1 -2
- package/types/Options/Interfaces/Particles/Bounce/IParticlesBounce.d.ts +1 -1
- package/types/Options/Interfaces/Particles/Collisions/ICollisions.d.ts +6 -4
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +15 -15
- package/types/Options/Interfaces/Particles/IShadow.d.ts +2 -2
- package/types/Options/Interfaces/Particles/IStroke.d.ts +5 -4
- package/types/Options/Interfaces/Particles/Move/IMove.d.ts +12 -17
- package/types/Options/Interfaces/Particles/Move/IMoveAngle.d.ts +1 -1
- package/types/Options/Interfaces/Particles/Move/IMoveAttract.d.ts +2 -4
- package/types/Options/Interfaces/Particles/Move/IMoveCenter.d.ts +1 -1
- package/types/Options/Interfaces/Particles/Move/IMoveGravity.d.ts +1 -1
- package/types/Options/Interfaces/Particles/Move/IMoveTrail.d.ts +1 -3
- package/types/Options/Interfaces/Particles/Move/IMoveTrailFill.d.ts +1 -1
- package/types/Options/Interfaces/Particles/Move/IOutModes.d.ts +1 -1
- package/types/Options/Interfaces/Particles/Move/ISpin.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Move/Path/IMovePath.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Number/IParticlesDensity.d.ts +0 -3
- package/types/Options/Interfaces/Particles/Number/IParticlesNumber.d.ts +1 -2
- package/types/Options/Interfaces/Particles/Opacity/IOpacity.d.ts +2 -3
- package/types/Options/Interfaces/Particles/Opacity/IOpacityAnimation.d.ts +2 -3
- package/types/Options/Interfaces/Particles/Shape/IShape.d.ts +2 -2
- package/types/Options/Interfaces/Particles/Size/ISize.d.ts +2 -3
- package/types/Options/Interfaces/Particles/Size/ISizeAnimation.d.ts +2 -3
- package/types/Options/Interfaces/Particles/ZIndex/IZIndex.d.ts +1 -1
- package/types/Options/Interfaces/Theme/ITheme.d.ts +4 -3
- package/types/Options/Interfaces/Theme/IThemeDefault.d.ts +1 -1
- package/types/Types/CustomEventArgs.d.ts +1 -1
- package/types/Types/CustomEventListener.d.ts +1 -1
- package/types/Types/ExportResult.d.ts +5 -0
- package/types/Types/ISourceOptions.d.ts +2 -2
- package/types/Types/ParticlesGroups.d.ts +1 -1
- package/types/Types/RangeValue.d.ts +1 -1
- package/types/Types/ShapeData.d.ts +2 -2
- package/types/Types/ShapeDrawerFunctions.d.ts +3 -3
- package/types/Utils/CanvasUtils.d.ts +11 -14
- package/types/Utils/ColorUtils.d.ts +6 -6
- package/types/Utils/EventDispatcher.d.ts +2 -2
- package/types/Utils/HslColorManager.d.ts +2 -2
- package/types/Utils/NumberUtils.d.ts +8 -8
- package/types/Utils/OptionsUtils.d.ts +6 -6
- package/types/Utils/RgbColorManager.d.ts +2 -2
- package/types/Utils/Utils.d.ts +32 -14
- package/types/bundle.d.ts +2 -91
- package/types/export-types.d.ts +107 -0
- package/types/exports.d.ts +89 -0
- package/types/index.d.ts +3 -204
- package/types/init.d.ts +2 -0
- package/umd/Core/Canvas.js +279 -249
- package/umd/Core/Container.js +105 -121
- package/umd/Core/Engine.js +285 -0
- package/umd/Core/Particle.js +174 -181
- package/umd/Core/Particles.js +155 -150
- package/umd/Core/Retina.js +21 -19
- package/umd/Core/Utils/Circle.js +15 -11
- package/umd/Core/Utils/Constants.js +5 -4
- package/umd/Core/Utils/EventListeners.js +268 -244
- package/umd/Core/Utils/InteractionManager.js +6 -16
- package/umd/Core/Utils/QuadTree.js +21 -27
- package/umd/Core/Utils/Rectangle.js +5 -5
- package/umd/Core/Utils/Vector.js +3 -3
- package/umd/Core/Utils/Vector3d.js +18 -10
- package/umd/Options/Classes/AnimatableColor.js +7 -6
- package/umd/Options/Classes/AnimationOptions.js +9 -8
- package/umd/Options/Classes/Background/Background.js +4 -4
- package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +5 -4
- package/umd/Options/Classes/BackgroundMask/BackgroundMaskCover.js +4 -4
- package/umd/Options/Classes/ColorAnimation.js +10 -6
- package/umd/Options/Classes/HslAnimation.js +5 -5
- package/umd/Options/Classes/Interactivity/Events/DivEvent.js +1 -25
- package/umd/Options/Classes/Interactivity/Events/Events.js +16 -35
- package/umd/Options/Classes/Interactivity/Events/HoverEvent.js +3 -3
- package/umd/Options/Classes/Interactivity/Interactivity.js +6 -13
- package/umd/Options/Classes/Interactivity/Modes/Modes.js +11 -8
- package/umd/Options/Classes/ManualParticle.js +8 -9
- package/umd/Options/Classes/Options.js +42 -62
- package/umd/Options/Classes/OptionsColor.js +4 -3
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounce.js +4 -4
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +3 -3
- package/umd/Options/Classes/Particles/Collisions/Collisions.js +12 -7
- package/umd/Options/Classes/Particles/Move/Move.js +32 -62
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +4 -4
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +12 -23
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -4
- package/umd/Options/Classes/Particles/Move/MoveTrail.js +5 -11
- package/umd/Options/Classes/Particles/Move/MoveTrailFill.js +3 -3
- package/umd/Options/Classes/Particles/Move/OutModes.js +4 -5
- package/umd/Options/Classes/Particles/Move/Path/MovePath.js +5 -5
- package/umd/Options/Classes/Particles/Move/Spin.js +7 -5
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +2 -21
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +5 -12
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +14 -10
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +3 -12
- package/umd/Options/Classes/Particles/ParticlesOptions.js +33 -38
- package/umd/Options/Classes/Particles/Shadow.js +4 -4
- package/umd/Options/Classes/Particles/Shape/Shape.js +11 -12
- package/umd/Options/Classes/Particles/Size/Size.js +14 -10
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +3 -12
- package/umd/Options/Classes/Particles/Stroke.js +6 -6
- package/umd/Options/Classes/Particles/ZIndex/ZIndex.js +3 -3
- package/umd/Options/Classes/Responsive.js +3 -3
- package/umd/Options/Classes/Theme/Theme.js +5 -5
- package/umd/Options/Classes/ValueWithRandom.js +11 -24
- package/umd/Utils/CanvasUtils.js +24 -61
- package/umd/Utils/ColorUtils.js +32 -34
- package/umd/Utils/EventDispatcher.js +7 -6
- package/umd/Utils/HslColorManager.js +12 -14
- package/umd/Utils/NumberUtils.js +45 -49
- package/umd/Utils/OptionsUtils.js +3 -3
- package/umd/Utils/RgbColorManager.js +8 -10
- package/umd/Utils/Utils.js +158 -78
- package/umd/bundle.js +5 -98
- package/umd/export-types.js +123 -0
- package/umd/exports.js +115 -0
- package/umd/index.js +9 -200
- package/umd/init.js +26 -0
- package/browser/Core/Utils/FrameManager.js +0 -42
- package/browser/Core/Utils/Plugins.js +0 -112
- package/browser/Options/Interfaces/Particles/Shape/IImageShape.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -1
- package/browser/Options/Interfaces/Particles/Shape/IStarShape.js +0 -1
- package/browser/engine.js +0 -175
- package/cjs/Core/Utils/FrameManager.js +0 -46
- package/cjs/Core/Utils/Plugins.js +0 -116
- package/cjs/Enums/Modes/SizeMode.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IImageShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -2
- package/cjs/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -17
- package/cjs/Options/Interfaces/Particles/Shape/IStarShape.js +0 -2
- package/cjs/engine.js +0 -179
- package/esm/Core/Interfaces/IParticleOverride.js +0 -1
- package/esm/Core/Interfaces/IParticlesMover.js +0 -1
- package/esm/Core/Utils/FrameManager.js +0 -42
- package/esm/Core/Utils/Plugins.js +0 -112
- package/esm/Enums/Modes/SizeMode.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IImageShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -1
- package/esm/Options/Interfaces/Particles/Shape/IStarShape.js +0 -1
- package/esm/engine.js +0 -175
- package/types/Core/Interfaces/IParticleOverride.d.ts +0 -6
- package/types/Core/Interfaces/IParticlesMover.d.ts +0 -7
- package/types/Core/Utils/FrameManager.d.ts +0 -6
- package/types/Core/Utils/Plugins.d.ts +0 -51
- package/types/Options/Interfaces/Particles/Shape/ICharacterShape.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Shape/IImageShape.d.ts +0 -8
- package/types/Options/Interfaces/Particles/Shape/IPolygonShape.d.ts +0 -5
- package/types/Options/Interfaces/Particles/Shape/IShapeValues.d.ts +0 -1
- package/types/Options/Interfaces/Particles/Shape/IStarShape.d.ts +0 -6
- package/types/engine.d.ts +0 -39
- package/umd/Core/Utils/FrameManager.js +0 -56
- package/umd/Core/Utils/Plugins.js +0 -126
- package/umd/Enums/Modes/SizeMode.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/ICharacterShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IImageShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IPolygonShape.js +0 -12
- package/umd/Options/Interfaces/Particles/Shape/IShapeValues.js +0 -27
- package/umd/Options/Interfaces/Particles/Shape/IStarShape.js +0 -12
- package/umd/engine.js +0 -189
- /package/browser/{Core/Interfaces/IParticleOverride.js → Enums/Modes/PixelMode.js} +0 -0
- /package/browser/{Core/Interfaces/IParticlesMover.js → Types/ExportResult.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticleOverride.js → Enums/Modes/PixelMode.js} +0 -0
- /package/cjs/{Core/Interfaces/IParticlesMover.js → Types/ExportResult.js} +0 -0
- /package/{browser/Enums/Modes/SizeMode.js → esm/Enums/Modes/PixelMode.js} +0 -0
- /package/{browser/Options/Interfaces/Particles/Shape/ICharacterShape.js → esm/Types/ExportResult.js} +0 -0
- /package/umd/{Core/Interfaces/IParticleOverride.js → Enums/Modes/PixelMode.js} +0 -0
- /package/umd/{Core/Interfaces/IParticlesMover.js → Types/ExportResult.js} +0 -0
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { Circle } from "./Circle";
|
|
2
|
-
import { Rectangle } from "./Rectangle";
|
|
3
|
-
import { getDistance } from "../../Utils/NumberUtils";
|
|
1
|
+
import { Circle } from "./Circle.js";
|
|
2
|
+
import { Rectangle } from "./Rectangle.js";
|
|
3
|
+
import { getDistance } from "../../Utils/NumberUtils.js";
|
|
4
4
|
export class QuadTree {
|
|
5
5
|
constructor(rectangle, capacity) {
|
|
6
6
|
this.rectangle = rectangle;
|
|
7
7
|
this.capacity = capacity;
|
|
8
|
+
this._subdivide = () => {
|
|
9
|
+
const { x, y } = this.rectangle.position, { width, height } = this.rectangle.size, { capacity } = this;
|
|
10
|
+
for (let i = 0; i < 4; i++) {
|
|
11
|
+
this._subs.push(new QuadTree(new Rectangle(x + (width / 2) * (i % 2), y + (height / 2) * (Math.round(i / 2) - (i % 2)), width / 2, height / 2), capacity));
|
|
12
|
+
}
|
|
13
|
+
this._divided = true;
|
|
14
|
+
};
|
|
8
15
|
this._points = [];
|
|
9
16
|
this._divided = false;
|
|
17
|
+
this._subs = [];
|
|
10
18
|
}
|
|
11
19
|
insert(point) {
|
|
12
|
-
var _a, _b, _c, _d, _e;
|
|
13
20
|
if (!this.rectangle.contains(point.position)) {
|
|
14
21
|
return false;
|
|
15
22
|
}
|
|
@@ -18,16 +25,12 @@ export class QuadTree {
|
|
|
18
25
|
return true;
|
|
19
26
|
}
|
|
20
27
|
if (!this._divided) {
|
|
21
|
-
this.
|
|
28
|
+
this._subdivide();
|
|
22
29
|
}
|
|
23
|
-
return ((
|
|
24
|
-
((_b = this._NW) === null || _b === void 0 ? void 0 : _b.insert(point)) ||
|
|
25
|
-
((_c = this._SE) === null || _c === void 0 ? void 0 : _c.insert(point)) ||
|
|
26
|
-
((_d = this._SW) === null || _d === void 0 ? void 0 : _d.insert(point)))) !== null && _e !== void 0 ? _e : false);
|
|
30
|
+
return this._subs.some((sub) => sub.insert(point));
|
|
27
31
|
}
|
|
28
32
|
query(range, check, found) {
|
|
29
|
-
|
|
30
|
-
const res = found !== null && found !== void 0 ? found : [];
|
|
33
|
+
const res = found || [];
|
|
31
34
|
if (!range.intersects(this.rectangle)) {
|
|
32
35
|
return [];
|
|
33
36
|
}
|
|
@@ -40,10 +43,9 @@ export class QuadTree {
|
|
|
40
43
|
res.push(p.particle);
|
|
41
44
|
}
|
|
42
45
|
if (this._divided) {
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(_d = this._SW) === null || _d === void 0 ? void 0 : _d.query(range, check, res);
|
|
46
|
+
for (const sub of this._subs) {
|
|
47
|
+
sub.query(range, check, res);
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
return res;
|
|
49
51
|
}
|
|
@@ -53,12 +55,4 @@ export class QuadTree {
|
|
|
53
55
|
queryRectangle(position, size, check) {
|
|
54
56
|
return this.query(new Rectangle(position.x, position.y, size.width, size.height), check);
|
|
55
57
|
}
|
|
56
|
-
subdivide() {
|
|
57
|
-
const x = this.rectangle.position.x, y = this.rectangle.position.y, w = this.rectangle.size.width, h = this.rectangle.size.height, capacity = this.capacity;
|
|
58
|
-
this._NE = new QuadTree(new Rectangle(x, y, w / 2, h / 2), capacity);
|
|
59
|
-
this._NW = new QuadTree(new Rectangle(x + w / 2, y, w / 2, h / 2), capacity);
|
|
60
|
-
this._SE = new QuadTree(new Rectangle(x, y + h / 2, w / 2, h / 2), capacity);
|
|
61
|
-
this._SW = new QuadTree(new Rectangle(x + w / 2, y + h / 2, w / 2, h / 2), capacity);
|
|
62
|
-
this._divided = true;
|
|
63
|
-
}
|
|
64
58
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { errorPrefix } from "./Constants.js";
|
|
2
|
+
import { isNumber } from "../../Utils/Utils.js";
|
|
1
3
|
export class Vector3d {
|
|
2
4
|
constructor(xOrCoords, y, z) {
|
|
3
|
-
|
|
5
|
+
this._updateFromAngle = (angle, length) => {
|
|
6
|
+
this.x = Math.cos(angle) * length;
|
|
7
|
+
this.y = Math.sin(angle) * length;
|
|
8
|
+
};
|
|
9
|
+
if (!isNumber(xOrCoords) && xOrCoords) {
|
|
4
10
|
this.x = xOrCoords.x;
|
|
5
11
|
this.y = xOrCoords.y;
|
|
6
12
|
const coords3d = xOrCoords;
|
|
@@ -9,10 +15,10 @@ export class Vector3d {
|
|
|
9
15
|
else if (xOrCoords !== undefined && y !== undefined) {
|
|
10
16
|
this.x = xOrCoords;
|
|
11
17
|
this.y = y;
|
|
12
|
-
this.z = z
|
|
18
|
+
this.z = z ?? 0;
|
|
13
19
|
}
|
|
14
20
|
else {
|
|
15
|
-
throw new Error(
|
|
21
|
+
throw new Error(`${errorPrefix} Vector3d not initialized correctly`);
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
static get origin() {
|
|
@@ -22,13 +28,13 @@ export class Vector3d {
|
|
|
22
28
|
return Math.atan2(this.y, this.x);
|
|
23
29
|
}
|
|
24
30
|
set angle(angle) {
|
|
25
|
-
this.
|
|
31
|
+
this._updateFromAngle(angle, this.length);
|
|
26
32
|
}
|
|
27
33
|
get length() {
|
|
28
34
|
return Math.sqrt(this.getLengthSq());
|
|
29
35
|
}
|
|
30
36
|
set length(length) {
|
|
31
|
-
this.
|
|
37
|
+
this._updateFromAngle(this.angle, length);
|
|
32
38
|
}
|
|
33
39
|
static clone(source) {
|
|
34
40
|
return Vector3d.create(source.x, source.y, source.z);
|
|
@@ -72,6 +78,12 @@ export class Vector3d {
|
|
|
72
78
|
this.y *= n;
|
|
73
79
|
this.z *= n;
|
|
74
80
|
}
|
|
81
|
+
normalize() {
|
|
82
|
+
const length = this.length;
|
|
83
|
+
if (length != 0) {
|
|
84
|
+
this.multTo(1.0 / length);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
75
87
|
rotate(angle) {
|
|
76
88
|
return Vector3d.create(this.x * Math.cos(angle) - this.y * Math.sin(angle), this.x * Math.sin(angle) + this.y * Math.cos(angle), 0);
|
|
77
89
|
}
|
|
@@ -89,8 +101,4 @@ export class Vector3d {
|
|
|
89
101
|
this.y -= v.y;
|
|
90
102
|
this.z -= v.z;
|
|
91
103
|
}
|
|
92
|
-
updateFromAngle(angle, length) {
|
|
93
|
-
this.x = Math.cos(angle) * length;
|
|
94
|
-
this.y = Math.sin(angle) * length;
|
|
95
|
-
}
|
|
96
104
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isArray, isString } from "../../Utils/Utils.js";
|
|
2
|
+
import { HslAnimation } from "./HslAnimation.js";
|
|
3
|
+
import { OptionsColor } from "./OptionsColor.js";
|
|
3
4
|
export class AnimatableColor extends OptionsColor {
|
|
4
5
|
constructor() {
|
|
5
6
|
super();
|
|
@@ -9,7 +10,7 @@ export class AnimatableColor extends OptionsColor {
|
|
|
9
10
|
const color = new AnimatableColor();
|
|
10
11
|
color.load(source);
|
|
11
12
|
if (data !== undefined) {
|
|
12
|
-
if (
|
|
13
|
+
if (isString(data) || isArray(data)) {
|
|
13
14
|
color.load({ value: data });
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { setRangeValue } from "../../Utils/NumberUtils";
|
|
1
|
+
import { setRangeValue } from "../../Utils/NumberUtils.js";
|
|
2
2
|
export class AnimationOptions {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.count = 0;
|
|
5
5
|
this.enable = false;
|
|
6
6
|
this.speed = 1;
|
|
7
7
|
this.decay = 0;
|
|
8
|
+
this.delay = 0;
|
|
8
9
|
this.sync = false;
|
|
9
10
|
}
|
|
10
11
|
load(data) {
|
|
@@ -23,6 +24,9 @@ export class AnimationOptions {
|
|
|
23
24
|
if (data.decay !== undefined) {
|
|
24
25
|
this.decay = setRangeValue(data.decay);
|
|
25
26
|
}
|
|
27
|
+
if (data.delay !== undefined) {
|
|
28
|
+
this.delay = setRangeValue(data.delay);
|
|
29
|
+
}
|
|
26
30
|
if (data.sync !== undefined) {
|
|
27
31
|
this.sync = data.sync;
|
|
28
32
|
}
|
|
@@ -39,9 +43,6 @@ export class RangedAnimationOptions extends AnimationOptions {
|
|
|
39
43
|
if (!data) {
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
42
|
-
if (data.minimumValue !== undefined) {
|
|
43
|
-
this.minimumValue = data.minimumValue;
|
|
44
|
-
}
|
|
45
46
|
if (data.mode !== undefined) {
|
|
46
47
|
this.mode = data.mode;
|
|
47
48
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BackgroundMaskCover } from "./BackgroundMaskCover";
|
|
1
|
+
import { BackgroundMaskCover } from "./BackgroundMaskCover.js";
|
|
2
|
+
import { isString } from "../../../Utils/Utils.js";
|
|
2
3
|
export class BackgroundMask {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.composite = "destination-out";
|
|
@@ -14,7 +15,7 @@ export class BackgroundMask {
|
|
|
14
15
|
}
|
|
15
16
|
if (data.cover !== undefined) {
|
|
16
17
|
const cover = data.cover;
|
|
17
|
-
const color = (
|
|
18
|
+
const color = (isString(data.cover) ? { color: data.cover } : data.cover);
|
|
18
19
|
this.cover.load(cover.color !== undefined ? cover : { color: color });
|
|
19
20
|
}
|
|
20
21
|
if (data.enable !== undefined) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { setRangeValue } from "../../Utils/NumberUtils";
|
|
1
|
+
import { setRangeValue } from "../../Utils/NumberUtils.js";
|
|
2
2
|
export class ColorAnimation {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.count = 0;
|
|
5
5
|
this.enable = false;
|
|
6
6
|
this.offset = 0;
|
|
7
7
|
this.speed = 1;
|
|
8
|
+
this.delay = 0;
|
|
8
9
|
this.decay = 0;
|
|
9
10
|
this.sync = true;
|
|
10
11
|
}
|
|
@@ -27,6 +28,9 @@ export class ColorAnimation {
|
|
|
27
28
|
if (data.decay !== undefined) {
|
|
28
29
|
this.decay = setRangeValue(data.decay);
|
|
29
30
|
}
|
|
31
|
+
if (data.delay !== undefined) {
|
|
32
|
+
this.delay = setRangeValue(data.delay);
|
|
33
|
+
}
|
|
30
34
|
if (data.sync !== undefined) {
|
|
31
35
|
this.sync = data.sync;
|
|
32
36
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { executeOnSingleOrMultiple } from "../../../../Utils/Utils";
|
|
2
1
|
export class DivEvent {
|
|
3
2
|
constructor() {
|
|
4
3
|
this.selectors = [];
|
|
@@ -6,33 +5,10 @@ export class DivEvent {
|
|
|
6
5
|
this.mode = [];
|
|
7
6
|
this.type = "circle";
|
|
8
7
|
}
|
|
9
|
-
get el() {
|
|
10
|
-
return this.elementId;
|
|
11
|
-
}
|
|
12
|
-
set el(value) {
|
|
13
|
-
this.elementId = value;
|
|
14
|
-
}
|
|
15
|
-
get elementId() {
|
|
16
|
-
return this.ids;
|
|
17
|
-
}
|
|
18
|
-
set elementId(value) {
|
|
19
|
-
this.ids = value;
|
|
20
|
-
}
|
|
21
|
-
get ids() {
|
|
22
|
-
return executeOnSingleOrMultiple(this.selectors, (t) => t.replace("#", ""));
|
|
23
|
-
}
|
|
24
|
-
set ids(value) {
|
|
25
|
-
this.selectors = executeOnSingleOrMultiple(value, (t) => `#${t}`);
|
|
26
|
-
}
|
|
27
8
|
load(data) {
|
|
28
|
-
var _a, _b;
|
|
29
9
|
if (!data) {
|
|
30
10
|
return;
|
|
31
11
|
}
|
|
32
|
-
const ids = (_b = (_a = data.ids) !== null && _a !== void 0 ? _a : data.elementId) !== null && _b !== void 0 ? _b : data.el;
|
|
33
|
-
if (ids !== undefined) {
|
|
34
|
-
this.ids = ids;
|
|
35
|
-
}
|
|
36
12
|
if (data.selectors !== undefined) {
|
|
37
13
|
this.selectors = data.selectors;
|
|
38
14
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { executeOnSingleOrMultiple, isBoolean } from "../../../../Utils/Utils.js";
|
|
2
|
+
import { ClickEvent } from "./ClickEvent.js";
|
|
3
|
+
import { DivEvent } from "./DivEvent.js";
|
|
4
|
+
import { HoverEvent } from "./HoverEvent.js";
|
|
5
|
+
import { ResizeEvent } from "./ResizeEvent.js";
|
|
6
6
|
export class Events {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.onClick = new ClickEvent();
|
|
@@ -10,31 +10,12 @@ export class Events {
|
|
|
10
10
|
this.onHover = new HoverEvent();
|
|
11
11
|
this.resize = new ResizeEvent();
|
|
12
12
|
}
|
|
13
|
-
get onclick() {
|
|
14
|
-
return this.onClick;
|
|
15
|
-
}
|
|
16
|
-
set onclick(value) {
|
|
17
|
-
this.onClick = value;
|
|
18
|
-
}
|
|
19
|
-
get ondiv() {
|
|
20
|
-
return this.onDiv;
|
|
21
|
-
}
|
|
22
|
-
set ondiv(value) {
|
|
23
|
-
this.onDiv = value;
|
|
24
|
-
}
|
|
25
|
-
get onhover() {
|
|
26
|
-
return this.onHover;
|
|
27
|
-
}
|
|
28
|
-
set onhover(value) {
|
|
29
|
-
this.onHover = value;
|
|
30
|
-
}
|
|
31
13
|
load(data) {
|
|
32
|
-
var _a, _b, _c;
|
|
33
14
|
if (!data) {
|
|
34
15
|
return;
|
|
35
16
|
}
|
|
36
|
-
this.onClick.load(
|
|
37
|
-
const onDiv =
|
|
17
|
+
this.onClick.load(data.onClick);
|
|
18
|
+
const onDiv = data.onDiv;
|
|
38
19
|
if (onDiv !== undefined) {
|
|
39
20
|
this.onDiv = executeOnSingleOrMultiple(onDiv, (t) => {
|
|
40
21
|
const tmp = new DivEvent();
|
|
@@ -42,8 +23,8 @@ export class Events {
|
|
|
42
23
|
return tmp;
|
|
43
24
|
});
|
|
44
25
|
}
|
|
45
|
-
this.onHover.load(
|
|
46
|
-
if (
|
|
26
|
+
this.onHover.load(data.onHover);
|
|
27
|
+
if (isBoolean(data.resize)) {
|
|
47
28
|
this.resize.enable = data.resize;
|
|
48
29
|
}
|
|
49
30
|
else {
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import { Events } from "./Events/Events";
|
|
2
|
-
import { Modes } from "./Modes/Modes";
|
|
1
|
+
import { Events } from "./Events/Events.js";
|
|
2
|
+
import { Modes } from "./Modes/Modes.js";
|
|
3
3
|
export class Interactivity {
|
|
4
4
|
constructor(engine, container) {
|
|
5
5
|
this.detectsOn = "window";
|
|
6
6
|
this.events = new Events();
|
|
7
7
|
this.modes = new Modes(engine, container);
|
|
8
8
|
}
|
|
9
|
-
get detect_on() {
|
|
10
|
-
return this.detectsOn;
|
|
11
|
-
}
|
|
12
|
-
set detect_on(value) {
|
|
13
|
-
this.detectsOn = value;
|
|
14
|
-
}
|
|
15
9
|
load(data) {
|
|
16
|
-
var _a;
|
|
17
10
|
if (!data) {
|
|
18
11
|
return;
|
|
19
12
|
}
|
|
20
|
-
const detectsOn =
|
|
13
|
+
const detectsOn = data.detectsOn;
|
|
21
14
|
if (detectsOn !== undefined) {
|
|
22
15
|
this.detectsOn = detectsOn;
|
|
23
16
|
}
|
|
@@ -7,15 +7,18 @@ export class Modes {
|
|
|
7
7
|
if (!data) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
if (this._container) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
if (!this._container) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
14
|
+
if (!interactors) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
for (const interactor of interactors) {
|
|
18
|
+
if (!interactor.loadModeOptions) {
|
|
19
|
+
continue;
|
|
18
20
|
}
|
|
21
|
+
interactor.loadModeOptions(this, data);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { deepExtend } from "../../Utils/Utils";
|
|
1
|
+
import { deepExtend } from "../../Utils/Utils.js";
|
|
2
2
|
export class ManualParticle {
|
|
3
3
|
load(data) {
|
|
4
|
-
var _a, _b, _c;
|
|
5
4
|
if (!data) {
|
|
6
5
|
return;
|
|
7
6
|
}
|
|
8
|
-
if (data.position
|
|
7
|
+
if (data.position) {
|
|
9
8
|
this.position = {
|
|
10
|
-
x:
|
|
11
|
-
y:
|
|
12
|
-
mode:
|
|
9
|
+
x: data.position.x ?? 50,
|
|
10
|
+
y: data.position.y ?? 50,
|
|
11
|
+
mode: data.position.mode ?? "percent",
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
|
-
if (data.options
|
|
14
|
+
if (data.options) {
|
|
16
15
|
this.options = deepExtend({}, data.options);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { deepExtend, executeOnSingleOrMultiple, safeMatchMedia } from "../../Utils/Utils";
|
|
2
|
-
import { Background } from "./Background/Background";
|
|
3
|
-
import { BackgroundMask } from "./BackgroundMask/BackgroundMask";
|
|
4
|
-
import { FullScreen } from "./FullScreen/FullScreen";
|
|
5
|
-
import { Interactivity } from "./Interactivity/Interactivity";
|
|
6
|
-
import { ManualParticle } from "./ManualParticle";
|
|
7
|
-
import { Responsive } from "./Responsive";
|
|
8
|
-
import { Theme } from "./Theme/Theme";
|
|
9
|
-
import { loadParticlesOptions } from "../../Utils/OptionsUtils";
|
|
10
|
-
import { setRangeValue } from "../../Utils/NumberUtils";
|
|
1
|
+
import { deepExtend, executeOnSingleOrMultiple, isBoolean, safeMatchMedia } from "../../Utils/Utils.js";
|
|
2
|
+
import { Background } from "./Background/Background.js";
|
|
3
|
+
import { BackgroundMask } from "./BackgroundMask/BackgroundMask.js";
|
|
4
|
+
import { FullScreen } from "./FullScreen/FullScreen.js";
|
|
5
|
+
import { Interactivity } from "./Interactivity/Interactivity.js";
|
|
6
|
+
import { ManualParticle } from "./ManualParticle.js";
|
|
7
|
+
import { Responsive } from "./Responsive.js";
|
|
8
|
+
import { Theme } from "./Theme/Theme.js";
|
|
9
|
+
import { loadParticlesOptions } from "../../Utils/OptionsUtils.js";
|
|
10
|
+
import { setRangeValue } from "../../Utils/NumberUtils.js";
|
|
11
11
|
export class Options {
|
|
12
12
|
constructor(engine, container) {
|
|
13
|
+
this._findDefaultTheme = (mode) => {
|
|
14
|
+
return (this.themes.find((theme) => theme.default.value && theme.default.mode === mode) ??
|
|
15
|
+
this.themes.find((theme) => theme.default.value && theme.default.mode === "any"));
|
|
16
|
+
};
|
|
17
|
+
this._importPreset = (preset) => {
|
|
18
|
+
this.load(this._engine.getPreset(preset));
|
|
19
|
+
};
|
|
13
20
|
this._engine = engine;
|
|
14
21
|
this._container = container;
|
|
15
22
|
this.autoPlay = true;
|
|
@@ -23,7 +30,6 @@ export class Options {
|
|
|
23
30
|
this.fpsLimit = 120;
|
|
24
31
|
this.interactivity = new Interactivity(engine, container);
|
|
25
32
|
this.manualParticles = [];
|
|
26
|
-
this.name = "default";
|
|
27
33
|
this.particles = loadParticlesOptions(this._engine, this._container);
|
|
28
34
|
this.pauseOnBlur = true;
|
|
29
35
|
this.pauseOnOutsideViewport = true;
|
|
@@ -33,26 +39,7 @@ export class Options {
|
|
|
33
39
|
this.themes = [];
|
|
34
40
|
this.zLayers = 100;
|
|
35
41
|
}
|
|
36
|
-
get backgroundMode() {
|
|
37
|
-
return this.fullScreen;
|
|
38
|
-
}
|
|
39
|
-
set backgroundMode(value) {
|
|
40
|
-
this.fullScreen.load(value);
|
|
41
|
-
}
|
|
42
|
-
get fps_limit() {
|
|
43
|
-
return this.fpsLimit;
|
|
44
|
-
}
|
|
45
|
-
set fps_limit(value) {
|
|
46
|
-
this.fpsLimit = value;
|
|
47
|
-
}
|
|
48
|
-
get retina_detect() {
|
|
49
|
-
return this.detectRetina;
|
|
50
|
-
}
|
|
51
|
-
set retina_detect(value) {
|
|
52
|
-
this.detectRetina = value;
|
|
53
|
-
}
|
|
54
42
|
load(data) {
|
|
55
|
-
var _a, _b, _c, _d, _e;
|
|
56
43
|
if (!data) {
|
|
57
44
|
return;
|
|
58
45
|
}
|
|
@@ -65,14 +52,14 @@ export class Options {
|
|
|
65
52
|
if (data.delay !== undefined) {
|
|
66
53
|
this.delay = setRangeValue(data.delay);
|
|
67
54
|
}
|
|
68
|
-
const detectRetina =
|
|
55
|
+
const detectRetina = data.detectRetina;
|
|
69
56
|
if (detectRetina !== undefined) {
|
|
70
57
|
this.detectRetina = detectRetina;
|
|
71
58
|
}
|
|
72
59
|
if (data.duration !== undefined) {
|
|
73
60
|
this.duration = setRangeValue(data.duration);
|
|
74
61
|
}
|
|
75
|
-
const fpsLimit =
|
|
62
|
+
const fpsLimit = data.fpsLimit;
|
|
76
63
|
if (fpsLimit !== undefined) {
|
|
77
64
|
this.fpsLimit = fpsLimit;
|
|
78
65
|
}
|
|
@@ -86,8 +73,8 @@ export class Options {
|
|
|
86
73
|
this.zLayers = data.zLayers;
|
|
87
74
|
}
|
|
88
75
|
this.background.load(data.background);
|
|
89
|
-
const fullScreen =
|
|
90
|
-
if (
|
|
76
|
+
const fullScreen = data.fullScreen;
|
|
77
|
+
if (isBoolean(fullScreen)) {
|
|
91
78
|
this.fullScreen.enable = fullScreen;
|
|
92
79
|
}
|
|
93
80
|
else {
|
|
@@ -95,7 +82,7 @@ export class Options {
|
|
|
95
82
|
}
|
|
96
83
|
this.backgroundMask.load(data.backgroundMask);
|
|
97
84
|
this.interactivity.load(data.interactivity);
|
|
98
|
-
if (data.manualParticles
|
|
85
|
+
if (data.manualParticles) {
|
|
99
86
|
this.manualParticles = data.manualParticles.map((t) => {
|
|
100
87
|
const tmp = new ManualParticle();
|
|
101
88
|
tmp.load(t);
|
|
@@ -104,11 +91,11 @@ export class Options {
|
|
|
104
91
|
}
|
|
105
92
|
this.particles.load(data.particles);
|
|
106
93
|
this.style = deepExtend(this.style, data.style);
|
|
107
|
-
this._engine.
|
|
94
|
+
this._engine.loadOptions(this, data);
|
|
108
95
|
if (data.smooth !== undefined) {
|
|
109
96
|
this.smooth = data.smooth;
|
|
110
97
|
}
|
|
111
|
-
const interactors = this._engine.
|
|
98
|
+
const interactors = this._engine.interactors.get(this._container);
|
|
112
99
|
if (interactors) {
|
|
113
100
|
for (const interactor of interactors) {
|
|
114
101
|
if (interactor.loadOptions) {
|
|
@@ -137,14 +124,14 @@ export class Options {
|
|
|
137
124
|
}
|
|
138
125
|
}
|
|
139
126
|
}
|
|
140
|
-
this.defaultThemes.dark =
|
|
141
|
-
this.defaultThemes.light =
|
|
127
|
+
this.defaultThemes.dark = this._findDefaultTheme("dark")?.name;
|
|
128
|
+
this.defaultThemes.light = this._findDefaultTheme("light")?.name;
|
|
142
129
|
}
|
|
143
130
|
setResponsive(width, pxRatio, defaultOptions) {
|
|
144
131
|
this.load(defaultOptions);
|
|
145
132
|
const responsiveOptions = this.responsive.find((t) => t.mode === "screen" && screen ? t.maxWidth > screen.availWidth : t.maxWidth * pxRatio > width);
|
|
146
|
-
this.load(responsiveOptions
|
|
147
|
-
return responsiveOptions
|
|
133
|
+
this.load(responsiveOptions?.options);
|
|
134
|
+
return responsiveOptions?.maxWidth;
|
|
148
135
|
}
|
|
149
136
|
setTheme(name) {
|
|
150
137
|
if (name) {
|
|
@@ -160,11 +147,4 @@ export class Options {
|
|
|
160
147
|
}
|
|
161
148
|
}
|
|
162
149
|
}
|
|
163
|
-
_findDefaultTheme(mode) {
|
|
164
|
-
var _a;
|
|
165
|
-
return ((_a = this.themes.find((theme) => theme.default.value && theme.default.mode === mode)) !== null && _a !== void 0 ? _a : this.themes.find((theme) => theme.default.value && theme.default.mode === "any"));
|
|
166
|
-
}
|
|
167
|
-
_importPreset(preset) {
|
|
168
|
-
this.load(this._engine.plugins.getPreset(preset));
|
|
169
|
-
}
|
|
170
150
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isArray, isString } from "../../Utils/Utils.js";
|
|
1
2
|
export class OptionsColor {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.value = "";
|
|
@@ -6,7 +7,7 @@ export class OptionsColor {
|
|
|
6
7
|
const color = new OptionsColor();
|
|
7
8
|
color.load(source);
|
|
8
9
|
if (data !== undefined) {
|
|
9
|
-
if (
|
|
10
|
+
if (isString(data) || isArray(data)) {
|
|
10
11
|
color.load({ value: data });
|
|
11
12
|
}
|
|
12
13
|
else {
|
|
@@ -16,7 +17,7 @@ export class OptionsColor {
|
|
|
16
17
|
return color;
|
|
17
18
|
}
|
|
18
19
|
load(data) {
|
|
19
|
-
if (
|
|
20
|
+
if (data?.value === undefined) {
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
this.value = data.value;
|