tsparticles 1.35.2 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Core/Canvas.js +4 -6
- package/Core/Container.d.ts +4 -2
- package/Core/Container.js +21 -12
- package/Core/Loader.d.ts +19 -4
- package/Core/Loader.js +80 -18
- package/Enums/Modes/ResponsiveMode.d.ts +4 -0
- package/Enums/Modes/ResponsiveMode.js +8 -0
- package/Enums/Modes/index.d.ts +1 -0
- package/Enums/Modes/index.js +1 -0
- package/Interactions/External/Attract/index.d.ts +1 -1
- package/Interactions/External/Attract/index.js +2 -2
- package/Interactions/External/Bounce/index.d.ts +1 -1
- package/Interactions/External/Bounce/index.js +2 -2
- package/Interactions/External/Bubble/index.d.ts +1 -1
- package/Interactions/External/Bubble/index.js +2 -2
- package/Interactions/External/Connect/index.d.ts +1 -1
- package/Interactions/External/Connect/index.js +2 -2
- package/Interactions/External/Grab/index.d.ts +1 -1
- package/Interactions/External/Grab/index.js +2 -2
- package/Interactions/External/Repulse/index.d.ts +1 -1
- package/Interactions/External/Repulse/index.js +2 -2
- package/Interactions/External/Trail/index.d.ts +1 -1
- package/Interactions/External/Trail/index.js +2 -2
- package/Interactions/Particles/Attract/index.d.ts +1 -1
- package/Interactions/Particles/Attract/index.js +2 -2
- package/Interactions/Particles/Collisions/index.d.ts +1 -1
- package/Interactions/Particles/Collisions/index.js +2 -2
- package/Interactions/Particles/Links/index.d.ts +2 -2
- package/Interactions/Particles/Links/index.js +5 -5
- package/Interactions/Particles/Links/plugin.d.ts +1 -1
- package/Interactions/Particles/Links/plugin.js +2 -2
- package/Options/Classes/FullScreen/FullScreen.js +2 -2
- package/Options/Classes/Interactivity/Interactivity.js +1 -1
- package/Options/Classes/Options.d.ts +1 -1
- package/Options/Classes/Options.js +5 -2
- package/Options/Classes/Responsive.d.ts +2 -0
- package/Options/Classes/Responsive.js +10 -0
- package/Options/Interfaces/IResponsive.d.ts +2 -0
- package/Plugins/Absorbers/plugin.d.ts +1 -1
- package/Plugins/Absorbers/plugin.js +2 -2
- package/Plugins/Emitters/plugin.d.ts +1 -1
- package/Plugins/Emitters/plugin.js +2 -2
- package/Plugins/PolygonMask/plugin.js +1 -1
- package/README.md +1 -1
- package/Shapes/Circle/index.d.ts +1 -1
- package/Shapes/Circle/index.js +2 -2
- package/Shapes/Image/index.d.ts +1 -1
- package/Shapes/Image/index.js +3 -3
- package/Shapes/Line/index.d.ts +1 -1
- package/Shapes/Line/index.js +2 -2
- package/Shapes/Polygon/index.d.ts +3 -3
- package/Shapes/Polygon/index.js +7 -7
- package/Shapes/Square/index.d.ts +1 -1
- package/Shapes/Square/index.js +3 -3
- package/Shapes/Star/index.d.ts +1 -1
- package/Shapes/Star/index.js +2 -2
- package/Shapes/Text/index.d.ts +1 -1
- package/Shapes/Text/index.js +2 -2
- package/Updaters/Angle/index.d.ts +1 -1
- package/Updaters/Angle/index.js +2 -2
- package/Updaters/Color/index.d.ts +1 -1
- package/Updaters/Color/index.js +2 -2
- package/Updaters/Life/index.d.ts +1 -1
- package/Updaters/Life/index.js +2 -2
- package/Updaters/Opacity/index.d.ts +1 -1
- package/Updaters/Opacity/index.js +2 -2
- package/Updaters/OutModes/index.d.ts +1 -1
- package/Updaters/OutModes/index.js +2 -2
- package/Updaters/Roll/index.d.ts +1 -1
- package/Updaters/Roll/index.js +2 -2
- package/Updaters/Size/index.d.ts +1 -1
- package/Updaters/Size/index.js +2 -2
- package/Updaters/StrokeColor/index.d.ts +1 -1
- package/Updaters/StrokeColor/index.js +2 -2
- package/Updaters/Tilt/index.d.ts +1 -1
- package/Updaters/Tilt/index.js +2 -2
- package/Updaters/Wobble/index.d.ts +1 -1
- package/Updaters/Wobble/index.js +2 -2
- package/Utils/Utils.d.ts +1 -2
- package/browser/Core/Canvas.d.ts +29 -0
- package/browser/Core/Canvas.js +26 -6
- package/browser/Core/Container.d.ts +98 -2
- package/browser/Core/Container.js +104 -12
- package/browser/Core/FrameManager.d.ts +8 -0
- package/browser/Core/FrameManager.js +9 -0
- package/browser/Core/InteractionManager.d.ts +3 -0
- package/browser/Core/InteractionManager.js +4 -0
- package/browser/Core/Interfaces/Colors.d.ts +23 -0
- package/browser/Core/Interfaces/IAttract.d.ts +3 -0
- package/browser/Core/Interfaces/IBounds.d.ts +3 -0
- package/browser/Core/Interfaces/IBubble.d.ts +3 -0
- package/browser/Core/Interfaces/IBubbleParticleData.d.ts +3 -0
- package/browser/Core/Interfaces/IContainerInteractivity.d.ts +3 -0
- package/browser/Core/Interfaces/IContainerPlugin.d.ts +3 -0
- package/browser/Core/Interfaces/ICoordinates.d.ts +3 -0
- package/browser/Core/Interfaces/IDelta.d.ts +3 -0
- package/browser/Core/Interfaces/IDimension.d.ts +3 -0
- package/browser/Core/Interfaces/IExternalInteractor.d.ts +3 -0
- package/browser/Core/Interfaces/IInteractor.d.ts +3 -0
- package/browser/Core/Interfaces/IMouseData.d.ts +3 -0
- package/browser/Core/Interfaces/IMovePathGenerator.d.ts +3 -0
- package/browser/Core/Interfaces/IParticle.d.ts +3 -0
- package/browser/Core/Interfaces/IParticleValueAnimation.d.ts +3 -0
- package/browser/Core/Interfaces/IParticlesInteractor.d.ts +3 -0
- package/browser/Core/Interfaces/IPlugin.d.ts +8 -0
- package/browser/Core/Interfaces/IRepulse.d.ts +3 -0
- package/browser/Core/Interfaces/IShapeDrawer.d.ts +3 -0
- package/browser/Core/Interfaces/IShapeValues.d.ts +3 -0
- package/browser/Core/Loader.d.ts +64 -4
- package/browser/Core/Loader.js +131 -18
- package/browser/Core/Particle/Mover.d.ts +3 -0
- package/browser/Core/Particle/Mover.js +7 -2
- package/browser/Core/Particle.d.ts +7 -0
- package/browser/Core/Particle.js +13 -0
- package/browser/Core/Particles.d.ts +13 -0
- package/browser/Core/Particles.js +25 -0
- package/browser/Core/Retina.d.ts +6 -0
- package/browser/Core/Retina.js +9 -0
- package/browser/Enums/Directions/MoveDirection.d.ts +3 -0
- package/browser/Enums/Directions/MoveDirection.js +3 -0
- package/browser/Enums/Directions/RotateDirection.d.ts +3 -0
- package/browser/Enums/Directions/RotateDirection.js +3 -0
- package/browser/Enums/Directions/TiltDirection.d.ts +3 -0
- package/browser/Enums/Directions/TiltDirection.js +3 -0
- package/browser/Enums/InteractivityDetect.d.ts +3 -0
- package/browser/Enums/InteractivityDetect.js +3 -0
- package/browser/Enums/Modes/ClickMode.d.ts +3 -0
- package/browser/Enums/Modes/ClickMode.js +3 -0
- package/browser/Enums/Modes/CollisionMode.d.ts +3 -0
- package/browser/Enums/Modes/CollisionMode.js +3 -0
- package/browser/Enums/Modes/DivMode.d.ts +3 -0
- package/browser/Enums/Modes/DivMode.js +3 -0
- package/browser/Enums/Modes/HoverMode.d.ts +3 -0
- package/browser/Enums/Modes/HoverMode.js +3 -0
- package/browser/Enums/Modes/OutMode.d.ts +3 -0
- package/browser/Enums/Modes/OutMode.js +3 -0
- package/browser/Enums/Modes/ResponsiveMode.d.ts +4 -0
- package/browser/Enums/Modes/ResponsiveMode.js +5 -0
- package/browser/Enums/Modes/SizeMode.d.ts +3 -0
- package/browser/Enums/Modes/SizeMode.js +3 -0
- package/browser/Enums/Modes/index.d.ts +1 -0
- package/browser/Enums/Modes/index.js +1 -0
- package/browser/Enums/Types/DestroyType.d.ts +3 -0
- package/browser/Enums/Types/DestroyType.js +3 -0
- package/browser/Enums/Types/DivType.d.ts +3 -0
- package/browser/Enums/Types/DivType.js +3 -0
- package/browser/Enums/Types/OrbitType.d.ts +3 -0
- package/browser/Enums/Types/OrbitType.js +3 -0
- package/browser/Enums/Types/ShapeType.d.ts +3 -0
- package/browser/Enums/Types/ShapeType.js +3 -0
- package/browser/Enums/Types/StartValueType.d.ts +3 -0
- package/browser/Enums/Types/StartValueType.js +3 -0
- package/browser/Interactions/External/Attract/Attractor.d.ts +4 -0
- package/browser/Interactions/External/Attract/Attractor.js +5 -0
- package/browser/Interactions/External/Attract/index.d.ts +1 -1
- package/browser/Interactions/External/Attract/index.js +2 -2
- package/browser/Interactions/External/Bounce/Bouncer.js +1 -0
- package/browser/Interactions/External/Bounce/index.d.ts +1 -1
- package/browser/Interactions/External/Bounce/index.js +2 -2
- package/browser/Interactions/External/Bubble/Bubbler.d.ts +4 -0
- package/browser/Interactions/External/Bubble/Bubbler.js +14 -0
- package/browser/Interactions/External/Bubble/IBubblerProcessParam.d.ts +6 -0
- package/browser/Interactions/External/Bubble/ProcessBubbleType.d.ts +3 -0
- package/browser/Interactions/External/Bubble/ProcessBubbleType.js +3 -0
- package/browser/Interactions/External/Bubble/index.d.ts +1 -1
- package/browser/Interactions/External/Bubble/index.js +2 -2
- package/browser/Interactions/External/Connect/Connector.d.ts +7 -0
- package/browser/Interactions/External/Connect/Connector.js +8 -0
- package/browser/Interactions/External/Connect/index.d.ts +1 -1
- package/browser/Interactions/External/Connect/index.js +2 -2
- package/browser/Interactions/External/Grab/Grabber.d.ts +4 -0
- package/browser/Interactions/External/Grab/Grabber.js +9 -0
- package/browser/Interactions/External/Grab/index.d.ts +1 -1
- package/browser/Interactions/External/Grab/index.js +2 -2
- package/browser/Interactions/External/Repulse/Repulser.d.ts +4 -0
- package/browser/Interactions/External/Repulse/Repulser.js +162 -0
- package/browser/Interactions/External/Repulse/index.d.ts +1 -1
- package/browser/Interactions/External/Repulse/index.js +2 -2
- package/browser/Interactions/External/Trail/TrailMaker.d.ts +3 -0
- package/browser/Interactions/External/Trail/TrailMaker.js +4 -0
- package/browser/Interactions/External/Trail/index.d.ts +1 -1
- package/browser/Interactions/External/Trail/index.js +2 -2
- package/browser/Interactions/Particles/Attract/Attractor.d.ts +3 -0
- package/browser/Interactions/Particles/Attract/Attractor.js +4 -0
- package/browser/Interactions/Particles/Attract/index.d.ts +1 -1
- package/browser/Interactions/Particles/Attract/index.js +2 -2
- package/browser/Interactions/Particles/Collisions/Collider.d.ts +3 -0
- package/browser/Interactions/Particles/Collisions/Collider.js +4 -0
- package/browser/Interactions/Particles/Collisions/index.d.ts +1 -1
- package/browser/Interactions/Particles/Collisions/index.js +2 -2
- package/browser/Interactions/Particles/Links/ILink.d.ts +6 -0
- package/browser/Interactions/Particles/Links/LinkInstance.js +8 -0
- package/browser/Interactions/Particles/Links/Linker.js +2 -0
- package/browser/Interactions/Particles/Links/index.d.ts +2 -2
- package/browser/Interactions/Particles/Links/index.js +5 -5
- package/browser/Interactions/Particles/Links/plugin.d.ts +1 -1
- package/browser/Interactions/Particles/Links/plugin.js +3 -2
- package/browser/Options/Classes/AnimatableColor.d.ts +4 -0
- package/browser/Options/Classes/AnimatableColor.js +4 -0
- package/browser/Options/Classes/Background/Background.d.ts +4 -0
- package/browser/Options/Classes/Background/Background.js +4 -0
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.d.ts +14 -0
- package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +4 -0
- package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +3 -0
- package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.js +3 -0
- package/browser/Options/Classes/ColorAnimation.d.ts +3 -0
- package/browser/Options/Classes/ColorAnimation.js +3 -0
- package/browser/Options/Classes/FullScreen/FullScreen.d.ts +16 -0
- package/browser/Options/Classes/FullScreen/FullScreen.js +8 -2
- package/browser/Options/Classes/Interactivity/Events/ClickEvent.d.ts +10 -0
- package/browser/Options/Classes/Interactivity/Events/ClickEvent.js +4 -0
- package/browser/Options/Classes/Interactivity/Events/DivEvent.d.ts +37 -0
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +33 -0
- package/browser/Options/Classes/Interactivity/Events/Events.d.ts +31 -0
- package/browser/Options/Classes/Interactivity/Events/Events.js +31 -0
- package/browser/Options/Classes/Interactivity/Events/HoverEvent.d.ts +4 -0
- package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +4 -0
- package/browser/Options/Classes/Interactivity/Events/Parallax.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Events/Parallax.js +3 -0
- package/browser/Options/Classes/Interactivity/Interactivity.d.ts +13 -0
- package/browser/Options/Classes/Interactivity/Interactivity.js +14 -1
- package/browser/Options/Classes/Interactivity/Modes/Attract.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Attract.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Bubble.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Bubble.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/BubbleBase.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/BubbleBase.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/BubbleDiv.d.ts +9 -0
- package/browser/Options/Classes/Interactivity/Modes/BubbleDiv.js +9 -0
- package/browser/Options/Classes/Interactivity/Modes/Connect.d.ts +21 -0
- package/browser/Options/Classes/Interactivity/Modes/Connect.js +21 -0
- package/browser/Options/Classes/Interactivity/Modes/ConnectLinks.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/ConnectLinks.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Grab.d.ts +21 -0
- package/browser/Options/Classes/Interactivity/Modes/Grab.js +21 -0
- package/browser/Options/Classes/Interactivity/Modes/GrabLinks.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/GrabLinks.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Modes.d.ts +4 -0
- package/browser/Options/Classes/Interactivity/Modes/Modes.js +4 -0
- package/browser/Options/Classes/Interactivity/Modes/Push.d.ts +12 -0
- package/browser/Options/Classes/Interactivity/Modes/Push.js +12 -0
- package/browser/Options/Classes/Interactivity/Modes/Remove.d.ts +12 -0
- package/browser/Options/Classes/Interactivity/Modes/Remove.js +12 -0
- package/browser/Options/Classes/Interactivity/Modes/Repulse.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Repulse.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/RepulseBase.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/RepulseBase.js +3 -0
- package/browser/Options/Classes/Interactivity/Modes/RepulseDiv.d.ts +9 -0
- package/browser/Options/Classes/Interactivity/Modes/RepulseDiv.js +11 -0
- package/browser/Options/Classes/Interactivity/Modes/Slow.d.ts +9 -0
- package/browser/Options/Classes/Interactivity/Modes/Slow.js +10 -0
- package/browser/Options/Classes/Interactivity/Modes/Trail.d.ts +3 -0
- package/browser/Options/Classes/Interactivity/Modes/Trail.js +3 -0
- package/browser/Options/Classes/Motion/Motion.d.ts +11 -0
- package/browser/Options/Classes/Motion/Motion.js +4 -0
- package/browser/Options/Classes/Motion/MotionReduce.d.ts +9 -0
- package/browser/Options/Classes/Motion/MotionReduce.js +3 -0
- package/browser/Options/Classes/Options.d.ts +31 -1
- package/browser/Options/Classes/Options.js +36 -3
- package/browser/Options/Classes/OptionsColor.d.ts +4 -0
- package/browser/Options/Classes/OptionsColor.js +4 -0
- package/browser/Options/Classes/Particles/Collisions/Collisions.d.ts +4 -0
- package/browser/Options/Classes/Particles/Collisions/Collisions.js +4 -0
- package/browser/Options/Classes/Particles/Links/Links.d.ts +4 -0
- package/browser/Options/Classes/Particles/Links/Links.js +4 -0
- package/browser/Options/Classes/Particles/Links/LinksShadow.d.ts +3 -0
- package/browser/Options/Classes/Particles/Links/LinksShadow.js +3 -0
- package/browser/Options/Classes/Particles/Links/LinksTriangle.d.ts +3 -0
- package/browser/Options/Classes/Particles/Links/LinksTriangle.js +3 -0
- package/browser/Options/Classes/Particles/Move/Attract.d.ts +21 -0
- package/browser/Options/Classes/Particles/Move/Attract.js +21 -0
- package/browser/Options/Classes/Particles/Move/Move.d.ts +42 -0
- package/browser/Options/Classes/Particles/Move/Move.js +43 -0
- package/browser/Options/Classes/Particles/Move/MoveAngle.d.ts +3 -0
- package/browser/Options/Classes/Particles/Move/MoveAngle.js +4 -1
- package/browser/Options/Classes/Particles/Move/Path/Path.d.ts +3 -0
- package/browser/Options/Classes/Particles/Move/Path/Path.js +3 -0
- package/browser/Options/Classes/Particles/Move/Trail.d.ts +3 -0
- package/browser/Options/Classes/Particles/Move/Trail.js +3 -0
- package/browser/Options/Classes/Particles/Number/Density.d.ts +12 -0
- package/browser/Options/Classes/Particles/Number/Density.js +12 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.d.ts +10 -0
- package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +10 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.d.ts +13 -0
- package/browser/Options/Classes/Particles/Opacity/Opacity.js +13 -0
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +15 -0
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +12 -0
- package/browser/Options/Classes/Particles/Orbit/Orbit.d.ts +4 -0
- package/browser/Options/Classes/Particles/Orbit/Orbit.js +4 -0
- package/browser/Options/Classes/Particles/Orbit/OrbitRotation.d.ts +3 -0
- package/browser/Options/Classes/Particles/Orbit/OrbitRotation.js +3 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.d.ts +22 -0
- package/browser/Options/Classes/Particles/ParticlesOptions.js +22 -0
- package/browser/Options/Classes/Particles/Repulse/Repulse.d.ts +3 -0
- package/browser/Options/Classes/Particles/Repulse/Repulse.js +3 -0
- package/browser/Options/Classes/Particles/Rotate/Rotate.d.ts +4 -0
- package/browser/Options/Classes/Particles/Rotate/Rotate.js +4 -0
- package/browser/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +3 -0
- package/browser/Options/Classes/Particles/Rotate/RotateAnimation.js +3 -0
- package/browser/Options/Classes/Particles/Shadow.d.ts +4 -0
- package/browser/Options/Classes/Particles/Shadow.js +4 -0
- package/browser/Options/Classes/Particles/Shape/Shape.d.ts +42 -0
- package/browser/Options/Classes/Particles/Shape/Shape.js +43 -0
- package/browser/Options/Classes/Particles/Size/Size.d.ts +13 -0
- package/browser/Options/Classes/Particles/Size/Size.js +13 -0
- package/browser/Options/Classes/Particles/Size/SizeAnimation.d.ts +15 -0
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +12 -0
- package/browser/Options/Classes/Particles/Stroke.d.ts +4 -0
- package/browser/Options/Classes/Particles/Stroke.js +4 -0
- package/browser/Options/Classes/Particles/Tilt/Tilt.d.ts +4 -0
- package/browser/Options/Classes/Particles/Tilt/Tilt.js +4 -0
- package/browser/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +3 -0
- package/browser/Options/Classes/Particles/Tilt/TiltAnimation.js +3 -0
- package/browser/Options/Classes/Particles/Twinkle/Twinkle.d.ts +4 -0
- package/browser/Options/Classes/Particles/Twinkle/Twinkle.js +4 -0
- package/browser/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +3 -0
- package/browser/Options/Classes/Particles/Twinkle/TwinkleValues.js +3 -0
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.d.ts +3 -0
- package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
- package/browser/Options/Classes/Responsive.d.ts +2 -0
- package/browser/Options/Classes/Responsive.js +11 -0
- package/browser/Options/Classes/ValueWithRandom.d.ts +3 -0
- package/browser/Options/Interfaces/Background/IBackground.d.ts +35 -0
- package/browser/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +21 -0
- package/browser/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.d.ts +10 -0
- package/browser/Options/Interfaces/FullScreen/IFullScreen.d.ts +16 -0
- package/browser/Options/Interfaces/IAnimatableColor.d.ts +8 -0
- package/browser/Options/Interfaces/IAnimation.d.ts +10 -0
- package/browser/Options/Interfaces/IColorAnimation.d.ts +7 -0
- package/browser/Options/Interfaces/IColorAnimation.js +4 -0
- package/browser/Options/Interfaces/IManualParticle.d.ts +11 -0
- package/browser/Options/Interfaces/IOptionLoader.d.ts +9 -0
- package/browser/Options/Interfaces/IOptions.d.ts +71 -0
- package/browser/Options/Interfaces/IOptionsColor.d.ts +5 -0
- package/browser/Options/Interfaces/IResponsive.d.ts +2 -0
- package/browser/Options/Interfaces/IValueWithRandom.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +12 -0
- package/browser/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +13 -0
- package/browser/Options/Interfaces/Interactivity/Events/IEvents.d.ts +13 -0
- package/browser/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +4 -0
- package/browser/Options/Interfaces/Interactivity/Events/IParallax.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/IInteractivity.d.ts +20 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IAttract.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IBubble.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IBubbleBase.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IBubbleDiv.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IConnect.d.ts +9 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IConnectLinks.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IGrab.d.ts +9 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IGrabLinks.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +6 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IModes.d.ts +4 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IPush.d.ts +6 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IRemove.d.ts +6 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IRepulse.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IRepulseBase.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/IRepulseDiv.d.ts +3 -0
- package/browser/Options/Interfaces/Interactivity/Modes/ISlow.d.ts +6 -0
- package/browser/Options/Interfaces/Interactivity/Modes/ITrail.d.ts +3 -0
- package/browser/Options/Interfaces/Motion/IMotion.d.ts +11 -0
- package/browser/Options/Interfaces/Motion/IMotionReduce.d.ts +9 -0
- package/browser/Options/Interfaces/Particles/Collisions/ICollisions.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/Destroy/IDestroy.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/IParticles.d.ts +10 -0
- package/browser/Options/Interfaces/Particles/IShadow.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/IStroke.d.ts +14 -0
- package/browser/Options/Interfaces/Particles/Links/ILinks.d.ts +43 -0
- package/browser/Options/Interfaces/Particles/Links/ILinksShadow.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Links/ILinksTriangle.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Move/IAttract.d.ts +9 -0
- package/browser/Options/Interfaces/Particles/Move/IMove.d.ts +19 -0
- package/browser/Options/Interfaces/Particles/Move/IMoveAngle.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Move/ITrail.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Move/Path/iPath.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Number/IDensity.d.ts +6 -0
- package/browser/Options/Interfaces/Particles/Number/IParticlesNumber.d.ts +7 -0
- package/browser/Options/Interfaces/Particles/Opacity/IOpacity.d.ts +7 -0
- package/browser/Options/Interfaces/Particles/Opacity/IOpacityAnimation.d.ts +9 -0
- package/browser/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +7 -0
- package/browser/Options/Interfaces/Particles/Repulse/IRepulse.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/Rotate/IRotate.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/Rotate/IRotateAnimation.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Shape/ICharacterShape.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Shape/IImageShape.d.ts +6 -0
- package/browser/Options/Interfaces/Particles/Shape/IPolygonShape.d.ts +6 -0
- package/browser/Options/Interfaces/Particles/Shape/IShape.d.ts +22 -0
- package/browser/Options/Interfaces/Particles/Shape/IStarShape.d.ts +6 -0
- package/browser/Options/Interfaces/Particles/Size/ISize.d.ts +7 -0
- package/browser/Options/Interfaces/Particles/Size/ISizeAnimation.d.ts +9 -0
- package/browser/Options/Interfaces/Particles/Tilt/ITilt.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/Tilt/ITiltAnimation.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/Twinkle/ITwinkle.d.ts +4 -0
- package/browser/Options/Interfaces/Particles/Twinkle/ITwinkleValues.d.ts +3 -0
- package/browser/Options/Interfaces/Particles/ZIndex/IZIndex.d.ts +4 -0
- package/browser/Options/Interfaces/Theme/ITheme.d.ts +14 -0
- package/browser/Options/Interfaces/Theme/IThemeDefault.d.ts +16 -0
- package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +3 -0
- package/browser/Plugins/Absorbers/AbsorberInstance.js +3 -0
- package/browser/Plugins/Absorbers/Absorbers.d.ts +3 -0
- package/browser/Plugins/Absorbers/Absorbers.js +3 -0
- package/browser/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +3 -0
- package/browser/Plugins/Absorbers/Enums/AbsorberClickMode.js +3 -0
- package/browser/Plugins/Absorbers/Options/Classes/Absorber.d.ts +4 -0
- package/browser/Plugins/Absorbers/Options/Classes/Absorber.js +4 -0
- package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +29 -0
- package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberOptions.d.ts +3 -0
- package/browser/Plugins/Absorbers/plugin.d.ts +1 -1
- package/browser/Plugins/Absorbers/plugin.js +5 -2
- package/browser/Plugins/Emitters/EmitterInstance.d.ts +3 -0
- package/browser/Plugins/Emitters/EmitterInstance.js +3 -0
- package/browser/Plugins/Emitters/Emitters.d.ts +3 -0
- package/browser/Plugins/Emitters/Emitters.js +3 -0
- package/browser/Plugins/Emitters/Enums/EmitterClickMode.d.ts +3 -0
- package/browser/Plugins/Emitters/Enums/EmitterClickMode.js +3 -0
- package/browser/Plugins/Emitters/Options/Classes/Emitter.d.ts +4 -0
- package/browser/Plugins/Emitters/Options/Classes/Emitter.js +4 -0
- package/browser/Plugins/Emitters/Options/Classes/EmitterLife.d.ts +3 -0
- package/browser/Plugins/Emitters/Options/Classes/EmitterLife.js +3 -0
- package/browser/Plugins/Emitters/Options/Classes/EmitterRate.d.ts +3 -0
- package/browser/Plugins/Emitters/Options/Classes/EmitterRate.js +3 -0
- package/browser/Plugins/Emitters/Options/Classes/EmitterSize.d.ts +3 -0
- package/browser/Plugins/Emitters/Options/Classes/EmitterSize.js +3 -0
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +44 -0
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitterLife.d.ts +19 -0
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitterOptions.d.ts +3 -0
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitterRate.d.ts +11 -0
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitterSize.d.ts +3 -0
- package/browser/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -0
- package/browser/Plugins/Emitters/plugin.d.ts +1 -1
- package/browser/Plugins/Emitters/plugin.js +5 -2
- package/browser/Plugins/PolygonMask/Options/Classes/Draw.d.ts +15 -0
- package/browser/Plugins/PolygonMask/Options/Classes/Draw.js +15 -0
- package/browser/Plugins/PolygonMask/Options/Classes/DrawStroke.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/DrawStroke.js +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/Inline.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/Inline.js +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/LocalSvg.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/LocalSvg.js +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/Move.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/Move.js +3 -0
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +10 -0
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.js +10 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IDraw.d.ts +9 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/ILocalSvg.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +3 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +7 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskOptions.d.ts +3 -0
- package/browser/Plugins/PolygonMask/PolygonMaskInstance.d.ts +12 -0
- package/browser/Plugins/PolygonMask/PolygonMaskInstance.js +22 -0
- package/browser/Plugins/PolygonMask/pathseg.js +55 -1
- package/browser/Plugins/PolygonMask/plugin.js +8 -2
- package/browser/Plugins/PolygonMask/utils.js +14 -2
- package/browser/Shapes/Circle/CircleDrawer.d.ts +3 -0
- package/browser/Shapes/Circle/CircleDrawer.js +3 -0
- package/browser/Shapes/Circle/index.d.ts +1 -1
- package/browser/Shapes/Circle/index.js +2 -2
- package/browser/Shapes/Image/ImageDrawer.d.ts +3 -0
- package/browser/Shapes/Image/ImageDrawer.js +6 -0
- package/browser/Shapes/Image/Utils.d.ts +3 -0
- package/browser/Shapes/Image/Utils.js +1 -0
- package/browser/Shapes/Image/index.d.ts +1 -1
- package/browser/Shapes/Image/index.js +3 -3
- package/browser/Shapes/Line/LineDrawer.d.ts +3 -0
- package/browser/Shapes/Line/LineDrawer.js +3 -0
- package/browser/Shapes/Line/index.d.ts +1 -1
- package/browser/Shapes/Line/index.js +2 -2
- package/browser/Shapes/Polygon/PolygonDrawer.d.ts +3 -0
- package/browser/Shapes/Polygon/PolygonDrawer.js +3 -0
- package/browser/Shapes/Polygon/PolygonDrawerBase.d.ts +3 -0
- package/browser/Shapes/Polygon/PolygonDrawerBase.js +5 -1
- package/browser/Shapes/Polygon/TriangleDrawer.d.ts +3 -0
- package/browser/Shapes/Polygon/TriangleDrawer.js +3 -0
- package/browser/Shapes/Polygon/index.d.ts +3 -3
- package/browser/Shapes/Polygon/index.js +7 -7
- package/browser/Shapes/Square/SquareDrawer.d.ts +3 -0
- package/browser/Shapes/Square/SquareDrawer.js +3 -0
- package/browser/Shapes/Square/index.d.ts +1 -1
- package/browser/Shapes/Square/index.js +3 -3
- package/browser/Shapes/Star/StarDrawer.d.ts +3 -0
- package/browser/Shapes/Star/StarDrawer.js +3 -0
- package/browser/Shapes/Star/index.d.ts +1 -1
- package/browser/Shapes/Star/index.js +2 -2
- package/browser/Shapes/Text/TextDrawer.d.ts +3 -0
- package/browser/Shapes/Text/TextDrawer.js +3 -0
- package/browser/Shapes/Text/index.d.ts +1 -1
- package/browser/Shapes/Text/index.js +2 -2
- package/browser/Types/ParticlesGroups.d.ts +4 -0
- package/browser/Types/RecursivePartial.d.ts +3 -0
- package/browser/Types/ShapeData.d.ts +3 -0
- package/browser/Types/ShapeDrawerFunctions.d.ts +21 -0
- package/browser/Types/SingleOrMultiple.d.ts +3 -0
- package/browser/Updaters/Angle/index.d.ts +1 -1
- package/browser/Updaters/Angle/index.js +2 -2
- package/browser/Updaters/Color/ColorUpdater.js +1 -0
- package/browser/Updaters/Color/index.d.ts +1 -1
- package/browser/Updaters/Color/index.js +2 -2
- package/browser/Updaters/Life/LifeUpdater.js +1 -0
- package/browser/Updaters/Life/index.d.ts +1 -1
- package/browser/Updaters/Life/index.js +2 -2
- package/browser/Updaters/Opacity/OpacityUpdater.js +1 -0
- package/browser/Updaters/Opacity/index.d.ts +1 -1
- package/browser/Updaters/Opacity/index.js +2 -2
- package/browser/Updaters/OutModes/OutOfCanvasUpdater.js +1 -0
- package/browser/Updaters/OutModes/index.d.ts +1 -1
- package/browser/Updaters/OutModes/index.js +2 -2
- package/browser/Updaters/Roll/index.d.ts +1 -1
- package/browser/Updaters/Roll/index.js +2 -2
- package/browser/Updaters/Size/SizeUpdater.js +1 -0
- package/browser/Updaters/Size/index.d.ts +1 -1
- package/browser/Updaters/Size/index.js +2 -2
- package/browser/Updaters/StrokeColor/StrokeColorUpdater.js +1 -0
- package/browser/Updaters/StrokeColor/index.d.ts +1 -1
- package/browser/Updaters/StrokeColor/index.js +2 -2
- package/browser/Updaters/Tilt/index.d.ts +1 -1
- package/browser/Updaters/Tilt/index.js +2 -2
- package/browser/Updaters/Wobble/index.d.ts +1 -1
- package/browser/Updaters/Wobble/index.js +2 -2
- package/browser/Utils/CanvasUtils.js +4 -0
- package/browser/Utils/Circle.d.ts +3 -0
- package/browser/Utils/Circle.js +3 -0
- package/browser/Utils/CircleWarp.d.ts +3 -0
- package/browser/Utils/CircleWarp.js +3 -0
- package/browser/Utils/ColorUtils.d.ts +20 -0
- package/browser/Utils/ColorUtils.js +33 -1
- package/browser/Utils/Constants.d.ts +7 -0
- package/browser/Utils/Constants.js +7 -0
- package/browser/Utils/EventListeners.d.ts +32 -0
- package/browser/Utils/EventListeners.js +40 -0
- package/browser/Utils/NumberUtils.d.ts +27 -0
- package/browser/Utils/NumberUtils.js +27 -0
- package/browser/Utils/Plugins.d.ts +3 -0
- package/browser/Utils/Plugins.js +3 -0
- package/browser/Utils/Point.d.ts +3 -0
- package/browser/Utils/Point.js +3 -0
- package/browser/Utils/QuadTree.d.ts +3 -0
- package/browser/Utils/QuadTree.js +3 -0
- package/browser/Utils/Range.d.ts +3 -0
- package/browser/Utils/Range.js +3 -0
- package/browser/Utils/Rectangle.d.ts +3 -0
- package/browser/Utils/Rectangle.js +3 -0
- package/browser/Utils/Utils.d.ts +6 -2
- package/browser/Utils/Utils.js +14 -0
- package/browser/full.d.ts +1 -1
- package/browser/full.js +14 -6
- package/browser/index.d.ts +1 -2
- package/browser/index.js +2 -2
- package/browser/index.slim.d.ts +1 -2
- package/browser/index.slim.js +3 -2
- package/browser/main.d.ts +103 -10
- package/browser/main.js +114 -11
- package/browser/pjs.d.ts +27 -0
- package/browser/pjs.js +23 -0
- package/browser/slim.d.ts +1 -1
- package/browser/slim.js +39 -47
- package/esm/Core/Canvas.js +4 -6
- package/esm/Core/Container.d.ts +4 -2
- package/esm/Core/Container.js +21 -12
- package/esm/Core/Loader.d.ts +19 -4
- package/esm/Core/Loader.js +80 -18
- package/esm/Enums/Modes/ResponsiveMode.d.ts +4 -0
- package/esm/Enums/Modes/ResponsiveMode.js +5 -0
- package/esm/Enums/Modes/index.d.ts +1 -0
- package/esm/Enums/Modes/index.js +1 -0
- package/esm/Interactions/External/Attract/index.d.ts +1 -1
- package/esm/Interactions/External/Attract/index.js +2 -2
- package/esm/Interactions/External/Bounce/index.d.ts +1 -1
- package/esm/Interactions/External/Bounce/index.js +2 -2
- package/esm/Interactions/External/Bubble/index.d.ts +1 -1
- package/esm/Interactions/External/Bubble/index.js +2 -2
- package/esm/Interactions/External/Connect/index.d.ts +1 -1
- package/esm/Interactions/External/Connect/index.js +2 -2
- package/esm/Interactions/External/Grab/index.d.ts +1 -1
- package/esm/Interactions/External/Grab/index.js +2 -2
- package/esm/Interactions/External/Repulse/index.d.ts +1 -1
- package/esm/Interactions/External/Repulse/index.js +2 -2
- package/esm/Interactions/External/Trail/index.d.ts +1 -1
- package/esm/Interactions/External/Trail/index.js +2 -2
- package/esm/Interactions/Particles/Attract/index.d.ts +1 -1
- package/esm/Interactions/Particles/Attract/index.js +2 -2
- package/esm/Interactions/Particles/Collisions/index.d.ts +1 -1
- package/esm/Interactions/Particles/Collisions/index.js +2 -2
- package/esm/Interactions/Particles/Links/index.d.ts +2 -2
- package/esm/Interactions/Particles/Links/index.js +5 -5
- package/esm/Interactions/Particles/Links/plugin.d.ts +1 -1
- package/esm/Interactions/Particles/Links/plugin.js +2 -2
- package/esm/Options/Classes/FullScreen/FullScreen.js +2 -2
- package/esm/Options/Classes/Interactivity/Interactivity.js +1 -1
- package/esm/Options/Classes/Options.d.ts +1 -1
- package/esm/Options/Classes/Options.js +6 -3
- package/esm/Options/Classes/Responsive.d.ts +2 -0
- package/esm/Options/Classes/Responsive.js +10 -0
- package/esm/Options/Interfaces/IResponsive.d.ts +2 -0
- package/esm/Plugins/Absorbers/plugin.d.ts +1 -1
- package/esm/Plugins/Absorbers/plugin.js +2 -2
- package/esm/Plugins/Emitters/plugin.d.ts +1 -1
- package/esm/Plugins/Emitters/plugin.js +2 -2
- package/esm/Plugins/PolygonMask/plugin.js +1 -1
- package/esm/Shapes/Circle/index.d.ts +1 -1
- package/esm/Shapes/Circle/index.js +2 -2
- package/esm/Shapes/Image/index.d.ts +1 -1
- package/esm/Shapes/Image/index.js +3 -3
- package/esm/Shapes/Line/index.d.ts +1 -1
- package/esm/Shapes/Line/index.js +2 -2
- package/esm/Shapes/Polygon/index.d.ts +3 -3
- package/esm/Shapes/Polygon/index.js +7 -7
- package/esm/Shapes/Square/index.d.ts +1 -1
- package/esm/Shapes/Square/index.js +3 -3
- package/esm/Shapes/Star/index.d.ts +1 -1
- package/esm/Shapes/Star/index.js +2 -2
- package/esm/Shapes/Text/index.d.ts +1 -1
- package/esm/Shapes/Text/index.js +2 -2
- package/esm/Updaters/Angle/index.d.ts +1 -1
- package/esm/Updaters/Angle/index.js +2 -2
- package/esm/Updaters/Color/index.d.ts +1 -1
- package/esm/Updaters/Color/index.js +2 -2
- package/esm/Updaters/Life/index.d.ts +1 -1
- package/esm/Updaters/Life/index.js +2 -2
- package/esm/Updaters/Opacity/index.d.ts +1 -1
- package/esm/Updaters/Opacity/index.js +2 -2
- package/esm/Updaters/OutModes/index.d.ts +1 -1
- package/esm/Updaters/OutModes/index.js +2 -2
- package/esm/Updaters/Roll/index.d.ts +1 -1
- package/esm/Updaters/Roll/index.js +2 -2
- package/esm/Updaters/Size/index.d.ts +1 -1
- package/esm/Updaters/Size/index.js +2 -2
- package/esm/Updaters/StrokeColor/index.d.ts +1 -1
- package/esm/Updaters/StrokeColor/index.js +2 -2
- package/esm/Updaters/Tilt/index.d.ts +1 -1
- package/esm/Updaters/Tilt/index.js +2 -2
- package/esm/Updaters/Wobble/index.d.ts +1 -1
- package/esm/Updaters/Wobble/index.js +2 -2
- package/esm/Utils/Utils.d.ts +1 -2
- package/esm/full.d.ts +1 -1
- package/esm/full.js +14 -6
- package/esm/index.d.ts +1 -2
- package/esm/index.js +2 -2
- package/esm/index.slim.d.ts +1 -2
- package/esm/index.slim.js +2 -2
- package/esm/main.d.ts +11 -10
- package/esm/main.js +18 -7
- package/esm/slim.d.ts +1 -1
- package/esm/slim.js +39 -47
- package/full.d.ts +1 -1
- package/full.js +14 -6
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/index.slim.d.ts +1 -2
- package/index.slim.js +2 -3
- package/main.d.ts +11 -10
- package/main.js +18 -7
- package/package.json +1 -1
- package/report.html +2 -2
- package/report.slim.html +2 -2
- package/slim.d.ts +1 -1
- package/slim.js +39 -47
- package/tsparticles.js +10262 -13560
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.js +1472 -0
- package/tsparticles.slim.js +8305 -11259
- package/tsparticles.slim.min.js +2 -2
- package/167.js +0 -1779
package/browser/Core/Loader.js
CHANGED
|
@@ -5,10 +5,21 @@ function fetchError(statusCode) {
|
|
|
5
5
|
console.error(`Error tsParticles - fetch status: ${statusCode}`);
|
|
6
6
|
console.error("Error tsParticles - File config not found");
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Main class for creating the [[Container]] objects
|
|
10
|
+
* @category Core
|
|
11
|
+
*/
|
|
8
12
|
export class Loader {
|
|
13
|
+
/**
|
|
14
|
+
* All the [[Container]] objects loaded
|
|
15
|
+
*/
|
|
9
16
|
static dom() {
|
|
10
17
|
return tsParticlesDom;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a [[Container]] from all the objects loaded
|
|
21
|
+
* @param index the object index
|
|
22
|
+
*/
|
|
12
23
|
static domItem(index) {
|
|
13
24
|
const dom = Loader.dom();
|
|
14
25
|
const item = dom[index];
|
|
@@ -17,19 +28,20 @@ export class Loader {
|
|
|
17
28
|
}
|
|
18
29
|
dom.splice(index, 1);
|
|
19
30
|
}
|
|
20
|
-
static async
|
|
21
|
-
|
|
31
|
+
static async loadOptions(params) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 10000)}`;
|
|
34
|
+
const { options, index } = params;
|
|
35
|
+
/* elements */
|
|
36
|
+
let domContainer = (_b = params.element) !== null && _b !== void 0 ? _b : document.getElementById(tagId);
|
|
22
37
|
if (!domContainer) {
|
|
23
38
|
domContainer = document.createElement("div");
|
|
24
39
|
domContainer.id = tagId;
|
|
25
|
-
document.append(domContainer);
|
|
40
|
+
(_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
|
|
26
41
|
}
|
|
27
|
-
return Loader.set(tagId, domContainer, options, index);
|
|
28
|
-
}
|
|
29
|
-
static async set(id, domContainer, options, index) {
|
|
30
42
|
const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
|
|
31
43
|
const dom = Loader.dom();
|
|
32
|
-
const oldIndex = dom.findIndex((v) => v.id ===
|
|
44
|
+
const oldIndex = dom.findIndex((v) => v.id === tagId);
|
|
33
45
|
if (oldIndex >= 0) {
|
|
34
46
|
const old = Loader.domItem(oldIndex);
|
|
35
47
|
if (old && !old.destroyed) {
|
|
@@ -45,6 +57,7 @@ export class Loader {
|
|
|
45
57
|
}
|
|
46
58
|
else {
|
|
47
59
|
const existingCanvases = domContainer.getElementsByTagName("canvas");
|
|
60
|
+
/* get existing canvas if present, otherwise a new one will be created */
|
|
48
61
|
if (existingCanvases.length) {
|
|
49
62
|
canvasEl = existingCanvases[0];
|
|
50
63
|
if (!canvasEl.className) {
|
|
@@ -54,14 +67,18 @@ export class Loader {
|
|
|
54
67
|
}
|
|
55
68
|
else {
|
|
56
69
|
generatedCanvas = true;
|
|
70
|
+
/* create canvas element */
|
|
57
71
|
canvasEl = document.createElement("canvas");
|
|
58
72
|
canvasEl.className = Constants.canvasClass;
|
|
73
|
+
/* set size canvas */
|
|
59
74
|
canvasEl.style.width = "100%";
|
|
60
75
|
canvasEl.style.height = "100%";
|
|
76
|
+
/* append canvas */
|
|
61
77
|
domContainer.appendChild(canvasEl);
|
|
62
78
|
}
|
|
63
79
|
}
|
|
64
|
-
|
|
80
|
+
/* launch tsParticles */
|
|
81
|
+
const newItem = new Container(tagId, currentOptions);
|
|
65
82
|
if (oldIndex >= 0) {
|
|
66
83
|
dom.splice(oldIndex, 0, newItem);
|
|
67
84
|
}
|
|
@@ -72,27 +89,123 @@ export class Loader {
|
|
|
72
89
|
await newItem.start();
|
|
73
90
|
return newItem;
|
|
74
91
|
}
|
|
75
|
-
static async
|
|
92
|
+
static async loadRemoteOptions(params) {
|
|
93
|
+
const { url: jsonUrl, index } = params;
|
|
76
94
|
const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
|
|
95
|
+
if (!url) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
77
98
|
const response = await fetch(url);
|
|
78
|
-
if (response.ok) {
|
|
79
|
-
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
fetchError(response.status);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const data = await response.json();
|
|
104
|
+
return await Loader.loadOptions({
|
|
105
|
+
tagId: params.tagId,
|
|
106
|
+
element: params.element,
|
|
107
|
+
index,
|
|
108
|
+
options: data,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Loads the provided options to create a [[Container]] object.
|
|
113
|
+
* @param tagId the particles container element id
|
|
114
|
+
* @param options the options object to initialize the [[Container]]
|
|
115
|
+
* @param index if an options array is provided, this will retrieve the exact index of that array
|
|
116
|
+
*/
|
|
117
|
+
static load(tagId, options, index) {
|
|
118
|
+
const params = { index };
|
|
119
|
+
if (typeof tagId === "string") {
|
|
120
|
+
params.tagId = tagId;
|
|
80
121
|
}
|
|
81
122
|
else {
|
|
82
|
-
|
|
123
|
+
params.options = tagId;
|
|
124
|
+
}
|
|
125
|
+
if (typeof options === "number") {
|
|
126
|
+
params.index = options !== null && options !== void 0 ? options : params.index;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
params.options = options !== null && options !== void 0 ? options : params.options;
|
|
130
|
+
}
|
|
131
|
+
return this.loadOptions(params);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Loads the provided options to create a [[Container]] object.
|
|
135
|
+
* @param id the particles container element id
|
|
136
|
+
* @param domContainer the dom container
|
|
137
|
+
* @param options the options object to initialize the [[Container]]
|
|
138
|
+
* @param index if an options array is provided, this will retrieve the exact index of that array
|
|
139
|
+
*/
|
|
140
|
+
static async set(id, domContainer, options, index) {
|
|
141
|
+
const params = { index };
|
|
142
|
+
if (typeof id === "string") {
|
|
143
|
+
params.tagId = id;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
params.element = id;
|
|
147
|
+
}
|
|
148
|
+
if (domContainer instanceof HTMLElement) {
|
|
149
|
+
params.element = domContainer;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
params.options = domContainer;
|
|
83
153
|
}
|
|
154
|
+
if (typeof options === "number") {
|
|
155
|
+
params.index = options;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
params.options = options !== null && options !== void 0 ? options : params.options;
|
|
159
|
+
}
|
|
160
|
+
return this.loadOptions(params);
|
|
84
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Loads the provided json with a GET request. The content will be used to create a [[Container]] object.
|
|
164
|
+
* This method is async, so if you need a callback refer to JavaScript function `fetch`
|
|
165
|
+
* @param tagId the particles container element id
|
|
166
|
+
* @param jsonUrl the json path (or paths array) to use in the GET request
|
|
167
|
+
* @param index the index of the paths array, if a single path is passed this value is ignored
|
|
168
|
+
* @returns A Promise with the [[Container]] object created
|
|
169
|
+
*/
|
|
170
|
+
static async loadJSON(tagId, jsonUrl, index) {
|
|
171
|
+
let url, id;
|
|
172
|
+
if (typeof jsonUrl === "number" || jsonUrl === undefined) {
|
|
173
|
+
url = tagId;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
id = tagId;
|
|
177
|
+
url = jsonUrl;
|
|
178
|
+
}
|
|
179
|
+
return await Loader.loadRemoteOptions({ tagId: id, url, index });
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Loads the provided json with a GET request. The content will be used to create a [[Container]] object.
|
|
183
|
+
* This method is async, so if you need a callback refer to JavaScript function `fetch`
|
|
184
|
+
* @param id the particles container element id
|
|
185
|
+
* @param domContainer the container used to contains the particles
|
|
186
|
+
* @param jsonUrl the json path (or paths array) to use in the GET request
|
|
187
|
+
* @param index the index of the paths array, if a single path is passed this value is ignored
|
|
188
|
+
* @returns A Promise with the [[Container]] object created
|
|
189
|
+
*/
|
|
85
190
|
static async setJSON(id, domContainer, jsonUrl, index) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
191
|
+
let url, newId, newIndex, element;
|
|
192
|
+
if (id instanceof HTMLElement) {
|
|
193
|
+
element = id;
|
|
194
|
+
url = domContainer;
|
|
195
|
+
newIndex = jsonUrl;
|
|
91
196
|
}
|
|
92
197
|
else {
|
|
93
|
-
|
|
198
|
+
newId = id;
|
|
199
|
+
element = domContainer;
|
|
200
|
+
url = jsonUrl;
|
|
201
|
+
newIndex = index;
|
|
94
202
|
}
|
|
203
|
+
return await Loader.loadRemoteOptions({ tagId: newId, url, index: newIndex, element });
|
|
95
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Adds an additional click handler to all the loaded [[Container]] objects.
|
|
207
|
+
* @param callback the function called after the click event is fired
|
|
208
|
+
*/
|
|
96
209
|
static setOnClickHandler(callback) {
|
|
97
210
|
const dom = Loader.dom();
|
|
98
211
|
if (dom.length === 0) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Container } from "../Container";
|
|
2
2
|
import type { Particle } from "../Particle";
|
|
3
3
|
import type { IDelta } from "../Interfaces";
|
|
4
|
+
/**
|
|
5
|
+
* @category Core
|
|
6
|
+
*/
|
|
4
7
|
export declare class Mover {
|
|
5
8
|
private readonly container;
|
|
6
9
|
constructor(container: Container);
|
|
@@ -31,6 +31,9 @@ function applyDistance(particle) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @category Core
|
|
36
|
+
*/
|
|
34
37
|
export class Mover {
|
|
35
38
|
constructor(container) {
|
|
36
39
|
this.container = container;
|
|
@@ -40,6 +43,7 @@ export class Mover {
|
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
45
|
this.moveParticle(particle, delta);
|
|
46
|
+
/* parallax */
|
|
43
47
|
this.moveParallax(particle);
|
|
44
48
|
}
|
|
45
49
|
moveParticle(particle, delta) {
|
|
@@ -152,12 +156,13 @@ export class Mover {
|
|
|
152
156
|
};
|
|
153
157
|
const parallaxSmooth = options.interactivity.events.onHover.parallax.smooth;
|
|
154
158
|
const factor = particle.getRadius() / parallaxForce;
|
|
159
|
+
/* smaller is the particle, longer is the offset distance */
|
|
155
160
|
const tmp = {
|
|
156
161
|
x: (mousePos.x - canvasCenter.x) * factor,
|
|
157
162
|
y: (mousePos.y - canvasCenter.y) * factor,
|
|
158
163
|
};
|
|
159
|
-
particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth;
|
|
160
|
-
particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth;
|
|
164
|
+
particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth; // Easing equation
|
|
165
|
+
particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth; // Easing equation
|
|
161
166
|
}
|
|
162
167
|
getProximitySpeedFactor(particle) {
|
|
163
168
|
const container = this.container;
|
|
@@ -9,6 +9,10 @@ import type { IBubbleParticleData, ICoordinates, ICoordinates3d, IDelta, IHsl, I
|
|
|
9
9
|
import { Vector3d } from "./Particle/Vector3d";
|
|
10
10
|
import { IParticleRoll } from "./Interfaces/IParticleRoll";
|
|
11
11
|
import { IParticleWobble } from "./Interfaces/IParticleWobble";
|
|
12
|
+
/**
|
|
13
|
+
* The single particle object
|
|
14
|
+
* @category Core
|
|
15
|
+
*/
|
|
12
16
|
export declare class Particle implements IParticle {
|
|
13
17
|
readonly id: number;
|
|
14
18
|
readonly container: Container;
|
|
@@ -62,6 +66,9 @@ export declare class Particle implements IParticle {
|
|
|
62
66
|
getFillColor(): IHsl | undefined;
|
|
63
67
|
getStrokeColor(): IHsl | undefined;
|
|
64
68
|
destroy(override?: boolean): void;
|
|
69
|
+
/**
|
|
70
|
+
* This method is used when the particle has lost a life and needs some value resets
|
|
71
|
+
*/
|
|
65
72
|
reset(): void;
|
|
66
73
|
private split;
|
|
67
74
|
private calcPosition;
|
package/browser/Core/Particle.js
CHANGED
|
@@ -14,6 +14,10 @@ const fixOutMode = (data) => {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* The single particle object
|
|
19
|
+
* @category Core
|
|
20
|
+
*/
|
|
17
21
|
export class Particle {
|
|
18
22
|
constructor(id, container, position, overrideOptions, group) {
|
|
19
23
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -66,6 +70,7 @@ export class Particle {
|
|
|
66
70
|
this.pathDelay = getValue(this.options.move.path.delay) * 1000;
|
|
67
71
|
const zIndexValue = getRangeValue(this.options.zIndex.value);
|
|
68
72
|
container.retina.initParticle(this);
|
|
73
|
+
/* size */
|
|
69
74
|
const sizeOptions = this.options.size, sizeRange = sizeOptions.value;
|
|
70
75
|
this.size = {
|
|
71
76
|
enable: sizeOptions.animation.enable,
|
|
@@ -104,15 +109,19 @@ export class Particle {
|
|
|
104
109
|
this.bubble = {
|
|
105
110
|
inRange: false,
|
|
106
111
|
};
|
|
112
|
+
/* animation - velocity for speed */
|
|
107
113
|
this.initialVelocity = this.calculateVelocity();
|
|
108
114
|
this.velocity = this.initialVelocity.copy();
|
|
109
115
|
this.moveDecay = 1 - getRangeValue(this.options.move.decay);
|
|
116
|
+
/* position */
|
|
110
117
|
this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
|
|
111
118
|
this.initialPosition = this.position.copy();
|
|
119
|
+
/* parallax */
|
|
112
120
|
this.offset = Vector.origin;
|
|
113
121
|
const particles = container.particles;
|
|
114
122
|
particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
|
|
115
123
|
particles.lastZIndex = this.position.z;
|
|
124
|
+
// Scale z-index factor
|
|
116
125
|
this.zIndexFactor = this.position.z / container.zLayers;
|
|
117
126
|
this.sides = 24;
|
|
118
127
|
let drawer = container.drawers.get(this.shape);
|
|
@@ -235,6 +244,9 @@ export class Particle {
|
|
|
235
244
|
this.split();
|
|
236
245
|
}
|
|
237
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* This method is used when the particle has lost a life and needs some value resets
|
|
249
|
+
*/
|
|
238
250
|
reset() {
|
|
239
251
|
if (this.opacity) {
|
|
240
252
|
this.opacity.loops = 0;
|
|
@@ -262,6 +274,7 @@ export class Particle {
|
|
|
262
274
|
const canvasSize = container.canvas.size;
|
|
263
275
|
const pos = Vector3d.create((_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : Math.random() * canvasSize.width, (_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : Math.random() * canvasSize.height, zIndex);
|
|
264
276
|
const radius = this.getRadius();
|
|
277
|
+
/* check position - into the canvas */
|
|
265
278
|
const outModes = this.options.move.outModes, fixHorizontal = (outMode) => {
|
|
266
279
|
fixOutMode({
|
|
267
280
|
outMode,
|
|
@@ -4,14 +4,24 @@ import { QuadTree } from "../Utils";
|
|
|
4
4
|
import type { RecursivePartial } from "../Types";
|
|
5
5
|
import type { IParticles } from "../Options/Interfaces/Particles/IParticles";
|
|
6
6
|
import type { ICoordinates, IDelta, IMouseData, IParticle, IRgb } from "./Interfaces";
|
|
7
|
+
/**
|
|
8
|
+
* Particles manager object
|
|
9
|
+
* @category Core
|
|
10
|
+
*/
|
|
7
11
|
export declare class Particles {
|
|
8
12
|
private readonly container;
|
|
9
13
|
get count(): number;
|
|
14
|
+
/**
|
|
15
|
+
* The quad tree used to search particles withing ranges
|
|
16
|
+
*/
|
|
10
17
|
quadTree: QuadTree;
|
|
11
18
|
linksColors: Map<string, string | IRgb | undefined>;
|
|
12
19
|
limit: number;
|
|
13
20
|
needsSort: boolean;
|
|
14
21
|
lastZIndex: number;
|
|
22
|
+
/**
|
|
23
|
+
* All the particles used in canvas
|
|
24
|
+
*/
|
|
15
25
|
array: Particle[];
|
|
16
26
|
zArray: Particle[];
|
|
17
27
|
pushing?: boolean;
|
|
@@ -29,6 +39,9 @@ export declare class Particles {
|
|
|
29
39
|
remove(particle: Particle, group?: string, override?: boolean): void;
|
|
30
40
|
update(delta: IDelta): void;
|
|
31
41
|
draw(delta: IDelta): void;
|
|
42
|
+
/**
|
|
43
|
+
* Removes all particles from the array
|
|
44
|
+
*/
|
|
32
45
|
clear(): void;
|
|
33
46
|
push(nb: number, mouse?: IMouseData, overrideOptions?: RecursivePartial<IParticles>, group?: string): void;
|
|
34
47
|
addParticle(position?: ICoordinates, overrideOptions?: RecursivePartial<IParticles>, group?: string): Particle | undefined;
|
|
@@ -3,6 +3,10 @@ import { getRangeValue, Plugins, Point, QuadTree, randomInRange, Rectangle, setR
|
|
|
3
3
|
import { InteractionManager } from "./InteractionManager";
|
|
4
4
|
import { ParticlesOptions } from "../Options/Classes/Particles/ParticlesOptions";
|
|
5
5
|
import { Mover } from "./Particle/Mover";
|
|
6
|
+
/**
|
|
7
|
+
* Particles manager object
|
|
8
|
+
* @category Core
|
|
9
|
+
*/
|
|
6
10
|
export class Particles {
|
|
7
11
|
constructor(container) {
|
|
8
12
|
this.container = container;
|
|
@@ -26,6 +30,7 @@ export class Particles {
|
|
|
26
30
|
get count() {
|
|
27
31
|
return this.array.length;
|
|
28
32
|
}
|
|
33
|
+
/* --------- tsParticles functions - particles ----------- */
|
|
29
34
|
init() {
|
|
30
35
|
var _a;
|
|
31
36
|
const container = this.container;
|
|
@@ -92,6 +97,14 @@ export class Particles {
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
for (const particle of this.array) {
|
|
100
|
+
// let d = ( dx = container.interactivity.mouse.click_pos_x - p.x ) * dx +
|
|
101
|
+
// ( dy = container.interactivity.mouse.click_pos_y - p.y ) * dy;
|
|
102
|
+
// let f = -BANG_SIZE / d;
|
|
103
|
+
// if ( d < BANG_SIZE ) {
|
|
104
|
+
// let t = Math.atan2( dy, dx );
|
|
105
|
+
// p.vx = f * Math.cos(t);
|
|
106
|
+
// p.vy = f * Math.sin(t);
|
|
107
|
+
// }
|
|
95
108
|
const resizeFactor = container.canvas.resizeFactor;
|
|
96
109
|
if (resizeFactor) {
|
|
97
110
|
particle.position.x *= resizeFactor.width;
|
|
@@ -117,6 +130,7 @@ export class Particles {
|
|
|
117
130
|
this.remove(particle);
|
|
118
131
|
}
|
|
119
132
|
this.interactionManager.externalInteract(delta);
|
|
133
|
+
// this loop is required to be done after mouse interactions
|
|
120
134
|
for (const particle of container.particles.array) {
|
|
121
135
|
for (const updater of this.updaters) {
|
|
122
136
|
updater.update(particle, delta);
|
|
@@ -129,26 +143,37 @@ export class Particles {
|
|
|
129
143
|
}
|
|
130
144
|
draw(delta) {
|
|
131
145
|
const container = this.container;
|
|
146
|
+
/* clear canvas */
|
|
132
147
|
container.canvas.clear();
|
|
133
148
|
const canvasSize = this.container.canvas.size;
|
|
134
149
|
this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, (canvasSize.width * 3) / 2, (canvasSize.height * 3) / 2), 4);
|
|
150
|
+
/* update each particles param */
|
|
135
151
|
this.update(delta);
|
|
136
152
|
if (this.needsSort) {
|
|
137
153
|
this.zArray.sort((a, b) => b.position.z - a.position.z || a.id - b.id);
|
|
138
154
|
this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
|
|
139
155
|
this.needsSort = false;
|
|
140
156
|
}
|
|
157
|
+
/* draw polygon shape in debug mode */
|
|
141
158
|
for (const [, plugin] of container.plugins) {
|
|
142
159
|
container.canvas.drawPlugin(plugin, delta);
|
|
143
160
|
}
|
|
161
|
+
/*if (container.canvas.context) {
|
|
162
|
+
this.quadTree.draw(container.canvas.context);
|
|
163
|
+
}*/
|
|
164
|
+
/* draw each particle */
|
|
144
165
|
for (const p of this.zArray) {
|
|
145
166
|
p.draw(delta);
|
|
146
167
|
}
|
|
147
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Removes all particles from the array
|
|
171
|
+
*/
|
|
148
172
|
clear() {
|
|
149
173
|
this.array = [];
|
|
150
174
|
this.zArray = [];
|
|
151
175
|
}
|
|
176
|
+
/* ---------- tsParticles functions - modes events ------------ */
|
|
152
177
|
push(nb, mouse, overrideOptions, group) {
|
|
153
178
|
this.pushing = true;
|
|
154
179
|
for (let i = 0; i < nb; i++) {
|
package/browser/Core/Retina.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Container } from "./Container";
|
|
2
2
|
import type { Particle } from "./Particle";
|
|
3
|
+
/**
|
|
4
|
+
* @category Core
|
|
5
|
+
*/
|
|
3
6
|
export declare class Retina {
|
|
4
7
|
private readonly container;
|
|
5
8
|
reduceFactor: number;
|
|
@@ -20,6 +23,9 @@ export declare class Retina {
|
|
|
20
23
|
maxSpeed: number;
|
|
21
24
|
orbitRadius?: number;
|
|
22
25
|
constructor(container: Container);
|
|
26
|
+
/**
|
|
27
|
+
* Initializes all the values needing a pixel ratio factor (sizes, widths, distances)
|
|
28
|
+
*/
|
|
23
29
|
init(): void;
|
|
24
30
|
initParticle(particle: Particle): void;
|
|
25
31
|
private handleMotionChange;
|
package/browser/Core/Retina.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { getRangeValue, isSsr } from "../Utils";
|
|
2
|
+
/**
|
|
3
|
+
* @category Core
|
|
4
|
+
*/
|
|
2
5
|
export class Retina {
|
|
3
6
|
constructor(container) {
|
|
4
7
|
this.container = container;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Initializes all the values needing a pixel ratio factor (sizes, widths, distances)
|
|
11
|
+
*/
|
|
6
12
|
init() {
|
|
7
13
|
const container = this.container;
|
|
8
14
|
const options = container.actualOptions;
|
|
@@ -15,10 +21,13 @@ export class Retina {
|
|
|
15
21
|
else {
|
|
16
22
|
const mediaQuery = matchMedia("(prefers-reduced-motion: reduce)");
|
|
17
23
|
if (mediaQuery) {
|
|
24
|
+
// Check if the media query matches or is not available.
|
|
18
25
|
this.handleMotionChange(mediaQuery);
|
|
26
|
+
// Ads an event listener to check for changes in the media query's value.
|
|
19
27
|
const handleChange = () => {
|
|
20
28
|
this.handleMotionChange(mediaQuery);
|
|
21
29
|
container.refresh().catch(() => {
|
|
30
|
+
// ignore
|
|
22
31
|
});
|
|
23
32
|
};
|
|
24
33
|
if (mediaQuery.addEventListener !== undefined) {
|