tsparticles 1.35.4 → 1.37.2
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 +5 -2
- package/Core/Container.js +23 -12
- package/Core/InteractionManager.d.ts +1 -0
- package/Core/InteractionManager.js +4 -1
- package/Core/Particles.d.ts +1 -1
- package/Core/Particles.js +3 -1
- 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/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/Plugins.d.ts +2 -2
- package/Utils/Plugins.js +4 -4
- 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 +99 -2
- package/browser/Core/Container.js +106 -12
- package/browser/Core/FrameManager.d.ts +8 -0
- package/browser/Core/FrameManager.js +9 -0
- package/browser/Core/InteractionManager.d.ts +4 -0
- package/browser/Core/InteractionManager.js +8 -1
- 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 +45 -0
- package/browser/Core/Loader.js +51 -0
- 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 +14 -1
- package/browser/Core/Particles.js +28 -1
- 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 +10 -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 +5 -2
- package/browser/Utils/Plugins.js +7 -4
- 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 +99 -6
- 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 +5 -2
- package/esm/Core/Container.js +23 -12
- package/esm/Core/InteractionManager.d.ts +1 -0
- package/esm/Core/InteractionManager.js +4 -1
- package/esm/Core/Particles.d.ts +1 -1
- package/esm/Core/Particles.js +3 -1
- 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/Plugins.d.ts +2 -2
- package/esm/Utils/Plugins.js +4 -4
- 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 +7 -6
- 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 +7 -6
- 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 +10586 -13650
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.js +1472 -0
- package/tsparticles.slim.js +8521 -11340
- package/tsparticles.slim.min.js +2 -2
- package/167.js +0 -1779
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Shape Drawers
|
|
3
|
+
*/
|
|
1
4
|
export class PolygonDrawerBase {
|
|
2
5
|
getSidesCount(particle) {
|
|
3
6
|
var _a, _b;
|
|
@@ -7,10 +10,11 @@ export class PolygonDrawerBase {
|
|
|
7
10
|
draw(context, particle, radius) {
|
|
8
11
|
const start = this.getCenter(particle, radius);
|
|
9
12
|
const side = this.getSidesData(particle, radius);
|
|
13
|
+
// By Programming Thomas - https://programmingthomas.wordpress.com/2013/04/03/n-sided-shapes/
|
|
10
14
|
const sideCount = side.count.numerator * side.count.denominator;
|
|
11
15
|
const decimalSides = side.count.numerator / side.count.denominator;
|
|
12
16
|
const interiorAngleDegrees = (180 * (decimalSides - 2)) / decimalSides;
|
|
13
|
-
const interiorAngle = Math.PI - (Math.PI * interiorAngleDegrees) / 180;
|
|
17
|
+
const interiorAngle = Math.PI - (Math.PI * interiorAngleDegrees) / 180; // convert to radians
|
|
14
18
|
if (!context) {
|
|
15
19
|
return;
|
|
16
20
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ISide } from "./PolygonDrawerBase";
|
|
2
2
|
import type { ICoordinates, IParticle } from "../../Core/Interfaces";
|
|
3
3
|
import { PolygonDrawerBase } from "./PolygonDrawerBase";
|
|
4
|
+
/**
|
|
5
|
+
* @category Shape Drawers
|
|
6
|
+
*/
|
|
4
7
|
export declare class TriangleDrawer extends PolygonDrawerBase {
|
|
5
8
|
getSidesCount(): number;
|
|
6
9
|
getSidesData(particle: IParticle, radius: number): ISide;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadGenericPolygonShape(tsParticles: Main): void
|
|
3
|
-
export declare function loadTriangleShape(tsParticles: Main): void
|
|
4
|
-
export declare function loadPolygonShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadGenericPolygonShape(tsParticles: Main): Promise<void>;
|
|
3
|
+
export declare function loadTriangleShape(tsParticles: Main): Promise<void>;
|
|
4
|
+
export declare function loadPolygonShape(tsParticles: Main): Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PolygonDrawer } from "./PolygonDrawer";
|
|
2
2
|
import { TriangleDrawer } from "./TriangleDrawer";
|
|
3
|
-
export function loadGenericPolygonShape(tsParticles) {
|
|
4
|
-
tsParticles.addShape("polygon", new PolygonDrawer());
|
|
3
|
+
export async function loadGenericPolygonShape(tsParticles) {
|
|
4
|
+
await tsParticles.addShape("polygon", new PolygonDrawer());
|
|
5
5
|
}
|
|
6
|
-
export function loadTriangleShape(tsParticles) {
|
|
7
|
-
tsParticles.addShape("triangle", new TriangleDrawer());
|
|
6
|
+
export async function loadTriangleShape(tsParticles) {
|
|
7
|
+
await tsParticles.addShape("triangle", new TriangleDrawer());
|
|
8
8
|
}
|
|
9
|
-
export function loadPolygonShape(tsParticles) {
|
|
10
|
-
loadGenericPolygonShape(tsParticles);
|
|
11
|
-
loadTriangleShape(tsParticles);
|
|
9
|
+
export async function loadPolygonShape(tsParticles) {
|
|
10
|
+
await loadGenericPolygonShape(tsParticles);
|
|
11
|
+
await loadTriangleShape(tsParticles);
|
|
12
12
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { IParticle, IShapeDrawer } from "../../Core/Interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* @category Shape Drawers
|
|
4
|
+
*/
|
|
2
5
|
export declare class SquareDrawer implements IShapeDrawer {
|
|
3
6
|
getSidesCount(): number;
|
|
4
7
|
draw(context: CanvasRenderingContext2D, particle: IParticle, radius: number): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadSquareShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadSquareShape(tsParticles: Main): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SquareDrawer } from "./SquareDrawer";
|
|
2
|
-
export function loadSquareShape(tsParticles) {
|
|
2
|
+
export async function loadSquareShape(tsParticles) {
|
|
3
3
|
const drawer = new SquareDrawer();
|
|
4
|
-
tsParticles.addShape("edge", drawer);
|
|
5
|
-
tsParticles.addShape("square", drawer);
|
|
4
|
+
await tsParticles.addShape("edge", drawer);
|
|
5
|
+
await tsParticles.addShape("square", drawer);
|
|
6
6
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { IParticle, IShapeDrawer } from "../../Core/Interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* @category Shape Drawers
|
|
4
|
+
*/
|
|
2
5
|
export declare class StarDrawer implements IShapeDrawer {
|
|
3
6
|
getSidesCount(particle: IParticle): number;
|
|
4
7
|
draw(context: CanvasRenderingContext2D, particle: IParticle, radius: number): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadStarShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadStarShape(tsParticles: Main): Promise<void>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { IParticle, IShapeDrawer } from "../../Core/Interfaces";
|
|
2
2
|
import type { Container } from "../../Core/Container";
|
|
3
3
|
export declare const validTypes: string[];
|
|
4
|
+
/**
|
|
5
|
+
* @category Shape Drawers
|
|
6
|
+
*/
|
|
4
7
|
export declare class TextDrawer implements IShapeDrawer {
|
|
5
8
|
getSidesCount(): number;
|
|
6
9
|
init(container: Container): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadTextShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadTextShape(tsParticles: Main): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { validTypes, TextDrawer } from "./TextDrawer";
|
|
2
|
-
export function loadTextShape(tsParticles) {
|
|
2
|
+
export async function loadTextShape(tsParticles) {
|
|
3
3
|
const drawer = new TextDrawer();
|
|
4
4
|
for (const type of validTypes) {
|
|
5
|
-
tsParticles.addShape(type, drawer);
|
|
5
|
+
await tsParticles.addShape(type, drawer);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { SingleOrMultiple } from "./SingleOrMultiple";
|
|
2
2
|
import type { IShapeValues } from "../Options/Interfaces/Particles/Shape/IShapeValues";
|
|
3
|
+
/**
|
|
4
|
+
* @category Types
|
|
5
|
+
*/
|
|
3
6
|
export declare type ShapeData = {
|
|
4
7
|
[type: string]: SingleOrMultiple<IShapeValues>;
|
|
5
8
|
};
|
|
@@ -2,10 +2,31 @@ import type { IParticle } from "../Core/Interfaces/IParticle";
|
|
|
2
2
|
import type { Container } from "../Core/Container";
|
|
3
3
|
import type { IDelta } from "../Core/Interfaces/IDelta";
|
|
4
4
|
import { Particle } from "../Core/Particle";
|
|
5
|
+
/**
|
|
6
|
+
* @category Types
|
|
7
|
+
*/
|
|
5
8
|
export declare type ShapeDrawerDrawFunction = (context: CanvasRenderingContext2D, particle: IParticle, radius: number, opacity: number, delta: IDelta, pixelRatio: number) => void;
|
|
9
|
+
/**
|
|
10
|
+
* @category Types
|
|
11
|
+
*/
|
|
6
12
|
export declare type ShapeDrawerInitFunction = (container: Container) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* @category Types
|
|
15
|
+
*/
|
|
7
16
|
export declare type ShapeDrawerParticleInitFunction = (container: Container, particle: IParticle) => void;
|
|
17
|
+
/**
|
|
18
|
+
* @category Types
|
|
19
|
+
*/
|
|
8
20
|
export declare type ShapeDrawerAfterEffectFunction = (context: CanvasRenderingContext2D, particle: IParticle, radius: number, opacity: number, delta: IDelta, pixelRatio: number) => void;
|
|
21
|
+
/**
|
|
22
|
+
* @category Types
|
|
23
|
+
*/
|
|
9
24
|
export declare type ShapeDrawerDestroyFunction = (container: Container) => void;
|
|
25
|
+
/**
|
|
26
|
+
* @category Types
|
|
27
|
+
*/
|
|
10
28
|
export declare type ShapeDrawerSidesCountFunction = (particle: IParticle) => number;
|
|
29
|
+
/**
|
|
30
|
+
* @category Types
|
|
31
|
+
*/
|
|
11
32
|
export declare type ShapeDrawerLoadFunction = (particle: Particle) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadAngleUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadAngleUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AngleUpdater } from "./AngleUpdater";
|
|
2
|
-
export function loadAngleUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("angle", (container) => new AngleUpdater(container));
|
|
2
|
+
export async function loadAngleUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("angle", (container) => new AngleUpdater(container));
|
|
4
4
|
}
|
|
@@ -44,6 +44,7 @@ export class ColorUpdater {
|
|
|
44
44
|
this.container = container;
|
|
45
45
|
}
|
|
46
46
|
init(particle) {
|
|
47
|
+
/* color */
|
|
47
48
|
const hslColor = colorToHsl(particle.options.color, particle.id, particle.options.reduceDuplicates);
|
|
48
49
|
if (hslColor) {
|
|
49
50
|
particle.color = getHslAnimationFromHsl(hslColor, particle.options.color.animation, this.container.retina.reduceFactor);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadColorUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadColorUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ColorUpdater } from "./ColorUpdater";
|
|
2
|
-
export function loadColorUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("color", (container) => new ColorUpdater(container));
|
|
2
|
+
export async function loadColorUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("color", (container) => new ColorUpdater(container));
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadLifeUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadLifeUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LifeUpdater } from "./LifeUpdater";
|
|
2
|
-
export function loadLifeUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("life", (container) => new LifeUpdater(container));
|
|
2
|
+
export async function loadLifeUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("life", (container) => new LifeUpdater(container));
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadOpacityUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { OpacityUpdater } from "./OpacityUpdater";
|
|
2
|
-
export function loadOpacityUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater(container));
|
|
2
|
+
export async function loadOpacityUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater(container));
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadOutModesUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater";
|
|
2
|
-
export function loadOutModesUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container));
|
|
2
|
+
export async function loadOutModesUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container));
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadRollUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadRollUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RollUpdater } from "./RollUpdater";
|
|
2
|
-
export function loadRollUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("roll", () => new RollUpdater());
|
|
2
|
+
export async function loadRollUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("roll", () => new RollUpdater());
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadSizeUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadSizeUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SizeUpdater } from "./SizeUpdater";
|
|
2
|
-
export function loadSizeUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("size", () => new SizeUpdater());
|
|
2
|
+
export async function loadSizeUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("size", () => new SizeUpdater());
|
|
4
4
|
}
|
|
@@ -52,6 +52,7 @@ export class StrokeColorUpdater {
|
|
|
52
52
|
init(particle) {
|
|
53
53
|
var _a, _b;
|
|
54
54
|
const container = this.container;
|
|
55
|
+
/* strokeColor */
|
|
55
56
|
particle.stroke =
|
|
56
57
|
particle.options.stroke instanceof Array
|
|
57
58
|
? itemFromArray(particle.options.stroke, particle.id, particle.options.reduceDuplicates)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadStrokeColorUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadStrokeColorUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { StrokeColorUpdater } from "./StrokeColorUpdater";
|
|
2
|
-
export function loadStrokeColorUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater(container));
|
|
2
|
+
export async function loadStrokeColorUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater(container));
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadTiltUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadTiltUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TiltUpdater } from "./TiltUpdater";
|
|
2
|
-
export function loadTiltUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("tilt", (container) => new TiltUpdater(container));
|
|
2
|
+
export async function loadTiltUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("tilt", (container) => new TiltUpdater(container));
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadWobbleUpdater(tsParticles: Main): void
|
|
2
|
+
export declare function loadWobbleUpdater(tsParticles: Main): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { WobbleUpdater } from "./WobbleUpdater";
|
|
2
|
-
export function loadWobbleUpdater(tsParticles) {
|
|
3
|
-
tsParticles.addParticleUpdater("wobble", (container) => new WobbleUpdater(container));
|
|
2
|
+
export async function loadWobbleUpdater(tsParticles) {
|
|
3
|
+
await tsParticles.addParticleUpdater("wobble", (container) => new WobbleUpdater(container));
|
|
4
4
|
}
|
|
@@ -24,6 +24,8 @@ export function clear(context, dimension) {
|
|
|
24
24
|
context.clearRect(0, 0, dimension.width, dimension.height);
|
|
25
25
|
}
|
|
26
26
|
export function drawLinkLine(context, width, begin, end, maxDistance, canvasSize, warp, backgroundMask, composite, colorLine, opacity, shadow) {
|
|
27
|
+
// this.ctx.lineCap = "round"; /* performance issue */
|
|
28
|
+
/* path */
|
|
27
29
|
let drawn = false;
|
|
28
30
|
if (getDistance(begin, end) <= maxDistance) {
|
|
29
31
|
drawLine(context, begin, end);
|
|
@@ -92,6 +94,8 @@ export function drawLinkLine(context, width, begin, end, maxDistance, canvasSize
|
|
|
92
94
|
context.stroke();
|
|
93
95
|
}
|
|
94
96
|
export function drawLinkTriangle(context, pos1, pos2, pos3, backgroundMask, composite, colorTriangle, opacityTriangle) {
|
|
97
|
+
// this.ctx.lineCap = "round"; /* performance issue */
|
|
98
|
+
/* path */
|
|
95
99
|
drawTriangle(context, pos1, pos2, pos3);
|
|
96
100
|
if (backgroundMask) {
|
|
97
101
|
context.globalCompositeOperation = composite;
|
package/browser/Utils/Circle.js
CHANGED
|
@@ -2,6 +2,9 @@ import { Range } from "./Range";
|
|
|
2
2
|
import type { ICoordinates } from "../Core/Interfaces/ICoordinates";
|
|
3
3
|
import { Circle } from "./Circle";
|
|
4
4
|
import type { IDimension } from "../Core/Interfaces/IDimension";
|
|
5
|
+
/**
|
|
6
|
+
* @category Utils
|
|
7
|
+
*/
|
|
5
8
|
export declare class CircleWarp extends Circle {
|
|
6
9
|
private readonly canvasSize;
|
|
7
10
|
constructor(x: number, y: number, radius: number, canvasSize: IDimension);
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { IColor, IHsl, IHsla, IHsv, IHsva, IParticle, IParticleHslAnimation, IRgb, IRgba } from "../Core/Interfaces";
|
|
2
2
|
import type { HslAnimation } from "../Options/Classes/HslAnimation";
|
|
3
|
+
/**
|
|
4
|
+
* Gets the particles color
|
|
5
|
+
* @param input the input color to convert in [[IRgb]] object
|
|
6
|
+
* @param index the array index, if needed
|
|
7
|
+
* @param useIndex set to false to ignore the index parameter
|
|
8
|
+
*/
|
|
3
9
|
export declare function colorToRgb(input?: string | IColor, index?: number, useIndex?: boolean): IRgb | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the particles color
|
|
12
|
+
* @param color the input color to convert in [[IHsl]] object
|
|
13
|
+
* @param index the array index, if needed
|
|
14
|
+
* @param useIndex set to false to ignore the index parameter
|
|
15
|
+
*/
|
|
4
16
|
export declare function colorToHsl(color: string | IColor | undefined, index?: number, useIndex?: boolean): IHsl | undefined;
|
|
5
17
|
export declare function rgbToHsl(color: IRgb): IHsl;
|
|
6
18
|
export declare function stringToAlpha(input: string): number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Converts hexadecimal string (HTML color code) in a [[IRgb]] object
|
|
21
|
+
* @param input the hexadecimal string (#f70 or #ff7700)
|
|
22
|
+
*/
|
|
7
23
|
export declare function stringToRgb(input: string): IRgb | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a Hue Saturation Lightness ([[IHsl]]) object in a [[IRgb]] object
|
|
26
|
+
* @param hsl
|
|
27
|
+
*/
|
|
8
28
|
export declare function hslToRgb(hsl: IHsl): IRgb;
|
|
9
29
|
export declare function hslaToRgba(hsla: IHsla): IRgba;
|
|
10
30
|
export declare function hslToHsv(hsl: IHsl): IHsv;
|
|
@@ -2,6 +2,12 @@ import { itemFromArray } from "./Utils";
|
|
|
2
2
|
import { Constants } from "./Constants";
|
|
3
3
|
import { mix, randomInRange, setRangeValue } from "./NumberUtils";
|
|
4
4
|
import { AnimationStatus } from "../Enums";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param p
|
|
8
|
+
* @param q
|
|
9
|
+
* @param t
|
|
10
|
+
*/
|
|
5
11
|
function hue2rgb(p, q, t) {
|
|
6
12
|
let tCalc = t;
|
|
7
13
|
if (tCalc < 0) {
|
|
@@ -59,6 +65,8 @@ function stringToRgba(input) {
|
|
|
59
65
|
: undefined;
|
|
60
66
|
}
|
|
61
67
|
else {
|
|
68
|
+
// By Tim Down - http://stackoverflow.com/a/5624139/3493650
|
|
69
|
+
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
62
70
|
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
63
71
|
const hexFixed = input.replace(shorthandRegex, (_m, r, g, b, a) => {
|
|
64
72
|
return r + r + g + g + b + b + (a !== undefined ? a + a : "");
|
|
@@ -75,6 +83,12 @@ function stringToRgba(input) {
|
|
|
75
83
|
: undefined;
|
|
76
84
|
}
|
|
77
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Gets the particles color
|
|
88
|
+
* @param input the input color to convert in [[IRgb]] object
|
|
89
|
+
* @param index the array index, if needed
|
|
90
|
+
* @param useIndex set to false to ignore the index parameter
|
|
91
|
+
*/
|
|
78
92
|
export function colorToRgb(input, index, useIndex = true) {
|
|
79
93
|
var _a, _b, _c;
|
|
80
94
|
if (input === undefined) {
|
|
@@ -117,6 +131,12 @@ export function colorToRgb(input, index, useIndex = true) {
|
|
|
117
131
|
}
|
|
118
132
|
return res;
|
|
119
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Gets the particles color
|
|
136
|
+
* @param color the input color to convert in [[IHsl]] object
|
|
137
|
+
* @param index the array index, if needed
|
|
138
|
+
* @param useIndex set to false to ignore the index parameter
|
|
139
|
+
*/
|
|
120
140
|
export function colorToHsl(color, index, useIndex = true) {
|
|
121
141
|
const rgb = colorToRgb(color, index, useIndex);
|
|
122
142
|
return rgb !== undefined ? rgbToHsl(rgb) : undefined;
|
|
@@ -127,13 +147,16 @@ export function rgbToHsl(color) {
|
|
|
127
147
|
const b1 = color.b / 255;
|
|
128
148
|
const max = Math.max(r1, g1, b1);
|
|
129
149
|
const min = Math.min(r1, g1, b1);
|
|
150
|
+
//Calculate L:
|
|
130
151
|
const res = {
|
|
131
152
|
h: 0,
|
|
132
153
|
l: (max + min) / 2,
|
|
133
154
|
s: 0,
|
|
134
155
|
};
|
|
135
156
|
if (max != min) {
|
|
157
|
+
//Calculate S:
|
|
136
158
|
res.s = res.l < 0.5 ? (max - min) / (max + min) : (max - min) / (2.0 - max - min);
|
|
159
|
+
//Calculate H:
|
|
137
160
|
res.h =
|
|
138
161
|
r1 === max
|
|
139
162
|
? (g1 - b1) / (max - min)
|
|
@@ -151,9 +174,17 @@ export function stringToAlpha(input) {
|
|
|
151
174
|
var _a;
|
|
152
175
|
return (_a = stringToRgba(input)) === null || _a === void 0 ? void 0 : _a.a;
|
|
153
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Converts hexadecimal string (HTML color code) in a [[IRgb]] object
|
|
179
|
+
* @param input the hexadecimal string (#f70 or #ff7700)
|
|
180
|
+
*/
|
|
154
181
|
export function stringToRgb(input) {
|
|
155
182
|
return stringToRgba(input);
|
|
156
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Converts a Hue Saturation Lightness ([[IHsl]]) object in a [[IRgb]] object
|
|
186
|
+
* @param hsl
|
|
187
|
+
*/
|
|
157
188
|
export function hslToRgb(hsl) {
|
|
158
189
|
const result = { b: 0, g: 0, r: 0 };
|
|
159
190
|
const hslPercent = {
|
|
@@ -162,7 +193,7 @@ export function hslToRgb(hsl) {
|
|
|
162
193
|
s: hsl.s / 100,
|
|
163
194
|
};
|
|
164
195
|
if (hslPercent.s === 0) {
|
|
165
|
-
result.b = hslPercent.l;
|
|
196
|
+
result.b = hslPercent.l; // achromatic
|
|
166
197
|
result.g = hslPercent.l;
|
|
167
198
|
result.r = hslPercent.l;
|
|
168
199
|
}
|
|
@@ -410,6 +441,7 @@ export function getHslFromAnimation(animation) {
|
|
|
410
441
|
: undefined;
|
|
411
442
|
}
|
|
412
443
|
export function getHslAnimationFromHsl(hsl, animationOptions, reduceFactor) {
|
|
444
|
+
/* color */
|
|
413
445
|
const resColor = {
|
|
414
446
|
h: {
|
|
415
447
|
enable: false,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project's constants
|
|
3
|
+
* @category Utils
|
|
4
|
+
*/
|
|
1
5
|
export declare class Constants {
|
|
6
|
+
/**
|
|
7
|
+
* Particles canvas element class name
|
|
8
|
+
*/
|
|
2
9
|
static readonly canvasClass: string;
|
|
3
10
|
static readonly randomColorValue: string;
|
|
4
11
|
static readonly midColorValue: string;
|