@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/types/exports.d.ts
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";
|
package/umd/Core/Canvas.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const Utils_js_1 = require("../Utils/Utils.js");
|
|
15
15
|
const Constants_js_1 = require("./Utils/Constants.js");
|
|
16
16
|
const ColorUtils_js_1 = require("../Utils/ColorUtils.js");
|
|
17
|
+
const fColorIndex = 0, sColorIndex = 1;
|
|
17
18
|
function setTransformValue(factor, newFactor, key) {
|
|
18
19
|
const newValue = newFactor[key];
|
|
19
20
|
if (newValue !== undefined) {
|
|
@@ -50,115 +51,35 @@
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
class Canvas {
|
|
54
|
+
container;
|
|
55
|
+
element;
|
|
56
|
+
size;
|
|
57
|
+
_canvasClearPlugins;
|
|
58
|
+
_canvasPaintPlugins;
|
|
59
|
+
_canvasSettings;
|
|
60
|
+
_clearDrawPlugins;
|
|
61
|
+
_colorPlugins;
|
|
62
|
+
_context;
|
|
63
|
+
_drawParticlePlugins;
|
|
64
|
+
_drawParticlesCleanupPlugins;
|
|
65
|
+
_drawParticlesSetupPlugins;
|
|
66
|
+
_drawPlugins;
|
|
67
|
+
_drawSettingsCleanupPlugins;
|
|
68
|
+
_drawSettingsSetupPlugins;
|
|
69
|
+
_engine;
|
|
70
|
+
_generated;
|
|
71
|
+
_mutationObserver;
|
|
72
|
+
_originalStyle;
|
|
73
|
+
_pointerEvents;
|
|
74
|
+
_postDrawUpdaters;
|
|
75
|
+
_preDrawUpdaters;
|
|
76
|
+
_resizePlugins;
|
|
77
|
+
_reusableColorStyles = {};
|
|
78
|
+
_reusablePluginColors = [undefined, undefined];
|
|
79
|
+
_reusableTransform = {};
|
|
80
|
+
_standardSize;
|
|
53
81
|
constructor(container, engine) {
|
|
54
82
|
this.container = container;
|
|
55
|
-
this._applyPostDrawUpdaters = particle => {
|
|
56
|
-
for (const updater of this._postDrawUpdaters) {
|
|
57
|
-
updater.afterDraw?.(particle);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
this._applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
|
|
61
|
-
for (const updater of this._preDrawUpdaters) {
|
|
62
|
-
if (updater.getColorStyles) {
|
|
63
|
-
const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
|
|
64
|
-
if (fill) {
|
|
65
|
-
colorStyles.fill = fill;
|
|
66
|
-
}
|
|
67
|
-
if (stroke) {
|
|
68
|
-
colorStyles.stroke = stroke;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (updater.getTransformValues) {
|
|
72
|
-
const updaterTransform = updater.getTransformValues(particle);
|
|
73
|
-
for (const key in updaterTransform) {
|
|
74
|
-
setTransformValue(transform, updaterTransform, key);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
updater.beforeDraw?.(particle);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
this._applyResizePlugins = () => {
|
|
81
|
-
for (const plugin of this._resizePlugins) {
|
|
82
|
-
plugin.resize?.();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
this._getPluginParticleColors = particle => {
|
|
86
|
-
let fColor, sColor;
|
|
87
|
-
for (const plugin of this._colorPlugins) {
|
|
88
|
-
if (!fColor && plugin.particleFillColor) {
|
|
89
|
-
fColor = (0, ColorUtils_js_1.rangeColorToHsl)(this._engine, plugin.particleFillColor(particle));
|
|
90
|
-
}
|
|
91
|
-
if (!sColor && plugin.particleStrokeColor) {
|
|
92
|
-
sColor = (0, ColorUtils_js_1.rangeColorToHsl)(this._engine, plugin.particleStrokeColor(particle));
|
|
93
|
-
}
|
|
94
|
-
if (fColor && sColor) {
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return [fColor, sColor];
|
|
99
|
-
};
|
|
100
|
-
this._initStyle = () => {
|
|
101
|
-
const element = this.element, options = this.container.actualOptions;
|
|
102
|
-
if (!element) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (this._fullScreen) {
|
|
106
|
-
this._setFullScreenStyle();
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
this._resetOriginalStyle();
|
|
110
|
-
}
|
|
111
|
-
for (const key in options.style) {
|
|
112
|
-
if (!key || !Object.prototype.hasOwnProperty.call(options.style, key)) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
const value = options.style[key];
|
|
116
|
-
if (!value) {
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
element.style.setProperty(key, value, "important");
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
this._repairStyle = () => {
|
|
123
|
-
const element = this.element;
|
|
124
|
-
if (!element) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
this._safeMutationObserver(observer => {
|
|
128
|
-
observer.disconnect();
|
|
129
|
-
});
|
|
130
|
-
this._initStyle();
|
|
131
|
-
this.initBackground();
|
|
132
|
-
const pointerEvents = this._pointerEvents;
|
|
133
|
-
element.style.pointerEvents = pointerEvents;
|
|
134
|
-
element.setAttribute("pointer-events", pointerEvents);
|
|
135
|
-
this._safeMutationObserver(observer => {
|
|
136
|
-
if (!(element instanceof Node)) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
observer.observe(element, { attributes: true });
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
this._resetOriginalStyle = () => {
|
|
143
|
-
const element = this.element, originalStyle = this._originalStyle;
|
|
144
|
-
if (!element || !originalStyle) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
setStyle(element, originalStyle, true);
|
|
148
|
-
};
|
|
149
|
-
this._safeMutationObserver = callback => {
|
|
150
|
-
if (!this._mutationObserver) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
callback(this._mutationObserver);
|
|
154
|
-
};
|
|
155
|
-
this._setFullScreenStyle = () => {
|
|
156
|
-
const element = this.element;
|
|
157
|
-
if (!element) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
setStyle(element, (0, Utils_js_1.getFullScreenStyle)(this.container.actualOptions.fullScreen.zIndex), true);
|
|
161
|
-
};
|
|
162
83
|
this._engine = engine;
|
|
163
84
|
this._standardSize = {
|
|
164
85
|
height: 0,
|
|
@@ -175,8 +96,20 @@
|
|
|
175
96
|
this._postDrawUpdaters = [];
|
|
176
97
|
this._resizePlugins = [];
|
|
177
98
|
this._colorPlugins = [];
|
|
99
|
+
this._canvasClearPlugins = [];
|
|
100
|
+
this._canvasPaintPlugins = [];
|
|
101
|
+
this._clearDrawPlugins = [];
|
|
102
|
+
this._drawParticlePlugins = [];
|
|
103
|
+
this._drawParticlesCleanupPlugins = [];
|
|
104
|
+
this._drawParticlesSetupPlugins = [];
|
|
105
|
+
this._drawPlugins = [];
|
|
106
|
+
this._drawSettingsSetupPlugins = [];
|
|
107
|
+
this._drawSettingsCleanupPlugins = [];
|
|
178
108
|
this._pointerEvents = "none";
|
|
179
109
|
}
|
|
110
|
+
get settings() {
|
|
111
|
+
return this._canvasSettings;
|
|
112
|
+
}
|
|
180
113
|
get _fullScreen() {
|
|
181
114
|
return this.container.actualOptions.fullScreen.enable;
|
|
182
115
|
}
|
|
@@ -190,9 +123,10 @@
|
|
|
190
123
|
}
|
|
191
124
|
clear() {
|
|
192
125
|
let pluginHandled = false;
|
|
193
|
-
for (const plugin of this.
|
|
194
|
-
|
|
195
|
-
|
|
126
|
+
for (const plugin of this._canvasClearPlugins) {
|
|
127
|
+
pluginHandled = plugin.canvasClear?.() ?? false;
|
|
128
|
+
if (pluginHandled) {
|
|
129
|
+
break;
|
|
196
130
|
}
|
|
197
131
|
}
|
|
198
132
|
if (pluginHandled) {
|
|
@@ -200,11 +134,6 @@
|
|
|
200
134
|
}
|
|
201
135
|
this.canvasClear();
|
|
202
136
|
}
|
|
203
|
-
clearDrawPlugin(plugin, delta) {
|
|
204
|
-
this.draw(ctx => {
|
|
205
|
-
(0, CanvasUtils_js_1.clearDrawPlugin)(ctx, plugin, delta);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
137
|
destroy() {
|
|
209
138
|
this.stop();
|
|
210
139
|
if (this._generated) {
|
|
@@ -219,6 +148,15 @@
|
|
|
219
148
|
this._postDrawUpdaters = [];
|
|
220
149
|
this._resizePlugins = [];
|
|
221
150
|
this._colorPlugins = [];
|
|
151
|
+
this._canvasClearPlugins = [];
|
|
152
|
+
this._canvasPaintPlugins = [];
|
|
153
|
+
this._clearDrawPlugins = [];
|
|
154
|
+
this._drawParticlePlugins = [];
|
|
155
|
+
this._drawParticlesCleanupPlugins = [];
|
|
156
|
+
this._drawParticlesSetupPlugins = [];
|
|
157
|
+
this._drawPlugins = [];
|
|
158
|
+
this._drawSettingsSetupPlugins = [];
|
|
159
|
+
this._drawSettingsCleanupPlugins = [];
|
|
222
160
|
}
|
|
223
161
|
draw(cb) {
|
|
224
162
|
const ctx = this._context;
|
|
@@ -242,22 +180,15 @@
|
|
|
242
180
|
if (!fColor && !sColor) {
|
|
243
181
|
return;
|
|
244
182
|
}
|
|
245
|
-
const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - particle.zIndexFactor,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return (0, ColorUtils_js_1.getStyleFromHsl)(fColor, container.hdr, zOpacity);
|
|
250
|
-
}, colorStyles = {
|
|
251
|
-
fill: getFillStyle(),
|
|
252
|
-
}, getStrokestyle = () => {
|
|
253
|
-
if (!sColor) {
|
|
254
|
-
return colorStyles.fill;
|
|
255
|
-
}
|
|
256
|
-
return (0, ColorUtils_js_1.getStyleFromHsl)(sColor, container.hdr, zStrokeOpacity);
|
|
257
|
-
};
|
|
258
|
-
colorStyles.stroke = getStrokestyle();
|
|
183
|
+
const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = Constants_js_1.zIndexFactorOffset - particle.zIndexFactor, { opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? (0, ColorUtils_js_1.getStyleFromHsl)(fColor, container.hdr, opacity) : undefined, stroke = sColor ? (0, ColorUtils_js_1.getStyleFromHsl)(sColor, container.hdr, strokeOpacity) : fill;
|
|
184
|
+
transform.a = transform.b = transform.c = transform.d = undefined;
|
|
185
|
+
colorStyles.fill = fill;
|
|
186
|
+
colorStyles.stroke = stroke;
|
|
259
187
|
this.draw((context) => {
|
|
260
|
-
|
|
188
|
+
for (const plugin of this._drawParticlesSetupPlugins) {
|
|
189
|
+
plugin.drawParticleSetup?.(context, particle, delta);
|
|
190
|
+
}
|
|
191
|
+
this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
|
|
261
192
|
(0, CanvasUtils_js_1.drawParticle)({
|
|
262
193
|
container,
|
|
263
194
|
context,
|
|
@@ -265,34 +196,40 @@
|
|
|
265
196
|
delta,
|
|
266
197
|
colorStyles,
|
|
267
198
|
radius: radius * zIndexFactor ** zIndexOptions.sizeRate,
|
|
268
|
-
opacity:
|
|
199
|
+
opacity: opacity,
|
|
269
200
|
transform,
|
|
270
201
|
});
|
|
202
|
+
this._applyPostDrawUpdaters(particle);
|
|
203
|
+
for (const plugin of this._drawParticlesCleanupPlugins) {
|
|
204
|
+
plugin.drawParticleCleanup?.(context, particle, delta);
|
|
205
|
+
}
|
|
271
206
|
});
|
|
272
|
-
this._applyPostDrawUpdaters(particle);
|
|
273
207
|
}
|
|
274
|
-
|
|
208
|
+
drawParticlePlugins(particle, delta) {
|
|
275
209
|
this.draw(ctx => {
|
|
276
|
-
|
|
210
|
+
for (const plugin of this._drawParticlePlugins) {
|
|
211
|
+
(0, CanvasUtils_js_1.drawParticlePlugin)(ctx, plugin, particle, delta);
|
|
212
|
+
}
|
|
277
213
|
});
|
|
278
214
|
}
|
|
279
215
|
drawParticles(delta) {
|
|
280
|
-
const { particles
|
|
216
|
+
const { particles } = this.container;
|
|
281
217
|
this.clear();
|
|
282
218
|
particles.update(delta);
|
|
283
|
-
for (const plugin of plugins.values()) {
|
|
284
|
-
this.drawPlugin(plugin, delta);
|
|
285
|
-
}
|
|
286
|
-
this.draw(() => {
|
|
287
|
-
particles.drawParticles(delta);
|
|
288
|
-
});
|
|
289
|
-
for (const plugin of plugins.values()) {
|
|
290
|
-
this.clearDrawPlugin(plugin, delta);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
drawPlugin(plugin, delta) {
|
|
294
219
|
this.draw(ctx => {
|
|
295
|
-
|
|
220
|
+
for (const plugin of this._drawSettingsSetupPlugins) {
|
|
221
|
+
plugin.drawSettingsSetup?.(ctx, delta);
|
|
222
|
+
}
|
|
223
|
+
for (const plugin of this._drawPlugins) {
|
|
224
|
+
plugin.draw?.(ctx, delta);
|
|
225
|
+
}
|
|
226
|
+
particles.drawParticles(delta);
|
|
227
|
+
for (const plugin of this._clearDrawPlugins) {
|
|
228
|
+
plugin.clearDraw?.(ctx, delta);
|
|
229
|
+
}
|
|
230
|
+
for (const plugin of this._drawSettingsCleanupPlugins) {
|
|
231
|
+
plugin.drawSettingsCleanup?.(ctx, delta);
|
|
232
|
+
}
|
|
296
233
|
});
|
|
297
234
|
}
|
|
298
235
|
init() {
|
|
@@ -338,13 +275,50 @@
|
|
|
338
275
|
}
|
|
339
276
|
initPlugins() {
|
|
340
277
|
this._resizePlugins = [];
|
|
341
|
-
|
|
278
|
+
this._colorPlugins = [];
|
|
279
|
+
this._canvasClearPlugins = [];
|
|
280
|
+
this._canvasPaintPlugins = [];
|
|
281
|
+
this._clearDrawPlugins = [];
|
|
282
|
+
this._drawParticlePlugins = [];
|
|
283
|
+
this._drawParticlesSetupPlugins = [];
|
|
284
|
+
this._drawParticlesCleanupPlugins = [];
|
|
285
|
+
this._drawPlugins = [];
|
|
286
|
+
this._drawSettingsSetupPlugins = [];
|
|
287
|
+
this._drawSettingsCleanupPlugins = [];
|
|
288
|
+
for (const plugin of this.container.plugins) {
|
|
342
289
|
if (plugin.resize) {
|
|
343
290
|
this._resizePlugins.push(plugin);
|
|
344
291
|
}
|
|
345
292
|
if (plugin.particleFillColor ?? plugin.particleStrokeColor) {
|
|
346
293
|
this._colorPlugins.push(plugin);
|
|
347
294
|
}
|
|
295
|
+
if (plugin.canvasClear) {
|
|
296
|
+
this._canvasClearPlugins.push(plugin);
|
|
297
|
+
}
|
|
298
|
+
if (plugin.canvasPaint) {
|
|
299
|
+
this._canvasPaintPlugins.push(plugin);
|
|
300
|
+
}
|
|
301
|
+
if (plugin.drawParticle) {
|
|
302
|
+
this._drawParticlePlugins.push(plugin);
|
|
303
|
+
}
|
|
304
|
+
if (plugin.drawParticleSetup) {
|
|
305
|
+
this._drawParticlesSetupPlugins.push(plugin);
|
|
306
|
+
}
|
|
307
|
+
if (plugin.drawParticleCleanup) {
|
|
308
|
+
this._drawParticlesCleanupPlugins.push(plugin);
|
|
309
|
+
}
|
|
310
|
+
if (plugin.draw) {
|
|
311
|
+
this._drawPlugins.push(plugin);
|
|
312
|
+
}
|
|
313
|
+
if (plugin.drawSettingsSetup) {
|
|
314
|
+
this._drawSettingsSetupPlugins.push(plugin);
|
|
315
|
+
}
|
|
316
|
+
if (plugin.drawSettingsCleanup) {
|
|
317
|
+
this._drawSettingsCleanupPlugins.push(plugin);
|
|
318
|
+
}
|
|
319
|
+
if (plugin.clearDraw) {
|
|
320
|
+
this._clearDrawPlugins.push(plugin);
|
|
321
|
+
}
|
|
348
322
|
}
|
|
349
323
|
}
|
|
350
324
|
initUpdaters() {
|
|
@@ -376,12 +350,13 @@
|
|
|
376
350
|
canvas.height = retinaSize.height = standardSize.height * pxRatio;
|
|
377
351
|
canvas.width = retinaSize.width = standardSize.width * pxRatio;
|
|
378
352
|
const canSupportHdrQuery = (0, Utils_js_1.safeMatchMedia)("(color-gamut: p3)");
|
|
379
|
-
this.
|
|
353
|
+
this._canvasSettings = {
|
|
380
354
|
alpha: true,
|
|
381
355
|
colorSpace: canSupportHdrQuery?.matches && container.hdr ? "display-p3" : "srgb",
|
|
382
356
|
desynchronized: true,
|
|
383
357
|
willReadFrequently: false,
|
|
384
|
-
}
|
|
358
|
+
};
|
|
359
|
+
this._context = this.element.getContext("2d", this._canvasSettings);
|
|
385
360
|
this._safeMutationObserver(obs => {
|
|
386
361
|
obs.disconnect();
|
|
387
362
|
});
|
|
@@ -396,11 +371,11 @@
|
|
|
396
371
|
}
|
|
397
372
|
paint() {
|
|
398
373
|
let handled = false;
|
|
399
|
-
for (const plugin of this.
|
|
374
|
+
for (const plugin of this._canvasPaintPlugins) {
|
|
375
|
+
handled = plugin.canvasPaint?.() ?? false;
|
|
400
376
|
if (handled) {
|
|
401
377
|
break;
|
|
402
378
|
}
|
|
403
|
-
handled = plugin.canvasPaint?.() ?? false;
|
|
404
379
|
}
|
|
405
380
|
if (handled) {
|
|
406
381
|
return;
|
|
@@ -476,6 +451,115 @@
|
|
|
476
451
|
await container.refresh();
|
|
477
452
|
}
|
|
478
453
|
}
|
|
454
|
+
_applyPostDrawUpdaters = particle => {
|
|
455
|
+
for (const updater of this._postDrawUpdaters) {
|
|
456
|
+
updater.afterDraw?.(particle);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
_applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
|
|
460
|
+
for (const updater of this._preDrawUpdaters) {
|
|
461
|
+
if (updater.getColorStyles) {
|
|
462
|
+
const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
|
|
463
|
+
if (fill) {
|
|
464
|
+
colorStyles.fill = fill;
|
|
465
|
+
}
|
|
466
|
+
if (stroke) {
|
|
467
|
+
colorStyles.stroke = stroke;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (updater.getTransformValues) {
|
|
471
|
+
const updaterTransform = updater.getTransformValues(particle);
|
|
472
|
+
for (const key in updaterTransform) {
|
|
473
|
+
setTransformValue(transform, updaterTransform, key);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
updater.beforeDraw?.(particle);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
_applyResizePlugins = () => {
|
|
480
|
+
for (const plugin of this._resizePlugins) {
|
|
481
|
+
plugin.resize?.();
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
_getPluginParticleColors = particle => {
|
|
485
|
+
let fColor, sColor;
|
|
486
|
+
for (const plugin of this._colorPlugins) {
|
|
487
|
+
if (!fColor && plugin.particleFillColor) {
|
|
488
|
+
fColor = (0, ColorUtils_js_1.rangeColorToHsl)(this._engine, plugin.particleFillColor(particle));
|
|
489
|
+
}
|
|
490
|
+
if (!sColor && plugin.particleStrokeColor) {
|
|
491
|
+
sColor = (0, ColorUtils_js_1.rangeColorToHsl)(this._engine, plugin.particleStrokeColor(particle));
|
|
492
|
+
}
|
|
493
|
+
if (fColor && sColor) {
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
this._reusablePluginColors[fColorIndex] = fColor;
|
|
498
|
+
this._reusablePluginColors[sColorIndex] = sColor;
|
|
499
|
+
return this._reusablePluginColors;
|
|
500
|
+
};
|
|
501
|
+
_initStyle = () => {
|
|
502
|
+
const element = this.element, options = this.container.actualOptions;
|
|
503
|
+
if (!element) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (this._fullScreen) {
|
|
507
|
+
this._setFullScreenStyle();
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
this._resetOriginalStyle();
|
|
511
|
+
}
|
|
512
|
+
for (const key in options.style) {
|
|
513
|
+
if (!key || !Object.hasOwn(options.style, key)) {
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
const value = options.style[key];
|
|
517
|
+
if (!value) {
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
element.style.setProperty(key, value, "important");
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
_repairStyle = () => {
|
|
524
|
+
const element = this.element;
|
|
525
|
+
if (!element) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
this._safeMutationObserver(observer => {
|
|
529
|
+
observer.disconnect();
|
|
530
|
+
});
|
|
531
|
+
this._initStyle();
|
|
532
|
+
this.initBackground();
|
|
533
|
+
const pointerEvents = this._pointerEvents;
|
|
534
|
+
element.style.pointerEvents = pointerEvents;
|
|
535
|
+
element.setAttribute("pointer-events", pointerEvents);
|
|
536
|
+
this._safeMutationObserver(observer => {
|
|
537
|
+
if (!(element instanceof Node)) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
observer.observe(element, { attributes: true });
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
_resetOriginalStyle = () => {
|
|
544
|
+
const element = this.element, originalStyle = this._originalStyle;
|
|
545
|
+
if (!element || !originalStyle) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
setStyle(element, originalStyle, true);
|
|
549
|
+
};
|
|
550
|
+
_safeMutationObserver = callback => {
|
|
551
|
+
if (!this._mutationObserver) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
callback(this._mutationObserver);
|
|
555
|
+
};
|
|
556
|
+
_setFullScreenStyle = () => {
|
|
557
|
+
const element = this.element;
|
|
558
|
+
if (!element) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
setStyle(element, (0, Utils_js_1.getFullScreenStyle)(this.container.actualOptions.fullScreen.zIndex), true);
|
|
562
|
+
};
|
|
479
563
|
}
|
|
480
564
|
exports.Canvas = Canvas;
|
|
481
565
|
});
|