@tsparticles/engine 4.0.0-alpha.1 → 4.0.0-alpha.14
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/219.min.js +1 -0
- package/README.md +2 -5
- package/browser/Core/Canvas.js +238 -154
- package/browser/Core/Container.js +111 -227
- package/browser/Core/Engine.js +84 -124
- package/browser/Core/Particle.js +236 -140
- package/browser/Core/Particles.js +212 -123
- package/browser/Core/Retina.js +5 -0
- package/browser/Core/Utils/Constants.js +2 -2
- package/browser/Core/Utils/EventListeners.js +69 -310
- package/browser/Core/Utils/Point.js +2 -0
- package/browser/Core/Utils/QuadTree.js +13 -8
- package/browser/Core/Utils/Ranges.js +4 -0
- package/browser/Core/Utils/Vectors.js +7 -4
- package/browser/Enums/Types/EasingType.js +18 -3
- package/browser/Options/Classes/AnimatableColor.js +1 -0
- package/browser/Options/Classes/AnimationOptions.js +8 -0
- package/browser/Options/Classes/Background/Background.js +6 -0
- package/browser/Options/Classes/ColorAnimation.js +1 -0
- package/browser/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/browser/Options/Classes/HslAnimation.js +3 -5
- package/browser/Options/Classes/Options.js +32 -78
- package/browser/Options/Classes/OptionsColor.js +1 -0
- package/browser/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/browser/Options/Classes/Particles/Effect/Effect.js +4 -0
- package/browser/Options/Classes/Particles/Move/Move.js +18 -0
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/browser/Options/Classes/Particles/Move/MoveAttract.js +3 -0
- package/browser/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/browser/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/browser/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/browser/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/browser/Options/Classes/Particles/Move/Spin.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.js +19 -11
- package/browser/Options/Classes/Particles/Shape/Shape.js +4 -0
- package/browser/Options/Classes/Particles/Size/Size.js +1 -0
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/browser/Options/Classes/Particles/Stroke.js +3 -0
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/{esm/Options/Classes/Interactivity/Events → browser/Options/Classes}/ResizeEvent.js +3 -1
- package/browser/Options/Classes/ValueWithRandom.js +3 -4
- package/browser/Utils/CanvasUtils.js +31 -106
- package/browser/Utils/ColorUtils.js +17 -2
- package/browser/Utils/EventDispatcher.js +1 -0
- package/browser/Utils/MathUtils.js +3 -2
- package/browser/Utils/Utils.js +53 -44
- package/browser/exports.js +1 -21
- package/cjs/Core/Canvas.js +238 -154
- package/cjs/Core/Container.js +111 -227
- package/cjs/Core/Engine.js +84 -124
- package/cjs/Core/Particle.js +236 -140
- package/cjs/Core/Particles.js +212 -123
- package/cjs/Core/Retina.js +5 -0
- package/cjs/Core/Utils/Constants.js +2 -2
- package/cjs/Core/Utils/EventListeners.js +69 -310
- package/cjs/Core/Utils/Point.js +2 -0
- package/cjs/Core/Utils/QuadTree.js +13 -8
- package/cjs/Core/Utils/Ranges.js +4 -0
- package/cjs/Core/Utils/Vectors.js +7 -4
- package/cjs/Enums/Types/EasingType.js +18 -3
- package/cjs/Options/Classes/AnimatableColor.js +1 -0
- package/cjs/Options/Classes/AnimationOptions.js +8 -0
- package/cjs/Options/Classes/Background/Background.js +6 -0
- package/cjs/Options/Classes/ColorAnimation.js +1 -0
- package/cjs/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/cjs/Options/Classes/HslAnimation.js +3 -5
- package/cjs/Options/Classes/Options.js +32 -78
- package/cjs/Options/Classes/OptionsColor.js +1 -0
- package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/cjs/Options/Classes/Particles/Effect/Effect.js +4 -0
- package/cjs/Options/Classes/Particles/Move/Move.js +18 -0
- package/cjs/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/cjs/Options/Classes/Particles/Move/MoveAttract.js +3 -0
- package/cjs/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/cjs/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/cjs/Options/Classes/Particles/Move/Spin.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/ParticlesOptions.js +19 -11
- package/cjs/Options/Classes/Particles/Shape/Shape.js +4 -0
- package/cjs/Options/Classes/Particles/Size/Size.js +1 -0
- package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/cjs/Options/Classes/Particles/Stroke.js +3 -0
- package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/cjs/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +3 -1
- package/cjs/Options/Classes/ValueWithRandom.js +3 -4
- package/cjs/Utils/CanvasUtils.js +31 -106
- package/cjs/Utils/ColorUtils.js +17 -2
- package/cjs/Utils/EventDispatcher.js +1 -0
- package/cjs/Utils/MathUtils.js +3 -2
- package/cjs/Utils/Utils.js +53 -44
- package/cjs/exports.js +1 -21
- package/dist_browser_Core_Container_js.js +8 -18
- package/esm/Core/Canvas.js +238 -154
- package/esm/Core/Container.js +111 -227
- package/esm/Core/Engine.js +84 -124
- package/esm/Core/Particle.js +236 -140
- package/esm/Core/Particles.js +212 -123
- package/esm/Core/Retina.js +5 -0
- package/esm/Core/Utils/Constants.js +2 -2
- package/esm/Core/Utils/EventListeners.js +69 -310
- package/esm/Core/Utils/Point.js +2 -0
- package/esm/Core/Utils/QuadTree.js +13 -8
- package/esm/Core/Utils/Ranges.js +4 -0
- package/esm/Core/Utils/Vectors.js +7 -4
- package/esm/Enums/Types/EasingType.js +18 -3
- package/esm/Options/Classes/AnimatableColor.js +1 -0
- package/esm/Options/Classes/AnimationOptions.js +8 -0
- package/esm/Options/Classes/Background/Background.js +6 -0
- package/esm/Options/Classes/ColorAnimation.js +1 -0
- package/esm/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/esm/Options/Classes/HslAnimation.js +3 -5
- package/esm/Options/Classes/Options.js +32 -78
- package/esm/Options/Classes/OptionsColor.js +1 -0
- package/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/esm/Options/Classes/Particles/Effect/Effect.js +4 -0
- package/esm/Options/Classes/Particles/Move/Move.js +18 -0
- package/esm/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/esm/Options/Classes/Particles/Move/MoveAttract.js +3 -0
- package/esm/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/esm/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/esm/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/esm/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/esm/Options/Classes/Particles/Move/Spin.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/esm/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/esm/Options/Classes/Particles/ParticlesOptions.js +19 -11
- package/esm/Options/Classes/Particles/Shape/Shape.js +4 -0
- package/esm/Options/Classes/Particles/Size/Size.js +1 -0
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/esm/Options/Classes/Particles/Stroke.js +3 -0
- package/esm/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/{browser/Options/Classes/Interactivity/Events → esm/Options/Classes}/ResizeEvent.js +3 -1
- package/esm/Options/Classes/ValueWithRandom.js +3 -4
- package/esm/Utils/CanvasUtils.js +31 -106
- package/esm/Utils/ColorUtils.js +17 -2
- package/esm/Utils/EventDispatcher.js +1 -0
- package/esm/Utils/MathUtils.js +3 -2
- package/esm/Utils/Utils.js +53 -44
- package/esm/exports.js +1 -21
- package/package.json +1 -1
- package/report.html +3 -3
- package/scripts/install.js +28 -9
- package/tsparticles.engine.js +67 -247
- package/tsparticles.engine.min.js +2 -2
- package/types/Core/Canvas.d.ts +15 -4
- package/types/Core/Container.d.ts +5 -20
- package/types/Core/Engine.d.ts +18 -32
- package/types/Core/Interfaces/IColorManager.d.ts +0 -1
- package/types/Core/Interfaces/IContainerPlugin.d.ts +12 -2
- package/types/Core/Interfaces/IDrawParticleParams.d.ts +1 -1
- package/types/Core/Interfaces/IMovePathGenerator.d.ts +1 -2
- package/types/Core/Interfaces/IParticleOpacityData.d.ts +4 -0
- package/types/Core/Interfaces/IParticleRotateData.d.ts +4 -0
- package/types/Core/Interfaces/IParticleTransformValues.d.ts +4 -4
- package/types/Core/Interfaces/IParticleUpdater.d.ts +1 -1
- package/types/Core/Interfaces/IPlugin.d.ts +5 -1
- package/types/Core/Interfaces/IShapeDrawer.d.ts +0 -1
- package/types/Core/Particle.d.ts +13 -2
- package/types/Core/Particles.d.ts +17 -8
- package/types/Core/Utils/Constants.d.ts +2 -2
- package/types/Core/Utils/EventListeners.d.ts +0 -14
- package/types/Enums/Types/EasingType.d.ts +20 -5
- package/types/Options/Classes/HslAnimation.d.ts +3 -4
- package/types/Options/Classes/Options.d.ts +2 -11
- package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -2
- package/types/Options/Classes/ResizeEvent.d.ts +9 -0
- package/types/Options/Classes/ValueWithRandom.d.ts +0 -1
- package/types/Options/Interfaces/IOptions.d.ts +2 -8
- package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -3
- package/types/Types/CustomEventListener.d.ts +1 -1
- package/types/Types/EngineInitializers.d.ts +19 -0
- package/types/Utils/CanvasUtils.d.ts +6 -25
- package/types/Utils/EventDispatcher.d.ts +1 -1
- package/types/Utils/Utils.d.ts +5 -7
- package/types/export-types.d.ts +3 -19
- package/types/exports.d.ts +1 -21
- package/umd/Core/Canvas.js +236 -152
- package/umd/Core/Container.js +111 -227
- package/umd/Core/Engine.js +83 -123
- package/umd/Core/Particle.js +236 -140
- package/umd/Core/Particles.js +213 -124
- package/umd/Core/Retina.js +5 -0
- package/umd/Core/Utils/Constants.js +3 -3
- package/umd/Core/Utils/EventListeners.js +69 -310
- package/umd/Core/Utils/Point.js +2 -0
- package/umd/Core/Utils/QuadTree.js +13 -8
- package/umd/Core/Utils/Ranges.js +4 -0
- package/umd/Core/Utils/Vectors.js +7 -4
- package/umd/Enums/Types/EasingType.js +18 -3
- package/umd/Options/Classes/AnimatableColor.js +1 -0
- package/umd/Options/Classes/AnimationOptions.js +8 -0
- package/umd/Options/Classes/Background/Background.js +6 -0
- package/umd/Options/Classes/ColorAnimation.js +1 -0
- package/umd/Options/Classes/FullScreen/FullScreen.js +2 -0
- package/umd/Options/Classes/HslAnimation.js +3 -5
- package/umd/Options/Classes/Options.js +32 -78
- package/umd/Options/Classes/OptionsColor.js +1 -0
- package/umd/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
- package/umd/Options/Classes/Particles/Effect/Effect.js +4 -0
- package/umd/Options/Classes/Particles/Move/Move.js +18 -0
- package/umd/Options/Classes/Particles/Move/MoveAngle.js +2 -0
- package/umd/Options/Classes/Particles/Move/MoveAttract.js +3 -0
- package/umd/Options/Classes/Particles/Move/MoveCenter.js +4 -0
- package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -0
- package/umd/Options/Classes/Particles/Move/OutModes.js +5 -0
- package/umd/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
- package/umd/Options/Classes/Particles/Move/Spin.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
- package/umd/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
- package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -0
- package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
- package/umd/Options/Classes/Particles/ParticlesOptions.js +19 -11
- package/umd/Options/Classes/Particles/Shape/Shape.js +4 -0
- package/umd/Options/Classes/Particles/Size/Size.js +1 -0
- package/umd/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
- package/umd/Options/Classes/Particles/Stroke.js +3 -0
- package/umd/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/umd/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +4 -2
- package/umd/Options/Classes/ValueWithRandom.js +3 -4
- package/umd/Utils/CanvasUtils.js +30 -108
- package/umd/Utils/ColorUtils.js +17 -2
- package/umd/Utils/EventDispatcher.js +1 -0
- package/umd/Utils/MathUtils.js +3 -2
- package/umd/Utils/Utils.js +55 -48
- package/umd/exports.js +2 -22
- package/638.min.js +0 -2
- package/638.min.js.LICENSE.txt +0 -1
- package/browser/Core/Utils/ExternalInteractorBase.js +0 -7
- package/browser/Core/Utils/InteractionManager.js +0 -60
- package/browser/Core/Utils/ParticlesInteractorBase.js +0 -7
- package/browser/Enums/InteractivityDetect.js +0 -6
- package/browser/Enums/Modes/ResponsiveMode.js +0 -5
- package/browser/Enums/Modes/ThemeMode.js +0 -6
- package/browser/Enums/Types/DivType.js +0 -5
- package/browser/Enums/Types/InteractorType.js +0 -5
- package/browser/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
- package/browser/Options/Classes/Interactivity/Events/Events.js +0 -30
- package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
- package/browser/Options/Classes/Interactivity/Events/Parallax.js +0 -22
- package/browser/Options/Classes/Interactivity/Interactivity.js +0 -22
- package/browser/Options/Classes/Interactivity/Modes/Modes.js +0 -25
- package/browser/Options/Classes/ManualParticle.js +0 -21
- package/browser/Options/Classes/Responsive.js +0 -29
- package/browser/Options/Classes/Theme/Theme.js +0 -21
- package/browser/Options/Classes/Theme/ThemeDefault.js +0 -23
- package/browser/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
- package/browser/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
- package/browser/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
- package/browser/Options/Interfaces/Theme/ITheme.js +0 -1
- package/browser/Options/Interfaces/Theme/IThemeDefault.js +0 -1
- package/cjs/Core/Interfaces/IContainerInteractivity.js +0 -1
- package/cjs/Core/Interfaces/IExternalInteractor.js +0 -1
- package/cjs/Core/Interfaces/IInteractor.js +0 -1
- package/cjs/Core/Interfaces/IMouseData.js +0 -1
- package/cjs/Core/Interfaces/IParticlesInteractor.js +0 -1
- package/cjs/Core/Utils/ExternalInteractorBase.js +0 -7
- package/cjs/Core/Utils/InteractionManager.js +0 -60
- package/cjs/Core/Utils/ParticlesInteractorBase.js +0 -7
- package/cjs/Enums/InteractivityDetect.js +0 -6
- package/cjs/Enums/Modes/ResponsiveMode.js +0 -5
- package/cjs/Enums/Modes/ThemeMode.js +0 -6
- package/cjs/Enums/Types/DivType.js +0 -5
- package/cjs/Enums/Types/InteractorType.js +0 -5
- package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
- package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
- package/cjs/Options/Classes/Interactivity/Events/Events.js +0 -30
- package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
- package/cjs/Options/Classes/Interactivity/Events/Parallax.js +0 -22
- package/cjs/Options/Classes/Interactivity/Interactivity.js +0 -22
- package/cjs/Options/Classes/Interactivity/Modes/Modes.js +0 -25
- package/cjs/Options/Classes/ManualParticle.js +0 -21
- package/cjs/Options/Classes/Responsive.js +0 -29
- package/cjs/Options/Classes/Theme/Theme.js +0 -21
- package/cjs/Options/Classes/Theme/ThemeDefault.js +0 -23
- package/cjs/Options/Interfaces/IManualParticle.js +0 -1
- package/cjs/Options/Interfaces/IResponsive.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
- package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
- package/cjs/Options/Interfaces/Theme/ITheme.js +0 -1
- package/cjs/Options/Interfaces/Theme/IThemeDefault.js +0 -1
- package/esm/Core/Interfaces/IContainerInteractivity.js +0 -1
- package/esm/Core/Interfaces/IExternalInteractor.js +0 -1
- package/esm/Core/Interfaces/IInteractor.js +0 -1
- package/esm/Core/Interfaces/IMouseData.js +0 -1
- package/esm/Core/Interfaces/IParticlesInteractor.js +0 -1
- package/esm/Core/Utils/ExternalInteractorBase.js +0 -7
- package/esm/Core/Utils/InteractionManager.js +0 -60
- package/esm/Core/Utils/ParticlesInteractorBase.js +0 -7
- package/esm/Enums/InteractivityDetect.js +0 -6
- package/esm/Enums/Modes/ResponsiveMode.js +0 -5
- package/esm/Enums/Modes/ThemeMode.js +0 -6
- package/esm/Enums/Types/DivType.js +0 -5
- package/esm/Enums/Types/InteractorType.js +0 -5
- package/esm/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
- package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
- package/esm/Options/Classes/Interactivity/Events/Events.js +0 -30
- package/esm/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
- package/esm/Options/Classes/Interactivity/Events/Parallax.js +0 -22
- package/esm/Options/Classes/Interactivity/Interactivity.js +0 -22
- package/esm/Options/Classes/Interactivity/Modes/Modes.js +0 -25
- package/esm/Options/Classes/ManualParticle.js +0 -21
- package/esm/Options/Classes/Responsive.js +0 -29
- package/esm/Options/Classes/Theme/Theme.js +0 -21
- package/esm/Options/Classes/Theme/ThemeDefault.js +0 -23
- package/esm/Options/Interfaces/IManualParticle.js +0 -1
- package/esm/Options/Interfaces/IResponsive.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
- package/esm/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
- package/esm/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
- package/esm/Options/Interfaces/Theme/ITheme.js +0 -1
- package/esm/Options/Interfaces/Theme/IThemeDefault.js +0 -1
- package/tsparticles.engine.min.js.LICENSE.txt +0 -1
- package/types/Core/Interfaces/IContainerInteractivity.d.ts +0 -6
- package/types/Core/Interfaces/IExternalInteractor.d.ts +0 -12
- package/types/Core/Interfaces/IInteractor.d.ts +0 -16
- package/types/Core/Interfaces/IMouseData.d.ts +0 -9
- package/types/Core/Interfaces/IParticlesInteractor.d.ts +0 -7
- package/types/Core/Utils/ExternalInteractorBase.d.ts +0 -15
- package/types/Core/Utils/InteractionManager.d.ts +0 -17
- package/types/Core/Utils/ParticlesInteractorBase.d.ts +0 -15
- package/types/Enums/InteractivityDetect.d.ts +0 -5
- package/types/Enums/Modes/ResponsiveMode.d.ts +0 -4
- package/types/Enums/Modes/ThemeMode.d.ts +0 -5
- package/types/Enums/Types/DivType.d.ts +0 -4
- package/types/Enums/Types/InteractorType.d.ts +0 -4
- package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +0 -10
- package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -13
- package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -16
- package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +0 -12
- package/types/Options/Classes/Interactivity/Events/Parallax.d.ts +0 -10
- package/types/Options/Classes/Interactivity/Events/ResizeEvent.d.ts +0 -9
- package/types/Options/Classes/Interactivity/Interactivity.d.ts +0 -16
- package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +0 -12
- package/types/Options/Classes/ManualParticle.d.ts +0 -10
- package/types/Options/Classes/Responsive.d.ts +0 -12
- package/types/Options/Classes/Theme/Theme.d.ts +0 -12
- package/types/Options/Classes/Theme/ThemeDefault.d.ts +0 -11
- package/types/Options/Interfaces/IManualParticle.d.ts +0 -7
- package/types/Options/Interfaces/IResponsive.d.ts +0 -7
- package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +0 -5
- package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -8
- package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -11
- package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +0 -7
- package/types/Options/Interfaces/Interactivity/Events/IParallax.d.ts +0 -5
- package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -9
- package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -4
- package/types/Options/Interfaces/Interactivity/Modes/IModes.d.ts +0 -1
- package/types/Options/Interfaces/Theme/ITheme.d.ts +0 -7
- package/types/Options/Interfaces/Theme/IThemeDefault.d.ts +0 -6
- package/umd/Core/Interfaces/IMouseData.js +0 -12
- package/umd/Core/Interfaces/IParticlesInteractor.js +0 -12
- package/umd/Core/Utils/ExternalInteractorBase.js +0 -21
- package/umd/Core/Utils/InteractionManager.js +0 -74
- package/umd/Core/Utils/ParticlesInteractorBase.js +0 -21
- package/umd/Enums/InteractivityDetect.js +0 -19
- package/umd/Enums/Modes/ResponsiveMode.js +0 -18
- package/umd/Enums/Modes/ThemeMode.js +0 -19
- package/umd/Enums/Types/DivType.js +0 -18
- package/umd/Enums/Types/InteractorType.js +0 -18
- package/umd/Options/Classes/Interactivity/Events/ClickEvent.js +0 -32
- package/umd/Options/Classes/Interactivity/Events/DivEvent.js +0 -41
- package/umd/Options/Classes/Interactivity/Events/Events.js +0 -44
- package/umd/Options/Classes/Interactivity/Events/HoverEvent.js +0 -35
- package/umd/Options/Classes/Interactivity/Events/Parallax.js +0 -36
- package/umd/Options/Classes/Interactivity/Interactivity.js +0 -36
- package/umd/Options/Classes/Interactivity/Modes/Modes.js +0 -39
- package/umd/Options/Classes/ManualParticle.js +0 -35
- package/umd/Options/Classes/Responsive.js +0 -43
- package/umd/Options/Classes/Theme/Theme.js +0 -35
- package/umd/Options/Classes/Theme/ThemeDefault.js +0 -37
- package/umd/Options/Interfaces/IManualParticle.js +0 -12
- package/umd/Options/Interfaces/IResponsive.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IEvents.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Events/IParallax.js +0 -12
- package/umd/Options/Interfaces/Interactivity/IInteractivity.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -12
- package/umd/Options/Interfaces/Interactivity/Modes/IModes.js +0 -12
- package/umd/Options/Interfaces/Theme/ITheme.js +0 -12
- package/umd/Options/Interfaces/Theme/IThemeDefault.js +0 -12
- /package/browser/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
- /package/browser/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
- /package/browser/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/browser/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
- /package/{browser/Core/Interfaces/IMouseData.js → cjs/Core/Interfaces/IParticleOpacityData.js} +0 -0
- /package/{browser/Core/Interfaces/IParticlesInteractor.js → cjs/Core/Interfaces/IParticleRotateData.js} +0 -0
- /package/cjs/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/{browser/Options/Interfaces/IManualParticle.js → cjs/Types/EngineInitializers.js} +0 -0
- /package/{browser/Options/Interfaces/IResponsive.js → esm/Core/Interfaces/IParticleOpacityData.js} +0 -0
- /package/{browser/Options/Interfaces/Interactivity/Events/IClickEvent.js → esm/Core/Interfaces/IParticleRotateData.js} +0 -0
- /package/esm/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/{browser/Options/Interfaces/Interactivity/Events/IDivEvent.js → esm/Types/EngineInitializers.js} +0 -0
- /package/types/Options/Interfaces/{Interactivity/Events/IResizeEvent.d.ts → IResizeEvent.d.ts} +0 -0
- /package/umd/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
- /package/umd/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
- /package/umd/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
- /package/umd/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
package/cjs/Utils/CanvasUtils.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lFactor, minStrokeWidth, originPoint } from "../Core/Utils/Constants.js";
|
|
2
2
|
import { AlterType } from "../Enums/Types/AlterType.js";
|
|
3
|
-
export function clearDrawPlugin(context, plugin, delta) {
|
|
4
|
-
if (!plugin.clearDraw) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
plugin.clearDraw(context, delta);
|
|
8
|
-
}
|
|
9
|
-
export function drawLine(context, begin, end) {
|
|
10
|
-
context.beginPath();
|
|
11
|
-
context.moveTo(begin.x, begin.y);
|
|
12
|
-
context.lineTo(end.x, end.y);
|
|
13
|
-
context.closePath();
|
|
14
|
-
}
|
|
15
3
|
export function paintBase(context, dimension, baseColor) {
|
|
16
4
|
context.fillStyle = baseColor ?? "rgba(0,0,0,0)";
|
|
17
5
|
context.fillRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
@@ -28,15 +16,7 @@ export function clear(context, dimension) {
|
|
|
28
16
|
context.clearRect(originPoint.x, originPoint.y, dimension.width, dimension.height);
|
|
29
17
|
}
|
|
30
18
|
export function drawParticle(data) {
|
|
31
|
-
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, pos = particle.getPosition(),
|
|
32
|
-
sin: Math.sin(angle),
|
|
33
|
-
cos: Math.cos(angle),
|
|
34
|
-
}, rotating = particle.isRotating, transformData = {
|
|
35
|
-
a: rotateData.cos * (transform.a ?? defaultTransform.a),
|
|
36
|
-
b: rotating ? rotateData.sin * (transform.b ?? identity) : (transform.b ?? defaultTransform.b),
|
|
37
|
-
c: rotating ? -rotateData.sin * (transform.c ?? identity) : (transform.c ?? defaultTransform.c),
|
|
38
|
-
d: rotateData.cos * (transform.d ?? defaultTransform.d),
|
|
39
|
-
};
|
|
19
|
+
const { container, context, particle, delta, colorStyles, radius, opacity, transform } = data, pos = particle.getPosition(), transformData = particle.getTransformData(transform);
|
|
40
20
|
context.setTransform(transformData.a, transformData.b, transformData.c, transformData.d, pos.x, pos.y);
|
|
41
21
|
if (colorStyles.fill) {
|
|
42
22
|
context.fillStyle = colorStyles.fill;
|
|
@@ -47,142 +27,87 @@ export function drawParticle(data) {
|
|
|
47
27
|
context.strokeStyle = colorStyles.stroke;
|
|
48
28
|
}
|
|
49
29
|
const drawData = {
|
|
50
|
-
container,
|
|
51
30
|
context,
|
|
52
31
|
particle,
|
|
53
32
|
radius,
|
|
54
33
|
opacity,
|
|
55
34
|
delta,
|
|
35
|
+
pixelRatio: container.retina.pixelRatio,
|
|
36
|
+
fill: particle.shapeFill,
|
|
37
|
+
stroke: strokeWidth > minStrokeWidth || !particle.shapeFill,
|
|
56
38
|
transformData,
|
|
57
|
-
strokeWidth,
|
|
58
39
|
};
|
|
59
|
-
drawBeforeEffect(drawData);
|
|
60
|
-
drawShapeBeforeDraw(drawData);
|
|
61
|
-
drawShape(drawData);
|
|
62
|
-
drawShapeAfterDraw(drawData);
|
|
63
|
-
drawAfterEffect(drawData);
|
|
40
|
+
drawBeforeEffect(container, drawData);
|
|
41
|
+
drawShapeBeforeDraw(container, drawData);
|
|
42
|
+
drawShape(container, drawData);
|
|
43
|
+
drawShapeAfterDraw(container, drawData);
|
|
44
|
+
drawAfterEffect(container, drawData);
|
|
64
45
|
context.resetTransform();
|
|
65
46
|
}
|
|
66
|
-
export function drawAfterEffect(data) {
|
|
67
|
-
const {
|
|
47
|
+
export function drawAfterEffect(container, data) {
|
|
48
|
+
const { particle } = data;
|
|
68
49
|
if (!particle.effect) {
|
|
69
50
|
return;
|
|
70
51
|
}
|
|
71
|
-
const drawer = container.effectDrawers.get(particle.effect), drawFunc = drawer?.drawAfter;
|
|
52
|
+
const drawer = container.particles.effectDrawers.get(particle.effect), drawFunc = drawer?.drawAfter;
|
|
72
53
|
if (!drawFunc) {
|
|
73
54
|
return;
|
|
74
55
|
}
|
|
75
|
-
drawFunc(
|
|
76
|
-
context,
|
|
77
|
-
particle,
|
|
78
|
-
radius,
|
|
79
|
-
opacity,
|
|
80
|
-
delta,
|
|
81
|
-
pixelRatio: container.retina.pixelRatio,
|
|
82
|
-
fill: particle.shapeFill,
|
|
83
|
-
stroke: strokeWidth > minStrokeWidth || !particle.shapeFill,
|
|
84
|
-
transformData: { ...transformData },
|
|
85
|
-
});
|
|
56
|
+
drawFunc(data);
|
|
86
57
|
}
|
|
87
|
-
export function drawBeforeEffect(data) {
|
|
88
|
-
const {
|
|
58
|
+
export function drawBeforeEffect(container, data) {
|
|
59
|
+
const { particle } = data;
|
|
89
60
|
if (!particle.effect) {
|
|
90
61
|
return;
|
|
91
62
|
}
|
|
92
|
-
const drawer = container.effectDrawers.get(particle.effect);
|
|
63
|
+
const drawer = container.particles.effectDrawers.get(particle.effect);
|
|
93
64
|
if (!drawer?.drawBefore) {
|
|
94
65
|
return;
|
|
95
66
|
}
|
|
96
|
-
drawer.drawBefore(
|
|
97
|
-
context,
|
|
98
|
-
particle,
|
|
99
|
-
radius,
|
|
100
|
-
opacity,
|
|
101
|
-
delta,
|
|
102
|
-
pixelRatio: container.retina.pixelRatio,
|
|
103
|
-
fill: particle.shapeFill,
|
|
104
|
-
stroke: strokeWidth > minStrokeWidth || !particle.shapeFill,
|
|
105
|
-
transformData: { ...transformData },
|
|
106
|
-
});
|
|
67
|
+
drawer.drawBefore(data);
|
|
107
68
|
}
|
|
108
|
-
export function drawShape(data) {
|
|
109
|
-
const {
|
|
69
|
+
export function drawShape(container, data) {
|
|
70
|
+
const { context, particle, stroke } = data;
|
|
110
71
|
if (!particle.shape) {
|
|
111
72
|
return;
|
|
112
73
|
}
|
|
113
|
-
const drawer = container.shapeDrawers.get(particle.shape);
|
|
74
|
+
const drawer = container.particles.shapeDrawers.get(particle.shape);
|
|
114
75
|
if (!drawer) {
|
|
115
76
|
return;
|
|
116
77
|
}
|
|
117
78
|
context.beginPath();
|
|
118
|
-
drawer.draw(
|
|
119
|
-
context,
|
|
120
|
-
particle,
|
|
121
|
-
radius,
|
|
122
|
-
opacity,
|
|
123
|
-
delta,
|
|
124
|
-
pixelRatio: container.retina.pixelRatio,
|
|
125
|
-
fill: particle.shapeFill,
|
|
126
|
-
stroke: strokeWidth > minStrokeWidth || !particle.shapeFill,
|
|
127
|
-
transformData: { ...transformData },
|
|
128
|
-
});
|
|
79
|
+
drawer.draw(data);
|
|
129
80
|
if (particle.shapeClose) {
|
|
130
81
|
context.closePath();
|
|
131
82
|
}
|
|
132
|
-
if (
|
|
83
|
+
if (stroke) {
|
|
133
84
|
context.stroke();
|
|
134
85
|
}
|
|
135
86
|
if (particle.shapeFill) {
|
|
136
87
|
context.fill();
|
|
137
88
|
}
|
|
138
89
|
}
|
|
139
|
-
export function drawShapeAfterDraw(data) {
|
|
140
|
-
const {
|
|
90
|
+
export function drawShapeAfterDraw(container, data) {
|
|
91
|
+
const { particle } = data;
|
|
141
92
|
if (!particle.shape) {
|
|
142
93
|
return;
|
|
143
94
|
}
|
|
144
|
-
const drawer = container.shapeDrawers.get(particle.shape);
|
|
95
|
+
const drawer = container.particles.shapeDrawers.get(particle.shape);
|
|
145
96
|
if (!drawer?.afterDraw) {
|
|
146
97
|
return;
|
|
147
98
|
}
|
|
148
|
-
drawer.afterDraw(
|
|
149
|
-
context,
|
|
150
|
-
particle,
|
|
151
|
-
radius,
|
|
152
|
-
opacity,
|
|
153
|
-
delta,
|
|
154
|
-
pixelRatio: container.retina.pixelRatio,
|
|
155
|
-
fill: particle.shapeFill,
|
|
156
|
-
stroke: strokeWidth > minStrokeWidth || !particle.shapeFill,
|
|
157
|
-
transformData: { ...transformData },
|
|
158
|
-
});
|
|
99
|
+
drawer.afterDraw(data);
|
|
159
100
|
}
|
|
160
|
-
export function drawShapeBeforeDraw(data) {
|
|
161
|
-
const {
|
|
101
|
+
export function drawShapeBeforeDraw(container, data) {
|
|
102
|
+
const { particle } = data;
|
|
162
103
|
if (!particle.shape) {
|
|
163
104
|
return;
|
|
164
105
|
}
|
|
165
|
-
const drawer = container.shapeDrawers.get(particle.shape);
|
|
106
|
+
const drawer = container.particles.shapeDrawers.get(particle.shape);
|
|
166
107
|
if (!drawer?.beforeDraw) {
|
|
167
108
|
return;
|
|
168
109
|
}
|
|
169
|
-
drawer.beforeDraw(
|
|
170
|
-
context,
|
|
171
|
-
particle,
|
|
172
|
-
radius,
|
|
173
|
-
opacity,
|
|
174
|
-
delta,
|
|
175
|
-
pixelRatio: container.retina.pixelRatio,
|
|
176
|
-
fill: particle.shapeFill,
|
|
177
|
-
stroke: strokeWidth > minStrokeWidth || !particle.shapeFill,
|
|
178
|
-
transformData: { ...transformData },
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
export function drawPlugin(context, plugin, delta) {
|
|
182
|
-
if (!plugin.draw) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
plugin.draw(context, delta);
|
|
110
|
+
drawer.beforeDraw(data);
|
|
186
111
|
}
|
|
187
112
|
export function drawParticlePlugin(context, plugin, particle, delta) {
|
|
188
113
|
if (!plugin.drawParticle) {
|
package/cjs/Utils/ColorUtils.js
CHANGED
|
@@ -3,6 +3,19 @@ import { decayOffset, defaultLoops, defaultOpacity, defaultRgbMin, defaultTime,
|
|
|
3
3
|
import { isArray, isString } from "./TypeUtils.js";
|
|
4
4
|
import { AnimationStatus } from "../Enums/AnimationStatus.js";
|
|
5
5
|
import { itemFromArray } from "./Utils.js";
|
|
6
|
+
const styleCache = new Map(), maxCacheSize = 1000, firstIndex = 0, rgbFixedPrecision = 2, hslFixedPrecision = 2;
|
|
7
|
+
function getCachedStyle(key, generator) {
|
|
8
|
+
let cached = styleCache.get(key);
|
|
9
|
+
if (!cached) {
|
|
10
|
+
cached = generator();
|
|
11
|
+
if (styleCache.size >= maxCacheSize) {
|
|
12
|
+
const keysToDelete = [...styleCache.keys()].slice(firstIndex, maxCacheSize * half);
|
|
13
|
+
keysToDelete.forEach(k => styleCache.delete(k));
|
|
14
|
+
}
|
|
15
|
+
styleCache.set(key, cached);
|
|
16
|
+
}
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
6
19
|
function stringToRgba(engine, input) {
|
|
7
20
|
if (!input) {
|
|
8
21
|
return;
|
|
@@ -155,7 +168,8 @@ export function getRandomRgbColor(min) {
|
|
|
155
168
|
};
|
|
156
169
|
}
|
|
157
170
|
export function getStyleFromRgb(color, hdr, opacity) {
|
|
158
|
-
|
|
171
|
+
const op = opacity ?? defaultOpacity, key = `rgb-${color.r.toFixed(rgbFixedPrecision)}-${color.g.toFixed(rgbFixedPrecision)}-${color.b.toFixed(rgbFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
172
|
+
return getCachedStyle(key, () => (hdr ? getHdrStyleFromRgb(color, opacity) : getSdrStyleFromRgb(color, opacity)));
|
|
159
173
|
}
|
|
160
174
|
function getHdrStyleFromRgb(color, opacity) {
|
|
161
175
|
return `color(display-p3 ${(color.r / rgbMax).toString()} ${(color.g / rgbMax).toString()} ${(color.b / rgbMax).toString()} / ${(opacity ?? defaultOpacity).toString()})`;
|
|
@@ -164,7 +178,8 @@ function getSdrStyleFromRgb(color, opacity) {
|
|
|
164
178
|
return `rgba(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()}, ${(opacity ?? defaultOpacity).toString()})`;
|
|
165
179
|
}
|
|
166
180
|
export function getStyleFromHsl(color, hdr, opacity) {
|
|
167
|
-
|
|
181
|
+
const op = opacity ?? defaultOpacity, key = `hsl-${color.h.toFixed(hslFixedPrecision)}-${color.s.toFixed(hslFixedPrecision)}-${color.l.toFixed(hslFixedPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
|
|
182
|
+
return getCachedStyle(key, () => (hdr ? getHdrStyleFromHsl(color, opacity) : getSdrStyleFromHsl(color, opacity)));
|
|
168
183
|
}
|
|
169
184
|
function getHdrStyleFromHsl(color, opacity) {
|
|
170
185
|
return getHdrStyleFromRgb(hslToRgb(color), opacity);
|
package/cjs/Utils/MathUtils.js
CHANGED
|
@@ -137,9 +137,10 @@ export function calcPositionOrRandomFromSizeRanged(data) {
|
|
|
137
137
|
return calcPositionOrRandomFromSize({ size: data.size, position });
|
|
138
138
|
}
|
|
139
139
|
export function calcExactPositionOrRandomFromSize(data) {
|
|
140
|
+
const { position, size } = data;
|
|
140
141
|
return {
|
|
141
|
-
x:
|
|
142
|
-
y:
|
|
142
|
+
x: position?.x ?? getRandom() * size.width,
|
|
143
|
+
y: position?.y ?? getRandom() * size.height,
|
|
143
144
|
};
|
|
144
145
|
}
|
|
145
146
|
export function calcExactPositionOrRandomFromSizeRanged(data) {
|
package/cjs/Utils/Utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { clamp, collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, randomInRangeValue, } from "./MathUtils.js";
|
|
2
2
|
import { half, millisecondsToSeconds, percentDenominator } from "../Core/Utils/Constants.js";
|
|
3
|
-
import { isArray, isNull, isObject } from "./TypeUtils.js";
|
|
3
|
+
import { isArray, isBoolean, isNull, isObject } from "./TypeUtils.js";
|
|
4
4
|
import { AnimationMode } from "../Enums/Modes/AnimationMode.js";
|
|
5
5
|
import { AnimationStatus } from "../Enums/AnimationStatus.js";
|
|
6
6
|
import { DestroyType } from "../Enums/Types/DestroyType.js";
|
|
@@ -21,12 +21,6 @@ function memoize(fn) {
|
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function checkSelector(element, selectors) {
|
|
25
|
-
const res = executeOnSingleOrMultiple(selectors, selector => {
|
|
26
|
-
return element.matches(selector);
|
|
27
|
-
});
|
|
28
|
-
return isArray(res) ? res.some(t => t) : res;
|
|
29
|
-
}
|
|
30
24
|
export function hasMatchMedia() {
|
|
31
25
|
return typeof matchMedia !== "undefined";
|
|
32
26
|
}
|
|
@@ -54,13 +48,6 @@ export function safeMutationObserver(callback) {
|
|
|
54
48
|
export function isInArray(value, array) {
|
|
55
49
|
return value === array || (isArray(array) && array.includes(value));
|
|
56
50
|
}
|
|
57
|
-
export async function loadFont(font, weight) {
|
|
58
|
-
try {
|
|
59
|
-
await safeDocument().fonts.load(`${weight ?? "400"} 36px '${font ?? "Verdana"}'`);
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
51
|
export function arrayRandomIndex(array) {
|
|
65
52
|
return Math.floor(getRandom() * array.length);
|
|
66
53
|
}
|
|
@@ -104,11 +91,15 @@ export function deepExtend(destination, ...sources) {
|
|
|
104
91
|
continue;
|
|
105
92
|
}
|
|
106
93
|
const sourceIsArray = Array.isArray(source);
|
|
107
|
-
if (sourceIsArray
|
|
108
|
-
destination
|
|
94
|
+
if (sourceIsArray) {
|
|
95
|
+
if (!Array.isArray(destination)) {
|
|
96
|
+
destination = [];
|
|
97
|
+
}
|
|
109
98
|
}
|
|
110
|
-
else
|
|
111
|
-
destination
|
|
99
|
+
else {
|
|
100
|
+
if (!isObject(destination) || Array.isArray(destination)) {
|
|
101
|
+
destination = {};
|
|
102
|
+
}
|
|
112
103
|
}
|
|
113
104
|
for (const key in source) {
|
|
114
105
|
if (key === "__proto__") {
|
|
@@ -123,31 +114,6 @@ export function deepExtend(destination, ...sources) {
|
|
|
123
114
|
}
|
|
124
115
|
return destination;
|
|
125
116
|
}
|
|
126
|
-
export function isDivModeEnabled(mode, divs) {
|
|
127
|
-
return !!findItemFromSingleOrMultiple(divs, t => t.enable && isInArray(mode, t.mode));
|
|
128
|
-
}
|
|
129
|
-
export function divModeExecute(mode, divs, callback) {
|
|
130
|
-
executeOnSingleOrMultiple(divs, div => {
|
|
131
|
-
const divMode = div.mode, divEnabled = div.enable;
|
|
132
|
-
if (divEnabled && isInArray(mode, divMode)) {
|
|
133
|
-
singleDivModeExecute(div, callback);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
export function singleDivModeExecute(div, callback) {
|
|
138
|
-
const selectors = div.selectors;
|
|
139
|
-
executeOnSingleOrMultiple(selectors, selector => {
|
|
140
|
-
callback(selector, div);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
export function divMode(divs, element) {
|
|
144
|
-
if (!element || !divs) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
return findItemFromSingleOrMultiple(divs, div => {
|
|
148
|
-
return checkSelector(element, div.selectors);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
117
|
export function circleBounceDataFromParticle(p) {
|
|
152
118
|
return {
|
|
153
119
|
position: p.getPosition(),
|
|
@@ -205,6 +171,8 @@ export function initParticleNumericAnimationValue(options, pxRatio) {
|
|
|
205
171
|
case AnimationMode.random:
|
|
206
172
|
res.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
|
|
207
173
|
break;
|
|
174
|
+
default:
|
|
175
|
+
break;
|
|
208
176
|
}
|
|
209
177
|
const autoStatus = animationOptions.mode === AnimationMode.auto;
|
|
210
178
|
switch (animationOptions.startValue) {
|
|
@@ -270,6 +238,8 @@ function checkDestroy(particle, destroyType, value, minValue, maxValue) {
|
|
|
270
238
|
particle.destroy();
|
|
271
239
|
}
|
|
272
240
|
break;
|
|
241
|
+
default:
|
|
242
|
+
break;
|
|
273
243
|
}
|
|
274
244
|
}
|
|
275
245
|
export function updateAnimation(particle, data, changeDirection, destroyType, delta) {
|
|
@@ -317,6 +287,9 @@ export function updateAnimation(particle, data, changeDirection, destroyType, de
|
|
|
317
287
|
else {
|
|
318
288
|
data.value -= velocity;
|
|
319
289
|
}
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
break;
|
|
320
293
|
}
|
|
321
294
|
if (data.velocity && decay !== identity) {
|
|
322
295
|
data.velocity *= decay;
|
|
@@ -328,7 +301,7 @@ export function cloneStyle(style) {
|
|
|
328
301
|
const clonedStyle = safeDocument().createElement("div").style;
|
|
329
302
|
for (const key in style) {
|
|
330
303
|
const styleKey = style[key];
|
|
331
|
-
if (!Object.
|
|
304
|
+
if (!Object.hasOwn(style, key) || isNull(styleKey)) {
|
|
332
305
|
continue;
|
|
333
306
|
}
|
|
334
307
|
const styleValue = style.getPropertyValue?.(styleKey);
|
|
@@ -368,3 +341,39 @@ function computeFullScreenStyle(zIndex) {
|
|
|
368
341
|
return fullScreenStyle;
|
|
369
342
|
}
|
|
370
343
|
export const getFullScreenStyle = memoize(computeFullScreenStyle);
|
|
344
|
+
export function manageListener(element, event, handler, add, options) {
|
|
345
|
+
if (add) {
|
|
346
|
+
let addOptions = { passive: true };
|
|
347
|
+
if (isBoolean(options)) {
|
|
348
|
+
addOptions.capture = options;
|
|
349
|
+
}
|
|
350
|
+
else if (options !== undefined) {
|
|
351
|
+
addOptions = options;
|
|
352
|
+
}
|
|
353
|
+
element.addEventListener(event, handler, addOptions);
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const removeOptions = options;
|
|
357
|
+
element.removeEventListener(event, handler, removeOptions);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
export async function getItemsFromInitializer(container, map, initializers, force = false) {
|
|
361
|
+
let res = map.get(container);
|
|
362
|
+
if (!res || force) {
|
|
363
|
+
res = await Promise.all([...initializers.values()].map(t => t(container)));
|
|
364
|
+
map.set(container, res);
|
|
365
|
+
}
|
|
366
|
+
return res;
|
|
367
|
+
}
|
|
368
|
+
export async function getItemMapFromInitializer(container, map, initializers, force = false) {
|
|
369
|
+
let res = map.get(container);
|
|
370
|
+
if (!res || force) {
|
|
371
|
+
res = new Map();
|
|
372
|
+
const entries = await Promise.all([...initializers.entries()].map(async ([key, initializer]) => [key, await initializer(container)]));
|
|
373
|
+
for (const [key, item] of entries) {
|
|
374
|
+
res.set(key, item);
|
|
375
|
+
}
|
|
376
|
+
map.set(container, res);
|
|
377
|
+
}
|
|
378
|
+
return res;
|
|
379
|
+
}
|
package/cjs/exports.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from "./Core/Utils/Constants.js";
|
|
2
|
-
export * from "./Core/Utils/ExternalInteractorBase.js";
|
|
3
|
-
export * from "./Core/Utils/ParticlesInteractorBase.js";
|
|
4
2
|
export * from "./Core/Utils/Point.js";
|
|
5
3
|
export * from "./Core/Utils/Ranges.js";
|
|
6
4
|
export * from "./Core/Utils/Vectors.js";
|
|
@@ -11,36 +9,20 @@ export * from "./Enums/Modes/AnimationMode.js";
|
|
|
11
9
|
export * from "./Enums/Modes/LimitMode.js";
|
|
12
10
|
export * from "./Enums/Modes/OutMode.js";
|
|
13
11
|
export * from "./Enums/Modes/PixelMode.js";
|
|
14
|
-
export * from "./Enums/Modes/ThemeMode.js";
|
|
15
|
-
export * from "./Enums/Modes/ResponsiveMode.js";
|
|
16
12
|
export * from "./Enums/Types/AlterType.js";
|
|
17
13
|
export * from "./Enums/Types/DestroyType.js";
|
|
18
14
|
export * from "./Enums/Types/GradientType.js";
|
|
19
|
-
export * from "./Enums/Types/InteractorType.js";
|
|
20
15
|
export * from "./Enums/Types/ParticleOutType.js";
|
|
21
16
|
export * from "./Enums/Types/StartValueType.js";
|
|
22
|
-
export * from "./Enums/Types/DivType.js";
|
|
23
17
|
export * from "./Enums/Types/EasingType.js";
|
|
24
18
|
export * from "./Enums/Types/EventType.js";
|
|
25
19
|
export * from "./Enums/AnimationStatus.js";
|
|
26
|
-
export * from "./Enums/InteractivityDetect.js";
|
|
27
20
|
export * from "./Options/Classes/AnimatableColor.js";
|
|
28
21
|
export * from "./Options/Classes/AnimationOptions.js";
|
|
29
22
|
export * from "./Options/Classes/Background/Background.js";
|
|
30
23
|
export * from "./Options/Classes/ColorAnimation.js";
|
|
31
24
|
export * from "./Options/Classes/FullScreen/FullScreen.js";
|
|
32
25
|
export * from "./Options/Classes/HslAnimation.js";
|
|
33
|
-
export * from "./Options/Classes/Interactivity/Events/ClickEvent.js";
|
|
34
|
-
export * from "./Options/Classes/Interactivity/Events/DivEvent.js";
|
|
35
|
-
export * from "./Options/Classes/Interactivity/Events/ClickEvent.js";
|
|
36
|
-
export * from "./Options/Classes/Interactivity/Events/DivEvent.js";
|
|
37
|
-
export * from "./Options/Classes/Interactivity/Events/Events.js";
|
|
38
|
-
export * from "./Options/Classes/Interactivity/Events/HoverEvent.js";
|
|
39
|
-
export * from "./Options/Classes/Interactivity/Events/Parallax.js";
|
|
40
|
-
export * from "./Options/Classes/Interactivity/Events/ResizeEvent.js";
|
|
41
|
-
export * from "./Options/Classes/Interactivity/Interactivity.js";
|
|
42
|
-
export * from "./Options/Classes/Interactivity/Modes/Modes.js";
|
|
43
|
-
export * from "./Options/Classes/ManualParticle.js";
|
|
44
26
|
export * from "./Options/Classes/Options.js";
|
|
45
27
|
export * from "./Options/Classes/OptionsColor.js";
|
|
46
28
|
export * from "./Options/Classes/Particles/Bounce/ParticlesBounce.js";
|
|
@@ -64,9 +46,7 @@ export * from "./Options/Classes/Particles/Shape/Shape.js";
|
|
|
64
46
|
export * from "./Options/Classes/Particles/Size/Size.js";
|
|
65
47
|
export * from "./Options/Classes/Particles/Size/SizeAnimation.js";
|
|
66
48
|
export * from "./Options/Classes/Particles/ZIndex/ZIndex.js";
|
|
67
|
-
export * from "./Options/Classes/
|
|
68
|
-
export * from "./Options/Classes/Theme/Theme.js";
|
|
69
|
-
export * from "./Options/Classes/Theme/ThemeDefault.js";
|
|
49
|
+
export * from "./Options/Classes/ResizeEvent.js";
|
|
70
50
|
export * from "./Options/Classes/ValueWithRandom.js";
|
|
71
51
|
export * from "./Utils/CanvasUtils.js";
|
|
72
52
|
export * from "./Utils/ColorUtils.js";
|