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