@tsparticles/engine 4.0.0-alpha.0 → 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 +219 -195
- 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/umd/Core/Particles.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./Utils/Constants.js", "../Enums/Types/EventType.js", "
|
|
7
|
+
define(["require", "exports", "./Utils/Constants.js", "../Enums/Types/EventType.js", "../Enums/Modes/LimitMode.js", "./Particle.js", "./Utils/Point.js", "./Utils/QuadTree.js", "./Utils/Ranges.js", "../Utils/LogUtils.js", "../Utils/OptionsUtils.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -12,105 +12,44 @@
|
|
|
12
12
|
exports.Particles = void 0;
|
|
13
13
|
const Constants_js_1 = require("./Utils/Constants.js");
|
|
14
14
|
const EventType_js_1 = require("../Enums/Types/EventType.js");
|
|
15
|
-
const InteractionManager_js_1 = require("./Utils/InteractionManager.js");
|
|
16
15
|
const LimitMode_js_1 = require("../Enums/Modes/LimitMode.js");
|
|
17
16
|
const Particle_js_1 = require("./Particle.js");
|
|
18
17
|
const Point_js_1 = require("./Utils/Point.js");
|
|
19
18
|
const QuadTree_js_1 = require("./Utils/QuadTree.js");
|
|
20
19
|
const Ranges_js_1 = require("./Utils/Ranges.js");
|
|
21
20
|
const LogUtils_js_1 = require("../Utils/LogUtils.js");
|
|
22
|
-
const Utils_js_1 = require("../Utils/Utils.js");
|
|
23
21
|
const OptionsUtils_js_1 = require("../Utils/OptionsUtils.js");
|
|
24
22
|
const qTreeRectangle = (canvasSize) => {
|
|
25
23
|
const { height, width } = canvasSize;
|
|
26
24
|
return new Ranges_js_1.Rectangle(Constants_js_1.posOffset * width, Constants_js_1.posOffset * height, Constants_js_1.sizeFactor * width, Constants_js_1.sizeFactor * height);
|
|
27
25
|
};
|
|
28
26
|
class Particles {
|
|
27
|
+
availablePathGenerators;
|
|
28
|
+
checkParticlePositionPlugins;
|
|
29
|
+
effectDrawers;
|
|
30
|
+
movers;
|
|
31
|
+
pathGenerators;
|
|
32
|
+
quadTree;
|
|
33
|
+
shapeDrawers;
|
|
34
|
+
updaters;
|
|
35
|
+
_array;
|
|
36
|
+
_container;
|
|
37
|
+
_engine;
|
|
38
|
+
_groupLimits;
|
|
39
|
+
_limit;
|
|
40
|
+
_maxZIndex;
|
|
41
|
+
_minZIndex;
|
|
42
|
+
_needsSort;
|
|
43
|
+
_nextId;
|
|
44
|
+
_particleResetPlugins;
|
|
45
|
+
_particleUpdatePlugins;
|
|
46
|
+
_pool;
|
|
47
|
+
_postParticleUpdatePlugins;
|
|
48
|
+
_postUpdatePlugins;
|
|
49
|
+
_resizeFactor;
|
|
50
|
+
_updatePlugins;
|
|
51
|
+
_zArray;
|
|
29
52
|
constructor(engine, container) {
|
|
30
|
-
this._addToPool = (...particles) => {
|
|
31
|
-
this._pool.push(...particles);
|
|
32
|
-
};
|
|
33
|
-
this._applyDensity = (options, manualCount, group, groupOptions) => {
|
|
34
|
-
const numberOptions = options.number;
|
|
35
|
-
if (!numberOptions.density.enable) {
|
|
36
|
-
if (group === undefined) {
|
|
37
|
-
this._limit = numberOptions.limit.value;
|
|
38
|
-
}
|
|
39
|
-
else if (groupOptions?.number.limit.value ?? numberOptions.limit.value) {
|
|
40
|
-
this._groupLimits.set(group, groupOptions?.number.limit.value ?? numberOptions.limit.value);
|
|
41
|
-
}
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const densityFactor = this._initDensityFactor(numberOptions.density), optParticlesNumber = numberOptions.value, optParticlesLimit = numberOptions.limit.value > Constants_js_1.minLimit ? numberOptions.limit.value : optParticlesNumber, particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + manualCount, particlesCount = Math.min(this.count, this.filter(t => t.group === group).length);
|
|
45
|
-
if (group === undefined) {
|
|
46
|
-
this._limit = numberOptions.limit.value * densityFactor;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
this._groupLimits.set(group, numberOptions.limit.value * densityFactor);
|
|
50
|
-
}
|
|
51
|
-
if (particlesCount < particlesNumber) {
|
|
52
|
-
this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
|
|
53
|
-
}
|
|
54
|
-
else if (particlesCount > particlesNumber) {
|
|
55
|
-
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
this._initDensityFactor = densityOptions => {
|
|
59
|
-
const container = this._container;
|
|
60
|
-
if (!container.canvas.element || !densityOptions.enable) {
|
|
61
|
-
return Constants_js_1.defaultDensityFactor;
|
|
62
|
-
}
|
|
63
|
-
const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
|
|
64
|
-
return (canvas.width * canvas.height) / (densityOptions.height * densityOptions.width * pxRatio ** Constants_js_1.squareExp);
|
|
65
|
-
};
|
|
66
|
-
this._pushParticle = (position, overrideOptions, group, initializer) => {
|
|
67
|
-
try {
|
|
68
|
-
const particle = this._pool.pop() ?? new Particle_js_1.Particle(this._engine, this._container);
|
|
69
|
-
particle.init(this._nextId, position, overrideOptions, group);
|
|
70
|
-
let canAdd = true;
|
|
71
|
-
if (initializer) {
|
|
72
|
-
canAdd = initializer(particle);
|
|
73
|
-
}
|
|
74
|
-
if (!canAdd) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
this._array.push(particle);
|
|
78
|
-
this._zArray.push(particle);
|
|
79
|
-
this._nextId++;
|
|
80
|
-
this._engine.dispatchEvent(EventType_js_1.EventType.particleAdded, {
|
|
81
|
-
container: this._container,
|
|
82
|
-
data: {
|
|
83
|
-
particle,
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
return particle;
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
(0, LogUtils_js_1.getLogger)().warning(`error adding particle: ${e}`);
|
|
90
|
-
}
|
|
91
|
-
return undefined;
|
|
92
|
-
};
|
|
93
|
-
this._removeParticle = (index, group, override) => {
|
|
94
|
-
const particle = this._array[index];
|
|
95
|
-
if (!particle) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
if (particle.group !== group) {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
const zIdx = this._zArray.indexOf(particle);
|
|
102
|
-
this._array.splice(index, Constants_js_1.deleteCount);
|
|
103
|
-
this._zArray.splice(zIdx, Constants_js_1.deleteCount);
|
|
104
|
-
particle.destroy(override);
|
|
105
|
-
this._engine.dispatchEvent(EventType_js_1.EventType.particleRemoved, {
|
|
106
|
-
container: this._container,
|
|
107
|
-
data: {
|
|
108
|
-
particle,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
this._addToPool(particle);
|
|
112
|
-
return true;
|
|
113
|
-
};
|
|
114
53
|
this._engine = engine;
|
|
115
54
|
this._container = container;
|
|
116
55
|
this._nextId = 0;
|
|
@@ -120,21 +59,26 @@
|
|
|
120
59
|
this._limit = 0;
|
|
121
60
|
this._groupLimits = new Map();
|
|
122
61
|
this._needsSort = false;
|
|
123
|
-
this.
|
|
124
|
-
this.
|
|
125
|
-
this._pluginsInitialized = false;
|
|
62
|
+
this._minZIndex = 0;
|
|
63
|
+
this._maxZIndex = 0;
|
|
126
64
|
const canvasSize = container.canvas.size;
|
|
127
65
|
this.quadTree = new QuadTree_js_1.QuadTree(qTreeRectangle(canvasSize), Constants_js_1.qTreeCapacity);
|
|
66
|
+
this.effectDrawers = new Map();
|
|
128
67
|
this.movers = [];
|
|
68
|
+
this.availablePathGenerators = new Map();
|
|
69
|
+
this.pathGenerators = new Map();
|
|
70
|
+
this.shapeDrawers = new Map();
|
|
129
71
|
this.updaters = [];
|
|
72
|
+
this.checkParticlePositionPlugins = [];
|
|
73
|
+
this._particleResetPlugins = [];
|
|
74
|
+
this._particleUpdatePlugins = [];
|
|
75
|
+
this._postUpdatePlugins = [];
|
|
76
|
+
this._postParticleUpdatePlugins = [];
|
|
77
|
+
this._updatePlugins = [];
|
|
130
78
|
}
|
|
131
79
|
get count() {
|
|
132
80
|
return this._array.length;
|
|
133
81
|
}
|
|
134
|
-
addManualParticles() {
|
|
135
|
-
const container = this._container, options = container.actualOptions;
|
|
136
|
-
options.manualParticles.forEach(p => this.addParticle(p.position ? (0, Utils_js_1.getPosition)(p.position, container.canvas.size) : undefined, p.options));
|
|
137
|
-
}
|
|
138
82
|
addParticle(position, overrideOptions, group, initializer) {
|
|
139
83
|
const limitMode = this._container.actualOptions.particles.number.limit.mode, limit = group === undefined ? this._limit : (this._groupLimits.get(group) ?? this._limit), currentCount = this.count;
|
|
140
84
|
if (limit > Constants_js_1.minLimit) {
|
|
@@ -151,20 +95,64 @@
|
|
|
151
95
|
return;
|
|
152
96
|
}
|
|
153
97
|
break;
|
|
98
|
+
default:
|
|
99
|
+
break;
|
|
154
100
|
}
|
|
155
101
|
}
|
|
156
|
-
|
|
102
|
+
try {
|
|
103
|
+
const particle = this._pool.pop() ?? new Particle_js_1.Particle(this._engine, this._container);
|
|
104
|
+
particle.init(this._nextId, position, overrideOptions, group);
|
|
105
|
+
let canAdd = true;
|
|
106
|
+
if (initializer) {
|
|
107
|
+
canAdd = initializer(particle);
|
|
108
|
+
}
|
|
109
|
+
if (!canAdd) {
|
|
110
|
+
this._pool.push(particle);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this._array.push(particle);
|
|
114
|
+
this._zArray.push(particle);
|
|
115
|
+
this._nextId++;
|
|
116
|
+
this._engine.dispatchEvent(EventType_js_1.EventType.particleAdded, {
|
|
117
|
+
container: this._container,
|
|
118
|
+
data: {
|
|
119
|
+
particle,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
return particle;
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
(0, LogUtils_js_1.getLogger)().warning(`error adding particle: ${e}`);
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
157
128
|
}
|
|
158
129
|
clear() {
|
|
159
130
|
this._array = [];
|
|
160
131
|
this._zArray = [];
|
|
161
|
-
this._pluginsInitialized = false;
|
|
162
132
|
}
|
|
163
133
|
destroy() {
|
|
134
|
+
const container = this._container;
|
|
135
|
+
for (const [, effectDrawer] of this.effectDrawers) {
|
|
136
|
+
effectDrawer.destroy?.(container);
|
|
137
|
+
}
|
|
138
|
+
for (const [, shapeDrawer] of this.shapeDrawers) {
|
|
139
|
+
shapeDrawer.destroy?.(container);
|
|
140
|
+
}
|
|
164
141
|
this._array = [];
|
|
142
|
+
this._pool.length = 0;
|
|
165
143
|
this._zArray = [];
|
|
144
|
+
this.effectDrawers = new Map();
|
|
166
145
|
this.movers = [];
|
|
146
|
+
this.availablePathGenerators = new Map();
|
|
147
|
+
this.pathGenerators = new Map();
|
|
148
|
+
this.shapeDrawers = new Map();
|
|
167
149
|
this.updaters = [];
|
|
150
|
+
this.checkParticlePositionPlugins = [];
|
|
151
|
+
this._particleResetPlugins = [];
|
|
152
|
+
this._particleUpdatePlugins = [];
|
|
153
|
+
this._postUpdatePlugins = [];
|
|
154
|
+
this._postParticleUpdatePlugins = [];
|
|
155
|
+
this._updatePlugins = [];
|
|
168
156
|
}
|
|
169
157
|
drawParticles(delta) {
|
|
170
158
|
for (const particle of this._zArray) {
|
|
@@ -180,22 +168,54 @@
|
|
|
180
168
|
get(index) {
|
|
181
169
|
return this._array[index];
|
|
182
170
|
}
|
|
183
|
-
handleClickMode(mode) {
|
|
184
|
-
this._interactionManager.handleClickMode(mode);
|
|
185
|
-
}
|
|
186
171
|
async init() {
|
|
187
172
|
const container = this._container, options = container.actualOptions;
|
|
188
|
-
this.
|
|
173
|
+
this._minZIndex = 0;
|
|
174
|
+
this._maxZIndex = 0;
|
|
189
175
|
this._needsSort = false;
|
|
176
|
+
this.checkParticlePositionPlugins = [];
|
|
177
|
+
this._updatePlugins = [];
|
|
178
|
+
this._particleUpdatePlugins = [];
|
|
179
|
+
this._postUpdatePlugins = [];
|
|
180
|
+
this._particleResetPlugins = [];
|
|
181
|
+
this._postParticleUpdatePlugins = [];
|
|
182
|
+
for (const plugin of container.plugins) {
|
|
183
|
+
if (plugin.redrawInit) {
|
|
184
|
+
await plugin.redrawInit();
|
|
185
|
+
}
|
|
186
|
+
if (plugin.checkParticlePosition) {
|
|
187
|
+
this.checkParticlePositionPlugins.push(plugin);
|
|
188
|
+
}
|
|
189
|
+
if (plugin.update) {
|
|
190
|
+
this._updatePlugins.push(plugin);
|
|
191
|
+
}
|
|
192
|
+
if (plugin.particleUpdate) {
|
|
193
|
+
this._particleUpdatePlugins.push(plugin);
|
|
194
|
+
}
|
|
195
|
+
if (plugin.postUpdate) {
|
|
196
|
+
this._postUpdatePlugins.push(plugin);
|
|
197
|
+
}
|
|
198
|
+
if (plugin.particleReset) {
|
|
199
|
+
this._particleResetPlugins.push(plugin);
|
|
200
|
+
}
|
|
201
|
+
if (plugin.postParticleUpdate) {
|
|
202
|
+
this._postParticleUpdatePlugins.push(plugin);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
190
205
|
await this.initPlugins();
|
|
206
|
+
for (const drawer of this.effectDrawers.values()) {
|
|
207
|
+
await drawer.init?.(container);
|
|
208
|
+
}
|
|
209
|
+
for (const drawer of this.shapeDrawers.values()) {
|
|
210
|
+
await drawer.init?.(container);
|
|
211
|
+
}
|
|
191
212
|
let handled = false;
|
|
192
|
-
for (const plugin of container.plugins
|
|
213
|
+
for (const plugin of container.plugins) {
|
|
193
214
|
handled = plugin.particlesInitialization?.() ?? handled;
|
|
194
215
|
if (handled) {
|
|
195
216
|
break;
|
|
196
217
|
}
|
|
197
218
|
}
|
|
198
|
-
this.addManualParticles();
|
|
199
219
|
if (!handled) {
|
|
200
220
|
const particlesOptions = options.particles, groups = particlesOptions.groups;
|
|
201
221
|
for (const group in groups) {
|
|
@@ -213,20 +233,20 @@
|
|
|
213
233
|
}
|
|
214
234
|
}
|
|
215
235
|
async initPlugins() {
|
|
216
|
-
if (this._pluginsInitialized) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
236
|
const container = this._container;
|
|
237
|
+
this.effectDrawers = await this._engine.getEffectDrawers(container, true);
|
|
220
238
|
this.movers = await this._engine.getMovers(container, true);
|
|
239
|
+
this.availablePathGenerators = await this._engine.getPathGenerators(container, true);
|
|
240
|
+
this.pathGenerators = new Map();
|
|
241
|
+
this.shapeDrawers = await this._engine.getShapeDrawers(container, true);
|
|
221
242
|
this.updaters = await this._engine.getUpdaters(container, true);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
pathGenerator.init(container);
|
|
243
|
+
for (const pathGenerator of this.pathGenerators.values()) {
|
|
244
|
+
pathGenerator.init();
|
|
225
245
|
}
|
|
226
246
|
}
|
|
227
|
-
push(nb,
|
|
247
|
+
push(nb, position, overrideOptions, group) {
|
|
228
248
|
for (let i = 0; i < nb; i++) {
|
|
229
|
-
this.addParticle(
|
|
249
|
+
this.addParticle(position, overrideOptions, group);
|
|
230
250
|
}
|
|
231
251
|
}
|
|
232
252
|
async redraw() {
|
|
@@ -253,20 +273,25 @@
|
|
|
253
273
|
this.removeAt(Constants_js_1.minIndex, quantity, group);
|
|
254
274
|
}
|
|
255
275
|
setDensity() {
|
|
256
|
-
const options = this._container.actualOptions, groups = options.particles.groups
|
|
276
|
+
const options = this._container.actualOptions, groups = options.particles.groups;
|
|
277
|
+
let pluginsCount = 0;
|
|
278
|
+
for (const plugin of this._container.plugins) {
|
|
279
|
+
if (plugin.particlesDensityCount) {
|
|
280
|
+
pluginsCount += plugin.particlesDensityCount();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
257
283
|
for (const group in groups) {
|
|
258
284
|
const groupData = groups[group];
|
|
259
285
|
if (!groupData) {
|
|
260
286
|
continue;
|
|
261
287
|
}
|
|
262
288
|
const groupDataOptions = (0, OptionsUtils_js_1.loadParticlesOptions)(this._engine, this._container, groupData);
|
|
263
|
-
this._applyDensity(groupDataOptions,
|
|
289
|
+
this._applyDensity(groupDataOptions, pluginsCount, group);
|
|
264
290
|
}
|
|
265
|
-
this._applyDensity(options.particles,
|
|
291
|
+
this._applyDensity(options.particles, pluginsCount);
|
|
266
292
|
}
|
|
267
293
|
setLastZIndex(zIndex) {
|
|
268
|
-
this.
|
|
269
|
-
this._needsSort = this._needsSort || this._lastZIndex < zIndex;
|
|
294
|
+
this._needsSort ||= zIndex >= this._maxZIndex || (zIndex > this._minZIndex && zIndex < this._maxZIndex);
|
|
270
295
|
}
|
|
271
296
|
setResizeFactor(factor) {
|
|
272
297
|
this._resizeFactor = factor;
|
|
@@ -274,10 +299,10 @@
|
|
|
274
299
|
update(delta) {
|
|
275
300
|
const container = this._container, particlesToDelete = new Set();
|
|
276
301
|
this.quadTree = new QuadTree_js_1.QuadTree(qTreeRectangle(container.canvas.size), Constants_js_1.qTreeCapacity);
|
|
277
|
-
for (const pathGenerator of
|
|
302
|
+
for (const pathGenerator of this.pathGenerators.values()) {
|
|
278
303
|
pathGenerator.update();
|
|
279
304
|
}
|
|
280
|
-
for (const plugin of
|
|
305
|
+
for (const plugin of this._updatePlugins) {
|
|
281
306
|
plugin.update?.(delta);
|
|
282
307
|
}
|
|
283
308
|
const resizeFactor = this._resizeFactor;
|
|
@@ -289,8 +314,10 @@
|
|
|
289
314
|
particle.initialPosition.y *= resizeFactor.height;
|
|
290
315
|
}
|
|
291
316
|
particle.ignoresResizeRatio = false;
|
|
292
|
-
this.
|
|
293
|
-
|
|
317
|
+
for (const plugin of this._particleResetPlugins) {
|
|
318
|
+
plugin.particleReset?.(particle);
|
|
319
|
+
}
|
|
320
|
+
for (const plugin of this._particleUpdatePlugins) {
|
|
294
321
|
if (particle.destroyed) {
|
|
295
322
|
break;
|
|
296
323
|
}
|
|
@@ -321,27 +348,89 @@
|
|
|
321
348
|
}
|
|
322
349
|
this._addToPool(...particlesToDelete);
|
|
323
350
|
}
|
|
324
|
-
this.
|
|
351
|
+
for (const plugin of this._postUpdatePlugins) {
|
|
352
|
+
plugin.postUpdate?.(delta);
|
|
353
|
+
}
|
|
325
354
|
for (const particle of this._array) {
|
|
326
355
|
for (const updater of this.updaters) {
|
|
327
356
|
updater.update(particle, delta);
|
|
328
357
|
}
|
|
329
358
|
if (!particle.destroyed && !particle.spawning) {
|
|
330
|
-
this.
|
|
359
|
+
for (const plugin of this._postParticleUpdatePlugins) {
|
|
360
|
+
plugin.postParticleUpdate?.(particle, delta);
|
|
361
|
+
}
|
|
331
362
|
}
|
|
332
363
|
}
|
|
333
364
|
delete this._resizeFactor;
|
|
334
365
|
if (this._needsSort) {
|
|
335
366
|
const zArray = this._zArray;
|
|
336
367
|
zArray.sort((a, b) => b.position.z - a.position.z || a.id - b.id);
|
|
337
|
-
const lastItem = zArray[zArray.length - Constants_js_1.lengthOffset];
|
|
338
|
-
if (!lastItem) {
|
|
368
|
+
const firstItem = zArray[Constants_js_1.minIndex], lastItem = zArray[zArray.length - Constants_js_1.lengthOffset];
|
|
369
|
+
if (!firstItem || !lastItem) {
|
|
339
370
|
return;
|
|
340
371
|
}
|
|
341
|
-
this.
|
|
372
|
+
this._maxZIndex = firstItem.position.z;
|
|
373
|
+
this._minZIndex = lastItem.position.z;
|
|
342
374
|
this._needsSort = false;
|
|
343
375
|
}
|
|
344
376
|
}
|
|
377
|
+
_addToPool = (...particles) => {
|
|
378
|
+
this._pool.push(...particles);
|
|
379
|
+
};
|
|
380
|
+
_applyDensity = (options, pluginsCount, group, groupOptions) => {
|
|
381
|
+
const numberOptions = options.number;
|
|
382
|
+
if (!numberOptions.density.enable) {
|
|
383
|
+
if (group === undefined) {
|
|
384
|
+
this._limit = numberOptions.limit.value;
|
|
385
|
+
}
|
|
386
|
+
else if (groupOptions?.number.limit.value ?? numberOptions.limit.value) {
|
|
387
|
+
this._groupLimits.set(group, groupOptions?.number.limit.value ?? numberOptions.limit.value);
|
|
388
|
+
}
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const densityFactor = this._initDensityFactor(numberOptions.density), optParticlesNumber = numberOptions.value, optParticlesLimit = numberOptions.limit.value > Constants_js_1.minLimit ? numberOptions.limit.value : optParticlesNumber, particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + pluginsCount, particlesCount = Math.min(this.count, this.filter(t => t.group === group).length);
|
|
392
|
+
if (group === undefined) {
|
|
393
|
+
this._limit = numberOptions.limit.value * densityFactor;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
this._groupLimits.set(group, numberOptions.limit.value * densityFactor);
|
|
397
|
+
}
|
|
398
|
+
if (particlesCount < particlesNumber) {
|
|
399
|
+
this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
|
|
400
|
+
}
|
|
401
|
+
else if (particlesCount > particlesNumber) {
|
|
402
|
+
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
_initDensityFactor = densityOptions => {
|
|
406
|
+
const container = this._container;
|
|
407
|
+
if (!container.canvas.element || !densityOptions.enable) {
|
|
408
|
+
return Constants_js_1.defaultDensityFactor;
|
|
409
|
+
}
|
|
410
|
+
const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
|
|
411
|
+
return (canvas.width * canvas.height) / (densityOptions.height * densityOptions.width * pxRatio ** Constants_js_1.squareExp);
|
|
412
|
+
};
|
|
413
|
+
_removeParticle = (index, group, override) => {
|
|
414
|
+
const particle = this._array[index];
|
|
415
|
+
if (!particle) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
if (particle.group !== group) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
const zIdx = this._zArray.indexOf(particle);
|
|
422
|
+
this._array.splice(index, Constants_js_1.deleteCount);
|
|
423
|
+
this._zArray.splice(zIdx, Constants_js_1.deleteCount);
|
|
424
|
+
particle.destroy(override);
|
|
425
|
+
this._engine.dispatchEvent(EventType_js_1.EventType.particleRemoved, {
|
|
426
|
+
container: this._container,
|
|
427
|
+
data: {
|
|
428
|
+
particle,
|
|
429
|
+
},
|
|
430
|
+
});
|
|
431
|
+
this._addToPool(particle);
|
|
432
|
+
return true;
|
|
433
|
+
};
|
|
345
434
|
}
|
|
346
435
|
exports.Particles = Particles;
|
|
347
436
|
});
|
package/umd/Core/Retina.js
CHANGED
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
const Constants_js_1 = require("./Utils/Constants.js");
|
|
14
14
|
const MathUtils_js_1 = require("../Utils/MathUtils.js");
|
|
15
15
|
class Retina {
|
|
16
|
+
container;
|
|
17
|
+
maxSpeed;
|
|
18
|
+
pixelRatio;
|
|
19
|
+
reduceFactor;
|
|
20
|
+
sizeAnimationSpeed;
|
|
16
21
|
constructor(container) {
|
|
17
22
|
this.container = container;
|
|
18
23
|
this.pixelRatio = Constants_js_1.defaultRatio;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.defaultTime = exports.defaultLoops = exports.defaultVelocity = exports.defaultRgbMin = exports.phaseNumerator = exports.sNormalizedOffset = exports.sextuple = exports.triple = exports.lMin = exports.lFactor = exports.minStrokeWidth = exports.identity = exports.defaultAngle = exports.manualDefaultPosition = exports.touchDelay = exports.deleteCount = exports.defaultDensityFactor = exports.lengthOffset = exports.
|
|
13
|
-
exports.generatedAttribute = "generated", exports.
|
|
12
|
+
exports.defaultTime = exports.defaultLoops = exports.defaultVelocity = exports.defaultRgbMin = exports.phaseNumerator = exports.sNormalizedOffset = exports.sextuple = exports.triple = exports.lMin = exports.lFactor = exports.minStrokeWidth = exports.identity = exports.defaultAngle = exports.manualDefaultPosition = exports.touchDelay = exports.deleteCount = exports.defaultDensityFactor = exports.lengthOffset = exports.minIndex = exports.minCount = exports.countOffset = exports.minLimit = exports.sizeFactor = exports.posOffset = exports.defaultRadius = exports.minZ = exports.minRetries = exports.tryCountIncrement = exports.decayOffset = exports.none = exports.one = exports.loadMinIndex = exports.loadRandomFactor = exports.canvasFirstIndex = exports.minFpsLimit = exports.defaultFpsLimit = exports.removeMinIndex = exports.removeDeleteCount = exports.minCoordinate = exports.touchEndLengthOffset = exports.clickRadius = exports.defaultOpacity = exports.zIndexFactorOffset = exports.minimumLength = exports.minimumSize = exports.defaultTransformValue = exports.minVelocity = exports.threeQuarter = exports.quarter = exports.empty = exports.hPhase = exports.sMin = exports.hMin = exports.lMax = exports.sMax = exports.hMax = exports.rgbMax = exports.inverseFactorNumerator = exports.subdivideCount = exports.defaultReduceFactor = exports.defaultRatio = exports.defaultRemoveQuantity = exports.qTreeCapacity = exports.squareExp = exports.defaultRetryCount = exports.canvasTag = exports.generatedFalse = exports.generatedTrue = exports.defaultAlpha = exports.defaultFps = exports.doublePI = exports.double = exports.midColorValue = exports.randomColorValue = exports.defaultTransform = exports.originPoint = exports.millisecondsToSeconds = exports.half = exports.percentDenominator = exports.visibilityChangeEvent = exports.resizeEvent = exports.generatedAttribute = void 0;
|
|
13
|
+
exports.generatedAttribute = "generated", exports.resizeEvent = "resize", exports.visibilityChangeEvent = "visibilitychange", exports.percentDenominator = 100, exports.half = 0.5, exports.millisecondsToSeconds = 1000, exports.originPoint = {
|
|
14
14
|
x: 0,
|
|
15
15
|
y: 0,
|
|
16
16
|
z: 0,
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
b: 0,
|
|
20
20
|
c: 0,
|
|
21
21
|
d: 1,
|
|
22
|
-
}, exports.randomColorValue = "random", exports.midColorValue = "mid", exports.double = 2, exports.doublePI = Math.PI * exports.double, exports.defaultFps = 60, exports.defaultAlpha = 1, exports.generatedTrue = "true", exports.generatedFalse = "false", exports.canvasTag = "canvas", exports.defaultRetryCount = 0, exports.squareExp = 2, exports.qTreeCapacity = 4, exports.defaultRemoveQuantity = 1, exports.defaultRatio = 1, exports.defaultReduceFactor = 1, exports.subdivideCount = 4, exports.inverseFactorNumerator = 1.0, exports.rgbMax = 255, exports.hMax = 360, exports.sMax = 100, exports.lMax = 100, exports.hMin = 0, exports.sMin = 0, exports.hPhase = 60, exports.empty = 0, exports.quarter = 0.25, exports.threeQuarter = exports.half + exports.quarter, exports.minVelocity = 0, exports.defaultTransformValue = 1, exports.minimumSize = 0, exports.minimumLength = 0, exports.zIndexFactorOffset = 1, exports.defaultOpacity = 1, exports.clickRadius = 1, exports.touchEndLengthOffset = 1, exports.minCoordinate = 0, exports.removeDeleteCount = 1, exports.removeMinIndex = 0, exports.defaultFpsLimit = 120, exports.minFpsLimit = 0, exports.canvasFirstIndex = 0, exports.loadRandomFactor = 10000, exports.loadMinIndex = 0, exports.one = 1, exports.none = 0, exports.decayOffset = 1, exports.tryCountIncrement = 1, exports.minRetries = 0, exports.
|
|
22
|
+
}, exports.randomColorValue = "random", exports.midColorValue = "mid", exports.double = 2, exports.doublePI = Math.PI * exports.double, exports.defaultFps = 60, exports.defaultAlpha = 1, exports.generatedTrue = "true", exports.generatedFalse = "false", exports.canvasTag = "canvas", exports.defaultRetryCount = 0, exports.squareExp = 2, exports.qTreeCapacity = 4, exports.defaultRemoveQuantity = 1, exports.defaultRatio = 1, exports.defaultReduceFactor = 1, exports.subdivideCount = 4, exports.inverseFactorNumerator = 1.0, exports.rgbMax = 255, exports.hMax = 360, exports.sMax = 100, exports.lMax = 100, exports.hMin = 0, exports.sMin = 0, exports.hPhase = 60, exports.empty = 0, exports.quarter = 0.25, exports.threeQuarter = exports.half + exports.quarter, exports.minVelocity = 0, exports.defaultTransformValue = 1, exports.minimumSize = 0, exports.minimumLength = 0, exports.zIndexFactorOffset = 1, exports.defaultOpacity = 1, exports.clickRadius = 1, exports.touchEndLengthOffset = 1, exports.minCoordinate = 0, exports.removeDeleteCount = 1, exports.removeMinIndex = 0, exports.defaultFpsLimit = 120, exports.minFpsLimit = 0, exports.canvasFirstIndex = 0, exports.loadRandomFactor = 10000, exports.loadMinIndex = 0, exports.one = 1, exports.none = 0, exports.decayOffset = 1, exports.tryCountIncrement = 1, exports.minRetries = 0, exports.minZ = 0, exports.defaultRadius = 0, exports.posOffset = -exports.quarter, exports.sizeFactor = 1.5, exports.minLimit = 0, exports.countOffset = 1, exports.minCount = 0, exports.minIndex = 0, exports.lengthOffset = 1, exports.defaultDensityFactor = 1, exports.deleteCount = 1, exports.touchDelay = 500, exports.manualDefaultPosition = 50, exports.defaultAngle = 0, exports.identity = 1, exports.minStrokeWidth = 0, exports.lFactor = 1, exports.lMin = 0, exports.triple = 3, exports.sextuple = 6, exports.sNormalizedOffset = 1, exports.phaseNumerator = 1, exports.defaultRgbMin = 0, exports.defaultVelocity = 0, exports.defaultLoops = 0, exports.defaultTime = 0;
|
|
23
23
|
});
|