tsparticles 1.37.4 → 1.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1015) hide show
  1. package/Core/Canvas.d.ts +2 -2
  2. package/Core/Canvas.js +44 -34
  3. package/Core/Container.d.ts +2 -3
  4. package/Core/Container.js +7 -8
  5. package/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  6. package/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
  7. package/Core/Interfaces/IParticle.d.ts +1 -1
  8. package/Core/Interfaces/index.d.ts +3 -1
  9. package/Core/Interfaces/index.js +3 -1
  10. package/Core/Loader.js +5 -9
  11. package/Core/Particle.d.ts +2 -5
  12. package/Core/Particle.js +16 -18
  13. package/Core/Particles.d.ts +1 -1
  14. package/Core/Particles.js +13 -19
  15. package/{Utils → Core/Utils}/Circle.d.ts +1 -1
  16. package/{Utils → Core/Utils}/Circle.js +2 -2
  17. package/{esm → Core}/Utils/CircleWarp.d.ts +1 -2
  18. package/{Utils → Core/Utils}/CircleWarp.js +0 -0
  19. package/{Utils → Core/Utils}/Constants.d.ts +1 -1
  20. package/{Utils → Core/Utils}/Constants.js +1 -1
  21. package/{Utils → Core/Utils}/EventListeners.d.ts +1 -1
  22. package/{Utils → Core/Utils}/EventListeners.js +11 -12
  23. package/Core/{ExternalInteractorBase.d.ts → Utils/ExternalInteractorBase.d.ts} +4 -4
  24. package/Core/{ExternalInteractorBase.js → Utils/ExternalInteractorBase.js} +1 -2
  25. package/{esm/Core → Core/Utils}/FrameManager.d.ts +1 -1
  26. package/Core/{FrameManager.js → Utils/FrameManager.js} +0 -0
  27. package/{esm/Core → Core/Utils}/InteractionManager.d.ts +3 -3
  28. package/Core/{InteractionManager.js → Utils/InteractionManager.js} +2 -3
  29. package/{esm/Core → Core/Utils}/ParticlesInteractorBase.d.ts +4 -4
  30. package/Core/{ParticlesInteractorBase.js → Utils/ParticlesInteractorBase.js} +1 -2
  31. package/{esm/Core/Particle/Mover.d.ts → Core/Utils/ParticlesMover.d.ts} +1 -1
  32. package/Core/{Particle/Mover.js → Utils/ParticlesMover.js} +6 -7
  33. package/{esm → Core}/Utils/Plugins.d.ts +5 -5
  34. package/{Utils → Core/Utils}/Plugins.js +0 -0
  35. package/{Utils → Core/Utils}/Point.d.ts +2 -2
  36. package/{Utils → Core/Utils}/Point.js +0 -0
  37. package/{Utils → Core/Utils}/QuadTree.d.ts +3 -3
  38. package/{Utils → Core/Utils}/QuadTree.js +2 -2
  39. package/{esm → Core}/Utils/Range.d.ts +1 -1
  40. package/{Utils → Core/Utils}/Range.js +0 -0
  41. package/{esm → Core}/Utils/Rectangle.d.ts +1 -2
  42. package/{Utils → Core/Utils}/Rectangle.js +0 -0
  43. package/Core/{Particle → Utils}/Vector.d.ts +0 -0
  44. package/Core/{Particle → Utils}/Vector.js +0 -0
  45. package/Core/{Particle → Utils}/Vector3d.d.ts +0 -0
  46. package/Core/{Particle → Utils}/Vector3d.js +0 -0
  47. package/Core/Utils/index.d.ts +16 -0
  48. package/Core/Utils/index.js +28 -0
  49. package/Core/index.d.ts +8 -0
  50. package/Core/index.js +20 -0
  51. package/Enums/AnimationStatus.d.ts +1 -1
  52. package/Enums/AnimationStatus.js +0 -6
  53. package/Enums/Directions/MoveDirection.d.ts +1 -1
  54. package/Enums/Directions/MoveDirection.js +0 -13
  55. package/Enums/Directions/OutModeDirection.d.ts +1 -1
  56. package/Enums/Directions/OutModeDirection.js +0 -8
  57. package/Enums/Directions/RotateDirection.d.ts +1 -1
  58. package/Enums/Directions/RotateDirection.js +0 -7
  59. package/Enums/Directions/TiltDirection.d.ts +1 -1
  60. package/Enums/Directions/TiltDirection.js +0 -7
  61. package/Enums/InteractivityDetect.d.ts +1 -1
  62. package/Enums/InteractivityDetect.js +0 -7
  63. package/Enums/Modes/ClickMode.d.ts +1 -1
  64. package/Enums/Modes/ClickMode.js +0 -11
  65. package/Enums/Modes/CollisionMode.d.ts +1 -1
  66. package/Enums/Modes/CollisionMode.js +0 -7
  67. package/Enums/Modes/DestroyMode.d.ts +1 -1
  68. package/Enums/Modes/DestroyMode.js +0 -6
  69. package/Enums/Modes/DivMode.d.ts +1 -1
  70. package/Enums/Modes/DivMode.js +0 -7
  71. package/Enums/Modes/HoverMode.d.ts +1 -1
  72. package/Enums/Modes/HoverMode.js +0 -13
  73. package/Enums/Modes/OutMode.d.ts +1 -1
  74. package/Enums/Modes/OutMode.js +0 -11
  75. package/Enums/Modes/ResponsiveMode.d.ts +1 -1
  76. package/Enums/Modes/ResponsiveMode.js +0 -6
  77. package/Enums/Modes/RollMode.d.ts +1 -1
  78. package/Enums/Modes/RollMode.js +0 -7
  79. package/Enums/Modes/SizeMode.d.ts +1 -1
  80. package/Enums/Modes/SizeMode.js +0 -6
  81. package/Enums/Modes/ThemeMode.d.ts +1 -1
  82. package/Enums/Modes/ThemeMode.js +0 -7
  83. package/Enums/Types/AlterType.d.ts +1 -1
  84. package/Enums/Types/AlterType.js +0 -6
  85. package/Enums/Types/DestroyType.d.ts +1 -1
  86. package/Enums/Types/DestroyType.js +0 -7
  87. package/Enums/Types/DivType.d.ts +1 -1
  88. package/Enums/Types/DivType.js +0 -6
  89. package/Enums/Types/EasingType.d.ts +1 -1
  90. package/Enums/Types/EasingType.js +0 -12
  91. package/Enums/Types/GradientType.d.ts +1 -1
  92. package/Enums/Types/GradientType.js +0 -7
  93. package/Enums/Types/InteractorType.d.ts +1 -1
  94. package/Enums/Types/InteractorType.js +0 -6
  95. package/Enums/Types/OrbitType.d.ts +1 -1
  96. package/Enums/Types/OrbitType.js +0 -6
  97. package/Enums/Types/ShapeType.d.ts +1 -1
  98. package/Enums/Types/ShapeType.js +0 -15
  99. package/Enums/Types/StartValueType.d.ts +1 -1
  100. package/Enums/Types/StartValueType.js +0 -7
  101. package/Interactions/External/Attract/Attractor.d.ts +2 -2
  102. package/Interactions/External/Attract/Attractor.js +9 -11
  103. package/Interactions/External/Attract/index.d.ts +2 -2
  104. package/Interactions/External/Bounce/Bouncer.d.ts +2 -2
  105. package/Interactions/External/Bounce/Bouncer.js +15 -17
  106. package/Interactions/External/Bounce/index.d.ts +2 -2
  107. package/Interactions/External/Bubble/Bubbler.d.ts +3 -3
  108. package/Interactions/External/Bubble/Bubbler.js +20 -22
  109. package/Interactions/External/Bubble/ProcessBubbleType.d.ts +1 -1
  110. package/Interactions/External/Bubble/ProcessBubbleType.js +0 -7
  111. package/Interactions/External/Bubble/index.d.ts +2 -2
  112. package/Interactions/External/Connect/Connector.d.ts +2 -2
  113. package/Interactions/External/Connect/Connector.js +3 -4
  114. package/Interactions/External/Connect/index.d.ts +2 -2
  115. package/Interactions/External/Grab/Grabber.d.ts +2 -2
  116. package/Interactions/External/Grab/Grabber.js +4 -5
  117. package/Interactions/External/Grab/index.d.ts +2 -2
  118. package/Interactions/External/Repulse/Repulser.d.ts +2 -2
  119. package/Interactions/External/Repulse/Repulser.js +15 -17
  120. package/Interactions/External/Repulse/index.d.ts +2 -2
  121. package/Interactions/External/Trail/TrailMaker.d.ts +2 -3
  122. package/Interactions/External/Trail/TrailMaker.js +4 -5
  123. package/Interactions/External/Trail/index.d.ts +2 -2
  124. package/Interactions/Particles/Attract/Attractor.d.ts +2 -4
  125. package/Interactions/Particles/Attract/Attractor.js +2 -2
  126. package/Interactions/Particles/Attract/index.d.ts +2 -2
  127. package/Interactions/Particles/Collisions/Collider.d.ts +2 -3
  128. package/Interactions/Particles/Collisions/Collider.js +5 -6
  129. package/Interactions/Particles/Collisions/index.d.ts +2 -2
  130. package/Interactions/Particles/Links/LinkInstance.d.ts +1 -3
  131. package/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
  132. package/Interactions/Particles/Links/Linker.d.ts +3 -4
  133. package/Interactions/Particles/Links/Linker.js +4 -4
  134. package/Interactions/Particles/Links/index.d.ts +2 -3
  135. package/Interactions/Particles/Links/index.js +3 -7
  136. package/Interactions/Particles/Links/interaction.d.ts +2 -0
  137. package/Interactions/Particles/Links/interaction.js +8 -0
  138. package/Interactions/Particles/Links/plugin.d.ts +2 -2
  139. package/Interactions/Particles/Links/plugin.js +2 -2
  140. package/Options/Classes/AnimatableGradient.js +3 -4
  141. package/Options/Classes/Interactivity/Events/DivEvent.js +1 -2
  142. package/Options/Classes/Interactivity/Interactivity.js +5 -6
  143. package/Options/Classes/Interactivity/Modes/Attract.js +1 -2
  144. package/Options/Classes/Interactivity/Modes/RepulseBase.js +1 -2
  145. package/Options/Classes/Options.d.ts +1 -0
  146. package/Options/Classes/Options.js +10 -8
  147. package/Options/Classes/Particles/Collisions/Collisions.js +1 -2
  148. package/Options/Classes/Particles/Destroy/Destroy.js +1 -2
  149. package/Options/Classes/Particles/Move/Move.js +1 -2
  150. package/Options/Classes/Particles/Move/OutModes.js +1 -2
  151. package/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -3
  152. package/Options/Classes/Particles/Roll/Roll.js +1 -2
  153. package/Options/Classes/Particles/Rotate/Rotate.js +1 -2
  154. package/Options/Classes/Particles/Shape/Shape.js +13 -14
  155. package/Options/Classes/Particles/Size/SizeAnimation.js +2 -3
  156. package/Options/Classes/Particles/Tilt/Tilt.js +1 -2
  157. package/Options/Classes/Responsive.js +4 -5
  158. package/Options/Classes/Theme/ThemeDefault.js +1 -2
  159. package/Options/Interfaces/IOptions.d.ts +1 -0
  160. package/Plugins/Absorbers/AbsorberContainer.d.ts +1 -1
  161. package/Plugins/Absorbers/AbsorberInstance.d.ts +2 -4
  162. package/Plugins/Absorbers/AbsorberInstance.js +9 -10
  163. package/Plugins/Absorbers/Absorbers.d.ts +1 -4
  164. package/Plugins/Absorbers/Absorbers.js +1 -2
  165. package/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +1 -1
  166. package/Plugins/Absorbers/Enums/AbsorberClickMode.js +0 -5
  167. package/Plugins/Absorbers/index.d.ts +2 -0
  168. package/Plugins/Absorbers/{plugin.js → index.js} +3 -4
  169. package/Plugins/Emitters/EmitterContainer.d.ts +1 -1
  170. package/Plugins/Emitters/EmitterInstance.d.ts +1 -2
  171. package/Plugins/Emitters/EmitterInstance.js +3 -4
  172. package/Plugins/Emitters/Emitters.d.ts +1 -2
  173. package/Plugins/Emitters/Emitters.js +1 -2
  174. package/Plugins/Emitters/EmittersMain.d.ts +2 -2
  175. package/Plugins/Emitters/Enums/EmitterClickMode.d.ts +1 -1
  176. package/Plugins/Emitters/Enums/EmitterClickMode.js +0 -5
  177. package/Plugins/Emitters/Enums/EmitterShapeType.d.ts +1 -1
  178. package/Plugins/Emitters/Enums/EmitterShapeType.js +0 -6
  179. package/Plugins/Emitters/IEmitterShape.d.ts +1 -1
  180. package/Plugins/Emitters/Options/Classes/Emitter.js +1 -2
  181. package/Plugins/Emitters/Options/Classes/EmitterSize.js +1 -2
  182. package/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +1 -1
  183. package/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +1 -1
  184. package/Plugins/Emitters/{plugin.d.ts → index.d.ts} +0 -0
  185. package/Plugins/Emitters/{plugin.js → index.js} +3 -4
  186. package/Plugins/PolygonMask/Enums/PolygonMaskInlineArrangement.d.ts +8 -0
  187. package/Plugins/PolygonMask/{Options/Interfaces/IDraw.js → Enums/PolygonMaskInlineArrangement.js} +0 -0
  188. package/Plugins/PolygonMask/Enums/PolygonMaskMoveType.d.ts +4 -0
  189. package/Plugins/PolygonMask/{Options/Interfaces/IDrawStroke.js → Enums/PolygonMaskMoveType.js} +0 -0
  190. package/{esm/Plugins/PolygonMask/Enums/Type.d.ts → Plugins/PolygonMask/Enums/PolygonMaskType.d.ts} +1 -1
  191. package/Plugins/PolygonMask/{Options/Interfaces/IInline.js → Enums/PolygonMaskType.js} +0 -0
  192. package/Plugins/PolygonMask/Enums/index.d.ts +3 -3
  193. package/Plugins/PolygonMask/Enums/index.js +3 -3
  194. package/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +13 -13
  195. package/Plugins/PolygonMask/Options/Classes/PolygonMask.js +42 -42
  196. package/Plugins/PolygonMask/Options/Classes/{Draw.d.ts → PolygonMaskDraw.d.ts} +5 -5
  197. package/Plugins/PolygonMask/Options/Classes/{Draw.js → PolygonMaskDraw.js} +15 -14
  198. package/Plugins/PolygonMask/Options/Classes/{DrawStroke.d.ts → PolygonMaskDrawStroke.d.ts} +3 -3
  199. package/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.js +29 -0
  200. package/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +9 -0
  201. package/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.js +17 -0
  202. package/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +11 -0
  203. package/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.js +29 -0
  204. package/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +10 -0
  205. package/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.js +21 -0
  206. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +12 -13
  207. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +8 -0
  208. package/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.js → IPolygonMaskDraw.js} +0 -0
  209. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDrawStroke.d.ts +6 -0
  210. package/Plugins/PolygonMask/Options/Interfaces/{IMove.js → IPolygonMaskDrawStroke.js} +0 -0
  211. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.d.ts +4 -0
  212. package/Plugins/PolygonMask/{types.js → Options/Interfaces/IPolygonMaskInline.js} +0 -0
  213. package/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.d.ts → IPolygonMaskLocalSvg.d.ts} +2 -2
  214. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.js +2 -0
  215. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.d.ts +5 -0
  216. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.js +2 -0
  217. package/Plugins/PolygonMask/PolygonMaskInstance.d.ts +2 -4
  218. package/Plugins/PolygonMask/PolygonMaskInstance.js +33 -30
  219. package/Plugins/PolygonMask/{types.d.ts → Types.d.ts} +0 -0
  220. package/Plugins/PolygonMask/Types.js +2 -0
  221. package/{esm/Plugins/PolygonMask/utils.d.ts → Plugins/PolygonMask/Utils.d.ts} +5 -5
  222. package/Plugins/PolygonMask/{utils.js → Utils.js} +15 -12
  223. package/Plugins/PolygonMask/index.d.ts +2 -0
  224. package/Plugins/PolygonMask/{plugin.js → index.js} +4 -5
  225. package/Plugins/PolygonMask/pathseg.js +54 -43
  226. package/README.md +68 -0
  227. package/Shapes/Circle/CircleDrawer.d.ts +1 -1
  228. package/Shapes/Circle/index.d.ts +2 -2
  229. package/Shapes/Image/ImageDrawer.d.ts +3 -7
  230. package/Shapes/Image/ImageDrawer.js +29 -109
  231. package/Shapes/Image/Utils.d.ts +8 -5
  232. package/Shapes/Image/Utils.js +69 -38
  233. package/Shapes/Image/index.d.ts +2 -2
  234. package/Shapes/Line/LineDrawer.d.ts +1 -1
  235. package/Shapes/Line/index.d.ts +2 -2
  236. package/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
  237. package/Shapes/Polygon/PolygonDrawerBase.d.ts +1 -1
  238. package/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
  239. package/Shapes/Polygon/index.d.ts +4 -4
  240. package/Shapes/Square/SquareDrawer.d.ts +1 -1
  241. package/Shapes/Square/index.d.ts +2 -2
  242. package/Shapes/Star/StarDrawer.d.ts +1 -1
  243. package/Shapes/Star/index.d.ts +2 -2
  244. package/Shapes/Text/TextDrawer.d.ts +1 -2
  245. package/Shapes/Text/index.d.ts +2 -2
  246. package/Updaters/Angle/AngleUpdater.d.ts +1 -3
  247. package/Updaters/Angle/AngleUpdater.js +8 -9
  248. package/Updaters/Angle/index.d.ts +2 -2
  249. package/Updaters/Color/ColorUpdater.d.ts +1 -3
  250. package/Updaters/Color/ColorUpdater.js +3 -4
  251. package/Updaters/Color/index.d.ts +2 -2
  252. package/Updaters/Life/LifeUpdater.d.ts +1 -3
  253. package/Updaters/Life/index.d.ts +2 -2
  254. package/Updaters/Opacity/OpacityUpdater.d.ts +1 -3
  255. package/Updaters/Opacity/OpacityUpdater.js +13 -14
  256. package/Updaters/Opacity/index.d.ts +2 -2
  257. package/Updaters/OutModes/IBounceData.d.ts +1 -2
  258. package/Updaters/OutModes/OutOfCanvasUpdater.d.ts +1 -3
  259. package/Updaters/OutModes/OutOfCanvasUpdater.js +19 -20
  260. package/Updaters/OutModes/Utils.js +12 -13
  261. package/Updaters/OutModes/index.d.ts +2 -2
  262. package/Updaters/Roll/RollUpdater.d.ts +1 -2
  263. package/Updaters/Roll/RollUpdater.js +4 -5
  264. package/Updaters/Roll/index.d.ts +2 -2
  265. package/Updaters/Size/SizeUpdater.d.ts +1 -2
  266. package/Updaters/Size/SizeUpdater.js +6 -7
  267. package/Updaters/Size/index.d.ts +2 -2
  268. package/Updaters/StrokeColor/StrokeColorUpdater.d.ts +1 -3
  269. package/Updaters/StrokeColor/StrokeColorUpdater.js +3 -4
  270. package/Updaters/StrokeColor/index.d.ts +2 -2
  271. package/Updaters/Tilt/TiltUpdater.d.ts +1 -3
  272. package/Updaters/Tilt/TiltUpdater.js +8 -9
  273. package/Updaters/Tilt/index.d.ts +2 -2
  274. package/Updaters/Wobble/WobbleUpdater.d.ts +1 -3
  275. package/Updaters/Wobble/index.d.ts +2 -2
  276. package/Utils/CanvasUtils.d.ts +3 -3
  277. package/Utils/CanvasUtils.js +4 -5
  278. package/Utils/ColorUtils.d.ts +1 -1
  279. package/Utils/ColorUtils.js +7 -8
  280. package/Utils/NumberUtils.d.ts +2 -2
  281. package/Utils/NumberUtils.js +20 -21
  282. package/Utils/Utils.d.ts +1 -1
  283. package/Utils/Utils.js +10 -14
  284. package/Utils/index.d.ts +0 -9
  285. package/Utils/index.js +0 -9
  286. package/browser/Core/Canvas.d.ts +2 -2
  287. package/browser/Core/Canvas.js +25 -15
  288. package/browser/Core/Container.d.ts +2 -3
  289. package/browser/Core/Container.js +2 -3
  290. package/browser/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  291. package/browser/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
  292. package/browser/Core/Interfaces/IParticle.d.ts +1 -1
  293. package/browser/Core/Interfaces/index.d.ts +3 -1
  294. package/browser/Core/Interfaces/index.js +3 -1
  295. package/browser/Core/Loader.js +6 -10
  296. package/browser/Core/Particle.d.ts +2 -5
  297. package/browser/Core/Particle.js +13 -15
  298. package/browser/Core/Particles.d.ts +1 -1
  299. package/browser/Core/Particles.js +8 -14
  300. package/browser/{Utils → Core/Utils}/Circle.d.ts +1 -1
  301. package/browser/{Utils → Core/Utils}/Circle.js +1 -1
  302. package/browser/{Utils → Core/Utils}/CircleWarp.d.ts +1 -2
  303. package/browser/{Utils → Core/Utils}/CircleWarp.js +0 -0
  304. package/browser/{Utils → Core/Utils}/Constants.d.ts +1 -4
  305. package/browser/{Utils → Core/Utils}/Constants.js +1 -4
  306. package/browser/{Utils → Core/Utils}/EventListeners.d.ts +1 -1
  307. package/browser/{Utils → Core/Utils}/EventListeners.js +11 -12
  308. package/{esm/Core → browser/Core/Utils}/ExternalInteractorBase.d.ts +4 -4
  309. package/browser/Core/{ExternalInteractorBase.js → Utils/ExternalInteractorBase.js} +1 -2
  310. package/browser/Core/{FrameManager.d.ts → Utils/FrameManager.d.ts} +1 -1
  311. package/browser/Core/{FrameManager.js → Utils/FrameManager.js} +0 -0
  312. package/browser/Core/{InteractionManager.d.ts → Utils/InteractionManager.d.ts} +3 -3
  313. package/browser/Core/{InteractionManager.js → Utils/InteractionManager.js} +2 -3
  314. package/{Core → browser/Core/Utils}/ParticlesInteractorBase.d.ts +4 -4
  315. package/{esm/Core → browser/Core/Utils}/ParticlesInteractorBase.js +1 -2
  316. package/browser/Core/{Particle/Mover.d.ts → Utils/ParticlesMover.d.ts} +1 -1
  317. package/browser/Core/{Particle/Mover.js → Utils/ParticlesMover.js} +4 -5
  318. package/browser/{Utils → Core/Utils}/Plugins.d.ts +5 -5
  319. package/browser/{Utils → Core/Utils}/Plugins.js +0 -0
  320. package/browser/{Utils → Core/Utils}/Point.d.ts +2 -2
  321. package/browser/{Utils → Core/Utils}/Point.js +0 -0
  322. package/browser/{Utils → Core/Utils}/QuadTree.d.ts +3 -3
  323. package/browser/{Utils → Core/Utils}/QuadTree.js +1 -1
  324. package/browser/{Utils → Core/Utils}/Range.d.ts +1 -1
  325. package/browser/{Utils → Core/Utils}/Range.js +0 -0
  326. package/browser/{Utils → Core/Utils}/Rectangle.d.ts +1 -2
  327. package/browser/{Utils → Core/Utils}/Rectangle.js +0 -0
  328. package/browser/Core/{Particle → Utils}/Vector.d.ts +0 -0
  329. package/browser/Core/{Particle → Utils}/Vector.js +0 -0
  330. package/browser/Core/{Particle → Utils}/Vector3d.d.ts +0 -0
  331. package/browser/Core/{Particle → Utils}/Vector3d.js +0 -0
  332. package/browser/Core/Utils/index.d.ts +16 -0
  333. package/browser/Core/Utils/index.js +16 -0
  334. package/browser/Core/index.d.ts +8 -0
  335. package/browser/Core/index.js +8 -0
  336. package/browser/Enums/AnimationStatus.d.ts +1 -1
  337. package/browser/Enums/AnimationStatus.js +1 -5
  338. package/browser/Enums/Directions/MoveDirection.d.ts +1 -1
  339. package/browser/Enums/Directions/MoveDirection.js +1 -15
  340. package/browser/Enums/Directions/OutModeDirection.d.ts +1 -1
  341. package/browser/Enums/Directions/OutModeDirection.js +1 -7
  342. package/browser/Enums/Directions/RotateDirection.d.ts +1 -1
  343. package/browser/Enums/Directions/RotateDirection.js +1 -9
  344. package/browser/Enums/Directions/TiltDirection.d.ts +1 -1
  345. package/browser/Enums/Directions/TiltDirection.js +1 -9
  346. package/browser/Enums/InteractivityDetect.d.ts +1 -1
  347. package/browser/Enums/InteractivityDetect.js +1 -9
  348. package/browser/Enums/Modes/ClickMode.d.ts +1 -1
  349. package/browser/Enums/Modes/ClickMode.js +1 -13
  350. package/browser/Enums/Modes/CollisionMode.d.ts +1 -1
  351. package/browser/Enums/Modes/CollisionMode.js +1 -9
  352. package/browser/Enums/Modes/DestroyMode.d.ts +1 -1
  353. package/browser/Enums/Modes/DestroyMode.js +1 -5
  354. package/browser/Enums/Modes/DivMode.d.ts +1 -1
  355. package/browser/Enums/Modes/DivMode.js +1 -9
  356. package/browser/Enums/Modes/HoverMode.d.ts +1 -1
  357. package/browser/Enums/Modes/HoverMode.js +1 -15
  358. package/browser/Enums/Modes/OutMode.d.ts +1 -1
  359. package/browser/Enums/Modes/OutMode.js +1 -13
  360. package/browser/Enums/Modes/ResponsiveMode.d.ts +1 -1
  361. package/browser/Enums/Modes/ResponsiveMode.js +1 -5
  362. package/browser/Enums/Modes/RollMode.d.ts +1 -1
  363. package/browser/Enums/Modes/RollMode.js +1 -6
  364. package/browser/Enums/Modes/SizeMode.d.ts +1 -1
  365. package/browser/Enums/Modes/SizeMode.js +1 -8
  366. package/browser/Enums/Modes/ThemeMode.d.ts +1 -1
  367. package/browser/Enums/Modes/ThemeMode.js +1 -6
  368. package/browser/Enums/Types/AlterType.d.ts +1 -1
  369. package/browser/Enums/Types/AlterType.js +1 -5
  370. package/browser/Enums/Types/DestroyType.d.ts +1 -1
  371. package/browser/Enums/Types/DestroyType.js +1 -9
  372. package/browser/Enums/Types/DivType.d.ts +1 -1
  373. package/browser/Enums/Types/DivType.js +1 -8
  374. package/browser/Enums/Types/EasingType.d.ts +1 -1
  375. package/browser/Enums/Types/EasingType.js +1 -11
  376. package/browser/Enums/Types/GradientType.d.ts +1 -1
  377. package/browser/Enums/Types/GradientType.js +1 -6
  378. package/browser/Enums/Types/InteractorType.d.ts +1 -1
  379. package/browser/Enums/Types/InteractorType.js +1 -5
  380. package/browser/Enums/Types/OrbitType.d.ts +1 -1
  381. package/browser/Enums/Types/OrbitType.js +1 -8
  382. package/browser/Enums/Types/ShapeType.d.ts +1 -1
  383. package/browser/Enums/Types/ShapeType.js +1 -17
  384. package/browser/Enums/Types/StartValueType.d.ts +1 -1
  385. package/browser/Enums/Types/StartValueType.js +1 -9
  386. package/browser/Interactions/External/Attract/Attractor.d.ts +2 -2
  387. package/browser/Interactions/External/Attract/Attractor.js +5 -7
  388. package/browser/Interactions/External/Attract/index.d.ts +2 -2
  389. package/browser/Interactions/External/Bounce/Bouncer.d.ts +2 -2
  390. package/browser/Interactions/External/Bounce/Bouncer.js +7 -9
  391. package/browser/Interactions/External/Bounce/index.d.ts +2 -2
  392. package/browser/Interactions/External/Bubble/Bubbler.d.ts +3 -3
  393. package/browser/Interactions/External/Bubble/Bubbler.js +16 -18
  394. package/browser/Interactions/External/Bubble/ProcessBubbleType.d.ts +1 -1
  395. package/browser/Interactions/External/Bubble/ProcessBubbleType.js +1 -9
  396. package/browser/Interactions/External/Bubble/index.d.ts +2 -2
  397. package/browser/Interactions/External/Connect/Connector.d.ts +2 -2
  398. package/browser/Interactions/External/Connect/Connector.js +2 -3
  399. package/browser/Interactions/External/Connect/index.d.ts +2 -2
  400. package/browser/Interactions/External/Grab/Grabber.d.ts +2 -2
  401. package/browser/Interactions/External/Grab/Grabber.js +3 -4
  402. package/browser/Interactions/External/Grab/index.d.ts +2 -2
  403. package/browser/Interactions/External/Repulse/Repulser.d.ts +2 -2
  404. package/browser/Interactions/External/Repulse/Repulser.js +8 -10
  405. package/browser/Interactions/External/Repulse/index.d.ts +2 -2
  406. package/browser/Interactions/External/Trail/TrailMaker.d.ts +2 -3
  407. package/browser/Interactions/External/Trail/TrailMaker.js +3 -4
  408. package/browser/Interactions/External/Trail/index.d.ts +2 -2
  409. package/browser/Interactions/Particles/Attract/Attractor.d.ts +2 -4
  410. package/browser/Interactions/Particles/Attract/Attractor.js +1 -1
  411. package/browser/Interactions/Particles/Attract/index.d.ts +2 -2
  412. package/browser/Interactions/Particles/Collisions/Collider.d.ts +2 -3
  413. package/browser/Interactions/Particles/Collisions/Collider.js +4 -5
  414. package/browser/Interactions/Particles/Collisions/index.d.ts +2 -2
  415. package/browser/Interactions/Particles/Links/LinkInstance.d.ts +1 -3
  416. package/browser/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
  417. package/browser/Interactions/Particles/Links/Linker.d.ts +3 -4
  418. package/browser/Interactions/Particles/Links/Linker.js +2 -2
  419. package/browser/Interactions/Particles/Links/index.d.ts +2 -3
  420. package/browser/Interactions/Particles/Links/index.js +1 -4
  421. package/browser/Interactions/Particles/Links/interaction.d.ts +2 -0
  422. package/browser/Interactions/Particles/Links/interaction.js +4 -0
  423. package/browser/Interactions/Particles/Links/plugin.d.ts +2 -2
  424. package/browser/Interactions/Particles/Links/plugin.js +2 -2
  425. package/browser/Options/Classes/AnimatableGradient.js +3 -4
  426. package/browser/Options/Classes/Interactivity/Events/DivEvent.js +1 -2
  427. package/browser/Options/Classes/Interactivity/Interactivity.js +5 -6
  428. package/browser/Options/Classes/Interactivity/Modes/Attract.js +1 -2
  429. package/browser/Options/Classes/Interactivity/Modes/RepulseBase.js +1 -2
  430. package/browser/Options/Classes/Options.d.ts +1 -0
  431. package/browser/Options/Classes/Options.js +9 -7
  432. package/browser/Options/Classes/Particles/Collisions/Collisions.js +1 -2
  433. package/browser/Options/Classes/Particles/Destroy/Destroy.js +1 -2
  434. package/browser/Options/Classes/Particles/Move/Move.js +1 -2
  435. package/browser/Options/Classes/Particles/Move/OutModes.js +1 -2
  436. package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -3
  437. package/browser/Options/Classes/Particles/Roll/Roll.js +1 -2
  438. package/browser/Options/Classes/Particles/Rotate/Rotate.js +1 -2
  439. package/browser/Options/Classes/Particles/Shape/Shape.js +13 -14
  440. package/browser/Options/Classes/Particles/Size/SizeAnimation.js +2 -3
  441. package/browser/Options/Classes/Particles/Tilt/Tilt.js +1 -2
  442. package/browser/Options/Classes/Responsive.js +4 -5
  443. package/browser/Options/Classes/Theme/ThemeDefault.js +1 -2
  444. package/browser/Options/Interfaces/IOptions.d.ts +1 -0
  445. package/browser/Plugins/Absorbers/AbsorberContainer.d.ts +1 -1
  446. package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +2 -4
  447. package/browser/Plugins/Absorbers/AbsorberInstance.js +4 -5
  448. package/browser/Plugins/Absorbers/Absorbers.d.ts +1 -4
  449. package/browser/Plugins/Absorbers/Absorbers.js +1 -2
  450. package/browser/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +1 -1
  451. package/browser/Plugins/Absorbers/Enums/AbsorberClickMode.js +1 -7
  452. package/browser/Plugins/Absorbers/index.d.ts +2 -0
  453. package/browser/Plugins/Absorbers/{plugin.js → index.js} +3 -4
  454. package/browser/Plugins/Emitters/EmitterContainer.d.ts +1 -1
  455. package/browser/Plugins/Emitters/EmitterInstance.d.ts +1 -2
  456. package/browser/Plugins/Emitters/EmitterInstance.js +3 -4
  457. package/browser/Plugins/Emitters/Emitters.d.ts +1 -2
  458. package/browser/Plugins/Emitters/Emitters.js +1 -2
  459. package/browser/Plugins/Emitters/EmittersMain.d.ts +2 -2
  460. package/browser/Plugins/Emitters/Enums/EmitterClickMode.d.ts +1 -1
  461. package/browser/Plugins/Emitters/Enums/EmitterClickMode.js +1 -7
  462. package/browser/Plugins/Emitters/Enums/EmitterShapeType.d.ts +1 -1
  463. package/browser/Plugins/Emitters/Enums/EmitterShapeType.js +1 -5
  464. package/browser/Plugins/Emitters/IEmitterShape.d.ts +1 -1
  465. package/browser/Plugins/Emitters/Options/Classes/Emitter.js +1 -2
  466. package/browser/Plugins/Emitters/Options/Classes/EmitterSize.js +1 -2
  467. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +1 -1
  468. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +1 -1
  469. package/browser/Plugins/Emitters/{plugin.d.ts → index.d.ts} +0 -0
  470. package/browser/Plugins/Emitters/{plugin.js → index.js} +3 -4
  471. package/browser/Plugins/PolygonMask/Enums/PolygonMaskInlineArrangement.d.ts +8 -0
  472. package/browser/Plugins/PolygonMask/{Options/Interfaces/IDraw.js → Enums/PolygonMaskInlineArrangement.js} +0 -0
  473. package/browser/Plugins/PolygonMask/Enums/PolygonMaskMoveType.d.ts +4 -0
  474. package/browser/Plugins/PolygonMask/{Options/Interfaces/IDrawStroke.js → Enums/PolygonMaskMoveType.js} +0 -0
  475. package/{Plugins/PolygonMask/Enums/Type.d.ts → browser/Plugins/PolygonMask/Enums/PolygonMaskType.d.ts} +1 -1
  476. package/browser/Plugins/PolygonMask/{Options/Interfaces/IInline.js → Enums/PolygonMaskType.js} +0 -0
  477. package/browser/Plugins/PolygonMask/Enums/index.d.ts +3 -3
  478. package/browser/Plugins/PolygonMask/Enums/index.js +3 -3
  479. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +13 -13
  480. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.js +42 -42
  481. package/browser/Plugins/PolygonMask/Options/Classes/{Draw.d.ts → PolygonMaskDraw.d.ts} +5 -5
  482. package/browser/Plugins/PolygonMask/Options/Classes/{Draw.js → PolygonMaskDraw.js} +13 -12
  483. package/browser/Plugins/PolygonMask/Options/Classes/{DrawStroke.d.ts → PolygonMaskDrawStroke.d.ts} +3 -3
  484. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.js +28 -0
  485. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +12 -0
  486. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.js +16 -0
  487. package/browser/Plugins/PolygonMask/Options/Classes/{LocalSvg.d.ts → PolygonMaskLocalSvg.d.ts} +4 -4
  488. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.js +28 -0
  489. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +13 -0
  490. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.js +20 -0
  491. package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +12 -13
  492. package/browser/Plugins/PolygonMask/Options/Interfaces/{IDraw.d.ts → IPolygonMaskDraw.d.ts} +4 -4
  493. package/browser/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.js → IPolygonMaskDraw.js} +0 -0
  494. package/browser/Plugins/PolygonMask/Options/Interfaces/{IDrawStroke.d.ts → IPolygonMaskDrawStroke.d.ts} +2 -2
  495. package/browser/Plugins/PolygonMask/Options/Interfaces/{IMove.js → IPolygonMaskDrawStroke.js} +0 -0
  496. package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.d.ts +7 -0
  497. package/browser/Plugins/PolygonMask/{types.js → Options/Interfaces/IPolygonMaskInline.js} +0 -0
  498. package/browser/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.d.ts → IPolygonMaskLocalSvg.d.ts} +2 -2
  499. package/{esm/Plugins/PolygonMask/Options/Interfaces/IDraw.js → browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.js} +0 -0
  500. package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.d.ts +8 -0
  501. package/{esm/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.js → browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.js} +0 -0
  502. package/browser/Plugins/PolygonMask/PolygonMaskInstance.d.ts +2 -4
  503. package/browser/Plugins/PolygonMask/PolygonMaskInstance.js +24 -21
  504. package/browser/Plugins/PolygonMask/{types.d.ts → Types.d.ts} +0 -0
  505. package/{esm/Plugins/PolygonMask/Options/Interfaces/IInline.js → browser/Plugins/PolygonMask/Types.js} +0 -0
  506. package/{Plugins/PolygonMask/utils.d.ts → browser/Plugins/PolygonMask/Utils.d.ts} +5 -5
  507. package/browser/Plugins/PolygonMask/{utils.js → Utils.js} +15 -12
  508. package/browser/Plugins/PolygonMask/index.d.ts +2 -0
  509. package/browser/Plugins/PolygonMask/{plugin.js → index.js} +5 -6
  510. package/browser/Plugins/PolygonMask/pathseg.js +54 -44
  511. package/browser/Shapes/Circle/CircleDrawer.d.ts +1 -1
  512. package/browser/Shapes/Circle/index.d.ts +2 -2
  513. package/browser/Shapes/Image/ImageDrawer.d.ts +3 -7
  514. package/browser/Shapes/Image/ImageDrawer.js +28 -111
  515. package/browser/Shapes/Image/Utils.d.ts +8 -5
  516. package/browser/Shapes/Image/Utils.js +71 -37
  517. package/browser/Shapes/Image/index.d.ts +2 -2
  518. package/browser/Shapes/Line/LineDrawer.d.ts +1 -1
  519. package/browser/Shapes/Line/index.d.ts +2 -2
  520. package/browser/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
  521. package/browser/Shapes/Polygon/PolygonDrawerBase.d.ts +1 -1
  522. package/browser/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
  523. package/browser/Shapes/Polygon/index.d.ts +4 -4
  524. package/browser/Shapes/Square/SquareDrawer.d.ts +1 -1
  525. package/browser/Shapes/Square/index.d.ts +2 -2
  526. package/browser/Shapes/Star/StarDrawer.d.ts +1 -1
  527. package/browser/Shapes/Star/index.d.ts +2 -2
  528. package/browser/Shapes/Text/TextDrawer.d.ts +1 -2
  529. package/browser/Shapes/Text/index.d.ts +2 -2
  530. package/browser/Updaters/Angle/AngleUpdater.d.ts +1 -3
  531. package/browser/Updaters/Angle/AngleUpdater.js +8 -9
  532. package/browser/Updaters/Angle/index.d.ts +2 -2
  533. package/browser/Updaters/Color/ColorUpdater.d.ts +1 -3
  534. package/browser/Updaters/Color/ColorUpdater.js +3 -4
  535. package/browser/Updaters/Color/index.d.ts +2 -2
  536. package/browser/Updaters/Life/LifeUpdater.d.ts +1 -3
  537. package/browser/Updaters/Life/index.d.ts +2 -2
  538. package/browser/Updaters/Opacity/OpacityUpdater.d.ts +1 -3
  539. package/browser/Updaters/Opacity/OpacityUpdater.js +13 -14
  540. package/browser/Updaters/Opacity/index.d.ts +2 -2
  541. package/browser/Updaters/OutModes/IBounceData.d.ts +1 -2
  542. package/browser/Updaters/OutModes/OutOfCanvasUpdater.d.ts +1 -3
  543. package/browser/Updaters/OutModes/OutOfCanvasUpdater.js +19 -20
  544. package/browser/Updaters/OutModes/Utils.js +12 -13
  545. package/browser/Updaters/OutModes/index.d.ts +2 -2
  546. package/browser/Updaters/Roll/RollUpdater.d.ts +1 -2
  547. package/browser/Updaters/Roll/RollUpdater.js +4 -5
  548. package/browser/Updaters/Roll/index.d.ts +2 -2
  549. package/browser/Updaters/Size/SizeUpdater.d.ts +1 -2
  550. package/browser/Updaters/Size/SizeUpdater.js +6 -7
  551. package/browser/Updaters/Size/index.d.ts +2 -2
  552. package/browser/Updaters/StrokeColor/StrokeColorUpdater.d.ts +1 -3
  553. package/browser/Updaters/StrokeColor/StrokeColorUpdater.js +3 -4
  554. package/browser/Updaters/StrokeColor/index.d.ts +2 -2
  555. package/browser/Updaters/Tilt/TiltUpdater.d.ts +1 -3
  556. package/browser/Updaters/Tilt/TiltUpdater.js +8 -9
  557. package/browser/Updaters/Tilt/index.d.ts +2 -2
  558. package/browser/Updaters/Wobble/WobbleUpdater.d.ts +1 -3
  559. package/browser/Updaters/Wobble/index.d.ts +2 -2
  560. package/browser/Utils/CanvasUtils.d.ts +3 -3
  561. package/browser/Utils/CanvasUtils.js +4 -5
  562. package/browser/Utils/ColorUtils.d.ts +1 -1
  563. package/browser/Utils/ColorUtils.js +2 -3
  564. package/browser/Utils/NumberUtils.d.ts +2 -2
  565. package/browser/Utils/NumberUtils.js +18 -19
  566. package/browser/Utils/Utils.d.ts +1 -1
  567. package/browser/Utils/Utils.js +10 -14
  568. package/browser/Utils/index.d.ts +0 -9
  569. package/browser/Utils/index.js +0 -9
  570. package/browser/{main.d.ts → engine.d.ts} +4 -6
  571. package/browser/{main.js → engine.js} +10 -11
  572. package/browser/full.d.ts +2 -2
  573. package/browser/full.js +3 -3
  574. package/browser/index.d.ts +6 -16
  575. package/browser/index.engine.d.ts +13 -0
  576. package/browser/index.engine.js +12 -0
  577. package/browser/index.js +5 -13
  578. package/browser/index.slim.d.ts +6 -16
  579. package/browser/index.slim.js +5 -13
  580. package/browser/pjs.d.ts +3 -3
  581. package/browser/pjs.js +6 -5
  582. package/browser/slim.d.ts +2 -2
  583. package/{esm/main.d.ts → engine.d.ts} +2 -4
  584. package/{main.js → engine.js} +24 -25
  585. package/esm/Core/Canvas.d.ts +2 -2
  586. package/esm/Core/Canvas.js +25 -15
  587. package/esm/Core/Container.d.ts +2 -3
  588. package/esm/Core/Container.js +2 -3
  589. package/esm/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  590. package/esm/Core/Interfaces/IMovePathGenerator.d.ts +1 -1
  591. package/esm/Core/Interfaces/IParticle.d.ts +1 -1
  592. package/esm/Core/Interfaces/index.d.ts +3 -1
  593. package/esm/Core/Interfaces/index.js +3 -1
  594. package/esm/Core/Loader.js +6 -10
  595. package/esm/Core/Particle.d.ts +2 -5
  596. package/esm/Core/Particle.js +13 -15
  597. package/esm/Core/Particles.d.ts +1 -1
  598. package/esm/Core/Particles.js +8 -14
  599. package/esm/{Utils → Core/Utils}/Circle.d.ts +1 -1
  600. package/esm/{Utils → Core/Utils}/Circle.js +1 -1
  601. package/{Utils → esm/Core/Utils}/CircleWarp.d.ts +1 -2
  602. package/esm/{Utils → Core/Utils}/CircleWarp.js +0 -0
  603. package/esm/{Utils → Core/Utils}/Constants.d.ts +1 -1
  604. package/esm/{Utils → Core/Utils}/Constants.js +1 -1
  605. package/esm/{Utils → Core/Utils}/EventListeners.d.ts +1 -1
  606. package/esm/{Utils → Core/Utils}/EventListeners.js +11 -12
  607. package/{browser/Core → esm/Core/Utils}/ExternalInteractorBase.d.ts +4 -4
  608. package/esm/Core/{ExternalInteractorBase.js → Utils/ExternalInteractorBase.js} +1 -2
  609. package/{Core → esm/Core/Utils}/FrameManager.d.ts +1 -1
  610. package/esm/Core/{FrameManager.js → Utils/FrameManager.js} +0 -0
  611. package/{Core → esm/Core/Utils}/InteractionManager.d.ts +3 -3
  612. package/esm/Core/{InteractionManager.js → Utils/InteractionManager.js} +2 -3
  613. package/{browser/Core → esm/Core/Utils}/ParticlesInteractorBase.d.ts +4 -4
  614. package/{browser/Core → esm/Core/Utils}/ParticlesInteractorBase.js +1 -2
  615. package/{Core/Particle/Mover.d.ts → esm/Core/Utils/ParticlesMover.d.ts} +1 -1
  616. package/esm/Core/{Particle/Mover.js → Utils/ParticlesMover.js} +4 -5
  617. package/{Utils → esm/Core/Utils}/Plugins.d.ts +5 -5
  618. package/esm/{Utils → Core/Utils}/Plugins.js +0 -0
  619. package/esm/{Utils → Core/Utils}/Point.d.ts +2 -2
  620. package/esm/{Utils → Core/Utils}/Point.js +0 -0
  621. package/esm/{Utils → Core/Utils}/QuadTree.d.ts +3 -3
  622. package/esm/{Utils → Core/Utils}/QuadTree.js +1 -1
  623. package/{Utils → esm/Core/Utils}/Range.d.ts +1 -1
  624. package/esm/{Utils → Core/Utils}/Range.js +0 -0
  625. package/{Utils → esm/Core/Utils}/Rectangle.d.ts +1 -2
  626. package/esm/{Utils → Core/Utils}/Rectangle.js +0 -0
  627. package/esm/Core/{Particle → Utils}/Vector.d.ts +0 -0
  628. package/esm/Core/{Particle → Utils}/Vector.js +0 -0
  629. package/esm/Core/{Particle → Utils}/Vector3d.d.ts +0 -0
  630. package/esm/Core/{Particle → Utils}/Vector3d.js +0 -0
  631. package/esm/Core/Utils/index.d.ts +16 -0
  632. package/esm/Core/Utils/index.js +16 -0
  633. package/esm/Core/index.d.ts +8 -0
  634. package/esm/Core/index.js +8 -0
  635. package/esm/Enums/AnimationStatus.d.ts +1 -1
  636. package/esm/Enums/AnimationStatus.js +1 -5
  637. package/esm/Enums/Directions/MoveDirection.d.ts +1 -1
  638. package/esm/Enums/Directions/MoveDirection.js +1 -12
  639. package/esm/Enums/Directions/OutModeDirection.d.ts +1 -1
  640. package/esm/Enums/Directions/OutModeDirection.js +1 -7
  641. package/esm/Enums/Directions/RotateDirection.d.ts +1 -1
  642. package/esm/Enums/Directions/RotateDirection.js +1 -6
  643. package/esm/Enums/Directions/TiltDirection.d.ts +1 -1
  644. package/esm/Enums/Directions/TiltDirection.js +1 -6
  645. package/esm/Enums/InteractivityDetect.d.ts +1 -1
  646. package/esm/Enums/InteractivityDetect.js +1 -6
  647. package/esm/Enums/Modes/ClickMode.d.ts +1 -1
  648. package/esm/Enums/Modes/ClickMode.js +1 -10
  649. package/esm/Enums/Modes/CollisionMode.d.ts +1 -1
  650. package/esm/Enums/Modes/CollisionMode.js +1 -6
  651. package/esm/Enums/Modes/DestroyMode.d.ts +1 -1
  652. package/esm/Enums/Modes/DestroyMode.js +1 -5
  653. package/esm/Enums/Modes/DivMode.d.ts +1 -1
  654. package/esm/Enums/Modes/DivMode.js +1 -6
  655. package/esm/Enums/Modes/HoverMode.d.ts +1 -1
  656. package/esm/Enums/Modes/HoverMode.js +1 -12
  657. package/esm/Enums/Modes/OutMode.d.ts +1 -1
  658. package/esm/Enums/Modes/OutMode.js +1 -10
  659. package/esm/Enums/Modes/ResponsiveMode.d.ts +1 -1
  660. package/esm/Enums/Modes/ResponsiveMode.js +1 -5
  661. package/esm/Enums/Modes/RollMode.d.ts +1 -1
  662. package/esm/Enums/Modes/RollMode.js +1 -6
  663. package/esm/Enums/Modes/SizeMode.d.ts +1 -1
  664. package/esm/Enums/Modes/SizeMode.js +1 -5
  665. package/esm/Enums/Modes/ThemeMode.d.ts +1 -1
  666. package/esm/Enums/Modes/ThemeMode.js +1 -6
  667. package/esm/Enums/Types/AlterType.d.ts +1 -1
  668. package/esm/Enums/Types/AlterType.js +1 -5
  669. package/esm/Enums/Types/DestroyType.d.ts +1 -1
  670. package/esm/Enums/Types/DestroyType.js +1 -6
  671. package/esm/Enums/Types/DivType.d.ts +1 -1
  672. package/esm/Enums/Types/DivType.js +1 -5
  673. package/esm/Enums/Types/EasingType.d.ts +1 -1
  674. package/esm/Enums/Types/EasingType.js +1 -11
  675. package/esm/Enums/Types/GradientType.d.ts +1 -1
  676. package/esm/Enums/Types/GradientType.js +1 -6
  677. package/esm/Enums/Types/InteractorType.d.ts +1 -1
  678. package/esm/Enums/Types/InteractorType.js +1 -5
  679. package/esm/Enums/Types/OrbitType.d.ts +1 -1
  680. package/esm/Enums/Types/OrbitType.js +1 -5
  681. package/esm/Enums/Types/ShapeType.d.ts +1 -1
  682. package/esm/Enums/Types/ShapeType.js +1 -14
  683. package/esm/Enums/Types/StartValueType.d.ts +1 -1
  684. package/esm/Enums/Types/StartValueType.js +1 -6
  685. package/esm/Interactions/External/Attract/Attractor.d.ts +2 -2
  686. package/esm/Interactions/External/Attract/Attractor.js +5 -7
  687. package/esm/Interactions/External/Attract/index.d.ts +2 -2
  688. package/esm/Interactions/External/Bounce/Bouncer.d.ts +2 -2
  689. package/esm/Interactions/External/Bounce/Bouncer.js +7 -9
  690. package/esm/Interactions/External/Bounce/index.d.ts +2 -2
  691. package/esm/Interactions/External/Bubble/Bubbler.d.ts +3 -3
  692. package/esm/Interactions/External/Bubble/Bubbler.js +16 -18
  693. package/esm/Interactions/External/Bubble/ProcessBubbleType.d.ts +1 -1
  694. package/esm/Interactions/External/Bubble/ProcessBubbleType.js +1 -6
  695. package/esm/Interactions/External/Bubble/index.d.ts +2 -2
  696. package/esm/Interactions/External/Connect/Connector.d.ts +2 -2
  697. package/esm/Interactions/External/Connect/Connector.js +2 -3
  698. package/esm/Interactions/External/Connect/index.d.ts +2 -2
  699. package/esm/Interactions/External/Grab/Grabber.d.ts +2 -2
  700. package/esm/Interactions/External/Grab/Grabber.js +3 -4
  701. package/esm/Interactions/External/Grab/index.d.ts +2 -2
  702. package/esm/Interactions/External/Repulse/Repulser.d.ts +2 -2
  703. package/esm/Interactions/External/Repulse/Repulser.js +8 -10
  704. package/esm/Interactions/External/Repulse/index.d.ts +2 -2
  705. package/esm/Interactions/External/Trail/TrailMaker.d.ts +2 -3
  706. package/esm/Interactions/External/Trail/TrailMaker.js +3 -4
  707. package/esm/Interactions/External/Trail/index.d.ts +2 -2
  708. package/esm/Interactions/Particles/Attract/Attractor.d.ts +2 -4
  709. package/esm/Interactions/Particles/Attract/Attractor.js +1 -1
  710. package/esm/Interactions/Particles/Attract/index.d.ts +2 -2
  711. package/esm/Interactions/Particles/Collisions/Collider.d.ts +2 -3
  712. package/esm/Interactions/Particles/Collisions/Collider.js +4 -5
  713. package/esm/Interactions/Particles/Collisions/index.d.ts +2 -2
  714. package/esm/Interactions/Particles/Links/LinkInstance.d.ts +1 -3
  715. package/esm/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
  716. package/esm/Interactions/Particles/Links/Linker.d.ts +3 -4
  717. package/esm/Interactions/Particles/Links/Linker.js +2 -2
  718. package/esm/Interactions/Particles/Links/index.d.ts +2 -3
  719. package/esm/Interactions/Particles/Links/index.js +1 -4
  720. package/esm/Interactions/Particles/Links/interaction.d.ts +2 -0
  721. package/esm/Interactions/Particles/Links/interaction.js +4 -0
  722. package/esm/Interactions/Particles/Links/plugin.d.ts +2 -2
  723. package/esm/Interactions/Particles/Links/plugin.js +2 -2
  724. package/esm/Options/Classes/AnimatableGradient.js +3 -4
  725. package/esm/Options/Classes/Interactivity/Events/DivEvent.js +1 -2
  726. package/esm/Options/Classes/Interactivity/Interactivity.js +5 -6
  727. package/esm/Options/Classes/Interactivity/Modes/Attract.js +1 -2
  728. package/esm/Options/Classes/Interactivity/Modes/RepulseBase.js +1 -2
  729. package/esm/Options/Classes/Options.d.ts +1 -0
  730. package/esm/Options/Classes/Options.js +9 -7
  731. package/esm/Options/Classes/Particles/Collisions/Collisions.js +1 -2
  732. package/esm/Options/Classes/Particles/Destroy/Destroy.js +1 -2
  733. package/esm/Options/Classes/Particles/Move/Move.js +1 -2
  734. package/esm/Options/Classes/Particles/Move/OutModes.js +1 -2
  735. package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +2 -3
  736. package/esm/Options/Classes/Particles/Roll/Roll.js +1 -2
  737. package/esm/Options/Classes/Particles/Rotate/Rotate.js +1 -2
  738. package/esm/Options/Classes/Particles/Shape/Shape.js +13 -14
  739. package/esm/Options/Classes/Particles/Size/SizeAnimation.js +2 -3
  740. package/esm/Options/Classes/Particles/Tilt/Tilt.js +1 -2
  741. package/esm/Options/Classes/Responsive.js +4 -5
  742. package/esm/Options/Classes/Theme/ThemeDefault.js +1 -2
  743. package/esm/Options/Interfaces/IOptions.d.ts +1 -0
  744. package/esm/Plugins/Absorbers/AbsorberContainer.d.ts +1 -1
  745. package/esm/Plugins/Absorbers/AbsorberInstance.d.ts +2 -4
  746. package/esm/Plugins/Absorbers/AbsorberInstance.js +4 -5
  747. package/esm/Plugins/Absorbers/Absorbers.d.ts +1 -4
  748. package/esm/Plugins/Absorbers/Absorbers.js +1 -2
  749. package/esm/Plugins/Absorbers/Enums/AbsorberClickMode.d.ts +1 -1
  750. package/esm/Plugins/Absorbers/Enums/AbsorberClickMode.js +1 -4
  751. package/esm/Plugins/Absorbers/index.d.ts +2 -0
  752. package/esm/Plugins/Absorbers/{plugin.js → index.js} +3 -4
  753. package/esm/Plugins/Emitters/EmitterContainer.d.ts +1 -1
  754. package/esm/Plugins/Emitters/EmitterInstance.d.ts +1 -2
  755. package/esm/Plugins/Emitters/EmitterInstance.js +3 -4
  756. package/esm/Plugins/Emitters/Emitters.d.ts +1 -2
  757. package/esm/Plugins/Emitters/Emitters.js +1 -2
  758. package/esm/Plugins/Emitters/EmittersMain.d.ts +2 -2
  759. package/esm/Plugins/Emitters/Enums/EmitterClickMode.d.ts +1 -1
  760. package/esm/Plugins/Emitters/Enums/EmitterClickMode.js +1 -4
  761. package/esm/Plugins/Emitters/Enums/EmitterShapeType.d.ts +1 -1
  762. package/esm/Plugins/Emitters/Enums/EmitterShapeType.js +1 -5
  763. package/esm/Plugins/Emitters/IEmitterShape.d.ts +1 -1
  764. package/esm/Plugins/Emitters/Options/Classes/Emitter.js +1 -2
  765. package/esm/Plugins/Emitters/Options/Classes/EmitterSize.js +1 -2
  766. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +1 -1
  767. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +1 -1
  768. package/esm/Plugins/Emitters/{plugin.d.ts → index.d.ts} +0 -0
  769. package/esm/Plugins/Emitters/{plugin.js → index.js} +3 -4
  770. package/esm/Plugins/PolygonMask/Enums/PolygonMaskInlineArrangement.d.ts +8 -0
  771. package/esm/Plugins/PolygonMask/{Options/Interfaces/ILocalSvg.js → Enums/PolygonMaskInlineArrangement.js} +0 -0
  772. package/esm/Plugins/PolygonMask/Enums/PolygonMaskMoveType.d.ts +4 -0
  773. package/esm/Plugins/PolygonMask/{Options/Interfaces/IMove.js → Enums/PolygonMaskMoveType.js} +0 -0
  774. package/{browser/Plugins/PolygonMask/Enums/Type.d.ts → esm/Plugins/PolygonMask/Enums/PolygonMaskType.d.ts} +1 -1
  775. package/esm/Plugins/PolygonMask/{types.js → Enums/PolygonMaskType.js} +0 -0
  776. package/esm/Plugins/PolygonMask/Enums/index.d.ts +3 -3
  777. package/esm/Plugins/PolygonMask/Enums/index.js +3 -3
  778. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +13 -13
  779. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMask.js +42 -42
  780. package/esm/Plugins/PolygonMask/Options/Classes/{Draw.d.ts → PolygonMaskDraw.d.ts} +5 -5
  781. package/esm/Plugins/PolygonMask/Options/Classes/{Draw.js → PolygonMaskDraw.js} +13 -12
  782. package/esm/Plugins/PolygonMask/Options/Classes/{DrawStroke.d.ts → PolygonMaskDrawStroke.d.ts} +3 -3
  783. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.js +25 -0
  784. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +9 -0
  785. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.js +13 -0
  786. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +11 -0
  787. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.js +25 -0
  788. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +10 -0
  789. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.js +17 -0
  790. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +12 -13
  791. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +8 -0
  792. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.js +1 -0
  793. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDrawStroke.d.ts +6 -0
  794. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDrawStroke.js +1 -0
  795. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.d.ts +4 -0
  796. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskInline.js +1 -0
  797. package/esm/Plugins/PolygonMask/Options/Interfaces/{ILocalSvg.d.ts → IPolygonMaskLocalSvg.d.ts} +2 -2
  798. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.js +1 -0
  799. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.d.ts +5 -0
  800. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskMove.js +1 -0
  801. package/esm/Plugins/PolygonMask/PolygonMaskInstance.d.ts +2 -4
  802. package/esm/Plugins/PolygonMask/PolygonMaskInstance.js +24 -21
  803. package/esm/Plugins/PolygonMask/{types.d.ts → Types.d.ts} +0 -0
  804. package/esm/Plugins/PolygonMask/Types.js +1 -0
  805. package/{browser/Plugins/PolygonMask/utils.d.ts → esm/Plugins/PolygonMask/Utils.d.ts} +5 -5
  806. package/esm/Plugins/PolygonMask/{utils.js → Utils.js} +15 -12
  807. package/esm/Plugins/PolygonMask/index.d.ts +2 -0
  808. package/esm/Plugins/PolygonMask/{plugin.js → index.js} +4 -5
  809. package/esm/Plugins/PolygonMask/pathseg.js +54 -43
  810. package/esm/Shapes/Circle/CircleDrawer.d.ts +1 -1
  811. package/esm/Shapes/Circle/index.d.ts +2 -2
  812. package/esm/Shapes/Image/ImageDrawer.d.ts +3 -7
  813. package/esm/Shapes/Image/ImageDrawer.js +28 -108
  814. package/esm/Shapes/Image/Utils.d.ts +8 -5
  815. package/esm/Shapes/Image/Utils.js +67 -36
  816. package/esm/Shapes/Image/index.d.ts +2 -2
  817. package/esm/Shapes/Line/LineDrawer.d.ts +1 -1
  818. package/esm/Shapes/Line/index.d.ts +2 -2
  819. package/esm/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
  820. package/esm/Shapes/Polygon/PolygonDrawerBase.d.ts +1 -1
  821. package/esm/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
  822. package/esm/Shapes/Polygon/index.d.ts +4 -4
  823. package/esm/Shapes/Square/SquareDrawer.d.ts +1 -1
  824. package/esm/Shapes/Square/index.d.ts +2 -2
  825. package/esm/Shapes/Star/StarDrawer.d.ts +1 -1
  826. package/esm/Shapes/Star/index.d.ts +2 -2
  827. package/esm/Shapes/Text/TextDrawer.d.ts +1 -2
  828. package/esm/Shapes/Text/index.d.ts +2 -2
  829. package/esm/Updaters/Angle/AngleUpdater.d.ts +1 -3
  830. package/esm/Updaters/Angle/AngleUpdater.js +8 -9
  831. package/esm/Updaters/Angle/index.d.ts +2 -2
  832. package/esm/Updaters/Color/ColorUpdater.d.ts +1 -3
  833. package/esm/Updaters/Color/ColorUpdater.js +3 -4
  834. package/esm/Updaters/Color/index.d.ts +2 -2
  835. package/esm/Updaters/Life/LifeUpdater.d.ts +1 -3
  836. package/esm/Updaters/Life/index.d.ts +2 -2
  837. package/esm/Updaters/Opacity/OpacityUpdater.d.ts +1 -3
  838. package/esm/Updaters/Opacity/OpacityUpdater.js +13 -14
  839. package/esm/Updaters/Opacity/index.d.ts +2 -2
  840. package/esm/Updaters/OutModes/IBounceData.d.ts +1 -2
  841. package/esm/Updaters/OutModes/OutOfCanvasUpdater.d.ts +1 -3
  842. package/esm/Updaters/OutModes/OutOfCanvasUpdater.js +19 -20
  843. package/esm/Updaters/OutModes/Utils.js +12 -13
  844. package/esm/Updaters/OutModes/index.d.ts +2 -2
  845. package/esm/Updaters/Roll/RollUpdater.d.ts +1 -2
  846. package/esm/Updaters/Roll/RollUpdater.js +4 -5
  847. package/esm/Updaters/Roll/index.d.ts +2 -2
  848. package/esm/Updaters/Size/SizeUpdater.d.ts +1 -2
  849. package/esm/Updaters/Size/SizeUpdater.js +6 -7
  850. package/esm/Updaters/Size/index.d.ts +2 -2
  851. package/esm/Updaters/StrokeColor/StrokeColorUpdater.d.ts +1 -3
  852. package/esm/Updaters/StrokeColor/StrokeColorUpdater.js +3 -4
  853. package/esm/Updaters/StrokeColor/index.d.ts +2 -2
  854. package/esm/Updaters/Tilt/TiltUpdater.d.ts +1 -3
  855. package/esm/Updaters/Tilt/TiltUpdater.js +8 -9
  856. package/esm/Updaters/Tilt/index.d.ts +2 -2
  857. package/esm/Updaters/Wobble/WobbleUpdater.d.ts +1 -3
  858. package/esm/Updaters/Wobble/index.d.ts +2 -2
  859. package/esm/Utils/CanvasUtils.d.ts +3 -3
  860. package/esm/Utils/CanvasUtils.js +4 -5
  861. package/esm/Utils/ColorUtils.d.ts +1 -1
  862. package/esm/Utils/ColorUtils.js +2 -3
  863. package/esm/Utils/NumberUtils.d.ts +2 -2
  864. package/esm/Utils/NumberUtils.js +18 -19
  865. package/esm/Utils/Utils.d.ts +1 -1
  866. package/esm/Utils/Utils.js +10 -14
  867. package/esm/Utils/index.d.ts +0 -9
  868. package/esm/Utils/index.js +0 -9
  869. package/{main.d.ts → esm/engine.d.ts} +2 -4
  870. package/esm/{main.js → engine.js} +8 -9
  871. package/esm/full.d.ts +2 -2
  872. package/esm/full.js +3 -3
  873. package/esm/index.d.ts +6 -16
  874. package/esm/index.engine.d.ts +13 -0
  875. package/esm/index.engine.js +11 -0
  876. package/esm/index.js +5 -13
  877. package/esm/index.slim.d.ts +6 -16
  878. package/esm/index.slim.js +5 -13
  879. package/esm/pjs.d.ts +3 -3
  880. package/esm/pjs.js +6 -5
  881. package/esm/slim.d.ts +2 -2
  882. package/full.d.ts +2 -2
  883. package/full.js +6 -6
  884. package/index.d.ts +6 -16
  885. package/index.engine.d.ts +13 -0
  886. package/index.engine.js +27 -0
  887. package/index.js +7 -19
  888. package/index.slim.d.ts +6 -16
  889. package/index.slim.js +7 -19
  890. package/package.json +1 -1
  891. package/pjs.d.ts +3 -3
  892. package/pjs.js +6 -5
  893. package/report.html +2 -2
  894. package/report.slim.html +2 -2
  895. package/scripts/install.js +14 -3
  896. package/slim.d.ts +2 -2
  897. package/tsparticles.engine.js +6746 -0
  898. package/tsparticles.engine.min.js +2 -0
  899. package/tsparticles.interaction.external.attract.js +4976 -0
  900. package/tsparticles.interaction.external.attract.min.js +2 -0
  901. package/tsparticles.interaction.external.bounce.js +4997 -0
  902. package/tsparticles.interaction.external.bounce.min.js +2 -0
  903. package/tsparticles.interaction.external.bubble.js +5083 -0
  904. package/tsparticles.interaction.external.bubble.min.js +2 -0
  905. package/tsparticles.interaction.external.connect.js +4845 -0
  906. package/tsparticles.interaction.external.connect.min.js +2 -0
  907. package/tsparticles.interaction.external.grab.js +4851 -0
  908. package/tsparticles.interaction.external.grab.min.js +2 -0
  909. package/tsparticles.interaction.external.repulse.js +5028 -0
  910. package/tsparticles.interaction.external.repulse.min.js +2 -0
  911. package/tsparticles.interaction.external.trail.js +4853 -0
  912. package/tsparticles.interaction.external.trail.min.js +2 -0
  913. package/tsparticles.interaction.particles.attract.js +4834 -0
  914. package/tsparticles.interaction.particles.attract.min.js +2 -0
  915. package/tsparticles.interaction.particles.collisions.js +4999 -0
  916. package/tsparticles.interaction.particles.collisions.min.js +2 -0
  917. package/tsparticles.interaction.particles.links.js +5071 -0
  918. package/tsparticles.interaction.particles.links.min.js +2 -0
  919. package/tsparticles.js +1297 -1605
  920. package/tsparticles.min.js +2 -2
  921. package/tsparticles.pathseg.min.js +2 -0
  922. package/tsparticles.plugins.absorbers.js +5332 -0
  923. package/tsparticles.plugins.absorbers.min.js +2 -0
  924. package/tsparticles.plugins.emitters.js +5419 -0
  925. package/tsparticles.plugins.emitters.min.js +2 -0
  926. package/tsparticles.plugins.polygonMask.js +5862 -0
  927. package/tsparticles.plugins.polygonMask.min.js +2 -0
  928. package/tsparticles.shape.circle.js +59 -0
  929. package/tsparticles.shape.circle.min.js +2 -0
  930. package/tsparticles.shape.image.js +5021 -0
  931. package/tsparticles.shape.image.min.js +2 -0
  932. package/tsparticles.shape.line.js +60 -0
  933. package/tsparticles.shape.line.min.js +2 -0
  934. package/tsparticles.shape.polygon.js +131 -0
  935. package/tsparticles.shape.polygon.min.js +2 -0
  936. package/tsparticles.shape.square.js +62 -0
  937. package/tsparticles.shape.square.min.js +2 -0
  938. package/tsparticles.shape.star.js +71 -0
  939. package/tsparticles.shape.star.min.js +2 -0
  940. package/tsparticles.shape.text.js +4865 -0
  941. package/tsparticles.shape.text.min.js +2 -0
  942. package/tsparticles.slim.js +1075 -1336
  943. package/tsparticles.slim.min.js +2 -2
  944. package/tsparticles.updater.angle.js +4880 -0
  945. package/tsparticles.updater.angle.min.js +2 -0
  946. package/tsparticles.updater.color.js +4862 -0
  947. package/tsparticles.updater.color.min.js +2 -0
  948. package/tsparticles.updater.life.js +4864 -0
  949. package/tsparticles.updater.life.min.js +2 -0
  950. package/tsparticles.updater.opacity.js +4914 -0
  951. package/tsparticles.updater.opacity.min.js +2 -0
  952. package/tsparticles.updater.outModes.js +4998 -0
  953. package/tsparticles.updater.outModes.min.js +2 -0
  954. package/tsparticles.updater.roll.js +4862 -0
  955. package/tsparticles.updater.roll.min.js +2 -0
  956. package/tsparticles.updater.size.js +4870 -0
  957. package/tsparticles.updater.size.min.js +2 -0
  958. package/tsparticles.updater.strokeColor.js +4875 -0
  959. package/tsparticles.updater.strokeColor.min.js +2 -0
  960. package/tsparticles.updater.tilt.js +4881 -0
  961. package/tsparticles.updater.tilt.min.js +2 -0
  962. package/tsparticles.updater.wobble.js +4850 -0
  963. package/tsparticles.updater.wobble.min.js +2 -0
  964. package/Plugins/Absorbers/plugin.d.ts +0 -2
  965. package/Plugins/PolygonMask/Enums/InlineArrangement.d.ts +0 -8
  966. package/Plugins/PolygonMask/Enums/InlineArrangement.js +0 -11
  967. package/Plugins/PolygonMask/Enums/MoveType.d.ts +0 -4
  968. package/Plugins/PolygonMask/Enums/MoveType.js +0 -8
  969. package/Plugins/PolygonMask/Enums/Type.js +0 -10
  970. package/Plugins/PolygonMask/Options/Classes/DrawStroke.js +0 -28
  971. package/Plugins/PolygonMask/Options/Classes/Inline.d.ts +0 -9
  972. package/Plugins/PolygonMask/Options/Classes/Inline.js +0 -17
  973. package/Plugins/PolygonMask/Options/Classes/LocalSvg.d.ts +0 -11
  974. package/Plugins/PolygonMask/Options/Classes/LocalSvg.js +0 -28
  975. package/Plugins/PolygonMask/Options/Classes/Move.d.ts +0 -10
  976. package/Plugins/PolygonMask/Options/Classes/Move.js +0 -21
  977. package/Plugins/PolygonMask/Options/Interfaces/IDraw.d.ts +0 -8
  978. package/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.d.ts +0 -6
  979. package/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +0 -4
  980. package/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +0 -5
  981. package/Plugins/PolygonMask/plugin.d.ts +0 -2
  982. package/browser/Plugins/Absorbers/plugin.d.ts +0 -2
  983. package/browser/Plugins/PolygonMask/Enums/InlineArrangement.d.ts +0 -8
  984. package/browser/Plugins/PolygonMask/Enums/InlineArrangement.js +0 -8
  985. package/browser/Plugins/PolygonMask/Enums/MoveType.d.ts +0 -4
  986. package/browser/Plugins/PolygonMask/Enums/MoveType.js +0 -5
  987. package/browser/Plugins/PolygonMask/Enums/Type.js +0 -7
  988. package/browser/Plugins/PolygonMask/Options/Classes/DrawStroke.js +0 -27
  989. package/browser/Plugins/PolygonMask/Options/Classes/Inline.d.ts +0 -12
  990. package/browser/Plugins/PolygonMask/Options/Classes/Inline.js +0 -16
  991. package/browser/Plugins/PolygonMask/Options/Classes/LocalSvg.js +0 -27
  992. package/browser/Plugins/PolygonMask/Options/Classes/Move.d.ts +0 -13
  993. package/browser/Plugins/PolygonMask/Options/Classes/Move.js +0 -20
  994. package/browser/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +0 -7
  995. package/browser/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +0 -8
  996. package/browser/Plugins/PolygonMask/plugin.d.ts +0 -2
  997. package/esm/Plugins/Absorbers/plugin.d.ts +0 -2
  998. package/esm/Plugins/PolygonMask/Enums/InlineArrangement.d.ts +0 -8
  999. package/esm/Plugins/PolygonMask/Enums/InlineArrangement.js +0 -8
  1000. package/esm/Plugins/PolygonMask/Enums/MoveType.d.ts +0 -4
  1001. package/esm/Plugins/PolygonMask/Enums/MoveType.js +0 -5
  1002. package/esm/Plugins/PolygonMask/Enums/Type.js +0 -7
  1003. package/esm/Plugins/PolygonMask/Options/Classes/DrawStroke.js +0 -24
  1004. package/esm/Plugins/PolygonMask/Options/Classes/Inline.d.ts +0 -9
  1005. package/esm/Plugins/PolygonMask/Options/Classes/Inline.js +0 -13
  1006. package/esm/Plugins/PolygonMask/Options/Classes/LocalSvg.d.ts +0 -11
  1007. package/esm/Plugins/PolygonMask/Options/Classes/LocalSvg.js +0 -24
  1008. package/esm/Plugins/PolygonMask/Options/Classes/Move.d.ts +0 -10
  1009. package/esm/Plugins/PolygonMask/Options/Classes/Move.js +0 -17
  1010. package/esm/Plugins/PolygonMask/Options/Interfaces/IDraw.d.ts +0 -8
  1011. package/esm/Plugins/PolygonMask/Options/Interfaces/IDrawStroke.d.ts +0 -6
  1012. package/esm/Plugins/PolygonMask/Options/Interfaces/IInline.d.ts +0 -4
  1013. package/esm/Plugins/PolygonMask/Options/Interfaces/IMove.d.ts +0 -5
  1014. package/esm/Plugins/PolygonMask/plugin.d.ts +0 -2
  1015. package/tsparticles.pathseg.js +0 -1472
package/tsparticles.js CHANGED
@@ -117,7 +117,7 @@
117
117
  }();
118
118
  !function() {
119
119
  __webpack_require__.u = function(chunkId) {
120
- return "" + "tsparticles.pathseg" + ".js";
120
+ return "" + "tsparticles.pathseg.min" + ".js";
121
121
  };
122
122
  }();
123
123
  !function() {
@@ -298,20 +298,14 @@
298
298
  }();
299
299
  !function() {
300
300
  __webpack_require__.O(0, [ 649 ], (function() {
301
- __webpack_require__.E(917);
301
+ __webpack_require__.E(404);
302
302
  }), 5);
303
303
  }();
304
304
  var __webpack_exports__ = {};
305
305
  __webpack_require__.r(__webpack_exports__);
306
306
  __webpack_require__.d(__webpack_exports__, {
307
- AbsorberClickMode: function() {
308
- return AbsorberClickMode;
309
- },
310
- AlterType: function() {
311
- return AlterType;
312
- },
313
- AnimationStatus: function() {
314
- return AnimationStatus;
307
+ Canvas: function() {
308
+ return Canvas;
315
309
  },
316
310
  Circle: function() {
317
311
  return Circle;
@@ -319,117 +313,69 @@
319
313
  CircleWarp: function() {
320
314
  return CircleWarp;
321
315
  },
322
- ClickMode: function() {
323
- return ClickMode;
324
- },
325
- CollisionMode: function() {
326
- return CollisionMode;
327
- },
328
316
  Constants: function() {
329
317
  return Constants;
330
318
  },
331
319
  Container: function() {
332
320
  return Container;
333
321
  },
334
- DestroyMode: function() {
335
- return DestroyMode;
336
- },
337
- DestroyType: function() {
338
- return DestroyType;
339
- },
340
- DivMode: function() {
341
- return DivMode;
342
- },
343
- DivType: function() {
344
- return DivType;
345
- },
346
- EasingType: function() {
347
- return EasingType;
322
+ Engine: function() {
323
+ return Engine;
348
324
  },
349
- EmitterClickMode: function() {
350
- return EmitterClickMode;
351
- },
352
- EmitterShapeType: function() {
353
- return EmitterShapeType;
325
+ EventListeners: function() {
326
+ return EventListeners;
354
327
  },
355
328
  ExternalInteractorBase: function() {
356
329
  return ExternalInteractorBase;
357
330
  },
358
- GradientType: function() {
359
- return GradientType;
360
- },
361
- HoverMode: function() {
362
- return HoverMode;
331
+ FrameManager: function() {
332
+ return FrameManager;
363
333
  },
364
- InlineArrangement: function() {
365
- return InlineArrangement;
334
+ InteractionManager: function() {
335
+ return InteractionManager;
366
336
  },
367
- InteractivityDetect: function() {
368
- return InteractivityDetect;
369
- },
370
- InteractorType: function() {
371
- return InteractorType;
337
+ Loader: function() {
338
+ return Loader;
372
339
  },
373
340
  Main: function() {
374
- return Main;
375
- },
376
- MoveDirection: function() {
377
- return MoveDirection;
378
- },
379
- MoveType: function() {
380
- return MoveType;
381
- },
382
- OrbitType: function() {
383
- return OrbitType;
384
- },
385
- OutMode: function() {
386
- return OutMode;
387
- },
388
- OutModeDirection: function() {
389
- return OutModeDirection;
341
+ return Engine;
390
342
  },
391
343
  Particle: function() {
392
344
  return Particle;
393
345
  },
346
+ Particles: function() {
347
+ return Particles;
348
+ },
394
349
  ParticlesInteractorBase: function() {
395
350
  return ParticlesInteractorBase;
396
351
  },
397
- Point: function() {
398
- return Point;
399
- },
400
- Rectangle: function() {
401
- return Rectangle;
402
- },
403
- ResponsiveMode: function() {
404
- return ResponsiveMode;
405
- },
406
- RollMode: function() {
407
- return RollMode;
352
+ ParticlesMover: function() {
353
+ return ParticlesMover;
408
354
  },
409
- RotateDirection: function() {
410
- return RotateDirection;
355
+ Plugins: function() {
356
+ return Plugins;
411
357
  },
412
- ShapeType: function() {
413
- return ShapeType;
414
- },
415
- SizeMode: function() {
416
- return SizeMode;
358
+ Point: function() {
359
+ return Point;
417
360
  },
418
- StartValueType: function() {
419
- return StartValueType;
361
+ QuadTree: function() {
362
+ return QuadTree;
420
363
  },
421
- ThemeMode: function() {
422
- return ThemeMode;
364
+ Range: function() {
365
+ return Range;
423
366
  },
424
- TiltDirection: function() {
425
- return TiltDirection;
367
+ Rectangle: function() {
368
+ return Rectangle;
426
369
  },
427
- Type: function() {
428
- return Type;
370
+ Retina: function() {
371
+ return Retina;
429
372
  },
430
373
  Vector: function() {
431
374
  return Vector;
432
375
  },
376
+ Vector3d: function() {
377
+ return Vector3d;
378
+ },
433
379
  alterHsl: function() {
434
380
  return alterHsl;
435
381
  },
@@ -650,10 +596,10 @@
650
596
  return tsParticles;
651
597
  }
652
598
  });
653
- const initPjs = main => {
654
- const particlesJS = (tagId, options) => main.load(tagId, options);
599
+ const initPjs = engine => {
600
+ const particlesJS = (tagId, options) => engine.load(tagId, options);
655
601
  particlesJS.load = (tagId, pathConfigJson, callback) => {
656
- main.loadJSON(tagId, pathConfigJson).then((container => {
602
+ engine.loadJSON(tagId, pathConfigJson).then((container => {
657
603
  if (container) {
658
604
  callback(container);
659
605
  }
@@ -662,279 +608,20 @@
662
608
  }));
663
609
  };
664
610
  particlesJS.setOnClickHandler = callback => {
665
- main.setOnClickHandler(callback);
611
+ engine.setOnClickHandler(callback);
666
612
  };
667
- const pJSDom = main.dom();
613
+ const pJSDom = engine.dom();
668
614
  return {
669
615
  particlesJS: particlesJS,
670
616
  pJSDom: pJSDom
671
617
  };
672
618
  };
673
- var MoveDirection;
674
- (function(MoveDirection) {
675
- MoveDirection["bottom"] = "bottom";
676
- MoveDirection["bottomLeft"] = "bottom-left";
677
- MoveDirection["bottomRight"] = "bottom-right";
678
- MoveDirection["left"] = "left";
679
- MoveDirection["none"] = "none";
680
- MoveDirection["right"] = "right";
681
- MoveDirection["top"] = "top";
682
- MoveDirection["topLeft"] = "top-left";
683
- MoveDirection["topRight"] = "top-right";
684
- })(MoveDirection || (MoveDirection = {}));
685
- var RotateDirection;
686
- (function(RotateDirection) {
687
- RotateDirection["clockwise"] = "clockwise";
688
- RotateDirection["counterClockwise"] = "counter-clockwise";
689
- RotateDirection["random"] = "random";
690
- })(RotateDirection || (RotateDirection = {}));
691
- var OutModeDirection;
692
- (function(OutModeDirection) {
693
- OutModeDirection["bottom"] = "bottom";
694
- OutModeDirection["left"] = "left";
695
- OutModeDirection["right"] = "right";
696
- OutModeDirection["top"] = "top";
697
- })(OutModeDirection || (OutModeDirection = {}));
698
- var TiltDirection;
699
- (function(TiltDirection) {
700
- TiltDirection["clockwise"] = "clockwise";
701
- TiltDirection["counterClockwise"] = "counter-clockwise";
702
- TiltDirection["random"] = "random";
703
- })(TiltDirection || (TiltDirection = {}));
704
- var ClickMode;
705
- (function(ClickMode) {
706
- ClickMode["attract"] = "attract";
707
- ClickMode["bubble"] = "bubble";
708
- ClickMode["push"] = "push";
709
- ClickMode["remove"] = "remove";
710
- ClickMode["repulse"] = "repulse";
711
- ClickMode["pause"] = "pause";
712
- ClickMode["trail"] = "trail";
713
- })(ClickMode || (ClickMode = {}));
714
- var DestroyMode;
715
- (function(DestroyMode) {
716
- DestroyMode["none"] = "none";
717
- DestroyMode["split"] = "split";
718
- })(DestroyMode || (DestroyMode = {}));
719
- var DivMode;
720
- (function(DivMode) {
721
- DivMode["bounce"] = "bounce";
722
- DivMode["bubble"] = "bubble";
723
- DivMode["repulse"] = "repulse";
724
- })(DivMode || (DivMode = {}));
725
- var HoverMode;
726
- (function(HoverMode) {
727
- HoverMode["attract"] = "attract";
728
- HoverMode["bounce"] = "bounce";
729
- HoverMode["bubble"] = "bubble";
730
- HoverMode["connect"] = "connect";
731
- HoverMode["grab"] = "grab";
732
- HoverMode["light"] = "light";
733
- HoverMode["repulse"] = "repulse";
734
- HoverMode["slow"] = "slow";
735
- HoverMode["trail"] = "trail";
736
- })(HoverMode || (HoverMode = {}));
737
- var CollisionMode;
738
- (function(CollisionMode) {
739
- CollisionMode["absorb"] = "absorb";
740
- CollisionMode["bounce"] = "bounce";
741
- CollisionMode["destroy"] = "destroy";
742
- })(CollisionMode || (CollisionMode = {}));
743
- var OutMode;
744
- (function(OutMode) {
745
- OutMode["bounce"] = "bounce";
746
- OutMode["bounceHorizontal"] = "bounce-horizontal";
747
- OutMode["bounceVertical"] = "bounce-vertical";
748
- OutMode["none"] = "none";
749
- OutMode["out"] = "out";
750
- OutMode["destroy"] = "destroy";
751
- OutMode["split"] = "split";
752
- })(OutMode || (OutMode = {}));
753
- var RollMode;
754
- (function(RollMode) {
755
- RollMode["both"] = "both";
756
- RollMode["horizontal"] = "horizontal";
757
- RollMode["vertical"] = "vertical";
758
- })(RollMode || (RollMode = {}));
759
- var SizeMode;
760
- (function(SizeMode) {
761
- SizeMode["precise"] = "precise";
762
- SizeMode["percent"] = "percent";
763
- })(SizeMode || (SizeMode = {}));
764
- var ThemeMode;
765
- (function(ThemeMode) {
766
- ThemeMode["any"] = "any";
767
- ThemeMode["dark"] = "dark";
768
- ThemeMode["light"] = "light";
769
- })(ThemeMode || (ThemeMode = {}));
770
- var ResponsiveMode;
771
- (function(ResponsiveMode) {
772
- ResponsiveMode["screen"] = "screen";
773
- ResponsiveMode["canvas"] = "canvas";
774
- })(ResponsiveMode || (ResponsiveMode = {}));
775
- var AnimationStatus;
776
- (function(AnimationStatus) {
777
- AnimationStatus[AnimationStatus["increasing"] = 0] = "increasing";
778
- AnimationStatus[AnimationStatus["decreasing"] = 1] = "decreasing";
779
- })(AnimationStatus || (AnimationStatus = {}));
780
- var AlterType;
781
- (function(AlterType) {
782
- AlterType["darken"] = "darken";
783
- AlterType["enlighten"] = "enlighten";
784
- })(AlterType || (AlterType = {}));
785
- var DestroyType;
786
- (function(DestroyType) {
787
- DestroyType["none"] = "none";
788
- DestroyType["max"] = "max";
789
- DestroyType["min"] = "min";
790
- })(DestroyType || (DestroyType = {}));
791
- var GradientType;
792
- (function(GradientType) {
793
- GradientType["linear"] = "linear";
794
- GradientType["radial"] = "radial";
795
- GradientType["random"] = "random";
796
- })(GradientType || (GradientType = {}));
797
- var InteractorType;
798
- (function(InteractorType) {
799
- InteractorType[InteractorType["External"] = 0] = "External";
800
- InteractorType[InteractorType["Particles"] = 1] = "Particles";
801
- })(InteractorType || (InteractorType = {}));
802
- var ShapeType;
803
- (function(ShapeType) {
804
- ShapeType["char"] = "char";
805
- ShapeType["character"] = "character";
806
- ShapeType["circle"] = "circle";
807
- ShapeType["edge"] = "edge";
808
- ShapeType["image"] = "image";
809
- ShapeType["images"] = "images";
810
- ShapeType["line"] = "line";
811
- ShapeType["polygon"] = "polygon";
812
- ShapeType["square"] = "square";
813
- ShapeType["star"] = "star";
814
- ShapeType["triangle"] = "triangle";
815
- })(ShapeType || (ShapeType = {}));
816
- var StartValueType;
817
- (function(StartValueType) {
818
- StartValueType["max"] = "max";
819
- StartValueType["min"] = "min";
820
- StartValueType["random"] = "random";
821
- })(StartValueType || (StartValueType = {}));
822
- var DivType;
823
- (function(DivType) {
824
- DivType["circle"] = "circle";
825
- DivType["rectangle"] = "rectangle";
826
- })(DivType || (DivType = {}));
827
- var EasingType;
828
- (function(EasingType) {
829
- EasingType["easeOutBack"] = "ease-out-back";
830
- EasingType["easeOutCirc"] = "ease-out-circ";
831
- EasingType["easeOutCubic"] = "ease-out-cubic";
832
- EasingType["easeOutQuad"] = "ease-out-quad";
833
- EasingType["easeOutQuart"] = "ease-out-quart";
834
- EasingType["easeOutQuint"] = "ease-out-quint";
835
- EasingType["easeOutExpo"] = "ease-out-expo";
836
- EasingType["easeOutSine"] = "ease-out-sine";
837
- })(EasingType || (EasingType = {}));
838
- var OrbitType;
839
- (function(OrbitType) {
840
- OrbitType["front"] = "front";
841
- OrbitType["back"] = "back";
842
- })(OrbitType || (OrbitType = {}));
843
- var InteractivityDetect;
844
- (function(InteractivityDetect) {
845
- InteractivityDetect["canvas"] = "canvas";
846
- InteractivityDetect["parent"] = "parent";
847
- InteractivityDetect["window"] = "window";
848
- })(InteractivityDetect || (InteractivityDetect = {}));
849
- class Vector {
619
+ class Range {
850
620
  constructor(x, y) {
851
- let defX, defY;
852
- if (y === undefined) {
853
- if (typeof x === "number") {
854
- throw new Error("tsParticles - Vector not initialized correctly");
855
- }
856
- const coords = x;
857
- [defX, defY] = [ coords.x, coords.y ];
858
- } else {
859
- [defX, defY] = [ x, y ];
860
- }
861
- this.x = defX;
862
- this.y = defY;
863
- }
864
- static clone(source) {
865
- return Vector.create(source.x, source.y);
866
- }
867
- static create(x, y) {
868
- return new Vector(x, y);
869
- }
870
- static get origin() {
871
- return Vector.create(0, 0);
872
- }
873
- get angle() {
874
- return Math.atan2(this.y, this.x);
875
- }
876
- set angle(angle) {
877
- this.updateFromAngle(angle, this.length);
878
- }
879
- get length() {
880
- return Math.sqrt(this.x ** 2 + this.y ** 2);
881
- }
882
- set length(length) {
883
- this.updateFromAngle(this.angle, length);
884
- }
885
- add(v) {
886
- return Vector.create(this.x + v.x, this.y + v.y);
887
- }
888
- addTo(v) {
889
- this.x += v.x;
890
- this.y += v.y;
891
- }
892
- sub(v) {
893
- return Vector.create(this.x - v.x, this.y - v.y);
894
- }
895
- subFrom(v) {
896
- this.x -= v.x;
897
- this.y -= v.y;
898
- }
899
- mult(n) {
900
- return Vector.create(this.x * n, this.y * n);
901
- }
902
- multTo(n) {
903
- this.x *= n;
904
- this.y *= n;
905
- }
906
- div(n) {
907
- return Vector.create(this.x / n, this.y / n);
908
- }
909
- divTo(n) {
910
- this.x /= n;
911
- this.y /= n;
912
- }
913
- distanceTo(v) {
914
- return this.sub(v).length;
915
- }
916
- getLengthSq() {
917
- return this.x ** 2 + this.y ** 2;
918
- }
919
- distanceToSq(v) {
920
- return this.sub(v).getLengthSq();
921
- }
922
- manhattanDistanceTo(v) {
923
- return Math.abs(v.x - this.x) + Math.abs(v.y - this.y);
924
- }
925
- copy() {
926
- return Vector.clone(this);
927
- }
928
- setTo(velocity) {
929
- this.x = velocity.x;
930
- this.y = velocity.y;
931
- }
932
- rotate(angle) {
933
- return Vector.create(this.x * Math.cos(angle) - this.y * Math.sin(angle), this.x * Math.sin(angle) + this.y * Math.cos(angle));
934
- }
935
- updateFromAngle(angle, length) {
936
- this.x = Math.cos(angle) * length;
937
- this.y = Math.sin(angle) * length;
621
+ this.position = {
622
+ x: x,
623
+ y: y
624
+ };
938
625
  }
939
626
  }
940
627
  function clamp(num, min, max) {
@@ -995,31 +682,31 @@
995
682
  return direction * Math.PI / 180;
996
683
  } else {
997
684
  switch (direction) {
998
- case MoveDirection.top:
685
+ case "top":
999
686
  return -Math.PI / 2;
1000
687
 
1001
- case MoveDirection.topRight:
688
+ case "top-right":
1002
689
  return -Math.PI / 4;
1003
690
 
1004
- case MoveDirection.right:
691
+ case "right":
1005
692
  return 0;
1006
693
 
1007
- case MoveDirection.bottomRight:
694
+ case "bottom-right":
1008
695
  return Math.PI / 4;
1009
696
 
1010
- case MoveDirection.bottom:
697
+ case "bottom":
1011
698
  return Math.PI / 2;
1012
699
 
1013
- case MoveDirection.bottomLeft:
700
+ case "bottom-left":
1014
701
  return 3 * Math.PI / 4;
1015
702
 
1016
- case MoveDirection.left:
703
+ case "left":
1017
704
  return Math.PI;
1018
705
 
1019
- case MoveDirection.topLeft:
706
+ case "top-left":
1020
707
  return -3 * Math.PI / 4;
1021
708
 
1022
- case MoveDirection.none:
709
+ case "none":
1023
710
  default:
1024
711
  return Math.random() * Math.PI * 2;
1025
712
  }
@@ -1036,32 +723,32 @@
1036
723
  }
1037
724
  function calcEasing(value, type) {
1038
725
  switch (type) {
1039
- case EasingType.easeOutQuad:
726
+ case "ease-out-quad":
1040
727
  return 1 - (1 - value) ** 2;
1041
728
 
1042
- case EasingType.easeOutCubic:
729
+ case "ease-out-cubic":
1043
730
  return 1 - (1 - value) ** 3;
1044
731
 
1045
- case EasingType.easeOutQuart:
732
+ case "ease-out-quart":
1046
733
  return 1 - (1 - value) ** 4;
1047
734
 
1048
- case EasingType.easeOutQuint:
735
+ case "ease-out-quint":
1049
736
  return 1 - (1 - value) ** 5;
1050
737
 
1051
- case EasingType.easeOutExpo:
738
+ case "ease-out-expo":
1052
739
  return value === 1 ? 1 : 1 - Math.pow(2, -10 * value);
1053
740
 
1054
- case EasingType.easeOutSine:
741
+ case "ease-out-sine":
1055
742
  return Math.sin(value * Math.PI / 2);
1056
743
 
1057
- case EasingType.easeOutBack:
744
+ case "ease-out-back":
1058
745
  {
1059
746
  const c1 = 1.70158;
1060
747
  const c3 = c1 + 1;
1061
748
  return 1 + c3 * Math.pow(value - 1, 3) + c1 * Math.pow(value - 1, 2);
1062
749
  }
1063
750
 
1064
- case EasingType.easeOutCirc:
751
+ case "ease-out-circ":
1065
752
  return Math.sqrt(1 - Math.pow(value - 1, 2));
1066
753
 
1067
754
  default:
@@ -1122,16 +809,16 @@
1122
809
  }
1123
810
  function areBoundsInside(bounds, size, direction) {
1124
811
  let inside = true;
1125
- if (!direction || direction === OutModeDirection.bottom) {
812
+ if (!direction || direction === "bottom") {
1126
813
  inside = bounds.top < size.height;
1127
814
  }
1128
- if (inside && (!direction || direction === OutModeDirection.left)) {
815
+ if (inside && (!direction || direction === "left")) {
1129
816
  inside = bounds.right > 0;
1130
817
  }
1131
- if (inside && (!direction || direction === OutModeDirection.right)) {
818
+ if (inside && (!direction || direction === "right")) {
1132
819
  inside = bounds.left < size.width;
1133
820
  }
1134
- if (inside && (!direction || direction === OutModeDirection.top)) {
821
+ if (inside && (!direction || direction === "top")) {
1135
822
  inside = bounds.bottom > 0;
1136
823
  }
1137
824
  return inside;
@@ -1222,14 +909,11 @@
1222
909
  };
1223
910
  }
1224
911
  function circleBounce(p1, p2) {
1225
- const xVelocityDiff = p1.velocity.x;
1226
- const yVelocityDiff = p1.velocity.y;
1227
- const pos1 = p1.position;
1228
- const pos2 = p2.position;
1229
- const xDist = pos2.x - pos1.x;
1230
- const yDist = pos2.y - pos1.y;
912
+ const {x: xVelocityDiff, y: yVelocityDiff} = p1.velocity.sub(p2.velocity);
913
+ const [pos1, pos2] = [ p1.position, p2.position ];
914
+ const {dx: xDist, dy: yDist} = getDistances(pos2, pos1);
1231
915
  if (xVelocityDiff * xDist + yVelocityDiff * yDist >= 0) {
1232
- const angle = -Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x);
916
+ const angle = -Math.atan2(yDist, xDist);
1233
917
  const m1 = p1.mass;
1234
918
  const m2 = p2.mass;
1235
919
  const u1 = p1.velocity.rotate(angle);
@@ -1291,23 +975,6 @@
1291
975
  }
1292
976
  }
1293
977
  }
1294
- class Constants {}
1295
- Constants.canvasClass = "tsparticles-canvas-el";
1296
- Constants.randomColorValue = "random";
1297
- Constants.midColorValue = "mid";
1298
- Constants.touchEndEvent = "touchend";
1299
- Constants.mouseDownEvent = "mousedown";
1300
- Constants.mouseUpEvent = "mouseup";
1301
- Constants.mouseMoveEvent = "mousemove";
1302
- Constants.touchStartEvent = "touchstart";
1303
- Constants.touchMoveEvent = "touchmove";
1304
- Constants.mouseLeaveEvent = "mouseleave";
1305
- Constants.mouseOutEvent = "mouseout";
1306
- Constants.touchCancelEvent = "touchcancel";
1307
- Constants.resizeEvent = "resize";
1308
- Constants.visibilityChangeEvent = "visibilitychange";
1309
- Constants.noPolygonDataLoaded = "No polygon data loaded.";
1310
- Constants.noPolygonFound = "No polygon found, you need to specify SVG url in config.";
1311
978
  function hue2rgb(p, q, t) {
1312
979
  let tCalc = t;
1313
980
  if (tCalc < 0) {
@@ -1717,7 +1384,7 @@
1717
1384
  if (colorAnimation.sync) {
1718
1385
  return;
1719
1386
  }
1720
- colorValue.status = AnimationStatus.increasing;
1387
+ colorValue.status = 0;
1721
1388
  colorValue.velocity *= Math.random();
1722
1389
  if (colorValue.value) {
1723
1390
  colorValue.value *= Math.random();
@@ -1880,8 +1547,8 @@
1880
1547
  if (tiltOptions.enable || rollOptions.enable) {
1881
1548
  const roll = rollOptions.enable && particle.roll;
1882
1549
  const tilt = tiltOptions.enable && particle.tilt;
1883
- const rollHorizontal = roll && (rollOptions.mode === RollMode.horizontal || rollOptions.mode === RollMode.both);
1884
- const rollVertical = roll && (rollOptions.mode === RollMode.vertical || rollOptions.mode === RollMode.both);
1550
+ const rollHorizontal = roll && (rollOptions.mode === "horizontal" || rollOptions.mode === "both");
1551
+ const rollVertical = roll && (rollOptions.mode === "vertical" || rollOptions.mode === "both");
1885
1552
  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);
1886
1553
  } else {
1887
1554
  context.translate(pos.x, pos.y);
@@ -1903,7 +1570,7 @@
1903
1570
  }
1904
1571
  if (gradient) {
1905
1572
  const gradientAngle = gradient.angle.value;
1906
- const fillGradient = gradient.type === GradientType.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);
1573
+ 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);
1907
1574
  for (const color of gradient.colors) {
1908
1575
  fillGradient.addColorStop(color.stop, getStyleFromHsl({
1909
1576
  h: color.value.h.value,
@@ -2001,17 +1668,9 @@
2001
1668
  return {
2002
1669
  h: color.h,
2003
1670
  s: color.s,
2004
- l: color.l + (type === AlterType.darken ? -1 : 1) * value
1671
+ l: color.l + (type === "darken" ? -1 : 1) * value
2005
1672
  };
2006
1673
  }
2007
- class Range {
2008
- constructor(x, y) {
2009
- this.position = {
2010
- x: x,
2011
- y: y
2012
- };
2013
- }
2014
- }
2015
1674
  class Circle extends Range {
2016
1675
  constructor(x, y, radius) {
2017
1676
  super(x, y);
@@ -2132,6 +1791,23 @@
2132
1791
  return false;
2133
1792
  }
2134
1793
  }
1794
+ class Constants {}
1795
+ Constants.generatedAttribute = "generated";
1796
+ Constants.randomColorValue = "random";
1797
+ Constants.midColorValue = "mid";
1798
+ Constants.touchEndEvent = "touchend";
1799
+ Constants.mouseDownEvent = "mousedown";
1800
+ Constants.mouseUpEvent = "mouseup";
1801
+ Constants.mouseMoveEvent = "mousemove";
1802
+ Constants.touchStartEvent = "touchstart";
1803
+ Constants.touchMoveEvent = "touchmove";
1804
+ Constants.mouseLeaveEvent = "mouseleave";
1805
+ Constants.mouseOutEvent = "mouseout";
1806
+ Constants.touchCancelEvent = "touchcancel";
1807
+ Constants.resizeEvent = "resize";
1808
+ Constants.visibilityChangeEvent = "visibilitychange";
1809
+ Constants.noPolygonDataLoaded = "No polygon data loaded.";
1810
+ Constants.noPolygonFound = "No polygon found, you need to specify SVG url in config.";
2135
1811
  function manageListener(element, event, handler, add, options) {
2136
1812
  if (add) {
2137
1813
  let addOptions = {
@@ -2178,10 +1854,10 @@
2178
1854
  const options = container.actualOptions;
2179
1855
  const detectType = options.interactivity.detectsOn;
2180
1856
  let mouseLeaveEvent = Constants.mouseLeaveEvent;
2181
- if (detectType === InteractivityDetect.window) {
1857
+ if (detectType === "window") {
2182
1858
  container.interactivity.element = window;
2183
1859
  mouseLeaveEvent = Constants.mouseOutEvent;
2184
- } else if (detectType === InteractivityDetect.parent && container.canvas.element) {
1860
+ } else if (detectType === "parent" && container.canvas.element) {
2185
1861
  const canvasEl = container.canvas.element;
2186
1862
  container.interactivity.element = (_a = canvasEl.parentElement) !== null && _a !== void 0 ? _a : canvasEl.parentNode;
2187
1863
  } else {
@@ -2252,9 +1928,9 @@
2252
1928
  clearTimeout(this.resizeTimeout);
2253
1929
  delete this.resizeTimeout;
2254
1930
  }
2255
- this.resizeTimeout = setTimeout((() => {
1931
+ this.resizeTimeout = setTimeout((async () => {
2256
1932
  var _a;
2257
- return (_a = this.container.canvas) === null || _a === void 0 ? void 0 : _a.windowResize();
1933
+ return await ((_a = this.container.canvas) === null || _a === void 0 ? void 0 : _a.windowResize());
2258
1934
  }), 500);
2259
1935
  }
2260
1936
  handleVisibilityChange() {
@@ -2305,7 +1981,7 @@
2305
1981
  y: mouseEvent.clientY - clientRect.top
2306
1982
  };
2307
1983
  }
2308
- } else if (options.interactivity.detectsOn === InteractivityDetect.parent) {
1984
+ } else if (options.interactivity.detectsOn === "parent") {
2309
1985
  const source = mouseEvent.target;
2310
1986
  const target = mouseEvent.currentTarget;
2311
1987
  const canvasEl = container.canvas.element;
@@ -2426,7 +2102,7 @@
2426
2102
  const pushNb = options.interactivity.modes.push.quantity;
2427
2103
  const removeNb = options.interactivity.modes.remove.quantity;
2428
2104
  switch (mode) {
2429
- case ClickMode.push:
2105
+ case "push":
2430
2106
  {
2431
2107
  if (pushNb > 0) {
2432
2108
  const pushOptions = options.interactivity.modes.push;
@@ -2437,15 +2113,15 @@
2437
2113
  break;
2438
2114
  }
2439
2115
 
2440
- case ClickMode.remove:
2116
+ case "remove":
2441
2117
  container.particles.removeQuantity(removeNb);
2442
2118
  break;
2443
2119
 
2444
- case ClickMode.bubble:
2120
+ case "bubble":
2445
2121
  container.bubble.clicking = true;
2446
2122
  break;
2447
2123
 
2448
- case ClickMode.repulse:
2124
+ case "repulse":
2449
2125
  container.repulse.clicking = true;
2450
2126
  container.repulse.count = 0;
2451
2127
  for (const particle of container.repulse.particles) {
@@ -2460,7 +2136,7 @@
2460
2136
  }), options.interactivity.modes.repulse.duration * 1e3);
2461
2137
  break;
2462
2138
 
2463
- case ClickMode.attract:
2139
+ case "attract":
2464
2140
  container.attract.clicking = true;
2465
2141
  container.attract.count = 0;
2466
2142
  for (const particle of container.attract.particles) {
@@ -2475,7 +2151,7 @@
2475
2151
  }), options.interactivity.modes.attract.duration * 1e3);
2476
2152
  break;
2477
2153
 
2478
- case ClickMode.pause:
2154
+ case "pause":
2479
2155
  if (container.getAnimationStatus()) {
2480
2156
  container.pause();
2481
2157
  } else {
@@ -2490,47 +2166,308 @@
2490
2166
  }
2491
2167
  }
2492
2168
  }
2493
- const plugins = [];
2494
- const interactorsInitializers = new Map;
2495
- const updatersInitializers = new Map;
2496
- const interactors = new Map;
2497
- const updaters = new Map;
2498
- const presets = new Map;
2499
- const drawers = new Map;
2500
- const pathGenerators = new Map;
2501
- class Plugins {
2502
- static getPlugin(plugin) {
2503
- return plugins.find((t => t.id === plugin));
2169
+ class ExternalInteractorBase {
2170
+ constructor(container) {
2171
+ this.container = container;
2172
+ this.type = 0;
2504
2173
  }
2505
- static addPlugin(plugin) {
2506
- if (!Plugins.getPlugin(plugin.id)) {
2507
- plugins.push(plugin);
2508
- }
2174
+ }
2175
+ class FrameManager {
2176
+ constructor(container) {
2177
+ this.container = container;
2509
2178
  }
2510
- static getAvailablePlugins(container) {
2511
- const res = new Map;
2512
- for (const plugin of plugins) {
2513
- if (!plugin.needsPlugin(container.actualOptions)) {
2514
- continue;
2179
+ nextFrame(timestamp) {
2180
+ var _a;
2181
+ try {
2182
+ const container = this.container;
2183
+ if (container.lastFrameTime !== undefined && timestamp < container.lastFrameTime + 1e3 / container.fpsLimit) {
2184
+ container.draw(false);
2185
+ return;
2515
2186
  }
2516
- res.set(plugin.id, plugin.getPlugin(container));
2187
+ (_a = container.lastFrameTime) !== null && _a !== void 0 ? _a : container.lastFrameTime = timestamp;
2188
+ const deltaValue = timestamp - container.lastFrameTime;
2189
+ const delta = {
2190
+ value: deltaValue,
2191
+ factor: 60 * deltaValue / 1e3
2192
+ };
2193
+ container.lifeTime += delta.value;
2194
+ container.lastFrameTime = timestamp;
2195
+ if (deltaValue > 1e3) {
2196
+ container.draw(false);
2197
+ return;
2198
+ }
2199
+ container.particles.draw(delta);
2200
+ if (container.duration > 0 && container.lifeTime > container.duration) {
2201
+ container.destroy();
2202
+ return;
2203
+ }
2204
+ if (container.getAnimationStatus()) {
2205
+ container.draw(false);
2206
+ }
2207
+ } catch (e) {
2208
+ console.error("tsParticles error in animation loop", e);
2517
2209
  }
2518
- return res;
2519
2210
  }
2520
- static loadOptions(options, sourceOptions) {
2521
- for (const plugin of plugins) {
2522
- plugin.loadOptions(options, sourceOptions);
2523
- }
2211
+ }
2212
+ class InteractionManager {
2213
+ constructor(container) {
2214
+ this.container = container;
2215
+ this.externalInteractors = [];
2216
+ this.particleInteractors = [];
2217
+ this.init();
2524
2218
  }
2525
- static getPreset(preset) {
2526
- return presets.get(preset);
2219
+ init() {
2220
+ const interactors = Plugins.getInteractors(this.container, true);
2221
+ for (const interactor of interactors) {
2222
+ switch (interactor.type) {
2223
+ case 0:
2224
+ this.externalInteractors.push(interactor);
2225
+ break;
2226
+
2227
+ case 1:
2228
+ this.particleInteractors.push(interactor);
2229
+ break;
2230
+ }
2231
+ }
2527
2232
  }
2528
- static addPreset(presetKey, options, override = false) {
2529
- if (override || !Plugins.getPreset(presetKey)) {
2530
- presets.set(presetKey, options);
2233
+ externalInteract(delta) {
2234
+ for (const interactor of this.externalInteractors) {
2235
+ if (interactor.isEnabled()) {
2236
+ interactor.interact(delta);
2237
+ }
2531
2238
  }
2532
2239
  }
2533
- static addShapeDrawer(type, drawer) {
2240
+ particlesInteract(particle, delta) {
2241
+ for (const interactor of this.externalInteractors) {
2242
+ interactor.reset(particle);
2243
+ }
2244
+ for (const interactor of this.particleInteractors) {
2245
+ if (interactor.isEnabled(particle)) {
2246
+ interactor.interact(particle, delta);
2247
+ }
2248
+ }
2249
+ }
2250
+ }
2251
+ class ParticlesInteractorBase {
2252
+ constructor(container) {
2253
+ this.container = container;
2254
+ this.type = 1;
2255
+ }
2256
+ }
2257
+ function applyDistance(particle) {
2258
+ const initialPosition = particle.initialPosition;
2259
+ const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
2260
+ const dxFixed = Math.abs(dx), dyFixed = Math.abs(dy);
2261
+ const hDistance = particle.retina.maxDistance.horizontal;
2262
+ const vDistance = particle.retina.maxDistance.vertical;
2263
+ if (!hDistance && !vDistance) {
2264
+ return;
2265
+ }
2266
+ if ((hDistance && dxFixed >= hDistance || vDistance && dyFixed >= vDistance) && !particle.misplaced) {
2267
+ particle.misplaced = !!hDistance && dxFixed > hDistance || !!vDistance && dyFixed > vDistance;
2268
+ if (hDistance) {
2269
+ particle.velocity.x = particle.velocity.y / 2 - particle.velocity.x;
2270
+ }
2271
+ if (vDistance) {
2272
+ particle.velocity.y = particle.velocity.x / 2 - particle.velocity.y;
2273
+ }
2274
+ } else if ((!hDistance || dxFixed < hDistance) && (!vDistance || dyFixed < vDistance) && particle.misplaced) {
2275
+ particle.misplaced = false;
2276
+ } else if (particle.misplaced) {
2277
+ const pos = particle.position, vel = particle.velocity;
2278
+ if (hDistance && (pos.x < initialPosition.x && vel.x < 0 || pos.x > initialPosition.x && vel.x > 0)) {
2279
+ vel.x *= -Math.random();
2280
+ }
2281
+ if (vDistance && (pos.y < initialPosition.y && vel.y < 0 || pos.y > initialPosition.y && vel.y > 0)) {
2282
+ vel.y *= -Math.random();
2283
+ }
2284
+ }
2285
+ }
2286
+ class ParticlesMover {
2287
+ constructor(container) {
2288
+ this.container = container;
2289
+ }
2290
+ move(particle, delta) {
2291
+ if (particle.destroyed) {
2292
+ return;
2293
+ }
2294
+ this.moveParticle(particle, delta);
2295
+ this.moveParallax(particle);
2296
+ }
2297
+ moveParticle(particle, delta) {
2298
+ var _a, _b, _c;
2299
+ var _d, _e;
2300
+ const particleOptions = particle.options;
2301
+ const moveOptions = particleOptions.move;
2302
+ if (!moveOptions.enable) {
2303
+ return;
2304
+ }
2305
+ 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;
2306
+ this.applyPath(particle, delta);
2307
+ const gravityOptions = moveOptions.gravity;
2308
+ const gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
2309
+ if (gravityOptions.enable && moveSpeed) {
2310
+ particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (60 * moveSpeed);
2311
+ }
2312
+ if (moveDrift && moveSpeed) {
2313
+ particle.velocity.x += moveDrift * delta.factor / (60 * moveSpeed);
2314
+ }
2315
+ const decay = particle.moveDecay;
2316
+ if (decay != 1) {
2317
+ particle.velocity.multTo(decay);
2318
+ }
2319
+ const velocity = particle.velocity.mult(moveSpeed);
2320
+ const maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
2321
+ if (gravityOptions.enable && gravityOptions.maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
2322
+ velocity.y = gravityFactor * maxSpeed;
2323
+ if (moveSpeed) {
2324
+ particle.velocity.y = velocity.y / moveSpeed;
2325
+ }
2326
+ }
2327
+ const zIndexOptions = particle.options.zIndex, zVelocityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
2328
+ if (moveOptions.spin.enable) {
2329
+ this.spin(particle, moveSpeed);
2330
+ } else {
2331
+ if (zVelocityFactor != 1) {
2332
+ velocity.multTo(zVelocityFactor);
2333
+ }
2334
+ particle.position.addTo(velocity);
2335
+ if (moveOptions.vibrate) {
2336
+ particle.position.x += Math.sin(particle.position.x * Math.cos(particle.position.y));
2337
+ particle.position.y += Math.cos(particle.position.y * Math.sin(particle.position.x));
2338
+ }
2339
+ }
2340
+ applyDistance(particle);
2341
+ }
2342
+ spin(particle, moveSpeed) {
2343
+ const container = this.container;
2344
+ if (!particle.spin) {
2345
+ return;
2346
+ }
2347
+ const updateFunc = {
2348
+ x: particle.spin.direction === "clockwise" ? Math.cos : Math.sin,
2349
+ y: particle.spin.direction === "clockwise" ? Math.sin : Math.cos
2350
+ };
2351
+ particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
2352
+ particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
2353
+ particle.spin.radius += particle.spin.acceleration;
2354
+ const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height);
2355
+ if (particle.spin.radius > maxCanvasSize / 2) {
2356
+ particle.spin.radius = maxCanvasSize / 2;
2357
+ particle.spin.acceleration *= -1;
2358
+ } else if (particle.spin.radius < 0) {
2359
+ particle.spin.radius = 0;
2360
+ particle.spin.acceleration *= -1;
2361
+ }
2362
+ particle.spin.angle += moveSpeed / 100 * (1 - particle.spin.radius / maxCanvasSize);
2363
+ }
2364
+ applyPath(particle, delta) {
2365
+ const particlesOptions = particle.options;
2366
+ const pathOptions = particlesOptions.move.path;
2367
+ const pathEnabled = pathOptions.enable;
2368
+ if (!pathEnabled) {
2369
+ return;
2370
+ }
2371
+ const container = this.container;
2372
+ if (particle.lastPathTime <= particle.pathDelay) {
2373
+ particle.lastPathTime += delta.value;
2374
+ return;
2375
+ }
2376
+ const path = container.pathGenerator.generate(particle);
2377
+ particle.velocity.addTo(path);
2378
+ if (pathOptions.clamp) {
2379
+ particle.velocity.x = clamp(particle.velocity.x, -1, 1);
2380
+ particle.velocity.y = clamp(particle.velocity.y, -1, 1);
2381
+ }
2382
+ particle.lastPathTime -= particle.pathDelay;
2383
+ }
2384
+ moveParallax(particle) {
2385
+ const container = this.container;
2386
+ const options = container.actualOptions;
2387
+ if (isSsr() || !options.interactivity.events.onHover.parallax.enable) {
2388
+ return;
2389
+ }
2390
+ const parallaxForce = options.interactivity.events.onHover.parallax.force;
2391
+ const mousePos = container.interactivity.mouse.position;
2392
+ if (!mousePos) {
2393
+ return;
2394
+ }
2395
+ const canvasCenter = {
2396
+ x: container.canvas.size.width / 2,
2397
+ y: container.canvas.size.height / 2
2398
+ };
2399
+ const parallaxSmooth = options.interactivity.events.onHover.parallax.smooth;
2400
+ const factor = particle.getRadius() / parallaxForce;
2401
+ const tmp = {
2402
+ x: (mousePos.x - canvasCenter.x) * factor,
2403
+ y: (mousePos.y - canvasCenter.y) * factor
2404
+ };
2405
+ particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth;
2406
+ particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth;
2407
+ }
2408
+ getProximitySpeedFactor(particle) {
2409
+ const container = this.container;
2410
+ const options = container.actualOptions;
2411
+ const active = isInArray("slow", options.interactivity.events.onHover.mode);
2412
+ if (!active) {
2413
+ return 1;
2414
+ }
2415
+ const mousePos = this.container.interactivity.mouse.position;
2416
+ if (!mousePos) {
2417
+ return 1;
2418
+ }
2419
+ const particlePos = particle.getPosition();
2420
+ const dist = getDistance(mousePos, particlePos);
2421
+ const radius = container.retina.slowModeRadius;
2422
+ if (dist > radius) {
2423
+ return 1;
2424
+ }
2425
+ const proximityFactor = dist / radius || 0;
2426
+ const slowFactor = options.interactivity.modes.slow.factor;
2427
+ return proximityFactor / slowFactor;
2428
+ }
2429
+ }
2430
+ const plugins = [];
2431
+ const interactorsInitializers = new Map;
2432
+ const updatersInitializers = new Map;
2433
+ const interactors = new Map;
2434
+ const updaters = new Map;
2435
+ const presets = new Map;
2436
+ const drawers = new Map;
2437
+ const pathGenerators = new Map;
2438
+ class Plugins {
2439
+ static getPlugin(plugin) {
2440
+ return plugins.find((t => t.id === plugin));
2441
+ }
2442
+ static addPlugin(plugin) {
2443
+ if (!Plugins.getPlugin(plugin.id)) {
2444
+ plugins.push(plugin);
2445
+ }
2446
+ }
2447
+ static getAvailablePlugins(container) {
2448
+ const res = new Map;
2449
+ for (const plugin of plugins) {
2450
+ if (!plugin.needsPlugin(container.actualOptions)) {
2451
+ continue;
2452
+ }
2453
+ res.set(plugin.id, plugin.getPlugin(container));
2454
+ }
2455
+ return res;
2456
+ }
2457
+ static loadOptions(options, sourceOptions) {
2458
+ for (const plugin of plugins) {
2459
+ plugin.loadOptions(options, sourceOptions);
2460
+ }
2461
+ }
2462
+ static getPreset(preset) {
2463
+ return presets.get(preset);
2464
+ }
2465
+ static addPreset(presetKey, options, override = false) {
2466
+ if (override || !Plugins.getPreset(presetKey)) {
2467
+ presets.set(presetKey, options);
2468
+ }
2469
+ }
2470
+ static addShapeDrawer(type, drawer) {
2534
2471
  if (!Plugins.getShapeDrawer(type)) {
2535
2472
  drawers.set(type, drawer);
2536
2473
  }
@@ -2644,6 +2581,150 @@
2644
2581
  return res;
2645
2582
  }
2646
2583
  }
2584
+ class Vector {
2585
+ constructor(x, y) {
2586
+ let defX, defY;
2587
+ if (y === undefined) {
2588
+ if (typeof x === "number") {
2589
+ throw new Error("tsParticles - Vector not initialized correctly");
2590
+ }
2591
+ const coords = x;
2592
+ [defX, defY] = [ coords.x, coords.y ];
2593
+ } else {
2594
+ [defX, defY] = [ x, y ];
2595
+ }
2596
+ this.x = defX;
2597
+ this.y = defY;
2598
+ }
2599
+ static clone(source) {
2600
+ return Vector.create(source.x, source.y);
2601
+ }
2602
+ static create(x, y) {
2603
+ return new Vector(x, y);
2604
+ }
2605
+ static get origin() {
2606
+ return Vector.create(0, 0);
2607
+ }
2608
+ get angle() {
2609
+ return Math.atan2(this.y, this.x);
2610
+ }
2611
+ set angle(angle) {
2612
+ this.updateFromAngle(angle, this.length);
2613
+ }
2614
+ get length() {
2615
+ return Math.sqrt(this.x ** 2 + this.y ** 2);
2616
+ }
2617
+ set length(length) {
2618
+ this.updateFromAngle(this.angle, length);
2619
+ }
2620
+ add(v) {
2621
+ return Vector.create(this.x + v.x, this.y + v.y);
2622
+ }
2623
+ addTo(v) {
2624
+ this.x += v.x;
2625
+ this.y += v.y;
2626
+ }
2627
+ sub(v) {
2628
+ return Vector.create(this.x - v.x, this.y - v.y);
2629
+ }
2630
+ subFrom(v) {
2631
+ this.x -= v.x;
2632
+ this.y -= v.y;
2633
+ }
2634
+ mult(n) {
2635
+ return Vector.create(this.x * n, this.y * n);
2636
+ }
2637
+ multTo(n) {
2638
+ this.x *= n;
2639
+ this.y *= n;
2640
+ }
2641
+ div(n) {
2642
+ return Vector.create(this.x / n, this.y / n);
2643
+ }
2644
+ divTo(n) {
2645
+ this.x /= n;
2646
+ this.y /= n;
2647
+ }
2648
+ distanceTo(v) {
2649
+ return this.sub(v).length;
2650
+ }
2651
+ getLengthSq() {
2652
+ return this.x ** 2 + this.y ** 2;
2653
+ }
2654
+ distanceToSq(v) {
2655
+ return this.sub(v).getLengthSq();
2656
+ }
2657
+ manhattanDistanceTo(v) {
2658
+ return Math.abs(v.x - this.x) + Math.abs(v.y - this.y);
2659
+ }
2660
+ copy() {
2661
+ return Vector.clone(this);
2662
+ }
2663
+ setTo(velocity) {
2664
+ this.x = velocity.x;
2665
+ this.y = velocity.y;
2666
+ }
2667
+ rotate(angle) {
2668
+ return Vector.create(this.x * Math.cos(angle) - this.y * Math.sin(angle), this.x * Math.sin(angle) + this.y * Math.cos(angle));
2669
+ }
2670
+ updateFromAngle(angle, length) {
2671
+ this.x = Math.cos(angle) * length;
2672
+ this.y = Math.sin(angle) * length;
2673
+ }
2674
+ }
2675
+ class Vector3d extends Vector {
2676
+ constructor(x, y, z) {
2677
+ super(x, y);
2678
+ this.z = z === undefined ? x.z : z;
2679
+ }
2680
+ static clone(source) {
2681
+ return Vector3d.create(source.x, source.y, source.z);
2682
+ }
2683
+ static create(x, y, z) {
2684
+ return new Vector3d(x, y, z);
2685
+ }
2686
+ add(v) {
2687
+ return v instanceof Vector3d ? Vector3d.create(this.x + v.x, this.y + v.y, this.z + v.z) : super.add(v);
2688
+ }
2689
+ addTo(v) {
2690
+ super.addTo(v);
2691
+ if (v instanceof Vector3d) {
2692
+ this.z += v.z;
2693
+ }
2694
+ }
2695
+ sub(v) {
2696
+ return v instanceof Vector3d ? Vector3d.create(this.x - v.x, this.y - v.y, this.z - v.z) : super.sub(v);
2697
+ }
2698
+ subFrom(v) {
2699
+ super.subFrom(v);
2700
+ if (v instanceof Vector3d) {
2701
+ this.z -= v.z;
2702
+ }
2703
+ }
2704
+ mult(n) {
2705
+ return Vector3d.create(this.x * n, this.y * n, this.z * n);
2706
+ }
2707
+ multTo(n) {
2708
+ super.multTo(n);
2709
+ this.z *= n;
2710
+ }
2711
+ div(n) {
2712
+ return Vector3d.create(this.x / n, this.y / n, this.z / n);
2713
+ }
2714
+ divTo(n) {
2715
+ super.divTo(n);
2716
+ this.z /= n;
2717
+ }
2718
+ copy() {
2719
+ return Vector3d.clone(this);
2720
+ }
2721
+ setTo(v) {
2722
+ super.setTo(v);
2723
+ if (v instanceof Vector3d) {
2724
+ this.z = v.z;
2725
+ }
2726
+ }
2727
+ }
2647
2728
  class Canvas {
2648
2729
  constructor(container) {
2649
2730
  this.container = container;
@@ -2662,15 +2743,12 @@
2662
2743
  this.initBackground();
2663
2744
  this.paint();
2664
2745
  }
2665
- loadCanvas(canvas, generatedCanvas) {
2746
+ loadCanvas(canvas) {
2666
2747
  var _a;
2667
- if (!canvas.className) {
2668
- canvas.className = Constants.canvasClass;
2669
- }
2670
2748
  if (this.generatedCanvas) {
2671
2749
  (_a = this.element) === null || _a === void 0 ? void 0 : _a.remove();
2672
2750
  }
2673
- this.generatedCanvas = generatedCanvas !== null && generatedCanvas !== void 0 ? generatedCanvas : this.generatedCanvas;
2751
+ this.generatedCanvas = canvas.dataset && Constants.generatedAttribute in canvas.dataset ? canvas.dataset[Constants.generatedAttribute] === "true" : this.generatedCanvas;
2674
2752
  this.element = canvas;
2675
2753
  this.originalStyle = deepExtend({}, this.element.style);
2676
2754
  this.size.height = canvas.offsetHeight;
@@ -2712,7 +2790,7 @@
2712
2790
  }));
2713
2791
  }
2714
2792
  }
2715
- windowResize() {
2793
+ async windowResize() {
2716
2794
  if (!this.element) {
2717
2795
  return;
2718
2796
  }
@@ -2726,7 +2804,7 @@
2726
2804
  }
2727
2805
  }
2728
2806
  if (needsRefresh) {
2729
- container.refresh();
2807
+ await container.refresh();
2730
2808
  }
2731
2809
  }
2732
2810
  resize() {
@@ -2913,12 +2991,12 @@
2913
2991
  const originalStyle = this.originalStyle;
2914
2992
  if (options.fullScreen.enable) {
2915
2993
  this.originalStyle = deepExtend({}, element.style);
2916
- element.style.position = "fixed";
2917
- element.style.zIndex = options.fullScreen.zIndex.toString(10);
2918
- element.style.top = "0";
2919
- element.style.left = "0";
2920
- element.style.width = "100%";
2921
- element.style.height = "100%";
2994
+ element.style.setProperty("position", "fixed", "important");
2995
+ element.style.setProperty("z-index", options.fullScreen.zIndex.toString(10), "important");
2996
+ element.style.setProperty("top", "0", "important");
2997
+ element.style.setProperty("left", "0", "important");
2998
+ element.style.setProperty("width", "100%", "important");
2999
+ element.style.setProperty("height", "100%", "important");
2922
3000
  } else if (originalStyle) {
2923
3001
  element.style.position = originalStyle.position;
2924
3002
  element.style.zIndex = originalStyle.zIndex;
@@ -2927,6 +3005,16 @@
2927
3005
  element.style.width = originalStyle.width;
2928
3006
  element.style.height = originalStyle.height;
2929
3007
  }
3008
+ for (const key in options.style) {
3009
+ if (!key || !options.style) {
3010
+ continue;
3011
+ }
3012
+ const value = options.style[key];
3013
+ if (!value) {
3014
+ continue;
3015
+ }
3016
+ element.style.setProperty(key, value, "important");
3017
+ }
2930
3018
  }
2931
3019
  paintBase(baseColor) {
2932
3020
  this.draw((ctx => {
@@ -3230,7 +3318,7 @@
3230
3318
  }
3231
3319
  class OutModes {
3232
3320
  constructor() {
3233
- this.default = OutMode.out;
3321
+ this.default = "out";
3234
3322
  }
3235
3323
  load(data) {
3236
3324
  var _a, _b, _c, _d;
@@ -3270,7 +3358,7 @@
3270
3358
  this.attract = new Attract;
3271
3359
  this.decay = 0;
3272
3360
  this.distance = {};
3273
- this.direction = MoveDirection.none;
3361
+ this.direction = "none";
3274
3362
  this.drift = 0;
3275
3363
  this.enable = false;
3276
3364
  this.gravity = new MoveGravity;
@@ -3462,10 +3550,10 @@
3462
3550
  class OpacityAnimation extends AnimationOptions {
3463
3551
  constructor() {
3464
3552
  super();
3465
- this.destroy = DestroyType.none;
3553
+ this.destroy = "none";
3466
3554
  this.enable = false;
3467
3555
  this.speed = 2;
3468
- this.startValue = StartValueType.random;
3556
+ this.startValue = "random";
3469
3557
  this.sync = false;
3470
3558
  }
3471
3559
  get opacity_min() {
@@ -3527,15 +3615,15 @@
3527
3615
  class Shape {
3528
3616
  constructor() {
3529
3617
  this.options = {};
3530
- this.type = ShapeType.circle;
3618
+ this.type = "circle";
3531
3619
  }
3532
3620
  get image() {
3533
3621
  var _a;
3534
- return (_a = this.options[ShapeType.image]) !== null && _a !== void 0 ? _a : this.options[ShapeType.images];
3622
+ return (_a = this.options["image"]) !== null && _a !== void 0 ? _a : this.options["images"];
3535
3623
  }
3536
3624
  set image(value) {
3537
- this.options[ShapeType.image] = value;
3538
- this.options[ShapeType.images] = value;
3625
+ this.options["image"] = value;
3626
+ this.options["images"] = value;
3539
3627
  }
3540
3628
  get custom() {
3541
3629
  return this.options;
@@ -3555,19 +3643,19 @@
3555
3643
  set stroke(_value) {}
3556
3644
  get character() {
3557
3645
  var _a;
3558
- return (_a = this.options[ShapeType.character]) !== null && _a !== void 0 ? _a : this.options[ShapeType.char];
3646
+ return (_a = this.options["character"]) !== null && _a !== void 0 ? _a : this.options["char"];
3559
3647
  }
3560
3648
  set character(value) {
3561
- this.options[ShapeType.character] = value;
3562
- this.options[ShapeType.char] = value;
3649
+ this.options["character"] = value;
3650
+ this.options["char"] = value;
3563
3651
  }
3564
3652
  get polygon() {
3565
3653
  var _a;
3566
- return (_a = this.options[ShapeType.polygon]) !== null && _a !== void 0 ? _a : this.options[ShapeType.star];
3654
+ return (_a = this.options["polygon"]) !== null && _a !== void 0 ? _a : this.options["star"];
3567
3655
  }
3568
3656
  set polygon(value) {
3569
- this.options[ShapeType.polygon] = value;
3570
- this.options[ShapeType.star] = value;
3657
+ this.options["polygon"] = value;
3658
+ this.options["star"] = value;
3571
3659
  }
3572
3660
  load(data) {
3573
3661
  var _a, _b, _c;
@@ -3583,9 +3671,9 @@
3583
3671
  }
3584
3672
  }
3585
3673
  }
3586
- this.loadShape(data.character, ShapeType.character, ShapeType.char, true);
3587
- this.loadShape(data.polygon, ShapeType.polygon, ShapeType.star, false);
3588
- this.loadShape((_c = data.image) !== null && _c !== void 0 ? _c : data.images, ShapeType.image, ShapeType.images, true);
3674
+ this.loadShape(data.character, "character", "char", true);
3675
+ this.loadShape(data.polygon, "polygon", "star", false);
3676
+ this.loadShape((_c = data.image) !== null && _c !== void 0 ? _c : data.images, "image", "images", true);
3589
3677
  if (data.type !== undefined) {
3590
3678
  this.type = data.type;
3591
3679
  }
@@ -3623,10 +3711,10 @@
3623
3711
  class SizeAnimation extends AnimationOptions {
3624
3712
  constructor() {
3625
3713
  super();
3626
- this.destroy = DestroyType.none;
3714
+ this.destroy = "none";
3627
3715
  this.enable = false;
3628
3716
  this.speed = 5;
3629
- this.startValue = StartValueType.random;
3717
+ this.startValue = "random";
3630
3718
  this.sync = false;
3631
3719
  }
3632
3720
  get size_min() {
@@ -3710,7 +3798,7 @@
3710
3798
  constructor() {
3711
3799
  super();
3712
3800
  this.animation = new RotateAnimation;
3713
- this.direction = RotateDirection.clockwise;
3801
+ this.direction = "clockwise";
3714
3802
  this.path = false;
3715
3803
  this.value = 0;
3716
3804
  }
@@ -3899,7 +3987,7 @@
3899
3987
  constructor() {
3900
3988
  this.bounce = new Bounce;
3901
3989
  this.enable = false;
3902
- this.mode = CollisionMode.bounce;
3990
+ this.mode = "bounce";
3903
3991
  this.overlap = new CollisionsOverlap;
3904
3992
  }
3905
3993
  load(data) {
@@ -4042,7 +4130,7 @@
4042
4130
  }
4043
4131
  class Destroy {
4044
4132
  constructor() {
4045
- this.mode = DestroyMode.none;
4133
+ this.mode = "none";
4046
4134
  this.split = new Split;
4047
4135
  }
4048
4136
  load(data) {
@@ -4101,7 +4189,7 @@
4101
4189
  constructor() {
4102
4190
  super();
4103
4191
  this.animation = new TiltAnimation;
4104
- this.direction = TiltDirection.clockwise;
4192
+ this.direction = "clockwise";
4105
4193
  this.enable = false;
4106
4194
  this.value = 0;
4107
4195
  }
@@ -4141,7 +4229,7 @@
4141
4229
  this.darken = new RollLight;
4142
4230
  this.enable = false;
4143
4231
  this.enlighten = new RollLight;
4144
- this.mode = RollMode.vertical;
4232
+ this.mode = "vertical";
4145
4233
  this.speed = 25;
4146
4234
  }
4147
4235
  load(data) {
@@ -4267,7 +4355,7 @@
4267
4355
  constructor() {
4268
4356
  this.angle = new GradientAngle;
4269
4357
  this.colors = [];
4270
- this.type = GradientType.random;
4358
+ this.type = "random";
4271
4359
  }
4272
4360
  load(data) {
4273
4361
  if (!data) {
@@ -4290,7 +4378,7 @@
4290
4378
  constructor() {
4291
4379
  this.value = 0;
4292
4380
  this.animation = new GradientAngleAnimation;
4293
- this.direction = RotateDirection.clockwise;
4381
+ this.direction = "clockwise";
4294
4382
  }
4295
4383
  load(data) {
4296
4384
  if (!data) {
@@ -4374,7 +4462,7 @@
4374
4462
  this.enable = false;
4375
4463
  this.speed = 0;
4376
4464
  this.sync = false;
4377
- this.startValue = StartValueType.random;
4465
+ this.startValue = "random";
4378
4466
  }
4379
4467
  load(data) {
4380
4468
  if (!data) {
@@ -4478,90 +4566,37 @@
4478
4566
  if (collisions !== undefined) {
4479
4567
  this.collisions.enable = collisions;
4480
4568
  }
4481
- this.collisions.load(data.collisions);
4482
- const strokeToLoad = (_g = data.stroke) !== null && _g !== void 0 ? _g : (_h = data.shape) === null || _h === void 0 ? void 0 : _h.stroke;
4483
- if (strokeToLoad) {
4484
- if (strokeToLoad instanceof Array) {
4485
- this.stroke = strokeToLoad.map((s => {
4486
- const tmp = new Stroke;
4487
- tmp.load(s);
4488
- return tmp;
4489
- }));
4490
- } else {
4491
- if (this.stroke instanceof Array) {
4492
- this.stroke = new Stroke;
4493
- }
4494
- this.stroke.load(strokeToLoad);
4495
- }
4496
- }
4497
- const gradientToLoad = data.gradient;
4498
- if (gradientToLoad) {
4499
- if (gradientToLoad instanceof Array) {
4500
- this.gradient = gradientToLoad.map((s => {
4501
- const tmp = new AnimatableGradient;
4502
- tmp.load(s);
4503
- return tmp;
4504
- }));
4505
- } else {
4506
- if (this.gradient instanceof Array) {
4507
- this.gradient = new AnimatableGradient;
4508
- }
4509
- this.gradient.load(gradientToLoad);
4510
- }
4511
- }
4512
- }
4513
- }
4514
- class Vector3d extends Vector {
4515
- constructor(x, y, z) {
4516
- super(x, y);
4517
- this.z = z === undefined ? x.z : z;
4518
- }
4519
- static clone(source) {
4520
- return Vector3d.create(source.x, source.y, source.z);
4521
- }
4522
- static create(x, y, z) {
4523
- return new Vector3d(x, y, z);
4524
- }
4525
- add(v) {
4526
- return v instanceof Vector3d ? Vector3d.create(this.x + v.x, this.y + v.y, this.z + v.z) : super.add(v);
4527
- }
4528
- addTo(v) {
4529
- super.addTo(v);
4530
- if (v instanceof Vector3d) {
4531
- this.z += v.z;
4532
- }
4533
- }
4534
- sub(v) {
4535
- return v instanceof Vector3d ? Vector3d.create(this.x - v.x, this.y - v.y, this.z - v.z) : super.sub(v);
4536
- }
4537
- subFrom(v) {
4538
- super.subFrom(v);
4539
- if (v instanceof Vector3d) {
4540
- this.z -= v.z;
4541
- }
4542
- }
4543
- mult(n) {
4544
- return Vector3d.create(this.x * n, this.y * n, this.z * n);
4545
- }
4546
- multTo(n) {
4547
- super.multTo(n);
4548
- this.z *= n;
4549
- }
4550
- div(n) {
4551
- return Vector3d.create(this.x / n, this.y / n, this.z / n);
4552
- }
4553
- divTo(n) {
4554
- super.divTo(n);
4555
- this.z /= n;
4556
- }
4557
- copy() {
4558
- return Vector3d.clone(this);
4559
- }
4560
- setTo(v) {
4561
- super.setTo(v);
4562
- if (v instanceof Vector3d) {
4563
- this.z = v.z;
4564
- }
4569
+ this.collisions.load(data.collisions);
4570
+ const strokeToLoad = (_g = data.stroke) !== null && _g !== void 0 ? _g : (_h = data.shape) === null || _h === void 0 ? void 0 : _h.stroke;
4571
+ if (strokeToLoad) {
4572
+ if (strokeToLoad instanceof Array) {
4573
+ this.stroke = strokeToLoad.map((s => {
4574
+ const tmp = new Stroke;
4575
+ tmp.load(s);
4576
+ return tmp;
4577
+ }));
4578
+ } else {
4579
+ if (this.stroke instanceof Array) {
4580
+ this.stroke = new Stroke;
4581
+ }
4582
+ this.stroke.load(strokeToLoad);
4583
+ }
4584
+ }
4585
+ const gradientToLoad = data.gradient;
4586
+ if (gradientToLoad) {
4587
+ if (gradientToLoad instanceof Array) {
4588
+ this.gradient = gradientToLoad.map((s => {
4589
+ const tmp = new AnimatableGradient;
4590
+ tmp.load(s);
4591
+ return tmp;
4592
+ }));
4593
+ } else {
4594
+ if (this.gradient instanceof Array) {
4595
+ this.gradient = new AnimatableGradient;
4596
+ }
4597
+ this.gradient.load(gradientToLoad);
4598
+ }
4599
+ }
4565
4600
  }
4566
4601
  }
4567
4602
  const fixOutMode = data => {
@@ -4632,22 +4667,22 @@
4632
4667
  };
4633
4668
  const sizeAnimation = sizeOptions.animation;
4634
4669
  if (sizeAnimation.enable) {
4635
- this.size.status = AnimationStatus.increasing;
4670
+ this.size.status = 0;
4636
4671
  switch (sizeAnimation.startValue) {
4637
- case StartValueType.min:
4672
+ case "min":
4638
4673
  this.size.value = this.size.min;
4639
- this.size.status = AnimationStatus.increasing;
4674
+ this.size.status = 0;
4640
4675
  break;
4641
4676
 
4642
- case StartValueType.random:
4677
+ case "random":
4643
4678
  this.size.value = randomInRange(this.size) * pxRatio;
4644
- this.size.status = Math.random() >= .5 ? AnimationStatus.increasing : AnimationStatus.decreasing;
4679
+ this.size.status = Math.random() >= .5 ? 0 : 1;
4645
4680
  break;
4646
4681
 
4647
- case StartValueType.max:
4682
+ case "max":
4648
4683
  default:
4649
4684
  this.size.value = this.size.max;
4650
- this.size.status = AnimationStatus.decreasing;
4685
+ this.size.status = 1;
4651
4686
  break;
4652
4687
  }
4653
4688
  this.size.velocity = ((_g = this.retina.sizeAnimationSpeed) !== null && _g !== void 0 ? _g : container.retina.sizeAnimationSpeed) / 100 * container.retina.reduceFactor;
@@ -4699,7 +4734,7 @@
4699
4734
  const distance = getDistance(pos, spinCenter);
4700
4735
  this.spin = {
4701
4736
  center: spinCenter,
4702
- direction: this.velocity.x >= 0 ? RotateDirection.clockwise : RotateDirection.counterClockwise,
4737
+ direction: this.velocity.x >= 0 ? "clockwise" : "counter-clockwise",
4703
4738
  angle: this.velocity.angle,
4704
4739
  radius: distance,
4705
4740
  acceleration: (_j = this.retina.spinAcceleration) !== null && _j !== void 0 ? _j : getRangeValue(this.options.move.spin.acceleration)
@@ -4775,353 +4810,141 @@
4775
4810
  if (this.unbreakable) {
4776
4811
  return;
4777
4812
  }
4778
- this.destroyed = true;
4779
- this.bubble.inRange = false;
4780
- for (const [, plugin] of this.container.plugins) {
4781
- if (plugin.particleDestroyed) {
4782
- plugin.particleDestroyed(this, override);
4783
- }
4784
- }
4785
- if (override) {
4786
- return;
4787
- }
4788
- const destroyOptions = this.options.destroy;
4789
- if (destroyOptions.mode === DestroyMode.split) {
4790
- this.split();
4791
- }
4792
- }
4793
- reset() {
4794
- if (this.opacity) {
4795
- this.opacity.loops = 0;
4796
- }
4797
- this.size.loops = 0;
4798
- }
4799
- split() {
4800
- const splitOptions = this.options.destroy.split;
4801
- if (splitOptions.count >= 0 && this.splitCount++ > splitOptions.count) {
4802
- return;
4803
- }
4804
- const rate = getRangeValue(splitOptions.rate.value);
4805
- for (let i = 0; i < rate; i++) {
4806
- this.container.particles.addSplitParticle(this);
4807
- }
4808
- }
4809
- calcPosition(container, position, zIndex, tryCount = 0) {
4810
- var _a, _b, _c, _d, _e, _f;
4811
- for (const [, plugin] of container.plugins) {
4812
- const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
4813
- if (pluginPos !== undefined) {
4814
- return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
4815
- }
4816
- }
4817
- const canvasSize = container.canvas.size;
4818
- 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);
4819
- const radius = this.getRadius();
4820
- const outModes = this.options.move.outModes, fixHorizontal = outMode => {
4821
- fixOutMode({
4822
- outMode: outMode,
4823
- checkModes: [ OutMode.bounce, OutMode.bounceHorizontal ],
4824
- coord: pos.x,
4825
- maxCoord: container.canvas.size.width,
4826
- setCb: value => pos.x += value,
4827
- radius: radius
4828
- });
4829
- }, fixVertical = outMode => {
4830
- fixOutMode({
4831
- outMode: outMode,
4832
- checkModes: [ OutMode.bounce, OutMode.bounceVertical ],
4833
- coord: pos.y,
4834
- maxCoord: container.canvas.size.height,
4835
- setCb: value => pos.y += value,
4836
- radius: radius
4837
- });
4838
- };
4839
- fixHorizontal((_c = outModes.left) !== null && _c !== void 0 ? _c : outModes.default);
4840
- fixHorizontal((_d = outModes.right) !== null && _d !== void 0 ? _d : outModes.default);
4841
- fixVertical((_e = outModes.top) !== null && _e !== void 0 ? _e : outModes.default);
4842
- fixVertical((_f = outModes.bottom) !== null && _f !== void 0 ? _f : outModes.default);
4843
- if (this.checkOverlap(pos, tryCount)) {
4844
- return this.calcPosition(container, undefined, zIndex, tryCount + 1);
4845
- }
4846
- return pos;
4847
- }
4848
- checkOverlap(pos, tryCount = 0) {
4849
- const collisionsOptions = this.options.collisions;
4850
- const radius = this.getRadius();
4851
- if (!collisionsOptions.enable) {
4852
- return false;
4853
- }
4854
- const overlapOptions = collisionsOptions.overlap;
4855
- if (overlapOptions.enable) {
4856
- return false;
4857
- }
4858
- const retries = overlapOptions.retries;
4859
- if (retries >= 0 && tryCount > retries) {
4860
- throw new Error("Particle is overlapping and can't be placed");
4861
- }
4862
- let overlaps = false;
4863
- for (const particle of this.container.particles.array) {
4864
- if (getDistance(pos, particle.position) < radius + particle.getRadius()) {
4865
- overlaps = true;
4866
- break;
4867
- }
4868
- }
4869
- return overlaps;
4870
- }
4871
- calculateVelocity() {
4872
- const baseVelocity = getParticleBaseVelocity(this.direction);
4873
- const res = baseVelocity.copy();
4874
- const moveOptions = this.options.move;
4875
- const rad = Math.PI / 180 * moveOptions.angle.value;
4876
- const radOffset = Math.PI / 180 * moveOptions.angle.offset;
4877
- const range = {
4878
- left: radOffset - rad / 2,
4879
- right: radOffset + rad / 2
4880
- };
4881
- if (!moveOptions.straight) {
4882
- res.angle += randomInRange(setRangeValue(range.left, range.right));
4883
- }
4884
- if (moveOptions.random && typeof moveOptions.speed === "number") {
4885
- res.length *= Math.random();
4886
- }
4887
- return res;
4888
- }
4889
- loadShapeData(shapeOptions, reduceDuplicates) {
4890
- const shapeData = shapeOptions.options[this.shape];
4891
- if (shapeData) {
4892
- return deepExtend({}, shapeData instanceof Array ? itemFromArray(shapeData, this.id, reduceDuplicates) : shapeData);
4893
- }
4894
- }
4895
- loadLife() {
4896
- const container = this.container;
4897
- const particlesOptions = this.options;
4898
- const lifeOptions = particlesOptions.life;
4899
- const life = {
4900
- delay: container.retina.reduceFactor ? getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1e3 : 0,
4901
- delayTime: 0,
4902
- duration: container.retina.reduceFactor ? getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1e3 : 0,
4903
- time: 0,
4904
- count: particlesOptions.life.count
4905
- };
4906
- if (life.duration <= 0) {
4907
- life.duration = -1;
4908
- }
4909
- if (life.count <= 0) {
4910
- life.count = -1;
4911
- }
4912
- return life;
4913
- }
4914
- }
4915
- class InteractionManager {
4916
- constructor(container) {
4917
- this.container = container;
4918
- this.externalInteractors = [];
4919
- this.particleInteractors = [];
4920
- this.init();
4921
- }
4922
- init() {
4923
- const interactors = Plugins.getInteractors(this.container, true);
4924
- for (const interactor of interactors) {
4925
- switch (interactor.type) {
4926
- case InteractorType.External:
4927
- this.externalInteractors.push(interactor);
4928
- break;
4929
-
4930
- case InteractorType.Particles:
4931
- this.particleInteractors.push(interactor);
4932
- break;
4933
- }
4934
- }
4935
- }
4936
- externalInteract(delta) {
4937
- for (const interactor of this.externalInteractors) {
4938
- if (interactor.isEnabled()) {
4939
- interactor.interact(delta);
4940
- }
4941
- }
4942
- }
4943
- particlesInteract(particle, delta) {
4944
- for (const interactor of this.externalInteractors) {
4945
- interactor.reset(particle);
4946
- }
4947
- for (const interactor of this.particleInteractors) {
4948
- if (interactor.isEnabled(particle)) {
4949
- interactor.interact(particle, delta);
4950
- }
4951
- }
4952
- }
4953
- }
4954
- function applyDistance(particle) {
4955
- const initialPosition = particle.initialPosition;
4956
- const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
4957
- const dxFixed = Math.abs(dx), dyFixed = Math.abs(dy);
4958
- const hDistance = particle.retina.maxDistance.horizontal;
4959
- const vDistance = particle.retina.maxDistance.vertical;
4960
- if (!hDistance && !vDistance) {
4961
- return;
4962
- }
4963
- if ((hDistance && dxFixed >= hDistance || vDistance && dyFixed >= vDistance) && !particle.misplaced) {
4964
- particle.misplaced = !!hDistance && dxFixed > hDistance || !!vDistance && dyFixed > vDistance;
4965
- if (hDistance) {
4966
- particle.velocity.x = particle.velocity.y / 2 - particle.velocity.x;
4967
- }
4968
- if (vDistance) {
4969
- particle.velocity.y = particle.velocity.x / 2 - particle.velocity.y;
4970
- }
4971
- } else if ((!hDistance || dxFixed < hDistance) && (!vDistance || dyFixed < vDistance) && particle.misplaced) {
4972
- particle.misplaced = false;
4973
- } else if (particle.misplaced) {
4974
- const pos = particle.position, vel = particle.velocity;
4975
- if (hDistance && (pos.x < initialPosition.x && vel.x < 0 || pos.x > initialPosition.x && vel.x > 0)) {
4976
- vel.x *= -Math.random();
4977
- }
4978
- if (vDistance && (pos.y < initialPosition.y && vel.y < 0 || pos.y > initialPosition.y && vel.y > 0)) {
4979
- vel.y *= -Math.random();
4980
- }
4981
- }
4982
- }
4983
- class Mover {
4984
- constructor(container) {
4985
- this.container = container;
4986
- }
4987
- move(particle, delta) {
4988
- if (particle.destroyed) {
4989
- return;
4990
- }
4991
- this.moveParticle(particle, delta);
4992
- this.moveParallax(particle);
4993
- }
4994
- moveParticle(particle, delta) {
4995
- var _a, _b, _c;
4996
- var _d, _e;
4997
- const particleOptions = particle.options;
4998
- const moveOptions = particleOptions.move;
4999
- if (!moveOptions.enable) {
5000
- return;
5001
- }
5002
- 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;
5003
- this.applyPath(particle, delta);
5004
- const gravityOptions = moveOptions.gravity;
5005
- const gravityFactor = gravityOptions.enable && gravityOptions.inverse ? -1 : 1;
5006
- if (gravityOptions.enable && moveSpeed) {
5007
- particle.velocity.y += gravityFactor * (gravityOptions.acceleration * delta.factor) / (60 * moveSpeed);
5008
- }
5009
- if (moveDrift && moveSpeed) {
5010
- particle.velocity.x += moveDrift * delta.factor / (60 * moveSpeed);
4813
+ this.destroyed = true;
4814
+ this.bubble.inRange = false;
4815
+ for (const [, plugin] of this.container.plugins) {
4816
+ if (plugin.particleDestroyed) {
4817
+ plugin.particleDestroyed(this, override);
4818
+ }
5011
4819
  }
5012
- const decay = particle.moveDecay;
5013
- if (decay != 1) {
5014
- particle.velocity.multTo(decay);
4820
+ if (override) {
4821
+ return;
5015
4822
  }
5016
- const velocity = particle.velocity.mult(moveSpeed);
5017
- const maxSpeed = (_c = particle.retina.maxSpeed) !== null && _c !== void 0 ? _c : container.retina.maxSpeed;
5018
- if (gravityOptions.enable && gravityOptions.maxSpeed > 0 && (!gravityOptions.inverse && velocity.y >= 0 && velocity.y >= maxSpeed || gravityOptions.inverse && velocity.y <= 0 && velocity.y <= -maxSpeed)) {
5019
- velocity.y = gravityFactor * maxSpeed;
5020
- if (moveSpeed) {
5021
- particle.velocity.y = velocity.y / moveSpeed;
5022
- }
4823
+ const destroyOptions = this.options.destroy;
4824
+ if (destroyOptions.mode === "split") {
4825
+ this.split();
5023
4826
  }
5024
- const zIndexOptions = particle.options.zIndex, zVelocityFactor = (1 - particle.zIndexFactor) ** zIndexOptions.velocityRate;
5025
- if (moveOptions.spin.enable) {
5026
- this.spin(particle, moveSpeed);
5027
- } else {
5028
- if (zVelocityFactor != 1) {
5029
- velocity.multTo(zVelocityFactor);
5030
- }
5031
- particle.position.addTo(velocity);
5032
- if (moveOptions.vibrate) {
5033
- particle.position.x += Math.sin(particle.position.x * Math.cos(particle.position.y));
5034
- particle.position.y += Math.cos(particle.position.y * Math.sin(particle.position.x));
5035
- }
4827
+ }
4828
+ reset() {
4829
+ if (this.opacity) {
4830
+ this.opacity.loops = 0;
5036
4831
  }
5037
- applyDistance(particle);
4832
+ this.size.loops = 0;
5038
4833
  }
5039
- spin(particle, moveSpeed) {
5040
- const container = this.container;
5041
- if (!particle.spin) {
4834
+ split() {
4835
+ const splitOptions = this.options.destroy.split;
4836
+ if (splitOptions.count >= 0 && this.splitCount++ > splitOptions.count) {
5042
4837
  return;
5043
4838
  }
5044
- const updateFunc = {
5045
- x: particle.spin.direction === RotateDirection.clockwise ? Math.cos : Math.sin,
5046
- y: particle.spin.direction === RotateDirection.clockwise ? Math.sin : Math.cos
4839
+ const rate = getRangeValue(splitOptions.rate.value);
4840
+ for (let i = 0; i < rate; i++) {
4841
+ this.container.particles.addSplitParticle(this);
4842
+ }
4843
+ }
4844
+ calcPosition(container, position, zIndex, tryCount = 0) {
4845
+ var _a, _b, _c, _d, _e, _f;
4846
+ for (const [, plugin] of container.plugins) {
4847
+ const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
4848
+ if (pluginPos !== undefined) {
4849
+ return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
4850
+ }
4851
+ }
4852
+ const canvasSize = container.canvas.size;
4853
+ 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);
4854
+ const radius = this.getRadius();
4855
+ const outModes = this.options.move.outModes, fixHorizontal = outMode => {
4856
+ fixOutMode({
4857
+ outMode: outMode,
4858
+ checkModes: [ "bounce", "bounce-horizontal" ],
4859
+ coord: pos.x,
4860
+ maxCoord: container.canvas.size.width,
4861
+ setCb: value => pos.x += value,
4862
+ radius: radius
4863
+ });
4864
+ }, fixVertical = outMode => {
4865
+ fixOutMode({
4866
+ outMode: outMode,
4867
+ checkModes: [ "bounce", "bounce-vertical" ],
4868
+ coord: pos.y,
4869
+ maxCoord: container.canvas.size.height,
4870
+ setCb: value => pos.y += value,
4871
+ radius: radius
4872
+ });
5047
4873
  };
5048
- particle.position.x = particle.spin.center.x + particle.spin.radius * updateFunc.x(particle.spin.angle);
5049
- particle.position.y = particle.spin.center.y + particle.spin.radius * updateFunc.y(particle.spin.angle);
5050
- particle.spin.radius += particle.spin.acceleration;
5051
- const maxCanvasSize = Math.max(container.canvas.size.width, container.canvas.size.height);
5052
- if (particle.spin.radius > maxCanvasSize / 2) {
5053
- particle.spin.radius = maxCanvasSize / 2;
5054
- particle.spin.acceleration *= -1;
5055
- } else if (particle.spin.radius < 0) {
5056
- particle.spin.radius = 0;
5057
- particle.spin.acceleration *= -1;
4874
+ fixHorizontal((_c = outModes.left) !== null && _c !== void 0 ? _c : outModes.default);
4875
+ fixHorizontal((_d = outModes.right) !== null && _d !== void 0 ? _d : outModes.default);
4876
+ fixVertical((_e = outModes.top) !== null && _e !== void 0 ? _e : outModes.default);
4877
+ fixVertical((_f = outModes.bottom) !== null && _f !== void 0 ? _f : outModes.default);
4878
+ if (this.checkOverlap(pos, tryCount)) {
4879
+ return this.calcPosition(container, undefined, zIndex, tryCount + 1);
5058
4880
  }
5059
- particle.spin.angle += moveSpeed / 100 * (1 - particle.spin.radius / maxCanvasSize);
4881
+ return pos;
5060
4882
  }
5061
- applyPath(particle, delta) {
5062
- const particlesOptions = particle.options;
5063
- const pathOptions = particlesOptions.move.path;
5064
- const pathEnabled = pathOptions.enable;
5065
- if (!pathEnabled) {
5066
- return;
4883
+ checkOverlap(pos, tryCount = 0) {
4884
+ const collisionsOptions = this.options.collisions;
4885
+ const radius = this.getRadius();
4886
+ if (!collisionsOptions.enable) {
4887
+ return false;
5067
4888
  }
5068
- const container = this.container;
5069
- if (particle.lastPathTime <= particle.pathDelay) {
5070
- particle.lastPathTime += delta.value;
5071
- return;
4889
+ const overlapOptions = collisionsOptions.overlap;
4890
+ if (overlapOptions.enable) {
4891
+ return false;
5072
4892
  }
5073
- const path = container.pathGenerator.generate(particle);
5074
- particle.velocity.addTo(path);
5075
- if (pathOptions.clamp) {
5076
- particle.velocity.x = clamp(particle.velocity.x, -1, 1);
5077
- particle.velocity.y = clamp(particle.velocity.y, -1, 1);
4893
+ const retries = overlapOptions.retries;
4894
+ if (retries >= 0 && tryCount > retries) {
4895
+ throw new Error("Particle is overlapping and can't be placed");
5078
4896
  }
5079
- particle.lastPathTime -= particle.pathDelay;
4897
+ let overlaps = false;
4898
+ for (const particle of this.container.particles.array) {
4899
+ if (getDistance(pos, particle.position) < radius + particle.getRadius()) {
4900
+ overlaps = true;
4901
+ break;
4902
+ }
4903
+ }
4904
+ return overlaps;
5080
4905
  }
5081
- moveParallax(particle) {
5082
- const container = this.container;
5083
- const options = container.actualOptions;
5084
- if (isSsr() || !options.interactivity.events.onHover.parallax.enable) {
5085
- return;
4906
+ calculateVelocity() {
4907
+ const baseVelocity = getParticleBaseVelocity(this.direction);
4908
+ const res = baseVelocity.copy();
4909
+ const moveOptions = this.options.move;
4910
+ const rad = Math.PI / 180 * moveOptions.angle.value;
4911
+ const radOffset = Math.PI / 180 * moveOptions.angle.offset;
4912
+ const range = {
4913
+ left: radOffset - rad / 2,
4914
+ right: radOffset + rad / 2
4915
+ };
4916
+ if (!moveOptions.straight) {
4917
+ res.angle += randomInRange(setRangeValue(range.left, range.right));
5086
4918
  }
5087
- const parallaxForce = options.interactivity.events.onHover.parallax.force;
5088
- const mousePos = container.interactivity.mouse.position;
5089
- if (!mousePos) {
5090
- return;
4919
+ if (moveOptions.random && typeof moveOptions.speed === "number") {
4920
+ res.length *= Math.random();
5091
4921
  }
5092
- const canvasCenter = {
5093
- x: container.canvas.size.width / 2,
5094
- y: container.canvas.size.height / 2
5095
- };
5096
- const parallaxSmooth = options.interactivity.events.onHover.parallax.smooth;
5097
- const factor = particle.getRadius() / parallaxForce;
5098
- const tmp = {
5099
- x: (mousePos.x - canvasCenter.x) * factor,
5100
- y: (mousePos.y - canvasCenter.y) * factor
5101
- };
5102
- particle.offset.x += (tmp.x - particle.offset.x) / parallaxSmooth;
5103
- particle.offset.y += (tmp.y - particle.offset.y) / parallaxSmooth;
4922
+ return res;
5104
4923
  }
5105
- getProximitySpeedFactor(particle) {
5106
- const container = this.container;
5107
- const options = container.actualOptions;
5108
- const active = isInArray(HoverMode.slow, options.interactivity.events.onHover.mode);
5109
- if (!active) {
5110
- return 1;
4924
+ loadShapeData(shapeOptions, reduceDuplicates) {
4925
+ const shapeData = shapeOptions.options[this.shape];
4926
+ if (shapeData) {
4927
+ return deepExtend({}, shapeData instanceof Array ? itemFromArray(shapeData, this.id, reduceDuplicates) : shapeData);
5111
4928
  }
5112
- const mousePos = this.container.interactivity.mouse.position;
5113
- if (!mousePos) {
5114
- return 1;
4929
+ }
4930
+ loadLife() {
4931
+ const container = this.container;
4932
+ const particlesOptions = this.options;
4933
+ const lifeOptions = particlesOptions.life;
4934
+ const life = {
4935
+ delay: container.retina.reduceFactor ? getRangeValue(lifeOptions.delay.value) * (lifeOptions.delay.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1e3 : 0,
4936
+ delayTime: 0,
4937
+ duration: container.retina.reduceFactor ? getRangeValue(lifeOptions.duration.value) * (lifeOptions.duration.sync ? 1 : Math.random()) / container.retina.reduceFactor * 1e3 : 0,
4938
+ time: 0,
4939
+ count: particlesOptions.life.count
4940
+ };
4941
+ if (life.duration <= 0) {
4942
+ life.duration = -1;
5115
4943
  }
5116
- const particlePos = particle.getPosition();
5117
- const dist = getDistance(mousePos, particlePos);
5118
- const radius = container.retina.slowModeRadius;
5119
- if (dist > radius) {
5120
- return 1;
4944
+ if (life.count <= 0) {
4945
+ life.count = -1;
5121
4946
  }
5122
- const proximityFactor = dist / radius || 0;
5123
- const slowFactor = options.interactivity.modes.slow.factor;
5124
- return proximityFactor / slowFactor;
4947
+ return life;
5125
4948
  }
5126
4949
  }
5127
4950
  class Particles {
@@ -5130,7 +4953,7 @@
5130
4953
  this.nextId = 0;
5131
4954
  this.array = [];
5132
4955
  this.zArray = [];
5133
- this.mover = new Mover(container);
4956
+ this.mover = new ParticlesMover(container);
5134
4957
  this.limit = 0;
5135
4958
  this.needsSort = false;
5136
4959
  this.lastZIndex = 0;
@@ -5284,9 +5107,7 @@
5284
5107
  this.pushing = false;
5285
5108
  }
5286
5109
  addParticle(position, overrideOptions, group) {
5287
- const container = this.container;
5288
- const options = container.actualOptions;
5289
- const limit = options.particles.number.limit * container.density;
5110
+ const container = this.container, options = container.actualOptions, limit = options.particles.number.limit * container.density;
5290
5111
  if (limit > 0) {
5291
5112
  const countToRemove = this.count + 1 - limit;
5292
5113
  if (countToRemove > 0) {
@@ -5296,8 +5117,7 @@
5296
5117
  return this.pushParticle(position, overrideOptions, group);
5297
5118
  }
5298
5119
  addSplitParticle(parent) {
5299
- const splitOptions = parent.options.destroy.split;
5300
- const options = new ParticlesOptions;
5120
+ const splitOptions = parent.options.destroy.split, options = new ParticlesOptions;
5301
5121
  options.load(parent.options);
5302
5122
  const factor = getRangeValue(splitOptions.factor.value);
5303
5123
  options.color.load({
@@ -5334,7 +5154,7 @@
5334
5154
  this.removeAt(0, quantity, group);
5335
5155
  }
5336
5156
  getLinkFrequency(p1, p2) {
5337
- const key = `${Math.min(p1.id, p2.id)}_${Math.max(p1.id, p2.id)}`;
5157
+ const range = setRangeValue(p1.id, p2.id), key = `${getRangeMin(range)}_${getRangeMax(range)}`;
5338
5158
  let res = this.freqs.links.get(key);
5339
5159
  if (res === undefined) {
5340
5160
  res = Math.random();
@@ -5362,8 +5182,7 @@
5362
5182
  return res;
5363
5183
  }
5364
5184
  addManualParticles() {
5365
- const container = this.container;
5366
- const options = container.actualOptions;
5185
+ const container = this.container, options = container.actualOptions;
5367
5186
  for (const particle of options.manualParticles) {
5368
5187
  const pos = particle.position ? {
5369
5188
  x: particle.position.x * container.canvas.size.width / 100,
@@ -5402,8 +5221,7 @@
5402
5221
  if (!container.canvas.element || !densityOptions.enable) {
5403
5222
  return 1;
5404
5223
  }
5405
- const canvas = container.canvas.element;
5406
- const pxRatio = container.retina.pixelRatio;
5224
+ const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
5407
5225
  return canvas.width * canvas.height / (densityOptions.factor * pxRatio ** 2 * densityOptions.area);
5408
5226
  }
5409
5227
  pushParticle(position, overrideOptions, group, initializer) {
@@ -5503,50 +5321,13 @@
5503
5321
  maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
5504
5322
  props.maxSpeed = options.move.gravity.maxSpeed * ratio;
5505
5323
  }
5506
- handleMotionChange(mediaQuery) {
5507
- const options = this.container.actualOptions;
5508
- if (mediaQuery.matches) {
5509
- const motion = options.motion;
5510
- this.reduceFactor = motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1;
5511
- } else {
5512
- this.reduceFactor = 1;
5513
- }
5514
- }
5515
- }
5516
- class FrameManager {
5517
- constructor(container) {
5518
- this.container = container;
5519
- }
5520
- nextFrame(timestamp) {
5521
- var _a;
5522
- try {
5523
- const container = this.container;
5524
- if (container.lastFrameTime !== undefined && timestamp < container.lastFrameTime + 1e3 / container.fpsLimit) {
5525
- container.draw(false);
5526
- return;
5527
- }
5528
- (_a = container.lastFrameTime) !== null && _a !== void 0 ? _a : container.lastFrameTime = timestamp;
5529
- const deltaValue = timestamp - container.lastFrameTime;
5530
- const delta = {
5531
- value: deltaValue,
5532
- factor: 60 * deltaValue / 1e3
5533
- };
5534
- container.lifeTime += delta.value;
5535
- container.lastFrameTime = timestamp;
5536
- if (deltaValue > 1e3) {
5537
- container.draw(false);
5538
- return;
5539
- }
5540
- container.particles.draw(delta);
5541
- if (container.duration > 0 && container.lifeTime > container.duration) {
5542
- container.destroy();
5543
- return;
5544
- }
5545
- if (container.getAnimationStatus()) {
5546
- container.draw(false);
5547
- }
5548
- } catch (e) {
5549
- console.error("tsParticles error in animation loop", e);
5324
+ handleMotionChange(mediaQuery) {
5325
+ const options = this.container.actualOptions;
5326
+ if (mediaQuery.matches) {
5327
+ const motion = options.motion;
5328
+ this.reduceFactor = motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1;
5329
+ } else {
5330
+ this.reduceFactor = 1;
5550
5331
  }
5551
5332
  }
5552
5333
  }
@@ -5572,7 +5353,7 @@
5572
5353
  this.selectors = [];
5573
5354
  this.enable = false;
5574
5355
  this.mode = [];
5575
- this.type = DivType.circle;
5356
+ this.type = "circle";
5576
5357
  }
5577
5358
  get elementId() {
5578
5359
  return this.ids;
@@ -5941,7 +5722,7 @@
5941
5722
  this.factor = 100;
5942
5723
  this.speed = 1;
5943
5724
  this.maxSpeed = 50;
5944
- this.easing = EasingType.easeOutQuad;
5725
+ this.easing = "ease-out-quad";
5945
5726
  }
5946
5727
  load(data) {
5947
5728
  if (!data) {
@@ -6068,7 +5849,7 @@
6068
5849
  constructor() {
6069
5850
  this.distance = 200;
6070
5851
  this.duration = .4;
6071
- this.easing = EasingType.easeOutQuad;
5852
+ this.easing = "ease-out-quad";
6072
5853
  this.factor = 1;
6073
5854
  this.maxSpeed = 50;
6074
5855
  this.speed = 1;
@@ -6201,7 +5982,7 @@
6201
5982
  }
6202
5983
  class Interactivity {
6203
5984
  constructor() {
6204
- this.detectsOn = InteractivityDetect.window;
5985
+ this.detectsOn = "window";
6205
5986
  this.events = new Events;
6206
5987
  this.modes = new Modes;
6207
5988
  }
@@ -6224,11 +6005,11 @@
6224
6005
  this.modes.load(data.modes);
6225
6006
  if (((_c = (_b = data.modes) === null || _b === void 0 ? void 0 : _b.slow) === null || _c === void 0 ? void 0 : _c.active) === true) {
6226
6007
  if (this.events.onHover.mode instanceof Array) {
6227
- if (this.events.onHover.mode.indexOf(HoverMode.slow) < 0) {
6228
- this.events.onHover.mode.push(HoverMode.slow);
6008
+ if (this.events.onHover.mode.indexOf("slow") < 0) {
6009
+ this.events.onHover.mode.push("slow");
6229
6010
  }
6230
- } else if (this.events.onHover.mode !== HoverMode.slow) {
6231
- this.events.onHover.mode = [ this.events.onHover.mode, HoverMode.slow ];
6011
+ } else if (this.events.onHover.mode !== "slow") {
6012
+ this.events.onHover.mode = [ this.events.onHover.mode, "slow" ];
6232
6013
  }
6233
6014
  }
6234
6015
  }
@@ -6314,7 +6095,7 @@
6314
6095
  class ThemeDefault {
6315
6096
  constructor() {
6316
6097
  this.auto = false;
6317
- this.mode = ThemeMode.any;
6098
+ this.mode = "any";
6318
6099
  this.value = false;
6319
6100
  }
6320
6101
  load(data) {
@@ -6420,7 +6201,7 @@
6420
6201
  constructor() {
6421
6202
  this.maxWidth = Infinity;
6422
6203
  this.options = {};
6423
- this.mode = ResponsiveMode.canvas;
6204
+ this.mode = "canvas";
6424
6205
  }
6425
6206
  load(data) {
6426
6207
  if (!data) {
@@ -6430,10 +6211,10 @@
6430
6211
  this.maxWidth = data.maxWidth;
6431
6212
  }
6432
6213
  if (data.mode !== undefined) {
6433
- if (data.mode === ResponsiveMode.screen) {
6434
- this.mode = ResponsiveMode.screen;
6214
+ if (data.mode === "screen") {
6215
+ this.mode = "screen";
6435
6216
  } else {
6436
- this.mode = ResponsiveMode.canvas;
6217
+ this.mode = "canvas";
6437
6218
  }
6438
6219
  }
6439
6220
  if (data.options !== undefined) {
@@ -6464,6 +6245,7 @@
6464
6245
  this.pauseOnBlur = true;
6465
6246
  this.pauseOnOutsideViewport = true;
6466
6247
  this.responsive = [];
6248
+ this.style = {};
6467
6249
  this.themes = [];
6468
6250
  this.zLayers = 100;
6469
6251
  }
@@ -6540,6 +6322,7 @@
6540
6322
  }
6541
6323
  this.motion.load(data.motion);
6542
6324
  this.particles.load(data.particles);
6325
+ this.style = deepExtend(this.style, data.style);
6543
6326
  Plugins.loadOptions(this, data);
6544
6327
  if (data.responsive !== undefined) {
6545
6328
  for (const responsive of data.responsive) {
@@ -6556,8 +6339,8 @@
6556
6339
  this.themes.push(optTheme);
6557
6340
  }
6558
6341
  }
6559
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, ThemeMode.dark)) === null || _d === void 0 ? void 0 : _d.name;
6560
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, ThemeMode.light)) === null || _e === void 0 ? void 0 : _e.name;
6342
+ this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
6343
+ this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
6561
6344
  }
6562
6345
  setTheme(name) {
6563
6346
  if (name) {
@@ -6566,7 +6349,7 @@
6566
6349
  this.load(chosenTheme.options);
6567
6350
  }
6568
6351
  } else {
6569
- 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 ? ThemeMode.dark : ThemeMode.light);
6352
+ 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");
6570
6353
  if (defaultTheme) {
6571
6354
  this.load(defaultTheme.options);
6572
6355
  }
@@ -6574,7 +6357,7 @@
6574
6357
  }
6575
6358
  setResponsive(width, pxRatio, defaultOptions) {
6576
6359
  this.load(defaultOptions);
6577
- const responsiveOptions = this.responsive.find((t => t.mode === ResponsiveMode.screen && screen ? t.maxWidth * pxRatio > screen.availWidth : t.maxWidth * pxRatio > width));
6360
+ const responsiveOptions = this.responsive.find((t => t.mode === "screen" && screen ? t.maxWidth * pxRatio > screen.availWidth : t.maxWidth * pxRatio > width));
6578
6361
  this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
6579
6362
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
6580
6363
  }
@@ -6584,7 +6367,7 @@
6584
6367
  }
6585
6368
  _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
6586
6369
  var _a;
6587
- 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 === ThemeMode.any));
6370
+ 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"));
6588
6371
  };
6589
6372
  class Container {
6590
6373
  constructor(id, sourceOptions, ...presets) {
@@ -7006,22 +6789,17 @@
7006
6789
  }
7007
6790
  }
7008
6791
  let canvasEl;
7009
- let generatedCanvas;
7010
6792
  if (domContainer.tagName.toLowerCase() === "canvas") {
7011
6793
  canvasEl = domContainer;
7012
- generatedCanvas = false;
6794
+ canvasEl.dataset[Constants.generatedAttribute] = "false";
7013
6795
  } else {
7014
6796
  const existingCanvases = domContainer.getElementsByTagName("canvas");
7015
6797
  if (existingCanvases.length) {
7016
6798
  canvasEl = existingCanvases[0];
7017
- if (!canvasEl.className) {
7018
- canvasEl.className = Constants.canvasClass;
7019
- }
7020
- generatedCanvas = false;
6799
+ canvasEl.dataset[Constants.generatedAttribute] = "false";
7021
6800
  } else {
7022
- generatedCanvas = true;
7023
6801
  canvasEl = document.createElement("canvas");
7024
- canvasEl.className = Constants.canvasClass;
6802
+ canvasEl.dataset[Constants.generatedAttribute] = "true";
7025
6803
  canvasEl.style.width = "100%";
7026
6804
  canvasEl.style.height = "100%";
7027
6805
  domContainer.appendChild(canvasEl);
@@ -7033,7 +6811,7 @@
7033
6811
  } else {
7034
6812
  dom.push(newItem);
7035
6813
  }
7036
- newItem.canvas.loadCanvas(canvasEl, generatedCanvas);
6814
+ newItem.canvas.loadCanvas(canvasEl);
7037
6815
  await newItem.start();
7038
6816
  return newItem;
7039
6817
  }
@@ -7143,20 +6921,20 @@
7143
6921
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
7144
6922
  value;
7145
6923
  };
7146
- var main_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
6924
+ var engine_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
7147
6925
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7148
6926
  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");
7149
6927
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7150
6928
  };
7151
- var _Main_initialized;
7152
- class Main {
6929
+ var _Engine_initialized;
6930
+ class Engine {
7153
6931
  constructor() {
7154
- _Main_initialized.set(this, void 0);
7155
- __classPrivateFieldSet(this, _Main_initialized, false, "f");
6932
+ _Engine_initialized.set(this, void 0);
6933
+ __classPrivateFieldSet(this, _Engine_initialized, false, "f");
7156
6934
  }
7157
6935
  init() {
7158
- if (!main_classPrivateFieldGet(this, _Main_initialized, "f")) {
7159
- __classPrivateFieldSet(this, _Main_initialized, true, "f");
6936
+ if (!engine_classPrivateFieldGet(this, _Engine_initialized, "f")) {
6937
+ __classPrivateFieldSet(this, _Engine_initialized, true, "f");
7160
6938
  }
7161
6939
  }
7162
6940
  async loadFromArray(tagId, options, index) {
@@ -7224,7 +7002,7 @@
7224
7002
  await this.refresh();
7225
7003
  }
7226
7004
  }
7227
- _Main_initialized = new WeakMap;
7005
+ _Engine_initialized = new WeakMap;
7228
7006
  class CircleDrawer {
7229
7007
  getSidesCount() {
7230
7008
  return 12;
@@ -7298,12 +7076,6 @@
7298
7076
  async function loadLifeUpdater(tsParticles) {
7299
7077
  await tsParticles.addParticleUpdater("life", (container => new LifeUpdater(container)));
7300
7078
  }
7301
- class ExternalInteractorBase {
7302
- constructor(container) {
7303
- this.container = container;
7304
- this.type = InteractorType.External;
7305
- }
7306
- }
7307
7079
  class Connector extends ExternalInteractorBase {
7308
7080
  constructor(container) {
7309
7081
  super(container);
@@ -7313,7 +7085,7 @@
7313
7085
  if (!(events.onHover.enable && mouse.position)) {
7314
7086
  return false;
7315
7087
  }
7316
- return isInArray(HoverMode.connect, events.onHover.mode);
7088
+ return isInArray("connect", events.onHover.mode);
7317
7089
  }
7318
7090
  reset() {}
7319
7091
  interact() {
@@ -7343,13 +7115,13 @@
7343
7115
  }
7344
7116
  function checkDestroy(particle, value, minValue, maxValue) {
7345
7117
  switch (particle.options.opacity.animation.destroy) {
7346
- case DestroyType.max:
7118
+ case "max":
7347
7119
  if (value >= maxValue) {
7348
7120
  particle.destroy();
7349
7121
  }
7350
7122
  break;
7351
7123
 
7352
- case DestroyType.min:
7124
+ case "min":
7353
7125
  if (value <= minValue) {
7354
7126
  particle.destroy();
7355
7127
  }
@@ -7367,9 +7139,9 @@
7367
7139
  return;
7368
7140
  }
7369
7141
  switch (particle.opacity.status) {
7370
- case AnimationStatus.increasing:
7142
+ case 0:
7371
7143
  if (particle.opacity.value >= maxValue) {
7372
- particle.opacity.status = AnimationStatus.decreasing;
7144
+ particle.opacity.status = 1;
7373
7145
  if (!particle.opacity.loops) {
7374
7146
  particle.opacity.loops = 0;
7375
7147
  }
@@ -7379,9 +7151,9 @@
7379
7151
  }
7380
7152
  break;
7381
7153
 
7382
- case AnimationStatus.decreasing:
7154
+ case 1:
7383
7155
  if (particle.opacity.value <= minValue) {
7384
- particle.opacity.status = AnimationStatus.increasing;
7156
+ particle.opacity.status = 0;
7385
7157
  if (!particle.opacity.loops) {
7386
7158
  particle.opacity.loops = 0;
7387
7159
  }
@@ -7412,25 +7184,25 @@
7412
7184
  };
7413
7185
  const opacityAnimation = opacityOptions.animation;
7414
7186
  if (opacityAnimation.enable) {
7415
- particle.opacity.status = AnimationStatus.increasing;
7187
+ particle.opacity.status = 0;
7416
7188
  const opacityRange = opacityOptions.value;
7417
7189
  particle.opacity.min = getRangeMin(opacityRange);
7418
7190
  particle.opacity.max = getRangeMax(opacityRange);
7419
7191
  switch (opacityAnimation.startValue) {
7420
- case StartValueType.min:
7192
+ case "min":
7421
7193
  particle.opacity.value = particle.opacity.min;
7422
- particle.opacity.status = AnimationStatus.increasing;
7194
+ particle.opacity.status = 0;
7423
7195
  break;
7424
7196
 
7425
- case StartValueType.random:
7197
+ case "random":
7426
7198
  particle.opacity.value = randomInRange(particle.opacity);
7427
- particle.opacity.status = Math.random() >= .5 ? AnimationStatus.increasing : AnimationStatus.decreasing;
7199
+ particle.opacity.status = Math.random() >= .5 ? 0 : 1;
7428
7200
  break;
7429
7201
 
7430
- case StartValueType.max:
7202
+ case "max":
7431
7203
  default:
7432
7204
  particle.opacity.value = particle.opacity.max;
7433
- particle.opacity.status = AnimationStatus.decreasing;
7205
+ particle.opacity.status = 1;
7434
7206
  break;
7435
7207
  }
7436
7208
  particle.opacity.velocity = opacityAnimation.speed / 100 * this.container.retina.reduceFactor;
@@ -7453,56 +7225,94 @@
7453
7225
  async function loadOpacityUpdater(tsParticles) {
7454
7226
  await tsParticles.addParticleUpdater("opacity", (container => new OpacityUpdater(container)));
7455
7227
  }
7456
- function loadImage(source) {
7457
- return new Promise(((resolve, reject) => {
7458
- if (!source) {
7459
- reject("Error tsParticles - No image.src");
7460
- return;
7461
- }
7462
- const image = {
7463
- source: source,
7464
- type: source.substr(source.length - 3)
7465
- };
7228
+ const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
7229
+ function replaceColorSvg(imageShape, color, opacity) {
7230
+ const {svgData: svgData} = imageShape;
7231
+ if (!svgData) {
7232
+ return "";
7233
+ }
7234
+ const colorStyle = getStyleFromHsl(color, opacity);
7235
+ if (svgData.includes("fill")) {
7236
+ return svgData.replace(currentColorRegex, (() => colorStyle));
7237
+ }
7238
+ const preFillIndex = svgData.indexOf(">");
7239
+ return `${svgData.substring(0, preFillIndex)} fill="${colorStyle}"${svgData.substring(preFillIndex)}`;
7240
+ }
7241
+ async function loadImage(image) {
7242
+ return new Promise((resolve => {
7243
+ image.loading = true;
7466
7244
  const img = new Image;
7467
7245
  img.addEventListener("load", (() => {
7468
7246
  image.element = img;
7469
- resolve(image);
7247
+ image.loading = false;
7248
+ resolve();
7470
7249
  }));
7471
7250
  img.addEventListener("error", (() => {
7472
- reject(`Error tsParticles - loading image: ${source}`);
7251
+ image.error = true;
7252
+ image.loading = false;
7253
+ console.error(`Error tsParticles - loading image: ${image.source}`);
7254
+ resolve();
7473
7255
  }));
7474
- img.src = source;
7256
+ img.src = image.source;
7475
7257
  }));
7476
7258
  }
7477
- async function downloadSvgImage(source) {
7478
- if (!source) {
7479
- throw new Error("Error tsParticles - No image.src");
7480
- }
7481
- const image = {
7482
- source: source,
7483
- type: source.substr(source.length - 3)
7484
- };
7259
+ async function downloadSvgImage(image) {
7485
7260
  if (image.type !== "svg") {
7486
- return loadImage(source);
7261
+ await loadImage(image);
7262
+ return;
7487
7263
  }
7264
+ image.loading = true;
7488
7265
  const response = await fetch(image.source);
7266
+ image.loading = false;
7489
7267
  if (!response.ok) {
7490
- throw new Error("Error tsParticles - Image not found");
7491
- }
7492
- image.svgData = await response.text();
7493
- return image;
7494
- }
7495
- function replaceColorSvg(imageShape, color, opacity) {
7496
- const {svgData: svgData} = imageShape;
7497
- if (!svgData) {
7498
- return "";
7268
+ console.error("Error tsParticles - Image not found");
7269
+ image.error = true;
7499
7270
  }
7500
- if (svgData.includes("fill")) {
7501
- const currentColor = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
7502
- return svgData.replace(currentColor, (() => getStyleFromHsl(color, opacity)));
7271
+ if (!image.error) {
7272
+ image.svgData = await response.text();
7503
7273
  }
7504
- const preFillIndex = svgData.indexOf(">");
7505
- return `${svgData.substring(0, preFillIndex)} fill="${getStyleFromHsl(color, opacity)}"${svgData.substring(preFillIndex)}`;
7274
+ }
7275
+ function replaceImageColor(image, imageData, color, particle) {
7276
+ var _a, _b, _c;
7277
+ const svgColoredData = replaceColorSvg(image, color, (_b = (_a = particle.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1);
7278
+ const svg = new Blob([ svgColoredData ], {
7279
+ type: "image/svg+xml"
7280
+ });
7281
+ const domUrl = URL || window.URL || window.webkitURL || window;
7282
+ const url = domUrl.createObjectURL(svg);
7283
+ const img = new Image;
7284
+ const imageRes = {
7285
+ data: Object.assign(Object.assign({}, image), {
7286
+ svgData: svgColoredData
7287
+ }),
7288
+ ratio: imageData.width / imageData.height,
7289
+ replaceColor: (_c = imageData.replaceColor) !== null && _c !== void 0 ? _c : imageData.replace_color,
7290
+ source: imageData.src
7291
+ };
7292
+ img.addEventListener("load", (() => {
7293
+ const pImage = particle.image;
7294
+ if (pImage) {
7295
+ pImage.loaded = true;
7296
+ image.element = img;
7297
+ }
7298
+ domUrl.revokeObjectURL(url);
7299
+ }));
7300
+ img.addEventListener("error", (() => {
7301
+ domUrl.revokeObjectURL(url);
7302
+ const img2 = Object.assign(Object.assign({}, image), {
7303
+ error: false,
7304
+ loading: true
7305
+ });
7306
+ loadImage(img2).then((() => {
7307
+ const pImage = particle.image;
7308
+ if (pImage) {
7309
+ image.element = img2.element;
7310
+ pImage.loaded = true;
7311
+ }
7312
+ }));
7313
+ }));
7314
+ img.src = url;
7315
+ return imageRes;
7506
7316
  }
7507
7317
  var ImageDrawer_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
7508
7318
  if (kind === "m") throw new TypeError("Private method is not writable");
@@ -7541,80 +7351,30 @@
7541
7351
  const containerImages = this.getImages(container);
7542
7352
  containerImages === null || containerImages === void 0 ? void 0 : containerImages.images.push(image);
7543
7353
  }
7544
- async init(container) {
7545
- await this.loadImagesFromParticlesOptions(container, container.actualOptions.particles);
7546
- await this.loadImagesFromParticlesOptions(container, container.actualOptions.interactivity.modes.trail.particles);
7547
- for (const manualParticle of container.actualOptions.manualParticles) {
7548
- await this.loadImagesFromParticlesOptions(container, manualParticle.options);
7549
- }
7550
- const emitterOptions = container.actualOptions;
7551
- if (emitterOptions.emitters) {
7552
- if (emitterOptions.emitters instanceof Array) {
7553
- for (const emitter of emitterOptions.emitters) {
7554
- await this.loadImagesFromParticlesOptions(container, emitter.particles);
7555
- }
7556
- } else {
7557
- await this.loadImagesFromParticlesOptions(container, emitterOptions.emitters.particles);
7558
- }
7559
- }
7560
- const interactiveEmitters = emitterOptions.interactivity.modes.emitters;
7561
- if (interactiveEmitters) {
7562
- if (interactiveEmitters instanceof Array) {
7563
- for (const emitter of interactiveEmitters) {
7564
- await this.loadImagesFromParticlesOptions(container, emitter.particles);
7565
- }
7566
- } else {
7567
- await this.loadImagesFromParticlesOptions(container, interactiveEmitters.particles);
7568
- }
7569
- }
7570
- }
7571
7354
  destroy() {
7572
7355
  ImageDrawer_classPrivateFieldSet(this, _ImageDrawer_images, [], "f");
7573
7356
  }
7574
- async loadImagesFromParticlesOptions(container, options) {
7575
- var _a, _b, _c;
7576
- const shapeOptions = options === null || options === void 0 ? void 0 : options.shape;
7577
- if (!(shapeOptions === null || shapeOptions === void 0 ? void 0 : shapeOptions.type) || !shapeOptions.options || !isInArray(ShapeType.image, shapeOptions.type) && !isInArray(ShapeType.images, shapeOptions.type)) {
7578
- return;
7579
- }
7580
- const idx = ImageDrawer_classPrivateFieldGet(this, _ImageDrawer_images, "f").findIndex((t => t.id === container.id));
7581
- if (idx >= 0) {
7582
- ImageDrawer_classPrivateFieldGet(this, _ImageDrawer_images, "f").splice(idx, 1);
7583
- }
7584
- const imageOptions = (_a = shapeOptions.options[ShapeType.images]) !== null && _a !== void 0 ? _a : shapeOptions.options[ShapeType.image];
7585
- if (imageOptions instanceof Array) {
7586
- for (const optionsImage of imageOptions) {
7587
- await this.loadImageShape(container, optionsImage);
7588
- }
7589
- } else {
7590
- await this.loadImageShape(container, imageOptions);
7591
- }
7592
- if (options === null || options === void 0 ? void 0 : options.groups) {
7593
- for (const groupName in options.groups) {
7594
- const group = options.groups[groupName];
7595
- await this.loadImagesFromParticlesOptions(container, group);
7596
- }
7597
- }
7598
- if ((_c = (_b = options === null || options === void 0 ? void 0 : options.destroy) === null || _b === void 0 ? void 0 : _b.split) === null || _c === void 0 ? void 0 : _c.particles) {
7599
- await this.loadImagesFromParticlesOptions(container, options === null || options === void 0 ? void 0 : options.destroy.split.particles);
7600
- }
7601
- }
7602
7357
  async loadImageShape(container, imageShape) {
7358
+ const source = imageShape.src;
7359
+ if (!source) {
7360
+ throw new Error("Error tsParticles - No image.src");
7361
+ }
7603
7362
  try {
7363
+ const image = {
7364
+ source: source,
7365
+ type: source.substr(source.length - 3),
7366
+ error: false,
7367
+ loading: true
7368
+ };
7369
+ this.addImage(container, image);
7604
7370
  const imageFunc = imageShape.replaceColor ? downloadSvgImage : loadImage;
7605
- const image = await imageFunc(imageShape.src);
7606
- if (image) {
7607
- this.addImage(container, image);
7608
- }
7371
+ await imageFunc(image);
7609
7372
  } catch (_a) {
7610
- console.warn(`tsParticles error - ${imageShape.src} not found`);
7373
+ throw new Error(`tsParticles error - ${imageShape.src} not found`);
7611
7374
  }
7612
7375
  }
7613
7376
  draw(context, particle, radius, opacity) {
7614
7377
  var _a, _b;
7615
- if (!context) {
7616
- return;
7617
- }
7618
7378
  const image = particle.image;
7619
7379
  const element = (_a = image === null || image === void 0 ? void 0 : image.data) === null || _a === void 0 ? void 0 : _a.element;
7620
7380
  if (!element) {
@@ -7634,67 +7394,40 @@
7634
7394
  }
7635
7395
  }
7636
7396
  loadShape(particle) {
7637
- var _a, _b, _c, _d, _e, _f, _g;
7397
+ var _a, _b, _c;
7638
7398
  if (particle.shape !== "image" && particle.shape !== "images") {
7639
7399
  return;
7640
7400
  }
7641
7401
  const images = this.getImages(particle.container).images;
7642
7402
  const imageData = particle.shapeData;
7643
- const image = (_a = images.find((t => t.source === imageData.src))) !== null && _a !== void 0 ? _a : images[0];
7644
- const color = particle.getFillColor();
7403
+ const image = images.find((t => t.source === imageData.src));
7645
7404
  let imageRes;
7646
7405
  if (!image) {
7406
+ this.loadImageShape(particle.container, imageData).then((() => {
7407
+ this.loadShape(particle);
7408
+ }));
7647
7409
  return;
7648
7410
  }
7649
- if (image.svgData !== undefined && imageData.replaceColor && color) {
7650
- const svgColoredData = replaceColorSvg(image, color, (_c = (_b = particle.opacity) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 1);
7651
- const svg = new Blob([ svgColoredData ], {
7652
- type: "image/svg+xml"
7653
- });
7654
- const domUrl = URL || window.URL || window.webkitURL || window;
7655
- const url = domUrl.createObjectURL(svg);
7656
- const img = new Image;
7657
- imageRes = {
7658
- data: Object.assign(Object.assign({}, image), {
7659
- svgData: svgColoredData
7660
- }),
7661
- ratio: imageData.width / imageData.height,
7662
- replaceColor: (_d = imageData.replaceColor) !== null && _d !== void 0 ? _d : imageData.replace_color,
7663
- source: imageData.src
7664
- };
7665
- img.addEventListener("load", (() => {
7666
- const pImage = particle.image;
7667
- if (pImage) {
7668
- pImage.loaded = true;
7669
- image.element = img;
7670
- }
7671
- domUrl.revokeObjectURL(url);
7672
- }));
7673
- img.addEventListener("error", (() => {
7674
- domUrl.revokeObjectURL(url);
7675
- loadImage(imageData.src).then((img2 => {
7676
- const pImage = particle.image;
7677
- if (pImage) {
7678
- image.element = img2 === null || img2 === void 0 ? void 0 : img2.element;
7679
- pImage.loaded = true;
7680
- }
7681
- }));
7682
- }));
7683
- img.src = url;
7411
+ if (image.error) {
7412
+ return;
7413
+ }
7414
+ const color = particle.getFillColor();
7415
+ if (image.svgData && imageData.replaceColor && color) {
7416
+ imageRes = replaceImageColor(image, imageData, color, particle);
7684
7417
  } else {
7685
7418
  imageRes = {
7686
7419
  data: image,
7687
7420
  loaded: true,
7688
7421
  ratio: imageData.width / imageData.height,
7689
- replaceColor: (_e = imageData.replaceColor) !== null && _e !== void 0 ? _e : imageData.replace_color,
7422
+ replaceColor: (_a = imageData.replaceColor) !== null && _a !== void 0 ? _a : imageData.replace_color,
7690
7423
  source: imageData.src
7691
7424
  };
7692
7425
  }
7693
7426
  if (!imageRes.ratio) {
7694
7427
  imageRes.ratio = 1;
7695
7428
  }
7696
- const fill = (_f = imageData.fill) !== null && _f !== void 0 ? _f : particle.fill;
7697
- const close = (_g = imageData.close) !== null && _g !== void 0 ? _g : particle.close;
7429
+ const fill = (_b = imageData.fill) !== null && _b !== void 0 ? _b : particle.fill;
7430
+ const close = (_c = imageData.close) !== null && _c !== void 0 ? _c : particle.close;
7698
7431
  const imageShape = {
7699
7432
  image: imageRes,
7700
7433
  fill: fill,
@@ -7788,12 +7521,6 @@
7788
7521
  await loadGenericPolygonShape(tsParticles);
7789
7522
  await loadTriangleShape(tsParticles);
7790
7523
  }
7791
- var ProcessBubbleType;
7792
- (function(ProcessBubbleType) {
7793
- ProcessBubbleType["color"] = "color";
7794
- ProcessBubbleType["opacity"] = "opacity";
7795
- ProcessBubbleType["size"] = "size";
7796
- })(ProcessBubbleType || (ProcessBubbleType = {}));
7797
7524
  function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
7798
7525
  if (modeValue >= optionsValue) {
7799
7526
  const value = particleValue + (modeValue - optionsValue) * ratio;
@@ -7808,13 +7535,13 @@
7808
7535
  super(container);
7809
7536
  }
7810
7537
  isEnabled() {
7811
- const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = options.interactivity.events, divs = events.onDiv, divBubble = isDivModeEnabled(DivMode.bubble, divs);
7538
+ const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = options.interactivity.events, divs = events.onDiv, divBubble = isDivModeEnabled("bubble", divs);
7812
7539
  if (!(divBubble || events.onHover.enable && mouse.position || events.onClick.enable && mouse.clickPosition)) {
7813
7540
  return false;
7814
7541
  }
7815
7542
  const hoverMode = events.onHover.mode;
7816
7543
  const clickMode = events.onClick.mode;
7817
- return isInArray(HoverMode.bubble, hoverMode) || isInArray(ClickMode.bubble, clickMode) || divBubble;
7544
+ return isInArray("bubble", hoverMode) || isInArray("bubble", clickMode) || divBubble;
7818
7545
  }
7819
7546
  reset(particle, force) {
7820
7547
  if (!(!particle.bubble.inRange || force)) {
@@ -7827,12 +7554,12 @@
7827
7554
  }
7828
7555
  interact() {
7829
7556
  const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
7830
- if (hoverEnabled && isInArray(HoverMode.bubble, hoverMode)) {
7557
+ if (hoverEnabled && isInArray("bubble", hoverMode)) {
7831
7558
  this.hoverBubble();
7832
- } else if (clickEnabled && isInArray(ClickMode.bubble, clickMode)) {
7559
+ } else if (clickEnabled && isInArray("bubble", clickMode)) {
7833
7560
  this.clickBubble();
7834
7561
  } else {
7835
- divModeExecute(DivMode.bubble, divs, ((selector, div) => this.singleSelectorHover(selector, div)));
7562
+ divModeExecute("bubble", divs, ((selector, div) => this.singleSelectorHover(selector, div)));
7836
7563
  }
7837
7564
  }
7838
7565
  singleSelectorHover(selector, div) {
@@ -7844,7 +7571,7 @@
7844
7571
  const elem = item, pxRatio = container.retina.pixelRatio, pos = {
7845
7572
  x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
7846
7573
  y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
7847
- }, repulseRadius = elem.offsetWidth / 2 * pxRatio, area = div.type === DivType.circle ? new Circle(pos.x, pos.y, repulseRadius) : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area);
7574
+ }, repulseRadius = elem.offsetWidth / 2 * pxRatio, area = div.type === "circle" ? new Circle(pos.x, pos.y, repulseRadius) : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area);
7848
7575
  for (const particle of query) {
7849
7576
  if (!area.contains(particle.getPosition())) {
7850
7577
  continue;
@@ -7876,26 +7603,26 @@
7876
7603
  const obj = pObjBubble !== null && pObjBubble !== void 0 ? pObjBubble : pObj;
7877
7604
  if (obj !== bubbleParam) {
7878
7605
  const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;
7879
- if (type === ProcessBubbleType.size) {
7606
+ if (type === "size") {
7880
7607
  particle.bubble.radius = value;
7881
7608
  }
7882
- if (type === ProcessBubbleType.opacity) {
7609
+ if (type === "opacity") {
7883
7610
  particle.bubble.opacity = value;
7884
7611
  }
7885
7612
  }
7886
7613
  } else {
7887
- if (type === ProcessBubbleType.size) {
7614
+ if (type === "size") {
7888
7615
  delete particle.bubble.radius;
7889
7616
  }
7890
- if (type === ProcessBubbleType.opacity) {
7617
+ if (type === "opacity") {
7891
7618
  delete particle.bubble.opacity;
7892
7619
  }
7893
7620
  }
7894
7621
  } else if (pObjBubble) {
7895
- if (type === ProcessBubbleType.size) {
7622
+ if (type === "size") {
7896
7623
  delete particle.bubble.radius;
7897
7624
  }
7898
- if (type === ProcessBubbleType.opacity) {
7625
+ if (type === "opacity") {
7899
7626
  delete particle.bubble.opacity;
7900
7627
  }
7901
7628
  }
@@ -7929,7 +7656,7 @@
7929
7656
  optValue: getRangeMax(particle.options.size.value) * container.retina.pixelRatio,
7930
7657
  value: particle.size.value
7931
7658
  },
7932
- type: ProcessBubbleType.size
7659
+ type: "size"
7933
7660
  };
7934
7661
  this.process(particle, distMouse, timeSpent, sizeData);
7935
7662
  const opacityData = {
@@ -7941,7 +7668,7 @@
7941
7668
  optValue: getRangeMax(particle.options.opacity.value),
7942
7669
  value: (_b = (_a = particle.opacity) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1
7943
7670
  },
7944
- type: ProcessBubbleType.opacity
7671
+ type: "opacity"
7945
7672
  };
7946
7673
  this.process(particle, distMouse, timeSpent, opacityData);
7947
7674
  if (!container.bubble.durationEnd) {
@@ -8039,14 +7766,14 @@
8039
7766
  return false;
8040
7767
  }
8041
7768
  const hoverMode = events.onHover.mode, clickMode = events.onClick.mode;
8042
- return isInArray(HoverMode.attract, hoverMode) || isInArray(ClickMode.attract, clickMode);
7769
+ return isInArray("attract", hoverMode) || isInArray("attract", clickMode);
8043
7770
  }
8044
7771
  reset() {}
8045
7772
  interact() {
8046
7773
  const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode;
8047
- if (mouseMoveStatus && hoverEnabled && isInArray(HoverMode.attract, hoverMode)) {
7774
+ if (mouseMoveStatus && hoverEnabled && isInArray("attract", hoverMode)) {
8048
7775
  this.hoverAttract();
8049
- } else if (clickEnabled && isInArray(ClickMode.attract, clickMode)) {
7776
+ } else if (clickEnabled && isInArray("attract", clickMode)) {
8050
7777
  this.clickAttract();
8051
7778
  }
8052
7779
  }
@@ -8104,7 +7831,7 @@
8104
7831
  }
8105
7832
  isEnabled() {
8106
7833
  const container = this.container, mouse = container.interactivity.mouse, events = container.actualOptions.interactivity.events;
8107
- return events.onHover.enable && !!mouse.position && isInArray(HoverMode.grab, events.onHover.mode);
7834
+ return events.onHover.enable && !!mouse.position && isInArray("grab", events.onHover.mode);
8108
7835
  }
8109
7836
  reset() {}
8110
7837
  interact() {
@@ -8164,12 +7891,6 @@
8164
7891
  async function loadStarShape(tsParticles) {
8165
7892
  await tsParticles.addShape("star", new StarDrawer);
8166
7893
  }
8167
- class ParticlesInteractorBase {
8168
- constructor(container) {
8169
- this.container = container;
8170
- this.type = InteractorType.Particles;
8171
- }
8172
- }
8173
7894
  class Attractor_Attractor extends ParticlesInteractorBase {
8174
7895
  constructor(container) {
8175
7896
  super(container);
@@ -8218,16 +7939,16 @@
8218
7939
  }
8219
7940
  const offset = randomInRange(valueAnimation.offset);
8220
7941
  const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
8221
- if (!decrease || colorValue.status === AnimationStatus.increasing) {
7942
+ if (!decrease || colorValue.status === 0) {
8222
7943
  colorValue.value += velocity;
8223
7944
  if (decrease && colorValue.value > max) {
8224
- colorValue.status = AnimationStatus.decreasing;
7945
+ colorValue.status = 1;
8225
7946
  colorValue.value -= colorValue.value % max;
8226
7947
  }
8227
7948
  } else {
8228
7949
  colorValue.value -= velocity;
8229
7950
  if (colorValue.value < 0) {
8230
- colorValue.status = AnimationStatus.increasing;
7951
+ colorValue.status = 0;
8231
7952
  colorValue.value += colorValue.value;
8232
7953
  }
8233
7954
  }
@@ -8291,16 +8012,16 @@
8291
8012
  }
8292
8013
  const offset = randomInRange(valueAnimation.offset);
8293
8014
  const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
8294
- if (!decrease || colorValue.status === AnimationStatus.increasing) {
8015
+ if (!decrease || colorValue.status === 0) {
8295
8016
  colorValue.value += velocity;
8296
8017
  if (decrease && colorValue.value > max) {
8297
- colorValue.status = AnimationStatus.decreasing;
8018
+ colorValue.status = 1;
8298
8019
  colorValue.value -= colorValue.value % max;
8299
8020
  }
8300
8021
  } else {
8301
8022
  colorValue.value -= velocity;
8302
8023
  if (colorValue.value < 0) {
8303
- colorValue.status = AnimationStatus.increasing;
8024
+ colorValue.status = 0;
8304
8025
  colorValue.value += colorValue.value;
8305
8026
  }
8306
8027
  }
@@ -8393,19 +8114,19 @@
8393
8114
  }
8394
8115
  resolveCollision(p1, p2) {
8395
8116
  switch (p1.options.collisions.mode) {
8396
- case CollisionMode.absorb:
8117
+ case "absorb":
8397
8118
  {
8398
8119
  this.absorb(p1, p2);
8399
8120
  break;
8400
8121
  }
8401
8122
 
8402
- case CollisionMode.bounce:
8123
+ case "bounce":
8403
8124
  {
8404
8125
  bounce(p1, p2);
8405
8126
  break;
8406
8127
  }
8407
8128
 
8408
- case CollisionMode.destroy:
8129
+ case "destroy":
8409
8130
  {
8410
8131
  destroy(p1, p2);
8411
8132
  break;
@@ -8457,14 +8178,14 @@
8457
8178
  return;
8458
8179
  }
8459
8180
  switch (rotate.status) {
8460
- case AnimationStatus.increasing:
8181
+ case 0:
8461
8182
  rotate.value += speed;
8462
8183
  if (rotate.value > max) {
8463
8184
  rotate.value -= max;
8464
8185
  }
8465
8186
  break;
8466
8187
 
8467
- case AnimationStatus.decreasing:
8188
+ case 1:
8468
8189
  default:
8469
8190
  rotate.value -= speed;
8470
8191
  if (rotate.value < 0) {
@@ -8484,18 +8205,18 @@
8484
8205
  value: getRangeValue(rotateOptions.value) * Math.PI / 180
8485
8206
  };
8486
8207
  let rotateDirection = rotateOptions.direction;
8487
- if (rotateDirection === RotateDirection.random) {
8208
+ if (rotateDirection === "random") {
8488
8209
  const index = Math.floor(Math.random() * 2);
8489
- rotateDirection = index > 0 ? RotateDirection.counterClockwise : RotateDirection.clockwise;
8210
+ rotateDirection = index > 0 ? "counter-clockwise" : "clockwise";
8490
8211
  }
8491
8212
  switch (rotateDirection) {
8492
- case RotateDirection.counterClockwise:
8213
+ case "counter-clockwise":
8493
8214
  case "counterClockwise":
8494
- particle.rotate.status = AnimationStatus.decreasing;
8215
+ particle.rotate.status = 1;
8495
8216
  break;
8496
8217
 
8497
- case RotateDirection.clockwise:
8498
- particle.rotate.status = AnimationStatus.increasing;
8218
+ case "clockwise":
8219
+ particle.rotate.status = 0;
8499
8220
  break;
8500
8221
  }
8501
8222
  const rotateAnimation = particle.options.rotate.animation;
@@ -8522,12 +8243,12 @@
8522
8243
  await tsParticles.addParticleUpdater("angle", (container => new AngleUpdater(container)));
8523
8244
  }
8524
8245
  function bounceHorizontal(data) {
8525
- if (!(data.outMode === OutMode.bounce || data.outMode === OutMode.bounceHorizontal || data.outMode === "bounceHorizontal" || data.outMode === OutMode.split)) {
8246
+ if (!(data.outMode === "bounce" || data.outMode === "bounce-horizontal" || data.outMode === "bounceHorizontal" || data.outMode === "split")) {
8526
8247
  return;
8527
8248
  }
8528
8249
  const velocity = data.particle.velocity.x;
8529
8250
  let bounced = false;
8530
- if (data.direction === OutModeDirection.right && data.bounds.right >= data.canvasSize.width && velocity > 0 || data.direction === OutModeDirection.left && data.bounds.left <= 0 && velocity < 0) {
8251
+ if (data.direction === "right" && data.bounds.right >= data.canvasSize.width && velocity > 0 || data.direction === "left" && data.bounds.left <= 0 && velocity < 0) {
8531
8252
  const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);
8532
8253
  data.particle.velocity.x *= -newVelocity;
8533
8254
  bounced = true;
@@ -8541,15 +8262,15 @@
8541
8262
  } else if (data.bounds.left <= 0) {
8542
8263
  data.particle.position.x = minPos;
8543
8264
  }
8544
- if (data.outMode === OutMode.split) {
8265
+ if (data.outMode === "split") {
8545
8266
  data.particle.destroy();
8546
8267
  }
8547
8268
  }
8548
8269
  function bounceVertical(data) {
8549
- if (data.outMode === OutMode.bounce || data.outMode === OutMode.bounceVertical || data.outMode === "bounceVertical" || data.outMode === OutMode.split) {
8270
+ if (data.outMode === "bounce" || data.outMode === "bounce-vertical" || data.outMode === "bounceVertical" || data.outMode === "split") {
8550
8271
  const velocity = data.particle.velocity.y;
8551
8272
  let bounced = false;
8552
- if (data.direction === OutModeDirection.bottom && data.bounds.bottom >= data.canvasSize.height && velocity > 0 || data.direction === OutModeDirection.top && data.bounds.top <= 0 && velocity < 0) {
8273
+ if (data.direction === "bottom" && data.bounds.bottom >= data.canvasSize.height && velocity > 0 || data.direction === "top" && data.bounds.top <= 0 && velocity < 0) {
8553
8274
  const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);
8554
8275
  data.particle.velocity.y *= -newVelocity;
8555
8276
  bounced = true;
@@ -8563,7 +8284,7 @@
8563
8284
  } else if (data.bounds.top <= 0) {
8564
8285
  data.particle.position.y = minPos;
8565
8286
  }
8566
- if (data.outMode === OutMode.split) {
8287
+ if (data.outMode === "split") {
8567
8288
  data.particle.destroy();
8568
8289
  }
8569
8290
  }
@@ -8579,31 +8300,31 @@
8579
8300
  update(particle, delta) {
8580
8301
  var _a, _b, _c, _d;
8581
8302
  const outModes = particle.options.move.outModes;
8582
- this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, OutModeDirection.bottom);
8583
- this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, OutModeDirection.left);
8584
- this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, OutModeDirection.right);
8585
- this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, OutModeDirection.top);
8303
+ this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, "bottom");
8304
+ this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, "left");
8305
+ this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, "right");
8306
+ this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, "top");
8586
8307
  }
8587
8308
  updateOutMode(particle, delta, outMode, direction) {
8588
8309
  switch (outMode) {
8589
- case OutMode.bounce:
8590
- case OutMode.bounceVertical:
8591
- case OutMode.bounceHorizontal:
8310
+ case "bounce":
8311
+ case "bounce-vertical":
8312
+ case "bounce-horizontal":
8592
8313
  case "bounceVertical":
8593
8314
  case "bounceHorizontal":
8594
- case OutMode.split:
8315
+ case "split":
8595
8316
  this.bounce(particle, delta, direction, outMode);
8596
8317
  break;
8597
8318
 
8598
- case OutMode.destroy:
8319
+ case "destroy":
8599
8320
  this.destroy(particle, direction);
8600
8321
  break;
8601
8322
 
8602
- case OutMode.out:
8323
+ case "out":
8603
8324
  this.out(particle, direction);
8604
8325
  break;
8605
8326
 
8606
- case OutMode.none:
8327
+ case "none":
8607
8328
  default:
8608
8329
  this.none(particle, direction);
8609
8330
  break;
@@ -8627,14 +8348,14 @@
8627
8348
  right: canvasSize.width + particle.getRadius() + particle.offset.x,
8628
8349
  top: -particle.getRadius() - particle.offset.y
8629
8350
  }, sizeValue = particle.getRadius(), nextBounds = calculateBounds(particle.position, sizeValue);
8630
- if (direction === OutModeDirection.right && nextBounds.left > canvasSize.width + particle.offset.x) {
8351
+ if (direction === "right" && nextBounds.left > canvasSize.width + particle.offset.x) {
8631
8352
  particle.position.x = newPos.left;
8632
8353
  particle.initialPosition.x = particle.position.x;
8633
8354
  if (!wrap) {
8634
8355
  particle.position.y = Math.random() * canvasSize.height;
8635
8356
  particle.initialPosition.y = particle.position.y;
8636
8357
  }
8637
- } else if (direction === OutModeDirection.left && nextBounds.right < -particle.offset.x) {
8358
+ } else if (direction === "left" && nextBounds.right < -particle.offset.x) {
8638
8359
  particle.position.x = newPos.right;
8639
8360
  particle.initialPosition.x = particle.position.x;
8640
8361
  if (!wrap) {
@@ -8642,14 +8363,14 @@
8642
8363
  particle.initialPosition.y = particle.position.y;
8643
8364
  }
8644
8365
  }
8645
- if (direction === OutModeDirection.bottom && nextBounds.top > canvasSize.height + particle.offset.y) {
8366
+ if (direction === "bottom" && nextBounds.top > canvasSize.height + particle.offset.y) {
8646
8367
  if (!wrap) {
8647
8368
  particle.position.x = Math.random() * canvasSize.width;
8648
8369
  particle.initialPosition.x = particle.position.x;
8649
8370
  }
8650
8371
  particle.position.y = newPos.top;
8651
8372
  particle.initialPosition.y = particle.position.y;
8652
- } else if (direction === OutModeDirection.top && nextBounds.bottom < -particle.offset.y) {
8373
+ } else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
8653
8374
  if (!wrap) {
8654
8375
  particle.position.x = Math.random() * canvasSize.width;
8655
8376
  particle.initialPosition.x = particle.position.x;
@@ -8693,7 +8414,7 @@
8693
8414
  });
8694
8415
  }
8695
8416
  none(particle, direction) {
8696
- if (particle.options.move.distance.horizontal && (direction === OutModeDirection.left || direction === OutModeDirection.right) || particle.options.move.distance.vertical && (direction === OutModeDirection.top || direction === OutModeDirection.bottom)) {
8417
+ if (particle.options.move.distance.horizontal && (direction === "left" || direction === "right") || particle.options.move.distance.vertical && (direction === "top" || direction === "bottom")) {
8697
8418
  return;
8698
8419
  }
8699
8420
  const gravityOptions = particle.options.move.gravity, container = this.container;
@@ -8708,7 +8429,7 @@
8708
8429
  }
8709
8430
  } else {
8710
8431
  const position = particle.position;
8711
- if (!gravityOptions.inverse && position.y > canvasSize.height + pRadius && direction === OutModeDirection.bottom || gravityOptions.inverse && position.y < -pRadius && direction === OutModeDirection.top) {
8432
+ if (!gravityOptions.inverse && position.y > canvasSize.height + pRadius && direction === "bottom" || gravityOptions.inverse && position.y < -pRadius && direction === "top") {
8712
8433
  container.particles.remove(particle);
8713
8434
  }
8714
8435
  }
@@ -8722,22 +8443,22 @@
8722
8443
  super(container);
8723
8444
  }
8724
8445
  isEnabled() {
8725
- const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = options.interactivity.events, divs = events.onDiv, divRepulse = isDivModeEnabled(DivMode.repulse, divs);
8446
+ const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = options.interactivity.events, divs = events.onDiv, divRepulse = isDivModeEnabled("repulse", divs);
8726
8447
  if (!(divRepulse || events.onHover.enable && mouse.position || events.onClick.enable && mouse.clickPosition)) {
8727
8448
  return false;
8728
8449
  }
8729
8450
  const hoverMode = events.onHover.mode, clickMode = events.onClick.mode;
8730
- return isInArray(HoverMode.repulse, hoverMode) || isInArray(ClickMode.repulse, clickMode) || divRepulse;
8451
+ return isInArray("repulse", hoverMode) || isInArray("repulse", clickMode) || divRepulse;
8731
8452
  }
8732
8453
  reset() {}
8733
8454
  interact() {
8734
8455
  const container = this.container, options = container.actualOptions, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, events = options.interactivity.events, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, clickEnabled = events.onClick.enable, clickMode = events.onClick.mode, divs = events.onDiv;
8735
- if (mouseMoveStatus && hoverEnabled && isInArray(HoverMode.repulse, hoverMode)) {
8456
+ if (mouseMoveStatus && hoverEnabled && isInArray("repulse", hoverMode)) {
8736
8457
  this.hoverRepulse();
8737
- } else if (clickEnabled && isInArray(ClickMode.repulse, clickMode)) {
8458
+ } else if (clickEnabled && isInArray("repulse", clickMode)) {
8738
8459
  this.clickRepulse();
8739
8460
  } else {
8740
- divModeExecute(DivMode.repulse, divs, ((selector, div) => this.singleSelectorRepulse(selector, div)));
8461
+ divModeExecute("repulse", divs, ((selector, div) => this.singleSelectorRepulse(selector, div)));
8741
8462
  }
8742
8463
  }
8743
8464
  singleSelectorRepulse(selector, div) {
@@ -8749,7 +8470,7 @@
8749
8470
  const elem = item, pxRatio = container.retina.pixelRatio, pos = {
8750
8471
  x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
8751
8472
  y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
8752
- }, repulseRadius = elem.offsetWidth / 2 * pxRatio, area = div.type === DivType.circle ? new Circle(pos.x, pos.y, repulseRadius) : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), divs = container.actualOptions.interactivity.modes.repulse.divs, divRepulse = divMode(divs, elem);
8473
+ }, repulseRadius = elem.offsetWidth / 2 * pxRatio, area = div.type === "circle" ? new Circle(pos.x, pos.y, repulseRadius) : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), divs = container.actualOptions.interactivity.modes.repulse.divs, divRepulse = divMode(divs, elem);
8753
8474
  this.processRepulse(pos, repulseRadius, area, divRepulse);
8754
8475
  }));
8755
8476
  }
@@ -8824,14 +8545,14 @@
8824
8545
  }
8825
8546
  isEnabled() {
8826
8547
  const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = options.interactivity.events, divs = events.onDiv;
8827
- return mouse.position && events.onHover.enable && isInArray(HoverMode.bounce, events.onHover.mode) || isDivModeEnabled(DivMode.bounce, divs);
8548
+ return mouse.position && events.onHover.enable && isInArray("bounce", events.onHover.mode) || isDivModeEnabled("bounce", divs);
8828
8549
  }
8829
8550
  interact() {
8830
8551
  const container = this.container, options = container.actualOptions, events = options.interactivity.events, mouseMoveStatus = container.interactivity.status === Constants.mouseMoveEvent, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, divs = events.onDiv;
8831
- if (mouseMoveStatus && hoverEnabled && isInArray(HoverMode.bounce, hoverMode)) {
8552
+ if (mouseMoveStatus && hoverEnabled && isInArray("bounce", hoverMode)) {
8832
8553
  this.processMouseBounce();
8833
8554
  } else {
8834
- divModeExecute(DivMode.bounce, divs, ((selector, div) => this.singleSelectorBounce(selector, div)));
8555
+ divModeExecute("bounce", divs, ((selector, div) => this.singleSelectorBounce(selector, div)));
8835
8556
  }
8836
8557
  }
8837
8558
  reset() {}
@@ -8852,7 +8573,7 @@
8852
8573
  x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
8853
8574
  y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
8854
8575
  }, radius = elem.offsetWidth / 2 * pxRatio, tolerance = 10 * pxRatio;
8855
- const area = div.type === DivType.circle ? new Circle(pos.x, pos.y, radius + tolerance) : new Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
8576
+ const area = div.type === "circle" ? new Circle(pos.x, pos.y, radius + tolerance) : new Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
8856
8577
  this.processBounce(pos, radius, area);
8857
8578
  }));
8858
8579
  }
@@ -8939,93 +8660,6 @@
8939
8660
  await tsParticles.addShape(type, drawer);
8940
8661
  }
8941
8662
  }
8942
- function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
8943
- let distance = getDistance(pos1, pos2);
8944
- if (!warp || distance <= optDistance) {
8945
- return distance;
8946
- }
8947
- const pos2NE = {
8948
- x: pos2.x - canvasSize.width,
8949
- y: pos2.y
8950
- };
8951
- distance = getDistance(pos1, pos2NE);
8952
- if (distance <= optDistance) {
8953
- return distance;
8954
- }
8955
- const pos2SE = {
8956
- x: pos2.x - canvasSize.width,
8957
- y: pos2.y - canvasSize.height
8958
- };
8959
- distance = getDistance(pos1, pos2SE);
8960
- if (distance <= optDistance) {
8961
- return distance;
8962
- }
8963
- const pos2SW = {
8964
- x: pos2.x,
8965
- y: pos2.y - canvasSize.height
8966
- };
8967
- distance = getDistance(pos1, pos2SW);
8968
- return distance;
8969
- }
8970
- class Linker extends ParticlesInteractorBase {
8971
- constructor(container) {
8972
- super(container);
8973
- }
8974
- isEnabled(particle) {
8975
- return particle.options.links.enable;
8976
- }
8977
- reset() {}
8978
- interact(p1) {
8979
- var _a;
8980
- p1.links = [];
8981
- const pos1 = p1.getPosition();
8982
- const container = this.container;
8983
- const canvasSize = container.canvas.size;
8984
- if (pos1.x < 0 || pos1.y < 0 || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {
8985
- return;
8986
- }
8987
- const linkOpt1 = p1.options.links;
8988
- const optOpacity = linkOpt1.opacity;
8989
- const optDistance = (_a = p1.retina.linksDistance) !== null && _a !== void 0 ? _a : container.retina.linksDistance;
8990
- const warp = linkOpt1.warp;
8991
- const range = warp ? new CircleWarp(pos1.x, pos1.y, optDistance, canvasSize) : new Circle(pos1.x, pos1.y, optDistance);
8992
- const query = container.particles.quadTree.query(range);
8993
- for (const p2 of query) {
8994
- const linkOpt2 = p2.options.links;
8995
- if (p1 === p2 || !linkOpt2.enable || linkOpt1.id !== linkOpt2.id || p2.spawning || p2.destroyed || p1.links.map((t => t.destination)).indexOf(p2) !== -1 || p2.links.map((t => t.destination)).indexOf(p1) !== -1) {
8996
- continue;
8997
- }
8998
- const pos2 = p2.getPosition();
8999
- if (pos2.x < 0 || pos2.y < 0 || pos2.x > canvasSize.width || pos2.y > canvasSize.height) {
9000
- continue;
9001
- }
9002
- const distance = getLinkDistance(pos1, pos2, optDistance, canvasSize, warp && linkOpt2.warp);
9003
- if (distance > optDistance) {
9004
- return;
9005
- }
9006
- const opacityLine = (1 - distance / optDistance) * optOpacity;
9007
- this.setColor(p1);
9008
- p1.links.push({
9009
- destination: p2,
9010
- opacity: opacityLine
9011
- });
9012
- }
9013
- }
9014
- setColor(p1) {
9015
- const container = this.container;
9016
- const linksOptions = p1.options.links;
9017
- let linkColor = linksOptions.id === undefined ? container.particles.linksColor : container.particles.linksColors.get(linksOptions.id);
9018
- if (!linkColor) {
9019
- const optColor = linksOptions.color;
9020
- linkColor = getLinkRandomColor(optColor, linksOptions.blink, linksOptions.consent);
9021
- if (linksOptions.id === undefined) {
9022
- container.particles.linksColor = linkColor;
9023
- } else {
9024
- container.particles.linksColors.set(linksOptions.id, linkColor);
9025
- }
9026
- }
9027
- }
9028
- }
9029
8663
  class LinkInstance {
9030
8664
  constructor(container) {
9031
8665
  this.container = container;
@@ -9125,35 +8759,122 @@
9125
8759
  opacity = twinkle.opacity;
9126
8760
  }
9127
8761
  }
9128
- if (!colorLine) {
9129
- const linksOptions = p1.options.links;
9130
- const linkColor = linksOptions.id !== undefined ? container.particles.linksColors.get(linksOptions.id) : container.particles.linksColor;
9131
- colorLine = getLinkColor(p1, p2, linkColor);
8762
+ if (!colorLine) {
8763
+ const linksOptions = p1.options.links;
8764
+ const linkColor = linksOptions.id !== undefined ? container.particles.linksColors.get(linksOptions.id) : container.particles.linksColor;
8765
+ colorLine = getLinkColor(p1, p2, linkColor);
8766
+ }
8767
+ if (!colorLine) {
8768
+ return;
8769
+ }
8770
+ const width = (_a = p1.retina.linksWidth) !== null && _a !== void 0 ? _a : container.retina.linksWidth;
8771
+ const maxDistance = (_b = p1.retina.linksDistance) !== null && _b !== void 0 ? _b : container.retina.linksDistance;
8772
+ drawLinkLine(ctx, width, pos1, pos2, maxDistance, container.canvas.size, p1.options.links.warp, options.backgroundMask.enable, options.backgroundMask.composite, colorLine, opacity, p1.options.links.shadow);
8773
+ }));
8774
+ }
8775
+ }
8776
+ class LinksPlugin {
8777
+ constructor() {
8778
+ this.id = "links";
8779
+ }
8780
+ getPlugin(container) {
8781
+ return new LinkInstance(container);
8782
+ }
8783
+ needsPlugin() {
8784
+ return true;
8785
+ }
8786
+ loadOptions() {}
8787
+ }
8788
+ async function loadPlugin(tsParticles) {
8789
+ const plugin = new LinksPlugin;
8790
+ await tsParticles.addPlugin(plugin);
8791
+ }
8792
+ function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
8793
+ let distance = getDistance(pos1, pos2);
8794
+ if (!warp || distance <= optDistance) {
8795
+ return distance;
8796
+ }
8797
+ const pos2NE = {
8798
+ x: pos2.x - canvasSize.width,
8799
+ y: pos2.y
8800
+ };
8801
+ distance = getDistance(pos1, pos2NE);
8802
+ if (distance <= optDistance) {
8803
+ return distance;
8804
+ }
8805
+ const pos2SE = {
8806
+ x: pos2.x - canvasSize.width,
8807
+ y: pos2.y - canvasSize.height
8808
+ };
8809
+ distance = getDistance(pos1, pos2SE);
8810
+ if (distance <= optDistance) {
8811
+ return distance;
8812
+ }
8813
+ const pos2SW = {
8814
+ x: pos2.x,
8815
+ y: pos2.y - canvasSize.height
8816
+ };
8817
+ distance = getDistance(pos1, pos2SW);
8818
+ return distance;
8819
+ }
8820
+ class Linker extends ParticlesInteractorBase {
8821
+ constructor(container) {
8822
+ super(container);
8823
+ }
8824
+ isEnabled(particle) {
8825
+ return particle.options.links.enable;
8826
+ }
8827
+ reset() {}
8828
+ interact(p1) {
8829
+ var _a;
8830
+ p1.links = [];
8831
+ const pos1 = p1.getPosition();
8832
+ const container = this.container;
8833
+ const canvasSize = container.canvas.size;
8834
+ if (pos1.x < 0 || pos1.y < 0 || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {
8835
+ return;
8836
+ }
8837
+ const linkOpt1 = p1.options.links;
8838
+ const optOpacity = linkOpt1.opacity;
8839
+ const optDistance = (_a = p1.retina.linksDistance) !== null && _a !== void 0 ? _a : container.retina.linksDistance;
8840
+ const warp = linkOpt1.warp;
8841
+ const range = warp ? new CircleWarp(pos1.x, pos1.y, optDistance, canvasSize) : new Circle(pos1.x, pos1.y, optDistance);
8842
+ const query = container.particles.quadTree.query(range);
8843
+ for (const p2 of query) {
8844
+ const linkOpt2 = p2.options.links;
8845
+ if (p1 === p2 || !linkOpt2.enable || linkOpt1.id !== linkOpt2.id || p2.spawning || p2.destroyed || p1.links.map((t => t.destination)).indexOf(p2) !== -1 || p2.links.map((t => t.destination)).indexOf(p1) !== -1) {
8846
+ continue;
8847
+ }
8848
+ const pos2 = p2.getPosition();
8849
+ if (pos2.x < 0 || pos2.y < 0 || pos2.x > canvasSize.width || pos2.y > canvasSize.height) {
8850
+ continue;
9132
8851
  }
9133
- if (!colorLine) {
8852
+ const distance = getLinkDistance(pos1, pos2, optDistance, canvasSize, warp && linkOpt2.warp);
8853
+ if (distance > optDistance) {
9134
8854
  return;
9135
8855
  }
9136
- const width = (_a = p1.retina.linksWidth) !== null && _a !== void 0 ? _a : container.retina.linksWidth;
9137
- const maxDistance = (_b = p1.retina.linksDistance) !== null && _b !== void 0 ? _b : container.retina.linksDistance;
9138
- drawLinkLine(ctx, width, pos1, pos2, maxDistance, container.canvas.size, p1.options.links.warp, options.backgroundMask.enable, options.backgroundMask.composite, colorLine, opacity, p1.options.links.shadow);
9139
- }));
9140
- }
9141
- }
9142
- class Plugin {
9143
- constructor() {
9144
- this.id = "links";
9145
- }
9146
- getPlugin(container) {
9147
- return new LinkInstance(container);
8856
+ const opacityLine = (1 - distance / optDistance) * optOpacity;
8857
+ this.setColor(p1);
8858
+ p1.links.push({
8859
+ destination: p2,
8860
+ opacity: opacityLine
8861
+ });
8862
+ }
9148
8863
  }
9149
- needsPlugin() {
9150
- return true;
8864
+ setColor(p1) {
8865
+ const container = this.container;
8866
+ const linksOptions = p1.options.links;
8867
+ let linkColor = linksOptions.id === undefined ? container.particles.linksColor : container.particles.linksColors.get(linksOptions.id);
8868
+ if (!linkColor) {
8869
+ const optColor = linksOptions.color;
8870
+ linkColor = getLinkRandomColor(optColor, linksOptions.blink, linksOptions.consent);
8871
+ if (linksOptions.id === undefined) {
8872
+ container.particles.linksColor = linkColor;
8873
+ } else {
8874
+ container.particles.linksColors.set(linksOptions.id, linkColor);
8875
+ }
8876
+ }
9151
8877
  }
9152
- loadOptions() {}
9153
- }
9154
- async function loadPlugin(tsParticles) {
9155
- const plugin = new Plugin;
9156
- await tsParticles.addPlugin(plugin);
9157
8878
  }
9158
8879
  async function loadInteraction(tsParticles) {
9159
8880
  await tsParticles.addInteractor("particlesLinks", (container => new Linker(container)));
@@ -9164,13 +8885,13 @@
9164
8885
  }
9165
8886
  function SizeUpdater_checkDestroy(particle, value, minValue, maxValue) {
9166
8887
  switch (particle.options.size.animation.destroy) {
9167
- case DestroyType.max:
8888
+ case "max":
9168
8889
  if (value >= maxValue) {
9169
8890
  particle.destroy();
9170
8891
  }
9171
8892
  break;
9172
8893
 
9173
- case DestroyType.min:
8894
+ case "min":
9174
8895
  if (value <= minValue) {
9175
8896
  particle.destroy();
9176
8897
  }
@@ -9186,9 +8907,9 @@
9186
8907
  return;
9187
8908
  }
9188
8909
  switch (particle.size.status) {
9189
- case AnimationStatus.increasing:
8910
+ case 0:
9190
8911
  if (particle.size.value >= maxValue) {
9191
- particle.size.status = AnimationStatus.decreasing;
8912
+ particle.size.status = 1;
9192
8913
  if (!particle.size.loops) {
9193
8914
  particle.size.loops = 0;
9194
8915
  }
@@ -9198,9 +8919,9 @@
9198
8919
  }
9199
8920
  break;
9200
8921
 
9201
- case AnimationStatus.decreasing:
8922
+ case 1:
9202
8923
  if (particle.size.value <= minValue) {
9203
- particle.size.status = AnimationStatus.increasing;
8924
+ particle.size.status = 0;
9204
8925
  if (!particle.size.loops) {
9205
8926
  particle.size.loops = 0;
9206
8927
  }
@@ -9293,7 +9014,7 @@
9293
9014
  }
9294
9015
  isEnabled() {
9295
9016
  const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = options.interactivity.events;
9296
- return mouse.clicking && mouse.inside && !!mouse.position && isInArray(ClickMode.trail, events.onClick.mode) || mouse.inside && !!mouse.position && isInArray(HoverMode.trail, events.onHover.mode);
9017
+ return mouse.clicking && mouse.inside && !!mouse.position && isInArray("trail", events.onClick.mode) || mouse.inside && !!mouse.position && isInArray("trail", events.onHover.mode);
9297
9018
  }
9298
9019
  reset() {}
9299
9020
  }
@@ -9313,14 +9034,14 @@
9313
9034
  return;
9314
9035
  }
9315
9036
  switch (particle.tilt.status) {
9316
- case AnimationStatus.increasing:
9037
+ case 0:
9317
9038
  particle.tilt.value += speed;
9318
9039
  if (particle.tilt.value > max) {
9319
9040
  particle.tilt.value -= max;
9320
9041
  }
9321
9042
  break;
9322
9043
 
9323
- case AnimationStatus.decreasing:
9044
+ case 1:
9324
9045
  default:
9325
9046
  particle.tilt.value -= speed;
9326
9047
  if (particle.tilt.value < 0) {
@@ -9342,18 +9063,18 @@
9342
9063
  cosDirection: Math.random() >= .5 ? 1 : -1
9343
9064
  };
9344
9065
  let tiltDirection = tiltOptions.direction;
9345
- if (tiltDirection === TiltDirection.random) {
9066
+ if (tiltDirection === "random") {
9346
9067
  const index = Math.floor(Math.random() * 2);
9347
- tiltDirection = index > 0 ? TiltDirection.counterClockwise : TiltDirection.clockwise;
9068
+ tiltDirection = index > 0 ? "counter-clockwise" : "clockwise";
9348
9069
  }
9349
9070
  switch (tiltDirection) {
9350
- case TiltDirection.counterClockwise:
9071
+ case "counter-clockwise":
9351
9072
  case "counterClockwise":
9352
- particle.tilt.status = AnimationStatus.decreasing;
9073
+ particle.tilt.status = 1;
9353
9074
  break;
9354
9075
 
9355
- case TiltDirection.clockwise:
9356
- particle.tilt.status = AnimationStatus.increasing;
9076
+ case "clockwise":
9077
+ particle.tilt.status = 0;
9357
9078
  break;
9358
9079
  }
9359
9080
  const tiltAnimation = particle.options.tilt.animation;
@@ -9427,6 +9148,66 @@
9427
9148
  async function loadWobbleUpdater(tsParticles) {
9428
9149
  await tsParticles.addParticleUpdater("wobble", (container => new WobbleUpdater(container)));
9429
9150
  }
9151
+ function updateRoll(particle, delta) {
9152
+ const roll = particle.options.roll;
9153
+ if (!particle.roll || !roll.enable) {
9154
+ return;
9155
+ }
9156
+ const speed = particle.roll.speed * delta.factor;
9157
+ const max = 2 * Math.PI;
9158
+ particle.roll.angle += speed;
9159
+ if (particle.roll.angle > max) {
9160
+ particle.roll.angle -= max;
9161
+ }
9162
+ }
9163
+ class RollUpdater {
9164
+ init(particle) {
9165
+ const rollOpt = particle.options.roll;
9166
+ if (rollOpt.enable) {
9167
+ particle.roll = {
9168
+ angle: Math.random() * Math.PI * 2,
9169
+ speed: getRangeValue(rollOpt.speed) / 360
9170
+ };
9171
+ if (rollOpt.backColor) {
9172
+ particle.backColor = colorToHsl(rollOpt.backColor);
9173
+ } else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
9174
+ const alterType = Math.random() >= .5 ? "darken" : "enlighten";
9175
+ particle.roll.alter = {
9176
+ type: alterType,
9177
+ value: alterType === "darken" ? rollOpt.darken.value : rollOpt.enlighten.value
9178
+ };
9179
+ } else if (rollOpt.darken.enable) {
9180
+ particle.roll.alter = {
9181
+ type: "darken",
9182
+ value: rollOpt.darken.value
9183
+ };
9184
+ } else if (rollOpt.enlighten.enable) {
9185
+ particle.roll.alter = {
9186
+ type: "enlighten",
9187
+ value: rollOpt.enlighten.value
9188
+ };
9189
+ }
9190
+ } else {
9191
+ particle.roll = {
9192
+ angle: 0,
9193
+ speed: 0
9194
+ };
9195
+ }
9196
+ }
9197
+ isEnabled(particle) {
9198
+ const roll = particle.options.roll;
9199
+ return !particle.destroyed && !particle.spawning && roll.enable;
9200
+ }
9201
+ update(particle, delta) {
9202
+ if (!this.isEnabled(particle)) {
9203
+ return;
9204
+ }
9205
+ updateRoll(particle, delta);
9206
+ }
9207
+ }
9208
+ async function loadRollUpdater(tsParticles) {
9209
+ await tsParticles.addParticleUpdater("roll", (() => new RollUpdater));
9210
+ }
9430
9211
  class AbsorberInstance {
9431
9212
  constructor(absorbers, container, options, position) {
9432
9213
  var _a, _b, _c, _d, _e;
@@ -9547,7 +9328,7 @@
9547
9328
  particle.absorberOrbit.length = minSize * (1 + (Math.random() * .2 - .1));
9548
9329
  }
9549
9330
  if (particle.absorberOrbitDirection === undefined) {
9550
- particle.absorberOrbitDirection = particle.velocity.x >= 0 ? RotateDirection.clockwise : RotateDirection.counterClockwise;
9331
+ particle.absorberOrbitDirection = particle.velocity.x >= 0 ? "clockwise" : "counter-clockwise";
9551
9332
  }
9552
9333
  const orbitRadius = particle.absorberOrbit.length;
9553
9334
  const orbitAngle = particle.absorberOrbit.angle;
@@ -9555,8 +9336,8 @@
9555
9336
  particle.velocity.x = 0;
9556
9337
  particle.velocity.y = 0;
9557
9338
  const updateFunc = {
9558
- x: orbitDirection === RotateDirection.clockwise ? Math.cos : Math.sin,
9559
- y: orbitDirection === RotateDirection.clockwise ? Math.sin : Math.cos
9339
+ x: orbitDirection === "clockwise" ? Math.cos : Math.sin,
9340
+ y: orbitDirection === "clockwise" ? Math.sin : Math.cos
9560
9341
  };
9561
9342
  particle.position.x = this.position.x + orbitRadius * updateFunc.x(orbitAngle);
9562
9343
  particle.position.y = this.position.y + orbitRadius * updateFunc.y(orbitAngle);
@@ -9651,10 +9432,6 @@
9651
9432
  }
9652
9433
  }
9653
9434
  }
9654
- var AbsorberClickMode;
9655
- (function(AbsorberClickMode) {
9656
- AbsorberClickMode["absorber"] = "absorber";
9657
- })(AbsorberClickMode || (AbsorberClickMode = {}));
9658
9435
  class Absorbers {
9659
9436
  constructor(container) {
9660
9437
  this.container = container;
@@ -9734,7 +9511,7 @@
9734
9511
  const container = this.container;
9735
9512
  const absorberOptions = this.absorbers;
9736
9513
  const modeAbsorbers = this.interactivityAbsorbers;
9737
- if (mode === AbsorberClickMode.absorber) {
9514
+ if (mode === "absorber") {
9738
9515
  let absorbersModeOptions;
9739
9516
  if (modeAbsorbers instanceof Array) {
9740
9517
  if (modeAbsorbers.length > 0) {
@@ -9760,7 +9537,7 @@
9760
9537
  }
9761
9538
  }
9762
9539
  }
9763
- class plugin_Plugin {
9540
+ class AbsorbersPlugin {
9764
9541
  constructor() {
9765
9542
  this.id = "absorbers";
9766
9543
  }
@@ -9780,7 +9557,7 @@
9780
9557
  }
9781
9558
  } else if (absorbers !== undefined) {
9782
9559
  loadAbsorbers = true;
9783
- } else if (((_c = (_b = (_a = options.interactivity) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.onClick) === null || _c === void 0 ? void 0 : _c.mode) && isInArray(AbsorberClickMode.absorber, options.interactivity.events.onClick.mode)) {
9560
+ } else if (((_c = (_b = (_a = options.interactivity) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.onClick) === null || _c === void 0 ? void 0 : _c.mode) && isInArray("absorber", options.interactivity.events.onClick.mode)) {
9784
9561
  loadAbsorbers = true;
9785
9562
  }
9786
9563
  return loadAbsorbers;
@@ -9825,12 +9602,12 @@
9825
9602
  }
9826
9603
  }
9827
9604
  async function loadAbsorbersPlugin(tsParticles) {
9828
- const plugin = new plugin_Plugin;
9605
+ const plugin = new AbsorbersPlugin;
9829
9606
  await tsParticles.addPlugin(plugin);
9830
9607
  }
9831
9608
  class EmitterSize {
9832
9609
  constructor() {
9833
- this.mode = SizeMode.percent;
9610
+ this.mode = "percent";
9834
9611
  this.height = 0;
9835
9612
  this.width = 0;
9836
9613
  }
@@ -9909,7 +9686,7 @@
9909
9686
  const size = new EmitterSize;
9910
9687
  size.load({
9911
9688
  height: 0,
9912
- mode: SizeMode.percent,
9689
+ mode: "percent",
9913
9690
  width: 0
9914
9691
  });
9915
9692
  return size;
@@ -10035,8 +9812,8 @@
10035
9812
  const container = this.container;
10036
9813
  const position = this.position;
10037
9814
  const offset = {
10038
- x: this.size.mode === SizeMode.percent ? container.canvas.size.width * this.size.width / 100 : this.size.width,
10039
- y: this.size.mode === SizeMode.percent ? container.canvas.size.height * this.size.height / 100 : this.size.height
9815
+ x: this.size.mode === "percent" ? container.canvas.size.width * this.size.width / 100 : this.size.width,
9816
+ y: this.size.mode === "percent" ? container.canvas.size.height * this.size.height / 100 : this.size.height
10040
9817
  };
10041
9818
  for (let i = 0; i < quantity; i++) {
10042
9819
  const particlesOptions = deepExtend({}, this.particlesOptions);
@@ -10118,22 +9895,13 @@
10118
9895
  }
10119
9896
  }
10120
9897
  }
10121
- var EmitterClickMode;
10122
- (function(EmitterClickMode) {
10123
- EmitterClickMode["emitter"] = "emitter";
10124
- })(EmitterClickMode || (EmitterClickMode = {}));
10125
- var EmitterShapeType;
10126
- (function(EmitterShapeType) {
10127
- EmitterShapeType["circle"] = "circle";
10128
- EmitterShapeType["square"] = "square";
10129
- })(EmitterShapeType || (EmitterShapeType = {}));
10130
9898
  class Emitter {
10131
9899
  constructor() {
10132
9900
  this.autoPlay = true;
10133
9901
  this.fill = true;
10134
9902
  this.life = new EmitterLife;
10135
9903
  this.rate = new EmitterRate;
10136
- this.shape = EmitterShapeType.square;
9904
+ this.shape = "square";
10137
9905
  this.startCount = 0;
10138
9906
  }
10139
9907
  load(data) {
@@ -10267,7 +10035,7 @@
10267
10035
  const container = this.container;
10268
10036
  const emitterOptions = this.emitters;
10269
10037
  const modeEmitters = this.interactivityEmitters;
10270
- if (mode === EmitterClickMode.emitter) {
10038
+ if (mode === "emitter") {
10271
10039
  let emitterModeOptions;
10272
10040
  if (modeEmitters instanceof Array) {
10273
10041
  if (modeEmitters.length > 0) {
@@ -10377,7 +10145,7 @@
10377
10145
  return false;
10378
10146
  }
10379
10147
  const emitters = options.emitters;
10380
- return emitters instanceof Array && !!emitters.length || emitters !== undefined || !!((_c = (_b = (_a = options.interactivity) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.onClick) === null || _c === void 0 ? void 0 : _c.mode) && isInArray(EmitterClickMode.emitter, options.interactivity.events.onClick.mode);
10148
+ return emitters instanceof Array && !!emitters.length || emitters !== undefined || !!((_c = (_b = (_a = options.interactivity) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.onClick) === null || _c === void 0 ? void 0 : _c.mode) && isInArray("emitter", options.interactivity.events.onClick.mode);
10381
10149
  }
10382
10150
  loadOptions(options, source) {
10383
10151
  var _a, _b;
@@ -10426,30 +10194,10 @@
10426
10194
  ShapeManager.addShape(name, shape);
10427
10195
  };
10428
10196
  }
10429
- tsParticles.addEmitterShape(EmitterShapeType.circle, new CircleShape);
10430
- tsParticles.addEmitterShape(EmitterShapeType.square, new SquareShape);
10431
- }
10432
- var InlineArrangement;
10433
- (function(InlineArrangement) {
10434
- InlineArrangement["equidistant"] = "equidistant";
10435
- InlineArrangement["onePerPoint"] = "one-per-point";
10436
- InlineArrangement["perPoint"] = "per-point";
10437
- InlineArrangement["randomLength"] = "random-length";
10438
- InlineArrangement["randomPoint"] = "random-point";
10439
- })(InlineArrangement || (InlineArrangement = {}));
10440
- var MoveType;
10441
- (function(MoveType) {
10442
- MoveType["path"] = "path";
10443
- MoveType["radius"] = "radius";
10444
- })(MoveType || (MoveType = {}));
10445
- var Type;
10446
- (function(Type) {
10447
- Type["inline"] = "inline";
10448
- Type["inside"] = "inside";
10449
- Type["outside"] = "outside";
10450
- Type["none"] = "none";
10451
- })(Type || (Type = {}));
10452
- class DrawStroke {
10197
+ tsParticles.addEmitterShape("circle", new CircleShape);
10198
+ tsParticles.addEmitterShape("square", new SquareShape);
10199
+ }
10200
+ class PolygonMaskDrawStroke {
10453
10201
  constructor() {
10454
10202
  this.color = new OptionsColor;
10455
10203
  this.width = .5;
@@ -10457,24 +10205,25 @@
10457
10205
  }
10458
10206
  load(data) {
10459
10207
  var _a;
10460
- if (data !== undefined) {
10461
- this.color = OptionsColor.create(this.color, data.color);
10462
- if (typeof this.color.value === "string") {
10463
- this.opacity = (_a = stringToAlpha(this.color.value)) !== null && _a !== void 0 ? _a : this.opacity;
10464
- }
10465
- if (data.opacity !== undefined) {
10466
- this.opacity = data.opacity;
10467
- }
10468
- if (data.width !== undefined) {
10469
- this.width = data.width;
10470
- }
10208
+ if (!data) {
10209
+ return;
10210
+ }
10211
+ this.color = OptionsColor.create(this.color, data.color);
10212
+ if (typeof this.color.value === "string") {
10213
+ this.opacity = (_a = stringToAlpha(this.color.value)) !== null && _a !== void 0 ? _a : this.opacity;
10214
+ }
10215
+ if (data.opacity !== undefined) {
10216
+ this.opacity = data.opacity;
10217
+ }
10218
+ if (data.width !== undefined) {
10219
+ this.width = data.width;
10471
10220
  }
10472
10221
  }
10473
10222
  }
10474
- class Draw {
10223
+ class PolygonMaskDraw {
10475
10224
  constructor() {
10476
10225
  this.enable = false;
10477
- this.stroke = new DrawStroke;
10226
+ this.stroke = new PolygonMaskDrawStroke;
10478
10227
  }
10479
10228
  get lineWidth() {
10480
10229
  return this.stroke.width;
@@ -10490,47 +10239,50 @@
10490
10239
  }
10491
10240
  load(data) {
10492
10241
  var _a;
10493
- if (data !== undefined) {
10494
- if (data.enable !== undefined) {
10495
- this.enable = data.enable;
10496
- }
10497
- const stroke = (_a = data.stroke) !== null && _a !== void 0 ? _a : {
10498
- color: data.lineColor,
10499
- width: data.lineWidth
10500
- };
10501
- this.stroke.load(stroke);
10242
+ if (!data) {
10243
+ return;
10502
10244
  }
10245
+ if (data.enable !== undefined) {
10246
+ this.enable = data.enable;
10247
+ }
10248
+ const stroke = (_a = data.stroke) !== null && _a !== void 0 ? _a : {
10249
+ color: data.lineColor,
10250
+ width: data.lineWidth
10251
+ };
10252
+ this.stroke.load(stroke);
10503
10253
  }
10504
10254
  }
10505
- class Move_Move {
10255
+ class PolygonMaskMove {
10506
10256
  constructor() {
10507
10257
  this.radius = 10;
10508
- this.type = MoveType.path;
10258
+ this.type = "path";
10509
10259
  }
10510
10260
  load(data) {
10511
- if (data !== undefined) {
10512
- if (data.radius !== undefined) {
10513
- this.radius = data.radius;
10514
- }
10515
- if (data.type !== undefined) {
10516
- this.type = data.type;
10517
- }
10261
+ if (!data) {
10262
+ return;
10263
+ }
10264
+ if (data.radius !== undefined) {
10265
+ this.radius = data.radius;
10266
+ }
10267
+ if (data.type !== undefined) {
10268
+ this.type = data.type;
10518
10269
  }
10519
10270
  }
10520
10271
  }
10521
- class Inline {
10272
+ class PolygonMaskInline {
10522
10273
  constructor() {
10523
- this.arrangement = InlineArrangement.onePerPoint;
10274
+ this.arrangement = "one-per-point";
10524
10275
  }
10525
10276
  load(data) {
10526
- if (data !== undefined) {
10527
- if (data.arrangement !== undefined) {
10528
- this.arrangement = data.arrangement;
10529
- }
10277
+ if (!data) {
10278
+ return;
10279
+ }
10280
+ if (data.arrangement !== undefined) {
10281
+ this.arrangement = data.arrangement;
10530
10282
  }
10531
10283
  }
10532
10284
  }
10533
- class LocalSvg {
10285
+ class PolygonMaskLocalSvg {
10534
10286
  constructor() {
10535
10287
  this.path = [];
10536
10288
  this.size = {
@@ -10539,29 +10291,30 @@
10539
10291
  };
10540
10292
  }
10541
10293
  load(data) {
10542
- if (data !== undefined) {
10543
- if (data.path !== undefined) {
10544
- this.path = data.path;
10294
+ if (!data) {
10295
+ return;
10296
+ }
10297
+ if (data.path !== undefined) {
10298
+ this.path = data.path;
10299
+ }
10300
+ if (data.size !== undefined) {
10301
+ if (data.size.width !== undefined) {
10302
+ this.size.width = data.size.width;
10545
10303
  }
10546
- if (data.size !== undefined) {
10547
- if (data.size.width !== undefined) {
10548
- this.size.width = data.size.width;
10549
- }
10550
- if (data.size.height !== undefined) {
10551
- this.size.height = data.size.height;
10552
- }
10304
+ if (data.size.height !== undefined) {
10305
+ this.size.height = data.size.height;
10553
10306
  }
10554
10307
  }
10555
10308
  }
10556
10309
  }
10557
10310
  class PolygonMask {
10558
10311
  constructor() {
10559
- this.draw = new Draw;
10312
+ this.draw = new PolygonMaskDraw;
10560
10313
  this.enable = false;
10561
- this.inline = new Inline;
10562
- this.move = new Move_Move;
10314
+ this.inline = new PolygonMaskInline;
10315
+ this.move = new PolygonMaskMove;
10563
10316
  this.scale = 1;
10564
- this.type = Type.none;
10317
+ this.type = "none";
10565
10318
  }
10566
10319
  get inlineArrangement() {
10567
10320
  return this.inline.arrangement;
@@ -10571,41 +10324,42 @@
10571
10324
  }
10572
10325
  load(data) {
10573
10326
  var _a;
10574
- if (data !== undefined) {
10575
- this.draw.load(data.draw);
10576
- const inline = (_a = data.inline) !== null && _a !== void 0 ? _a : {
10577
- arrangement: data.inlineArrangement
10578
- };
10579
- if (inline !== undefined) {
10580
- this.inline.load(inline);
10581
- }
10582
- this.move.load(data.move);
10583
- if (data.scale !== undefined) {
10584
- this.scale = data.scale;
10585
- }
10586
- if (data.type !== undefined) {
10587
- this.type = data.type;
10588
- }
10589
- if (data.enable !== undefined) {
10590
- this.enable = data.enable;
10327
+ if (!data) {
10328
+ return;
10329
+ }
10330
+ this.draw.load(data.draw);
10331
+ const inline = (_a = data.inline) !== null && _a !== void 0 ? _a : {
10332
+ arrangement: data.inlineArrangement
10333
+ };
10334
+ if (inline !== undefined) {
10335
+ this.inline.load(inline);
10336
+ }
10337
+ this.move.load(data.move);
10338
+ if (data.scale !== undefined) {
10339
+ this.scale = data.scale;
10340
+ }
10341
+ if (data.type !== undefined) {
10342
+ this.type = data.type;
10343
+ }
10344
+ if (data.enable !== undefined) {
10345
+ this.enable = data.enable;
10346
+ } else {
10347
+ this.enable = this.type !== "none";
10348
+ }
10349
+ if (data.url !== undefined) {
10350
+ this.url = data.url;
10351
+ }
10352
+ if (data.data !== undefined) {
10353
+ if (typeof data.data === "string") {
10354
+ this.data = data.data;
10591
10355
  } else {
10592
- this.enable = this.type !== Type.none;
10593
- }
10594
- if (data.url !== undefined) {
10595
- this.url = data.url;
10596
- }
10597
- if (data.data !== undefined) {
10598
- if (typeof data.data === "string") {
10599
- this.data = data.data;
10600
- } else {
10601
- this.data = new LocalSvg;
10602
- this.data.load(data.data);
10603
- }
10604
- }
10605
- if (data.position !== undefined) {
10606
- this.position = deepExtend({}, data.position);
10356
+ this.data = new PolygonMaskLocalSvg;
10357
+ this.data.load(data.data);
10607
10358
  }
10608
10359
  }
10360
+ if (data.position !== undefined) {
10361
+ this.position = deepExtend({}, data.position);
10362
+ }
10609
10363
  }
10610
10364
  }
10611
10365
  function drawPolygonMask(context, rawData, stroke) {
@@ -10707,29 +10461,27 @@
10707
10461
  const {dx: dx, dy: dy} = getDistances(pos, s1);
10708
10462
  const {dx: dxx, dy: dyy} = getDistances(s2, s1);
10709
10463
  const t = (dx * dxx + dy * dyy) / (dxx ** 2 + dyy ** 2);
10710
- let x = s1.x + dxx * t;
10711
- let y = s1.y + dyy * t;
10464
+ const res = {
10465
+ x: s1.x + dxx * t,
10466
+ y: s1.x + dyy * t,
10467
+ isOnSegment: t >= 0 && t <= 1
10468
+ };
10712
10469
  if (t < 0) {
10713
- x = s1.x;
10714
- y = s1.y;
10470
+ res.x = s1.x;
10471
+ res.y = s1.y;
10715
10472
  } else if (t > 1) {
10716
- x = s2.x;
10717
- y = s2.y;
10473
+ res.x = s2.x;
10474
+ res.y = s2.y;
10718
10475
  }
10719
- return {
10720
- x: x,
10721
- y: y,
10722
- isOnSegment: t >= 0 && t <= 1
10723
- };
10476
+ return res;
10724
10477
  }
10725
10478
  function segmentBounce(start, stop, velocity) {
10726
10479
  const {dx: dx, dy: dy} = getDistances(start, stop);
10727
10480
  const wallAngle = Math.atan2(dy, dx);
10728
- const wallNormalX = Math.sin(wallAngle);
10729
- const wallNormalY = -Math.cos(wallAngle);
10730
- const d = 2 * (velocity.x * wallNormalX + velocity.y * wallNormalY);
10731
- velocity.x -= d * wallNormalX;
10732
- velocity.y -= d * wallNormalY;
10481
+ const wallNormal = Vector.create(Math.sin(wallAngle), -Math.cos(wallAngle));
10482
+ const d = 2 * (velocity.x * wallNormal.x + velocity.y * wallNormal.y);
10483
+ wallNormal.multTo(d);
10484
+ velocity.subFrom(wallNormal);
10733
10485
  }
10734
10486
  class PolygonMaskInstance {
10735
10487
  constructor(container) {
@@ -10753,7 +10505,7 @@
10753
10505
  resize() {
10754
10506
  const container = this.container;
10755
10507
  const options = this.options;
10756
- if (!(options.enable && options.type !== Type.none)) {
10508
+ if (!(options.enable && options.type !== "none")) {
10757
10509
  return;
10758
10510
  }
10759
10511
  if (this.redrawTimeout) {
@@ -10770,7 +10522,7 @@
10770
10522
  }
10771
10523
  particlesInitialization() {
10772
10524
  const options = this.options;
10773
- if (options.enable && options.type === Type.inline && (options.inline.arrangement === InlineArrangement.onePerPoint || options.inline.arrangement === InlineArrangement.perPoint)) {
10525
+ if (options.enable && options.type === "inline" && (options.inline.arrangement === "one-per-point" || options.inline.arrangement === "per-point")) {
10774
10526
  this.drawPoints();
10775
10527
  return true;
10776
10528
  }
@@ -10789,7 +10541,7 @@
10789
10541
  }
10790
10542
  clickPositionValid(position) {
10791
10543
  const options = this.options;
10792
- return options.enable && options.type !== Type.none && options.type !== Type.inline && this.checkInsidePolygon(position);
10544
+ return options.enable && options.type !== "none" && options.type !== "inline" && this.checkInsidePolygon(position);
10793
10545
  }
10794
10546
  draw(context) {
10795
10547
  var _a;
@@ -10817,10 +10569,10 @@
10817
10569
  }
10818
10570
  polygonBounce(particle, _delta, direction) {
10819
10571
  const options = this.options;
10820
- if (!this.raw || !options.enable || direction !== OutModeDirection.top) {
10572
+ if (!this.raw || !options.enable || direction !== "top") {
10821
10573
  return false;
10822
10574
  }
10823
- if (options.type === Type.inside || options.type === Type.outside) {
10575
+ if (options.type === "inside" || options.type === "outside") {
10824
10576
  let closest, dx, dy;
10825
10577
  const pos = particle.getPosition(), radius = particle.getRadius();
10826
10578
  for (let i = 0, j = this.raw.length - 1; i < this.raw.length; j = i++) {
@@ -10849,7 +10601,7 @@
10849
10601
  particle.velocity.mult(-1);
10850
10602
  return true;
10851
10603
  }
10852
- } else if (options.type === Type.inline && particle.initialPosition) {
10604
+ } else if (options.type === "inline" && particle.initialPosition) {
10853
10605
  const dist = getDistance(particle.initialPosition, particle.getPosition());
10854
10606
  if (dist > this.polygonMaskMoveRadius) {
10855
10607
  particle.velocity.x = particle.velocity.y / 2 - particle.velocity.x;
@@ -10863,7 +10615,7 @@
10863
10615
  var _a, _b;
10864
10616
  const container = this.container;
10865
10617
  const options = this.options;
10866
- if (!options.enable || options.type === Type.none || options.type === Type.inline) {
10618
+ if (!options.enable || options.type === "none" || options.type === "inline") {
10867
10619
  return true;
10868
10620
  }
10869
10621
  if (!this.raw) {
@@ -10881,7 +10633,7 @@
10881
10633
  inside = !inside;
10882
10634
  }
10883
10635
  }
10884
- return options.type === Type.inside ? inside : options.type === Type.outside ? !inside : false;
10636
+ return options.type === "inside" ? inside : options.type === "outside" ? !inside : false;
10885
10637
  }
10886
10638
  parseSvgPath(xml, force) {
10887
10639
  var _a, _b, _c;
@@ -10950,22 +10702,22 @@
10950
10702
  const container = this.container;
10951
10703
  const options = this.options;
10952
10704
  let position;
10953
- if (options.type === Type.inline) {
10705
+ if (options.type === "inline") {
10954
10706
  switch (options.inline.arrangement) {
10955
- case InlineArrangement.randomPoint:
10707
+ case "random-point":
10956
10708
  position = this.getRandomPoint();
10957
10709
  break;
10958
10710
 
10959
- case InlineArrangement.randomLength:
10711
+ case "random-length":
10960
10712
  position = this.getRandomPointByLength();
10961
10713
  break;
10962
10714
 
10963
- case InlineArrangement.equidistant:
10715
+ case "equidistant":
10964
10716
  position = this.getEquidistantPointByIndex(container.particles.count);
10965
10717
  break;
10966
10718
 
10967
- case InlineArrangement.onePerPoint:
10968
- case InlineArrangement.perPoint:
10719
+ case "one-per-point":
10720
+ case "per-point":
10969
10721
  default:
10970
10722
  position = this.getPointByIndex(container.particles.count);
10971
10723
  }
@@ -11093,7 +10845,7 @@
11093
10845
  this.createPath2D();
11094
10846
  }
11095
10847
  }
11096
- class PolygonMask_plugin_Plugin {
10848
+ class PolygonMaskPlugin {
11097
10849
  constructor() {
11098
10850
  this.id = "polygonMask";
11099
10851
  }
@@ -11102,7 +10854,7 @@
11102
10854
  }
11103
10855
  needsPlugin(options) {
11104
10856
  var _a, _b, _c;
11105
- return (_b = (_a = options === null || options === void 0 ? void 0 : options.polygon) === null || _a === void 0 ? void 0 : _a.enable) !== null && _b !== void 0 ? _b : ((_c = options === null || options === void 0 ? void 0 : options.polygon) === null || _c === void 0 ? void 0 : _c.type) !== undefined && options.polygon.type !== Type.none;
10857
+ return (_b = (_a = options === null || options === void 0 ? void 0 : options.polygon) === null || _a === void 0 ? void 0 : _a.enable) !== null && _b !== void 0 ? _b : ((_c = options === null || options === void 0 ? void 0 : options.polygon) === null || _c === void 0 ? void 0 : _c.type) !== undefined && options.polygon.type !== "none";
11106
10858
  }
11107
10859
  loadOptions(options, source) {
11108
10860
  if (!this.needsPlugin(source)) {
@@ -11117,72 +10869,12 @@
11117
10869
  }
11118
10870
  }
11119
10871
  async function loadPolygonMaskPlugin(tsParticles) {
11120
- if (!isSsr() && !window.SVGPathSeg) {
11121
- await __webpack_require__.e(917).then(__webpack_require__.t.bind(__webpack_require__, 167, 23));
10872
+ if (!isSsr() && !("SVGPathSeg" in window)) {
10873
+ await __webpack_require__.e(404).then(__webpack_require__.t.bind(__webpack_require__, 167, 23));
11122
10874
  }
11123
- const plugin = new PolygonMask_plugin_Plugin;
10875
+ const plugin = new PolygonMaskPlugin;
11124
10876
  await tsParticles.addPlugin(plugin);
11125
10877
  }
11126
- function updateRoll(particle, delta) {
11127
- const roll = particle.options.roll;
11128
- if (!particle.roll || !roll.enable) {
11129
- return;
11130
- }
11131
- const speed = particle.roll.speed * delta.factor;
11132
- const max = 2 * Math.PI;
11133
- particle.roll.angle += speed;
11134
- if (particle.roll.angle > max) {
11135
- particle.roll.angle -= max;
11136
- }
11137
- }
11138
- class RollUpdater {
11139
- init(particle) {
11140
- const rollOpt = particle.options.roll;
11141
- if (rollOpt.enable) {
11142
- particle.roll = {
11143
- angle: Math.random() * Math.PI * 2,
11144
- speed: getRangeValue(rollOpt.speed) / 360
11145
- };
11146
- if (rollOpt.backColor) {
11147
- particle.backColor = colorToHsl(rollOpt.backColor);
11148
- } else if (rollOpt.darken.enable && rollOpt.enlighten.enable) {
11149
- const alterType = Math.random() >= .5 ? AlterType.darken : AlterType.enlighten;
11150
- particle.roll.alter = {
11151
- type: alterType,
11152
- value: alterType === AlterType.darken ? rollOpt.darken.value : rollOpt.enlighten.value
11153
- };
11154
- } else if (rollOpt.darken.enable) {
11155
- particle.roll.alter = {
11156
- type: AlterType.darken,
11157
- value: rollOpt.darken.value
11158
- };
11159
- } else if (rollOpt.enlighten.enable) {
11160
- particle.roll.alter = {
11161
- type: AlterType.enlighten,
11162
- value: rollOpt.enlighten.value
11163
- };
11164
- }
11165
- } else {
11166
- particle.roll = {
11167
- angle: 0,
11168
- speed: 0
11169
- };
11170
- }
11171
- }
11172
- isEnabled(particle) {
11173
- const roll = particle.options.roll;
11174
- return !particle.destroyed && !particle.spawning && roll.enable;
11175
- }
11176
- update(particle, delta) {
11177
- if (!this.isEnabled(particle)) {
11178
- return;
11179
- }
11180
- updateRoll(particle, delta);
11181
- }
11182
- }
11183
- async function loadRollUpdater(tsParticles) {
11184
- await tsParticles.addParticleUpdater("roll", (() => new RollUpdater));
11185
- }
11186
10878
  async function loadFull(tsParticles) {
11187
10879
  await loadSlim(tsParticles);
11188
10880
  await loadExternalTrailInteraction(tsParticles);
@@ -11193,7 +10885,7 @@
11193
10885
  await loadEmittersPlugin(tsParticles);
11194
10886
  await loadPolygonMaskPlugin(tsParticles);
11195
10887
  }
11196
- const tsParticles = new Main;
10888
+ const tsParticles = new Engine;
11197
10889
  tsParticles.init();
11198
10890
  const {particlesJS: particlesJS, pJSDom: pJSDom} = initPjs(tsParticles);
11199
10891
  loadFull(tsParticles);