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
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { IDrawStroke } from "./IDrawStroke";
|
|
2
2
|
import type { IColor } from "../../../../Core/Interfaces/Colors";
|
|
3
|
+
/**
|
|
4
|
+
* @category Polygon Mask Plugin
|
|
5
|
+
*/
|
|
3
6
|
export interface IDraw {
|
|
4
7
|
enable: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated the property lineColor is deprecated, please use the new stroke.color property
|
|
10
|
+
*/
|
|
5
11
|
lineColor: string | IColor;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated the property lineColor is deprecated, please use the new stroke.width property
|
|
14
|
+
*/
|
|
6
15
|
lineWidth: number;
|
|
7
16
|
stroke: IDrawStroke;
|
|
8
17
|
}
|
|
@@ -5,10 +5,17 @@ import type { IInline } from "./IInline";
|
|
|
5
5
|
import type { ICoordinates } from "../../../../Core/Interfaces/ICoordinates";
|
|
6
6
|
import type { ILocalSvg } from "./ILocalSvg";
|
|
7
7
|
import { Type } from "../../Enums";
|
|
8
|
+
/**
|
|
9
|
+
* [[include:Options/Plugins/PolygonMask.md]]
|
|
10
|
+
* @category Polygon Mask Plugin
|
|
11
|
+
*/
|
|
8
12
|
export interface IPolygonMask {
|
|
9
13
|
draw: IDraw;
|
|
10
14
|
enable: boolean;
|
|
11
15
|
inline: IInline;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated the inlineArrangement is deprecated, please use the new inline.arrangement property
|
|
18
|
+
*/
|
|
12
19
|
inlineArrangement: InlineArrangement | keyof typeof InlineArrangement | InlineArrangementAlt;
|
|
13
20
|
move: IMove;
|
|
14
21
|
position?: ICoordinates;
|
|
@@ -6,6 +6,10 @@ import type { RecursivePartial } from "../../Types";
|
|
|
6
6
|
import { PolygonMask } from "./Options/Classes/PolygonMask";
|
|
7
7
|
import { OutModeDirection } from "../../Enums";
|
|
8
8
|
import type { IPolygonMaskOptions } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* Polygon Mask manager
|
|
11
|
+
* @category Polygon Mask Plugin
|
|
12
|
+
*/
|
|
9
13
|
export declare class PolygonMaskInstance implements IContainerPlugin {
|
|
10
14
|
private readonly container;
|
|
11
15
|
redrawTimeout?: number;
|
|
@@ -28,6 +32,14 @@ export declare class PolygonMaskInstance implements IContainerPlugin {
|
|
|
28
32
|
private polygonBounce;
|
|
29
33
|
private checkInsidePolygon;
|
|
30
34
|
private parseSvgPath;
|
|
35
|
+
/**
|
|
36
|
+
* Deprecate SVGPathElement.getPathSegAtLength removed in:
|
|
37
|
+
* Chrome for desktop release 62
|
|
38
|
+
* Chrome for Android release 62
|
|
39
|
+
* Android WebView release 62
|
|
40
|
+
* Opera release 49
|
|
41
|
+
* Opera for Android release 49
|
|
42
|
+
*/
|
|
31
43
|
private downloadSvgPath;
|
|
32
44
|
private drawPoints;
|
|
33
45
|
private randomPoint;
|
|
@@ -3,6 +3,10 @@ import { Constants, deepExtend, getDistance, getDistances, itemFromArray } from
|
|
|
3
3
|
import { PolygonMask } from "./Options/Classes/PolygonMask";
|
|
4
4
|
import { OutModeDirection } from "../../Enums";
|
|
5
5
|
import { calcClosestPtOnSegment, drawPolygonMask, drawPolygonMaskPath, parsePaths, segmentBounce } from "./utils";
|
|
6
|
+
/**
|
|
7
|
+
* Polygon Mask manager
|
|
8
|
+
* @category Polygon Mask Plugin
|
|
9
|
+
*/
|
|
6
10
|
export class PolygonMaskInstance {
|
|
7
11
|
constructor(container) {
|
|
8
12
|
this.container = container;
|
|
@@ -18,6 +22,7 @@ export class PolygonMaskInstance {
|
|
|
18
22
|
this.options.load(options === null || options === void 0 ? void 0 : options.polygon);
|
|
19
23
|
const polygonMaskOptions = this.options;
|
|
20
24
|
this.polygonMaskMoveRadius = polygonMaskOptions.move.radius * this.container.retina.pixelRatio;
|
|
25
|
+
/* If is set the url of svg element, load it and parse into raw polygon data */
|
|
21
26
|
if (polygonMaskOptions.enable) {
|
|
22
27
|
await this.initRawData();
|
|
23
28
|
}
|
|
@@ -143,6 +148,9 @@ export class PolygonMaskInstance {
|
|
|
143
148
|
if (!options.enable || options.type === Type.none || options.type === Type.inline) {
|
|
144
149
|
return true;
|
|
145
150
|
}
|
|
151
|
+
// https://github.com/substack/point-in-polygon
|
|
152
|
+
// ray-casting algorithm based on
|
|
153
|
+
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
|
146
154
|
if (!this.raw) {
|
|
147
155
|
throw new Error(Constants.noPolygonFound);
|
|
148
156
|
}
|
|
@@ -150,6 +158,9 @@ export class PolygonMaskInstance {
|
|
|
150
158
|
const x = (_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : Math.random() * canvasSize.width;
|
|
151
159
|
const y = (_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : Math.random() * canvasSize.height;
|
|
152
160
|
let inside = false;
|
|
161
|
+
// if (this.path2DSupported && this.polygonPath && position) {
|
|
162
|
+
// inside = container.canvas.isPointInPath(this.polygonPath, position);
|
|
163
|
+
// } else {
|
|
153
164
|
for (let i = 0, j = this.raw.length - 1; i < this.raw.length; j = i++) {
|
|
154
165
|
const pi = this.raw[i];
|
|
155
166
|
const pj = this.raw[j];
|
|
@@ -158,6 +169,7 @@ export class PolygonMaskInstance {
|
|
|
158
169
|
inside = !inside;
|
|
159
170
|
}
|
|
160
171
|
}
|
|
172
|
+
// }
|
|
161
173
|
return options.type === Type.inside ? inside : options.type === Type.outside ? !inside : false;
|
|
162
174
|
}
|
|
163
175
|
parseSvgPath(xml, force) {
|
|
@@ -193,16 +205,26 @@ export class PolygonMaskInstance {
|
|
|
193
205
|
x: 50,
|
|
194
206
|
y: 50,
|
|
195
207
|
};
|
|
208
|
+
/* centering of the polygon mask */
|
|
196
209
|
this.offset = {
|
|
197
210
|
x: (container.canvas.size.width * position.x) / (100 * pxRatio) - this.dimension.width / 2,
|
|
198
211
|
y: (container.canvas.size.height * position.y) / (100 * pxRatio) - this.dimension.height / 2,
|
|
199
212
|
};
|
|
200
213
|
return parsePaths(this.paths, scale, this.offset);
|
|
201
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Deprecate SVGPathElement.getPathSegAtLength removed in:
|
|
217
|
+
* Chrome for desktop release 62
|
|
218
|
+
* Chrome for Android release 62
|
|
219
|
+
* Android WebView release 62
|
|
220
|
+
* Opera release 49
|
|
221
|
+
* Opera for Android release 49
|
|
222
|
+
*/
|
|
202
223
|
async downloadSvgPath(svgUrl, force) {
|
|
203
224
|
const options = this.options;
|
|
204
225
|
const url = svgUrl || options.url;
|
|
205
226
|
const forceDownload = force !== null && force !== void 0 ? force : false;
|
|
227
|
+
// Load SVG from file on server
|
|
206
228
|
if (!url || (this.paths !== undefined && !forceDownload)) {
|
|
207
229
|
return this.raw;
|
|
208
230
|
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// SVGPathSeg API polyfill
|
|
3
|
+
// https://github.com/progers/pathseg
|
|
4
|
+
//
|
|
5
|
+
// This is a drop-in replacement for the SVGPathSeg and SVGPathSegList APIs that were removed from
|
|
6
|
+
// SVG2 (https://lists.w3.org/Archives/Public/www-svg/2015Jun/0044.html), including the latest spec
|
|
7
|
+
// changes which were implemented in Firefox 43 and Chrome 46.
|
|
2
8
|
(function () {
|
|
3
9
|
"use strict";
|
|
4
10
|
try {
|
|
11
|
+
// The polyfill only applies to browser environments with a `window` object
|
|
12
|
+
// (i.e. not node.js, workers, etc.). If included in one of these
|
|
13
|
+
// environments (such as when using 'react-dom/server'), simply return out
|
|
5
14
|
if (typeof window === "undefined")
|
|
6
15
|
return;
|
|
7
16
|
if (!("SVGPathSeg" in window)) {
|
|
17
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSeg
|
|
8
18
|
window.SVGPathSeg = function (type, typeAsLetter, owningPathSegList) {
|
|
9
19
|
this.pathSegType = type;
|
|
10
20
|
this.pathSegTypeAsLetter = typeAsLetter;
|
|
@@ -31,6 +41,7 @@
|
|
|
31
41
|
window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17;
|
|
32
42
|
window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
|
|
33
43
|
window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
|
|
44
|
+
// Notify owning PathSegList on any changes so they can be synchronized back to the path element.
|
|
34
45
|
window.SVGPathSeg.prototype._segmentChanged = function () {
|
|
35
46
|
if (this._owningPathSegList)
|
|
36
47
|
this._owningPathSegList.segmentChanged(this);
|
|
@@ -972,6 +983,8 @@
|
|
|
972
983
|
},
|
|
973
984
|
enumerable: true,
|
|
974
985
|
});
|
|
986
|
+
// Add createSVGPathSeg* functions to window.SVGPathElement.
|
|
987
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-Interfacewindow.SVGPathElement.
|
|
975
988
|
window.SVGPathElement.prototype.createSVGPathSegClosePath = function () {
|
|
976
989
|
return new window.SVGPathSegClosePath(undefined);
|
|
977
990
|
};
|
|
@@ -1030,12 +1043,16 @@
|
|
|
1030
1043
|
return new window.SVGPathSegCurvetoQuadraticSmoothRel(undefined, x, y);
|
|
1031
1044
|
};
|
|
1032
1045
|
if (!("getPathSegAtLength" in window.SVGPathElement.prototype)) {
|
|
1046
|
+
// Add getPathSegAtLength to SVGPathElement.
|
|
1047
|
+
// Spec: https://www.w3.org/TR/SVG11/single-page.html#paths-__svg__SVGPathElement__getPathSegAtLength
|
|
1048
|
+
// This polyfill requires SVGPathElement.getTotalLength to implement the distance-along-a-path algorithm.
|
|
1033
1049
|
window.SVGPathElement.prototype.getPathSegAtLength = function (distance) {
|
|
1034
1050
|
if (distance === undefined || !isFinite(distance))
|
|
1035
1051
|
throw "Invalid arguments.";
|
|
1036
1052
|
var measurementElement = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1037
1053
|
measurementElement.setAttribute("d", this.getAttribute("d"));
|
|
1038
1054
|
var lastPathSegment = measurementElement.pathSegList.numberOfItems - 1;
|
|
1055
|
+
// If the path is empty, return 0.
|
|
1039
1056
|
if (lastPathSegment <= 0)
|
|
1040
1057
|
return 0;
|
|
1041
1058
|
do {
|
|
@@ -1048,10 +1065,17 @@
|
|
|
1048
1065
|
};
|
|
1049
1066
|
}
|
|
1050
1067
|
}
|
|
1068
|
+
// Checking for SVGPathSegList in window checks for the case of an implementation without the
|
|
1069
|
+
// SVGPathSegList API.
|
|
1070
|
+
// The second check for appendItem is specific to Firefox 59+ which removed only parts of the
|
|
1071
|
+
// SVGPathSegList API (e.g., appendItem). In this case we need to re-implement the entire API
|
|
1072
|
+
// so the polyfill data (i.e., _list) is used throughout.
|
|
1051
1073
|
if (!("SVGPathSegList" in window) || !("appendItem" in window.SVGPathSegList.prototype)) {
|
|
1074
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSegList
|
|
1052
1075
|
window.SVGPathSegList = function (pathElement) {
|
|
1053
1076
|
this._pathElement = pathElement;
|
|
1054
1077
|
this._list = this._parsePath(this._pathElement.getAttribute("d"));
|
|
1078
|
+
// Use a MutationObserver to catch changes to the path's "d" attribute.
|
|
1055
1079
|
this._mutationObserverConfig = { attributes: true, attributeFilter: ["d"] };
|
|
1056
1080
|
this._pathElementMutationObserver = new MutationObserver(this._updateListFromPathMutations.bind(this));
|
|
1057
1081
|
this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
|
|
@@ -1064,6 +1088,7 @@
|
|
|
1064
1088
|
},
|
|
1065
1089
|
enumerable: true,
|
|
1066
1090
|
});
|
|
1091
|
+
// The length property was not specified but was in Firefox 58.
|
|
1067
1092
|
Object.defineProperty(window.SVGPathSegList.prototype, "length", {
|
|
1068
1093
|
get: function () {
|
|
1069
1094
|
this._checkPathSynchronizedToList();
|
|
@@ -1071,6 +1096,8 @@
|
|
|
1071
1096
|
},
|
|
1072
1097
|
enumerable: true,
|
|
1073
1098
|
});
|
|
1099
|
+
// Add the pathSegList accessors to window.SVGPathElement.
|
|
1100
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData
|
|
1074
1101
|
Object.defineProperty(window.SVGPathElement.prototype, "pathSegList", {
|
|
1075
1102
|
get: function () {
|
|
1076
1103
|
if (!this._pathSegList)
|
|
@@ -1079,6 +1106,7 @@
|
|
|
1079
1106
|
},
|
|
1080
1107
|
enumerable: true,
|
|
1081
1108
|
});
|
|
1109
|
+
// FIXME: The following are not implemented and simply return window.SVGPathElement.pathSegList.
|
|
1082
1110
|
Object.defineProperty(window.SVGPathElement.prototype, "normalizedPathSegList", {
|
|
1083
1111
|
get: function () {
|
|
1084
1112
|
return this.pathSegList;
|
|
@@ -1097,6 +1125,9 @@
|
|
|
1097
1125
|
},
|
|
1098
1126
|
enumerable: true,
|
|
1099
1127
|
});
|
|
1128
|
+
// Process any pending mutations to the path element and update the list as needed.
|
|
1129
|
+
// This should be the first call of all public functions and is needed because
|
|
1130
|
+
// MutationObservers are not synchronous so we can have pending asynchronous mutations.
|
|
1100
1131
|
window.SVGPathSegList.prototype._checkPathSynchronizedToList = function () {
|
|
1101
1132
|
this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords());
|
|
1102
1133
|
};
|
|
@@ -1111,11 +1142,13 @@
|
|
|
1111
1142
|
if (hasPathMutations)
|
|
1112
1143
|
this._list = this._parsePath(this._pathElement.getAttribute("d"));
|
|
1113
1144
|
};
|
|
1145
|
+
// Serialize the list and update the path's 'd' attribute.
|
|
1114
1146
|
window.SVGPathSegList.prototype._writeListToPath = function () {
|
|
1115
1147
|
this._pathElementMutationObserver.disconnect();
|
|
1116
1148
|
this._pathElement.setAttribute("d", window.SVGPathSegList._pathSegArrayAsString(this._list));
|
|
1117
1149
|
this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
|
|
1118
1150
|
};
|
|
1151
|
+
// When a path segment changes the list needs to be synchronized back to the path element.
|
|
1119
1152
|
window.SVGPathSegList.prototype.segmentChanged = function (pathSeg) {
|
|
1120
1153
|
this._writeListToPath();
|
|
1121
1154
|
};
|
|
@@ -1145,9 +1178,11 @@
|
|
|
1145
1178
|
};
|
|
1146
1179
|
window.SVGPathSegList.prototype.insertItemBefore = function (newItem, index) {
|
|
1147
1180
|
this._checkPathSynchronizedToList();
|
|
1181
|
+
// Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
|
|
1148
1182
|
if (index > this.numberOfItems)
|
|
1149
1183
|
index = this.numberOfItems;
|
|
1150
1184
|
if (newItem._owningPathSegList) {
|
|
1185
|
+
// SVG2 spec says to make a copy.
|
|
1151
1186
|
newItem = newItem.clone();
|
|
1152
1187
|
}
|
|
1153
1188
|
this._list.splice(index, 0, newItem);
|
|
@@ -1158,6 +1193,7 @@
|
|
|
1158
1193
|
window.SVGPathSegList.prototype.replaceItem = function (newItem, index) {
|
|
1159
1194
|
this._checkPathSynchronizedToList();
|
|
1160
1195
|
if (newItem._owningPathSegList) {
|
|
1196
|
+
// SVG2 spec says to make a copy.
|
|
1161
1197
|
newItem = newItem.clone();
|
|
1162
1198
|
}
|
|
1163
1199
|
this._checkValidIndex(index);
|
|
@@ -1177,10 +1213,12 @@
|
|
|
1177
1213
|
window.SVGPathSegList.prototype.appendItem = function (newItem) {
|
|
1178
1214
|
this._checkPathSynchronizedToList();
|
|
1179
1215
|
if (newItem._owningPathSegList) {
|
|
1216
|
+
// SVG2 spec says to make a copy.
|
|
1180
1217
|
newItem = newItem.clone();
|
|
1181
1218
|
}
|
|
1182
1219
|
this._list.push(newItem);
|
|
1183
1220
|
newItem._owningPathSegList = this;
|
|
1221
|
+
// TODO: Optimize this to just append to the existing attribute.
|
|
1184
1222
|
this._writeListToPath();
|
|
1185
1223
|
return newItem;
|
|
1186
1224
|
};
|
|
@@ -1198,6 +1236,7 @@
|
|
|
1198
1236
|
});
|
|
1199
1237
|
return string;
|
|
1200
1238
|
};
|
|
1239
|
+
// This closely follows SVGPathParser::parsePath from Source/core/svg/SVGPathParser.cpp.
|
|
1201
1240
|
window.SVGPathSegList.prototype._parsePath = function (string) {
|
|
1202
1241
|
if (!string || string.length == 0)
|
|
1203
1242
|
return [];
|
|
@@ -1291,6 +1330,7 @@
|
|
|
1291
1330
|
}
|
|
1292
1331
|
};
|
|
1293
1332
|
Source.prototype._nextCommandHelper = function (lookahead, previousCommand) {
|
|
1333
|
+
// Check for remaining coordinates in the current command.
|
|
1294
1334
|
if ((lookahead == "+" || lookahead == "-" || lookahead == "." || (lookahead >= "0" && lookahead <= "9")) &&
|
|
1295
1335
|
previousCommand != window.SVGPathSeg.PATHSEG_CLOSEPATH) {
|
|
1296
1336
|
if (previousCommand == window.SVGPathSeg.PATHSEG_MOVETO_ABS)
|
|
@@ -1302,11 +1342,15 @@
|
|
|
1302
1342
|
return window.SVGPathSeg.PATHSEG_UNKNOWN;
|
|
1303
1343
|
};
|
|
1304
1344
|
Source.prototype.initialCommandIsMoveTo = function () {
|
|
1345
|
+
// If the path is empty it is still valid, so return true.
|
|
1305
1346
|
if (!this.hasMoreData())
|
|
1306
1347
|
return true;
|
|
1307
1348
|
var command = this.peekSegmentType();
|
|
1349
|
+
// Path must start with moveTo.
|
|
1308
1350
|
return command == window.SVGPathSeg.PATHSEG_MOVETO_ABS || command == window.SVGPathSeg.PATHSEG_MOVETO_REL;
|
|
1309
1351
|
};
|
|
1352
|
+
// Parse a number from an SVG path. This very closely follows genericParseNumber(...) from Source/core/svg/SVGParserUtilities.cpp.
|
|
1353
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-PathDataBNF
|
|
1310
1354
|
Source.prototype._parseNumber = function () {
|
|
1311
1355
|
var exponent = 0;
|
|
1312
1356
|
var integer = 0;
|
|
@@ -1316,6 +1360,7 @@
|
|
|
1316
1360
|
var expsign = 1;
|
|
1317
1361
|
var startIndex = this._currentIndex;
|
|
1318
1362
|
this._skipOptionalSpaces();
|
|
1363
|
+
// Read the sign.
|
|
1319
1364
|
if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == "+")
|
|
1320
1365
|
this._currentIndex++;
|
|
1321
1366
|
else if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == "-") {
|
|
@@ -1325,12 +1370,14 @@
|
|
|
1325
1370
|
if (this._currentIndex == this._endIndex ||
|
|
1326
1371
|
((this._string.charAt(this._currentIndex) < "0" || this._string.charAt(this._currentIndex) > "9") &&
|
|
1327
1372
|
this._string.charAt(this._currentIndex) != "."))
|
|
1373
|
+
// The first character of a number must be one of [0-9+-.].
|
|
1328
1374
|
return undefined;
|
|
1375
|
+
// Read the integer part, build right-to-left.
|
|
1329
1376
|
var startIntPartIndex = this._currentIndex;
|
|
1330
1377
|
while (this._currentIndex < this._endIndex &&
|
|
1331
1378
|
this._string.charAt(this._currentIndex) >= "0" &&
|
|
1332
1379
|
this._string.charAt(this._currentIndex) <= "9")
|
|
1333
|
-
this._currentIndex++;
|
|
1380
|
+
this._currentIndex++; // Advance to first non-digit.
|
|
1334
1381
|
if (this._currentIndex != startIntPartIndex) {
|
|
1335
1382
|
var scanIntPartIndex = this._currentIndex - 1;
|
|
1336
1383
|
var multiplier = 1;
|
|
@@ -1339,8 +1386,10 @@
|
|
|
1339
1386
|
multiplier *= 10;
|
|
1340
1387
|
}
|
|
1341
1388
|
}
|
|
1389
|
+
// Read the decimals.
|
|
1342
1390
|
if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == ".") {
|
|
1343
1391
|
this._currentIndex++;
|
|
1392
|
+
// There must be a least one digit following the .
|
|
1344
1393
|
if (this._currentIndex >= this._endIndex ||
|
|
1345
1394
|
this._string.charAt(this._currentIndex) < "0" ||
|
|
1346
1395
|
this._string.charAt(this._currentIndex) > "9")
|
|
@@ -1353,12 +1402,14 @@
|
|
|
1353
1402
|
this._currentIndex += 1;
|
|
1354
1403
|
}
|
|
1355
1404
|
}
|
|
1405
|
+
// Read the exponent part.
|
|
1356
1406
|
if (this._currentIndex != startIndex &&
|
|
1357
1407
|
this._currentIndex + 1 < this._endIndex &&
|
|
1358
1408
|
(this._string.charAt(this._currentIndex) == "e" || this._string.charAt(this._currentIndex) == "E") &&
|
|
1359
1409
|
this._string.charAt(this._currentIndex + 1) != "x" &&
|
|
1360
1410
|
this._string.charAt(this._currentIndex + 1) != "m") {
|
|
1361
1411
|
this._currentIndex++;
|
|
1412
|
+
// Read the sign of the exponent.
|
|
1362
1413
|
if (this._string.charAt(this._currentIndex) == "+") {
|
|
1363
1414
|
this._currentIndex++;
|
|
1364
1415
|
}
|
|
@@ -1366,6 +1417,7 @@
|
|
|
1366
1417
|
this._currentIndex++;
|
|
1367
1418
|
expsign = -1;
|
|
1368
1419
|
}
|
|
1420
|
+
// There must be an exponent.
|
|
1369
1421
|
if (this._currentIndex >= this._endIndex ||
|
|
1370
1422
|
this._string.charAt(this._currentIndex) < "0" ||
|
|
1371
1423
|
this._string.charAt(this._currentIndex) > "9")
|
|
@@ -1405,6 +1457,7 @@
|
|
|
1405
1457
|
var lookahead = this._string[this._currentIndex];
|
|
1406
1458
|
var command = this._pathSegTypeFromChar(lookahead);
|
|
1407
1459
|
if (command == window.SVGPathSeg.PATHSEG_UNKNOWN) {
|
|
1460
|
+
// Possibly an implicit command. Not allowed if this is the first command.
|
|
1408
1461
|
if (this._previousCommand == window.SVGPathSeg.PATHSEG_UNKNOWN)
|
|
1409
1462
|
return null;
|
|
1410
1463
|
command = this._nextCommandHelper(lookahead, this._previousCommand);
|
|
@@ -1532,6 +1585,7 @@
|
|
|
1532
1585
|
}
|
|
1533
1586
|
}
|
|
1534
1587
|
catch (e) {
|
|
1588
|
+
// ignore, if it's not working we can ignore errors
|
|
1535
1589
|
console.warn("An error occurred in tsParticles pathseg polyfill. If the Polygon Mask is not working, please open an issue here: https://github.com/matteobruni/tsparticles", e);
|
|
1536
1590
|
}
|
|
1537
1591
|
})();
|
|
@@ -2,6 +2,9 @@ import { PolygonMaskInstance } from "./PolygonMaskInstance";
|
|
|
2
2
|
import { PolygonMask } from "./Options/Classes/PolygonMask";
|
|
3
3
|
import { Type } from "./Enums";
|
|
4
4
|
import { isSsr } from "../../Utils";
|
|
5
|
+
/**
|
|
6
|
+
* @category Polygon Mask Plugin
|
|
7
|
+
*/
|
|
5
8
|
class Plugin {
|
|
6
9
|
constructor() {
|
|
7
10
|
this.id = "polygonMask";
|
|
@@ -27,8 +30,11 @@ class Plugin {
|
|
|
27
30
|
}
|
|
28
31
|
export async function loadPolygonMaskPlugin(tsParticles) {
|
|
29
32
|
if (!isSsr() && !window.SVGPathSeg) {
|
|
30
|
-
await import(
|
|
33
|
+
await import(
|
|
34
|
+
/* webpackChunkName: "tsparticles.pathseg" */
|
|
35
|
+
/* webpackMode: "lazy-once" */
|
|
36
|
+
"./pathseg");
|
|
31
37
|
}
|
|
32
38
|
const plugin = new Plugin();
|
|
33
|
-
tsParticles.addPlugin(plugin);
|
|
39
|
+
await tsParticles.addPlugin(plugin);
|
|
34
40
|
}
|
|
@@ -38,6 +38,9 @@ export function parsePaths(paths, scale, offset) {
|
|
|
38
38
|
const segment = segments === null || segments === void 0 ? void 0 : segments.getItem(i);
|
|
39
39
|
const svgPathSeg = window.SVGPathSeg;
|
|
40
40
|
switch (segment === null || segment === void 0 ? void 0 : segment.pathSegType) {
|
|
41
|
+
//
|
|
42
|
+
// Absolute
|
|
43
|
+
//
|
|
41
44
|
case svgPathSeg.PATHSEG_MOVETO_ABS:
|
|
42
45
|
case svgPathSeg.PATHSEG_LINETO_ABS:
|
|
43
46
|
case svgPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
|
|
@@ -56,6 +59,9 @@ export function parsePaths(paths, scale, offset) {
|
|
|
56
59
|
case svgPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
|
|
57
60
|
p.y = segment.y;
|
|
58
61
|
break;
|
|
62
|
+
//
|
|
63
|
+
// Relative
|
|
64
|
+
//
|
|
59
65
|
case svgPathSeg.PATHSEG_LINETO_REL:
|
|
60
66
|
case svgPathSeg.PATHSEG_MOVETO_REL:
|
|
61
67
|
case svgPathSeg.PATHSEG_CURVETO_CUBIC_REL:
|
|
@@ -76,7 +82,7 @@ export function parsePaths(paths, scale, offset) {
|
|
|
76
82
|
break;
|
|
77
83
|
case svgPathSeg.PATHSEG_UNKNOWN:
|
|
78
84
|
case svgPathSeg.PATHSEG_CLOSEPATH:
|
|
79
|
-
continue;
|
|
85
|
+
continue; // Skip the closing path (and the UNKNOWN)
|
|
80
86
|
}
|
|
81
87
|
res.push({
|
|
82
88
|
x: p.x * scale + offset.x,
|
|
@@ -87,11 +93,17 @@ export function parsePaths(paths, scale, offset) {
|
|
|
87
93
|
return res;
|
|
88
94
|
}
|
|
89
95
|
export function calcClosestPtOnSegment(s1, s2, pos) {
|
|
96
|
+
// calc delta distance: source point to line start
|
|
90
97
|
const { dx, dy } = getDistances(pos, s1);
|
|
98
|
+
// calc delta distance: line start to end
|
|
91
99
|
const { dx: dxx, dy: dyy } = getDistances(s2, s1);
|
|
100
|
+
// Calc position on line normalized between 0.00 & 1.00
|
|
101
|
+
// == dot product divided by delta line distances squared
|
|
92
102
|
const t = (dx * dxx + dy * dyy) / (dxx ** 2 + dyy ** 2);
|
|
103
|
+
// calc nearest pt on line
|
|
93
104
|
let x = s1.x + dxx * t;
|
|
94
105
|
let y = s1.y + dyy * t;
|
|
106
|
+
// clamp results to being on the segment
|
|
95
107
|
if (t < 0) {
|
|
96
108
|
x = s1.x;
|
|
97
109
|
y = s1.y;
|
|
@@ -104,7 +116,7 @@ export function calcClosestPtOnSegment(s1, s2, pos) {
|
|
|
104
116
|
}
|
|
105
117
|
export function segmentBounce(start, stop, velocity) {
|
|
106
118
|
const { dx, dy } = getDistances(start, stop);
|
|
107
|
-
const wallAngle = Math.atan2(dy, dx);
|
|
119
|
+
const wallAngle = Math.atan2(dy, dx); // + Math.PI / 2;
|
|
108
120
|
const wallNormalX = Math.sin(wallAngle);
|
|
109
121
|
const wallNormalY = -Math.cos(wallAngle);
|
|
110
122
|
const d = 2 * (velocity.x * wallNormalX + velocity.y * wallNormalY);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { IParticle, IShapeDrawer } from "../../Core/Interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* @category Shape Drawers
|
|
4
|
+
*/
|
|
2
5
|
export declare class CircleDrawer 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 loadCircleShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadCircleShape(tsParticles: Main): Promise<void>;
|
|
@@ -13,6 +13,9 @@ var _ImageDrawer_images;
|
|
|
13
13
|
import { isInArray } from "../../Utils";
|
|
14
14
|
import { ShapeType } from "../../Enums";
|
|
15
15
|
import { downloadSvgImage, loadImage, replaceColorSvg } from "./Utils";
|
|
16
|
+
/**
|
|
17
|
+
* @category Shape Drawers
|
|
18
|
+
*/
|
|
16
19
|
export class ImageDrawer {
|
|
17
20
|
constructor() {
|
|
18
21
|
_ImageDrawer_images.set(this, void 0);
|
|
@@ -151,9 +154,11 @@ export class ImageDrawer {
|
|
|
151
154
|
}
|
|
152
155
|
if (image.svgData !== undefined && imageData.replaceColor && color) {
|
|
153
156
|
const svgColoredData = replaceColorSvg(image, color, (_c = (_b = particle.opacity) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 1);
|
|
157
|
+
/* prepare to create img with colored svg */
|
|
154
158
|
const svg = new Blob([svgColoredData], { type: "image/svg+xml" });
|
|
155
159
|
const domUrl = URL || window.URL || window.webkitURL || window;
|
|
156
160
|
const url = domUrl.createObjectURL(svg);
|
|
161
|
+
/* create particle img obj */
|
|
157
162
|
const img = new Image();
|
|
158
163
|
imageRes = {
|
|
159
164
|
data: Object.assign(Object.assign({}, image), { svgData: svgColoredData }),
|
|
@@ -171,6 +176,7 @@ export class ImageDrawer {
|
|
|
171
176
|
});
|
|
172
177
|
img.addEventListener("error", () => {
|
|
173
178
|
domUrl.revokeObjectURL(url);
|
|
179
|
+
// deepcode ignore PromiseNotCaughtGeneral: catch can be ignored
|
|
174
180
|
loadImage(imageData.src).then((img2) => {
|
|
175
181
|
const pImage = particle.image;
|
|
176
182
|
if (pImage) {
|
|
@@ -43,6 +43,7 @@ export function replaceColorSvg(imageShape, color, opacity) {
|
|
|
43
43
|
if (!svgData) {
|
|
44
44
|
return "";
|
|
45
45
|
}
|
|
46
|
+
/* set color to svg element */
|
|
46
47
|
if (svgData.includes("fill")) {
|
|
47
48
|
const currentColor = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
|
|
48
49
|
return svgData.replace(currentColor, () => getStyleFromHsl(color, opacity));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "../../main";
|
|
2
|
-
export declare function loadImageShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadImageShape(tsParticles: Main): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ImageDrawer } from "./ImageDrawer";
|
|
2
|
-
export function loadImageShape(tsParticles) {
|
|
2
|
+
export async function loadImageShape(tsParticles) {
|
|
3
3
|
const imageDrawer = new ImageDrawer();
|
|
4
|
-
tsParticles.addShape("image", imageDrawer);
|
|
5
|
-
tsParticles.addShape("images", imageDrawer);
|
|
4
|
+
await tsParticles.addShape("image", imageDrawer);
|
|
5
|
+
await tsParticles.addShape("images", imageDrawer);
|
|
6
6
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { IParticle, IShapeDrawer } from "../../Core/Interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* @category Shape Drawers
|
|
4
|
+
*/
|
|
2
5
|
export declare class LineDrawer 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 loadLineShape(tsParticles: Main): void
|
|
2
|
+
export declare function loadLineShape(tsParticles: Main): Promise<void>;
|