tsparticles 1.37.4 → 1.39.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.d.ts +2 -2
- package/Core/Canvas.js +44 -34
- package/Core/Container.d.ts +2 -3
- package/Core/Container.js +7 -8
- package/Core/Interfaces/ICircleBouncer.d.ts +1 -1
- package/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
- package/Core/Interfaces/IParticle.d.ts +1 -1
- package/Core/Interfaces/index.d.ts +3 -1
- package/Core/Interfaces/index.js +3 -1
- package/Core/Loader.js +5 -9
- package/Core/Particle.d.ts +2 -5
- package/Core/Particle.js +16 -18
- package/Core/Particles.d.ts +1 -1
- package/Core/Particles.js +13 -19
- package/{Utils → Core/Utils}/Circle.d.ts +1 -1
- package/{Utils → Core/Utils}/Circle.js +2 -2
- package/{esm → Core}/Utils/CircleWarp.d.ts +1 -2
- package/{Utils → Core/Utils}/CircleWarp.js +0 -0
- package/{Utils → Core/Utils}/Constants.d.ts +1 -1
- package/{Utils → Core/Utils}/Constants.js +1 -1
- package/{Utils → Core/Utils}/EventListeners.d.ts +1 -1
- package/{Utils → Core/Utils}/EventListeners.js +11 -12
- package/Core/{ExternalInteractorBase.d.ts → Utils/ExternalInteractorBase.d.ts} +4 -4
- package/Core/{ExternalInteractorBase.js → Utils/ExternalInteractorBase.js} +1 -2
- package/{esm/Core → Core/Utils}/FrameManager.d.ts +1 -1
- package/Core/{FrameManager.js → Utils/FrameManager.js} +0 -0
- package/{esm/Core → Core/Utils}/InteractionManager.d.ts +3 -3
- package/Core/{InteractionManager.js → Utils/InteractionManager.js} +2 -3
- package/{esm/Core → Core/Utils}/ParticlesInteractorBase.d.ts +4 -4
- package/Core/{ParticlesInteractorBase.js → Utils/ParticlesInteractorBase.js} +1 -2
- package/{esm/Core/Particle/Mover.d.ts → Core/Utils/ParticlesMover.d.ts} +1 -1
- package/Core/{Particle/Mover.js → Utils/ParticlesMover.js} +6 -7
- package/{esm → Core}/Utils/Plugins.d.ts +5 -5
- package/{Utils → Core/Utils}/Plugins.js +0 -0
- package/{Utils → Core/Utils}/Point.d.ts +2 -2
- package/{Utils → Core/Utils}/Point.js +0 -0
- package/{Utils → Core/Utils}/QuadTree.d.ts +3 -3
- package/{Utils → Core/Utils}/QuadTree.js +2 -2
- package/{esm → Core}/Utils/Range.d.ts +1 -1
- package/{Utils → Core/Utils}/Range.js +0 -0
- package/{esm → Core}/Utils/Rectangle.d.ts +1 -2
- package/{Utils → Core/Utils}/Rectangle.js +0 -0
- package/Core/{Particle → Utils}/Vector.d.ts +0 -0
- package/Core/{Particle → Utils}/Vector.js +0 -0
- package/Core/{Particle → Utils}/Vector3d.d.ts +0 -0
- package/Core/{Particle → Utils}/Vector3d.js +0 -0
- package/Core/Utils/index.d.ts +16 -0
- package/Core/Utils/index.js +28 -0
- package/Core/index.d.ts +8 -0
- package/Core/index.js +20 -0
- package/Enums/AnimationStatus.d.ts +1 -1
- package/Enums/AnimationStatus.js +0 -6
- package/Enums/Directions/MoveDirection.d.ts +1 -1
- package/Enums/Directions/MoveDirection.js +0 -13
- package/Enums/Directions/OutModeDirection.d.ts +1 -1
- package/Enums/Directions/OutModeDirection.js +0 -8
- package/Enums/Directions/RotateDirection.d.ts +1 -1
- package/Enums/Directions/RotateDirection.js +0 -7
- package/Enums/Directions/TiltDirection.d.ts +1 -1
- package/Enums/Directions/TiltDirection.js +0 -7
- package/Enums/InteractivityDetect.d.ts +1 -1
- package/Enums/InteractivityDetect.js +0 -7
- package/Enums/Modes/ClickMode.d.ts +1 -1
- package/Enums/Modes/ClickMode.js +0 -11
- package/Enums/Modes/CollisionMode.d.ts +1 -1
- package/Enums/Modes/CollisionMode.js +0 -7
- package/Enums/Modes/DestroyMode.d.ts +1 -1
- package/Enums/Modes/DestroyMode.js +0 -6
- package/Enums/Modes/DivMode.d.ts +1 -1
- package/Enums/Modes/DivMode.js +0 -7
- package/Enums/Modes/HoverMode.d.ts +1 -1
- package/Enums/Modes/HoverMode.js +0 -13
- package/Enums/Modes/OutMode.d.ts +1 -1
- package/Enums/Modes/OutMode.js +0 -11
- package/Enums/Modes/ResponsiveMode.d.ts +1 -1
- package/Enums/Modes/ResponsiveMode.js +0 -6
- package/Enums/Modes/RollMode.d.ts +1 -1
- package/Enums/Modes/RollMode.js +0 -7
- package/Enums/Modes/SizeMode.d.ts +1 -1
- package/Enums/Modes/SizeMode.js +0 -6
- package/Enums/Modes/ThemeMode.d.ts +1 -1
- package/Enums/Modes/ThemeMode.js +0 -7
- package/Enums/Types/AlterType.d.ts +1 -1
- package/Enums/Types/AlterType.js +0 -6
- package/Enums/Types/DestroyType.d.ts +1 -1
- package/Enums/Types/DestroyType.js +0 -7
- package/Enums/Types/DivType.d.ts +1 -1
- package/Enums/Types/DivType.js +0 -6
- package/Enums/Types/EasingType.d.ts +1 -1
- package/Enums/Types/EasingType.js +0 -12
- package/Enums/Types/GradientType.d.ts +1 -1
- package/Enums/Types/GradientType.js +0 -7
- package/Enums/Types/InteractorType.d.ts +1 -1
- package/Enums/Types/InteractorType.js +0 -6
- package/Enums/Types/OrbitType.d.ts +1 -1
- package/Enums/Types/OrbitType.js +0 -6
- package/Enums/Types/ShapeType.d.ts +1 -1
- package/Enums/Types/ShapeType.js +0 -15
- package/Enums/Types/StartValueType.d.ts +1 -1
- package/Enums/Types/StartValueType.js +0 -7
- package/Interactions/External/Attract/Attractor.d.ts +2 -2
- package/Interactions/External/Attract/Attractor.js +9 -11
- package/Interactions/External/Attract/index.d.ts +2 -2
- package/Interactions/External/Bounce/Bouncer.d.ts +2 -2
- package/Interactions/External/Bounce/Bouncer.js +15 -17
- package/Interactions/External/Bounce/index.d.ts +2 -2
- package/Interactions/External/Bubble/Bubbler.d.ts +3 -3
- package/Interactions/External/Bubble/Bubbler.js +20 -22
- package/Interactions/External/Bubble/ProcessBubbleType.d.ts +1 -1
- package/Interactions/External/Bubble/ProcessBubbleType.js +0 -7
- package/Interactions/External/Bubble/index.d.ts +2 -2
- package/Interactions/External/Connect/Connector.d.ts +2 -2
- package/Interactions/External/Connect/Connector.js +3 -4
- package/Interactions/External/Connect/index.d.ts +2 -2
- package/Interactions/External/Grab/Grabber.d.ts +2 -2
- package/Interactions/External/Grab/Grabber.js +4 -5
- package/Interactions/External/Grab/index.d.ts +2 -2
- package/Interactions/External/Repulse/Repulser.d.ts +2 -2
- package/Interactions/External/Repulse/Repulser.js +15 -17
- package/Interactions/External/Repulse/index.d.ts +2 -2
- package/Interactions/External/Trail/TrailMaker.d.ts +2 -3
- package/Interactions/External/Trail/TrailMaker.js +4 -5
- package/Interactions/External/Trail/index.d.ts +2 -2
- package/Interactions/Particles/Attract/Attractor.d.ts +2 -4
- package/Interactions/Particles/Attract/Attractor.js +2 -2
- package/Interactions/Particles/Attract/index.d.ts +2 -2
- package/Interactions/Particles/Collisions/Collider.d.ts +2 -3
- package/Interactions/Particles/Collisions/Collider.js +5 -6
- package/Interactions/Particles/Collisions/index.d.ts +2 -2
- package/Interactions/Particles/Links/LinkInstance.d.ts +1 -3
- package/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
- package/Interactions/Particles/Links/Linker.d.ts +3 -4
- package/Interactions/Particles/Links/Linker.js +4 -4
- package/Interactions/Particles/Links/index.d.ts +2 -3
- package/Interactions/Particles/Links/index.js +3 -7
- package/Interactions/Particles/Links/interaction.d.ts +2 -0
- package/Interactions/Particles/Links/interaction.js +8 -0
- package/Interactions/Particles/Links/plugin.d.ts +2 -2
- package/Interactions/Particles/Links/plugin.js +2 -2
- package/Options/Classes/AnimatableGradient.js +3 -4
- package/Options/Classes/Interactivity/Events/DivEvent.js +1 -2
- package/Options/Classes/Interactivity/Interactivity.js +5 -6
- package/Options/Classes/Interactivity/Modes/Attract.js +1 -2
- package/Options/Classes/Interactivity/Modes/RepulseBase.js +1 -2
- package/Options/Classes/Options.d.ts +1 -0
- package/Options/Classes/Options.js +10 -8
- package/Options/Classes/Particles/Collisions/Collisions.js +1 -2
- package/Options/Classes/Particles/Destroy/Destroy.js +1 -2
- package/Options/Classes/Particles/Move/Move.js +1 -2
- package/Options/Classes/Particles/Move/OutModes.js +1 -2
- package/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -3
- package/Options/Classes/Particles/Roll/Roll.js +1 -2
- package/Options/Classes/Particles/Rotate/Rotate.js +1 -2
- package/Options/Classes/Particles/Shape/Shape.js +13 -14
- package/Options/Classes/Particles/Size/SizeAnimation.js +2 -3
- package/Options/Classes/Particles/Tilt/Tilt.js +1 -2
- package/Options/Classes/Responsive.js +4 -5
- package/Options/Classes/Theme/ThemeDefault.js +1 -2
- package/Options/Interfaces/IOptions.d.ts +1 -0
- package/Plugins/Absorbers/AbsorberContainer.d.ts +1 -1
- package/Plugins/Absorbers/AbsorberInstance.d.ts +2 -4
- package/Plugins/Absorbers/AbsorberInstance.js +9 -10
- package/Plugins/Absorbers/Absorbers.d.ts +1 -4
- package/Plugins/Absorbers/Absorbers.js +1 -2
- package/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +1 -1
- package/Plugins/Absorbers/Enums/AbsorberClickMode.js +0 -5
- package/Plugins/Absorbers/index.d.ts +2 -0
- package/Plugins/Absorbers/{plugin.js → index.js} +3 -4
- package/Plugins/Emitters/EmitterContainer.d.ts +1 -1
- package/Plugins/Emitters/EmitterInstance.d.ts +1 -2
- package/Plugins/Emitters/EmitterInstance.js +3 -4
- package/Plugins/Emitters/Emitters.d.ts +1 -2
- package/Plugins/Emitters/Emitters.js +1 -2
- package/Plugins/Emitters/EmittersMain.d.ts +2 -2
- package/Plugins/Emitters/Enums/EmitterClickMode.d.ts +1 -1
- package/Plugins/Emitters/Enums/EmitterClickMode.js +0 -5
- package/Plugins/Emitters/Enums/EmitterShapeType.d.ts +1 -1
- package/Plugins/Emitters/Enums/EmitterShapeType.js +0 -6
- package/Plugins/Emitters/IEmitterShape.d.ts +1 -1
- package/Plugins/Emitters/Options/Classes/Emitter.js +1 -2
- package/Plugins/Emitters/Options/Classes/EmitterSize.js +1 -2
- package/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +1 -1
- package/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +1 -1
- package/Plugins/Emitters/{plugin.d.ts → index.d.ts} +0 -0
- package/Plugins/Emitters/{plugin.js → index.js} +3 -4
- package/Plugins/PolygonMask/Enums/PolygonMaskInlineArrangement.d.ts +8 -0
- package/Plugins/PolygonMask/{Options/Interfaces/IDraw.js → Enums/PolygonMaskInlineArrangement.js} +0 -0
- package/Plugins/PolygonMask/Enums/PolygonMaskMoveType.d.ts +4 -0
- package/Plugins/PolygonMask/{Options/Interfaces/IDrawStroke.js → Enums/PolygonMaskMoveType.js} +0 -0
- package/{esm/Plugins/PolygonMask/Enums/Type.d.ts → Plugins/PolygonMask/Enums/PolygonMaskType.d.ts} +1 -1
- package/Plugins/PolygonMask/{Options/Interfaces/IInline.js → Enums/PolygonMaskType.js} +0 -0
- package/Plugins/PolygonMask/Enums/index.d.ts +3 -3
- package/Plugins/PolygonMask/Enums/index.js +3 -3
- package/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +13 -13
- package/Plugins/PolygonMask/Options/Classes/PolygonMask.js +42 -42
- package/Plugins/PolygonMask/Options/Classes/{Draw.d.ts → PolygonMaskDraw.d.ts} +5 -5
- package/Plugins/PolygonMask/Options/Classes/{Draw.js → PolygonMaskDraw.js} +15 -14
- package/Plugins/PolygonMask/Options/Classes/{DrawStroke.d.ts → PolygonMaskDrawStroke.d.ts} +3 -3
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.js +29 -0
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +9 -0
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.js +17 -0
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +11 -0
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.js +29 -0
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +10 -0
- package/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.js +21 -0
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +12 -13
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +8 -0
- package/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.js → IPolygonMaskDraw.js} +0 -0
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDrawStroke.d.ts +6 -0
- package/Plugins/PolygonMask/Options/Interfaces/{IMove.js → IPolygonMaskDrawStroke.js} +0 -0
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.d.ts +4 -0
- package/Plugins/PolygonMask/{types.js → Options/Interfaces/IPolygonMaskInline.js} +0 -0
- package/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.d.ts → IPolygonMaskLocalSvg.d.ts} +2 -2
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.js +2 -0
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.d.ts +5 -0
- package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.js +2 -0
- package/Plugins/PolygonMask/PolygonMaskInstance.d.ts +2 -4
- package/Plugins/PolygonMask/PolygonMaskInstance.js +33 -30
- package/Plugins/PolygonMask/{types.d.ts → Types.d.ts} +0 -0
- package/Plugins/PolygonMask/Types.js +2 -0
- package/{esm/Plugins/PolygonMask/utils.d.ts → Plugins/PolygonMask/Utils.d.ts} +5 -5
- package/Plugins/PolygonMask/{utils.js → Utils.js} +15 -12
- package/Plugins/PolygonMask/index.d.ts +2 -0
- package/Plugins/PolygonMask/{plugin.js → index.js} +4 -5
- package/Plugins/PolygonMask/pathseg.js +54 -43
- package/README.md +68 -0
- package/Shapes/Circle/CircleDrawer.d.ts +1 -1
- package/Shapes/Circle/index.d.ts +2 -2
- package/Shapes/Image/ImageDrawer.d.ts +3 -7
- package/Shapes/Image/ImageDrawer.js +29 -109
- package/Shapes/Image/Utils.d.ts +8 -5
- package/Shapes/Image/Utils.js +69 -38
- package/Shapes/Image/index.d.ts +2 -2
- package/Shapes/Line/LineDrawer.d.ts +1 -1
- package/Shapes/Line/index.d.ts +2 -2
- package/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
- package/Shapes/Polygon/PolygonDrawerBase.d.ts +1 -1
- package/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
- package/Shapes/Polygon/index.d.ts +4 -4
- package/Shapes/Square/SquareDrawer.d.ts +1 -1
- package/Shapes/Square/index.d.ts +2 -2
- package/Shapes/Star/StarDrawer.d.ts +1 -1
- package/Shapes/Star/index.d.ts +2 -2
- package/Shapes/Text/TextDrawer.d.ts +1 -2
- package/Shapes/Text/index.d.ts +2 -2
- package/Updaters/Angle/AngleUpdater.d.ts +1 -3
- package/Updaters/Angle/AngleUpdater.js +8 -9
- package/Updaters/Angle/index.d.ts +2 -2
- package/Updaters/Color/ColorUpdater.d.ts +1 -3
- package/Updaters/Color/ColorUpdater.js +3 -4
- package/Updaters/Color/index.d.ts +2 -2
- package/Updaters/Life/LifeUpdater.d.ts +1 -3
- package/Updaters/Life/index.d.ts +2 -2
- package/Updaters/Opacity/OpacityUpdater.d.ts +1 -3
- package/Updaters/Opacity/OpacityUpdater.js +13 -14
- package/Updaters/Opacity/index.d.ts +2 -2
- package/Updaters/OutModes/IBounceData.d.ts +1 -2
- package/Updaters/OutModes/OutOfCanvasUpdater.d.ts +1 -3
- package/Updaters/OutModes/OutOfCanvasUpdater.js +19 -20
- package/Updaters/OutModes/Utils.js +12 -13
- package/Updaters/OutModes/index.d.ts +2 -2
- package/Updaters/Roll/RollUpdater.d.ts +1 -2
- package/Updaters/Roll/RollUpdater.js +4 -5
- package/Updaters/Roll/index.d.ts +2 -2
- package/Updaters/Size/SizeUpdater.d.ts +1 -2
- package/Updaters/Size/SizeUpdater.js +6 -7
- package/Updaters/Size/index.d.ts +2 -2
- package/Updaters/StrokeColor/StrokeColorUpdater.d.ts +1 -3
- package/Updaters/StrokeColor/StrokeColorUpdater.js +3 -4
- package/Updaters/StrokeColor/index.d.ts +2 -2
- package/Updaters/Tilt/TiltUpdater.d.ts +1 -3
- package/Updaters/Tilt/TiltUpdater.js +8 -9
- package/Updaters/Tilt/index.d.ts +2 -2
- package/Updaters/Wobble/WobbleUpdater.d.ts +1 -3
- package/Updaters/Wobble/index.d.ts +2 -2
- package/Utils/CanvasUtils.d.ts +3 -3
- package/Utils/CanvasUtils.js +4 -5
- package/Utils/ColorUtils.d.ts +1 -1
- package/Utils/ColorUtils.js +7 -8
- package/Utils/NumberUtils.d.ts +2 -2
- package/Utils/NumberUtils.js +20 -21
- package/Utils/Utils.d.ts +1 -1
- package/Utils/Utils.js +10 -14
- package/Utils/index.d.ts +0 -9
- package/Utils/index.js +0 -9
- package/browser/Core/Canvas.d.ts +2 -2
- package/browser/Core/Canvas.js +25 -15
- package/browser/Core/Container.d.ts +2 -3
- package/browser/Core/Container.js +2 -3
- package/browser/Core/Interfaces/ICircleBouncer.d.ts +1 -1
- package/browser/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
- package/browser/Core/Interfaces/IParticle.d.ts +1 -1
- package/browser/Core/Interfaces/index.d.ts +3 -1
- package/browser/Core/Interfaces/index.js +3 -1
- package/browser/Core/Loader.js +6 -10
- package/browser/Core/Particle.d.ts +2 -5
- package/browser/Core/Particle.js +13 -15
- package/browser/Core/Particles.d.ts +1 -1
- package/browser/Core/Particles.js +8 -14
- package/browser/{Utils → Core/Utils}/Circle.d.ts +1 -1
- package/browser/{Utils → Core/Utils}/Circle.js +1 -1
- package/browser/{Utils → Core/Utils}/CircleWarp.d.ts +1 -2
- package/browser/{Utils → Core/Utils}/CircleWarp.js +0 -0
- package/browser/{Utils → Core/Utils}/Constants.d.ts +1 -4
- package/browser/{Utils → Core/Utils}/Constants.js +1 -4
- package/browser/{Utils → Core/Utils}/EventListeners.d.ts +1 -1
- package/browser/{Utils → Core/Utils}/EventListeners.js +11 -12
- package/{esm/Core → browser/Core/Utils}/ExternalInteractorBase.d.ts +4 -4
- package/browser/Core/{ExternalInteractorBase.js → Utils/ExternalInteractorBase.js} +1 -2
- package/browser/Core/{FrameManager.d.ts → Utils/FrameManager.d.ts} +1 -1
- package/browser/Core/{FrameManager.js → Utils/FrameManager.js} +0 -0
- package/browser/Core/{InteractionManager.d.ts → Utils/InteractionManager.d.ts} +3 -3
- package/browser/Core/{InteractionManager.js → Utils/InteractionManager.js} +2 -3
- package/{Core → browser/Core/Utils}/ParticlesInteractorBase.d.ts +4 -4
- package/{esm/Core → browser/Core/Utils}/ParticlesInteractorBase.js +1 -2
- package/browser/Core/{Particle/Mover.d.ts → Utils/ParticlesMover.d.ts} +1 -1
- package/browser/Core/{Particle/Mover.js → Utils/ParticlesMover.js} +4 -5
- package/browser/{Utils → Core/Utils}/Plugins.d.ts +5 -5
- package/browser/{Utils → Core/Utils}/Plugins.js +0 -0
- package/browser/{Utils → Core/Utils}/Point.d.ts +2 -2
- package/browser/{Utils → Core/Utils}/Point.js +0 -0
- package/browser/{Utils → Core/Utils}/QuadTree.d.ts +3 -3
- package/browser/{Utils → Core/Utils}/QuadTree.js +1 -1
- package/browser/{Utils → Core/Utils}/Range.d.ts +1 -1
- package/browser/{Utils → Core/Utils}/Range.js +0 -0
- package/browser/{Utils → Core/Utils}/Rectangle.d.ts +1 -2
- package/browser/{Utils → Core/Utils}/Rectangle.js +0 -0
- package/browser/Core/{Particle → Utils}/Vector.d.ts +0 -0
- package/browser/Core/{Particle → Utils}/Vector.js +0 -0
- package/browser/Core/{Particle → Utils}/Vector3d.d.ts +0 -0
- package/browser/Core/{Particle → Utils}/Vector3d.js +0 -0
- package/browser/Core/Utils/index.d.ts +16 -0
- package/browser/Core/Utils/index.js +16 -0
- package/browser/Core/index.d.ts +8 -0
- package/browser/Core/index.js +8 -0
- package/browser/Enums/AnimationStatus.d.ts +1 -1
- package/browser/Enums/AnimationStatus.js +1 -5
- package/browser/Enums/Directions/MoveDirection.d.ts +1 -1
- package/browser/Enums/Directions/MoveDirection.js +1 -15
- package/browser/Enums/Directions/OutModeDirection.d.ts +1 -1
- package/browser/Enums/Directions/OutModeDirection.js +1 -7
- package/browser/Enums/Directions/RotateDirection.d.ts +1 -1
- package/browser/Enums/Directions/RotateDirection.js +1 -9
- package/browser/Enums/Directions/TiltDirection.d.ts +1 -1
- package/browser/Enums/Directions/TiltDirection.js +1 -9
- package/browser/Enums/InteractivityDetect.d.ts +1 -1
- package/browser/Enums/InteractivityDetect.js +1 -9
- package/browser/Enums/Modes/ClickMode.d.ts +1 -1
- package/browser/Enums/Modes/ClickMode.js +1 -13
- package/browser/Enums/Modes/CollisionMode.d.ts +1 -1
- package/browser/Enums/Modes/CollisionMode.js +1 -9
- package/browser/Enums/Modes/DestroyMode.d.ts +1 -1
- package/browser/Enums/Modes/DestroyMode.js +1 -5
- package/browser/Enums/Modes/DivMode.d.ts +1 -1
- package/browser/Enums/Modes/DivMode.js +1 -9
- package/browser/Enums/Modes/HoverMode.d.ts +1 -1
- package/browser/Enums/Modes/HoverMode.js +1 -15
- package/browser/Enums/Modes/OutMode.d.ts +1 -1
- package/browser/Enums/Modes/OutMode.js +1 -13
- package/browser/Enums/Modes/ResponsiveMode.d.ts +1 -1
- package/browser/Enums/Modes/ResponsiveMode.js +1 -5
- package/browser/Enums/Modes/RollMode.d.ts +1 -1
- package/browser/Enums/Modes/RollMode.js +1 -6
- package/browser/Enums/Modes/SizeMode.d.ts +1 -1
- package/browser/Enums/Modes/SizeMode.js +1 -8
- package/browser/Enums/Modes/ThemeMode.d.ts +1 -1
- package/browser/Enums/Modes/ThemeMode.js +1 -6
- package/browser/Enums/Types/AlterType.d.ts +1 -1
- package/browser/Enums/Types/AlterType.js +1 -5
- package/browser/Enums/Types/DestroyType.d.ts +1 -1
- package/browser/Enums/Types/DestroyType.js +1 -9
- package/browser/Enums/Types/DivType.d.ts +1 -1
- package/browser/Enums/Types/DivType.js +1 -8
- package/browser/Enums/Types/EasingType.d.ts +1 -1
- package/browser/Enums/Types/EasingType.js +1 -11
- package/browser/Enums/Types/GradientType.d.ts +1 -1
- package/browser/Enums/Types/GradientType.js +1 -6
- package/browser/Enums/Types/InteractorType.d.ts +1 -1
- package/browser/Enums/Types/InteractorType.js +1 -5
- package/browser/Enums/Types/OrbitType.d.ts +1 -1
- package/browser/Enums/Types/OrbitType.js +1 -8
- package/browser/Enums/Types/ShapeType.d.ts +1 -1
- package/browser/Enums/Types/ShapeType.js +1 -17
- package/browser/Enums/Types/StartValueType.d.ts +1 -1
- package/browser/Enums/Types/StartValueType.js +1 -9
- package/browser/Interactions/External/Attract/Attractor.d.ts +2 -2
- package/browser/Interactions/External/Attract/Attractor.js +5 -7
- package/browser/Interactions/External/Attract/index.d.ts +2 -2
- package/browser/Interactions/External/Bounce/Bouncer.d.ts +2 -2
- package/browser/Interactions/External/Bounce/Bouncer.js +7 -9
- package/browser/Interactions/External/Bounce/index.d.ts +2 -2
- package/browser/Interactions/External/Bubble/Bubbler.d.ts +3 -3
- package/browser/Interactions/External/Bubble/Bubbler.js +16 -18
- package/browser/Interactions/External/Bubble/ProcessBubbleType.d.ts +1 -1
- package/browser/Interactions/External/Bubble/ProcessBubbleType.js +1 -9
- package/browser/Interactions/External/Bubble/index.d.ts +2 -2
- package/browser/Interactions/External/Connect/Connector.d.ts +2 -2
- package/browser/Interactions/External/Connect/Connector.js +2 -3
- package/browser/Interactions/External/Connect/index.d.ts +2 -2
- package/browser/Interactions/External/Grab/Grabber.d.ts +2 -2
- package/browser/Interactions/External/Grab/Grabber.js +3 -4
- package/browser/Interactions/External/Grab/index.d.ts +2 -2
- package/browser/Interactions/External/Repulse/Repulser.d.ts +2 -2
- package/browser/Interactions/External/Repulse/Repulser.js +8 -10
- package/browser/Interactions/External/Repulse/index.d.ts +2 -2
- package/browser/Interactions/External/Trail/TrailMaker.d.ts +2 -3
- package/browser/Interactions/External/Trail/TrailMaker.js +3 -4
- package/browser/Interactions/External/Trail/index.d.ts +2 -2
- package/browser/Interactions/Particles/Attract/Attractor.d.ts +2 -4
- package/browser/Interactions/Particles/Attract/Attractor.js +1 -1
- package/browser/Interactions/Particles/Attract/index.d.ts +2 -2
- package/browser/Interactions/Particles/Collisions/Collider.d.ts +2 -3
- package/browser/Interactions/Particles/Collisions/Collider.js +4 -5
- package/browser/Interactions/Particles/Collisions/index.d.ts +2 -2
- package/browser/Interactions/Particles/Links/LinkInstance.d.ts +1 -3
- package/browser/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
- package/browser/Interactions/Particles/Links/Linker.d.ts +3 -4
- package/browser/Interactions/Particles/Links/Linker.js +2 -2
- package/browser/Interactions/Particles/Links/index.d.ts +2 -3
- package/browser/Interactions/Particles/Links/index.js +1 -4
- package/browser/Interactions/Particles/Links/interaction.d.ts +2 -0
- package/browser/Interactions/Particles/Links/interaction.js +4 -0
- package/browser/Interactions/Particles/Links/plugin.d.ts +2 -2
- package/browser/Interactions/Particles/Links/plugin.js +2 -2
- package/browser/Options/Classes/AnimatableGradient.js +3 -4
- package/browser/Options/Classes/Interactivity/Events/DivEvent.js +1 -2
- package/browser/Options/Classes/Interactivity/Interactivity.js +5 -6
- package/browser/Options/Classes/Interactivity/Modes/Attract.js +1 -2
- package/browser/Options/Classes/Interactivity/Modes/RepulseBase.js +1 -2
- package/browser/Options/Classes/Options.d.ts +1 -0
- package/browser/Options/Classes/Options.js +9 -7
- package/browser/Options/Classes/Particles/Collisions/Collisions.js +1 -2
- package/browser/Options/Classes/Particles/Destroy/Destroy.js +1 -2
- package/browser/Options/Classes/Particles/Move/Move.js +1 -2
- package/browser/Options/Classes/Particles/Move/OutModes.js +1 -2
- package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -3
- package/browser/Options/Classes/Particles/Roll/Roll.js +1 -2
- package/browser/Options/Classes/Particles/Rotate/Rotate.js +1 -2
- package/browser/Options/Classes/Particles/Shape/Shape.js +13 -14
- package/browser/Options/Classes/Particles/Size/SizeAnimation.js +2 -3
- package/browser/Options/Classes/Particles/Tilt/Tilt.js +1 -2
- package/browser/Options/Classes/Responsive.js +4 -5
- package/browser/Options/Classes/Theme/ThemeDefault.js +1 -2
- package/browser/Options/Interfaces/IOptions.d.ts +1 -0
- package/browser/Plugins/Absorbers/AbsorberContainer.d.ts +1 -1
- package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +2 -4
- package/browser/Plugins/Absorbers/AbsorberInstance.js +4 -5
- package/browser/Plugins/Absorbers/Absorbers.d.ts +1 -4
- package/browser/Plugins/Absorbers/Absorbers.js +1 -2
- package/browser/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +1 -1
- package/browser/Plugins/Absorbers/Enums/AbsorberClickMode.js +1 -7
- package/browser/Plugins/Absorbers/index.d.ts +2 -0
- package/browser/Plugins/Absorbers/{plugin.js → index.js} +3 -4
- package/browser/Plugins/Emitters/EmitterContainer.d.ts +1 -1
- package/browser/Plugins/Emitters/EmitterInstance.d.ts +1 -2
- package/browser/Plugins/Emitters/EmitterInstance.js +3 -4
- package/browser/Plugins/Emitters/Emitters.d.ts +1 -2
- package/browser/Plugins/Emitters/Emitters.js +1 -2
- package/browser/Plugins/Emitters/EmittersMain.d.ts +2 -2
- package/browser/Plugins/Emitters/Enums/EmitterClickMode.d.ts +1 -1
- package/browser/Plugins/Emitters/Enums/EmitterClickMode.js +1 -7
- package/browser/Plugins/Emitters/Enums/EmitterShapeType.d.ts +1 -1
- package/browser/Plugins/Emitters/Enums/EmitterShapeType.js +1 -5
- package/browser/Plugins/Emitters/IEmitterShape.d.ts +1 -1
- package/browser/Plugins/Emitters/Options/Classes/Emitter.js +1 -2
- package/browser/Plugins/Emitters/Options/Classes/EmitterSize.js +1 -2
- package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +1 -1
- package/browser/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +1 -1
- package/browser/Plugins/Emitters/{plugin.d.ts → index.d.ts} +0 -0
- package/browser/Plugins/Emitters/{plugin.js → index.js} +3 -4
- package/browser/Plugins/PolygonMask/Enums/PolygonMaskInlineArrangement.d.ts +8 -0
- package/browser/Plugins/PolygonMask/{Options/Interfaces/IDraw.js → Enums/PolygonMaskInlineArrangement.js} +0 -0
- package/browser/Plugins/PolygonMask/Enums/PolygonMaskMoveType.d.ts +4 -0
- package/browser/Plugins/PolygonMask/{Options/Interfaces/IDrawStroke.js → Enums/PolygonMaskMoveType.js} +0 -0
- package/{Plugins/PolygonMask/Enums/Type.d.ts → browser/Plugins/PolygonMask/Enums/PolygonMaskType.d.ts} +1 -1
- package/browser/Plugins/PolygonMask/{Options/Interfaces/IInline.js → Enums/PolygonMaskType.js} +0 -0
- package/browser/Plugins/PolygonMask/Enums/index.d.ts +3 -3
- package/browser/Plugins/PolygonMask/Enums/index.js +3 -3
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +13 -13
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.js +42 -42
- package/browser/Plugins/PolygonMask/Options/Classes/{Draw.d.ts → PolygonMaskDraw.d.ts} +5 -5
- package/browser/Plugins/PolygonMask/Options/Classes/{Draw.js → PolygonMaskDraw.js} +13 -12
- package/browser/Plugins/PolygonMask/Options/Classes/{DrawStroke.d.ts → PolygonMaskDrawStroke.d.ts} +3 -3
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.js +28 -0
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +12 -0
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.js +16 -0
- package/browser/Plugins/PolygonMask/Options/Classes/{LocalSvg.d.ts → PolygonMaskLocalSvg.d.ts} +4 -4
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.js +28 -0
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +13 -0
- package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.js +20 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +12 -13
- package/browser/Plugins/PolygonMask/Options/Interfaces/{IDraw.d.ts → IPolygonMaskDraw.d.ts} +4 -4
- package/browser/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.js → IPolygonMaskDraw.js} +0 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/{IDrawStroke.d.ts → IPolygonMaskDrawStroke.d.ts} +2 -2
- package/browser/Plugins/PolygonMask/Options/Interfaces/{IMove.js → IPolygonMaskDrawStroke.js} +0 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.d.ts +7 -0
- package/browser/Plugins/PolygonMask/{types.js → Options/Interfaces/IPolygonMaskInline.js} +0 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.d.ts → IPolygonMaskLocalSvg.d.ts} +2 -2
- package/{esm/Plugins/PolygonMask/Options/Interfaces/IDraw.js → browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.js} +0 -0
- package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.d.ts +8 -0
- package/{esm/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.js → browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.js} +0 -0
- package/browser/Plugins/PolygonMask/PolygonMaskInstance.d.ts +2 -4
- package/browser/Plugins/PolygonMask/PolygonMaskInstance.js +24 -21
- package/browser/Plugins/PolygonMask/{types.d.ts → Types.d.ts} +0 -0
- package/{esm/Plugins/PolygonMask/Options/Interfaces/IInline.js → browser/Plugins/PolygonMask/Types.js} +0 -0
- package/{Plugins/PolygonMask/utils.d.ts → browser/Plugins/PolygonMask/Utils.d.ts} +5 -5
- package/browser/Plugins/PolygonMask/{utils.js → Utils.js} +15 -12
- package/browser/Plugins/PolygonMask/index.d.ts +2 -0
- package/browser/Plugins/PolygonMask/{plugin.js → index.js} +5 -6
- package/browser/Plugins/PolygonMask/pathseg.js +54 -44
- package/browser/Shapes/Circle/CircleDrawer.d.ts +1 -1
- package/browser/Shapes/Circle/index.d.ts +2 -2
- package/browser/Shapes/Image/ImageDrawer.d.ts +3 -7
- package/browser/Shapes/Image/ImageDrawer.js +28 -111
- package/browser/Shapes/Image/Utils.d.ts +8 -5
- package/browser/Shapes/Image/Utils.js +71 -37
- package/browser/Shapes/Image/index.d.ts +2 -2
- package/browser/Shapes/Line/LineDrawer.d.ts +1 -1
- package/browser/Shapes/Line/index.d.ts +2 -2
- package/browser/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
- package/browser/Shapes/Polygon/PolygonDrawerBase.d.ts +1 -1
- package/browser/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
- package/browser/Shapes/Polygon/index.d.ts +4 -4
- package/browser/Shapes/Square/SquareDrawer.d.ts +1 -1
- package/browser/Shapes/Square/index.d.ts +2 -2
- package/browser/Shapes/Star/StarDrawer.d.ts +1 -1
- package/browser/Shapes/Star/index.d.ts +2 -2
- package/browser/Shapes/Text/TextDrawer.d.ts +1 -2
- package/browser/Shapes/Text/index.d.ts +2 -2
- package/browser/Updaters/Angle/AngleUpdater.d.ts +1 -3
- package/browser/Updaters/Angle/AngleUpdater.js +8 -9
- package/browser/Updaters/Angle/index.d.ts +2 -2
- package/browser/Updaters/Color/ColorUpdater.d.ts +1 -3
- package/browser/Updaters/Color/ColorUpdater.js +3 -4
- package/browser/Updaters/Color/index.d.ts +2 -2
- package/browser/Updaters/Life/LifeUpdater.d.ts +1 -3
- package/browser/Updaters/Life/index.d.ts +2 -2
- package/browser/Updaters/Opacity/OpacityUpdater.d.ts +1 -3
- package/browser/Updaters/Opacity/OpacityUpdater.js +13 -14
- package/browser/Updaters/Opacity/index.d.ts +2 -2
- package/browser/Updaters/OutModes/IBounceData.d.ts +1 -2
- package/browser/Updaters/OutModes/OutOfCanvasUpdater.d.ts +1 -3
- package/browser/Updaters/OutModes/OutOfCanvasUpdater.js +19 -20
- package/browser/Updaters/OutModes/Utils.js +12 -13
- package/browser/Updaters/OutModes/index.d.ts +2 -2
- package/browser/Updaters/Roll/RollUpdater.d.ts +1 -2
- package/browser/Updaters/Roll/RollUpdater.js +4 -5
- package/browser/Updaters/Roll/index.d.ts +2 -2
- package/browser/Updaters/Size/SizeUpdater.d.ts +1 -2
- package/browser/Updaters/Size/SizeUpdater.js +6 -7
- package/browser/Updaters/Size/index.d.ts +2 -2
- package/browser/Updaters/StrokeColor/StrokeColorUpdater.d.ts +1 -3
- package/browser/Updaters/StrokeColor/StrokeColorUpdater.js +3 -4
- package/browser/Updaters/StrokeColor/index.d.ts +2 -2
- package/browser/Updaters/Tilt/TiltUpdater.d.ts +1 -3
- package/browser/Updaters/Tilt/TiltUpdater.js +8 -9
- package/browser/Updaters/Tilt/index.d.ts +2 -2
- package/browser/Updaters/Wobble/WobbleUpdater.d.ts +1 -3
- package/browser/Updaters/Wobble/index.d.ts +2 -2
- package/browser/Utils/CanvasUtils.d.ts +3 -3
- package/browser/Utils/CanvasUtils.js +4 -5
- package/browser/Utils/ColorUtils.d.ts +1 -1
- package/browser/Utils/ColorUtils.js +2 -3
- package/browser/Utils/NumberUtils.d.ts +2 -2
- package/browser/Utils/NumberUtils.js +18 -19
- package/browser/Utils/Utils.d.ts +1 -1
- package/browser/Utils/Utils.js +10 -14
- package/browser/Utils/index.d.ts +0 -9
- package/browser/Utils/index.js +0 -9
- package/browser/{main.d.ts → engine.d.ts} +4 -6
- package/browser/{main.js → engine.js} +10 -11
- package/browser/full.d.ts +2 -2
- package/browser/full.js +3 -3
- package/browser/index.d.ts +6 -16
- package/browser/index.engine.d.ts +13 -0
- package/browser/index.engine.js +12 -0
- package/browser/index.js +5 -13
- package/browser/index.slim.d.ts +6 -16
- package/browser/index.slim.js +5 -13
- package/browser/pjs.d.ts +3 -3
- package/browser/pjs.js +6 -5
- package/browser/slim.d.ts +2 -2
- package/{esm/main.d.ts → engine.d.ts} +2 -4
- package/{main.js → engine.js} +24 -25
- package/esm/Core/Canvas.d.ts +2 -2
- package/esm/Core/Canvas.js +25 -15
- package/esm/Core/Container.d.ts +2 -3
- package/esm/Core/Container.js +2 -3
- package/esm/Core/Interfaces/ICircleBouncer.d.ts +1 -1
- package/esm/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
- package/esm/Core/Interfaces/IParticle.d.ts +1 -1
- package/esm/Core/Interfaces/index.d.ts +3 -1
- package/esm/Core/Interfaces/index.js +3 -1
- package/esm/Core/Loader.js +6 -10
- package/esm/Core/Particle.d.ts +2 -5
- package/esm/Core/Particle.js +13 -15
- package/esm/Core/Particles.d.ts +1 -1
- package/esm/Core/Particles.js +8 -14
- package/esm/{Utils → Core/Utils}/Circle.d.ts +1 -1
- package/esm/{Utils → Core/Utils}/Circle.js +1 -1
- package/{Utils → esm/Core/Utils}/CircleWarp.d.ts +1 -2
- package/esm/{Utils → Core/Utils}/CircleWarp.js +0 -0
- package/esm/{Utils → Core/Utils}/Constants.d.ts +1 -1
- package/esm/{Utils → Core/Utils}/Constants.js +1 -1
- package/esm/{Utils → Core/Utils}/EventListeners.d.ts +1 -1
- package/esm/{Utils → Core/Utils}/EventListeners.js +11 -12
- package/{browser/Core → esm/Core/Utils}/ExternalInteractorBase.d.ts +4 -4
- package/esm/Core/{ExternalInteractorBase.js → Utils/ExternalInteractorBase.js} +1 -2
- package/{Core → esm/Core/Utils}/FrameManager.d.ts +1 -1
- package/esm/Core/{FrameManager.js → Utils/FrameManager.js} +0 -0
- package/{Core → esm/Core/Utils}/InteractionManager.d.ts +3 -3
- package/esm/Core/{InteractionManager.js → Utils/InteractionManager.js} +2 -3
- package/{browser/Core → esm/Core/Utils}/ParticlesInteractorBase.d.ts +4 -4
- package/{browser/Core → esm/Core/Utils}/ParticlesInteractorBase.js +1 -2
- package/{Core/Particle/Mover.d.ts → esm/Core/Utils/ParticlesMover.d.ts} +1 -1
- package/esm/Core/{Particle/Mover.js → Utils/ParticlesMover.js} +4 -5
- package/{Utils → esm/Core/Utils}/Plugins.d.ts +5 -5
- package/esm/{Utils → Core/Utils}/Plugins.js +0 -0
- package/esm/{Utils → Core/Utils}/Point.d.ts +2 -2
- package/esm/{Utils → Core/Utils}/Point.js +0 -0
- package/esm/{Utils → Core/Utils}/QuadTree.d.ts +3 -3
- package/esm/{Utils → Core/Utils}/QuadTree.js +1 -1
- package/{Utils → esm/Core/Utils}/Range.d.ts +1 -1
- package/esm/{Utils → Core/Utils}/Range.js +0 -0
- package/{Utils → esm/Core/Utils}/Rectangle.d.ts +1 -2
- package/esm/{Utils → Core/Utils}/Rectangle.js +0 -0
- package/esm/Core/{Particle → Utils}/Vector.d.ts +0 -0
- package/esm/Core/{Particle → Utils}/Vector.js +0 -0
- package/esm/Core/{Particle → Utils}/Vector3d.d.ts +0 -0
- package/esm/Core/{Particle → Utils}/Vector3d.js +0 -0
- package/esm/Core/Utils/index.d.ts +16 -0
- package/esm/Core/Utils/index.js +16 -0
- package/esm/Core/index.d.ts +8 -0
- package/esm/Core/index.js +8 -0
- package/esm/Enums/AnimationStatus.d.ts +1 -1
- package/esm/Enums/AnimationStatus.js +1 -5
- package/esm/Enums/Directions/MoveDirection.d.ts +1 -1
- package/esm/Enums/Directions/MoveDirection.js +1 -12
- package/esm/Enums/Directions/OutModeDirection.d.ts +1 -1
- package/esm/Enums/Directions/OutModeDirection.js +1 -7
- package/esm/Enums/Directions/RotateDirection.d.ts +1 -1
- package/esm/Enums/Directions/RotateDirection.js +1 -6
- package/esm/Enums/Directions/TiltDirection.d.ts +1 -1
- package/esm/Enums/Directions/TiltDirection.js +1 -6
- package/esm/Enums/InteractivityDetect.d.ts +1 -1
- package/esm/Enums/InteractivityDetect.js +1 -6
- package/esm/Enums/Modes/ClickMode.d.ts +1 -1
- package/esm/Enums/Modes/ClickMode.js +1 -10
- package/esm/Enums/Modes/CollisionMode.d.ts +1 -1
- package/esm/Enums/Modes/CollisionMode.js +1 -6
- package/esm/Enums/Modes/DestroyMode.d.ts +1 -1
- package/esm/Enums/Modes/DestroyMode.js +1 -5
- package/esm/Enums/Modes/DivMode.d.ts +1 -1
- package/esm/Enums/Modes/DivMode.js +1 -6
- package/esm/Enums/Modes/HoverMode.d.ts +1 -1
- package/esm/Enums/Modes/HoverMode.js +1 -12
- package/esm/Enums/Modes/OutMode.d.ts +1 -1
- package/esm/Enums/Modes/OutMode.js +1 -10
- package/esm/Enums/Modes/ResponsiveMode.d.ts +1 -1
- package/esm/Enums/Modes/ResponsiveMode.js +1 -5
- package/esm/Enums/Modes/RollMode.d.ts +1 -1
- package/esm/Enums/Modes/RollMode.js +1 -6
- package/esm/Enums/Modes/SizeMode.d.ts +1 -1
- package/esm/Enums/Modes/SizeMode.js +1 -5
- package/esm/Enums/Modes/ThemeMode.d.ts +1 -1
- package/esm/Enums/Modes/ThemeMode.js +1 -6
- package/esm/Enums/Types/AlterType.d.ts +1 -1
- package/esm/Enums/Types/AlterType.js +1 -5
- package/esm/Enums/Types/DestroyType.d.ts +1 -1
- package/esm/Enums/Types/DestroyType.js +1 -6
- package/esm/Enums/Types/DivType.d.ts +1 -1
- package/esm/Enums/Types/DivType.js +1 -5
- package/esm/Enums/Types/EasingType.d.ts +1 -1
- package/esm/Enums/Types/EasingType.js +1 -11
- package/esm/Enums/Types/GradientType.d.ts +1 -1
- package/esm/Enums/Types/GradientType.js +1 -6
- package/esm/Enums/Types/InteractorType.d.ts +1 -1
- package/esm/Enums/Types/InteractorType.js +1 -5
- package/esm/Enums/Types/OrbitType.d.ts +1 -1
- package/esm/Enums/Types/OrbitType.js +1 -5
- package/esm/Enums/Types/ShapeType.d.ts +1 -1
- package/esm/Enums/Types/ShapeType.js +1 -14
- package/esm/Enums/Types/StartValueType.d.ts +1 -1
- package/esm/Enums/Types/StartValueType.js +1 -6
- package/esm/Interactions/External/Attract/Attractor.d.ts +2 -2
- package/esm/Interactions/External/Attract/Attractor.js +5 -7
- package/esm/Interactions/External/Attract/index.d.ts +2 -2
- package/esm/Interactions/External/Bounce/Bouncer.d.ts +2 -2
- package/esm/Interactions/External/Bounce/Bouncer.js +7 -9
- package/esm/Interactions/External/Bounce/index.d.ts +2 -2
- package/esm/Interactions/External/Bubble/Bubbler.d.ts +3 -3
- package/esm/Interactions/External/Bubble/Bubbler.js +16 -18
- package/esm/Interactions/External/Bubble/ProcessBubbleType.d.ts +1 -1
- package/esm/Interactions/External/Bubble/ProcessBubbleType.js +1 -6
- package/esm/Interactions/External/Bubble/index.d.ts +2 -2
- package/esm/Interactions/External/Connect/Connector.d.ts +2 -2
- package/esm/Interactions/External/Connect/Connector.js +2 -3
- package/esm/Interactions/External/Connect/index.d.ts +2 -2
- package/esm/Interactions/External/Grab/Grabber.d.ts +2 -2
- package/esm/Interactions/External/Grab/Grabber.js +3 -4
- package/esm/Interactions/External/Grab/index.d.ts +2 -2
- package/esm/Interactions/External/Repulse/Repulser.d.ts +2 -2
- package/esm/Interactions/External/Repulse/Repulser.js +8 -10
- package/esm/Interactions/External/Repulse/index.d.ts +2 -2
- package/esm/Interactions/External/Trail/TrailMaker.d.ts +2 -3
- package/esm/Interactions/External/Trail/TrailMaker.js +3 -4
- package/esm/Interactions/External/Trail/index.d.ts +2 -2
- package/esm/Interactions/Particles/Attract/Attractor.d.ts +2 -4
- package/esm/Interactions/Particles/Attract/Attractor.js +1 -1
- package/esm/Interactions/Particles/Attract/index.d.ts +2 -2
- package/esm/Interactions/Particles/Collisions/Collider.d.ts +2 -3
- package/esm/Interactions/Particles/Collisions/Collider.js +4 -5
- package/esm/Interactions/Particles/Collisions/index.d.ts +2 -2
- package/esm/Interactions/Particles/Links/LinkInstance.d.ts +1 -3
- package/esm/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
- package/esm/Interactions/Particles/Links/Linker.d.ts +3 -4
- package/esm/Interactions/Particles/Links/Linker.js +2 -2
- package/esm/Interactions/Particles/Links/index.d.ts +2 -3
- package/esm/Interactions/Particles/Links/index.js +1 -4
- package/esm/Interactions/Particles/Links/interaction.d.ts +2 -0
- package/esm/Interactions/Particles/Links/interaction.js +4 -0
- package/esm/Interactions/Particles/Links/plugin.d.ts +2 -2
- package/esm/Interactions/Particles/Links/plugin.js +2 -2
- package/esm/Options/Classes/AnimatableGradient.js +3 -4
- package/esm/Options/Classes/Interactivity/Events/DivEvent.js +1 -2
- package/esm/Options/Classes/Interactivity/Interactivity.js +5 -6
- package/esm/Options/Classes/Interactivity/Modes/Attract.js +1 -2
- package/esm/Options/Classes/Interactivity/Modes/RepulseBase.js +1 -2
- package/esm/Options/Classes/Options.d.ts +1 -0
- package/esm/Options/Classes/Options.js +9 -7
- package/esm/Options/Classes/Particles/Collisions/Collisions.js +1 -2
- package/esm/Options/Classes/Particles/Destroy/Destroy.js +1 -2
- package/esm/Options/Classes/Particles/Move/Move.js +1 -2
- package/esm/Options/Classes/Particles/Move/OutModes.js +1 -2
- package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -3
- package/esm/Options/Classes/Particles/Roll/Roll.js +1 -2
- package/esm/Options/Classes/Particles/Rotate/Rotate.js +1 -2
- package/esm/Options/Classes/Particles/Shape/Shape.js +13 -14
- package/esm/Options/Classes/Particles/Size/SizeAnimation.js +2 -3
- package/esm/Options/Classes/Particles/Tilt/Tilt.js +1 -2
- package/esm/Options/Classes/Responsive.js +4 -5
- package/esm/Options/Classes/Theme/ThemeDefault.js +1 -2
- package/esm/Options/Interfaces/IOptions.d.ts +1 -0
- package/esm/Plugins/Absorbers/AbsorberContainer.d.ts +1 -1
- package/esm/Plugins/Absorbers/AbsorberInstance.d.ts +2 -4
- package/esm/Plugins/Absorbers/AbsorberInstance.js +4 -5
- package/esm/Plugins/Absorbers/Absorbers.d.ts +1 -4
- package/esm/Plugins/Absorbers/Absorbers.js +1 -2
- package/esm/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +1 -1
- package/esm/Plugins/Absorbers/Enums/AbsorberClickMode.js +1 -4
- package/esm/Plugins/Absorbers/index.d.ts +2 -0
- package/esm/Plugins/Absorbers/{plugin.js → index.js} +3 -4
- package/esm/Plugins/Emitters/EmitterContainer.d.ts +1 -1
- package/esm/Plugins/Emitters/EmitterInstance.d.ts +1 -2
- package/esm/Plugins/Emitters/EmitterInstance.js +3 -4
- package/esm/Plugins/Emitters/Emitters.d.ts +1 -2
- package/esm/Plugins/Emitters/Emitters.js +1 -2
- package/esm/Plugins/Emitters/EmittersMain.d.ts +2 -2
- package/esm/Plugins/Emitters/Enums/EmitterClickMode.d.ts +1 -1
- package/esm/Plugins/Emitters/Enums/EmitterClickMode.js +1 -4
- package/esm/Plugins/Emitters/Enums/EmitterShapeType.d.ts +1 -1
- package/esm/Plugins/Emitters/Enums/EmitterShapeType.js +1 -5
- package/esm/Plugins/Emitters/IEmitterShape.d.ts +1 -1
- package/esm/Plugins/Emitters/Options/Classes/Emitter.js +1 -2
- package/esm/Plugins/Emitters/Options/Classes/EmitterSize.js +1 -2
- package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +1 -1
- package/esm/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +1 -1
- package/esm/Plugins/Emitters/{plugin.d.ts → index.d.ts} +0 -0
- package/esm/Plugins/Emitters/{plugin.js → index.js} +3 -4
- package/esm/Plugins/PolygonMask/Enums/PolygonMaskInlineArrangement.d.ts +8 -0
- package/esm/Plugins/PolygonMask/{Options/Interfaces/ILocalSvg.js → Enums/PolygonMaskInlineArrangement.js} +0 -0
- package/esm/Plugins/PolygonMask/Enums/PolygonMaskMoveType.d.ts +4 -0
- package/esm/Plugins/PolygonMask/{Options/Interfaces/IMove.js → Enums/PolygonMaskMoveType.js} +0 -0
- package/{browser/Plugins/PolygonMask/Enums/Type.d.ts → esm/Plugins/PolygonMask/Enums/PolygonMaskType.d.ts} +1 -1
- package/esm/Plugins/PolygonMask/{types.js → Enums/PolygonMaskType.js} +0 -0
- package/esm/Plugins/PolygonMask/Enums/index.d.ts +3 -3
- package/esm/Plugins/PolygonMask/Enums/index.js +3 -3
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +13 -13
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMask.js +42 -42
- package/esm/Plugins/PolygonMask/Options/Classes/{Draw.d.ts → PolygonMaskDraw.d.ts} +5 -5
- package/esm/Plugins/PolygonMask/Options/Classes/{Draw.js → PolygonMaskDraw.js} +13 -12
- package/esm/Plugins/PolygonMask/Options/Classes/{DrawStroke.d.ts → PolygonMaskDrawStroke.d.ts} +3 -3
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.js +25 -0
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +9 -0
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.js +13 -0
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +11 -0
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.js +25 -0
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +10 -0
- package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.js +17 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +12 -13
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +8 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.js +1 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDrawStroke.d.ts +6 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDrawStroke.js +1 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.d.ts +4 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.js +1 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.d.ts → IPolygonMaskLocalSvg.d.ts} +2 -2
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.js +1 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.d.ts +5 -0
- package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.js +1 -0
- package/esm/Plugins/PolygonMask/PolygonMaskInstance.d.ts +2 -4
- package/esm/Plugins/PolygonMask/PolygonMaskInstance.js +24 -21
- package/esm/Plugins/PolygonMask/{types.d.ts → Types.d.ts} +0 -0
- package/esm/Plugins/PolygonMask/Types.js +1 -0
- package/{browser/Plugins/PolygonMask/utils.d.ts → esm/Plugins/PolygonMask/Utils.d.ts} +5 -5
- package/esm/Plugins/PolygonMask/{utils.js → Utils.js} +15 -12
- package/esm/Plugins/PolygonMask/index.d.ts +2 -0
- package/esm/Plugins/PolygonMask/{plugin.js → index.js} +4 -5
- package/esm/Plugins/PolygonMask/pathseg.js +54 -43
- package/esm/Shapes/Circle/CircleDrawer.d.ts +1 -1
- package/esm/Shapes/Circle/index.d.ts +2 -2
- package/esm/Shapes/Image/ImageDrawer.d.ts +3 -7
- package/esm/Shapes/Image/ImageDrawer.js +28 -108
- package/esm/Shapes/Image/Utils.d.ts +8 -5
- package/esm/Shapes/Image/Utils.js +67 -36
- package/esm/Shapes/Image/index.d.ts +2 -2
- package/esm/Shapes/Line/LineDrawer.d.ts +1 -1
- package/esm/Shapes/Line/index.d.ts +2 -2
- package/esm/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
- package/esm/Shapes/Polygon/PolygonDrawerBase.d.ts +1 -1
- package/esm/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
- package/esm/Shapes/Polygon/index.d.ts +4 -4
- package/esm/Shapes/Square/SquareDrawer.d.ts +1 -1
- package/esm/Shapes/Square/index.d.ts +2 -2
- package/esm/Shapes/Star/StarDrawer.d.ts +1 -1
- package/esm/Shapes/Star/index.d.ts +2 -2
- package/esm/Shapes/Text/TextDrawer.d.ts +1 -2
- package/esm/Shapes/Text/index.d.ts +2 -2
- package/esm/Updaters/Angle/AngleUpdater.d.ts +1 -3
- package/esm/Updaters/Angle/AngleUpdater.js +8 -9
- package/esm/Updaters/Angle/index.d.ts +2 -2
- package/esm/Updaters/Color/ColorUpdater.d.ts +1 -3
- package/esm/Updaters/Color/ColorUpdater.js +3 -4
- package/esm/Updaters/Color/index.d.ts +2 -2
- package/esm/Updaters/Life/LifeUpdater.d.ts +1 -3
- package/esm/Updaters/Life/index.d.ts +2 -2
- package/esm/Updaters/Opacity/OpacityUpdater.d.ts +1 -3
- package/esm/Updaters/Opacity/OpacityUpdater.js +13 -14
- package/esm/Updaters/Opacity/index.d.ts +2 -2
- package/esm/Updaters/OutModes/IBounceData.d.ts +1 -2
- package/esm/Updaters/OutModes/OutOfCanvasUpdater.d.ts +1 -3
- package/esm/Updaters/OutModes/OutOfCanvasUpdater.js +19 -20
- package/esm/Updaters/OutModes/Utils.js +12 -13
- package/esm/Updaters/OutModes/index.d.ts +2 -2
- package/esm/Updaters/Roll/RollUpdater.d.ts +1 -2
- package/esm/Updaters/Roll/RollUpdater.js +4 -5
- package/esm/Updaters/Roll/index.d.ts +2 -2
- package/esm/Updaters/Size/SizeUpdater.d.ts +1 -2
- package/esm/Updaters/Size/SizeUpdater.js +6 -7
- package/esm/Updaters/Size/index.d.ts +2 -2
- package/esm/Updaters/StrokeColor/StrokeColorUpdater.d.ts +1 -3
- package/esm/Updaters/StrokeColor/StrokeColorUpdater.js +3 -4
- package/esm/Updaters/StrokeColor/index.d.ts +2 -2
- package/esm/Updaters/Tilt/TiltUpdater.d.ts +1 -3
- package/esm/Updaters/Tilt/TiltUpdater.js +8 -9
- package/esm/Updaters/Tilt/index.d.ts +2 -2
- package/esm/Updaters/Wobble/WobbleUpdater.d.ts +1 -3
- package/esm/Updaters/Wobble/index.d.ts +2 -2
- package/esm/Utils/CanvasUtils.d.ts +3 -3
- package/esm/Utils/CanvasUtils.js +4 -5
- package/esm/Utils/ColorUtils.d.ts +1 -1
- package/esm/Utils/ColorUtils.js +2 -3
- package/esm/Utils/NumberUtils.d.ts +2 -2
- package/esm/Utils/NumberUtils.js +18 -19
- package/esm/Utils/Utils.d.ts +1 -1
- package/esm/Utils/Utils.js +10 -14
- package/esm/Utils/index.d.ts +0 -9
- package/esm/Utils/index.js +0 -9
- package/{main.d.ts → esm/engine.d.ts} +2 -4
- package/esm/{main.js → engine.js} +8 -9
- package/esm/full.d.ts +2 -2
- package/esm/full.js +3 -3
- package/esm/index.d.ts +6 -16
- package/esm/index.engine.d.ts +13 -0
- package/esm/index.engine.js +11 -0
- package/esm/index.js +5 -13
- package/esm/index.slim.d.ts +6 -16
- package/esm/index.slim.js +5 -13
- package/esm/pjs.d.ts +3 -3
- package/esm/pjs.js +6 -5
- package/esm/slim.d.ts +2 -2
- package/full.d.ts +2 -2
- package/full.js +6 -6
- package/index.d.ts +6 -16
- package/index.engine.d.ts +13 -0
- package/index.engine.js +27 -0
- package/index.js +7 -19
- package/index.slim.d.ts +6 -16
- package/index.slim.js +7 -19
- package/package.json +1 -1
- package/pjs.d.ts +3 -3
- package/pjs.js +6 -5
- package/report.html +2 -2
- package/report.slim.html +2 -2
- package/scripts/install.js +14 -3
- package/slim.d.ts +2 -2
- package/tsparticles.engine.js +6746 -0
- package/tsparticles.engine.min.js +2 -0
- package/tsparticles.interaction.external.attract.js +4976 -0
- package/tsparticles.interaction.external.attract.min.js +2 -0
- package/tsparticles.interaction.external.bounce.js +4997 -0
- package/tsparticles.interaction.external.bounce.min.js +2 -0
- package/tsparticles.interaction.external.bubble.js +5083 -0
- package/tsparticles.interaction.external.bubble.min.js +2 -0
- package/tsparticles.interaction.external.connect.js +4845 -0
- package/tsparticles.interaction.external.connect.min.js +2 -0
- package/tsparticles.interaction.external.grab.js +4851 -0
- package/tsparticles.interaction.external.grab.min.js +2 -0
- package/tsparticles.interaction.external.repulse.js +5028 -0
- package/tsparticles.interaction.external.repulse.min.js +2 -0
- package/tsparticles.interaction.external.trail.js +4853 -0
- package/tsparticles.interaction.external.trail.min.js +2 -0
- package/tsparticles.interaction.particles.attract.js +4834 -0
- package/tsparticles.interaction.particles.attract.min.js +2 -0
- package/tsparticles.interaction.particles.collisions.js +4999 -0
- package/tsparticles.interaction.particles.collisions.min.js +2 -0
- package/tsparticles.interaction.particles.links.js +5071 -0
- package/tsparticles.interaction.particles.links.min.js +2 -0
- package/tsparticles.js +1297 -1605
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.min.js +2 -0
- package/tsparticles.plugins.absorbers.js +5332 -0
- package/tsparticles.plugins.absorbers.min.js +2 -0
- package/tsparticles.plugins.emitters.js +5419 -0
- package/tsparticles.plugins.emitters.min.js +2 -0
- package/tsparticles.plugins.polygonMask.js +5862 -0
- package/tsparticles.plugins.polygonMask.min.js +2 -0
- package/tsparticles.shape.circle.js +59 -0
- package/tsparticles.shape.circle.min.js +2 -0
- package/tsparticles.shape.image.js +5021 -0
- package/tsparticles.shape.image.min.js +2 -0
- package/tsparticles.shape.line.js +60 -0
- package/tsparticles.shape.line.min.js +2 -0
- package/tsparticles.shape.polygon.js +131 -0
- package/tsparticles.shape.polygon.min.js +2 -0
- package/tsparticles.shape.square.js +62 -0
- package/tsparticles.shape.square.min.js +2 -0
- package/tsparticles.shape.star.js +71 -0
- package/tsparticles.shape.star.min.js +2 -0
- package/tsparticles.shape.text.js +4865 -0
- package/tsparticles.shape.text.min.js +2 -0
- package/tsparticles.slim.js +1075 -1336
- package/tsparticles.slim.min.js +2 -2
- package/tsparticles.updater.angle.js +4880 -0
- package/tsparticles.updater.angle.min.js +2 -0
- package/tsparticles.updater.color.js +4862 -0
- package/tsparticles.updater.color.min.js +2 -0
- package/tsparticles.updater.life.js +4864 -0
- package/tsparticles.updater.life.min.js +2 -0
- package/tsparticles.updater.opacity.js +4914 -0
- package/tsparticles.updater.opacity.min.js +2 -0
- package/tsparticles.updater.outModes.js +4998 -0
- package/tsparticles.updater.outModes.min.js +2 -0
- package/tsparticles.updater.roll.js +4862 -0
- package/tsparticles.updater.roll.min.js +2 -0
- package/tsparticles.updater.size.js +4870 -0
- package/tsparticles.updater.size.min.js +2 -0
- package/tsparticles.updater.strokeColor.js +4875 -0
- package/tsparticles.updater.strokeColor.min.js +2 -0
- package/tsparticles.updater.tilt.js +4881 -0
- package/tsparticles.updater.tilt.min.js +2 -0
- package/tsparticles.updater.wobble.js +4850 -0
- package/tsparticles.updater.wobble.min.js +2 -0
- package/Plugins/Absorbers/plugin.d.ts +0 -2
- package/Plugins/PolygonMask/Enums/InlineArrangement.d.ts +0 -8
- package/Plugins/PolygonMask/Enums/InlineArrangement.js +0 -11
- package/Plugins/PolygonMask/Enums/MoveType.d.ts +0 -4
- package/Plugins/PolygonMask/Enums/MoveType.js +0 -8
- package/Plugins/PolygonMask/Enums/Type.js +0 -10
- package/Plugins/PolygonMask/Options/Classes/DrawStroke.js +0 -28
- package/Plugins/PolygonMask/Options/Classes/Inline.d.ts +0 -9
- package/Plugins/PolygonMask/Options/Classes/Inline.js +0 -17
- package/Plugins/PolygonMask/Options/Classes/LocalSvg.d.ts +0 -11
- package/Plugins/PolygonMask/Options/Classes/LocalSvg.js +0 -28
- package/Plugins/PolygonMask/Options/Classes/Move.d.ts +0 -10
- package/Plugins/PolygonMask/Options/Classes/Move.js +0 -21
- package/Plugins/PolygonMask/Options/Interfaces/IDraw.d.ts +0 -8
- package/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.d.ts +0 -6
- package/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +0 -4
- package/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +0 -5
- package/Plugins/PolygonMask/plugin.d.ts +0 -2
- package/browser/Plugins/Absorbers/plugin.d.ts +0 -2
- package/browser/Plugins/PolygonMask/Enums/InlineArrangement.d.ts +0 -8
- package/browser/Plugins/PolygonMask/Enums/InlineArrangement.js +0 -8
- package/browser/Plugins/PolygonMask/Enums/MoveType.d.ts +0 -4
- package/browser/Plugins/PolygonMask/Enums/MoveType.js +0 -5
- package/browser/Plugins/PolygonMask/Enums/Type.js +0 -7
- package/browser/Plugins/PolygonMask/Options/Classes/DrawStroke.js +0 -27
- package/browser/Plugins/PolygonMask/Options/Classes/Inline.d.ts +0 -12
- package/browser/Plugins/PolygonMask/Options/Classes/Inline.js +0 -16
- package/browser/Plugins/PolygonMask/Options/Classes/LocalSvg.js +0 -27
- package/browser/Plugins/PolygonMask/Options/Classes/Move.d.ts +0 -13
- package/browser/Plugins/PolygonMask/Options/Classes/Move.js +0 -20
- package/browser/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +0 -7
- package/browser/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +0 -8
- package/browser/Plugins/PolygonMask/plugin.d.ts +0 -2
- package/esm/Plugins/Absorbers/plugin.d.ts +0 -2
- package/esm/Plugins/PolygonMask/Enums/InlineArrangement.d.ts +0 -8
- package/esm/Plugins/PolygonMask/Enums/InlineArrangement.js +0 -8
- package/esm/Plugins/PolygonMask/Enums/MoveType.d.ts +0 -4
- package/esm/Plugins/PolygonMask/Enums/MoveType.js +0 -5
- package/esm/Plugins/PolygonMask/Enums/Type.js +0 -7
- package/esm/Plugins/PolygonMask/Options/Classes/DrawStroke.js +0 -24
- package/esm/Plugins/PolygonMask/Options/Classes/Inline.d.ts +0 -9
- package/esm/Plugins/PolygonMask/Options/Classes/Inline.js +0 -13
- package/esm/Plugins/PolygonMask/Options/Classes/LocalSvg.d.ts +0 -11
- package/esm/Plugins/PolygonMask/Options/Classes/LocalSvg.js +0 -24
- package/esm/Plugins/PolygonMask/Options/Classes/Move.d.ts +0 -10
- package/esm/Plugins/PolygonMask/Options/Classes/Move.js +0 -17
- package/esm/Plugins/PolygonMask/Options/Interfaces/IDraw.d.ts +0 -8
- package/esm/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.d.ts +0 -6
- package/esm/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +0 -4
- package/esm/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +0 -5
- package/esm/Plugins/PolygonMask/plugin.d.ts +0 -2
- package/tsparticles.pathseg.js +0 -1472
|
@@ -0,0 +1,4914 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if (typeof exports === "object" && typeof module === "object") module.exports = factory(); else if (typeof define === "function" && define.amd) define([], factory); else {
|
|
3
|
+
var a = factory();
|
|
4
|
+
for (var i in a) (typeof exports === "object" ? exports : root)[i] = a[i];
|
|
5
|
+
}
|
|
6
|
+
})(window, (function() {
|
|
7
|
+
return function() {
|
|
8
|
+
"use strict";
|
|
9
|
+
var __webpack_require__ = {};
|
|
10
|
+
!function() {
|
|
11
|
+
__webpack_require__.d = function(exports, definition) {
|
|
12
|
+
for (var key in definition) {
|
|
13
|
+
if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}();
|
|
22
|
+
!function() {
|
|
23
|
+
__webpack_require__.o = function(obj, prop) {
|
|
24
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
25
|
+
};
|
|
26
|
+
}();
|
|
27
|
+
!function() {
|
|
28
|
+
__webpack_require__.r = function(exports) {
|
|
29
|
+
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
30
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
31
|
+
value: "Module"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}();
|
|
39
|
+
var __webpack_exports__ = {};
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
+
loadOpacityUpdater: function() {
|
|
43
|
+
return loadOpacityUpdater;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
class Circle_Circle extends(null && Range){
|
|
47
|
+
constructor(x, y, radius) {
|
|
48
|
+
super(x, y);
|
|
49
|
+
this.radius = radius;
|
|
50
|
+
}
|
|
51
|
+
contains(point) {
|
|
52
|
+
return getDistance(point, this.position) <= this.radius;
|
|
53
|
+
}
|
|
54
|
+
intersects(range) {
|
|
55
|
+
const rect = range;
|
|
56
|
+
const circle = range;
|
|
57
|
+
const pos1 = this.position;
|
|
58
|
+
const pos2 = range.position;
|
|
59
|
+
const xDist = Math.abs(pos2.x - pos1.x);
|
|
60
|
+
const yDist = Math.abs(pos2.y - pos1.y);
|
|
61
|
+
const r = this.radius;
|
|
62
|
+
if (circle.radius !== undefined) {
|
|
63
|
+
const rSum = r + circle.radius;
|
|
64
|
+
const dist = Math.sqrt(xDist * xDist + yDist + yDist);
|
|
65
|
+
return rSum > dist;
|
|
66
|
+
} else if (rect.size !== undefined) {
|
|
67
|
+
const w = rect.size.width;
|
|
68
|
+
const h = rect.size.height;
|
|
69
|
+
const edges = Math.pow(xDist - w, 2) + Math.pow(yDist - h, 2);
|
|
70
|
+
if (xDist > r + w || yDist > r + h) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (xDist <= w || yDist <= h) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return edges <= r * r;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
class CircleWarp_CircleWarp extends(null && Circle){
|
|
82
|
+
constructor(x, y, radius, canvasSize) {
|
|
83
|
+
super(x, y, radius);
|
|
84
|
+
this.canvasSize = canvasSize;
|
|
85
|
+
this.canvasSize = {
|
|
86
|
+
height: canvasSize.height,
|
|
87
|
+
width: canvasSize.width
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
contains(point) {
|
|
91
|
+
if (super.contains(point)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
const posNE = {
|
|
95
|
+
x: point.x - this.canvasSize.width,
|
|
96
|
+
y: point.y
|
|
97
|
+
};
|
|
98
|
+
if (super.contains(posNE)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
const posSE = {
|
|
102
|
+
x: point.x - this.canvasSize.width,
|
|
103
|
+
y: point.y - this.canvasSize.height
|
|
104
|
+
};
|
|
105
|
+
if (super.contains(posSE)) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
const posSW = {
|
|
109
|
+
x: point.x,
|
|
110
|
+
y: point.y - this.canvasSize.height
|
|
111
|
+
};
|
|
112
|
+
return super.contains(posSW);
|
|
113
|
+
}
|
|
114
|
+
intersects(range) {
|
|
115
|
+
if (super.intersects(range)) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
const rect = range;
|
|
119
|
+
const circle = range;
|
|
120
|
+
const newPos = {
|
|
121
|
+
x: range.position.x - this.canvasSize.width,
|
|
122
|
+
y: range.position.y - this.canvasSize.height
|
|
123
|
+
};
|
|
124
|
+
if (circle.radius !== undefined) {
|
|
125
|
+
const biggerCircle = new Circle(newPos.x, newPos.y, circle.radius * 2);
|
|
126
|
+
return super.intersects(biggerCircle);
|
|
127
|
+
} else if (rect.size !== undefined) {
|
|
128
|
+
const rectSW = new Rectangle(newPos.x, newPos.y, rect.size.width * 2, rect.size.height * 2);
|
|
129
|
+
return super.intersects(rectSW);
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
class Constants_Constants {}
|
|
135
|
+
Constants_Constants.generatedAttribute = "generated";
|
|
136
|
+
Constants_Constants.randomColorValue = "random";
|
|
137
|
+
Constants_Constants.midColorValue = "mid";
|
|
138
|
+
Constants_Constants.touchEndEvent = "touchend";
|
|
139
|
+
Constants_Constants.mouseDownEvent = "mousedown";
|
|
140
|
+
Constants_Constants.mouseUpEvent = "mouseup";
|
|
141
|
+
Constants_Constants.mouseMoveEvent = "mousemove";
|
|
142
|
+
Constants_Constants.touchStartEvent = "touchstart";
|
|
143
|
+
Constants_Constants.touchMoveEvent = "touchmove";
|
|
144
|
+
Constants_Constants.mouseLeaveEvent = "mouseleave";
|
|
145
|
+
Constants_Constants.mouseOutEvent = "mouseout";
|
|
146
|
+
Constants_Constants.touchCancelEvent = "touchcancel";
|
|
147
|
+
Constants_Constants.resizeEvent = "resize";
|
|
148
|
+
Constants_Constants.visibilityChangeEvent = "visibilitychange";
|
|
149
|
+
Constants_Constants.noPolygonDataLoaded = "No polygon data loaded.";
|
|
150
|
+
Constants_Constants.noPolygonFound = "No polygon found, you need to specify SVG url in config.";
|
|
151
|
+
function manageListener(element, event, handler, add, options) {
|
|
152
|
+
if (add) {
|
|
153
|
+
let addOptions = {
|
|
154
|
+
passive: true
|
|
155
|
+
};
|
|
156
|
+
if (typeof options === "boolean") {
|
|
157
|
+
addOptions.capture = options;
|
|
158
|
+
} else if (options !== undefined) {
|
|
159
|
+
addOptions = options;
|
|
160
|
+
}
|
|
161
|
+
element.addEventListener(event, handler, addOptions);
|
|
162
|
+
} else {
|
|
163
|
+
const removeOptions = options;
|
|
164
|
+
element.removeEventListener(event, handler, removeOptions);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
class EventListeners_EventListeners {
|
|
168
|
+
constructor(container) {
|
|
169
|
+
this.container = container;
|
|
170
|
+
this.canPush = true;
|
|
171
|
+
this.mouseMoveHandler = e => this.mouseTouchMove(e);
|
|
172
|
+
this.touchStartHandler = e => this.mouseTouchMove(e);
|
|
173
|
+
this.touchMoveHandler = e => this.mouseTouchMove(e);
|
|
174
|
+
this.touchEndHandler = () => this.mouseTouchFinish();
|
|
175
|
+
this.mouseLeaveHandler = () => this.mouseTouchFinish();
|
|
176
|
+
this.touchCancelHandler = () => this.mouseTouchFinish();
|
|
177
|
+
this.touchEndClickHandler = e => this.mouseTouchClick(e);
|
|
178
|
+
this.mouseUpHandler = e => this.mouseTouchClick(e);
|
|
179
|
+
this.mouseDownHandler = () => this.mouseDown();
|
|
180
|
+
this.visibilityChangeHandler = () => this.handleVisibilityChange();
|
|
181
|
+
this.themeChangeHandler = e => this.handleThemeChange(e);
|
|
182
|
+
this.oldThemeChangeHandler = e => this.handleThemeChange(e);
|
|
183
|
+
this.resizeHandler = () => this.handleWindowResize();
|
|
184
|
+
}
|
|
185
|
+
addListeners() {
|
|
186
|
+
this.manageListeners(true);
|
|
187
|
+
}
|
|
188
|
+
removeListeners() {
|
|
189
|
+
this.manageListeners(false);
|
|
190
|
+
}
|
|
191
|
+
manageListeners(add) {
|
|
192
|
+
var _a;
|
|
193
|
+
const container = this.container;
|
|
194
|
+
const options = container.actualOptions;
|
|
195
|
+
const detectType = options.interactivity.detectsOn;
|
|
196
|
+
let mouseLeaveEvent = Constants.mouseLeaveEvent;
|
|
197
|
+
if (detectType === "window") {
|
|
198
|
+
container.interactivity.element = window;
|
|
199
|
+
mouseLeaveEvent = Constants.mouseOutEvent;
|
|
200
|
+
} else if (detectType === "parent" && container.canvas.element) {
|
|
201
|
+
const canvasEl = container.canvas.element;
|
|
202
|
+
container.interactivity.element = (_a = canvasEl.parentElement) !== null && _a !== void 0 ? _a : canvasEl.parentNode;
|
|
203
|
+
} else {
|
|
204
|
+
container.interactivity.element = container.canvas.element;
|
|
205
|
+
}
|
|
206
|
+
const mediaMatch = !isSsr() && typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
|
|
207
|
+
if (mediaMatch) {
|
|
208
|
+
if (mediaMatch.addEventListener !== undefined) {
|
|
209
|
+
manageListener(mediaMatch, "change", this.themeChangeHandler, add);
|
|
210
|
+
} else if (mediaMatch.addListener !== undefined) {
|
|
211
|
+
if (add) {
|
|
212
|
+
mediaMatch.addListener(this.oldThemeChangeHandler);
|
|
213
|
+
} else {
|
|
214
|
+
mediaMatch.removeListener(this.oldThemeChangeHandler);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const interactivityEl = container.interactivity.element;
|
|
219
|
+
if (!interactivityEl) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const html = interactivityEl;
|
|
223
|
+
if (options.interactivity.events.onHover.enable || options.interactivity.events.onClick.enable) {
|
|
224
|
+
manageListener(interactivityEl, Constants.mouseMoveEvent, this.mouseMoveHandler, add);
|
|
225
|
+
manageListener(interactivityEl, Constants.touchStartEvent, this.touchStartHandler, add);
|
|
226
|
+
manageListener(interactivityEl, Constants.touchMoveEvent, this.touchMoveHandler, add);
|
|
227
|
+
if (!options.interactivity.events.onClick.enable) {
|
|
228
|
+
manageListener(interactivityEl, Constants.touchEndEvent, this.touchEndHandler, add);
|
|
229
|
+
} else {
|
|
230
|
+
manageListener(interactivityEl, Constants.touchEndEvent, this.touchEndClickHandler, add);
|
|
231
|
+
manageListener(interactivityEl, Constants.mouseUpEvent, this.mouseUpHandler, add);
|
|
232
|
+
manageListener(interactivityEl, Constants.mouseDownEvent, this.mouseDownHandler, add);
|
|
233
|
+
}
|
|
234
|
+
manageListener(interactivityEl, mouseLeaveEvent, this.mouseLeaveHandler, add);
|
|
235
|
+
manageListener(interactivityEl, Constants.touchCancelEvent, this.touchCancelHandler, add);
|
|
236
|
+
}
|
|
237
|
+
if (container.canvas.element) {
|
|
238
|
+
container.canvas.element.style.pointerEvents = html === container.canvas.element ? "initial" : "none";
|
|
239
|
+
}
|
|
240
|
+
if (options.interactivity.events.resize) {
|
|
241
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
242
|
+
if (this.resizeObserver && !add) {
|
|
243
|
+
if (container.canvas.element) {
|
|
244
|
+
this.resizeObserver.unobserve(container.canvas.element);
|
|
245
|
+
}
|
|
246
|
+
this.resizeObserver.disconnect();
|
|
247
|
+
delete this.resizeObserver;
|
|
248
|
+
} else if (!this.resizeObserver && add && container.canvas.element) {
|
|
249
|
+
this.resizeObserver = new ResizeObserver((entries => {
|
|
250
|
+
const entry = entries.find((e => e.target === container.canvas.element));
|
|
251
|
+
if (!entry) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.handleWindowResize();
|
|
255
|
+
}));
|
|
256
|
+
this.resizeObserver.observe(container.canvas.element);
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
manageListener(window, Constants.resizeEvent, this.resizeHandler, add);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (document) {
|
|
263
|
+
manageListener(document, Constants.visibilityChangeEvent, this.visibilityChangeHandler, add, false);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
handleWindowResize() {
|
|
267
|
+
if (this.resizeTimeout) {
|
|
268
|
+
clearTimeout(this.resizeTimeout);
|
|
269
|
+
delete this.resizeTimeout;
|
|
270
|
+
}
|
|
271
|
+
this.resizeTimeout = setTimeout((async () => {
|
|
272
|
+
var _a;
|
|
273
|
+
return await ((_a = this.container.canvas) === null || _a === void 0 ? void 0 : _a.windowResize());
|
|
274
|
+
}), 500);
|
|
275
|
+
}
|
|
276
|
+
handleVisibilityChange() {
|
|
277
|
+
const container = this.container;
|
|
278
|
+
const options = container.actualOptions;
|
|
279
|
+
this.mouseTouchFinish();
|
|
280
|
+
if (!options.pauseOnBlur) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (document === null || document === void 0 ? void 0 : document.hidden) {
|
|
284
|
+
container.pageHidden = true;
|
|
285
|
+
container.pause();
|
|
286
|
+
} else {
|
|
287
|
+
container.pageHidden = false;
|
|
288
|
+
if (container.getAnimationStatus()) {
|
|
289
|
+
container.play(true);
|
|
290
|
+
} else {
|
|
291
|
+
container.draw(true);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
mouseDown() {
|
|
296
|
+
const interactivity = this.container.interactivity;
|
|
297
|
+
if (interactivity) {
|
|
298
|
+
const mouse = interactivity.mouse;
|
|
299
|
+
mouse.clicking = true;
|
|
300
|
+
mouse.downPosition = mouse.position;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
mouseTouchMove(e) {
|
|
304
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
305
|
+
const container = this.container;
|
|
306
|
+
const options = container.actualOptions;
|
|
307
|
+
if (((_a = container.interactivity) === null || _a === void 0 ? void 0 : _a.element) === undefined) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
container.interactivity.mouse.inside = true;
|
|
311
|
+
let pos;
|
|
312
|
+
const canvas = container.canvas.element;
|
|
313
|
+
if (e.type.startsWith("mouse")) {
|
|
314
|
+
this.canPush = true;
|
|
315
|
+
const mouseEvent = e;
|
|
316
|
+
if (container.interactivity.element === window) {
|
|
317
|
+
if (canvas) {
|
|
318
|
+
const clientRect = canvas.getBoundingClientRect();
|
|
319
|
+
pos = {
|
|
320
|
+
x: mouseEvent.clientX - clientRect.left,
|
|
321
|
+
y: mouseEvent.clientY - clientRect.top
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
} else if (options.interactivity.detectsOn === "parent") {
|
|
325
|
+
const source = mouseEvent.target;
|
|
326
|
+
const target = mouseEvent.currentTarget;
|
|
327
|
+
const canvasEl = container.canvas.element;
|
|
328
|
+
if (source && target && canvasEl) {
|
|
329
|
+
const sourceRect = source.getBoundingClientRect();
|
|
330
|
+
const targetRect = target.getBoundingClientRect();
|
|
331
|
+
const canvasRect = canvasEl.getBoundingClientRect();
|
|
332
|
+
pos = {
|
|
333
|
+
x: mouseEvent.offsetX + 2 * sourceRect.left - (targetRect.left + canvasRect.left),
|
|
334
|
+
y: mouseEvent.offsetY + 2 * sourceRect.top - (targetRect.top + canvasRect.top)
|
|
335
|
+
};
|
|
336
|
+
} else {
|
|
337
|
+
pos = {
|
|
338
|
+
x: (_b = mouseEvent.offsetX) !== null && _b !== void 0 ? _b : mouseEvent.clientX,
|
|
339
|
+
y: (_c = mouseEvent.offsetY) !== null && _c !== void 0 ? _c : mouseEvent.clientY
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
if (mouseEvent.target === container.canvas.element) {
|
|
344
|
+
pos = {
|
|
345
|
+
x: (_d = mouseEvent.offsetX) !== null && _d !== void 0 ? _d : mouseEvent.clientX,
|
|
346
|
+
y: (_e = mouseEvent.offsetY) !== null && _e !== void 0 ? _e : mouseEvent.clientY
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
this.canPush = e.type !== "touchmove";
|
|
352
|
+
const touchEvent = e;
|
|
353
|
+
const lastTouch = touchEvent.touches[touchEvent.touches.length - 1];
|
|
354
|
+
const canvasRect = canvas === null || canvas === void 0 ? void 0 : canvas.getBoundingClientRect();
|
|
355
|
+
pos = {
|
|
356
|
+
x: lastTouch.clientX - ((_f = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.left) !== null && _f !== void 0 ? _f : 0),
|
|
357
|
+
y: lastTouch.clientY - ((_g = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.top) !== null && _g !== void 0 ? _g : 0)
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
const pxRatio = container.retina.pixelRatio;
|
|
361
|
+
if (pos) {
|
|
362
|
+
pos.x *= pxRatio;
|
|
363
|
+
pos.y *= pxRatio;
|
|
364
|
+
}
|
|
365
|
+
container.interactivity.mouse.position = pos;
|
|
366
|
+
container.interactivity.status = Constants.mouseMoveEvent;
|
|
367
|
+
}
|
|
368
|
+
mouseTouchFinish() {
|
|
369
|
+
const interactivity = this.container.interactivity;
|
|
370
|
+
if (interactivity === undefined) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const mouse = interactivity.mouse;
|
|
374
|
+
delete mouse.position;
|
|
375
|
+
delete mouse.clickPosition;
|
|
376
|
+
delete mouse.downPosition;
|
|
377
|
+
interactivity.status = Constants.mouseLeaveEvent;
|
|
378
|
+
mouse.inside = false;
|
|
379
|
+
mouse.clicking = false;
|
|
380
|
+
}
|
|
381
|
+
mouseTouchClick(e) {
|
|
382
|
+
const container = this.container;
|
|
383
|
+
const options = container.actualOptions;
|
|
384
|
+
const mouse = container.interactivity.mouse;
|
|
385
|
+
mouse.inside = true;
|
|
386
|
+
let handled = false;
|
|
387
|
+
const mousePosition = mouse.position;
|
|
388
|
+
if (mousePosition === undefined || !options.interactivity.events.onClick.enable) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
for (const [, plugin] of container.plugins) {
|
|
392
|
+
if (plugin.clickPositionValid !== undefined) {
|
|
393
|
+
handled = plugin.clickPositionValid(mousePosition);
|
|
394
|
+
if (handled) {
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!handled) {
|
|
400
|
+
this.doMouseTouchClick(e);
|
|
401
|
+
}
|
|
402
|
+
mouse.clicking = false;
|
|
403
|
+
}
|
|
404
|
+
doMouseTouchClick(e) {
|
|
405
|
+
const container = this.container;
|
|
406
|
+
const options = container.actualOptions;
|
|
407
|
+
if (this.canPush) {
|
|
408
|
+
const mousePos = container.interactivity.mouse.position;
|
|
409
|
+
if (mousePos) {
|
|
410
|
+
container.interactivity.mouse.clickPosition = {
|
|
411
|
+
x: mousePos.x,
|
|
412
|
+
y: mousePos.y
|
|
413
|
+
};
|
|
414
|
+
} else {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
container.interactivity.mouse.clickTime = (new Date).getTime();
|
|
418
|
+
const onClick = options.interactivity.events.onClick;
|
|
419
|
+
if (onClick.mode instanceof Array) {
|
|
420
|
+
for (const mode of onClick.mode) {
|
|
421
|
+
this.handleClickMode(mode);
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
this.handleClickMode(onClick.mode);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (e.type === "touchend") {
|
|
428
|
+
setTimeout((() => this.mouseTouchFinish()), 500);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
handleThemeChange(e) {
|
|
432
|
+
const mediaEvent = e;
|
|
433
|
+
const themeName = mediaEvent.matches ? this.container.options.defaultDarkTheme : this.container.options.defaultLightTheme;
|
|
434
|
+
const theme = this.container.options.themes.find((theme => theme.name === themeName));
|
|
435
|
+
if (theme && theme.default.auto) {
|
|
436
|
+
this.container.loadTheme(themeName);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
handleClickMode(mode) {
|
|
440
|
+
const container = this.container;
|
|
441
|
+
const options = container.actualOptions;
|
|
442
|
+
const pushNb = options.interactivity.modes.push.quantity;
|
|
443
|
+
const removeNb = options.interactivity.modes.remove.quantity;
|
|
444
|
+
switch (mode) {
|
|
445
|
+
case "push":
|
|
446
|
+
{
|
|
447
|
+
if (pushNb > 0) {
|
|
448
|
+
const pushOptions = options.interactivity.modes.push;
|
|
449
|
+
const group = itemFromArray([ undefined, ...pushOptions.groups ]);
|
|
450
|
+
const groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined;
|
|
451
|
+
container.particles.push(pushNb, container.interactivity.mouse, groupOptions, group);
|
|
452
|
+
}
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
case "remove":
|
|
457
|
+
container.particles.removeQuantity(removeNb);
|
|
458
|
+
break;
|
|
459
|
+
|
|
460
|
+
case "bubble":
|
|
461
|
+
container.bubble.clicking = true;
|
|
462
|
+
break;
|
|
463
|
+
|
|
464
|
+
case "repulse":
|
|
465
|
+
container.repulse.clicking = true;
|
|
466
|
+
container.repulse.count = 0;
|
|
467
|
+
for (const particle of container.repulse.particles) {
|
|
468
|
+
particle.velocity.setTo(particle.initialVelocity);
|
|
469
|
+
}
|
|
470
|
+
container.repulse.particles = [];
|
|
471
|
+
container.repulse.finish = false;
|
|
472
|
+
setTimeout((() => {
|
|
473
|
+
if (!container.destroyed) {
|
|
474
|
+
container.repulse.clicking = false;
|
|
475
|
+
}
|
|
476
|
+
}), options.interactivity.modes.repulse.duration * 1e3);
|
|
477
|
+
break;
|
|
478
|
+
|
|
479
|
+
case "attract":
|
|
480
|
+
container.attract.clicking = true;
|
|
481
|
+
container.attract.count = 0;
|
|
482
|
+
for (const particle of container.attract.particles) {
|
|
483
|
+
particle.velocity.setTo(particle.initialVelocity);
|
|
484
|
+
}
|
|
485
|
+
container.attract.particles = [];
|
|
486
|
+
container.attract.finish = false;
|
|
487
|
+
setTimeout((() => {
|
|
488
|
+
if (!container.destroyed) {
|
|
489
|
+
container.attract.clicking = false;
|
|
490
|
+
}
|
|
491
|
+
}), options.interactivity.modes.attract.duration * 1e3);
|
|
492
|
+
break;
|
|
493
|
+
|
|
494
|
+
case "pause":
|
|
495
|
+
if (container.getAnimationStatus()) {
|
|
496
|
+
container.pause();
|
|
497
|
+
} else {
|
|
498
|
+
container.play();
|
|
499
|
+
}
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
for (const [, plugin] of container.plugins) {
|
|
503
|
+
if (plugin.handleClickMode) {
|
|
504
|
+
plugin.handleClickMode(mode);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
class InteractionManager_InteractionManager {
|
|
510
|
+
constructor(container) {
|
|
511
|
+
this.container = container;
|
|
512
|
+
this.externalInteractors = [];
|
|
513
|
+
this.particleInteractors = [];
|
|
514
|
+
this.init();
|
|
515
|
+
}
|
|
516
|
+
init() {
|
|
517
|
+
const interactors = Plugins.getInteractors(this.container, true);
|
|
518
|
+
for (const interactor of interactors) {
|
|
519
|
+
switch (interactor.type) {
|
|
520
|
+
case 0:
|
|
521
|
+
this.externalInteractors.push(interactor);
|
|
522
|
+
break;
|
|
523
|
+
|
|
524
|
+
case 1:
|
|
525
|
+
this.particleInteractors.push(interactor);
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
externalInteract(delta) {
|
|
531
|
+
for (const interactor of this.externalInteractors) {
|
|
532
|
+
if (interactor.isEnabled()) {
|
|
533
|
+
interactor.interact(delta);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
particlesInteract(particle, delta) {
|
|
538
|
+
for (const interactor of this.externalInteractors) {
|
|
539
|
+
interactor.reset(particle);
|
|
540
|
+
}
|
|
541
|
+
for (const interactor of this.particleInteractors) {
|
|
542
|
+
if (interactor.isEnabled(particle)) {
|
|
543
|
+
interactor.interact(particle, delta);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
function applyDistance(particle) {
|
|
549
|
+
const initialPosition = particle.initialPosition;
|
|
550
|
+
const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
|
|
551
|
+
const dxFixed = Math.abs(dx), dyFixed = Math.abs(dy);
|
|
552
|
+
const hDistance = particle.retina.maxDistance.horizontal;
|
|
553
|
+
const vDistance = particle.retina.maxDistance.vertical;
|
|
554
|
+
if (!hDistance && !vDistance) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if ((hDistance && dxFixed >= hDistance || vDistance && dyFixed >= vDistance) && !particle.misplaced) {
|
|
558
|
+
particle.misplaced = !!hDistance && dxFixed > hDistance || !!vDistance && dyFixed > vDistance;
|
|
559
|
+
if (hDistance) {
|
|
560
|
+
particle.velocity.x = particle.velocity.y / 2 - particle.velocity.x;
|
|
561
|
+
}
|
|
562
|
+
if (vDistance) {
|
|
563
|
+
particle.velocity.y = particle.velocity.x / 2 - particle.velocity.y;
|
|
564
|
+
}
|
|
565
|
+
} else if ((!hDistance || dxFixed < hDistance) && (!vDistance || dyFixed < vDistance) && particle.misplaced) {
|
|
566
|
+
particle.misplaced = false;
|
|
567
|
+
} else if (particle.misplaced) {
|
|
568
|
+
const pos = particle.position, vel = particle.velocity;
|
|
569
|
+
if (hDistance && (pos.x < initialPosition.x && vel.x < 0 || pos.x > initialPosition.x && vel.x > 0)) {
|
|
570
|
+
vel.x *= -Math.random();
|
|
571
|
+
}
|
|
572
|
+
if (vDistance && (pos.y < initialPosition.y && vel.y < 0 || pos.y > initialPosition.y && vel.y > 0)) {
|
|
573
|
+
vel.y *= -Math.random();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
class ParticlesMover_ParticlesMover {
|
|
578
|
+
constructor(container) {
|
|
579
|
+
this.container = container;
|
|
580
|
+
}
|
|
581
|
+
move(particle, delta) {
|
|
582
|
+
if (particle.destroyed) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
this.moveParticle(particle, delta);
|
|
586
|
+
this.moveParallax(particle);
|
|
587
|
+
}
|
|
588
|
+
moveParticle(particle, delta) {
|
|
589
|
+
var _a, _b, _c;
|
|
590
|
+
var _d, _e;
|
|
591
|
+
const particleOptions = particle.options;
|
|
592
|
+
const moveOptions = particleOptions.move;
|
|
593
|
+
if (!moveOptions.enable) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
const container = this.container, slowFactor = this.getProximitySpeedFactor(particle), baseSpeed = ((_a = (_d = particle.retina).moveSpeed) !== null && _a !== void 0 ? _a : _d.moveSpeed = getRangeValue(moveOptions.speed) * container.retina.pixelRatio) * container.retina.reduceFactor, moveDrift = (_b = (_e = particle.retina).moveDrift) !== null && _b !== void 0 ? _b : _e.moveDrift = getRangeValue(particle.options.move.drift) * container.retina.pixelRatio, maxSize = getRangeMax(particleOptions.size.value) * container.retina.pixelRatio, sizeFactor = moveOptions.size ? particle.getRadius() / maxSize : 1, diffFactor = 2, speedFactor = sizeFactor * slowFactor * (delta.factor || 1) / diffFactor, moveSpeed = baseSpeed * speedFactor;
|
|
597
|
+
this.applyPath(particle, delta);
|
|
598
|
+
const gravityOptions = moveOptions.gravity;
|
|
599
|
+
const gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
|
|
600
|
+
if (gravityOptions.enable && moveSpeed) {
|
|
601
|
+
particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (60 * moveSpeed);
|
|
602
|
+
}
|
|
603
|
+
if (moveDrift && moveSpeed) {
|
|
604
|
+
particle.velocity.x += moveDrift * delta.factor / (60 * moveSpeed);
|
|
605
|
+
}
|
|
606
|
+
const decay = particle.moveDecay;
|
|
607
|
+
if (decay != 1) {
|
|
608
|
+
particle.velocity.multTo(decay);
|
|
609
|
+
}
|
|
610
|
+
const velocity = particle.velocity.mult(moveSpeed);
|
|
611
|
+
const maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
|
|
612
|
+
if (gravityOptions.enable && gravityOptions.maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
|
|
613
|
+
velocity.y = gravityFactor * maxSpeed;
|
|
614
|
+
if (moveSpeed) {
|
|
615
|
+
particle.velocity.y = velocity.y / moveSpeed;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
const zIndexOptions = particle.options.zIndex, zVelocityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
|
|
619
|
+
if (moveOptions.spin.enable) {
|
|
620
|
+
this.spin(particle, moveSpeed);
|
|
621
|
+
} else {
|
|
622
|
+
if (zVelocityFactor != 1) {
|
|
623
|
+
velocity.multTo(zVelocityFactor);
|
|
624
|
+
}
|
|
625
|
+
particle.position.addTo(velocity);
|
|
626
|
+
if (moveOptions.vibrate) {
|
|
627
|
+
particle.position.x += Math.sin(particle.position.x * Math.cos(particle.position.y));
|
|
628
|
+
particle.position.y += Math.cos(particle.position.y * Math.sin(particle.position.x));
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
applyDistance(particle);
|
|
632
|
+
}
|
|
633
|
+
spin(particle, moveSpeed) {
|
|
634
|
+
const container = this.container;
|
|
635
|
+
if (!particle.spin) {
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
const updateFunc = {
|
|
639
|
+
x: particle.spin.direction === "clockwise" ? Math.cos : Math.sin,
|
|
640
|
+
y: particle.spin.direction === "clockwise" ? Math.sin : Math.cos
|
|
641
|
+
};
|
|
642
|
+
particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
|
|
643
|
+
particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
|
|
644
|
+
particle.spin.radius += particle.spin.acceleration;
|
|
645
|
+
const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height);
|
|
646
|
+
if (particle.spin.radius > maxCanvasSize / 2) {
|
|
647
|
+
particle.spin.radius = maxCanvasSize / 2;
|
|
648
|
+
particle.spin.acceleration *= -1;
|
|
649
|
+
} else if (particle.spin.radius < 0) {
|
|
650
|
+
particle.spin.radius = 0;
|
|
651
|
+
particle.spin.acceleration *= -1;
|
|
652
|
+
}
|
|
653
|
+
particle.spin.angle += moveSpeed / 100 * (1 - particle.spin.radius / maxCanvasSize);
|
|
654
|
+
}
|
|
655
|
+
applyPath(particle, delta) {
|
|
656
|
+
const particlesOptions = particle.options;
|
|
657
|
+
const pathOptions = particlesOptions.move.path;
|
|
658
|
+
const pathEnabled = pathOptions.enable;
|
|
659
|
+
if (!pathEnabled) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
const container = this.container;
|
|
663
|
+
if (particle.lastPathTime <= particle.pathDelay) {
|
|
664
|
+
particle.lastPathTime += delta.value;
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
const path = container.pathGenerator.generate(particle);
|
|
668
|
+
particle.velocity.addTo(path);
|
|
669
|
+
if (pathOptions.clamp) {
|
|
670
|
+
particle.velocity.x = clamp(particle.velocity.x, -1, 1);
|
|
671
|
+
particle.velocity.y = clamp(particle.velocity.y, -1, 1);
|
|
672
|
+
}
|
|
673
|
+
particle.lastPathTime -= particle.pathDelay;
|
|
674
|
+
}
|
|
675
|
+
moveParallax(particle) {
|
|
676
|
+
const container = this.container;
|
|
677
|
+
const options = container.actualOptions;
|
|
678
|
+
if (isSsr() || !options.interactivity.events.onHover.parallax.enable) {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
const parallaxForce = options.interactivity.events.onHover.parallax.force;
|
|
682
|
+
const mousePos = container.interactivity.mouse.position;
|
|
683
|
+
if (!mousePos) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
const canvasCenter = {
|
|
687
|
+
x: container.canvas.size.width / 2,
|
|
688
|
+
y: container.canvas.size.height / 2
|
|
689
|
+
};
|
|
690
|
+
const parallaxSmooth = options.interactivity.events.onHover.parallax.smooth;
|
|
691
|
+
const factor = particle.getRadius() / parallaxForce;
|
|
692
|
+
const tmp = {
|
|
693
|
+
x: (mousePos.x - canvasCenter.x) * factor,
|
|
694
|
+
y: (mousePos.y - canvasCenter.y) * factor
|
|
695
|
+
};
|
|
696
|
+
particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth;
|
|
697
|
+
particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth;
|
|
698
|
+
}
|
|
699
|
+
getProximitySpeedFactor(particle) {
|
|
700
|
+
const container = this.container;
|
|
701
|
+
const options = container.actualOptions;
|
|
702
|
+
const active = isInArray("slow", options.interactivity.events.onHover.mode);
|
|
703
|
+
if (!active) {
|
|
704
|
+
return 1;
|
|
705
|
+
}
|
|
706
|
+
const mousePos = this.container.interactivity.mouse.position;
|
|
707
|
+
if (!mousePos) {
|
|
708
|
+
return 1;
|
|
709
|
+
}
|
|
710
|
+
const particlePos = particle.getPosition();
|
|
711
|
+
const dist = getDistance(mousePos, particlePos);
|
|
712
|
+
const radius = container.retina.slowModeRadius;
|
|
713
|
+
if (dist > radius) {
|
|
714
|
+
return 1;
|
|
715
|
+
}
|
|
716
|
+
const proximityFactor = dist / radius || 0;
|
|
717
|
+
const slowFactor = options.interactivity.modes.slow.factor;
|
|
718
|
+
return proximityFactor / slowFactor;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
const plugins = null && [];
|
|
722
|
+
const interactorsInitializers = new Map;
|
|
723
|
+
const updatersInitializers = new Map;
|
|
724
|
+
const interactors = new Map;
|
|
725
|
+
const updaters = new Map;
|
|
726
|
+
const presets = new Map;
|
|
727
|
+
const drawers = new Map;
|
|
728
|
+
const pathGenerators = new Map;
|
|
729
|
+
class Plugins_Plugins {
|
|
730
|
+
static getPlugin(plugin) {
|
|
731
|
+
return plugins.find((t => t.id === plugin));
|
|
732
|
+
}
|
|
733
|
+
static addPlugin(plugin) {
|
|
734
|
+
if (!Plugins_Plugins.getPlugin(plugin.id)) {
|
|
735
|
+
plugins.push(plugin);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
static getAvailablePlugins(container) {
|
|
739
|
+
const res = new Map;
|
|
740
|
+
for (const plugin of plugins) {
|
|
741
|
+
if (!plugin.needsPlugin(container.actualOptions)) {
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
res.set(plugin.id, plugin.getPlugin(container));
|
|
745
|
+
}
|
|
746
|
+
return res;
|
|
747
|
+
}
|
|
748
|
+
static loadOptions(options, sourceOptions) {
|
|
749
|
+
for (const plugin of plugins) {
|
|
750
|
+
plugin.loadOptions(options, sourceOptions);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
static getPreset(preset) {
|
|
754
|
+
return presets.get(preset);
|
|
755
|
+
}
|
|
756
|
+
static addPreset(presetKey, options, override = false) {
|
|
757
|
+
if (override || !Plugins_Plugins.getPreset(presetKey)) {
|
|
758
|
+
presets.set(presetKey, options);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
static addShapeDrawer(type, drawer) {
|
|
762
|
+
if (!Plugins_Plugins.getShapeDrawer(type)) {
|
|
763
|
+
drawers.set(type, drawer);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
static getShapeDrawer(type) {
|
|
767
|
+
return drawers.get(type);
|
|
768
|
+
}
|
|
769
|
+
static getSupportedShapes() {
|
|
770
|
+
return drawers.keys();
|
|
771
|
+
}
|
|
772
|
+
static getPathGenerator(type) {
|
|
773
|
+
return pathGenerators.get(type);
|
|
774
|
+
}
|
|
775
|
+
static addPathGenerator(type, pathGenerator) {
|
|
776
|
+
if (!Plugins_Plugins.getPathGenerator(type)) {
|
|
777
|
+
pathGenerators.set(type, pathGenerator);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
static getInteractors(container, force = false) {
|
|
781
|
+
let res = interactors.get(container);
|
|
782
|
+
if (!res || force) {
|
|
783
|
+
res = [ ...interactorsInitializers.values() ].map((t => t(container)));
|
|
784
|
+
interactors.set(container, res);
|
|
785
|
+
}
|
|
786
|
+
return res;
|
|
787
|
+
}
|
|
788
|
+
static addInteractor(name, initInteractor) {
|
|
789
|
+
interactorsInitializers.set(name, initInteractor);
|
|
790
|
+
}
|
|
791
|
+
static getUpdaters(container, force = false) {
|
|
792
|
+
let res = updaters.get(container);
|
|
793
|
+
if (!res || force) {
|
|
794
|
+
res = [ ...updatersInitializers.values() ].map((t => t(container)));
|
|
795
|
+
updaters.set(container, res);
|
|
796
|
+
}
|
|
797
|
+
return res;
|
|
798
|
+
}
|
|
799
|
+
static addParticleUpdater(name, initUpdater) {
|
|
800
|
+
updatersInitializers.set(name, initUpdater);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
class QuadTree_QuadTree {
|
|
804
|
+
constructor(rectangle, capacity) {
|
|
805
|
+
this.rectangle = rectangle;
|
|
806
|
+
this.capacity = capacity;
|
|
807
|
+
this.points = [];
|
|
808
|
+
this.divided = false;
|
|
809
|
+
}
|
|
810
|
+
subdivide() {
|
|
811
|
+
const x = this.rectangle.position.x;
|
|
812
|
+
const y = this.rectangle.position.y;
|
|
813
|
+
const w = this.rectangle.size.width;
|
|
814
|
+
const h = this.rectangle.size.height;
|
|
815
|
+
const capacity = this.capacity;
|
|
816
|
+
this.northEast = new QuadTree_QuadTree(new Rectangle(x, y, w / 2, h / 2), capacity);
|
|
817
|
+
this.northWest = new QuadTree_QuadTree(new Rectangle(x + w / 2, y, w / 2, h / 2), capacity);
|
|
818
|
+
this.southEast = new QuadTree_QuadTree(new Rectangle(x, y + h / 2, w / 2, h / 2), capacity);
|
|
819
|
+
this.southWest = new QuadTree_QuadTree(new Rectangle(x + w / 2, y + h / 2, w / 2, h / 2), capacity);
|
|
820
|
+
this.divided = true;
|
|
821
|
+
}
|
|
822
|
+
insert(point) {
|
|
823
|
+
var _a, _b, _c, _d, _e;
|
|
824
|
+
if (!this.rectangle.contains(point.position)) {
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
if (this.points.length < this.capacity) {
|
|
828
|
+
this.points.push(point);
|
|
829
|
+
return true;
|
|
830
|
+
}
|
|
831
|
+
if (!this.divided) {
|
|
832
|
+
this.subdivide();
|
|
833
|
+
}
|
|
834
|
+
return (_e = ((_a = this.northEast) === null || _a === void 0 ? void 0 : _a.insert(point)) || ((_b = this.northWest) === null || _b === void 0 ? void 0 : _b.insert(point)) || ((_c = this.southEast) === null || _c === void 0 ? void 0 : _c.insert(point)) || ((_d = this.southWest) === null || _d === void 0 ? void 0 : _d.insert(point))) !== null && _e !== void 0 ? _e : false;
|
|
835
|
+
}
|
|
836
|
+
queryCircle(position, radius) {
|
|
837
|
+
return this.query(new Circle(position.x, position.y, radius));
|
|
838
|
+
}
|
|
839
|
+
queryCircleWarp(position, radius, containerOrSize) {
|
|
840
|
+
const container = containerOrSize;
|
|
841
|
+
const size = containerOrSize;
|
|
842
|
+
return this.query(new CircleWarp(position.x, position.y, radius, container.canvas !== undefined ? container.canvas.size : size));
|
|
843
|
+
}
|
|
844
|
+
queryRectangle(position, size) {
|
|
845
|
+
return this.query(new Rectangle(position.x, position.y, size.width, size.height));
|
|
846
|
+
}
|
|
847
|
+
query(range, found) {
|
|
848
|
+
var _a, _b, _c, _d;
|
|
849
|
+
const res = found !== null && found !== void 0 ? found : [];
|
|
850
|
+
if (!range.intersects(this.rectangle)) {
|
|
851
|
+
return [];
|
|
852
|
+
} else {
|
|
853
|
+
for (const p of this.points) {
|
|
854
|
+
if (!range.contains(p.position) && getDistance(range.position, p.position) > p.particle.getRadius()) {
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
res.push(p.particle);
|
|
858
|
+
}
|
|
859
|
+
if (this.divided) {
|
|
860
|
+
(_a = this.northEast) === null || _a === void 0 ? void 0 : _a.query(range, res);
|
|
861
|
+
(_b = this.northWest) === null || _b === void 0 ? void 0 : _b.query(range, res);
|
|
862
|
+
(_c = this.southEast) === null || _c === void 0 ? void 0 : _c.query(range, res);
|
|
863
|
+
(_d = this.southWest) === null || _d === void 0 ? void 0 : _d.query(range, res);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return res;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
class Canvas_Canvas {
|
|
870
|
+
constructor(container) {
|
|
871
|
+
this.container = container;
|
|
872
|
+
this.size = {
|
|
873
|
+
height: 0,
|
|
874
|
+
width: 0
|
|
875
|
+
};
|
|
876
|
+
this.context = null;
|
|
877
|
+
this.generatedCanvas = false;
|
|
878
|
+
}
|
|
879
|
+
init() {
|
|
880
|
+
this.resize();
|
|
881
|
+
this.initStyle();
|
|
882
|
+
this.initCover();
|
|
883
|
+
this.initTrail();
|
|
884
|
+
this.initBackground();
|
|
885
|
+
this.paint();
|
|
886
|
+
}
|
|
887
|
+
loadCanvas(canvas) {
|
|
888
|
+
var _a;
|
|
889
|
+
if (this.generatedCanvas) {
|
|
890
|
+
(_a = this.element) === null || _a === void 0 ? void 0 : _a.remove();
|
|
891
|
+
}
|
|
892
|
+
this.generatedCanvas = canvas.dataset && Constants.generatedAttribute in canvas.dataset ? canvas.dataset[Constants.generatedAttribute] === "true" : this.generatedCanvas;
|
|
893
|
+
this.element = canvas;
|
|
894
|
+
this.originalStyle = deepExtend({}, this.element.style);
|
|
895
|
+
this.size.height = canvas.offsetHeight;
|
|
896
|
+
this.size.width = canvas.offsetWidth;
|
|
897
|
+
this.context = this.element.getContext("2d");
|
|
898
|
+
this.container.retina.init();
|
|
899
|
+
this.initBackground();
|
|
900
|
+
}
|
|
901
|
+
destroy() {
|
|
902
|
+
var _a;
|
|
903
|
+
if (this.generatedCanvas) {
|
|
904
|
+
(_a = this.element) === null || _a === void 0 ? void 0 : _a.remove();
|
|
905
|
+
}
|
|
906
|
+
this.draw((ctx => {
|
|
907
|
+
clear(ctx, this.size);
|
|
908
|
+
}));
|
|
909
|
+
}
|
|
910
|
+
paint() {
|
|
911
|
+
const options = this.container.actualOptions;
|
|
912
|
+
this.draw((ctx => {
|
|
913
|
+
if (options.backgroundMask.enable && options.backgroundMask.cover && this.coverColor) {
|
|
914
|
+
clear(ctx, this.size);
|
|
915
|
+
this.paintBase(getStyleFromRgb(this.coverColor, this.coverColor.a));
|
|
916
|
+
} else {
|
|
917
|
+
this.paintBase();
|
|
918
|
+
}
|
|
919
|
+
}));
|
|
920
|
+
}
|
|
921
|
+
clear() {
|
|
922
|
+
const options = this.container.actualOptions;
|
|
923
|
+
const trail = options.particles.move.trail;
|
|
924
|
+
if (options.backgroundMask.enable) {
|
|
925
|
+
this.paint();
|
|
926
|
+
} else if (trail.enable && trail.length > 0 && this.trailFillColor) {
|
|
927
|
+
this.paintBase(getStyleFromRgb(this.trailFillColor, 1 / trail.length));
|
|
928
|
+
} else {
|
|
929
|
+
this.draw((ctx => {
|
|
930
|
+
clear(ctx, this.size);
|
|
931
|
+
}));
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
async windowResize() {
|
|
935
|
+
if (!this.element) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
const container = this.container;
|
|
939
|
+
this.resize();
|
|
940
|
+
const needsRefresh = container.updateActualOptions();
|
|
941
|
+
container.particles.setDensity();
|
|
942
|
+
for (const [, plugin] of container.plugins) {
|
|
943
|
+
if (plugin.resize !== undefined) {
|
|
944
|
+
plugin.resize();
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
if (needsRefresh) {
|
|
948
|
+
await container.refresh();
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
resize() {
|
|
952
|
+
if (!this.element) {
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const container = this.container;
|
|
956
|
+
const pxRatio = container.retina.pixelRatio;
|
|
957
|
+
const size = container.canvas.size;
|
|
958
|
+
const oldSize = {
|
|
959
|
+
width: size.width,
|
|
960
|
+
height: size.height
|
|
961
|
+
};
|
|
962
|
+
size.width = this.element.offsetWidth * pxRatio;
|
|
963
|
+
size.height = this.element.offsetHeight * pxRatio;
|
|
964
|
+
this.element.width = size.width;
|
|
965
|
+
this.element.height = size.height;
|
|
966
|
+
if (this.container.started) {
|
|
967
|
+
this.resizeFactor = {
|
|
968
|
+
width: size.width / oldSize.width,
|
|
969
|
+
height: size.height / oldSize.height
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
drawConnectLine(p1, p2) {
|
|
974
|
+
this.draw((ctx => {
|
|
975
|
+
var _a;
|
|
976
|
+
const lineStyle = this.lineStyle(p1, p2);
|
|
977
|
+
if (!lineStyle) {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
const pos1 = p1.getPosition();
|
|
981
|
+
const pos2 = p2.getPosition();
|
|
982
|
+
drawConnectLine(ctx, (_a = p1.retina.linksWidth) !== null && _a !== void 0 ? _a : this.container.retina.linksWidth, lineStyle, pos1, pos2);
|
|
983
|
+
}));
|
|
984
|
+
}
|
|
985
|
+
drawGrabLine(particle, lineColor, opacity, mousePos) {
|
|
986
|
+
const container = this.container;
|
|
987
|
+
this.draw((ctx => {
|
|
988
|
+
var _a;
|
|
989
|
+
const beginPos = particle.getPosition();
|
|
990
|
+
drawGrabLine(ctx, (_a = particle.retina.linksWidth) !== null && _a !== void 0 ? _a : container.retina.linksWidth, beginPos, mousePos, lineColor, opacity);
|
|
991
|
+
}));
|
|
992
|
+
}
|
|
993
|
+
drawParticle(particle, delta) {
|
|
994
|
+
var _a, _b, _c, _d, _e, _f;
|
|
995
|
+
if (particle.spawning || particle.destroyed) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
const pfColor = particle.getFillColor();
|
|
999
|
+
const psColor = (_a = particle.getStrokeColor()) !== null && _a !== void 0 ? _a : pfColor;
|
|
1000
|
+
if (!pfColor && !psColor) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
let [fColor, sColor] = this.getPluginParticleColors(particle);
|
|
1004
|
+
const pOptions = particle.options;
|
|
1005
|
+
const twinkle = pOptions.twinkle.particles;
|
|
1006
|
+
const twinkling = twinkle.enable && Math.random() < twinkle.frequency;
|
|
1007
|
+
if (!fColor || !sColor) {
|
|
1008
|
+
const twinkleRgb = colorToHsl(twinkle.color);
|
|
1009
|
+
if (!fColor) {
|
|
1010
|
+
fColor = twinkling && twinkleRgb !== undefined ? twinkleRgb : pfColor ? pfColor : undefined;
|
|
1011
|
+
}
|
|
1012
|
+
if (!sColor) {
|
|
1013
|
+
sColor = twinkling && twinkleRgb !== undefined ? twinkleRgb : psColor ? psColor : undefined;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
const options = this.container.actualOptions;
|
|
1017
|
+
const zIndexOptions = particle.options.zIndex;
|
|
1018
|
+
const zOpacityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.opacityRate;
|
|
1019
|
+
const radius = particle.getRadius();
|
|
1020
|
+
const opacity = twinkling ? twinkle.opacity : (_d = (_b = particle.bubble.opacity) !== null && _b !== void 0 ? _b : (_c = particle.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 1;
|
|
1021
|
+
const strokeOpacity = (_f = (_e = particle.stroke) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : opacity;
|
|
1022
|
+
const zOpacity = opacity * zOpacityFactor;
|
|
1023
|
+
const fillColorValue = fColor ? getStyleFromHsl(fColor, zOpacity) : undefined;
|
|
1024
|
+
if (!fillColorValue && !sColor) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
this.draw((ctx => {
|
|
1028
|
+
const zSizeFactor = (1 - particle.zIndexFactor) ** zIndexOptions.sizeRate;
|
|
1029
|
+
const zStrokeOpacity = strokeOpacity * zOpacityFactor;
|
|
1030
|
+
const strokeColorValue = sColor ? getStyleFromHsl(sColor, zStrokeOpacity) : fillColorValue;
|
|
1031
|
+
if (radius <= 0) {
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
const container = this.container;
|
|
1035
|
+
for (const updater of container.particles.updaters) {
|
|
1036
|
+
if (updater.beforeDraw) {
|
|
1037
|
+
updater.beforeDraw(particle);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
drawParticle(this.container, ctx, particle, delta, fillColorValue, strokeColorValue, options.backgroundMask.enable, options.backgroundMask.composite, radius * zSizeFactor, zOpacity, particle.options.shadow, particle.gradient);
|
|
1041
|
+
for (const updater of container.particles.updaters) {
|
|
1042
|
+
if (updater.afterDraw) {
|
|
1043
|
+
updater.afterDraw(particle);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}));
|
|
1047
|
+
}
|
|
1048
|
+
drawPlugin(plugin, delta) {
|
|
1049
|
+
this.draw((ctx => {
|
|
1050
|
+
drawPlugin(ctx, plugin, delta);
|
|
1051
|
+
}));
|
|
1052
|
+
}
|
|
1053
|
+
drawParticlePlugin(plugin, particle, delta) {
|
|
1054
|
+
this.draw((ctx => {
|
|
1055
|
+
drawParticlePlugin(ctx, plugin, particle, delta);
|
|
1056
|
+
}));
|
|
1057
|
+
}
|
|
1058
|
+
initBackground() {
|
|
1059
|
+
const options = this.container.actualOptions;
|
|
1060
|
+
const background = options.background;
|
|
1061
|
+
const element = this.element;
|
|
1062
|
+
const elementStyle = element === null || element === void 0 ? void 0 : element.style;
|
|
1063
|
+
if (!elementStyle) {
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
if (background.color) {
|
|
1067
|
+
const color = colorToRgb(background.color);
|
|
1068
|
+
elementStyle.backgroundColor = color ? getStyleFromRgb(color, background.opacity) : "";
|
|
1069
|
+
} else {
|
|
1070
|
+
elementStyle.backgroundColor = "";
|
|
1071
|
+
}
|
|
1072
|
+
elementStyle.backgroundImage = background.image || "";
|
|
1073
|
+
elementStyle.backgroundPosition = background.position || "";
|
|
1074
|
+
elementStyle.backgroundRepeat = background.repeat || "";
|
|
1075
|
+
elementStyle.backgroundSize = background.size || "";
|
|
1076
|
+
}
|
|
1077
|
+
draw(cb) {
|
|
1078
|
+
if (!this.context) {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
return cb(this.context);
|
|
1082
|
+
}
|
|
1083
|
+
initCover() {
|
|
1084
|
+
const options = this.container.actualOptions;
|
|
1085
|
+
const cover = options.backgroundMask.cover;
|
|
1086
|
+
const color = cover.color;
|
|
1087
|
+
const coverRgb = colorToRgb(color);
|
|
1088
|
+
if (coverRgb) {
|
|
1089
|
+
this.coverColor = {
|
|
1090
|
+
r: coverRgb.r,
|
|
1091
|
+
g: coverRgb.g,
|
|
1092
|
+
b: coverRgb.b,
|
|
1093
|
+
a: cover.opacity
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
initTrail() {
|
|
1098
|
+
const options = this.container.actualOptions;
|
|
1099
|
+
const trail = options.particles.move.trail;
|
|
1100
|
+
const fillColor = colorToRgb(trail.fillColor);
|
|
1101
|
+
if (fillColor) {
|
|
1102
|
+
const trail = options.particles.move.trail;
|
|
1103
|
+
this.trailFillColor = {
|
|
1104
|
+
r: fillColor.r,
|
|
1105
|
+
g: fillColor.g,
|
|
1106
|
+
b: fillColor.b,
|
|
1107
|
+
a: 1 / trail.length
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
getPluginParticleColors(particle) {
|
|
1112
|
+
let fColor;
|
|
1113
|
+
let sColor;
|
|
1114
|
+
for (const [, plugin] of this.container.plugins) {
|
|
1115
|
+
if (!fColor && plugin.particleFillColor) {
|
|
1116
|
+
fColor = colorToHsl(plugin.particleFillColor(particle));
|
|
1117
|
+
}
|
|
1118
|
+
if (!sColor && plugin.particleStrokeColor) {
|
|
1119
|
+
sColor = colorToHsl(plugin.particleStrokeColor(particle));
|
|
1120
|
+
}
|
|
1121
|
+
if (fColor && sColor) {
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return [ fColor, sColor ];
|
|
1126
|
+
}
|
|
1127
|
+
initStyle() {
|
|
1128
|
+
const element = this.element, options = this.container.actualOptions;
|
|
1129
|
+
if (!element) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
const originalStyle = this.originalStyle;
|
|
1133
|
+
if (options.fullScreen.enable) {
|
|
1134
|
+
this.originalStyle = deepExtend({}, element.style);
|
|
1135
|
+
element.style.setProperty("position", "fixed", "important");
|
|
1136
|
+
element.style.setProperty("z-index", options.fullScreen.zIndex.toString(10), "important");
|
|
1137
|
+
element.style.setProperty("top", "0", "important");
|
|
1138
|
+
element.style.setProperty("left", "0", "important");
|
|
1139
|
+
element.style.setProperty("width", "100%", "important");
|
|
1140
|
+
element.style.setProperty("height", "100%", "important");
|
|
1141
|
+
} else if (originalStyle) {
|
|
1142
|
+
element.style.position = originalStyle.position;
|
|
1143
|
+
element.style.zIndex = originalStyle.zIndex;
|
|
1144
|
+
element.style.top = originalStyle.top;
|
|
1145
|
+
element.style.left = originalStyle.left;
|
|
1146
|
+
element.style.width = originalStyle.width;
|
|
1147
|
+
element.style.height = originalStyle.height;
|
|
1148
|
+
}
|
|
1149
|
+
for (const key in options.style) {
|
|
1150
|
+
if (!key || !options.style) {
|
|
1151
|
+
continue;
|
|
1152
|
+
}
|
|
1153
|
+
const value = options.style[key];
|
|
1154
|
+
if (!value) {
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
element.style.setProperty(key, value, "important");
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
paintBase(baseColor) {
|
|
1161
|
+
this.draw((ctx => {
|
|
1162
|
+
paintBase(ctx, this.size, baseColor);
|
|
1163
|
+
}));
|
|
1164
|
+
}
|
|
1165
|
+
lineStyle(p1, p2) {
|
|
1166
|
+
return this.draw((ctx => {
|
|
1167
|
+
const options = this.container.actualOptions;
|
|
1168
|
+
const connectOptions = options.interactivity.modes.connect;
|
|
1169
|
+
return gradient(ctx, p1, p2, connectOptions.links.opacity);
|
|
1170
|
+
}));
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
class ValueWithRandom_ValueWithRandom {
|
|
1174
|
+
constructor() {
|
|
1175
|
+
this.random = new Random;
|
|
1176
|
+
this.value = 0;
|
|
1177
|
+
}
|
|
1178
|
+
load(data) {
|
|
1179
|
+
if (!data) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (typeof data.random === "boolean") {
|
|
1183
|
+
this.random.enable = data.random;
|
|
1184
|
+
} else {
|
|
1185
|
+
this.random.load(data.random);
|
|
1186
|
+
}
|
|
1187
|
+
if (data.value !== undefined) {
|
|
1188
|
+
this.value = setRangeValue(data.value, this.random.enable ? this.random.minimumValue : undefined);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
class PathDelay_PathDelay extends(null && ValueWithRandom){
|
|
1193
|
+
constructor() {
|
|
1194
|
+
super();
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
class Path_Path {
|
|
1198
|
+
constructor() {
|
|
1199
|
+
this.clamp = true;
|
|
1200
|
+
this.delay = new PathDelay;
|
|
1201
|
+
this.enable = false;
|
|
1202
|
+
this.options = {};
|
|
1203
|
+
}
|
|
1204
|
+
load(data) {
|
|
1205
|
+
if (data === undefined) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
if (data.clamp !== undefined) {
|
|
1209
|
+
this.clamp = data.clamp;
|
|
1210
|
+
}
|
|
1211
|
+
this.delay.load(data.delay);
|
|
1212
|
+
if (data.enable !== undefined) {
|
|
1213
|
+
this.enable = data.enable;
|
|
1214
|
+
}
|
|
1215
|
+
this.generator = data.generator;
|
|
1216
|
+
if (data.options) {
|
|
1217
|
+
this.options = deepExtend(this.options, data.options);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
class Spin_Spin {
|
|
1222
|
+
constructor() {
|
|
1223
|
+
this.acceleration = 0;
|
|
1224
|
+
this.enable = false;
|
|
1225
|
+
}
|
|
1226
|
+
load(data) {
|
|
1227
|
+
if (!data) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (data.acceleration !== undefined) {
|
|
1231
|
+
this.acceleration = setRangeValue(data.acceleration);
|
|
1232
|
+
}
|
|
1233
|
+
if (data.enable !== undefined) {
|
|
1234
|
+
this.enable = data.enable;
|
|
1235
|
+
}
|
|
1236
|
+
this.position = data.position ? deepExtend({}, data.position) : undefined;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
class Move_Move {
|
|
1240
|
+
constructor() {
|
|
1241
|
+
this.angle = new MoveAngle;
|
|
1242
|
+
this.attract = new Attract;
|
|
1243
|
+
this.decay = 0;
|
|
1244
|
+
this.distance = {};
|
|
1245
|
+
this.direction = "none";
|
|
1246
|
+
this.drift = 0;
|
|
1247
|
+
this.enable = false;
|
|
1248
|
+
this.gravity = new MoveGravity;
|
|
1249
|
+
this.path = new Path;
|
|
1250
|
+
this.outModes = new OutModes;
|
|
1251
|
+
this.random = false;
|
|
1252
|
+
this.size = false;
|
|
1253
|
+
this.speed = 2;
|
|
1254
|
+
this.spin = new Spin;
|
|
1255
|
+
this.straight = false;
|
|
1256
|
+
this.trail = new Trail;
|
|
1257
|
+
this.vibrate = false;
|
|
1258
|
+
this.warp = false;
|
|
1259
|
+
}
|
|
1260
|
+
get collisions() {
|
|
1261
|
+
return false;
|
|
1262
|
+
}
|
|
1263
|
+
set collisions(value) {}
|
|
1264
|
+
get bounce() {
|
|
1265
|
+
return this.collisions;
|
|
1266
|
+
}
|
|
1267
|
+
set bounce(value) {
|
|
1268
|
+
this.collisions = value;
|
|
1269
|
+
}
|
|
1270
|
+
get out_mode() {
|
|
1271
|
+
return this.outMode;
|
|
1272
|
+
}
|
|
1273
|
+
set out_mode(value) {
|
|
1274
|
+
this.outMode = value;
|
|
1275
|
+
}
|
|
1276
|
+
get outMode() {
|
|
1277
|
+
return this.outModes.default;
|
|
1278
|
+
}
|
|
1279
|
+
set outMode(value) {
|
|
1280
|
+
this.outModes.default = value;
|
|
1281
|
+
}
|
|
1282
|
+
get noise() {
|
|
1283
|
+
return this.path;
|
|
1284
|
+
}
|
|
1285
|
+
set noise(value) {
|
|
1286
|
+
this.path = value;
|
|
1287
|
+
}
|
|
1288
|
+
load(data) {
|
|
1289
|
+
var _a, _b, _c;
|
|
1290
|
+
if (data === undefined) {
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
if (data.angle !== undefined) {
|
|
1294
|
+
if (typeof data.angle === "number") {
|
|
1295
|
+
this.angle.value = data.angle;
|
|
1296
|
+
} else {
|
|
1297
|
+
this.angle.load(data.angle);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
this.attract.load(data.attract);
|
|
1301
|
+
if (data.decay !== undefined) {
|
|
1302
|
+
this.decay = data.decay;
|
|
1303
|
+
}
|
|
1304
|
+
if (data.direction !== undefined) {
|
|
1305
|
+
this.direction = data.direction;
|
|
1306
|
+
}
|
|
1307
|
+
if (data.distance !== undefined) {
|
|
1308
|
+
this.distance = typeof data.distance === "number" ? {
|
|
1309
|
+
horizontal: data.distance,
|
|
1310
|
+
vertical: data.distance
|
|
1311
|
+
} : deepExtend({}, data.distance);
|
|
1312
|
+
}
|
|
1313
|
+
if (data.drift !== undefined) {
|
|
1314
|
+
this.drift = setRangeValue(data.drift);
|
|
1315
|
+
}
|
|
1316
|
+
if (data.enable !== undefined) {
|
|
1317
|
+
this.enable = data.enable;
|
|
1318
|
+
}
|
|
1319
|
+
this.gravity.load(data.gravity);
|
|
1320
|
+
const outMode = (_a = data.outMode) !== null && _a !== void 0 ? _a : data.out_mode;
|
|
1321
|
+
if (data.outModes !== undefined || outMode !== undefined) {
|
|
1322
|
+
if (typeof data.outModes === "string" || data.outModes === undefined && outMode !== undefined) {
|
|
1323
|
+
this.outModes.load({
|
|
1324
|
+
default: (_b = data.outModes) !== null && _b !== void 0 ? _b : outMode
|
|
1325
|
+
});
|
|
1326
|
+
} else {
|
|
1327
|
+
this.outModes.load(data.outModes);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
this.path.load((_c = data.path) !== null && _c !== void 0 ? _c : data.noise);
|
|
1331
|
+
if (data.random !== undefined) {
|
|
1332
|
+
this.random = data.random;
|
|
1333
|
+
}
|
|
1334
|
+
if (data.size !== undefined) {
|
|
1335
|
+
this.size = data.size;
|
|
1336
|
+
}
|
|
1337
|
+
if (data.speed !== undefined) {
|
|
1338
|
+
this.speed = setRangeValue(data.speed);
|
|
1339
|
+
}
|
|
1340
|
+
this.spin.load(data.spin);
|
|
1341
|
+
if (data.straight !== undefined) {
|
|
1342
|
+
this.straight = data.straight;
|
|
1343
|
+
}
|
|
1344
|
+
this.trail.load(data.trail);
|
|
1345
|
+
if (data.vibrate !== undefined) {
|
|
1346
|
+
this.vibrate = data.vibrate;
|
|
1347
|
+
}
|
|
1348
|
+
if (data.warp !== undefined) {
|
|
1349
|
+
this.warp = data.warp;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
class Opacity_Opacity extends(null && ValueWithRandom){
|
|
1354
|
+
constructor() {
|
|
1355
|
+
super();
|
|
1356
|
+
this.animation = new OpacityAnimation;
|
|
1357
|
+
this.random.minimumValue = .1;
|
|
1358
|
+
this.value = 1;
|
|
1359
|
+
}
|
|
1360
|
+
get anim() {
|
|
1361
|
+
return this.animation;
|
|
1362
|
+
}
|
|
1363
|
+
set anim(value) {
|
|
1364
|
+
this.animation = value;
|
|
1365
|
+
}
|
|
1366
|
+
load(data) {
|
|
1367
|
+
var _a;
|
|
1368
|
+
if (!data) {
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
super.load(data);
|
|
1372
|
+
const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
|
|
1373
|
+
if (animation !== undefined) {
|
|
1374
|
+
this.animation.load(animation);
|
|
1375
|
+
this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
class Shape_Shape {
|
|
1380
|
+
constructor() {
|
|
1381
|
+
this.options = {};
|
|
1382
|
+
this.type = "circle";
|
|
1383
|
+
}
|
|
1384
|
+
get image() {
|
|
1385
|
+
var _a;
|
|
1386
|
+
return (_a = this.options["image"]) !== null && _a !== void 0 ? _a : this.options["images"];
|
|
1387
|
+
}
|
|
1388
|
+
set image(value) {
|
|
1389
|
+
this.options["image"] = value;
|
|
1390
|
+
this.options["images"] = value;
|
|
1391
|
+
}
|
|
1392
|
+
get custom() {
|
|
1393
|
+
return this.options;
|
|
1394
|
+
}
|
|
1395
|
+
set custom(value) {
|
|
1396
|
+
this.options = value;
|
|
1397
|
+
}
|
|
1398
|
+
get images() {
|
|
1399
|
+
return this.image;
|
|
1400
|
+
}
|
|
1401
|
+
set images(value) {
|
|
1402
|
+
this.image = value;
|
|
1403
|
+
}
|
|
1404
|
+
get stroke() {
|
|
1405
|
+
return [];
|
|
1406
|
+
}
|
|
1407
|
+
set stroke(_value) {}
|
|
1408
|
+
get character() {
|
|
1409
|
+
var _a;
|
|
1410
|
+
return (_a = this.options["character"]) !== null && _a !== void 0 ? _a : this.options["char"];
|
|
1411
|
+
}
|
|
1412
|
+
set character(value) {
|
|
1413
|
+
this.options["character"] = value;
|
|
1414
|
+
this.options["char"] = value;
|
|
1415
|
+
}
|
|
1416
|
+
get polygon() {
|
|
1417
|
+
var _a;
|
|
1418
|
+
return (_a = this.options["polygon"]) !== null && _a !== void 0 ? _a : this.options["star"];
|
|
1419
|
+
}
|
|
1420
|
+
set polygon(value) {
|
|
1421
|
+
this.options["polygon"] = value;
|
|
1422
|
+
this.options["star"] = value;
|
|
1423
|
+
}
|
|
1424
|
+
load(data) {
|
|
1425
|
+
var _a, _b, _c;
|
|
1426
|
+
if (data === undefined) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
const options = (_a = data.options) !== null && _a !== void 0 ? _a : data.custom;
|
|
1430
|
+
if (options !== undefined) {
|
|
1431
|
+
for (const shape in options) {
|
|
1432
|
+
const item = options[shape];
|
|
1433
|
+
if (item !== undefined) {
|
|
1434
|
+
this.options[shape] = deepExtend((_b = this.options[shape]) !== null && _b !== void 0 ? _b : {}, item);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
this.loadShape(data.character, "character", "char", true);
|
|
1439
|
+
this.loadShape(data.polygon, "polygon", "star", false);
|
|
1440
|
+
this.loadShape((_c = data.image) !== null && _c !== void 0 ? _c : data.images, "image", "images", true);
|
|
1441
|
+
if (data.type !== undefined) {
|
|
1442
|
+
this.type = data.type;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
loadShape(item, mainKey, altKey, altOverride) {
|
|
1446
|
+
var _a, _b, _c, _d;
|
|
1447
|
+
if (item === undefined) {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
if (item instanceof Array) {
|
|
1451
|
+
if (!(this.options[mainKey] instanceof Array)) {
|
|
1452
|
+
this.options[mainKey] = [];
|
|
1453
|
+
if (!this.options[altKey] || altOverride) {
|
|
1454
|
+
this.options[altKey] = [];
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
this.options[mainKey] = deepExtend((_a = this.options[mainKey]) !== null && _a !== void 0 ? _a : [], item);
|
|
1458
|
+
if (!this.options[altKey] || altOverride) {
|
|
1459
|
+
this.options[altKey] = deepExtend((_b = this.options[altKey]) !== null && _b !== void 0 ? _b : [], item);
|
|
1460
|
+
}
|
|
1461
|
+
} else {
|
|
1462
|
+
if (this.options[mainKey] instanceof Array) {
|
|
1463
|
+
this.options[mainKey] = {};
|
|
1464
|
+
if (!this.options[altKey] || altOverride) {
|
|
1465
|
+
this.options[altKey] = {};
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
this.options[mainKey] = deepExtend((_c = this.options[mainKey]) !== null && _c !== void 0 ? _c : {}, item);
|
|
1469
|
+
if (!this.options[altKey] || altOverride) {
|
|
1470
|
+
this.options[altKey] = deepExtend((_d = this.options[altKey]) !== null && _d !== void 0 ? _d : {}, item);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
class Size_Size extends(null && ValueWithRandom){
|
|
1476
|
+
constructor() {
|
|
1477
|
+
super();
|
|
1478
|
+
this.animation = new SizeAnimation;
|
|
1479
|
+
this.random.minimumValue = 1;
|
|
1480
|
+
this.value = 3;
|
|
1481
|
+
}
|
|
1482
|
+
get anim() {
|
|
1483
|
+
return this.animation;
|
|
1484
|
+
}
|
|
1485
|
+
set anim(value) {
|
|
1486
|
+
this.animation = value;
|
|
1487
|
+
}
|
|
1488
|
+
load(data) {
|
|
1489
|
+
var _a;
|
|
1490
|
+
if (!data) {
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
super.load(data);
|
|
1494
|
+
const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
|
|
1495
|
+
if (animation !== undefined) {
|
|
1496
|
+
this.animation.load(animation);
|
|
1497
|
+
this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
class Rotate_Rotate extends(null && ValueWithRandom){
|
|
1502
|
+
constructor() {
|
|
1503
|
+
super();
|
|
1504
|
+
this.animation = new RotateAnimation;
|
|
1505
|
+
this.direction = "clockwise";
|
|
1506
|
+
this.path = false;
|
|
1507
|
+
this.value = 0;
|
|
1508
|
+
}
|
|
1509
|
+
load(data) {
|
|
1510
|
+
if (!data) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
super.load(data);
|
|
1514
|
+
if (data.direction !== undefined) {
|
|
1515
|
+
this.direction = data.direction;
|
|
1516
|
+
}
|
|
1517
|
+
this.animation.load(data.animation);
|
|
1518
|
+
if (data.path !== undefined) {
|
|
1519
|
+
this.path = data.path;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
class ColorAnimation_ColorAnimation {
|
|
1524
|
+
constructor() {
|
|
1525
|
+
this.count = 0;
|
|
1526
|
+
this.enable = false;
|
|
1527
|
+
this.offset = 0;
|
|
1528
|
+
this.speed = 1;
|
|
1529
|
+
this.sync = true;
|
|
1530
|
+
}
|
|
1531
|
+
load(data) {
|
|
1532
|
+
if (data === undefined) {
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
if (data.count !== undefined) {
|
|
1536
|
+
this.count = data.count;
|
|
1537
|
+
}
|
|
1538
|
+
if (data.enable !== undefined) {
|
|
1539
|
+
this.enable = data.enable;
|
|
1540
|
+
}
|
|
1541
|
+
if (data.offset !== undefined) {
|
|
1542
|
+
this.offset = setRangeValue(data.offset);
|
|
1543
|
+
}
|
|
1544
|
+
if (data.speed !== undefined) {
|
|
1545
|
+
this.speed = data.speed;
|
|
1546
|
+
}
|
|
1547
|
+
if (data.sync !== undefined) {
|
|
1548
|
+
this.sync = data.sync;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
class HslAnimation_HslAnimation {
|
|
1553
|
+
constructor() {
|
|
1554
|
+
this.h = new ColorAnimation;
|
|
1555
|
+
this.s = new ColorAnimation;
|
|
1556
|
+
this.l = new ColorAnimation;
|
|
1557
|
+
}
|
|
1558
|
+
load(data) {
|
|
1559
|
+
if (!data) {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
this.h.load(data.h);
|
|
1563
|
+
this.s.load(data.s);
|
|
1564
|
+
this.l.load(data.l);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
class AnimatableColor_AnimatableColor extends(null && OptionsColor){
|
|
1568
|
+
constructor() {
|
|
1569
|
+
super();
|
|
1570
|
+
this.animation = new HslAnimation;
|
|
1571
|
+
}
|
|
1572
|
+
static create(source, data) {
|
|
1573
|
+
const color = new AnimatableColor_AnimatableColor;
|
|
1574
|
+
color.load(source);
|
|
1575
|
+
if (data !== undefined) {
|
|
1576
|
+
if (typeof data === "string" || data instanceof Array) {
|
|
1577
|
+
color.load({
|
|
1578
|
+
value: data
|
|
1579
|
+
});
|
|
1580
|
+
} else {
|
|
1581
|
+
color.load(data);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
return color;
|
|
1585
|
+
}
|
|
1586
|
+
load(data) {
|
|
1587
|
+
super.load(data);
|
|
1588
|
+
if (!data) {
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
const colorAnimation = data.animation;
|
|
1592
|
+
if (colorAnimation !== undefined) {
|
|
1593
|
+
if (colorAnimation.enable !== undefined) {
|
|
1594
|
+
this.animation.h.load(colorAnimation);
|
|
1595
|
+
} else {
|
|
1596
|
+
this.animation.load(data.animation);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
class Stroke_Stroke {
|
|
1602
|
+
constructor() {
|
|
1603
|
+
this.width = 0;
|
|
1604
|
+
}
|
|
1605
|
+
load(data) {
|
|
1606
|
+
if (data === undefined) {
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
if (data.color !== undefined) {
|
|
1610
|
+
this.color = AnimatableColor.create(this.color, data.color);
|
|
1611
|
+
}
|
|
1612
|
+
if (data.width !== undefined) {
|
|
1613
|
+
this.width = data.width;
|
|
1614
|
+
}
|
|
1615
|
+
if (data.opacity !== undefined) {
|
|
1616
|
+
this.opacity = data.opacity;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
class BounceFactor_BounceFactor extends(null && ValueWithRandom){
|
|
1621
|
+
constructor() {
|
|
1622
|
+
super();
|
|
1623
|
+
this.random.minimumValue = .1;
|
|
1624
|
+
this.value = 1;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
class Bounce_Bounce {
|
|
1628
|
+
constructor() {
|
|
1629
|
+
this.horizontal = new BounceFactor;
|
|
1630
|
+
this.vertical = new BounceFactor;
|
|
1631
|
+
}
|
|
1632
|
+
load(data) {
|
|
1633
|
+
if (!data) {
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
this.horizontal.load(data.horizontal);
|
|
1637
|
+
this.vertical.load(data.vertical);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
class Collisions_Collisions {
|
|
1641
|
+
constructor() {
|
|
1642
|
+
this.bounce = new Bounce;
|
|
1643
|
+
this.enable = false;
|
|
1644
|
+
this.mode = "bounce";
|
|
1645
|
+
this.overlap = new CollisionsOverlap;
|
|
1646
|
+
}
|
|
1647
|
+
load(data) {
|
|
1648
|
+
if (data === undefined) {
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
this.bounce.load(data.bounce);
|
|
1652
|
+
if (data.enable !== undefined) {
|
|
1653
|
+
this.enable = data.enable;
|
|
1654
|
+
}
|
|
1655
|
+
if (data.mode !== undefined) {
|
|
1656
|
+
this.mode = data.mode;
|
|
1657
|
+
}
|
|
1658
|
+
this.overlap.load(data.overlap);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
class LifeDelay_LifeDelay extends(null && ValueWithRandom){
|
|
1662
|
+
constructor() {
|
|
1663
|
+
super();
|
|
1664
|
+
this.sync = false;
|
|
1665
|
+
}
|
|
1666
|
+
load(data) {
|
|
1667
|
+
if (!data) {
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
super.load(data);
|
|
1671
|
+
if (data.sync !== undefined) {
|
|
1672
|
+
this.sync = data.sync;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
class LifeDuration_LifeDuration extends(null && ValueWithRandom){
|
|
1677
|
+
constructor() {
|
|
1678
|
+
super();
|
|
1679
|
+
this.random.minimumValue = 1e-4;
|
|
1680
|
+
this.sync = false;
|
|
1681
|
+
}
|
|
1682
|
+
load(data) {
|
|
1683
|
+
if (data === undefined) {
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
super.load(data);
|
|
1687
|
+
if (data.sync !== undefined) {
|
|
1688
|
+
this.sync = data.sync;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
class Life_Life {
|
|
1693
|
+
constructor() {
|
|
1694
|
+
this.count = 0;
|
|
1695
|
+
this.delay = new LifeDelay;
|
|
1696
|
+
this.duration = new LifeDuration;
|
|
1697
|
+
}
|
|
1698
|
+
load(data) {
|
|
1699
|
+
if (data === undefined) {
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
if (data.count !== undefined) {
|
|
1703
|
+
this.count = data.count;
|
|
1704
|
+
}
|
|
1705
|
+
this.delay.load(data.delay);
|
|
1706
|
+
this.duration.load(data.duration);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
class SplitFactor_SplitFactor extends(null && ValueWithRandom){
|
|
1710
|
+
constructor() {
|
|
1711
|
+
super();
|
|
1712
|
+
this.value = 3;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
class SplitRate_SplitRate extends(null && ValueWithRandom){
|
|
1716
|
+
constructor() {
|
|
1717
|
+
super();
|
|
1718
|
+
this.value = {
|
|
1719
|
+
min: 4,
|
|
1720
|
+
max: 9
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
class Split_Split {
|
|
1725
|
+
constructor() {
|
|
1726
|
+
this.count = 1;
|
|
1727
|
+
this.factor = new SplitFactor;
|
|
1728
|
+
this.rate = new SplitRate;
|
|
1729
|
+
this.sizeOffset = true;
|
|
1730
|
+
}
|
|
1731
|
+
load(data) {
|
|
1732
|
+
if (!data) {
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
if (data.count !== undefined) {
|
|
1736
|
+
this.count = data.count;
|
|
1737
|
+
}
|
|
1738
|
+
this.factor.load(data.factor);
|
|
1739
|
+
this.rate.load(data.rate);
|
|
1740
|
+
if (data.particles !== undefined) {
|
|
1741
|
+
this.particles = deepExtend({}, data.particles);
|
|
1742
|
+
}
|
|
1743
|
+
if (data.sizeOffset !== undefined) {
|
|
1744
|
+
this.sizeOffset = data.sizeOffset;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
class Destroy_Destroy {
|
|
1749
|
+
constructor() {
|
|
1750
|
+
this.mode = "none";
|
|
1751
|
+
this.split = new Split;
|
|
1752
|
+
}
|
|
1753
|
+
load(data) {
|
|
1754
|
+
if (!data) {
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
if (data.mode !== undefined) {
|
|
1758
|
+
this.mode = data.mode;
|
|
1759
|
+
}
|
|
1760
|
+
this.split.load(data.split);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
class Wobble_Wobble {
|
|
1764
|
+
constructor() {
|
|
1765
|
+
this.distance = 5;
|
|
1766
|
+
this.enable = false;
|
|
1767
|
+
this.speed = 50;
|
|
1768
|
+
}
|
|
1769
|
+
load(data) {
|
|
1770
|
+
if (!data) {
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
if (data.distance !== undefined) {
|
|
1774
|
+
this.distance = setRangeValue(data.distance);
|
|
1775
|
+
}
|
|
1776
|
+
if (data.enable !== undefined) {
|
|
1777
|
+
this.enable = data.enable;
|
|
1778
|
+
}
|
|
1779
|
+
if (data.speed !== undefined) {
|
|
1780
|
+
this.speed = setRangeValue(data.speed);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
class Tilt_Tilt extends(null && ValueWithRandom){
|
|
1785
|
+
constructor() {
|
|
1786
|
+
super();
|
|
1787
|
+
this.animation = new TiltAnimation;
|
|
1788
|
+
this.direction = "clockwise";
|
|
1789
|
+
this.enable = false;
|
|
1790
|
+
this.value = 0;
|
|
1791
|
+
}
|
|
1792
|
+
load(data) {
|
|
1793
|
+
if (!data) {
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
super.load(data);
|
|
1797
|
+
this.animation.load(data.animation);
|
|
1798
|
+
if (data.direction !== undefined) {
|
|
1799
|
+
this.direction = data.direction;
|
|
1800
|
+
}
|
|
1801
|
+
if (data.enable !== undefined) {
|
|
1802
|
+
this.enable = data.enable;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
class Roll_Roll {
|
|
1807
|
+
constructor() {
|
|
1808
|
+
this.darken = new RollLight;
|
|
1809
|
+
this.enable = false;
|
|
1810
|
+
this.enlighten = new RollLight;
|
|
1811
|
+
this.mode = "vertical";
|
|
1812
|
+
this.speed = 25;
|
|
1813
|
+
}
|
|
1814
|
+
load(data) {
|
|
1815
|
+
if (!data) {
|
|
1816
|
+
return;
|
|
1817
|
+
}
|
|
1818
|
+
if (data.backColor !== undefined) {
|
|
1819
|
+
this.backColor = OptionsColor.create(this.backColor, data.backColor);
|
|
1820
|
+
}
|
|
1821
|
+
this.darken.load(data.darken);
|
|
1822
|
+
if (data.enable !== undefined) {
|
|
1823
|
+
this.enable = data.enable;
|
|
1824
|
+
}
|
|
1825
|
+
this.enlighten.load(data.enlighten);
|
|
1826
|
+
if (data.mode !== undefined) {
|
|
1827
|
+
this.mode = data.mode;
|
|
1828
|
+
}
|
|
1829
|
+
if (data.speed !== undefined) {
|
|
1830
|
+
this.speed = setRangeValue(data.speed);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
class ZIndex_ZIndex extends(null && ValueWithRandom){
|
|
1835
|
+
constructor() {
|
|
1836
|
+
super();
|
|
1837
|
+
this.opacityRate = 1;
|
|
1838
|
+
this.sizeRate = 1;
|
|
1839
|
+
this.velocityRate = 1;
|
|
1840
|
+
}
|
|
1841
|
+
load(data) {
|
|
1842
|
+
super.load(data);
|
|
1843
|
+
if (!data) {
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
if (data.opacityRate !== undefined) {
|
|
1847
|
+
this.opacityRate = data.opacityRate;
|
|
1848
|
+
}
|
|
1849
|
+
if (data.sizeRate !== undefined) {
|
|
1850
|
+
this.sizeRate = data.sizeRate;
|
|
1851
|
+
}
|
|
1852
|
+
if (data.velocityRate !== undefined) {
|
|
1853
|
+
this.velocityRate = data.velocityRate;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
class OrbitRotation_OrbitRotation extends(null && ValueWithRandom){
|
|
1858
|
+
constructor() {
|
|
1859
|
+
super();
|
|
1860
|
+
this.value = 45;
|
|
1861
|
+
this.random.enable = false;
|
|
1862
|
+
this.random.minimumValue = 0;
|
|
1863
|
+
}
|
|
1864
|
+
load(data) {
|
|
1865
|
+
if (data === undefined) {
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
super.load(data);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
class Orbit_Orbit {
|
|
1872
|
+
constructor() {
|
|
1873
|
+
this.animation = new AnimationOptions;
|
|
1874
|
+
this.enable = false;
|
|
1875
|
+
this.opacity = 1;
|
|
1876
|
+
this.rotation = new OrbitRotation;
|
|
1877
|
+
this.width = 1;
|
|
1878
|
+
}
|
|
1879
|
+
load(data) {
|
|
1880
|
+
if (data === undefined) {
|
|
1881
|
+
return;
|
|
1882
|
+
}
|
|
1883
|
+
this.animation.load(data.animation);
|
|
1884
|
+
this.rotation.load(data.rotation);
|
|
1885
|
+
if (data.enable !== undefined) {
|
|
1886
|
+
this.enable = data.enable;
|
|
1887
|
+
}
|
|
1888
|
+
if (data.opacity !== undefined) {
|
|
1889
|
+
this.opacity = data.opacity;
|
|
1890
|
+
}
|
|
1891
|
+
if (data.width !== undefined) {
|
|
1892
|
+
this.width = data.width;
|
|
1893
|
+
}
|
|
1894
|
+
if (data.radius !== undefined) {
|
|
1895
|
+
this.radius = data.radius;
|
|
1896
|
+
}
|
|
1897
|
+
if (data.color !== undefined) {
|
|
1898
|
+
this.color = OptionsColor.create(this.color, data.color);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
class Repulse_Repulse extends(null && ValueWithRandom){
|
|
1903
|
+
constructor() {
|
|
1904
|
+
super();
|
|
1905
|
+
this.enabled = false;
|
|
1906
|
+
this.distance = 1;
|
|
1907
|
+
this.duration = 1;
|
|
1908
|
+
this.factor = 1;
|
|
1909
|
+
this.speed = 1;
|
|
1910
|
+
}
|
|
1911
|
+
load(data) {
|
|
1912
|
+
super.load(data);
|
|
1913
|
+
if (!data) {
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
if (data.enabled !== undefined) {
|
|
1917
|
+
this.enabled = data.enabled;
|
|
1918
|
+
}
|
|
1919
|
+
if (data.distance !== undefined) {
|
|
1920
|
+
this.distance = data.distance;
|
|
1921
|
+
}
|
|
1922
|
+
if (data.duration !== undefined) {
|
|
1923
|
+
this.duration = data.duration;
|
|
1924
|
+
}
|
|
1925
|
+
if (data.factor !== undefined) {
|
|
1926
|
+
this.factor = data.factor;
|
|
1927
|
+
}
|
|
1928
|
+
if (data.speed !== undefined) {
|
|
1929
|
+
this.speed = data.speed;
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
class AnimatableGradient_AnimatableGradient {
|
|
1934
|
+
constructor() {
|
|
1935
|
+
this.angle = new GradientAngle;
|
|
1936
|
+
this.colors = [];
|
|
1937
|
+
this.type = "random";
|
|
1938
|
+
}
|
|
1939
|
+
load(data) {
|
|
1940
|
+
if (!data) {
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
this.angle.load(data.angle);
|
|
1944
|
+
if (data.colors !== undefined) {
|
|
1945
|
+
this.colors = data.colors.map((s => {
|
|
1946
|
+
const tmp = new AnimatableGradientColor;
|
|
1947
|
+
tmp.load(s);
|
|
1948
|
+
return tmp;
|
|
1949
|
+
}));
|
|
1950
|
+
}
|
|
1951
|
+
if (data.type !== undefined) {
|
|
1952
|
+
this.type = data.type;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
class GradientAngle {
|
|
1957
|
+
constructor() {
|
|
1958
|
+
this.value = 0;
|
|
1959
|
+
this.animation = new GradientAngleAnimation;
|
|
1960
|
+
this.direction = "clockwise";
|
|
1961
|
+
}
|
|
1962
|
+
load(data) {
|
|
1963
|
+
if (!data) {
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
this.animation.load(data.animation);
|
|
1967
|
+
if (data.value !== undefined) {
|
|
1968
|
+
this.value = data.value;
|
|
1969
|
+
}
|
|
1970
|
+
if (data.direction !== undefined) {
|
|
1971
|
+
this.direction = data.direction;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
class GradientColorOpacity {
|
|
1976
|
+
constructor() {
|
|
1977
|
+
this.value = 0;
|
|
1978
|
+
this.animation = new GradientColorOpacityAnimation;
|
|
1979
|
+
}
|
|
1980
|
+
load(data) {
|
|
1981
|
+
if (!data) {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
this.animation.load(data.animation);
|
|
1985
|
+
if (data.value !== undefined) {
|
|
1986
|
+
this.value = setRangeValue(data.value);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
class AnimatableGradientColor {
|
|
1991
|
+
constructor() {
|
|
1992
|
+
this.stop = 0;
|
|
1993
|
+
this.value = new AnimatableColor;
|
|
1994
|
+
}
|
|
1995
|
+
load(data) {
|
|
1996
|
+
if (!data) {
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
if (data.stop !== undefined) {
|
|
2000
|
+
this.stop = data.stop;
|
|
2001
|
+
}
|
|
2002
|
+
this.value = AnimatableColor.create(this.value, data.value);
|
|
2003
|
+
if (data.opacity !== undefined) {
|
|
2004
|
+
this.opacity = new GradientColorOpacity;
|
|
2005
|
+
if (typeof data.opacity === "number") {
|
|
2006
|
+
this.opacity.value = data.opacity;
|
|
2007
|
+
} else {
|
|
2008
|
+
this.opacity.load(data.opacity);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
class GradientAngleAnimation {
|
|
2014
|
+
constructor() {
|
|
2015
|
+
this.count = 0;
|
|
2016
|
+
this.enable = false;
|
|
2017
|
+
this.speed = 0;
|
|
2018
|
+
this.sync = false;
|
|
2019
|
+
}
|
|
2020
|
+
load(data) {
|
|
2021
|
+
if (!data) {
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
if (data.count !== undefined) {
|
|
2025
|
+
this.count = data.count;
|
|
2026
|
+
}
|
|
2027
|
+
if (data.enable !== undefined) {
|
|
2028
|
+
this.enable = data.enable;
|
|
2029
|
+
}
|
|
2030
|
+
if (data.speed !== undefined) {
|
|
2031
|
+
this.speed = data.speed;
|
|
2032
|
+
}
|
|
2033
|
+
if (data.sync !== undefined) {
|
|
2034
|
+
this.sync = data.sync;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
class GradientColorOpacityAnimation {
|
|
2039
|
+
constructor() {
|
|
2040
|
+
this.count = 0;
|
|
2041
|
+
this.enable = false;
|
|
2042
|
+
this.speed = 0;
|
|
2043
|
+
this.sync = false;
|
|
2044
|
+
this.startValue = "random";
|
|
2045
|
+
}
|
|
2046
|
+
load(data) {
|
|
2047
|
+
if (!data) {
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
if (data.count !== undefined) {
|
|
2051
|
+
this.count = data.count;
|
|
2052
|
+
}
|
|
2053
|
+
if (data.enable !== undefined) {
|
|
2054
|
+
this.enable = data.enable;
|
|
2055
|
+
}
|
|
2056
|
+
if (data.speed !== undefined) {
|
|
2057
|
+
this.speed = data.speed;
|
|
2058
|
+
}
|
|
2059
|
+
if (data.sync !== undefined) {
|
|
2060
|
+
this.sync = data.sync;
|
|
2061
|
+
}
|
|
2062
|
+
if (data.startValue !== undefined) {
|
|
2063
|
+
this.startValue = data.startValue;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
class ParticlesOptions_ParticlesOptions {
|
|
2068
|
+
constructor() {
|
|
2069
|
+
this.bounce = new Bounce;
|
|
2070
|
+
this.collisions = new Collisions;
|
|
2071
|
+
this.color = new AnimatableColor;
|
|
2072
|
+
this.destroy = new Destroy;
|
|
2073
|
+
this.gradient = [];
|
|
2074
|
+
this.groups = {};
|
|
2075
|
+
this.life = new Life;
|
|
2076
|
+
this.links = new Links;
|
|
2077
|
+
this.move = new Move;
|
|
2078
|
+
this.number = new ParticlesNumber;
|
|
2079
|
+
this.opacity = new Opacity;
|
|
2080
|
+
this.orbit = new Orbit;
|
|
2081
|
+
this.reduceDuplicates = false;
|
|
2082
|
+
this.repulse = new Repulse;
|
|
2083
|
+
this.roll = new Roll;
|
|
2084
|
+
this.rotate = new Rotate;
|
|
2085
|
+
this.shadow = new Shadow;
|
|
2086
|
+
this.shape = new Shape;
|
|
2087
|
+
this.size = new Size;
|
|
2088
|
+
this.stroke = new Stroke;
|
|
2089
|
+
this.tilt = new Tilt;
|
|
2090
|
+
this.twinkle = new Twinkle;
|
|
2091
|
+
this.wobble = new Wobble;
|
|
2092
|
+
this.zIndex = new ZIndex;
|
|
2093
|
+
}
|
|
2094
|
+
get line_linked() {
|
|
2095
|
+
return this.links;
|
|
2096
|
+
}
|
|
2097
|
+
set line_linked(value) {
|
|
2098
|
+
this.links = value;
|
|
2099
|
+
}
|
|
2100
|
+
get lineLinked() {
|
|
2101
|
+
return this.links;
|
|
2102
|
+
}
|
|
2103
|
+
set lineLinked(value) {
|
|
2104
|
+
this.links = value;
|
|
2105
|
+
}
|
|
2106
|
+
load(data) {
|
|
2107
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2108
|
+
if (data === undefined) {
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
this.bounce.load(data.bounce);
|
|
2112
|
+
this.color.load(AnimatableColor.create(this.color, data.color));
|
|
2113
|
+
this.destroy.load(data.destroy);
|
|
2114
|
+
this.life.load(data.life);
|
|
2115
|
+
const links = (_b = (_a = data.links) !== null && _a !== void 0 ? _a : data.lineLinked) !== null && _b !== void 0 ? _b : data.line_linked;
|
|
2116
|
+
if (links !== undefined) {
|
|
2117
|
+
this.links.load(links);
|
|
2118
|
+
}
|
|
2119
|
+
if (data.groups !== undefined) {
|
|
2120
|
+
for (const group in data.groups) {
|
|
2121
|
+
const item = data.groups[group];
|
|
2122
|
+
if (item !== undefined) {
|
|
2123
|
+
this.groups[group] = deepExtend((_c = this.groups[group]) !== null && _c !== void 0 ? _c : {}, item);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
this.move.load(data.move);
|
|
2128
|
+
this.number.load(data.number);
|
|
2129
|
+
this.opacity.load(data.opacity);
|
|
2130
|
+
this.orbit.load(data.orbit);
|
|
2131
|
+
if (data.reduceDuplicates !== undefined) {
|
|
2132
|
+
this.reduceDuplicates = data.reduceDuplicates;
|
|
2133
|
+
}
|
|
2134
|
+
this.repulse.load(data.repulse);
|
|
2135
|
+
this.roll.load(data.roll);
|
|
2136
|
+
this.rotate.load(data.rotate);
|
|
2137
|
+
this.shape.load(data.shape);
|
|
2138
|
+
this.size.load(data.size);
|
|
2139
|
+
this.shadow.load(data.shadow);
|
|
2140
|
+
this.tilt.load(data.tilt);
|
|
2141
|
+
this.twinkle.load(data.twinkle);
|
|
2142
|
+
this.wobble.load(data.wobble);
|
|
2143
|
+
this.zIndex.load(data.zIndex);
|
|
2144
|
+
const collisions = (_e = (_d = data.move) === null || _d === void 0 ? void 0 : _d.collisions) !== null && _e !== void 0 ? _e : (_f = data.move) === null || _f === void 0 ? void 0 : _f.bounce;
|
|
2145
|
+
if (collisions !== undefined) {
|
|
2146
|
+
this.collisions.enable = collisions;
|
|
2147
|
+
}
|
|
2148
|
+
this.collisions.load(data.collisions);
|
|
2149
|
+
const strokeToLoad = (_g = data.stroke) !== null && _g !== void 0 ? _g : (_h = data.shape) === null || _h === void 0 ? void 0 : _h.stroke;
|
|
2150
|
+
if (strokeToLoad) {
|
|
2151
|
+
if (strokeToLoad instanceof Array) {
|
|
2152
|
+
this.stroke = strokeToLoad.map((s => {
|
|
2153
|
+
const tmp = new Stroke;
|
|
2154
|
+
tmp.load(s);
|
|
2155
|
+
return tmp;
|
|
2156
|
+
}));
|
|
2157
|
+
} else {
|
|
2158
|
+
if (this.stroke instanceof Array) {
|
|
2159
|
+
this.stroke = new Stroke;
|
|
2160
|
+
}
|
|
2161
|
+
this.stroke.load(strokeToLoad);
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
const gradientToLoad = data.gradient;
|
|
2165
|
+
if (gradientToLoad) {
|
|
2166
|
+
if (gradientToLoad instanceof Array) {
|
|
2167
|
+
this.gradient = gradientToLoad.map((s => {
|
|
2168
|
+
const tmp = new AnimatableGradient;
|
|
2169
|
+
tmp.load(s);
|
|
2170
|
+
return tmp;
|
|
2171
|
+
}));
|
|
2172
|
+
} else {
|
|
2173
|
+
if (this.gradient instanceof Array) {
|
|
2174
|
+
this.gradient = new AnimatableGradient;
|
|
2175
|
+
}
|
|
2176
|
+
this.gradient.load(gradientToLoad);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
const fixOutMode = data => {
|
|
2182
|
+
if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
|
|
2183
|
+
if (data.coord > data.maxCoord - data.radius * 2) {
|
|
2184
|
+
data.setCb(-data.radius);
|
|
2185
|
+
} else if (data.coord < data.radius * 2) {
|
|
2186
|
+
data.setCb(data.radius);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
};
|
|
2190
|
+
class Particle_Particle {
|
|
2191
|
+
constructor(id, container, position, overrideOptions, group) {
|
|
2192
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2193
|
+
this.id = id;
|
|
2194
|
+
this.container = container;
|
|
2195
|
+
this.group = group;
|
|
2196
|
+
this.fill = true;
|
|
2197
|
+
this.close = true;
|
|
2198
|
+
this.lastPathTime = 0;
|
|
2199
|
+
this.destroyed = false;
|
|
2200
|
+
this.unbreakable = false;
|
|
2201
|
+
this.splitCount = 0;
|
|
2202
|
+
this.misplaced = false;
|
|
2203
|
+
this.retina = {
|
|
2204
|
+
maxDistance: {}
|
|
2205
|
+
};
|
|
2206
|
+
const pxRatio = container.retina.pixelRatio;
|
|
2207
|
+
const mainOptions = container.actualOptions;
|
|
2208
|
+
const particlesOptions = new ParticlesOptions;
|
|
2209
|
+
particlesOptions.load(mainOptions.particles);
|
|
2210
|
+
const shapeType = particlesOptions.shape.type;
|
|
2211
|
+
const reduceDuplicates = particlesOptions.reduceDuplicates;
|
|
2212
|
+
this.shape = shapeType instanceof Array ? itemFromArray(shapeType, this.id, reduceDuplicates) : shapeType;
|
|
2213
|
+
if (overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.shape) {
|
|
2214
|
+
if (overrideOptions.shape.type) {
|
|
2215
|
+
const overrideShapeType = overrideOptions.shape.type;
|
|
2216
|
+
this.shape = overrideShapeType instanceof Array ? itemFromArray(overrideShapeType, this.id, reduceDuplicates) : overrideShapeType;
|
|
2217
|
+
}
|
|
2218
|
+
const shapeOptions = new Shape;
|
|
2219
|
+
shapeOptions.load(overrideOptions.shape);
|
|
2220
|
+
if (this.shape) {
|
|
2221
|
+
this.shapeData = this.loadShapeData(shapeOptions, reduceDuplicates);
|
|
2222
|
+
}
|
|
2223
|
+
} else {
|
|
2224
|
+
this.shapeData = this.loadShapeData(particlesOptions.shape, reduceDuplicates);
|
|
2225
|
+
}
|
|
2226
|
+
if (overrideOptions !== undefined) {
|
|
2227
|
+
particlesOptions.load(overrideOptions);
|
|
2228
|
+
}
|
|
2229
|
+
if (((_a = this.shapeData) === null || _a === void 0 ? void 0 : _a.particles) !== undefined) {
|
|
2230
|
+
particlesOptions.load((_b = this.shapeData) === null || _b === void 0 ? void 0 : _b.particles);
|
|
2231
|
+
}
|
|
2232
|
+
this.fill = (_d = (_c = this.shapeData) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.fill;
|
|
2233
|
+
this.close = (_f = (_e = this.shapeData) === null || _e === void 0 ? void 0 : _e.close) !== null && _f !== void 0 ? _f : this.close;
|
|
2234
|
+
this.options = particlesOptions;
|
|
2235
|
+
this.pathDelay = getValue(this.options.move.path.delay) * 1e3;
|
|
2236
|
+
const zIndexValue = getRangeValue(this.options.zIndex.value);
|
|
2237
|
+
container.retina.initParticle(this);
|
|
2238
|
+
const sizeOptions = this.options.size, sizeRange = sizeOptions.value;
|
|
2239
|
+
this.size = {
|
|
2240
|
+
enable: sizeOptions.animation.enable,
|
|
2241
|
+
value: getValue(sizeOptions) * container.retina.pixelRatio,
|
|
2242
|
+
max: getRangeMax(sizeRange) * pxRatio,
|
|
2243
|
+
min: getRangeMin(sizeRange) * pxRatio,
|
|
2244
|
+
loops: 0,
|
|
2245
|
+
maxLoops: sizeOptions.animation.count
|
|
2246
|
+
};
|
|
2247
|
+
const sizeAnimation = sizeOptions.animation;
|
|
2248
|
+
if (sizeAnimation.enable) {
|
|
2249
|
+
this.size.status = 0;
|
|
2250
|
+
switch (sizeAnimation.startValue) {
|
|
2251
|
+
case "min":
|
|
2252
|
+
this.size.value = this.size.min;
|
|
2253
|
+
this.size.status = 0;
|
|
2254
|
+
break;
|
|
2255
|
+
|
|
2256
|
+
case "random":
|
|
2257
|
+
this.size.value = randomInRange(this.size) * pxRatio;
|
|
2258
|
+
this.size.status = Math.random() >= .5 ? 0 : 1;
|
|
2259
|
+
break;
|
|
2260
|
+
|
|
2261
|
+
case "max":
|
|
2262
|
+
default:
|
|
2263
|
+
this.size.value = this.size.max;
|
|
2264
|
+
this.size.status = 1;
|
|
2265
|
+
break;
|
|
2266
|
+
}
|
|
2267
|
+
this.size.velocity = ((_g = this.retina.sizeAnimationSpeed) !== null && _g !== void 0 ? _g : container.retina.sizeAnimationSpeed) / 100 * container.retina.reduceFactor;
|
|
2268
|
+
if (!sizeAnimation.sync) {
|
|
2269
|
+
this.size.velocity *= Math.random();
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
this.direction = getParticleDirectionAngle(this.options.move.direction);
|
|
2273
|
+
this.bubble = {
|
|
2274
|
+
inRange: false
|
|
2275
|
+
};
|
|
2276
|
+
this.initialVelocity = this.calculateVelocity();
|
|
2277
|
+
this.velocity = this.initialVelocity.copy();
|
|
2278
|
+
this.moveDecay = 1 - getRangeValue(this.options.move.decay);
|
|
2279
|
+
this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
|
|
2280
|
+
this.initialPosition = this.position.copy();
|
|
2281
|
+
this.offset = Vector.origin;
|
|
2282
|
+
const particles = container.particles;
|
|
2283
|
+
particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
|
|
2284
|
+
particles.lastZIndex = this.position.z;
|
|
2285
|
+
this.zIndexFactor = this.position.z / container.zLayers;
|
|
2286
|
+
this.sides = 24;
|
|
2287
|
+
let drawer = container.drawers.get(this.shape);
|
|
2288
|
+
if (!drawer) {
|
|
2289
|
+
drawer = Plugins.getShapeDrawer(this.shape);
|
|
2290
|
+
if (drawer) {
|
|
2291
|
+
container.drawers.set(this.shape, drawer);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
if (drawer === null || drawer === void 0 ? void 0 : drawer.loadShape) {
|
|
2295
|
+
drawer === null || drawer === void 0 ? void 0 : drawer.loadShape(this);
|
|
2296
|
+
}
|
|
2297
|
+
const sideCountFunc = drawer === null || drawer === void 0 ? void 0 : drawer.getSidesCount;
|
|
2298
|
+
if (sideCountFunc) {
|
|
2299
|
+
this.sides = sideCountFunc(this);
|
|
2300
|
+
}
|
|
2301
|
+
this.life = this.loadLife();
|
|
2302
|
+
this.spawning = this.life.delay > 0;
|
|
2303
|
+
if (this.options.move.spin.enable) {
|
|
2304
|
+
const spinPos = (_h = this.options.move.spin.position) !== null && _h !== void 0 ? _h : {
|
|
2305
|
+
x: 50,
|
|
2306
|
+
y: 50
|
|
2307
|
+
};
|
|
2308
|
+
const spinCenter = {
|
|
2309
|
+
x: spinPos.x / 100 * container.canvas.size.width,
|
|
2310
|
+
y: spinPos.y / 100 * container.canvas.size.height
|
|
2311
|
+
};
|
|
2312
|
+
const pos = this.getPosition();
|
|
2313
|
+
const distance = getDistance(pos, spinCenter);
|
|
2314
|
+
this.spin = {
|
|
2315
|
+
center: spinCenter,
|
|
2316
|
+
direction: this.velocity.x >= 0 ? "clockwise" : "counter-clockwise",
|
|
2317
|
+
angle: this.velocity.angle,
|
|
2318
|
+
radius: distance,
|
|
2319
|
+
acceleration: (_j = this.retina.spinAcceleration) !== null && _j !== void 0 ? _j : getRangeValue(this.options.move.spin.acceleration)
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
2322
|
+
this.shadowColor = colorToRgb(this.options.shadow.color);
|
|
2323
|
+
for (const updater of container.particles.updaters) {
|
|
2324
|
+
if (updater.init) {
|
|
2325
|
+
updater.init(this);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
if (drawer && drawer.particleInit) {
|
|
2329
|
+
drawer.particleInit(container, this);
|
|
2330
|
+
}
|
|
2331
|
+
for (const [, plugin] of container.plugins) {
|
|
2332
|
+
if (plugin.particleCreated) {
|
|
2333
|
+
plugin.particleCreated(this);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
isVisible() {
|
|
2338
|
+
return !this.destroyed && !this.spawning && this.isInsideCanvas();
|
|
2339
|
+
}
|
|
2340
|
+
isInsideCanvas() {
|
|
2341
|
+
const radius = this.getRadius();
|
|
2342
|
+
const canvasSize = this.container.canvas.size;
|
|
2343
|
+
return this.position.x >= -radius && this.position.y >= -radius && this.position.y <= canvasSize.height + radius && this.position.x <= canvasSize.width + radius;
|
|
2344
|
+
}
|
|
2345
|
+
draw(delta) {
|
|
2346
|
+
const container = this.container;
|
|
2347
|
+
for (const [, plugin] of container.plugins) {
|
|
2348
|
+
container.canvas.drawParticlePlugin(plugin, this, delta);
|
|
2349
|
+
}
|
|
2350
|
+
container.canvas.drawParticle(this, delta);
|
|
2351
|
+
}
|
|
2352
|
+
getPosition() {
|
|
2353
|
+
return {
|
|
2354
|
+
x: this.position.x + this.offset.x,
|
|
2355
|
+
y: this.position.y + this.offset.y,
|
|
2356
|
+
z: this.position.z
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
getRadius() {
|
|
2360
|
+
var _a;
|
|
2361
|
+
return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
|
|
2362
|
+
}
|
|
2363
|
+
getMass() {
|
|
2364
|
+
return this.getRadius() ** 2 * Math.PI / 2;
|
|
2365
|
+
}
|
|
2366
|
+
getFillColor() {
|
|
2367
|
+
var _a, _b, _c;
|
|
2368
|
+
const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
|
|
2369
|
+
if (color && this.roll && (this.backColor || this.roll.alter)) {
|
|
2370
|
+
const rolled = Math.floor(((_c = (_b = this.roll) === null || _b === void 0 ? void 0 : _b.angle) !== null && _c !== void 0 ? _c : 0) / (Math.PI / 2)) % 2;
|
|
2371
|
+
if (rolled) {
|
|
2372
|
+
if (this.backColor) {
|
|
2373
|
+
return this.backColor;
|
|
2374
|
+
}
|
|
2375
|
+
if (this.roll.alter) {
|
|
2376
|
+
return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
return color;
|
|
2381
|
+
}
|
|
2382
|
+
getStrokeColor() {
|
|
2383
|
+
var _a, _b;
|
|
2384
|
+
return (_b = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor)) !== null && _b !== void 0 ? _b : this.getFillColor();
|
|
2385
|
+
}
|
|
2386
|
+
destroy(override) {
|
|
2387
|
+
this.destroyed = true;
|
|
2388
|
+
this.bubble.inRange = false;
|
|
2389
|
+
if (this.unbreakable) {
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
this.destroyed = true;
|
|
2393
|
+
this.bubble.inRange = false;
|
|
2394
|
+
for (const [, plugin] of this.container.plugins) {
|
|
2395
|
+
if (plugin.particleDestroyed) {
|
|
2396
|
+
plugin.particleDestroyed(this, override);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
if (override) {
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
const destroyOptions = this.options.destroy;
|
|
2403
|
+
if (destroyOptions.mode === "split") {
|
|
2404
|
+
this.split();
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
reset() {
|
|
2408
|
+
if (this.opacity) {
|
|
2409
|
+
this.opacity.loops = 0;
|
|
2410
|
+
}
|
|
2411
|
+
this.size.loops = 0;
|
|
2412
|
+
}
|
|
2413
|
+
split() {
|
|
2414
|
+
const splitOptions = this.options.destroy.split;
|
|
2415
|
+
if (splitOptions.count >= 0 && this.splitCount++ > splitOptions.count) {
|
|
2416
|
+
return;
|
|
2417
|
+
}
|
|
2418
|
+
const rate = getRangeValue(splitOptions.rate.value);
|
|
2419
|
+
for (let i = 0; i < rate; i++) {
|
|
2420
|
+
this.container.particles.addSplitParticle(this);
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
calcPosition(container, position, zIndex, tryCount = 0) {
|
|
2424
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2425
|
+
for (const [, plugin] of container.plugins) {
|
|
2426
|
+
const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
|
|
2427
|
+
if (pluginPos !== undefined) {
|
|
2428
|
+
return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
const canvasSize = container.canvas.size;
|
|
2432
|
+
const pos = Vector3d.create((_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : Math.random() * canvasSize.width, (_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : Math.random() * canvasSize.height, zIndex);
|
|
2433
|
+
const radius = this.getRadius();
|
|
2434
|
+
const outModes = this.options.move.outModes, fixHorizontal = outMode => {
|
|
2435
|
+
fixOutMode({
|
|
2436
|
+
outMode: outMode,
|
|
2437
|
+
checkModes: [ "bounce", "bounce-horizontal" ],
|
|
2438
|
+
coord: pos.x,
|
|
2439
|
+
maxCoord: container.canvas.size.width,
|
|
2440
|
+
setCb: value => pos.x += value,
|
|
2441
|
+
radius: radius
|
|
2442
|
+
});
|
|
2443
|
+
}, fixVertical = outMode => {
|
|
2444
|
+
fixOutMode({
|
|
2445
|
+
outMode: outMode,
|
|
2446
|
+
checkModes: [ "bounce", "bounce-vertical" ],
|
|
2447
|
+
coord: pos.y,
|
|
2448
|
+
maxCoord: container.canvas.size.height,
|
|
2449
|
+
setCb: value => pos.y += value,
|
|
2450
|
+
radius: radius
|
|
2451
|
+
});
|
|
2452
|
+
};
|
|
2453
|
+
fixHorizontal((_c = outModes.left) !== null && _c !== void 0 ? _c : outModes.default);
|
|
2454
|
+
fixHorizontal((_d = outModes.right) !== null && _d !== void 0 ? _d : outModes.default);
|
|
2455
|
+
fixVertical((_e = outModes.top) !== null && _e !== void 0 ? _e : outModes.default);
|
|
2456
|
+
fixVertical((_f = outModes.bottom) !== null && _f !== void 0 ? _f : outModes.default);
|
|
2457
|
+
if (this.checkOverlap(pos, tryCount)) {
|
|
2458
|
+
return this.calcPosition(container, undefined, zIndex, tryCount + 1);
|
|
2459
|
+
}
|
|
2460
|
+
return pos;
|
|
2461
|
+
}
|
|
2462
|
+
checkOverlap(pos, tryCount = 0) {
|
|
2463
|
+
const collisionsOptions = this.options.collisions;
|
|
2464
|
+
const radius = this.getRadius();
|
|
2465
|
+
if (!collisionsOptions.enable) {
|
|
2466
|
+
return false;
|
|
2467
|
+
}
|
|
2468
|
+
const overlapOptions = collisionsOptions.overlap;
|
|
2469
|
+
if (overlapOptions.enable) {
|
|
2470
|
+
return false;
|
|
2471
|
+
}
|
|
2472
|
+
const retries = overlapOptions.retries;
|
|
2473
|
+
if (retries >= 0 && tryCount > retries) {
|
|
2474
|
+
throw new Error("Particle is overlapping and can't be placed");
|
|
2475
|
+
}
|
|
2476
|
+
let overlaps = false;
|
|
2477
|
+
for (const particle of this.container.particles.array) {
|
|
2478
|
+
if (getDistance(pos, particle.position) < radius + particle.getRadius()) {
|
|
2479
|
+
overlaps = true;
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
return overlaps;
|
|
2484
|
+
}
|
|
2485
|
+
calculateVelocity() {
|
|
2486
|
+
const baseVelocity = getParticleBaseVelocity(this.direction);
|
|
2487
|
+
const res = baseVelocity.copy();
|
|
2488
|
+
const moveOptions = this.options.move;
|
|
2489
|
+
const rad = Math.PI / 180 * moveOptions.angle.value;
|
|
2490
|
+
const radOffset = Math.PI / 180 * moveOptions.angle.offset;
|
|
2491
|
+
const range = {
|
|
2492
|
+
left: radOffset - rad / 2,
|
|
2493
|
+
right: radOffset + rad / 2
|
|
2494
|
+
};
|
|
2495
|
+
if (!moveOptions.straight) {
|
|
2496
|
+
res.angle += randomInRange(setRangeValue(range.left, range.right));
|
|
2497
|
+
}
|
|
2498
|
+
if (moveOptions.random && typeof moveOptions.speed === "number") {
|
|
2499
|
+
res.length *= Math.random();
|
|
2500
|
+
}
|
|
2501
|
+
return res;
|
|
2502
|
+
}
|
|
2503
|
+
loadShapeData(shapeOptions, reduceDuplicates) {
|
|
2504
|
+
const shapeData = shapeOptions.options[this.shape];
|
|
2505
|
+
if (shapeData) {
|
|
2506
|
+
return deepExtend({}, shapeData instanceof Array ? itemFromArray(shapeData, this.id, reduceDuplicates) : shapeData);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
loadLife() {
|
|
2510
|
+
const container = this.container;
|
|
2511
|
+
const particlesOptions = this.options;
|
|
2512
|
+
const lifeOptions = particlesOptions.life;
|
|
2513
|
+
const life = {
|
|
2514
|
+
delay: container.retina.reduceFactor ? getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1e3 : 0,
|
|
2515
|
+
delayTime: 0,
|
|
2516
|
+
duration: container.retina.reduceFactor ? getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1e3 : 0,
|
|
2517
|
+
time: 0,
|
|
2518
|
+
count: particlesOptions.life.count
|
|
2519
|
+
};
|
|
2520
|
+
if (life.duration <= 0) {
|
|
2521
|
+
life.duration = -1;
|
|
2522
|
+
}
|
|
2523
|
+
if (life.count <= 0) {
|
|
2524
|
+
life.count = -1;
|
|
2525
|
+
}
|
|
2526
|
+
return life;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
class Particles_Particles {
|
|
2530
|
+
constructor(container) {
|
|
2531
|
+
this.container = container;
|
|
2532
|
+
this.nextId = 0;
|
|
2533
|
+
this.array = [];
|
|
2534
|
+
this.zArray = [];
|
|
2535
|
+
this.mover = new ParticlesMover(container);
|
|
2536
|
+
this.limit = 0;
|
|
2537
|
+
this.needsSort = false;
|
|
2538
|
+
this.lastZIndex = 0;
|
|
2539
|
+
this.freqs = {
|
|
2540
|
+
links: new Map,
|
|
2541
|
+
triangles: new Map
|
|
2542
|
+
};
|
|
2543
|
+
this.interactionManager = new InteractionManager(container);
|
|
2544
|
+
const canvasSize = this.container.canvas.size;
|
|
2545
|
+
this.linksColors = new Map;
|
|
2546
|
+
this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
|
|
2547
|
+
this.updaters = Plugins.getUpdaters(container, true);
|
|
2548
|
+
}
|
|
2549
|
+
get count() {
|
|
2550
|
+
return this.array.length;
|
|
2551
|
+
}
|
|
2552
|
+
init() {
|
|
2553
|
+
var _a;
|
|
2554
|
+
const container = this.container;
|
|
2555
|
+
const options = container.actualOptions;
|
|
2556
|
+
this.lastZIndex = 0;
|
|
2557
|
+
this.needsSort = false;
|
|
2558
|
+
this.freqs.links = new Map;
|
|
2559
|
+
this.freqs.triangles = new Map;
|
|
2560
|
+
let handled = false;
|
|
2561
|
+
this.updaters = Plugins.getUpdaters(container, true);
|
|
2562
|
+
this.interactionManager.init();
|
|
2563
|
+
for (const [, plugin] of container.plugins) {
|
|
2564
|
+
if (plugin.particlesInitialization !== undefined) {
|
|
2565
|
+
handled = plugin.particlesInitialization();
|
|
2566
|
+
}
|
|
2567
|
+
if (handled) {
|
|
2568
|
+
break;
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
this.addManualParticles();
|
|
2572
|
+
if (!handled) {
|
|
2573
|
+
for (const group in options.particles.groups) {
|
|
2574
|
+
const groupOptions = options.particles.groups[group];
|
|
2575
|
+
for (let i = this.count, j = 0; j < ((_a = groupOptions.number) === null || _a === void 0 ? void 0 : _a.value) && i < options.particles.number.value; i++,
|
|
2576
|
+
j++) {
|
|
2577
|
+
this.addParticle(undefined, groupOptions, group);
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
for (let i = this.count; i < options.particles.number.value; i++) {
|
|
2581
|
+
this.addParticle();
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
container.pathGenerator.init(container);
|
|
2585
|
+
}
|
|
2586
|
+
redraw() {
|
|
2587
|
+
this.clear();
|
|
2588
|
+
this.init();
|
|
2589
|
+
this.draw({
|
|
2590
|
+
value: 0,
|
|
2591
|
+
factor: 0
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
removeAt(index, quantity = 1, group, override) {
|
|
2595
|
+
if (!(index >= 0 && index <= this.count)) {
|
|
2596
|
+
return;
|
|
2597
|
+
}
|
|
2598
|
+
let deleted = 0;
|
|
2599
|
+
for (let i = index; deleted < quantity && i < this.count; i++) {
|
|
2600
|
+
const particle = this.array[i];
|
|
2601
|
+
if (!particle || particle.group !== group) {
|
|
2602
|
+
continue;
|
|
2603
|
+
}
|
|
2604
|
+
particle.destroy(override);
|
|
2605
|
+
this.array.splice(i--, 1);
|
|
2606
|
+
const zIdx = this.zArray.indexOf(particle);
|
|
2607
|
+
this.zArray.splice(zIdx, 1);
|
|
2608
|
+
deleted++;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
remove(particle, group, override) {
|
|
2612
|
+
this.removeAt(this.array.indexOf(particle), undefined, group, override);
|
|
2613
|
+
}
|
|
2614
|
+
update(delta) {
|
|
2615
|
+
const container = this.container;
|
|
2616
|
+
const particlesToDelete = [];
|
|
2617
|
+
container.pathGenerator.update();
|
|
2618
|
+
for (const [, plugin] of container.plugins) {
|
|
2619
|
+
if (plugin.update !== undefined) {
|
|
2620
|
+
plugin.update(delta);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
for (const particle of this.array) {
|
|
2624
|
+
const resizeFactor = container.canvas.resizeFactor;
|
|
2625
|
+
if (resizeFactor) {
|
|
2626
|
+
particle.position.x *= resizeFactor.width;
|
|
2627
|
+
particle.position.y *= resizeFactor.height;
|
|
2628
|
+
}
|
|
2629
|
+
particle.bubble.inRange = false;
|
|
2630
|
+
for (const [, plugin] of this.container.plugins) {
|
|
2631
|
+
if (particle.destroyed) {
|
|
2632
|
+
break;
|
|
2633
|
+
}
|
|
2634
|
+
if (plugin.particleUpdate) {
|
|
2635
|
+
plugin.particleUpdate(particle, delta);
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
this.mover.move(particle, delta);
|
|
2639
|
+
if (particle.destroyed) {
|
|
2640
|
+
particlesToDelete.push(particle);
|
|
2641
|
+
continue;
|
|
2642
|
+
}
|
|
2643
|
+
this.quadTree.insert(new Point(particle.getPosition(), particle));
|
|
2644
|
+
}
|
|
2645
|
+
for (const particle of particlesToDelete) {
|
|
2646
|
+
this.remove(particle);
|
|
2647
|
+
}
|
|
2648
|
+
this.interactionManager.externalInteract(delta);
|
|
2649
|
+
for (const particle of container.particles.array) {
|
|
2650
|
+
for (const updater of this.updaters) {
|
|
2651
|
+
updater.update(particle, delta);
|
|
2652
|
+
}
|
|
2653
|
+
if (!particle.destroyed && !particle.spawning) {
|
|
2654
|
+
this.interactionManager.particlesInteract(particle, delta);
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
delete container.canvas.resizeFactor;
|
|
2658
|
+
}
|
|
2659
|
+
draw(delta) {
|
|
2660
|
+
const container = this.container;
|
|
2661
|
+
container.canvas.clear();
|
|
2662
|
+
const canvasSize = this.container.canvas.size;
|
|
2663
|
+
this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
|
|
2664
|
+
this.update(delta);
|
|
2665
|
+
if (this.needsSort) {
|
|
2666
|
+
this.zArray.sort(((a, b) => b.position.z - a.position.z || a.id - b.id));
|
|
2667
|
+
this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
|
|
2668
|
+
this.needsSort = false;
|
|
2669
|
+
}
|
|
2670
|
+
for (const [, plugin] of container.plugins) {
|
|
2671
|
+
container.canvas.drawPlugin(plugin, delta);
|
|
2672
|
+
}
|
|
2673
|
+
for (const p of this.zArray) {
|
|
2674
|
+
p.draw(delta);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
clear() {
|
|
2678
|
+
this.array = [];
|
|
2679
|
+
this.zArray = [];
|
|
2680
|
+
}
|
|
2681
|
+
push(nb, mouse, overrideOptions, group) {
|
|
2682
|
+
this.pushing = true;
|
|
2683
|
+
for (let i = 0; i < nb; i++) {
|
|
2684
|
+
this.addParticle(mouse === null || mouse === void 0 ? void 0 : mouse.position, overrideOptions, group);
|
|
2685
|
+
}
|
|
2686
|
+
this.pushing = false;
|
|
2687
|
+
}
|
|
2688
|
+
addParticle(position, overrideOptions, group) {
|
|
2689
|
+
const container = this.container, options = container.actualOptions, limit = options.particles.number.limit * container.density;
|
|
2690
|
+
if (limit > 0) {
|
|
2691
|
+
const countToRemove = this.count + 1 - limit;
|
|
2692
|
+
if (countToRemove > 0) {
|
|
2693
|
+
this.removeQuantity(countToRemove);
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
return this.pushParticle(position, overrideOptions, group);
|
|
2697
|
+
}
|
|
2698
|
+
addSplitParticle(parent) {
|
|
2699
|
+
const splitOptions = parent.options.destroy.split, options = new ParticlesOptions;
|
|
2700
|
+
options.load(parent.options);
|
|
2701
|
+
const factor = getRangeValue(splitOptions.factor.value);
|
|
2702
|
+
options.color.load({
|
|
2703
|
+
value: {
|
|
2704
|
+
hsl: parent.getFillColor()
|
|
2705
|
+
}
|
|
2706
|
+
});
|
|
2707
|
+
if (typeof options.size.value === "number") {
|
|
2708
|
+
options.size.value /= factor;
|
|
2709
|
+
} else {
|
|
2710
|
+
options.size.value.min /= factor;
|
|
2711
|
+
options.size.value.max /= factor;
|
|
2712
|
+
}
|
|
2713
|
+
options.load(splitOptions.particles);
|
|
2714
|
+
const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : 0;
|
|
2715
|
+
const position = {
|
|
2716
|
+
x: parent.position.x + randomInRange(offset),
|
|
2717
|
+
y: parent.position.y + randomInRange(offset)
|
|
2718
|
+
};
|
|
2719
|
+
return this.pushParticle(position, options, parent.group, (particle => {
|
|
2720
|
+
if (particle.size.value < .5) {
|
|
2721
|
+
return false;
|
|
2722
|
+
}
|
|
2723
|
+
particle.velocity.length = randomInRange(setRangeValue(parent.velocity.length, particle.velocity.length));
|
|
2724
|
+
particle.splitCount = parent.splitCount + 1;
|
|
2725
|
+
particle.unbreakable = true;
|
|
2726
|
+
setTimeout((() => {
|
|
2727
|
+
particle.unbreakable = false;
|
|
2728
|
+
}), 500);
|
|
2729
|
+
return true;
|
|
2730
|
+
}));
|
|
2731
|
+
}
|
|
2732
|
+
removeQuantity(quantity, group) {
|
|
2733
|
+
this.removeAt(0, quantity, group);
|
|
2734
|
+
}
|
|
2735
|
+
getLinkFrequency(p1, p2) {
|
|
2736
|
+
const range = setRangeValue(p1.id, p2.id), key = `${getRangeMin(range)}_${getRangeMax(range)}`;
|
|
2737
|
+
let res = this.freqs.links.get(key);
|
|
2738
|
+
if (res === undefined) {
|
|
2739
|
+
res = Math.random();
|
|
2740
|
+
this.freqs.links.set(key, res);
|
|
2741
|
+
}
|
|
2742
|
+
return res;
|
|
2743
|
+
}
|
|
2744
|
+
getTriangleFrequency(p1, p2, p3) {
|
|
2745
|
+
let [id1, id2, id3] = [ p1.id, p2.id, p3.id ];
|
|
2746
|
+
if (id1 > id2) {
|
|
2747
|
+
[id2, id1] = [ id1, id2 ];
|
|
2748
|
+
}
|
|
2749
|
+
if (id2 > id3) {
|
|
2750
|
+
[id3, id2] = [ id2, id3 ];
|
|
2751
|
+
}
|
|
2752
|
+
if (id1 > id3) {
|
|
2753
|
+
[id3, id1] = [ id1, id3 ];
|
|
2754
|
+
}
|
|
2755
|
+
const key = `${id1}_${id2}_${id3}`;
|
|
2756
|
+
let res = this.freqs.triangles.get(key);
|
|
2757
|
+
if (res === undefined) {
|
|
2758
|
+
res = Math.random();
|
|
2759
|
+
this.freqs.triangles.set(key, res);
|
|
2760
|
+
}
|
|
2761
|
+
return res;
|
|
2762
|
+
}
|
|
2763
|
+
addManualParticles() {
|
|
2764
|
+
const container = this.container, options = container.actualOptions;
|
|
2765
|
+
for (const particle of options.manualParticles) {
|
|
2766
|
+
const pos = particle.position ? {
|
|
2767
|
+
x: particle.position.x * container.canvas.size.width / 100,
|
|
2768
|
+
y: particle.position.y * container.canvas.size.height / 100
|
|
2769
|
+
} : undefined;
|
|
2770
|
+
this.addParticle(pos, particle.options);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
setDensity() {
|
|
2774
|
+
const options = this.container.actualOptions;
|
|
2775
|
+
for (const group in options.particles.groups) {
|
|
2776
|
+
this.applyDensity(options.particles.groups[group], 0, group);
|
|
2777
|
+
}
|
|
2778
|
+
this.applyDensity(options.particles, options.manualParticles.length);
|
|
2779
|
+
}
|
|
2780
|
+
applyDensity(options, manualCount, group) {
|
|
2781
|
+
var _a;
|
|
2782
|
+
if (!((_a = options.number.density) === null || _a === void 0 ? void 0 : _a.enable)) {
|
|
2783
|
+
return;
|
|
2784
|
+
}
|
|
2785
|
+
const numberOptions = options.number;
|
|
2786
|
+
const densityFactor = this.initDensityFactor(numberOptions.density);
|
|
2787
|
+
const optParticlesNumber = numberOptions.value;
|
|
2788
|
+
const optParticlesLimit = numberOptions.limit > 0 ? numberOptions.limit : optParticlesNumber;
|
|
2789
|
+
const particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + manualCount;
|
|
2790
|
+
const particlesCount = Math.min(this.count, this.array.filter((t => t.group === group)).length);
|
|
2791
|
+
this.limit = numberOptions.limit * densityFactor;
|
|
2792
|
+
if (particlesCount < particlesNumber) {
|
|
2793
|
+
this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
|
|
2794
|
+
} else if (particlesCount > particlesNumber) {
|
|
2795
|
+
this.removeQuantity(particlesCount - particlesNumber, group);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
initDensityFactor(densityOptions) {
|
|
2799
|
+
const container = this.container;
|
|
2800
|
+
if (!container.canvas.element || !densityOptions.enable) {
|
|
2801
|
+
return 1;
|
|
2802
|
+
}
|
|
2803
|
+
const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
|
|
2804
|
+
return canvas.width * canvas.height / (densityOptions.factor * pxRatio ** 2 * densityOptions.area);
|
|
2805
|
+
}
|
|
2806
|
+
pushParticle(position, overrideOptions, group, initializer) {
|
|
2807
|
+
try {
|
|
2808
|
+
const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
|
|
2809
|
+
let canAdd = true;
|
|
2810
|
+
if (initializer) {
|
|
2811
|
+
canAdd = initializer(particle);
|
|
2812
|
+
}
|
|
2813
|
+
if (!canAdd) {
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2816
|
+
this.array.push(particle);
|
|
2817
|
+
this.zArray.push(particle);
|
|
2818
|
+
this.nextId++;
|
|
2819
|
+
return particle;
|
|
2820
|
+
} catch (e) {
|
|
2821
|
+
console.warn(`error adding particle: ${e}`);
|
|
2822
|
+
return;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
class Retina_Retina {
|
|
2827
|
+
constructor(container) {
|
|
2828
|
+
this.container = container;
|
|
2829
|
+
}
|
|
2830
|
+
init() {
|
|
2831
|
+
const container = this.container;
|
|
2832
|
+
const options = container.actualOptions;
|
|
2833
|
+
this.pixelRatio = !options.detectRetina || isSsr() ? 1 : window.devicePixelRatio;
|
|
2834
|
+
const motionOptions = this.container.actualOptions.motion;
|
|
2835
|
+
if (motionOptions && (motionOptions.disable || motionOptions.reduce.value)) {
|
|
2836
|
+
if (isSsr() || typeof matchMedia === "undefined" || !matchMedia) {
|
|
2837
|
+
this.reduceFactor = 1;
|
|
2838
|
+
} else {
|
|
2839
|
+
const mediaQuery = matchMedia("(prefers-reduced-motion: reduce)");
|
|
2840
|
+
if (mediaQuery) {
|
|
2841
|
+
this.handleMotionChange(mediaQuery);
|
|
2842
|
+
const handleChange = () => {
|
|
2843
|
+
this.handleMotionChange(mediaQuery);
|
|
2844
|
+
container.refresh().catch((() => {}));
|
|
2845
|
+
};
|
|
2846
|
+
if (mediaQuery.addEventListener !== undefined) {
|
|
2847
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
2848
|
+
} else if (mediaQuery.addListener !== undefined) {
|
|
2849
|
+
mediaQuery.addListener(handleChange);
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
} else {
|
|
2854
|
+
this.reduceFactor = 1;
|
|
2855
|
+
}
|
|
2856
|
+
const ratio = this.pixelRatio;
|
|
2857
|
+
if (container.canvas.element) {
|
|
2858
|
+
const element = container.canvas.element;
|
|
2859
|
+
container.canvas.size.width = element.offsetWidth * ratio;
|
|
2860
|
+
container.canvas.size.height = element.offsetHeight * ratio;
|
|
2861
|
+
}
|
|
2862
|
+
const particles = options.particles;
|
|
2863
|
+
this.attractDistance = particles.move.attract.distance * ratio;
|
|
2864
|
+
this.linksDistance = particles.links.distance * ratio;
|
|
2865
|
+
this.linksWidth = particles.links.width * ratio;
|
|
2866
|
+
this.sizeAnimationSpeed = particles.size.animation.speed * ratio;
|
|
2867
|
+
this.maxSpeed = particles.move.gravity.maxSpeed * ratio;
|
|
2868
|
+
if (particles.orbit.radius !== undefined) {
|
|
2869
|
+
this.orbitRadius = particles.orbit.radius * this.container.retina.pixelRatio;
|
|
2870
|
+
}
|
|
2871
|
+
const modes = options.interactivity.modes;
|
|
2872
|
+
this.connectModeDistance = modes.connect.distance * ratio;
|
|
2873
|
+
this.connectModeRadius = modes.connect.radius * ratio;
|
|
2874
|
+
this.grabModeDistance = modes.grab.distance * ratio;
|
|
2875
|
+
this.repulseModeDistance = modes.repulse.distance * ratio;
|
|
2876
|
+
this.bounceModeDistance = modes.bounce.distance * ratio;
|
|
2877
|
+
this.attractModeDistance = modes.attract.distance * ratio;
|
|
2878
|
+
this.slowModeRadius = modes.slow.radius * ratio;
|
|
2879
|
+
this.bubbleModeDistance = modes.bubble.distance * ratio;
|
|
2880
|
+
if (modes.bubble.size) {
|
|
2881
|
+
this.bubbleModeSize = modes.bubble.size * ratio;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
initParticle(particle) {
|
|
2885
|
+
const options = particle.options;
|
|
2886
|
+
const ratio = this.pixelRatio;
|
|
2887
|
+
const moveDistance = options.move.distance;
|
|
2888
|
+
const props = particle.retina;
|
|
2889
|
+
props.attractDistance = options.move.attract.distance * ratio;
|
|
2890
|
+
props.linksDistance = options.links.distance * ratio;
|
|
2891
|
+
props.linksWidth = options.links.width * ratio;
|
|
2892
|
+
props.moveDrift = getRangeValue(options.move.drift) * ratio;
|
|
2893
|
+
props.moveSpeed = getRangeValue(options.move.speed) * ratio;
|
|
2894
|
+
props.sizeAnimationSpeed = options.size.animation.speed * ratio;
|
|
2895
|
+
if (particle.spin) {
|
|
2896
|
+
props.spinAcceleration = getRangeValue(options.move.spin.acceleration) * ratio;
|
|
2897
|
+
}
|
|
2898
|
+
const maxDistance = props.maxDistance;
|
|
2899
|
+
maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
|
|
2900
|
+
maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
|
|
2901
|
+
props.maxSpeed = options.move.gravity.maxSpeed * ratio;
|
|
2902
|
+
}
|
|
2903
|
+
handleMotionChange(mediaQuery) {
|
|
2904
|
+
const options = this.container.actualOptions;
|
|
2905
|
+
if (mediaQuery.matches) {
|
|
2906
|
+
const motion = options.motion;
|
|
2907
|
+
this.reduceFactor = motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1;
|
|
2908
|
+
} else {
|
|
2909
|
+
this.reduceFactor = 1;
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
class Trail_Trail {
|
|
2914
|
+
constructor() {
|
|
2915
|
+
this.delay = 1;
|
|
2916
|
+
this.pauseOnStop = false;
|
|
2917
|
+
this.quantity = 1;
|
|
2918
|
+
}
|
|
2919
|
+
load(data) {
|
|
2920
|
+
if (data === undefined) {
|
|
2921
|
+
return;
|
|
2922
|
+
}
|
|
2923
|
+
if (data.delay !== undefined) {
|
|
2924
|
+
this.delay = data.delay;
|
|
2925
|
+
}
|
|
2926
|
+
if (data.quantity !== undefined) {
|
|
2927
|
+
this.quantity = data.quantity;
|
|
2928
|
+
}
|
|
2929
|
+
if (data.particles !== undefined) {
|
|
2930
|
+
this.particles = deepExtend({}, data.particles);
|
|
2931
|
+
}
|
|
2932
|
+
if (data.pauseOnStop !== undefined) {
|
|
2933
|
+
this.pauseOnStop = data.pauseOnStop;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
class Modes_Modes {
|
|
2938
|
+
constructor() {
|
|
2939
|
+
this.attract = new Attract;
|
|
2940
|
+
this.bounce = new Bounce;
|
|
2941
|
+
this.bubble = new Bubble;
|
|
2942
|
+
this.connect = new Connect;
|
|
2943
|
+
this.grab = new Grab;
|
|
2944
|
+
this.light = new Light;
|
|
2945
|
+
this.push = new Push;
|
|
2946
|
+
this.remove = new Remove;
|
|
2947
|
+
this.repulse = new Repulse;
|
|
2948
|
+
this.slow = new Slow;
|
|
2949
|
+
this.trail = new Trail;
|
|
2950
|
+
}
|
|
2951
|
+
load(data) {
|
|
2952
|
+
if (data === undefined) {
|
|
2953
|
+
return;
|
|
2954
|
+
}
|
|
2955
|
+
this.attract.load(data.attract);
|
|
2956
|
+
this.bubble.load(data.bubble);
|
|
2957
|
+
this.connect.load(data.connect);
|
|
2958
|
+
this.grab.load(data.grab);
|
|
2959
|
+
this.light.load(data.light);
|
|
2960
|
+
this.push.load(data.push);
|
|
2961
|
+
this.remove.load(data.remove);
|
|
2962
|
+
this.repulse.load(data.repulse);
|
|
2963
|
+
this.slow.load(data.slow);
|
|
2964
|
+
this.trail.load(data.trail);
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
class Interactivity_Interactivity {
|
|
2968
|
+
constructor() {
|
|
2969
|
+
this.detectsOn = "window";
|
|
2970
|
+
this.events = new Events;
|
|
2971
|
+
this.modes = new Modes;
|
|
2972
|
+
}
|
|
2973
|
+
get detect_on() {
|
|
2974
|
+
return this.detectsOn;
|
|
2975
|
+
}
|
|
2976
|
+
set detect_on(value) {
|
|
2977
|
+
this.detectsOn = value;
|
|
2978
|
+
}
|
|
2979
|
+
load(data) {
|
|
2980
|
+
var _a, _b, _c;
|
|
2981
|
+
if (data === undefined) {
|
|
2982
|
+
return;
|
|
2983
|
+
}
|
|
2984
|
+
const detectsOn = (_a = data.detectsOn) !== null && _a !== void 0 ? _a : data.detect_on;
|
|
2985
|
+
if (detectsOn !== undefined) {
|
|
2986
|
+
this.detectsOn = detectsOn;
|
|
2987
|
+
}
|
|
2988
|
+
this.events.load(data.events);
|
|
2989
|
+
this.modes.load(data.modes);
|
|
2990
|
+
if (((_c = (_b = data.modes) === null || _b === void 0 ? void 0 : _b.slow) === null || _c === void 0 ? void 0 : _c.active) === true) {
|
|
2991
|
+
if (this.events.onHover.mode instanceof Array) {
|
|
2992
|
+
if (this.events.onHover.mode.indexOf("slow") < 0) {
|
|
2993
|
+
this.events.onHover.mode.push("slow");
|
|
2994
|
+
}
|
|
2995
|
+
} else if (this.events.onHover.mode !== "slow") {
|
|
2996
|
+
this.events.onHover.mode = [ this.events.onHover.mode, "slow" ];
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
class Theme_Theme {
|
|
3002
|
+
constructor() {
|
|
3003
|
+
this.name = "";
|
|
3004
|
+
this.default = new ThemeDefault;
|
|
3005
|
+
}
|
|
3006
|
+
load(data) {
|
|
3007
|
+
if (data === undefined) {
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
if (data.name !== undefined) {
|
|
3011
|
+
this.name = data.name;
|
|
3012
|
+
}
|
|
3013
|
+
this.default.load(data.default);
|
|
3014
|
+
if (data.options !== undefined) {
|
|
3015
|
+
this.options = deepExtend({}, data.options);
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
class ManualParticle_ManualParticle {
|
|
3020
|
+
load(data) {
|
|
3021
|
+
var _a, _b;
|
|
3022
|
+
if (!data) {
|
|
3023
|
+
return;
|
|
3024
|
+
}
|
|
3025
|
+
if (data.position !== undefined) {
|
|
3026
|
+
this.position = {
|
|
3027
|
+
x: (_a = data.position.x) !== null && _a !== void 0 ? _a : 50,
|
|
3028
|
+
y: (_b = data.position.y) !== null && _b !== void 0 ? _b : 50
|
|
3029
|
+
};
|
|
3030
|
+
}
|
|
3031
|
+
if (data.options !== undefined) {
|
|
3032
|
+
this.options = deepExtend({}, data.options);
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
class Responsive_Responsive {
|
|
3037
|
+
constructor() {
|
|
3038
|
+
this.maxWidth = Infinity;
|
|
3039
|
+
this.options = {};
|
|
3040
|
+
this.mode = "canvas";
|
|
3041
|
+
}
|
|
3042
|
+
load(data) {
|
|
3043
|
+
if (!data) {
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
if (data.maxWidth !== undefined) {
|
|
3047
|
+
this.maxWidth = data.maxWidth;
|
|
3048
|
+
}
|
|
3049
|
+
if (data.mode !== undefined) {
|
|
3050
|
+
if (data.mode === "screen") {
|
|
3051
|
+
this.mode = "screen";
|
|
3052
|
+
} else {
|
|
3053
|
+
this.mode = "canvas";
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
if (data.options !== undefined) {
|
|
3057
|
+
this.options = deepExtend({}, data.options);
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
3062
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3063
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3064
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3065
|
+
};
|
|
3066
|
+
var _Options_instances, _Options_findDefaultTheme;
|
|
3067
|
+
class Options_Options {
|
|
3068
|
+
constructor() {
|
|
3069
|
+
_Options_instances.add(this);
|
|
3070
|
+
this.autoPlay = true;
|
|
3071
|
+
this.background = new Background;
|
|
3072
|
+
this.backgroundMask = new BackgroundMask;
|
|
3073
|
+
this.fullScreen = new FullScreen;
|
|
3074
|
+
this.detectRetina = true;
|
|
3075
|
+
this.duration = 0;
|
|
3076
|
+
this.fpsLimit = 60;
|
|
3077
|
+
this.interactivity = new Interactivity;
|
|
3078
|
+
this.manualParticles = [];
|
|
3079
|
+
this.motion = new Motion;
|
|
3080
|
+
this.particles = new ParticlesOptions;
|
|
3081
|
+
this.pauseOnBlur = true;
|
|
3082
|
+
this.pauseOnOutsideViewport = true;
|
|
3083
|
+
this.responsive = [];
|
|
3084
|
+
this.style = {};
|
|
3085
|
+
this.themes = [];
|
|
3086
|
+
this.zLayers = 100;
|
|
3087
|
+
}
|
|
3088
|
+
get fps_limit() {
|
|
3089
|
+
return this.fpsLimit;
|
|
3090
|
+
}
|
|
3091
|
+
set fps_limit(value) {
|
|
3092
|
+
this.fpsLimit = value;
|
|
3093
|
+
}
|
|
3094
|
+
get retina_detect() {
|
|
3095
|
+
return this.detectRetina;
|
|
3096
|
+
}
|
|
3097
|
+
set retina_detect(value) {
|
|
3098
|
+
this.detectRetina = value;
|
|
3099
|
+
}
|
|
3100
|
+
get backgroundMode() {
|
|
3101
|
+
return this.fullScreen;
|
|
3102
|
+
}
|
|
3103
|
+
set backgroundMode(value) {
|
|
3104
|
+
this.fullScreen.load(value);
|
|
3105
|
+
}
|
|
3106
|
+
load(data) {
|
|
3107
|
+
var _a, _b, _c, _d, _e;
|
|
3108
|
+
if (data === undefined) {
|
|
3109
|
+
return;
|
|
3110
|
+
}
|
|
3111
|
+
if (data.preset !== undefined) {
|
|
3112
|
+
if (data.preset instanceof Array) {
|
|
3113
|
+
for (const preset of data.preset) {
|
|
3114
|
+
this.importPreset(preset);
|
|
3115
|
+
}
|
|
3116
|
+
} else {
|
|
3117
|
+
this.importPreset(data.preset);
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
if (data.autoPlay !== undefined) {
|
|
3121
|
+
this.autoPlay = data.autoPlay;
|
|
3122
|
+
}
|
|
3123
|
+
const detectRetina = (_a = data.detectRetina) !== null && _a !== void 0 ? _a : data.retina_detect;
|
|
3124
|
+
if (detectRetina !== undefined) {
|
|
3125
|
+
this.detectRetina = detectRetina;
|
|
3126
|
+
}
|
|
3127
|
+
if (data.duration !== undefined) {
|
|
3128
|
+
this.duration = data.duration;
|
|
3129
|
+
}
|
|
3130
|
+
const fpsLimit = (_b = data.fpsLimit) !== null && _b !== void 0 ? _b : data.fps_limit;
|
|
3131
|
+
if (fpsLimit !== undefined) {
|
|
3132
|
+
this.fpsLimit = fpsLimit;
|
|
3133
|
+
}
|
|
3134
|
+
if (data.pauseOnBlur !== undefined) {
|
|
3135
|
+
this.pauseOnBlur = data.pauseOnBlur;
|
|
3136
|
+
}
|
|
3137
|
+
if (data.pauseOnOutsideViewport !== undefined) {
|
|
3138
|
+
this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
|
|
3139
|
+
}
|
|
3140
|
+
if (data.zLayers !== undefined) {
|
|
3141
|
+
this.zLayers = data.zLayers;
|
|
3142
|
+
}
|
|
3143
|
+
this.background.load(data.background);
|
|
3144
|
+
const fullScreen = (_c = data.fullScreen) !== null && _c !== void 0 ? _c : data.backgroundMode;
|
|
3145
|
+
if (typeof fullScreen === "boolean") {
|
|
3146
|
+
this.fullScreen.enable = fullScreen;
|
|
3147
|
+
} else {
|
|
3148
|
+
this.fullScreen.load(fullScreen);
|
|
3149
|
+
}
|
|
3150
|
+
this.backgroundMask.load(data.backgroundMask);
|
|
3151
|
+
this.interactivity.load(data.interactivity);
|
|
3152
|
+
if (data.manualParticles !== undefined) {
|
|
3153
|
+
this.manualParticles = data.manualParticles.map((t => {
|
|
3154
|
+
const tmp = new ManualParticle;
|
|
3155
|
+
tmp.load(t);
|
|
3156
|
+
return tmp;
|
|
3157
|
+
}));
|
|
3158
|
+
}
|
|
3159
|
+
this.motion.load(data.motion);
|
|
3160
|
+
this.particles.load(data.particles);
|
|
3161
|
+
this.style = deepExtend(this.style, data.style);
|
|
3162
|
+
Plugins.loadOptions(this, data);
|
|
3163
|
+
if (data.responsive !== undefined) {
|
|
3164
|
+
for (const responsive of data.responsive) {
|
|
3165
|
+
const optResponsive = new Responsive;
|
|
3166
|
+
optResponsive.load(responsive);
|
|
3167
|
+
this.responsive.push(optResponsive);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
this.responsive.sort(((a, b) => a.maxWidth - b.maxWidth));
|
|
3171
|
+
if (data.themes !== undefined) {
|
|
3172
|
+
for (const theme of data.themes) {
|
|
3173
|
+
const optTheme = new Theme;
|
|
3174
|
+
optTheme.load(theme);
|
|
3175
|
+
this.themes.push(optTheme);
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
|
|
3179
|
+
this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
|
|
3180
|
+
}
|
|
3181
|
+
setTheme(name) {
|
|
3182
|
+
if (name) {
|
|
3183
|
+
const chosenTheme = this.themes.find((theme => theme.name === name));
|
|
3184
|
+
if (chosenTheme) {
|
|
3185
|
+
this.load(chosenTheme.options);
|
|
3186
|
+
}
|
|
3187
|
+
} else {
|
|
3188
|
+
const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch && mediaMatch.matches, defaultTheme = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, clientDarkMode ? "dark" : "light");
|
|
3189
|
+
if (defaultTheme) {
|
|
3190
|
+
this.load(defaultTheme.options);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
setResponsive(width, pxRatio, defaultOptions) {
|
|
3195
|
+
this.load(defaultOptions);
|
|
3196
|
+
const responsiveOptions = this.responsive.find((t => t.mode === "screen" && screen ? t.maxWidth * pxRatio > screen.availWidth : t.maxWidth * pxRatio > width));
|
|
3197
|
+
this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
|
|
3198
|
+
return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
|
|
3199
|
+
}
|
|
3200
|
+
importPreset(preset) {
|
|
3201
|
+
this.load(Plugins.getPreset(preset));
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
_Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
|
|
3205
|
+
var _a;
|
|
3206
|
+
return (_a = this.themes.find((theme => theme.default.value && theme.default.mode === mode))) !== null && _a !== void 0 ? _a : this.themes.find((theme => theme.default.value && theme.default.mode === "any"));
|
|
3207
|
+
};
|
|
3208
|
+
class Container_Container {
|
|
3209
|
+
constructor(id, sourceOptions, ...presets) {
|
|
3210
|
+
this.id = id;
|
|
3211
|
+
this.fpsLimit = 60;
|
|
3212
|
+
this.duration = 0;
|
|
3213
|
+
this.lifeTime = 0;
|
|
3214
|
+
this.firstStart = true;
|
|
3215
|
+
this.started = false;
|
|
3216
|
+
this.destroyed = false;
|
|
3217
|
+
this.paused = true;
|
|
3218
|
+
this.lastFrameTime = 0;
|
|
3219
|
+
this.zLayers = 100;
|
|
3220
|
+
this.pageHidden = false;
|
|
3221
|
+
this._sourceOptions = sourceOptions;
|
|
3222
|
+
this._initialSourceOptions = sourceOptions;
|
|
3223
|
+
this.retina = new Retina(this);
|
|
3224
|
+
this.canvas = new Canvas(this);
|
|
3225
|
+
this.particles = new Particles(this);
|
|
3226
|
+
this.drawer = new FrameManager(this);
|
|
3227
|
+
this.presets = presets;
|
|
3228
|
+
this.pathGenerator = {
|
|
3229
|
+
generate: () => {
|
|
3230
|
+
const v = Vector.create(0, 0);
|
|
3231
|
+
v.length = Math.random();
|
|
3232
|
+
v.angle = Math.random() * Math.PI * 2;
|
|
3233
|
+
return v;
|
|
3234
|
+
},
|
|
3235
|
+
init: () => {},
|
|
3236
|
+
update: () => {}
|
|
3237
|
+
};
|
|
3238
|
+
this.interactivity = {
|
|
3239
|
+
mouse: {
|
|
3240
|
+
clicking: false,
|
|
3241
|
+
inside: false
|
|
3242
|
+
}
|
|
3243
|
+
};
|
|
3244
|
+
this.bubble = {};
|
|
3245
|
+
this.repulse = {
|
|
3246
|
+
particles: []
|
|
3247
|
+
};
|
|
3248
|
+
this.attract = {
|
|
3249
|
+
particles: []
|
|
3250
|
+
};
|
|
3251
|
+
this.plugins = new Map;
|
|
3252
|
+
this.drawers = new Map;
|
|
3253
|
+
this.density = 1;
|
|
3254
|
+
this._options = new Options;
|
|
3255
|
+
this.actualOptions = new Options;
|
|
3256
|
+
this.eventListeners = new EventListeners(this);
|
|
3257
|
+
if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
|
|
3258
|
+
this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
get options() {
|
|
3262
|
+
return this._options;
|
|
3263
|
+
}
|
|
3264
|
+
get sourceOptions() {
|
|
3265
|
+
return this._sourceOptions;
|
|
3266
|
+
}
|
|
3267
|
+
play(force) {
|
|
3268
|
+
const needsUpdate = this.paused || force;
|
|
3269
|
+
if (this.firstStart && !this.actualOptions.autoPlay) {
|
|
3270
|
+
this.firstStart = false;
|
|
3271
|
+
return;
|
|
3272
|
+
}
|
|
3273
|
+
if (this.paused) {
|
|
3274
|
+
this.paused = false;
|
|
3275
|
+
}
|
|
3276
|
+
if (needsUpdate) {
|
|
3277
|
+
for (const [, plugin] of this.plugins) {
|
|
3278
|
+
if (plugin.play) {
|
|
3279
|
+
plugin.play();
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
this.draw(needsUpdate || false);
|
|
3284
|
+
}
|
|
3285
|
+
pause() {
|
|
3286
|
+
if (this.drawAnimationFrame !== undefined) {
|
|
3287
|
+
cancelAnimation()(this.drawAnimationFrame);
|
|
3288
|
+
delete this.drawAnimationFrame;
|
|
3289
|
+
}
|
|
3290
|
+
if (this.paused) {
|
|
3291
|
+
return;
|
|
3292
|
+
}
|
|
3293
|
+
for (const [, plugin] of this.plugins) {
|
|
3294
|
+
if (plugin.pause) {
|
|
3295
|
+
plugin.pause();
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
if (!this.pageHidden) {
|
|
3299
|
+
this.paused = true;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
draw(force) {
|
|
3303
|
+
let refreshTime = force;
|
|
3304
|
+
this.drawAnimationFrame = animate()((timestamp => {
|
|
3305
|
+
if (refreshTime) {
|
|
3306
|
+
this.lastFrameTime = undefined;
|
|
3307
|
+
refreshTime = false;
|
|
3308
|
+
}
|
|
3309
|
+
this.drawer.nextFrame(timestamp);
|
|
3310
|
+
}));
|
|
3311
|
+
}
|
|
3312
|
+
getAnimationStatus() {
|
|
3313
|
+
return !this.paused && !this.pageHidden;
|
|
3314
|
+
}
|
|
3315
|
+
setNoise(noiseOrGenerator, init, update) {
|
|
3316
|
+
this.setPath(noiseOrGenerator, init, update);
|
|
3317
|
+
}
|
|
3318
|
+
setPath(pathOrGenerator, init, update) {
|
|
3319
|
+
if (!pathOrGenerator) {
|
|
3320
|
+
return;
|
|
3321
|
+
}
|
|
3322
|
+
if (typeof pathOrGenerator === "function") {
|
|
3323
|
+
this.pathGenerator.generate = pathOrGenerator;
|
|
3324
|
+
if (init) {
|
|
3325
|
+
this.pathGenerator.init = init;
|
|
3326
|
+
}
|
|
3327
|
+
if (update) {
|
|
3328
|
+
this.pathGenerator.update = update;
|
|
3329
|
+
}
|
|
3330
|
+
} else {
|
|
3331
|
+
if (pathOrGenerator.generate) {
|
|
3332
|
+
this.pathGenerator.generate = pathOrGenerator.generate;
|
|
3333
|
+
}
|
|
3334
|
+
if (pathOrGenerator.init) {
|
|
3335
|
+
this.pathGenerator.init = pathOrGenerator.init;
|
|
3336
|
+
}
|
|
3337
|
+
if (pathOrGenerator.update) {
|
|
3338
|
+
this.pathGenerator.update = pathOrGenerator.update;
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
destroy() {
|
|
3343
|
+
this.stop();
|
|
3344
|
+
this.canvas.destroy();
|
|
3345
|
+
for (const [, drawer] of this.drawers) {
|
|
3346
|
+
if (drawer.destroy) {
|
|
3347
|
+
drawer.destroy(this);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
for (const key of this.drawers.keys()) {
|
|
3351
|
+
this.drawers.delete(key);
|
|
3352
|
+
}
|
|
3353
|
+
this.destroyed = true;
|
|
3354
|
+
}
|
|
3355
|
+
exportImg(callback) {
|
|
3356
|
+
this.exportImage(callback);
|
|
3357
|
+
}
|
|
3358
|
+
exportImage(callback, type, quality) {
|
|
3359
|
+
var _a;
|
|
3360
|
+
return (_a = this.canvas.element) === null || _a === void 0 ? void 0 : _a.toBlob(callback, type !== null && type !== void 0 ? type : "image/png", quality);
|
|
3361
|
+
}
|
|
3362
|
+
exportConfiguration() {
|
|
3363
|
+
return JSON.stringify(this.actualOptions, undefined, 2);
|
|
3364
|
+
}
|
|
3365
|
+
refresh() {
|
|
3366
|
+
this.stop();
|
|
3367
|
+
return this.start();
|
|
3368
|
+
}
|
|
3369
|
+
reset() {
|
|
3370
|
+
this._options = new Options;
|
|
3371
|
+
return this.refresh();
|
|
3372
|
+
}
|
|
3373
|
+
stop() {
|
|
3374
|
+
if (!this.started) {
|
|
3375
|
+
return;
|
|
3376
|
+
}
|
|
3377
|
+
this.firstStart = true;
|
|
3378
|
+
this.started = false;
|
|
3379
|
+
this.eventListeners.removeListeners();
|
|
3380
|
+
this.pause();
|
|
3381
|
+
this.particles.clear();
|
|
3382
|
+
this.canvas.clear();
|
|
3383
|
+
if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
|
|
3384
|
+
this.intersectionObserver.observe(this.interactivity.element);
|
|
3385
|
+
}
|
|
3386
|
+
for (const [, plugin] of this.plugins) {
|
|
3387
|
+
if (plugin.stop) {
|
|
3388
|
+
plugin.stop();
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
for (const key of this.plugins.keys()) {
|
|
3392
|
+
this.plugins.delete(key);
|
|
3393
|
+
}
|
|
3394
|
+
this.particles.linksColors = new Map;
|
|
3395
|
+
delete this.particles.grabLineColor;
|
|
3396
|
+
delete this.particles.linksColor;
|
|
3397
|
+
this._sourceOptions = this._options;
|
|
3398
|
+
}
|
|
3399
|
+
async loadTheme(name) {
|
|
3400
|
+
this.currentTheme = name;
|
|
3401
|
+
await this.refresh();
|
|
3402
|
+
}
|
|
3403
|
+
async start() {
|
|
3404
|
+
if (this.started) {
|
|
3405
|
+
return;
|
|
3406
|
+
}
|
|
3407
|
+
await this.init();
|
|
3408
|
+
this.started = true;
|
|
3409
|
+
this.eventListeners.addListeners();
|
|
3410
|
+
if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
|
|
3411
|
+
this.intersectionObserver.observe(this.interactivity.element);
|
|
3412
|
+
}
|
|
3413
|
+
for (const [, plugin] of this.plugins) {
|
|
3414
|
+
if (plugin.startAsync !== undefined) {
|
|
3415
|
+
await plugin.startAsync();
|
|
3416
|
+
} else if (plugin.start !== undefined) {
|
|
3417
|
+
plugin.start();
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
this.play();
|
|
3421
|
+
}
|
|
3422
|
+
addClickHandler(callback) {
|
|
3423
|
+
const el = this.interactivity.element;
|
|
3424
|
+
if (!el) {
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
const clickOrTouchHandler = (e, pos, radius) => {
|
|
3428
|
+
if (this.destroyed) {
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
const pxRatio = this.retina.pixelRatio, posRetina = {
|
|
3432
|
+
x: pos.x * pxRatio,
|
|
3433
|
+
y: pos.y * pxRatio
|
|
3434
|
+
}, particles = this.particles.quadTree.queryCircle(posRetina, radius * pxRatio);
|
|
3435
|
+
callback(e, particles);
|
|
3436
|
+
};
|
|
3437
|
+
const clickHandler = e => {
|
|
3438
|
+
if (this.destroyed) {
|
|
3439
|
+
return;
|
|
3440
|
+
}
|
|
3441
|
+
const mouseEvent = e;
|
|
3442
|
+
const pos = {
|
|
3443
|
+
x: mouseEvent.offsetX || mouseEvent.clientX,
|
|
3444
|
+
y: mouseEvent.offsetY || mouseEvent.clientY
|
|
3445
|
+
};
|
|
3446
|
+
clickOrTouchHandler(e, pos, 1);
|
|
3447
|
+
};
|
|
3448
|
+
const touchStartHandler = () => {
|
|
3449
|
+
if (this.destroyed) {
|
|
3450
|
+
return;
|
|
3451
|
+
}
|
|
3452
|
+
touched = true;
|
|
3453
|
+
touchMoved = false;
|
|
3454
|
+
};
|
|
3455
|
+
const touchMoveHandler = () => {
|
|
3456
|
+
if (this.destroyed) {
|
|
3457
|
+
return;
|
|
3458
|
+
}
|
|
3459
|
+
touchMoved = true;
|
|
3460
|
+
};
|
|
3461
|
+
const touchEndHandler = e => {
|
|
3462
|
+
var _a, _b, _c;
|
|
3463
|
+
if (this.destroyed) {
|
|
3464
|
+
return;
|
|
3465
|
+
}
|
|
3466
|
+
if (touched && !touchMoved) {
|
|
3467
|
+
const touchEvent = e;
|
|
3468
|
+
let lastTouch = touchEvent.touches[touchEvent.touches.length - 1];
|
|
3469
|
+
if (!lastTouch) {
|
|
3470
|
+
lastTouch = touchEvent.changedTouches[touchEvent.changedTouches.length - 1];
|
|
3471
|
+
if (!lastTouch) {
|
|
3472
|
+
return;
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
const canvasRect = (_a = this.canvas.element) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
3476
|
+
const pos = {
|
|
3477
|
+
x: lastTouch.clientX - ((_b = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.left) !== null && _b !== void 0 ? _b : 0),
|
|
3478
|
+
y: lastTouch.clientY - ((_c = canvasRect === null || canvasRect === void 0 ? void 0 : canvasRect.top) !== null && _c !== void 0 ? _c : 0)
|
|
3479
|
+
};
|
|
3480
|
+
clickOrTouchHandler(e, pos, Math.max(lastTouch.radiusX, lastTouch.radiusY));
|
|
3481
|
+
}
|
|
3482
|
+
touched = false;
|
|
3483
|
+
touchMoved = false;
|
|
3484
|
+
};
|
|
3485
|
+
const touchCancelHandler = () => {
|
|
3486
|
+
if (this.destroyed) {
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
touched = false;
|
|
3490
|
+
touchMoved = false;
|
|
3491
|
+
};
|
|
3492
|
+
let touched = false;
|
|
3493
|
+
let touchMoved = false;
|
|
3494
|
+
el.addEventListener("click", clickHandler);
|
|
3495
|
+
el.addEventListener("touchstart", touchStartHandler);
|
|
3496
|
+
el.addEventListener("touchmove", touchMoveHandler);
|
|
3497
|
+
el.addEventListener("touchend", touchEndHandler);
|
|
3498
|
+
el.addEventListener("touchcancel", touchCancelHandler);
|
|
3499
|
+
}
|
|
3500
|
+
updateActualOptions() {
|
|
3501
|
+
this.actualOptions.responsive = [];
|
|
3502
|
+
const newMaxWidth = this.actualOptions.setResponsive(this.canvas.size.width, this.retina.pixelRatio, this._options);
|
|
3503
|
+
this.actualOptions.setTheme(this.currentTheme);
|
|
3504
|
+
if (this.responsiveMaxWidth != newMaxWidth) {
|
|
3505
|
+
this.responsiveMaxWidth = newMaxWidth;
|
|
3506
|
+
return true;
|
|
3507
|
+
}
|
|
3508
|
+
return false;
|
|
3509
|
+
}
|
|
3510
|
+
async init() {
|
|
3511
|
+
this._options = new Options;
|
|
3512
|
+
for (const preset of this.presets) {
|
|
3513
|
+
this._options.load(Plugins.getPreset(preset));
|
|
3514
|
+
}
|
|
3515
|
+
const shapes = Plugins.getSupportedShapes();
|
|
3516
|
+
for (const type of shapes) {
|
|
3517
|
+
const drawer = Plugins.getShapeDrawer(type);
|
|
3518
|
+
if (drawer) {
|
|
3519
|
+
this.drawers.set(type, drawer);
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
this._options.load(this._initialSourceOptions);
|
|
3523
|
+
this._options.load(this._sourceOptions);
|
|
3524
|
+
this.actualOptions = new Options;
|
|
3525
|
+
this.actualOptions.load(this._options);
|
|
3526
|
+
this.retina.init();
|
|
3527
|
+
this.canvas.init();
|
|
3528
|
+
this.updateActualOptions();
|
|
3529
|
+
this.canvas.initBackground();
|
|
3530
|
+
this.canvas.resize();
|
|
3531
|
+
this.zLayers = this.actualOptions.zLayers;
|
|
3532
|
+
this.duration = getRangeValue(this.actualOptions.duration);
|
|
3533
|
+
this.lifeTime = 0;
|
|
3534
|
+
this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
|
|
3535
|
+
const availablePlugins = Plugins.getAvailablePlugins(this);
|
|
3536
|
+
for (const [id, plugin] of availablePlugins) {
|
|
3537
|
+
this.plugins.set(id, plugin);
|
|
3538
|
+
}
|
|
3539
|
+
for (const [, drawer] of this.drawers) {
|
|
3540
|
+
if (drawer.init) {
|
|
3541
|
+
await drawer.init(this);
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
for (const [, plugin] of this.plugins) {
|
|
3545
|
+
if (plugin.init) {
|
|
3546
|
+
plugin.init(this.actualOptions);
|
|
3547
|
+
} else if (plugin.initAsync !== undefined) {
|
|
3548
|
+
await plugin.initAsync(this.actualOptions);
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
const pathOptions = this.actualOptions.particles.move.path;
|
|
3552
|
+
if (pathOptions.generator) {
|
|
3553
|
+
const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
|
|
3554
|
+
if (customGenerator) {
|
|
3555
|
+
if (customGenerator.init) {
|
|
3556
|
+
this.pathGenerator.init = customGenerator.init;
|
|
3557
|
+
}
|
|
3558
|
+
if (customGenerator.generate) {
|
|
3559
|
+
this.pathGenerator.generate = customGenerator.generate;
|
|
3560
|
+
}
|
|
3561
|
+
if (customGenerator.update) {
|
|
3562
|
+
this.pathGenerator.update = customGenerator.update;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
this.particles.init();
|
|
3567
|
+
this.particles.setDensity();
|
|
3568
|
+
for (const [, plugin] of this.plugins) {
|
|
3569
|
+
if (plugin.particlesSetup !== undefined) {
|
|
3570
|
+
plugin.particlesSetup();
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
intersectionManager(entries) {
|
|
3575
|
+
if (!this.actualOptions.pauseOnOutsideViewport) {
|
|
3576
|
+
return;
|
|
3577
|
+
}
|
|
3578
|
+
for (const entry of entries) {
|
|
3579
|
+
if (entry.target !== this.interactivity.element) {
|
|
3580
|
+
continue;
|
|
3581
|
+
}
|
|
3582
|
+
if (entry.isIntersecting) {
|
|
3583
|
+
this.play();
|
|
3584
|
+
} else {
|
|
3585
|
+
this.pause();
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
const tsParticlesDom = null && [];
|
|
3591
|
+
function fetchError(statusCode) {
|
|
3592
|
+
console.error(`Error tsParticles - fetch status: ${statusCode}`);
|
|
3593
|
+
console.error("Error tsParticles - File config not found");
|
|
3594
|
+
}
|
|
3595
|
+
class Loader {
|
|
3596
|
+
static dom() {
|
|
3597
|
+
return tsParticlesDom;
|
|
3598
|
+
}
|
|
3599
|
+
static domItem(index) {
|
|
3600
|
+
const dom = Loader.dom();
|
|
3601
|
+
const item = dom[index];
|
|
3602
|
+
if (item && !item.destroyed) {
|
|
3603
|
+
return item;
|
|
3604
|
+
}
|
|
3605
|
+
dom.splice(index, 1);
|
|
3606
|
+
}
|
|
3607
|
+
static async loadOptions(params) {
|
|
3608
|
+
var _a, _b, _c;
|
|
3609
|
+
const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
|
|
3610
|
+
const {options: options, index: index} = params;
|
|
3611
|
+
let domContainer = (_b = params.element) !== null && _b !== void 0 ? _b : document.getElementById(tagId);
|
|
3612
|
+
if (!domContainer) {
|
|
3613
|
+
domContainer = document.createElement("div");
|
|
3614
|
+
domContainer.id = tagId;
|
|
3615
|
+
(_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
|
|
3616
|
+
}
|
|
3617
|
+
const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
|
|
3618
|
+
const dom = Loader.dom();
|
|
3619
|
+
const oldIndex = dom.findIndex((v => v.id === tagId));
|
|
3620
|
+
if (oldIndex >= 0) {
|
|
3621
|
+
const old = Loader.domItem(oldIndex);
|
|
3622
|
+
if (old && !old.destroyed) {
|
|
3623
|
+
old.destroy();
|
|
3624
|
+
dom.splice(oldIndex, 1);
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
let canvasEl;
|
|
3628
|
+
if (domContainer.tagName.toLowerCase() === "canvas") {
|
|
3629
|
+
canvasEl = domContainer;
|
|
3630
|
+
canvasEl.dataset[Constants.generatedAttribute] = "false";
|
|
3631
|
+
} else {
|
|
3632
|
+
const existingCanvases = domContainer.getElementsByTagName("canvas");
|
|
3633
|
+
if (existingCanvases.length) {
|
|
3634
|
+
canvasEl = existingCanvases[0];
|
|
3635
|
+
canvasEl.dataset[Constants.generatedAttribute] = "false";
|
|
3636
|
+
} else {
|
|
3637
|
+
canvasEl = document.createElement("canvas");
|
|
3638
|
+
canvasEl.dataset[Constants.generatedAttribute] = "true";
|
|
3639
|
+
canvasEl.style.width = "100%";
|
|
3640
|
+
canvasEl.style.height = "100%";
|
|
3641
|
+
domContainer.appendChild(canvasEl);
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
const newItem = new Container(tagId, currentOptions);
|
|
3645
|
+
if (oldIndex >= 0) {
|
|
3646
|
+
dom.splice(oldIndex, 0, newItem);
|
|
3647
|
+
} else {
|
|
3648
|
+
dom.push(newItem);
|
|
3649
|
+
}
|
|
3650
|
+
newItem.canvas.loadCanvas(canvasEl);
|
|
3651
|
+
await newItem.start();
|
|
3652
|
+
return newItem;
|
|
3653
|
+
}
|
|
3654
|
+
static async loadRemoteOptions(params) {
|
|
3655
|
+
const {url: jsonUrl, index: index} = params;
|
|
3656
|
+
const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
|
|
3657
|
+
if (!url) {
|
|
3658
|
+
return;
|
|
3659
|
+
}
|
|
3660
|
+
const response = await fetch(url);
|
|
3661
|
+
if (!response.ok) {
|
|
3662
|
+
fetchError(response.status);
|
|
3663
|
+
return;
|
|
3664
|
+
}
|
|
3665
|
+
const data = await response.json();
|
|
3666
|
+
return await Loader.loadOptions({
|
|
3667
|
+
tagId: params.tagId,
|
|
3668
|
+
element: params.element,
|
|
3669
|
+
index: index,
|
|
3670
|
+
options: data
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
static load(tagId, options, index) {
|
|
3674
|
+
const params = {
|
|
3675
|
+
index: index
|
|
3676
|
+
};
|
|
3677
|
+
if (typeof tagId === "string") {
|
|
3678
|
+
params.tagId = tagId;
|
|
3679
|
+
} else {
|
|
3680
|
+
params.options = tagId;
|
|
3681
|
+
}
|
|
3682
|
+
if (typeof options === "number") {
|
|
3683
|
+
params.index = options !== null && options !== void 0 ? options : params.index;
|
|
3684
|
+
} else {
|
|
3685
|
+
params.options = options !== null && options !== void 0 ? options : params.options;
|
|
3686
|
+
}
|
|
3687
|
+
return this.loadOptions(params);
|
|
3688
|
+
}
|
|
3689
|
+
static async set(id, domContainer, options, index) {
|
|
3690
|
+
const params = {
|
|
3691
|
+
index: index
|
|
3692
|
+
};
|
|
3693
|
+
if (typeof id === "string") {
|
|
3694
|
+
params.tagId = id;
|
|
3695
|
+
} else {
|
|
3696
|
+
params.element = id;
|
|
3697
|
+
}
|
|
3698
|
+
if (domContainer instanceof HTMLElement) {
|
|
3699
|
+
params.element = domContainer;
|
|
3700
|
+
} else {
|
|
3701
|
+
params.options = domContainer;
|
|
3702
|
+
}
|
|
3703
|
+
if (typeof options === "number") {
|
|
3704
|
+
params.index = options;
|
|
3705
|
+
} else {
|
|
3706
|
+
params.options = options !== null && options !== void 0 ? options : params.options;
|
|
3707
|
+
}
|
|
3708
|
+
return this.loadOptions(params);
|
|
3709
|
+
}
|
|
3710
|
+
static async loadJSON(tagId, jsonUrl, index) {
|
|
3711
|
+
let url, id;
|
|
3712
|
+
if (typeof jsonUrl === "number" || jsonUrl === undefined) {
|
|
3713
|
+
url = tagId;
|
|
3714
|
+
} else {
|
|
3715
|
+
id = tagId;
|
|
3716
|
+
url = jsonUrl;
|
|
3717
|
+
}
|
|
3718
|
+
return await Loader.loadRemoteOptions({
|
|
3719
|
+
tagId: id,
|
|
3720
|
+
url: url,
|
|
3721
|
+
index: index
|
|
3722
|
+
});
|
|
3723
|
+
}
|
|
3724
|
+
static async setJSON(id, domContainer, jsonUrl, index) {
|
|
3725
|
+
let url, newId, newIndex, element;
|
|
3726
|
+
if (id instanceof HTMLElement) {
|
|
3727
|
+
element = id;
|
|
3728
|
+
url = domContainer;
|
|
3729
|
+
newIndex = jsonUrl;
|
|
3730
|
+
} else {
|
|
3731
|
+
newId = id;
|
|
3732
|
+
element = domContainer;
|
|
3733
|
+
url = jsonUrl;
|
|
3734
|
+
newIndex = index;
|
|
3735
|
+
}
|
|
3736
|
+
return await Loader.loadRemoteOptions({
|
|
3737
|
+
tagId: newId,
|
|
3738
|
+
url: url,
|
|
3739
|
+
index: newIndex,
|
|
3740
|
+
element: element
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
static setOnClickHandler(callback) {
|
|
3744
|
+
const dom = Loader.dom();
|
|
3745
|
+
if (dom.length === 0) {
|
|
3746
|
+
throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
|
|
3747
|
+
}
|
|
3748
|
+
for (const domItem of dom) {
|
|
3749
|
+
domItem.addClickHandler(callback);
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
function NumberUtils_clamp(num, min, max) {
|
|
3754
|
+
return Math.min(Math.max(num, min), max);
|
|
3755
|
+
}
|
|
3756
|
+
function NumberUtils_mix(comp1, comp2, weight1, weight2) {
|
|
3757
|
+
return Math.floor((comp1 * weight1 + comp2 * weight2) / (weight1 + weight2));
|
|
3758
|
+
}
|
|
3759
|
+
function NumberUtils_randomInRange(r) {
|
|
3760
|
+
const max = NumberUtils_getRangeMax(r);
|
|
3761
|
+
let min = NumberUtils_getRangeMin(r);
|
|
3762
|
+
if (max === min) {
|
|
3763
|
+
min = 0;
|
|
3764
|
+
}
|
|
3765
|
+
return Math.random() * (max - min) + min;
|
|
3766
|
+
}
|
|
3767
|
+
function NumberUtils_getRangeValue(value) {
|
|
3768
|
+
return typeof value === "number" ? value : NumberUtils_randomInRange(value);
|
|
3769
|
+
}
|
|
3770
|
+
function NumberUtils_getRangeMin(value) {
|
|
3771
|
+
return typeof value === "number" ? value : value.min;
|
|
3772
|
+
}
|
|
3773
|
+
function NumberUtils_getRangeMax(value) {
|
|
3774
|
+
return typeof value === "number" ? value : value.max;
|
|
3775
|
+
}
|
|
3776
|
+
function NumberUtils_setRangeValue(source, value) {
|
|
3777
|
+
if (source === value || value === undefined && typeof source === "number") {
|
|
3778
|
+
return source;
|
|
3779
|
+
}
|
|
3780
|
+
const min = NumberUtils_getRangeMin(source), max = NumberUtils_getRangeMax(source);
|
|
3781
|
+
return value !== undefined ? {
|
|
3782
|
+
min: Math.min(min, value),
|
|
3783
|
+
max: Math.max(max, value)
|
|
3784
|
+
} : NumberUtils_setRangeValue(min, max);
|
|
3785
|
+
}
|
|
3786
|
+
function NumberUtils_getValue(options) {
|
|
3787
|
+
const random = options.random;
|
|
3788
|
+
const {enable: enable, minimumValue: minimumValue} = typeof random === "boolean" ? {
|
|
3789
|
+
enable: random,
|
|
3790
|
+
minimumValue: 0
|
|
3791
|
+
} : random;
|
|
3792
|
+
return enable ? NumberUtils_getRangeValue(NumberUtils_setRangeValue(options.value, minimumValue)) : NumberUtils_getRangeValue(options.value);
|
|
3793
|
+
}
|
|
3794
|
+
function NumberUtils_getDistances(pointA, pointB) {
|
|
3795
|
+
const dx = pointA.x - pointB.x;
|
|
3796
|
+
const dy = pointA.y - pointB.y;
|
|
3797
|
+
return {
|
|
3798
|
+
dx: dx,
|
|
3799
|
+
dy: dy,
|
|
3800
|
+
distance: Math.sqrt(dx * dx + dy * dy)
|
|
3801
|
+
};
|
|
3802
|
+
}
|
|
3803
|
+
function NumberUtils_getDistance(pointA, pointB) {
|
|
3804
|
+
return NumberUtils_getDistances(pointA, pointB).distance;
|
|
3805
|
+
}
|
|
3806
|
+
function NumberUtils_getParticleDirectionAngle(direction) {
|
|
3807
|
+
if (typeof direction === "number") {
|
|
3808
|
+
return direction * Math.PI / 180;
|
|
3809
|
+
} else {
|
|
3810
|
+
switch (direction) {
|
|
3811
|
+
case "top":
|
|
3812
|
+
return -Math.PI / 2;
|
|
3813
|
+
|
|
3814
|
+
case "top-right":
|
|
3815
|
+
return -Math.PI / 4;
|
|
3816
|
+
|
|
3817
|
+
case "right":
|
|
3818
|
+
return 0;
|
|
3819
|
+
|
|
3820
|
+
case "bottom-right":
|
|
3821
|
+
return Math.PI / 4;
|
|
3822
|
+
|
|
3823
|
+
case "bottom":
|
|
3824
|
+
return Math.PI / 2;
|
|
3825
|
+
|
|
3826
|
+
case "bottom-left":
|
|
3827
|
+
return 3 * Math.PI / 4;
|
|
3828
|
+
|
|
3829
|
+
case "left":
|
|
3830
|
+
return Math.PI;
|
|
3831
|
+
|
|
3832
|
+
case "top-left":
|
|
3833
|
+
return -3 * Math.PI / 4;
|
|
3834
|
+
|
|
3835
|
+
case "none":
|
|
3836
|
+
default:
|
|
3837
|
+
return Math.random() * Math.PI * 2;
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
function NumberUtils_getParticleBaseVelocity(direction) {
|
|
3842
|
+
const baseVelocity = Vector.origin;
|
|
3843
|
+
baseVelocity.length = 1;
|
|
3844
|
+
baseVelocity.angle = direction;
|
|
3845
|
+
return baseVelocity;
|
|
3846
|
+
}
|
|
3847
|
+
function NumberUtils_collisionVelocity(v1, v2, m1, m2) {
|
|
3848
|
+
return Vector.create(v1.x * (m1 - m2) / (m1 + m2) + v2.x * 2 * m2 / (m1 + m2), v1.y);
|
|
3849
|
+
}
|
|
3850
|
+
function calcEasing(value, type) {
|
|
3851
|
+
switch (type) {
|
|
3852
|
+
case "ease-out-quad":
|
|
3853
|
+
return 1 - (1 - value) ** 2;
|
|
3854
|
+
|
|
3855
|
+
case "ease-out-cubic":
|
|
3856
|
+
return 1 - (1 - value) ** 3;
|
|
3857
|
+
|
|
3858
|
+
case "ease-out-quart":
|
|
3859
|
+
return 1 - (1 - value) ** 4;
|
|
3860
|
+
|
|
3861
|
+
case "ease-out-quint":
|
|
3862
|
+
return 1 - (1 - value) ** 5;
|
|
3863
|
+
|
|
3864
|
+
case "ease-out-expo":
|
|
3865
|
+
return value === 1 ? 1 : 1 - Math.pow(2, -10 * value);
|
|
3866
|
+
|
|
3867
|
+
case "ease-out-sine":
|
|
3868
|
+
return Math.sin(value * Math.PI / 2);
|
|
3869
|
+
|
|
3870
|
+
case "ease-out-back":
|
|
3871
|
+
{
|
|
3872
|
+
const c1 = 1.70158;
|
|
3873
|
+
const c3 = c1 + 1;
|
|
3874
|
+
return 1 + c3 * Math.pow(value - 1, 3) + c1 * Math.pow(value - 1, 2);
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
case "ease-out-circ":
|
|
3878
|
+
return Math.sqrt(1 - Math.pow(value - 1, 2));
|
|
3879
|
+
|
|
3880
|
+
default:
|
|
3881
|
+
return value;
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
function rectSideBounce(pSide, pOtherSide, rectSide, rectOtherSide, velocity, factor) {
|
|
3885
|
+
const res = {
|
|
3886
|
+
bounced: false
|
|
3887
|
+
};
|
|
3888
|
+
if (pOtherSide.min >= rectOtherSide.min && pOtherSide.min <= rectOtherSide.max && pOtherSide.max >= rectOtherSide.min && pOtherSide.max <= rectOtherSide.max) {
|
|
3889
|
+
if (pSide.max >= rectSide.min && pSide.max <= (rectSide.max + rectSide.min) / 2 && velocity > 0 || pSide.min <= rectSide.max && pSide.min > (rectSide.max + rectSide.min) / 2 && velocity < 0) {
|
|
3890
|
+
res.velocity = velocity * -factor;
|
|
3891
|
+
res.bounced = true;
|
|
3892
|
+
}
|
|
3893
|
+
}
|
|
3894
|
+
return res;
|
|
3895
|
+
}
|
|
3896
|
+
function checkSelector(element, selectors) {
|
|
3897
|
+
if (selectors instanceof Array) {
|
|
3898
|
+
for (const selector of selectors) {
|
|
3899
|
+
if (element.matches(selector)) {
|
|
3900
|
+
return true;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
return false;
|
|
3904
|
+
} else {
|
|
3905
|
+
return element.matches(selectors);
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
function Utils_isSsr() {
|
|
3909
|
+
return typeof window === "undefined" || !window || typeof window.document === "undefined" || !window.document;
|
|
3910
|
+
}
|
|
3911
|
+
function Utils_animate() {
|
|
3912
|
+
return Utils_isSsr() ? callback => setTimeout(callback) : callback => (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout)(callback);
|
|
3913
|
+
}
|
|
3914
|
+
function Utils_cancelAnimation() {
|
|
3915
|
+
return Utils_isSsr() ? handle => clearTimeout(handle) : handle => (window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || window.clearTimeout)(handle);
|
|
3916
|
+
}
|
|
3917
|
+
function Utils_isInArray(value, array) {
|
|
3918
|
+
return value === array || array instanceof Array && array.indexOf(value) > -1;
|
|
3919
|
+
}
|
|
3920
|
+
async function loadFont(character) {
|
|
3921
|
+
var _a, _b;
|
|
3922
|
+
try {
|
|
3923
|
+
await document.fonts.load(`${(_a = character.weight) !== null && _a !== void 0 ? _a : "400"} 36px '${(_b = character.font) !== null && _b !== void 0 ? _b : "Verdana"}'`);
|
|
3924
|
+
} catch (_c) {}
|
|
3925
|
+
}
|
|
3926
|
+
function arrayRandomIndex(array) {
|
|
3927
|
+
return Math.floor(Math.random() * array.length);
|
|
3928
|
+
}
|
|
3929
|
+
function Utils_itemFromArray(array, index, useIndex = true) {
|
|
3930
|
+
const fixedIndex = index !== undefined && useIndex ? index % array.length : arrayRandomIndex(array);
|
|
3931
|
+
return array[fixedIndex];
|
|
3932
|
+
}
|
|
3933
|
+
function isPointInside(point, size, radius, direction) {
|
|
3934
|
+
return areBoundsInside(calculateBounds(point, radius !== null && radius !== void 0 ? radius : 0), size, direction);
|
|
3935
|
+
}
|
|
3936
|
+
function areBoundsInside(bounds, size, direction) {
|
|
3937
|
+
let inside = true;
|
|
3938
|
+
if (!direction || direction === "bottom") {
|
|
3939
|
+
inside = bounds.top < size.height;
|
|
3940
|
+
}
|
|
3941
|
+
if (inside && (!direction || direction === "left")) {
|
|
3942
|
+
inside = bounds.right > 0;
|
|
3943
|
+
}
|
|
3944
|
+
if (inside && (!direction || direction === "right")) {
|
|
3945
|
+
inside = bounds.left < size.width;
|
|
3946
|
+
}
|
|
3947
|
+
if (inside && (!direction || direction === "top")) {
|
|
3948
|
+
inside = bounds.bottom > 0;
|
|
3949
|
+
}
|
|
3950
|
+
return inside;
|
|
3951
|
+
}
|
|
3952
|
+
function calculateBounds(point, radius) {
|
|
3953
|
+
return {
|
|
3954
|
+
bottom: point.y + radius,
|
|
3955
|
+
left: point.x - radius,
|
|
3956
|
+
right: point.x + radius,
|
|
3957
|
+
top: point.y - radius
|
|
3958
|
+
};
|
|
3959
|
+
}
|
|
3960
|
+
function Utils_deepExtend(destination, ...sources) {
|
|
3961
|
+
for (const source of sources) {
|
|
3962
|
+
if (source === undefined || source === null) {
|
|
3963
|
+
continue;
|
|
3964
|
+
}
|
|
3965
|
+
if (typeof source !== "object") {
|
|
3966
|
+
destination = source;
|
|
3967
|
+
continue;
|
|
3968
|
+
}
|
|
3969
|
+
const sourceIsArray = Array.isArray(source);
|
|
3970
|
+
if (sourceIsArray && (typeof destination !== "object" || !destination || !Array.isArray(destination))) {
|
|
3971
|
+
destination = [];
|
|
3972
|
+
} else if (!sourceIsArray && (typeof destination !== "object" || !destination || Array.isArray(destination))) {
|
|
3973
|
+
destination = {};
|
|
3974
|
+
}
|
|
3975
|
+
for (const key in source) {
|
|
3976
|
+
if (key === "__proto__") {
|
|
3977
|
+
continue;
|
|
3978
|
+
}
|
|
3979
|
+
const sourceDict = source;
|
|
3980
|
+
const value = sourceDict[key];
|
|
3981
|
+
const isObject = typeof value === "object";
|
|
3982
|
+
const destDict = destination;
|
|
3983
|
+
destDict[key] = isObject && Array.isArray(value) ? value.map((v => Utils_deepExtend(destDict[key], v))) : Utils_deepExtend(destDict[key], value);
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
return destination;
|
|
3987
|
+
}
|
|
3988
|
+
function isDivModeEnabled(mode, divs) {
|
|
3989
|
+
return divs instanceof Array ? !!divs.find((t => t.enable && Utils_isInArray(mode, t.mode))) : Utils_isInArray(mode, divs.mode);
|
|
3990
|
+
}
|
|
3991
|
+
function divModeExecute(mode, divs, callback) {
|
|
3992
|
+
if (divs instanceof Array) {
|
|
3993
|
+
for (const div of divs) {
|
|
3994
|
+
const divMode = div.mode;
|
|
3995
|
+
const divEnabled = div.enable;
|
|
3996
|
+
if (divEnabled && Utils_isInArray(mode, divMode)) {
|
|
3997
|
+
singleDivModeExecute(div, callback);
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
} else {
|
|
4001
|
+
const divMode = divs.mode;
|
|
4002
|
+
const divEnabled = divs.enable;
|
|
4003
|
+
if (divEnabled && Utils_isInArray(mode, divMode)) {
|
|
4004
|
+
singleDivModeExecute(divs, callback);
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
function singleDivModeExecute(div, callback) {
|
|
4009
|
+
const selectors = div.selectors;
|
|
4010
|
+
if (selectors instanceof Array) {
|
|
4011
|
+
for (const selector of selectors) {
|
|
4012
|
+
callback(selector, div);
|
|
4013
|
+
}
|
|
4014
|
+
} else {
|
|
4015
|
+
callback(selectors, div);
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
function divMode(divs, element) {
|
|
4019
|
+
if (!element || !divs) {
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
if (divs instanceof Array) {
|
|
4023
|
+
return divs.find((d => checkSelector(element, d.selectors)));
|
|
4024
|
+
} else if (checkSelector(element, divs.selectors)) {
|
|
4025
|
+
return divs;
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
function circleBounceDataFromParticle(p) {
|
|
4029
|
+
return {
|
|
4030
|
+
position: p.getPosition(),
|
|
4031
|
+
radius: p.getRadius(),
|
|
4032
|
+
mass: p.getMass(),
|
|
4033
|
+
velocity: p.velocity,
|
|
4034
|
+
factor: Vector.create(getValue(p.options.bounce.horizontal), getValue(p.options.bounce.vertical))
|
|
4035
|
+
};
|
|
4036
|
+
}
|
|
4037
|
+
function circleBounce(p1, p2) {
|
|
4038
|
+
const {x: xVelocityDiff, y: yVelocityDiff} = p1.velocity.sub(p2.velocity);
|
|
4039
|
+
const [pos1, pos2] = [ p1.position, p2.position ];
|
|
4040
|
+
const {dx: xDist, dy: yDist} = getDistances(pos2, pos1);
|
|
4041
|
+
if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
|
|
4042
|
+
const angle = -Math.atan2(yDist, xDist);
|
|
4043
|
+
const m1 = p1.mass;
|
|
4044
|
+
const m2 = p2.mass;
|
|
4045
|
+
const u1 = p1.velocity.rotate(angle);
|
|
4046
|
+
const u2 = p2.velocity.rotate(angle);
|
|
4047
|
+
const v1 = collisionVelocity(u1, u2, m1, m2);
|
|
4048
|
+
const v2 = collisionVelocity(u2, u1, m1, m2);
|
|
4049
|
+
const vFinal1 = v1.rotate(-angle);
|
|
4050
|
+
const vFinal2 = v2.rotate(-angle);
|
|
4051
|
+
p1.velocity.x = vFinal1.x * p1.factor.x;
|
|
4052
|
+
p1.velocity.y = vFinal1.y * p1.factor.y;
|
|
4053
|
+
p2.velocity.x = vFinal2.x * p2.factor.x;
|
|
4054
|
+
p2.velocity.y = vFinal2.y * p2.factor.y;
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4057
|
+
function rectBounce(particle, divBounds) {
|
|
4058
|
+
const pPos = particle.getPosition();
|
|
4059
|
+
const size = particle.getRadius();
|
|
4060
|
+
const bounds = calculateBounds(pPos, size);
|
|
4061
|
+
const resH = rectSideBounce({
|
|
4062
|
+
min: bounds.left,
|
|
4063
|
+
max: bounds.right
|
|
4064
|
+
}, {
|
|
4065
|
+
min: bounds.top,
|
|
4066
|
+
max: bounds.bottom
|
|
4067
|
+
}, {
|
|
4068
|
+
min: divBounds.left,
|
|
4069
|
+
max: divBounds.right
|
|
4070
|
+
}, {
|
|
4071
|
+
min: divBounds.top,
|
|
4072
|
+
max: divBounds.bottom
|
|
4073
|
+
}, particle.velocity.x, getValue(particle.options.bounce.horizontal));
|
|
4074
|
+
if (resH.bounced) {
|
|
4075
|
+
if (resH.velocity !== undefined) {
|
|
4076
|
+
particle.velocity.x = resH.velocity;
|
|
4077
|
+
}
|
|
4078
|
+
if (resH.position !== undefined) {
|
|
4079
|
+
particle.position.x = resH.position;
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
const resV = rectSideBounce({
|
|
4083
|
+
min: bounds.top,
|
|
4084
|
+
max: bounds.bottom
|
|
4085
|
+
}, {
|
|
4086
|
+
min: bounds.left,
|
|
4087
|
+
max: bounds.right
|
|
4088
|
+
}, {
|
|
4089
|
+
min: divBounds.top,
|
|
4090
|
+
max: divBounds.bottom
|
|
4091
|
+
}, {
|
|
4092
|
+
min: divBounds.left,
|
|
4093
|
+
max: divBounds.right
|
|
4094
|
+
}, particle.velocity.y, getValue(particle.options.bounce.vertical));
|
|
4095
|
+
if (resV.bounced) {
|
|
4096
|
+
if (resV.velocity !== undefined) {
|
|
4097
|
+
particle.velocity.y = resV.velocity;
|
|
4098
|
+
}
|
|
4099
|
+
if (resV.position !== undefined) {
|
|
4100
|
+
particle.position.y = resV.position;
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
function hue2rgb(p, q, t) {
|
|
4105
|
+
let tCalc = t;
|
|
4106
|
+
if (tCalc < 0) {
|
|
4107
|
+
tCalc += 1;
|
|
4108
|
+
}
|
|
4109
|
+
if (tCalc > 1) {
|
|
4110
|
+
tCalc -= 1;
|
|
4111
|
+
}
|
|
4112
|
+
if (tCalc < 1 / 6) {
|
|
4113
|
+
return p + (q - p) * 6 * tCalc;
|
|
4114
|
+
}
|
|
4115
|
+
if (tCalc < 1 / 2) {
|
|
4116
|
+
return q;
|
|
4117
|
+
}
|
|
4118
|
+
if (tCalc < 2 / 3) {
|
|
4119
|
+
return p + (q - p) * (2 / 3 - tCalc) * 6;
|
|
4120
|
+
}
|
|
4121
|
+
return p;
|
|
4122
|
+
}
|
|
4123
|
+
function stringToRgba(input) {
|
|
4124
|
+
if (input.startsWith("rgb")) {
|
|
4125
|
+
const regex = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([\d.]+)\s*)?\)/i;
|
|
4126
|
+
const result = regex.exec(input);
|
|
4127
|
+
return result ? {
|
|
4128
|
+
a: result.length > 4 ? parseFloat(result[5]) : 1,
|
|
4129
|
+
b: parseInt(result[3], 10),
|
|
4130
|
+
g: parseInt(result[2], 10),
|
|
4131
|
+
r: parseInt(result[1], 10)
|
|
4132
|
+
} : undefined;
|
|
4133
|
+
} else if (input.startsWith("hsl")) {
|
|
4134
|
+
const regex = /hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.]+)\s*)?\)/i;
|
|
4135
|
+
const result = regex.exec(input);
|
|
4136
|
+
return result ? hslaToRgba({
|
|
4137
|
+
a: result.length > 4 ? parseFloat(result[5]) : 1,
|
|
4138
|
+
h: parseInt(result[1], 10),
|
|
4139
|
+
l: parseInt(result[3], 10),
|
|
4140
|
+
s: parseInt(result[2], 10)
|
|
4141
|
+
}) : undefined;
|
|
4142
|
+
} else if (input.startsWith("hsv")) {
|
|
4143
|
+
const regex = /hsva?\(\s*(\d+)°\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([\d.]+)\s*)?\)/i;
|
|
4144
|
+
const result = regex.exec(input);
|
|
4145
|
+
return result ? hsvaToRgba({
|
|
4146
|
+
a: result.length > 4 ? parseFloat(result[5]) : 1,
|
|
4147
|
+
h: parseInt(result[1], 10),
|
|
4148
|
+
s: parseInt(result[2], 10),
|
|
4149
|
+
v: parseInt(result[3], 10)
|
|
4150
|
+
}) : undefined;
|
|
4151
|
+
} else {
|
|
4152
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
4153
|
+
const hexFixed = input.replace(shorthandRegex, ((_m, r, g, b, a) => r + r + g + g + b + b + (a !== undefined ? a + a : "")));
|
|
4154
|
+
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
|
|
4155
|
+
const result = regex.exec(hexFixed);
|
|
4156
|
+
return result ? {
|
|
4157
|
+
a: result[4] !== undefined ? parseInt(result[4], 16) / 255 : 1,
|
|
4158
|
+
b: parseInt(result[3], 16),
|
|
4159
|
+
g: parseInt(result[2], 16),
|
|
4160
|
+
r: parseInt(result[1], 16)
|
|
4161
|
+
} : undefined;
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
4164
|
+
function ColorUtils_colorToRgb(input, index, useIndex = true) {
|
|
4165
|
+
var _a, _b, _c;
|
|
4166
|
+
if (input === undefined) {
|
|
4167
|
+
return;
|
|
4168
|
+
}
|
|
4169
|
+
const color = typeof input === "string" ? {
|
|
4170
|
+
value: input
|
|
4171
|
+
} : input;
|
|
4172
|
+
let res;
|
|
4173
|
+
if (typeof color.value === "string") {
|
|
4174
|
+
if (color.value === Constants.randomColorValue) {
|
|
4175
|
+
res = getRandomRgbColor();
|
|
4176
|
+
} else {
|
|
4177
|
+
res = stringToRgb(color.value);
|
|
4178
|
+
}
|
|
4179
|
+
} else {
|
|
4180
|
+
if (color.value instanceof Array) {
|
|
4181
|
+
const colorSelected = itemFromArray(color.value, index, useIndex);
|
|
4182
|
+
res = ColorUtils_colorToRgb({
|
|
4183
|
+
value: colorSelected
|
|
4184
|
+
});
|
|
4185
|
+
} else {
|
|
4186
|
+
const colorValue = color.value;
|
|
4187
|
+
const rgbColor = (_a = colorValue.rgb) !== null && _a !== void 0 ? _a : color.value;
|
|
4188
|
+
if (rgbColor.r !== undefined) {
|
|
4189
|
+
res = rgbColor;
|
|
4190
|
+
} else {
|
|
4191
|
+
const hslColor = (_b = colorValue.hsl) !== null && _b !== void 0 ? _b : color.value;
|
|
4192
|
+
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
4193
|
+
res = hslToRgb(hslColor);
|
|
4194
|
+
} else {
|
|
4195
|
+
const hsvColor = (_c = colorValue.hsv) !== null && _c !== void 0 ? _c : color.value;
|
|
4196
|
+
if (hsvColor.h !== undefined && hsvColor.v !== undefined) {
|
|
4197
|
+
res = hsvToRgb(hsvColor);
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
return res;
|
|
4204
|
+
}
|
|
4205
|
+
function ColorUtils_colorToHsl(color, index, useIndex = true) {
|
|
4206
|
+
const rgb = ColorUtils_colorToRgb(color, index, useIndex);
|
|
4207
|
+
return rgb !== undefined ? rgbToHsl(rgb) : undefined;
|
|
4208
|
+
}
|
|
4209
|
+
function rgbToHsl(color) {
|
|
4210
|
+
const r1 = color.r / 255;
|
|
4211
|
+
const g1 = color.g / 255;
|
|
4212
|
+
const b1 = color.b / 255;
|
|
4213
|
+
const max = Math.max(r1, g1, b1);
|
|
4214
|
+
const min = Math.min(r1, g1, b1);
|
|
4215
|
+
const res = {
|
|
4216
|
+
h: 0,
|
|
4217
|
+
l: (max + min) / 2,
|
|
4218
|
+
s: 0
|
|
4219
|
+
};
|
|
4220
|
+
if (max != min) {
|
|
4221
|
+
res.s = res.l < .5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);
|
|
4222
|
+
res.h = r1 === max ? (g1 - b1) / (max - min) : res.h = g1 === max ? 2 + (b1 - r1) / (max - min) : 4 + (r1 - g1) / (max - min);
|
|
4223
|
+
}
|
|
4224
|
+
res.l *= 100;
|
|
4225
|
+
res.s *= 100;
|
|
4226
|
+
res.h *= 60;
|
|
4227
|
+
if (res.h < 0) {
|
|
4228
|
+
res.h += 360;
|
|
4229
|
+
}
|
|
4230
|
+
return res;
|
|
4231
|
+
}
|
|
4232
|
+
function stringToAlpha(input) {
|
|
4233
|
+
var _a;
|
|
4234
|
+
return (_a = stringToRgba(input)) === null || _a === void 0 ? void 0 : _a.a;
|
|
4235
|
+
}
|
|
4236
|
+
function stringToRgb(input) {
|
|
4237
|
+
return stringToRgba(input);
|
|
4238
|
+
}
|
|
4239
|
+
function hslToRgb(hsl) {
|
|
4240
|
+
const result = {
|
|
4241
|
+
b: 0,
|
|
4242
|
+
g: 0,
|
|
4243
|
+
r: 0
|
|
4244
|
+
};
|
|
4245
|
+
const hslPercent = {
|
|
4246
|
+
h: hsl.h / 360,
|
|
4247
|
+
l: hsl.l / 100,
|
|
4248
|
+
s: hsl.s / 100
|
|
4249
|
+
};
|
|
4250
|
+
if (hslPercent.s === 0) {
|
|
4251
|
+
result.b = hslPercent.l;
|
|
4252
|
+
result.g = hslPercent.l;
|
|
4253
|
+
result.r = hslPercent.l;
|
|
4254
|
+
} else {
|
|
4255
|
+
const q = hslPercent.l < .5 ? hslPercent.l * (1 + hslPercent.s) : hslPercent.l + hslPercent.s - hslPercent.l * hslPercent.s;
|
|
4256
|
+
const p = 2 * hslPercent.l - q;
|
|
4257
|
+
result.r = hue2rgb(p, q, hslPercent.h + 1 / 3);
|
|
4258
|
+
result.g = hue2rgb(p, q, hslPercent.h);
|
|
4259
|
+
result.b = hue2rgb(p, q, hslPercent.h - 1 / 3);
|
|
4260
|
+
}
|
|
4261
|
+
result.r = Math.floor(result.r * 255);
|
|
4262
|
+
result.g = Math.floor(result.g * 255);
|
|
4263
|
+
result.b = Math.floor(result.b * 255);
|
|
4264
|
+
return result;
|
|
4265
|
+
}
|
|
4266
|
+
function hslaToRgba(hsla) {
|
|
4267
|
+
const rgbResult = hslToRgb(hsla);
|
|
4268
|
+
return {
|
|
4269
|
+
a: hsla.a,
|
|
4270
|
+
b: rgbResult.b,
|
|
4271
|
+
g: rgbResult.g,
|
|
4272
|
+
r: rgbResult.r
|
|
4273
|
+
};
|
|
4274
|
+
}
|
|
4275
|
+
function hslToHsv(hsl) {
|
|
4276
|
+
const l = hsl.l / 100, sl = hsl.s / 100;
|
|
4277
|
+
const v = l + sl * Math.min(l, 1 - l), sv = !v ? 0 : 2 * (1 - l / v);
|
|
4278
|
+
return {
|
|
4279
|
+
h: hsl.h,
|
|
4280
|
+
s: sv * 100,
|
|
4281
|
+
v: v * 100
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
function hslaToHsva(hsla) {
|
|
4285
|
+
const hsvResult = hslToHsv(hsla);
|
|
4286
|
+
return {
|
|
4287
|
+
a: hsla.a,
|
|
4288
|
+
h: hsvResult.h,
|
|
4289
|
+
s: hsvResult.s,
|
|
4290
|
+
v: hsvResult.v
|
|
4291
|
+
};
|
|
4292
|
+
}
|
|
4293
|
+
function hsvToHsl(hsv) {
|
|
4294
|
+
const v = hsv.v / 100, sv = hsv.s / 100;
|
|
4295
|
+
const l = v * (1 - sv / 2), sl = l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l);
|
|
4296
|
+
return {
|
|
4297
|
+
h: hsv.h,
|
|
4298
|
+
l: l * 100,
|
|
4299
|
+
s: sl * 100
|
|
4300
|
+
};
|
|
4301
|
+
}
|
|
4302
|
+
function hsvaToHsla(hsva) {
|
|
4303
|
+
const hslResult = hsvToHsl(hsva);
|
|
4304
|
+
return {
|
|
4305
|
+
a: hsva.a,
|
|
4306
|
+
h: hslResult.h,
|
|
4307
|
+
l: hslResult.l,
|
|
4308
|
+
s: hslResult.s
|
|
4309
|
+
};
|
|
4310
|
+
}
|
|
4311
|
+
function hsvToRgb(hsv) {
|
|
4312
|
+
const result = {
|
|
4313
|
+
b: 0,
|
|
4314
|
+
g: 0,
|
|
4315
|
+
r: 0
|
|
4316
|
+
};
|
|
4317
|
+
const hsvPercent = {
|
|
4318
|
+
h: hsv.h / 60,
|
|
4319
|
+
s: hsv.s / 100,
|
|
4320
|
+
v: hsv.v / 100
|
|
4321
|
+
};
|
|
4322
|
+
const c = hsvPercent.v * hsvPercent.s, x = c * (1 - Math.abs(hsvPercent.h % 2 - 1));
|
|
4323
|
+
let tempRgb;
|
|
4324
|
+
if (hsvPercent.h >= 0 && hsvPercent.h <= 1) {
|
|
4325
|
+
tempRgb = {
|
|
4326
|
+
r: c,
|
|
4327
|
+
g: x,
|
|
4328
|
+
b: 0
|
|
4329
|
+
};
|
|
4330
|
+
} else if (hsvPercent.h > 1 && hsvPercent.h <= 2) {
|
|
4331
|
+
tempRgb = {
|
|
4332
|
+
r: x,
|
|
4333
|
+
g: c,
|
|
4334
|
+
b: 0
|
|
4335
|
+
};
|
|
4336
|
+
} else if (hsvPercent.h > 2 && hsvPercent.h <= 3) {
|
|
4337
|
+
tempRgb = {
|
|
4338
|
+
r: 0,
|
|
4339
|
+
g: c,
|
|
4340
|
+
b: x
|
|
4341
|
+
};
|
|
4342
|
+
} else if (hsvPercent.h > 3 && hsvPercent.h <= 4) {
|
|
4343
|
+
tempRgb = {
|
|
4344
|
+
r: 0,
|
|
4345
|
+
g: x,
|
|
4346
|
+
b: c
|
|
4347
|
+
};
|
|
4348
|
+
} else if (hsvPercent.h > 4 && hsvPercent.h <= 5) {
|
|
4349
|
+
tempRgb = {
|
|
4350
|
+
r: x,
|
|
4351
|
+
g: 0,
|
|
4352
|
+
b: c
|
|
4353
|
+
};
|
|
4354
|
+
} else if (hsvPercent.h > 5 && hsvPercent.h <= 6) {
|
|
4355
|
+
tempRgb = {
|
|
4356
|
+
r: c,
|
|
4357
|
+
g: 0,
|
|
4358
|
+
b: x
|
|
4359
|
+
};
|
|
4360
|
+
}
|
|
4361
|
+
if (tempRgb) {
|
|
4362
|
+
const m = hsvPercent.v - c;
|
|
4363
|
+
result.r = Math.floor((tempRgb.r + m) * 255);
|
|
4364
|
+
result.g = Math.floor((tempRgb.g + m) * 255);
|
|
4365
|
+
result.b = Math.floor((tempRgb.b + m) * 255);
|
|
4366
|
+
}
|
|
4367
|
+
return result;
|
|
4368
|
+
}
|
|
4369
|
+
function hsvaToRgba(hsva) {
|
|
4370
|
+
const rgbResult = hsvToRgb(hsva);
|
|
4371
|
+
return {
|
|
4372
|
+
a: hsva.a,
|
|
4373
|
+
b: rgbResult.b,
|
|
4374
|
+
g: rgbResult.g,
|
|
4375
|
+
r: rgbResult.r
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
function rgbToHsv(rgb) {
|
|
4379
|
+
const rgbPercent = {
|
|
4380
|
+
r: rgb.r / 255,
|
|
4381
|
+
g: rgb.g / 255,
|
|
4382
|
+
b: rgb.b / 255
|
|
4383
|
+
}, xMax = Math.max(rgbPercent.r, rgbPercent.g, rgbPercent.b), xMin = Math.min(rgbPercent.r, rgbPercent.g, rgbPercent.b), v = xMax, c = xMax - xMin;
|
|
4384
|
+
let h = 0;
|
|
4385
|
+
if (v === rgbPercent.r) {
|
|
4386
|
+
h = 60 * ((rgbPercent.g - rgbPercent.b) / c);
|
|
4387
|
+
} else if (v === rgbPercent.g) {
|
|
4388
|
+
h = 60 * (2 + (rgbPercent.b - rgbPercent.r) / c);
|
|
4389
|
+
} else if (v === rgbPercent.b) {
|
|
4390
|
+
h = 60 * (4 + (rgbPercent.r - rgbPercent.g) / c);
|
|
4391
|
+
}
|
|
4392
|
+
const s = !v ? 0 : c / v;
|
|
4393
|
+
return {
|
|
4394
|
+
h: h,
|
|
4395
|
+
s: s * 100,
|
|
4396
|
+
v: v * 100
|
|
4397
|
+
};
|
|
4398
|
+
}
|
|
4399
|
+
function rgbaToHsva(rgba) {
|
|
4400
|
+
const hsvResult = rgbToHsv(rgba);
|
|
4401
|
+
return {
|
|
4402
|
+
a: rgba.a,
|
|
4403
|
+
h: hsvResult.h,
|
|
4404
|
+
s: hsvResult.s,
|
|
4405
|
+
v: hsvResult.v
|
|
4406
|
+
};
|
|
4407
|
+
}
|
|
4408
|
+
function getRandomRgbColor(min) {
|
|
4409
|
+
const fixedMin = min !== null && min !== void 0 ? min : 0;
|
|
4410
|
+
return {
|
|
4411
|
+
b: Math.floor(randomInRange(setRangeValue(fixedMin, 256))),
|
|
4412
|
+
g: Math.floor(randomInRange(setRangeValue(fixedMin, 256))),
|
|
4413
|
+
r: Math.floor(randomInRange(setRangeValue(fixedMin, 256)))
|
|
4414
|
+
};
|
|
4415
|
+
}
|
|
4416
|
+
function ColorUtils_getStyleFromRgb(color, opacity) {
|
|
4417
|
+
return `rgba(${color.r}, ${color.g}, ${color.b}, ${opacity !== null && opacity !== void 0 ? opacity : 1})`;
|
|
4418
|
+
}
|
|
4419
|
+
function ColorUtils_getStyleFromHsl(color, opacity) {
|
|
4420
|
+
return `hsla(${color.h}, ${color.s}%, ${color.l}%, ${opacity !== null && opacity !== void 0 ? opacity : 1})`;
|
|
4421
|
+
}
|
|
4422
|
+
function getStyleFromHsv(color, opacity) {
|
|
4423
|
+
return ColorUtils_getStyleFromHsl(hsvToHsl(color), opacity);
|
|
4424
|
+
}
|
|
4425
|
+
function ColorUtils_colorMix(color1, color2, size1, size2) {
|
|
4426
|
+
let rgb1 = color1;
|
|
4427
|
+
let rgb2 = color2;
|
|
4428
|
+
if (rgb1.r === undefined) {
|
|
4429
|
+
rgb1 = hslToRgb(color1);
|
|
4430
|
+
}
|
|
4431
|
+
if (rgb2.r === undefined) {
|
|
4432
|
+
rgb2 = hslToRgb(color2);
|
|
4433
|
+
}
|
|
4434
|
+
return {
|
|
4435
|
+
b: mix(rgb1.b, rgb2.b, size1, size2),
|
|
4436
|
+
g: mix(rgb1.g, rgb2.g, size1, size2),
|
|
4437
|
+
r: mix(rgb1.r, rgb2.r, size1, size2)
|
|
4438
|
+
};
|
|
4439
|
+
}
|
|
4440
|
+
function getLinkColor(p1, p2, linkColor) {
|
|
4441
|
+
var _a, _b;
|
|
4442
|
+
if (linkColor === Constants.randomColorValue) {
|
|
4443
|
+
return getRandomRgbColor();
|
|
4444
|
+
} else if (linkColor === "mid") {
|
|
4445
|
+
const sourceColor = (_a = p1.getFillColor()) !== null && _a !== void 0 ? _a : p1.getStrokeColor();
|
|
4446
|
+
const destColor = (_b = p2 === null || p2 === void 0 ? void 0 : p2.getFillColor()) !== null && _b !== void 0 ? _b : p2 === null || p2 === void 0 ? void 0 : p2.getStrokeColor();
|
|
4447
|
+
if (sourceColor && destColor && p2) {
|
|
4448
|
+
return ColorUtils_colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
|
|
4449
|
+
} else {
|
|
4450
|
+
const hslColor = sourceColor !== null && sourceColor !== void 0 ? sourceColor : destColor;
|
|
4451
|
+
if (hslColor) {
|
|
4452
|
+
return hslToRgb(hslColor);
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
} else {
|
|
4456
|
+
return linkColor;
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4459
|
+
function getLinkRandomColor(optColor, blink, consent) {
|
|
4460
|
+
const color = typeof optColor === "string" ? optColor : optColor.value;
|
|
4461
|
+
if (color === Constants.randomColorValue) {
|
|
4462
|
+
if (consent) {
|
|
4463
|
+
return ColorUtils_colorToRgb({
|
|
4464
|
+
value: color
|
|
4465
|
+
});
|
|
4466
|
+
} else if (blink) {
|
|
4467
|
+
return Constants.randomColorValue;
|
|
4468
|
+
} else {
|
|
4469
|
+
return Constants.midColorValue;
|
|
4470
|
+
}
|
|
4471
|
+
} else {
|
|
4472
|
+
return ColorUtils_colorToRgb({
|
|
4473
|
+
value: color
|
|
4474
|
+
});
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
function ColorUtils_getHslFromAnimation(animation) {
|
|
4478
|
+
return animation !== undefined ? {
|
|
4479
|
+
h: animation.h.value,
|
|
4480
|
+
s: animation.s.value,
|
|
4481
|
+
l: animation.l.value
|
|
4482
|
+
} : undefined;
|
|
4483
|
+
}
|
|
4484
|
+
function getHslAnimationFromHsl(hsl, animationOptions, reduceFactor) {
|
|
4485
|
+
const resColor = {
|
|
4486
|
+
h: {
|
|
4487
|
+
enable: false,
|
|
4488
|
+
value: hsl.h
|
|
4489
|
+
},
|
|
4490
|
+
s: {
|
|
4491
|
+
enable: false,
|
|
4492
|
+
value: hsl.s
|
|
4493
|
+
},
|
|
4494
|
+
l: {
|
|
4495
|
+
enable: false,
|
|
4496
|
+
value: hsl.l
|
|
4497
|
+
}
|
|
4498
|
+
};
|
|
4499
|
+
if (animationOptions) {
|
|
4500
|
+
setColorAnimation(resColor.h, animationOptions.h, reduceFactor);
|
|
4501
|
+
setColorAnimation(resColor.s, animationOptions.s, reduceFactor);
|
|
4502
|
+
setColorAnimation(resColor.l, animationOptions.l, reduceFactor);
|
|
4503
|
+
}
|
|
4504
|
+
return resColor;
|
|
4505
|
+
}
|
|
4506
|
+
function setColorAnimation(colorValue, colorAnimation, reduceFactor) {
|
|
4507
|
+
colorValue.enable = colorAnimation.enable;
|
|
4508
|
+
if (colorValue.enable) {
|
|
4509
|
+
colorValue.velocity = colorAnimation.speed / 100 * reduceFactor;
|
|
4510
|
+
if (colorAnimation.sync) {
|
|
4511
|
+
return;
|
|
4512
|
+
}
|
|
4513
|
+
colorValue.status = 0;
|
|
4514
|
+
colorValue.velocity *= Math.random();
|
|
4515
|
+
if (colorValue.value) {
|
|
4516
|
+
colorValue.value *= Math.random();
|
|
4517
|
+
}
|
|
4518
|
+
} else {
|
|
4519
|
+
colorValue.velocity = 0;
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
function drawLine(context, begin, end) {
|
|
4523
|
+
context.beginPath();
|
|
4524
|
+
context.moveTo(begin.x, begin.y);
|
|
4525
|
+
context.lineTo(end.x, end.y);
|
|
4526
|
+
context.closePath();
|
|
4527
|
+
}
|
|
4528
|
+
function drawTriangle(context, p1, p2, p3) {
|
|
4529
|
+
context.beginPath();
|
|
4530
|
+
context.moveTo(p1.x, p1.y);
|
|
4531
|
+
context.lineTo(p2.x, p2.y);
|
|
4532
|
+
context.lineTo(p3.x, p3.y);
|
|
4533
|
+
context.closePath();
|
|
4534
|
+
}
|
|
4535
|
+
function CanvasUtils_paintBase(context, dimension, baseColor) {
|
|
4536
|
+
context.save();
|
|
4537
|
+
context.fillStyle = baseColor !== null && baseColor !== void 0 ? baseColor : "rgba(0,0,0,0)";
|
|
4538
|
+
context.fillRect(0, 0, dimension.width, dimension.height);
|
|
4539
|
+
context.restore();
|
|
4540
|
+
}
|
|
4541
|
+
function CanvasUtils_clear(context, dimension) {
|
|
4542
|
+
context.clearRect(0, 0, dimension.width, dimension.height);
|
|
4543
|
+
}
|
|
4544
|
+
function drawLinkLine(context, width, begin, end, maxDistance, canvasSize, warp, backgroundMask, composite, colorLine, opacity, shadow) {
|
|
4545
|
+
let drawn = false;
|
|
4546
|
+
if (getDistance(begin, end) <= maxDistance) {
|
|
4547
|
+
drawLine(context, begin, end);
|
|
4548
|
+
drawn = true;
|
|
4549
|
+
} else if (warp) {
|
|
4550
|
+
let pi1;
|
|
4551
|
+
let pi2;
|
|
4552
|
+
const endNE = {
|
|
4553
|
+
x: end.x - canvasSize.width,
|
|
4554
|
+
y: end.y
|
|
4555
|
+
};
|
|
4556
|
+
const d1 = getDistances(begin, endNE);
|
|
4557
|
+
if (d1.distance <= maxDistance) {
|
|
4558
|
+
const yi = begin.y - d1.dy / d1.dx * begin.x;
|
|
4559
|
+
pi1 = {
|
|
4560
|
+
x: 0,
|
|
4561
|
+
y: yi
|
|
4562
|
+
};
|
|
4563
|
+
pi2 = {
|
|
4564
|
+
x: canvasSize.width,
|
|
4565
|
+
y: yi
|
|
4566
|
+
};
|
|
4567
|
+
} else {
|
|
4568
|
+
const endSW = {
|
|
4569
|
+
x: end.x,
|
|
4570
|
+
y: end.y - canvasSize.height
|
|
4571
|
+
};
|
|
4572
|
+
const d2 = getDistances(begin, endSW);
|
|
4573
|
+
if (d2.distance <= maxDistance) {
|
|
4574
|
+
const yi = begin.y - d2.dy / d2.dx * begin.x;
|
|
4575
|
+
const xi = -yi / (d2.dy / d2.dx);
|
|
4576
|
+
pi1 = {
|
|
4577
|
+
x: xi,
|
|
4578
|
+
y: 0
|
|
4579
|
+
};
|
|
4580
|
+
pi2 = {
|
|
4581
|
+
x: xi,
|
|
4582
|
+
y: canvasSize.height
|
|
4583
|
+
};
|
|
4584
|
+
} else {
|
|
4585
|
+
const endSE = {
|
|
4586
|
+
x: end.x - canvasSize.width,
|
|
4587
|
+
y: end.y - canvasSize.height
|
|
4588
|
+
};
|
|
4589
|
+
const d3 = getDistances(begin, endSE);
|
|
4590
|
+
if (d3.distance <= maxDistance) {
|
|
4591
|
+
const yi = begin.y - d3.dy / d3.dx * begin.x;
|
|
4592
|
+
const xi = -yi / (d3.dy / d3.dx);
|
|
4593
|
+
pi1 = {
|
|
4594
|
+
x: xi,
|
|
4595
|
+
y: yi
|
|
4596
|
+
};
|
|
4597
|
+
pi2 = {
|
|
4598
|
+
x: pi1.x + canvasSize.width,
|
|
4599
|
+
y: pi1.y + canvasSize.height
|
|
4600
|
+
};
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
}
|
|
4604
|
+
if (pi1 && pi2) {
|
|
4605
|
+
drawLine(context, begin, pi1);
|
|
4606
|
+
drawLine(context, end, pi2);
|
|
4607
|
+
drawn = true;
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
if (!drawn) {
|
|
4611
|
+
return;
|
|
4612
|
+
}
|
|
4613
|
+
context.lineWidth = width;
|
|
4614
|
+
if (backgroundMask) {
|
|
4615
|
+
context.globalCompositeOperation = composite;
|
|
4616
|
+
}
|
|
4617
|
+
context.strokeStyle = getStyleFromRgb(colorLine, opacity);
|
|
4618
|
+
if (shadow.enable) {
|
|
4619
|
+
const shadowColor = colorToRgb(shadow.color);
|
|
4620
|
+
if (shadowColor) {
|
|
4621
|
+
context.shadowBlur = shadow.blur;
|
|
4622
|
+
context.shadowColor = getStyleFromRgb(shadowColor);
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
context.stroke();
|
|
4626
|
+
}
|
|
4627
|
+
function drawLinkTriangle(context, pos1, pos2, pos3, backgroundMask, composite, colorTriangle, opacityTriangle) {
|
|
4628
|
+
drawTriangle(context, pos1, pos2, pos3);
|
|
4629
|
+
if (backgroundMask) {
|
|
4630
|
+
context.globalCompositeOperation = composite;
|
|
4631
|
+
}
|
|
4632
|
+
context.fillStyle = getStyleFromRgb(colorTriangle, opacityTriangle);
|
|
4633
|
+
context.fill();
|
|
4634
|
+
}
|
|
4635
|
+
function CanvasUtils_drawConnectLine(context, width, lineStyle, begin, end) {
|
|
4636
|
+
context.save();
|
|
4637
|
+
drawLine(context, begin, end);
|
|
4638
|
+
context.lineWidth = width;
|
|
4639
|
+
context.strokeStyle = lineStyle;
|
|
4640
|
+
context.stroke();
|
|
4641
|
+
context.restore();
|
|
4642
|
+
}
|
|
4643
|
+
function CanvasUtils_gradient(context, p1, p2, opacity) {
|
|
4644
|
+
const gradStop = Math.floor(p2.getRadius() / p1.getRadius());
|
|
4645
|
+
const color1 = p1.getFillColor();
|
|
4646
|
+
const color2 = p2.getFillColor();
|
|
4647
|
+
if (!color1 || !color2) {
|
|
4648
|
+
return;
|
|
4649
|
+
}
|
|
4650
|
+
const sourcePos = p1.getPosition();
|
|
4651
|
+
const destPos = p2.getPosition();
|
|
4652
|
+
const midRgb = colorMix(color1, color2, p1.getRadius(), p2.getRadius());
|
|
4653
|
+
const grad = context.createLinearGradient(sourcePos.x, sourcePos.y, destPos.x, destPos.y);
|
|
4654
|
+
grad.addColorStop(0, getStyleFromHsl(color1, opacity));
|
|
4655
|
+
grad.addColorStop(gradStop > 1 ? 1 : gradStop, getStyleFromRgb(midRgb, opacity));
|
|
4656
|
+
grad.addColorStop(1, getStyleFromHsl(color2, opacity));
|
|
4657
|
+
return grad;
|
|
4658
|
+
}
|
|
4659
|
+
function CanvasUtils_drawGrabLine(context, width, begin, end, colorLine, opacity) {
|
|
4660
|
+
context.save();
|
|
4661
|
+
drawLine(context, begin, end);
|
|
4662
|
+
context.strokeStyle = getStyleFromRgb(colorLine, opacity);
|
|
4663
|
+
context.lineWidth = width;
|
|
4664
|
+
context.stroke();
|
|
4665
|
+
context.restore();
|
|
4666
|
+
}
|
|
4667
|
+
function CanvasUtils_drawParticle(container, context, particle, delta, fillColorValue, strokeColorValue, backgroundMask, composite, radius, opacity, shadow, gradient) {
|
|
4668
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4669
|
+
const pos = particle.getPosition();
|
|
4670
|
+
const tiltOptions = particle.options.tilt;
|
|
4671
|
+
const rollOptions = particle.options.roll;
|
|
4672
|
+
context.save();
|
|
4673
|
+
if (tiltOptions.enable || rollOptions.enable) {
|
|
4674
|
+
const roll = rollOptions.enable && particle.roll;
|
|
4675
|
+
const tilt = tiltOptions.enable && particle.tilt;
|
|
4676
|
+
const rollHorizontal = roll && (rollOptions.mode === "horizontal" || rollOptions.mode === "both");
|
|
4677
|
+
const rollVertical = roll && (rollOptions.mode === "vertical" || rollOptions.mode === "both");
|
|
4678
|
+
context.setTransform(rollHorizontal ? Math.cos(particle.roll.angle) : 1, tilt ? Math.cos(particle.tilt.value) * particle.tilt.cosDirection : 0, tilt ? Math.sin(particle.tilt.value) * particle.tilt.sinDirection : 0, rollVertical ? Math.sin(particle.roll.angle) : 1, pos.x, pos.y);
|
|
4679
|
+
} else {
|
|
4680
|
+
context.translate(pos.x, pos.y);
|
|
4681
|
+
}
|
|
4682
|
+
context.beginPath();
|
|
4683
|
+
const angle = ((_b = (_a = particle.rotate) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0) + (particle.options.rotate.path ? particle.velocity.angle : 0);
|
|
4684
|
+
if (angle !== 0) {
|
|
4685
|
+
context.rotate(angle);
|
|
4686
|
+
}
|
|
4687
|
+
if (backgroundMask) {
|
|
4688
|
+
context.globalCompositeOperation = composite;
|
|
4689
|
+
}
|
|
4690
|
+
const shadowColor = particle.shadowColor;
|
|
4691
|
+
if (shadow.enable && shadowColor) {
|
|
4692
|
+
context.shadowBlur = shadow.blur;
|
|
4693
|
+
context.shadowColor = getStyleFromRgb(shadowColor);
|
|
4694
|
+
context.shadowOffsetX = shadow.offset.x;
|
|
4695
|
+
context.shadowOffsetY = shadow.offset.y;
|
|
4696
|
+
}
|
|
4697
|
+
if (gradient) {
|
|
4698
|
+
const gradientAngle = gradient.angle.value;
|
|
4699
|
+
const fillGradient = gradient.type === "radial" ? context.createRadialGradient(0, 0, 0, 0, 0, radius) : context.createLinearGradient(Math.cos(gradientAngle) * -radius, Math.sin(gradientAngle) * -radius, Math.cos(gradientAngle) * radius, Math.sin(gradientAngle) * radius);
|
|
4700
|
+
for (const color of gradient.colors) {
|
|
4701
|
+
fillGradient.addColorStop(color.stop, getStyleFromHsl({
|
|
4702
|
+
h: color.value.h.value,
|
|
4703
|
+
s: color.value.s.value,
|
|
4704
|
+
l: color.value.l.value
|
|
4705
|
+
}, (_d = (_c = color.opacity) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : opacity));
|
|
4706
|
+
}
|
|
4707
|
+
context.fillStyle = fillGradient;
|
|
4708
|
+
} else {
|
|
4709
|
+
if (fillColorValue) {
|
|
4710
|
+
context.fillStyle = fillColorValue;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
const stroke = particle.stroke;
|
|
4714
|
+
context.lineWidth = (_e = particle.strokeWidth) !== null && _e !== void 0 ? _e : 0;
|
|
4715
|
+
if (strokeColorValue) {
|
|
4716
|
+
context.strokeStyle = strokeColorValue;
|
|
4717
|
+
}
|
|
4718
|
+
drawShape(container, context, particle, radius, opacity, delta);
|
|
4719
|
+
if (((_f = stroke === null || stroke === void 0 ? void 0 : stroke.width) !== null && _f !== void 0 ? _f : 0) > 0) {
|
|
4720
|
+
context.stroke();
|
|
4721
|
+
}
|
|
4722
|
+
if (particle.close) {
|
|
4723
|
+
context.closePath();
|
|
4724
|
+
}
|
|
4725
|
+
if (particle.fill) {
|
|
4726
|
+
context.fill();
|
|
4727
|
+
}
|
|
4728
|
+
context.restore();
|
|
4729
|
+
context.save();
|
|
4730
|
+
if (tiltOptions.enable && particle.tilt) {
|
|
4731
|
+
context.setTransform(1, Math.cos(particle.tilt.value) * particle.tilt.cosDirection, Math.sin(particle.tilt.value) * particle.tilt.sinDirection, 1, pos.x, pos.y);
|
|
4732
|
+
} else {
|
|
4733
|
+
context.translate(pos.x, pos.y);
|
|
4734
|
+
}
|
|
4735
|
+
if (angle !== 0) {
|
|
4736
|
+
context.rotate(angle);
|
|
4737
|
+
}
|
|
4738
|
+
if (backgroundMask) {
|
|
4739
|
+
context.globalCompositeOperation = composite;
|
|
4740
|
+
}
|
|
4741
|
+
drawShapeAfterEffect(container, context, particle, radius, opacity, delta);
|
|
4742
|
+
context.restore();
|
|
4743
|
+
}
|
|
4744
|
+
function drawShape(container, context, particle, radius, opacity, delta) {
|
|
4745
|
+
if (!particle.shape) {
|
|
4746
|
+
return;
|
|
4747
|
+
}
|
|
4748
|
+
const drawer = container.drawers.get(particle.shape);
|
|
4749
|
+
if (!drawer) {
|
|
4750
|
+
return;
|
|
4751
|
+
}
|
|
4752
|
+
drawer.draw(context, particle, radius, opacity, delta, container.retina.pixelRatio);
|
|
4753
|
+
}
|
|
4754
|
+
function drawShapeAfterEffect(container, context, particle, radius, opacity, delta) {
|
|
4755
|
+
if (!particle.shape) {
|
|
4756
|
+
return;
|
|
4757
|
+
}
|
|
4758
|
+
const drawer = container.drawers.get(particle.shape);
|
|
4759
|
+
if (!(drawer === null || drawer === void 0 ? void 0 : drawer.afterEffect)) {
|
|
4760
|
+
return;
|
|
4761
|
+
}
|
|
4762
|
+
drawer.afterEffect(context, particle, radius, opacity, delta, container.retina.pixelRatio);
|
|
4763
|
+
}
|
|
4764
|
+
function CanvasUtils_drawPlugin(context, plugin, delta) {
|
|
4765
|
+
if (!plugin.draw) {
|
|
4766
|
+
return;
|
|
4767
|
+
}
|
|
4768
|
+
context.save();
|
|
4769
|
+
plugin.draw(context, delta);
|
|
4770
|
+
context.restore();
|
|
4771
|
+
}
|
|
4772
|
+
function CanvasUtils_drawParticlePlugin(context, plugin, particle, delta) {
|
|
4773
|
+
if (plugin.drawParticle !== undefined) {
|
|
4774
|
+
context.save();
|
|
4775
|
+
plugin.drawParticle(context, particle, delta);
|
|
4776
|
+
context.restore();
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4780
|
+
const pos = particle.getPosition();
|
|
4781
|
+
if (fillColorValue) {
|
|
4782
|
+
context.strokeStyle = getStyleFromHsl(fillColorValue, opacity);
|
|
4783
|
+
}
|
|
4784
|
+
if (width === 0) {
|
|
4785
|
+
return;
|
|
4786
|
+
}
|
|
4787
|
+
context.lineWidth = width;
|
|
4788
|
+
const rotationRadian = rotation * Math.PI / 180;
|
|
4789
|
+
context.beginPath();
|
|
4790
|
+
context.ellipse(pos.x, pos.y, radius / 2, radius * 2, rotationRadian, start, end);
|
|
4791
|
+
context.stroke();
|
|
4792
|
+
}
|
|
4793
|
+
function CanvasUtils_alterHsl(color, type, value) {
|
|
4794
|
+
return {
|
|
4795
|
+
h: color.h,
|
|
4796
|
+
s: color.s,
|
|
4797
|
+
l: color.l + (type === "darken" ? -1 : 1) * value
|
|
4798
|
+
};
|
|
4799
|
+
}
|
|
4800
|
+
function checkDestroy(particle, value, minValue, maxValue) {
|
|
4801
|
+
switch (particle.options.opacity.animation.destroy) {
|
|
4802
|
+
case "max":
|
|
4803
|
+
if (value >= maxValue) {
|
|
4804
|
+
particle.destroy();
|
|
4805
|
+
}
|
|
4806
|
+
break;
|
|
4807
|
+
|
|
4808
|
+
case "min":
|
|
4809
|
+
if (value <= minValue) {
|
|
4810
|
+
particle.destroy();
|
|
4811
|
+
}
|
|
4812
|
+
break;
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
function updateOpacity(particle, delta) {
|
|
4816
|
+
var _a, _b, _c, _d, _e;
|
|
4817
|
+
if (!particle.opacity) {
|
|
4818
|
+
return;
|
|
4819
|
+
}
|
|
4820
|
+
const minValue = particle.opacity.min;
|
|
4821
|
+
const maxValue = particle.opacity.max;
|
|
4822
|
+
if (!(!particle.destroyed && particle.opacity.enable && (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) < ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0)))) {
|
|
4823
|
+
return;
|
|
4824
|
+
}
|
|
4825
|
+
switch (particle.opacity.status) {
|
|
4826
|
+
case 0:
|
|
4827
|
+
if (particle.opacity.value >= maxValue) {
|
|
4828
|
+
particle.opacity.status = 1;
|
|
4829
|
+
if (!particle.opacity.loops) {
|
|
4830
|
+
particle.opacity.loops = 0;
|
|
4831
|
+
}
|
|
4832
|
+
particle.opacity.loops++;
|
|
4833
|
+
} else {
|
|
4834
|
+
particle.opacity.value += ((_d = particle.opacity.velocity) !== null && _d !== void 0 ? _d : 0) * delta.factor;
|
|
4835
|
+
}
|
|
4836
|
+
break;
|
|
4837
|
+
|
|
4838
|
+
case 1:
|
|
4839
|
+
if (particle.opacity.value <= minValue) {
|
|
4840
|
+
particle.opacity.status = 0;
|
|
4841
|
+
if (!particle.opacity.loops) {
|
|
4842
|
+
particle.opacity.loops = 0;
|
|
4843
|
+
}
|
|
4844
|
+
particle.opacity.loops++;
|
|
4845
|
+
} else {
|
|
4846
|
+
particle.opacity.value -= ((_e = particle.opacity.velocity) !== null && _e !== void 0 ? _e : 0) * delta.factor;
|
|
4847
|
+
}
|
|
4848
|
+
break;
|
|
4849
|
+
}
|
|
4850
|
+
checkDestroy(particle, particle.opacity.value, minValue, maxValue);
|
|
4851
|
+
if (!particle.destroyed) {
|
|
4852
|
+
particle.opacity.value = NumberUtils_clamp(particle.opacity.value, minValue, maxValue);
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
class OpacityUpdater {
|
|
4856
|
+
constructor(container) {
|
|
4857
|
+
this.container = container;
|
|
4858
|
+
}
|
|
4859
|
+
init(particle) {
|
|
4860
|
+
const opacityOptions = particle.options.opacity;
|
|
4861
|
+
particle.opacity = {
|
|
4862
|
+
enable: opacityOptions.animation.enable,
|
|
4863
|
+
max: NumberUtils_getRangeMax(opacityOptions.value),
|
|
4864
|
+
min: NumberUtils_getRangeMin(opacityOptions.value),
|
|
4865
|
+
value: NumberUtils_getRangeValue(opacityOptions.value),
|
|
4866
|
+
loops: 0,
|
|
4867
|
+
maxLoops: opacityOptions.animation.count
|
|
4868
|
+
};
|
|
4869
|
+
const opacityAnimation = opacityOptions.animation;
|
|
4870
|
+
if (opacityAnimation.enable) {
|
|
4871
|
+
particle.opacity.status = 0;
|
|
4872
|
+
const opacityRange = opacityOptions.value;
|
|
4873
|
+
particle.opacity.min = NumberUtils_getRangeMin(opacityRange);
|
|
4874
|
+
particle.opacity.max = NumberUtils_getRangeMax(opacityRange);
|
|
4875
|
+
switch (opacityAnimation.startValue) {
|
|
4876
|
+
case "min":
|
|
4877
|
+
particle.opacity.value = particle.opacity.min;
|
|
4878
|
+
particle.opacity.status = 0;
|
|
4879
|
+
break;
|
|
4880
|
+
|
|
4881
|
+
case "random":
|
|
4882
|
+
particle.opacity.value = NumberUtils_randomInRange(particle.opacity);
|
|
4883
|
+
particle.opacity.status = Math.random() >= .5 ? 0 : 1;
|
|
4884
|
+
break;
|
|
4885
|
+
|
|
4886
|
+
case "max":
|
|
4887
|
+
default:
|
|
4888
|
+
particle.opacity.value = particle.opacity.max;
|
|
4889
|
+
particle.opacity.status = 1;
|
|
4890
|
+
break;
|
|
4891
|
+
}
|
|
4892
|
+
particle.opacity.velocity = opacityAnimation.speed / 100 * this.container.retina.reduceFactor;
|
|
4893
|
+
if (!opacityAnimation.sync) {
|
|
4894
|
+
particle.opacity.velocity *= Math.random();
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
}
|
|
4898
|
+
isEnabled(particle) {
|
|
4899
|
+
var _a, _b, _c;
|
|
4900
|
+
return !particle.destroyed && !particle.spawning && !!particle.opacity && particle.opacity.enable && (((_a = particle.opacity.maxLoops) !== null && _a !== void 0 ? _a : 0) <= 0 || ((_b = particle.opacity.loops) !== null && _b !== void 0 ? _b : 0) < ((_c = particle.opacity.maxLoops) !== null && _c !== void 0 ? _c : 0));
|
|
4901
|
+
}
|
|
4902
|
+
update(particle, delta) {
|
|
4903
|
+
if (!this.isEnabled(particle)) {
|
|
4904
|
+
return;
|
|
4905
|
+
}
|
|
4906
|
+
updateOpacity(particle, delta);
|
|
4907
|
+
}
|
|
4908
|
+
}
|
|
4909
|
+
async function loadOpacityUpdater(tsParticles) {
|
|
4910
|
+
await tsParticles.addParticleUpdater("opacity", (container => new OpacityUpdater(container)));
|
|
4911
|
+
}
|
|
4912
|
+
return __webpack_exports__;
|
|
4913
|
+
}();
|
|
4914
|
+
}));
|