tsparticles 1.39.0 → 1.40.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 (983) hide show
  1. package/Core/Canvas.d.ts +1 -1
  2. package/Core/Canvas.js +27 -27
  3. package/Core/Container.d.ts +8 -6
  4. package/Core/Container.js +33 -18
  5. package/Core/Interfaces/Gradients.d.ts +2 -2
  6. package/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  7. package/Core/Interfaces/IContainerPlugin.d.ts +4 -4
  8. package/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  9. package/Core/Interfaces/IInteractor.d.ts +1 -1
  10. package/Core/Interfaces/IParticle.d.ts +8 -8
  11. package/Core/Interfaces/IParticleGradientAnimation.d.ts +1 -1
  12. package/Core/Interfaces/IParticleSpin.d.ts +1 -1
  13. package/Core/Interfaces/IParticlesInteractor.d.ts +2 -2
  14. package/Core/Interfaces/IPlugin.d.ts +1 -1
  15. package/Core/Loader.d.ts +13 -10
  16. package/Core/Loader.js +42 -26
  17. package/Core/Particle.d.ts +6 -4
  18. package/Core/Particle.js +47 -32
  19. package/Core/Particles.d.ts +6 -4
  20. package/Core/Particles.js +32 -17
  21. package/Core/Utils/Circle.d.ts +1 -1
  22. package/Core/Utils/CircleWarp.d.ts +1 -1
  23. package/Core/Utils/CircleWarp.js +1 -1
  24. package/Core/Utils/EventListeners.js +1 -1
  25. package/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  26. package/Core/Utils/InteractionManager.d.ts +6 -4
  27. package/Core/Utils/InteractionManager.js +19 -3
  28. package/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  29. package/Core/Utils/ParticlesMover.d.ts +1 -1
  30. package/Core/Utils/Plugins.d.ts +30 -16
  31. package/Core/Utils/Plugins.js +58 -46
  32. package/Core/Utils/QuadTree.d.ts +3 -3
  33. package/Core/Utils/QuadTree.js +1 -1
  34. package/Core/Utils/Rectangle.d.ts +1 -1
  35. package/Core/Utils/Vector3d.d.ts +1 -1
  36. package/Interactions/External/Attract/Attractor.d.ts +1 -1
  37. package/Interactions/External/Attract/Attractor.js +1 -1
  38. package/Interactions/External/Attract/index.d.ts +1 -1
  39. package/Interactions/External/Attract/index.js +2 -2
  40. package/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  41. package/Interactions/External/Bounce/Bouncer.js +1 -1
  42. package/Interactions/External/Bounce/index.d.ts +1 -1
  43. package/Interactions/External/Bounce/index.js +2 -2
  44. package/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  45. package/Interactions/External/Bubble/Bubbler.js +1 -1
  46. package/Interactions/External/Bubble/index.d.ts +1 -1
  47. package/Interactions/External/Bubble/index.js +2 -2
  48. package/Interactions/External/Connect/Connector.js +1 -1
  49. package/Interactions/External/Connect/index.d.ts +1 -1
  50. package/Interactions/External/Connect/index.js +2 -2
  51. package/Interactions/External/Grab/Grabber.d.ts +1 -1
  52. package/Interactions/External/Grab/Grabber.js +1 -1
  53. package/Interactions/External/Grab/index.d.ts +1 -1
  54. package/Interactions/External/Grab/index.js +2 -2
  55. package/Interactions/External/Repulse/Repulser.d.ts +1 -1
  56. package/Interactions/External/Repulse/Repulser.js +1 -1
  57. package/Interactions/External/Repulse/index.d.ts +1 -1
  58. package/Interactions/External/Repulse/index.js +2 -2
  59. package/Interactions/External/Trail/TrailMaker.js +1 -1
  60. package/Interactions/External/Trail/index.d.ts +1 -1
  61. package/Interactions/External/Trail/index.js +2 -2
  62. package/Interactions/Particles/Attract/Attractor.js +1 -1
  63. package/Interactions/Particles/Attract/index.d.ts +1 -1
  64. package/Interactions/Particles/Attract/index.js +2 -2
  65. package/Interactions/Particles/Collisions/index.d.ts +1 -1
  66. package/Interactions/Particles/Collisions/index.js +2 -2
  67. package/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
  68. package/Interactions/Particles/Links/Linker.d.ts +1 -1
  69. package/Interactions/Particles/Links/Linker.js +1 -1
  70. package/Interactions/Particles/Links/index.d.ts +1 -1
  71. package/Interactions/Particles/Links/index.js +4 -4
  72. package/Interactions/Particles/Links/interaction.d.ts +1 -1
  73. package/Interactions/Particles/Links/interaction.js +2 -2
  74. package/Interactions/Particles/Links/plugin.d.ts +1 -1
  75. package/Interactions/Particles/Links/plugin.js +2 -2
  76. package/Options/Classes/AnimatableColor.d.ts +3 -3
  77. package/Options/Classes/AnimatableColor.js +1 -1
  78. package/Options/Classes/AnimatableGradient.d.ts +6 -6
  79. package/Options/Classes/AnimationOptions.d.ts +2 -2
  80. package/Options/Classes/Background/Background.d.ts +2 -2
  81. package/Options/Classes/BackgroundMask/BackgroundMask.d.ts +2 -2
  82. package/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +2 -2
  83. package/Options/Classes/ColorAnimation.d.ts +1 -1
  84. package/Options/Classes/HslAnimation.d.ts +2 -2
  85. package/Options/Classes/Interactivity/Events/ClickEvent.d.ts +2 -2
  86. package/Options/Classes/Interactivity/Events/DivEvent.d.ts +1 -1
  87. package/Options/Classes/Interactivity/Events/Events.d.ts +2 -2
  88. package/Options/Classes/Interactivity/Events/HoverEvent.d.ts +3 -3
  89. package/Options/Classes/Interactivity/Events/Parallax.d.ts +1 -1
  90. package/Options/Classes/Interactivity/Interactivity.d.ts +2 -2
  91. package/Options/Classes/Interactivity/Modes/Attract.d.ts +2 -2
  92. package/Options/Classes/Interactivity/Modes/Bubble.d.ts +2 -2
  93. package/Options/Classes/Interactivity/Modes/Bubble.js +1 -1
  94. package/Options/Classes/Interactivity/Modes/BubbleBase.d.ts +1 -1
  95. package/Options/Classes/Interactivity/Modes/BubbleDiv.d.ts +1 -1
  96. package/Options/Classes/Interactivity/Modes/Connect.d.ts +2 -2
  97. package/Options/Classes/Interactivity/Modes/ConnectLinks.d.ts +1 -1
  98. package/Options/Classes/Interactivity/Modes/Grab.d.ts +2 -2
  99. package/Options/Classes/Interactivity/Modes/GrabLinks.d.ts +2 -2
  100. package/Options/Classes/Interactivity/Modes/Light.d.ts +1 -1
  101. package/Options/Classes/Interactivity/Modes/Modes.d.ts +7 -7
  102. package/Options/Classes/Interactivity/Modes/Modes.js +4 -4
  103. package/Options/Classes/Interactivity/Modes/Push.d.ts +1 -1
  104. package/Options/Classes/Interactivity/Modes/Remove.d.ts +1 -1
  105. package/Options/Classes/Interactivity/Modes/Repulse.d.ts +3 -3
  106. package/Options/Classes/Interactivity/Modes/Repulse.js +1 -1
  107. package/Options/Classes/Interactivity/Modes/RepulseBase.d.ts +2 -2
  108. package/Options/Classes/Interactivity/Modes/RepulseDiv.d.ts +1 -1
  109. package/Options/Classes/Interactivity/Modes/Slow.d.ts +1 -1
  110. package/Options/Classes/Interactivity/Modes/Trail.d.ts +2 -2
  111. package/Options/Classes/ManualParticle.d.ts +2 -2
  112. package/Options/Classes/Motion/Motion.d.ts +1 -1
  113. package/Options/Classes/Options.d.ts +9 -8
  114. package/Options/Classes/Options.js +20 -13
  115. package/Options/Classes/OptionsColor.d.ts +2 -2
  116. package/Options/Classes/Particles/Bounce/Bounce.d.ts +1 -1
  117. package/Options/Classes/Particles/Collisions/Collisions.d.ts +4 -4
  118. package/Options/Classes/Particles/Collisions/CollisionsOverlap.d.ts +2 -2
  119. package/Options/Classes/Particles/Destroy/Destroy.d.ts +1 -1
  120. package/Options/Classes/Particles/Destroy/Split.d.ts +3 -3
  121. package/Options/Classes/Particles/Life/Life.d.ts +1 -1
  122. package/Options/Classes/Particles/Links/Links.d.ts +2 -2
  123. package/Options/Classes/Particles/Links/LinksShadow.d.ts +2 -2
  124. package/Options/Classes/Particles/Links/LinksTriangle.d.ts +1 -1
  125. package/Options/Classes/Particles/Move/Attract.d.ts +2 -2
  126. package/Options/Classes/Particles/Move/Move.d.ts +5 -5
  127. package/Options/Classes/Particles/Move/Move.js +3 -3
  128. package/Options/Classes/Particles/Move/OutModes.d.ts +2 -2
  129. package/Options/Classes/Particles/Move/Path/Path.d.ts +3 -3
  130. package/Options/Classes/Particles/Move/Spin.d.ts +3 -3
  131. package/Options/Classes/Particles/Move/Trail.d.ts +2 -2
  132. package/Options/Classes/Particles/Number/Density.d.ts +1 -1
  133. package/Options/Classes/Particles/Number/ParticlesNumber.d.ts +2 -2
  134. package/Options/Classes/Particles/Opacity/Opacity.d.ts +1 -1
  135. package/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +3 -3
  136. package/Options/Classes/Particles/Orbit/Orbit.d.ts +5 -5
  137. package/Options/Classes/Particles/Orbit/Orbit.js +2 -2
  138. package/Options/Classes/Particles/Orbit/OrbitRotation.d.ts +1 -1
  139. package/Options/Classes/Particles/ParticlesOptions.d.ts +16 -16
  140. package/Options/Classes/Particles/ParticlesOptions.js +13 -13
  141. package/Options/Classes/Particles/Repulse/Repulse.d.ts +1 -1
  142. package/Options/Classes/Particles/Roll/Roll.d.ts +2 -2
  143. package/Options/Classes/Particles/Roll/RollLight.d.ts +1 -1
  144. package/Options/Classes/Particles/Rotate/Rotate.d.ts +3 -3
  145. package/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +1 -1
  146. package/Options/Classes/Particles/Shadow.d.ts +3 -3
  147. package/Options/Classes/Particles/Shape/Shape.d.ts +5 -5
  148. package/Options/Classes/Particles/Size/Size.d.ts +2 -2
  149. package/Options/Classes/Particles/Size/SizeAnimation.d.ts +3 -3
  150. package/Options/Classes/Particles/Stroke.d.ts +2 -2
  151. package/Options/Classes/Particles/Tilt/Tilt.d.ts +3 -3
  152. package/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +1 -1
  153. package/Options/Classes/Particles/Twinkle/Twinkle.d.ts +1 -1
  154. package/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
  155. package/Options/Classes/Particles/Wobble/Wobble.d.ts +2 -2
  156. package/Options/Classes/Particles/ZIndex/ZIndex.d.ts +1 -1
  157. package/Options/Classes/Random.d.ts +1 -1
  158. package/Options/Classes/Responsive.d.ts +2 -2
  159. package/Options/Classes/Theme/Theme.d.ts +2 -2
  160. package/Options/Classes/Theme/Theme.js +1 -1
  161. package/Options/Classes/Theme/ThemeDefault.d.ts +2 -2
  162. package/Options/Classes/ValueWithRandom.d.ts +2 -2
  163. package/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +1 -1
  164. package/Options/Interfaces/IAnimatableColor.d.ts +1 -1
  165. package/Options/Interfaces/IAnimatableGradient.d.ts +1 -1
  166. package/Options/Interfaces/IColorAnimation.d.ts +1 -1
  167. package/Options/Interfaces/IManualParticle.d.ts +1 -1
  168. package/Options/Interfaces/IOptions.d.ts +6 -6
  169. package/Options/Interfaces/IOptionsGradient.d.ts +2 -2
  170. package/Options/Interfaces/IResponsive.d.ts +2 -2
  171. package/Options/Interfaces/IValueWithRandom.d.ts +1 -1
  172. package/Options/Interfaces/Interactivity/Events/IEvents.d.ts +1 -1
  173. package/Options/Interfaces/Interactivity/IInteractivity.d.ts +1 -1
  174. package/Options/Interfaces/Interactivity/Modes/IBubble.d.ts +2 -2
  175. package/Options/Interfaces/Interactivity/Modes/IBubbleBase.d.ts +1 -1
  176. package/Options/Interfaces/Interactivity/Modes/IModes.d.ts +2 -2
  177. package/Options/Interfaces/Interactivity/Modes/IRepulse.d.ts +2 -2
  178. package/Options/Interfaces/Interactivity/Modes/IRepulseDiv.d.ts +1 -1
  179. package/Options/Interfaces/Particles/Destroy/ISplit.d.ts +1 -1
  180. package/Options/Interfaces/Particles/IParticles.d.ts +14 -14
  181. package/Options/Interfaces/Particles/IShadow.d.ts +1 -1
  182. package/Options/Interfaces/Particles/IStroke.d.ts +1 -1
  183. package/Options/Interfaces/Particles/Links/ILinks.d.ts +1 -1
  184. package/Options/Interfaces/Particles/Move/IMove.d.ts +5 -5
  185. package/Options/Interfaces/Particles/Move/Path/{iPath.d.ts → IPath.d.ts} +0 -0
  186. package/Options/Interfaces/Particles/Move/Path/{iPath.js → IPath.js} +0 -0
  187. package/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +3 -3
  188. package/Options/Interfaces/Particles/Roll/IRoll.d.ts +1 -1
  189. package/Options/Interfaces/Particles/Rotate/IRotate.d.ts +1 -1
  190. package/Options/Interfaces/Particles/Shape/IShape.d.ts +3 -3
  191. package/Options/Interfaces/Particles/Tilt/ITilt.d.ts +1 -1
  192. package/Options/Interfaces/Theme/ITheme.d.ts +2 -2
  193. package/Plugins/Absorbers/AbsorberInstance.d.ts +5 -4
  194. package/Plugins/Absorbers/AbsorberInstance.js +18 -18
  195. package/Plugins/Absorbers/Absorbers.d.ts +3 -3
  196. package/Plugins/Absorbers/Absorbers.js +1 -1
  197. package/Plugins/Absorbers/Options/Classes/Absorber.d.ts +4 -4
  198. package/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -2
  199. package/Plugins/Absorbers/Options/Classes/AbsorberSize.js +1 -1
  200. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +2 -2
  201. package/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +1 -2
  202. package/Plugins/Absorbers/Options/Interfaces/IAbsorberOptions.d.ts +1 -1
  203. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +1 -1
  204. package/Plugins/Absorbers/index.d.ts +1 -1
  205. package/Plugins/Absorbers/index.js +3 -3
  206. package/Plugins/Emitters/EmitterContainer.d.ts +2 -1
  207. package/Plugins/Emitters/EmitterInstance.d.ts +10 -5
  208. package/Plugins/Emitters/EmitterInstance.js +78 -49
  209. package/Plugins/Emitters/Emitters.d.ts +6 -4
  210. package/Plugins/Emitters/Emitters.js +27 -4
  211. package/{browser/Plugins/Emitters/EmittersMain.d.ts → Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  212. package/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  213. package/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  214. package/Plugins/Emitters/Options/Classes/Emitter.d.ts +8 -7
  215. package/Plugins/Emitters/Options/Classes/Emitter.js +4 -3
  216. package/Plugins/Emitters/Options/Classes/EmitterLife.d.ts +1 -1
  217. package/Plugins/Emitters/Options/Classes/EmitterRate.d.ts +1 -1
  218. package/Plugins/Emitters/Options/Classes/EmitterSize.d.ts +1 -1
  219. package/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +7 -6
  220. package/Plugins/Emitters/Options/Interfaces/IEmitterOptions.d.ts +1 -1
  221. package/Plugins/Emitters/Options/Interfaces/IEmitterSize.d.ts +1 -1
  222. package/Plugins/Emitters/ShapeManager.d.ts +6 -3
  223. package/Plugins/Emitters/ShapeManager.js +16 -4
  224. package/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  225. package/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  226. package/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  227. package/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  228. package/Plugins/Emitters/index.d.ts +3 -3
  229. package/Plugins/Emitters/index.js +33 -14
  230. package/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +5 -5
  231. package/Plugins/PolygonMask/Options/Classes/PolygonMask.js +1 -1
  232. package/Plugins/PolygonMask/Options/Classes/PolygonMaskDraw.d.ts +2 -2
  233. package/Plugins/PolygonMask/Options/Classes/PolygonMaskDraw.js +1 -1
  234. package/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.d.ts +2 -2
  235. package/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +2 -2
  236. package/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +3 -3
  237. package/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +2 -2
  238. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +3 -3
  239. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +1 -1
  240. package/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.d.ts +1 -1
  241. package/Plugins/PolygonMask/PolygonMaskInstance.d.ts +3 -3
  242. package/Plugins/PolygonMask/PolygonMaskInstance.js +12 -12
  243. package/Plugins/PolygonMask/Types.d.ts +1 -1
  244. package/Plugins/PolygonMask/index.d.ts +1 -1
  245. package/Plugins/PolygonMask/index.js +3 -3
  246. package/README.md +162 -18
  247. package/Shapes/Circle/index.d.ts +1 -1
  248. package/Shapes/Circle/index.js +2 -2
  249. package/Shapes/Image/index.d.ts +1 -1
  250. package/Shapes/Image/index.js +3 -3
  251. package/Shapes/Line/index.d.ts +1 -1
  252. package/Shapes/Line/index.js +2 -2
  253. package/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
  254. package/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
  255. package/Shapes/Polygon/index.d.ts +3 -3
  256. package/Shapes/Polygon/index.js +7 -7
  257. package/Shapes/Square/index.d.ts +1 -1
  258. package/Shapes/Square/index.js +3 -3
  259. package/Shapes/Star/index.d.ts +1 -1
  260. package/Shapes/Star/index.js +2 -2
  261. package/Shapes/Text/index.d.ts +1 -1
  262. package/Shapes/Text/index.js +2 -2
  263. package/Types/ShapeData.d.ts +1 -1
  264. package/Types/ShapeDrawerFunctions.d.ts +1 -1
  265. package/Updaters/Angle/index.d.ts +1 -1
  266. package/Updaters/Angle/index.js +2 -2
  267. package/Updaters/Color/index.d.ts +1 -1
  268. package/Updaters/Color/index.js +2 -2
  269. package/Updaters/Life/index.d.ts +1 -1
  270. package/Updaters/Life/index.js +2 -2
  271. package/Updaters/Opacity/index.d.ts +1 -1
  272. package/Updaters/Opacity/index.js +2 -2
  273. package/Updaters/OutModes/IBounceData.d.ts +1 -1
  274. package/Updaters/OutModes/OutOfCanvasUpdater.js +9 -9
  275. package/Updaters/OutModes/index.d.ts +1 -1
  276. package/Updaters/OutModes/index.js +2 -2
  277. package/Updaters/Roll/index.d.ts +1 -1
  278. package/Updaters/Roll/index.js +2 -2
  279. package/Updaters/Size/index.d.ts +1 -1
  280. package/Updaters/Size/index.js +2 -2
  281. package/Updaters/StrokeColor/index.d.ts +1 -1
  282. package/Updaters/StrokeColor/index.js +2 -2
  283. package/Updaters/Tilt/index.d.ts +1 -1
  284. package/Updaters/Tilt/index.js +2 -2
  285. package/Updaters/Wobble/index.d.ts +1 -1
  286. package/Updaters/Wobble/index.js +2 -2
  287. package/Utils/CanvasUtils.d.ts +2 -3
  288. package/Utils/CanvasUtils.js +1 -1
  289. package/Utils/ColorUtils.js +1 -1
  290. package/Utils/NumberUtils.d.ts +2 -2
  291. package/Utils/Utils.d.ts +3 -3
  292. package/browser/Core/Canvas.d.ts +1 -1
  293. package/browser/Core/Canvas.js +1 -1
  294. package/browser/Core/Container.d.ts +9 -6
  295. package/browser/Core/Container.js +34 -18
  296. package/browser/Core/Interfaces/Gradients.d.ts +2 -2
  297. package/browser/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  298. package/browser/Core/Interfaces/IContainerPlugin.d.ts +4 -4
  299. package/browser/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  300. package/browser/Core/Interfaces/IInteractor.d.ts +1 -1
  301. package/browser/Core/Interfaces/IParticle.d.ts +8 -8
  302. package/browser/Core/Interfaces/IParticleGradientAnimation.d.ts +1 -1
  303. package/browser/Core/Interfaces/IParticleSpin.d.ts +1 -1
  304. package/browser/Core/Interfaces/IParticlesInteractor.d.ts +2 -2
  305. package/browser/Core/Interfaces/IPlugin.d.ts +1 -1
  306. package/browser/Core/Loader.d.ts +13 -10
  307. package/browser/Core/Loader.js +36 -20
  308. package/browser/Core/Particle.d.ts +6 -4
  309. package/browser/Core/Particle.js +19 -4
  310. package/browser/Core/Particles.d.ts +6 -4
  311. package/browser/Core/Particles.js +22 -7
  312. package/browser/Core/Utils/Circle.d.ts +1 -1
  313. package/browser/Core/Utils/CircleWarp.d.ts +1 -1
  314. package/browser/Core/Utils/CircleWarp.js +1 -1
  315. package/browser/Core/Utils/EventListeners.js +1 -1
  316. package/browser/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  317. package/browser/Core/Utils/InteractionManager.d.ts +6 -4
  318. package/browser/Core/Utils/InteractionManager.js +19 -3
  319. package/browser/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  320. package/browser/Core/Utils/ParticlesMover.d.ts +1 -1
  321. package/browser/Core/Utils/Plugins.d.ts +30 -16
  322. package/browser/Core/Utils/Plugins.js +58 -46
  323. package/browser/Core/Utils/QuadTree.d.ts +3 -3
  324. package/browser/Core/Utils/QuadTree.js +1 -1
  325. package/browser/Core/Utils/Rectangle.d.ts +1 -1
  326. package/browser/Core/Utils/Vector3d.d.ts +1 -1
  327. package/browser/Interactions/External/Attract/Attractor.d.ts +1 -1
  328. package/browser/Interactions/External/Attract/Attractor.js +1 -1
  329. package/browser/Interactions/External/Attract/index.d.ts +1 -1
  330. package/browser/Interactions/External/Attract/index.js +2 -2
  331. package/browser/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  332. package/browser/Interactions/External/Bounce/Bouncer.js +1 -1
  333. package/browser/Interactions/External/Bounce/index.d.ts +1 -1
  334. package/browser/Interactions/External/Bounce/index.js +2 -2
  335. package/browser/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  336. package/browser/Interactions/External/Bubble/Bubbler.js +1 -1
  337. package/browser/Interactions/External/Bubble/index.d.ts +1 -1
  338. package/browser/Interactions/External/Bubble/index.js +2 -2
  339. package/browser/Interactions/External/Connect/Connector.js +1 -1
  340. package/browser/Interactions/External/Connect/index.d.ts +1 -1
  341. package/browser/Interactions/External/Connect/index.js +2 -2
  342. package/browser/Interactions/External/Grab/Grabber.d.ts +1 -1
  343. package/browser/Interactions/External/Grab/Grabber.js +1 -1
  344. package/browser/Interactions/External/Grab/index.d.ts +1 -1
  345. package/browser/Interactions/External/Grab/index.js +2 -2
  346. package/browser/Interactions/External/Repulse/Repulser.d.ts +1 -1
  347. package/browser/Interactions/External/Repulse/Repulser.js +1 -1
  348. package/browser/Interactions/External/Repulse/index.d.ts +1 -1
  349. package/browser/Interactions/External/Repulse/index.js +2 -2
  350. package/browser/Interactions/External/Trail/TrailMaker.js +1 -1
  351. package/browser/Interactions/External/Trail/index.d.ts +1 -1
  352. package/browser/Interactions/External/Trail/index.js +2 -2
  353. package/browser/Interactions/Particles/Attract/Attractor.js +1 -1
  354. package/browser/Interactions/Particles/Attract/index.d.ts +1 -1
  355. package/browser/Interactions/Particles/Attract/index.js +2 -2
  356. package/browser/Interactions/Particles/Collisions/index.d.ts +1 -1
  357. package/browser/Interactions/Particles/Collisions/index.js +2 -2
  358. package/browser/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
  359. package/browser/Interactions/Particles/Links/Linker.d.ts +1 -1
  360. package/browser/Interactions/Particles/Links/Linker.js +1 -1
  361. package/browser/Interactions/Particles/Links/index.d.ts +1 -1
  362. package/browser/Interactions/Particles/Links/index.js +4 -4
  363. package/browser/Interactions/Particles/Links/interaction.d.ts +1 -1
  364. package/browser/Interactions/Particles/Links/interaction.js +2 -2
  365. package/browser/Interactions/Particles/Links/plugin.d.ts +1 -1
  366. package/browser/Interactions/Particles/Links/plugin.js +2 -2
  367. package/browser/Options/Classes/AnimatableColor.d.ts +3 -3
  368. package/browser/Options/Classes/AnimatableColor.js +1 -1
  369. package/browser/Options/Classes/AnimatableGradient.d.ts +6 -6
  370. package/browser/Options/Classes/AnimationOptions.d.ts +2 -2
  371. package/browser/Options/Classes/Background/Background.d.ts +2 -2
  372. package/browser/Options/Classes/BackgroundMask/BackgroundMask.d.ts +2 -2
  373. package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +2 -2
  374. package/browser/Options/Classes/ColorAnimation.d.ts +1 -1
  375. package/browser/Options/Classes/HslAnimation.d.ts +2 -2
  376. package/browser/Options/Classes/Interactivity/Events/ClickEvent.d.ts +2 -2
  377. package/browser/Options/Classes/Interactivity/Events/DivEvent.d.ts +1 -1
  378. package/browser/Options/Classes/Interactivity/Events/Events.d.ts +2 -2
  379. package/browser/Options/Classes/Interactivity/Events/HoverEvent.d.ts +3 -3
  380. package/browser/Options/Classes/Interactivity/Events/Parallax.d.ts +1 -1
  381. package/browser/Options/Classes/Interactivity/Interactivity.d.ts +2 -2
  382. package/browser/Options/Classes/Interactivity/Modes/Attract.d.ts +2 -2
  383. package/browser/Options/Classes/Interactivity/Modes/Bubble.d.ts +2 -2
  384. package/browser/Options/Classes/Interactivity/Modes/Bubble.js +1 -1
  385. package/browser/Options/Classes/Interactivity/Modes/BubbleBase.d.ts +1 -1
  386. package/browser/Options/Classes/Interactivity/Modes/BubbleDiv.d.ts +1 -1
  387. package/browser/Options/Classes/Interactivity/Modes/Connect.d.ts +2 -2
  388. package/browser/Options/Classes/Interactivity/Modes/ConnectLinks.d.ts +1 -1
  389. package/browser/Options/Classes/Interactivity/Modes/Grab.d.ts +2 -2
  390. package/browser/Options/Classes/Interactivity/Modes/GrabLinks.d.ts +2 -2
  391. package/browser/Options/Classes/Interactivity/Modes/Light.d.ts +1 -1
  392. package/browser/Options/Classes/Interactivity/Modes/Modes.d.ts +7 -7
  393. package/browser/Options/Classes/Interactivity/Modes/Modes.js +4 -4
  394. package/browser/Options/Classes/Interactivity/Modes/Push.d.ts +1 -1
  395. package/browser/Options/Classes/Interactivity/Modes/Remove.d.ts +1 -1
  396. package/browser/Options/Classes/Interactivity/Modes/Repulse.d.ts +3 -3
  397. package/browser/Options/Classes/Interactivity/Modes/Repulse.js +1 -1
  398. package/browser/Options/Classes/Interactivity/Modes/RepulseBase.d.ts +2 -2
  399. package/browser/Options/Classes/Interactivity/Modes/RepulseDiv.d.ts +1 -1
  400. package/browser/Options/Classes/Interactivity/Modes/Slow.d.ts +1 -1
  401. package/browser/Options/Classes/Interactivity/Modes/Trail.d.ts +2 -2
  402. package/browser/Options/Classes/ManualParticle.d.ts +2 -2
  403. package/browser/Options/Classes/Motion/Motion.d.ts +1 -1
  404. package/browser/Options/Classes/Options.d.ts +9 -8
  405. package/browser/Options/Classes/Options.js +20 -13
  406. package/browser/Options/Classes/OptionsColor.d.ts +2 -2
  407. package/browser/Options/Classes/Particles/Bounce/Bounce.d.ts +1 -1
  408. package/browser/Options/Classes/Particles/Collisions/Collisions.d.ts +4 -4
  409. package/browser/Options/Classes/Particles/Collisions/CollisionsOverlap.d.ts +2 -2
  410. package/browser/Options/Classes/Particles/Destroy/Destroy.d.ts +1 -1
  411. package/browser/Options/Classes/Particles/Destroy/Split.d.ts +3 -3
  412. package/browser/Options/Classes/Particles/Life/Life.d.ts +1 -1
  413. package/browser/Options/Classes/Particles/Links/Links.d.ts +2 -2
  414. package/browser/Options/Classes/Particles/Links/LinksShadow.d.ts +2 -2
  415. package/browser/Options/Classes/Particles/Links/LinksTriangle.d.ts +1 -1
  416. package/browser/Options/Classes/Particles/Move/Attract.d.ts +2 -2
  417. package/browser/Options/Classes/Particles/Move/Move.d.ts +5 -5
  418. package/browser/Options/Classes/Particles/Move/Move.js +3 -3
  419. package/browser/Options/Classes/Particles/Move/OutModes.d.ts +2 -2
  420. package/browser/Options/Classes/Particles/Move/Path/Path.d.ts +3 -3
  421. package/browser/Options/Classes/Particles/Move/Spin.d.ts +3 -3
  422. package/browser/Options/Classes/Particles/Move/Trail.d.ts +2 -2
  423. package/browser/Options/Classes/Particles/Number/Density.d.ts +1 -1
  424. package/browser/Options/Classes/Particles/Number/ParticlesNumber.d.ts +2 -2
  425. package/browser/Options/Classes/Particles/Opacity/Opacity.d.ts +1 -1
  426. package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +3 -3
  427. package/browser/Options/Classes/Particles/Orbit/Orbit.d.ts +5 -5
  428. package/browser/Options/Classes/Particles/Orbit/Orbit.js +2 -2
  429. package/browser/Options/Classes/Particles/Orbit/OrbitRotation.d.ts +1 -1
  430. package/browser/Options/Classes/Particles/ParticlesOptions.d.ts +16 -16
  431. package/browser/Options/Classes/Particles/ParticlesOptions.js +13 -13
  432. package/browser/Options/Classes/Particles/Repulse/Repulse.d.ts +1 -1
  433. package/browser/Options/Classes/Particles/Roll/Roll.d.ts +2 -2
  434. package/browser/Options/Classes/Particles/Roll/RollLight.d.ts +1 -1
  435. package/browser/Options/Classes/Particles/Rotate/Rotate.d.ts +3 -3
  436. package/browser/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +1 -1
  437. package/browser/Options/Classes/Particles/Shadow.d.ts +3 -3
  438. package/browser/Options/Classes/Particles/Shape/Shape.d.ts +5 -5
  439. package/browser/Options/Classes/Particles/Size/Size.d.ts +2 -2
  440. package/browser/Options/Classes/Particles/Size/SizeAnimation.d.ts +3 -3
  441. package/browser/Options/Classes/Particles/Stroke.d.ts +2 -2
  442. package/browser/Options/Classes/Particles/Tilt/Tilt.d.ts +3 -3
  443. package/browser/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +1 -1
  444. package/browser/Options/Classes/Particles/Twinkle/Twinkle.d.ts +1 -1
  445. package/browser/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
  446. package/browser/Options/Classes/Particles/Wobble/Wobble.d.ts +2 -2
  447. package/browser/Options/Classes/Particles/ZIndex/ZIndex.d.ts +1 -1
  448. package/browser/Options/Classes/Random.d.ts +1 -1
  449. package/browser/Options/Classes/Responsive.d.ts +2 -2
  450. package/browser/Options/Classes/Theme/Theme.d.ts +2 -2
  451. package/browser/Options/Classes/Theme/Theme.js +1 -1
  452. package/browser/Options/Classes/Theme/ThemeDefault.d.ts +2 -2
  453. package/browser/Options/Classes/ValueWithRandom.d.ts +2 -2
  454. package/browser/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +1 -1
  455. package/browser/Options/Interfaces/IAnimatableColor.d.ts +1 -1
  456. package/browser/Options/Interfaces/IAnimatableGradient.d.ts +1 -1
  457. package/browser/Options/Interfaces/IColorAnimation.d.ts +1 -1
  458. package/browser/Options/Interfaces/IColorAnimation.js +0 -4
  459. package/browser/Options/Interfaces/IManualParticle.d.ts +1 -1
  460. package/browser/Options/Interfaces/IOptions.d.ts +6 -6
  461. package/browser/Options/Interfaces/IOptionsGradient.d.ts +2 -2
  462. package/browser/Options/Interfaces/IResponsive.d.ts +2 -2
  463. package/browser/Options/Interfaces/IValueWithRandom.d.ts +1 -1
  464. package/browser/Options/Interfaces/Interactivity/Events/IEvents.d.ts +1 -1
  465. package/browser/Options/Interfaces/Interactivity/IInteractivity.d.ts +1 -1
  466. package/browser/Options/Interfaces/Interactivity/Modes/IBubble.d.ts +2 -2
  467. package/browser/Options/Interfaces/Interactivity/Modes/IBubbleBase.d.ts +1 -1
  468. package/browser/Options/Interfaces/Interactivity/Modes/IModes.d.ts +2 -2
  469. package/browser/Options/Interfaces/Interactivity/Modes/IRepulse.d.ts +2 -2
  470. package/browser/Options/Interfaces/Interactivity/Modes/IRepulseDiv.d.ts +1 -1
  471. package/browser/Options/Interfaces/Particles/Destroy/ISplit.d.ts +1 -1
  472. package/browser/Options/Interfaces/Particles/IParticles.d.ts +14 -14
  473. package/browser/Options/Interfaces/Particles/IShadow.d.ts +1 -1
  474. package/browser/Options/Interfaces/Particles/IStroke.d.ts +1 -1
  475. package/browser/Options/Interfaces/Particles/Links/ILinks.d.ts +1 -1
  476. package/browser/Options/Interfaces/Particles/Move/IMove.d.ts +5 -5
  477. package/browser/Options/Interfaces/Particles/Move/Path/{iPath.d.ts → IPath.d.ts} +0 -0
  478. package/browser/Options/Interfaces/Particles/Move/Path/{iPath.js → IPath.js} +0 -0
  479. package/browser/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +3 -3
  480. package/browser/Options/Interfaces/Particles/Roll/IRoll.d.ts +1 -1
  481. package/browser/Options/Interfaces/Particles/Rotate/IRotate.d.ts +1 -1
  482. package/browser/Options/Interfaces/Particles/Shape/IShape.d.ts +3 -3
  483. package/browser/Options/Interfaces/Particles/Tilt/ITilt.d.ts +1 -1
  484. package/browser/Options/Interfaces/Theme/ITheme.d.ts +2 -2
  485. package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +5 -4
  486. package/browser/Plugins/Absorbers/AbsorberInstance.js +18 -18
  487. package/browser/Plugins/Absorbers/Absorbers.d.ts +3 -3
  488. package/browser/Plugins/Absorbers/Absorbers.js +1 -1
  489. package/browser/Plugins/Absorbers/Options/Classes/Absorber.d.ts +4 -4
  490. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -2
  491. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.js +1 -1
  492. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +2 -2
  493. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +1 -2
  494. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberOptions.d.ts +1 -1
  495. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +1 -1
  496. package/browser/Plugins/Absorbers/index.d.ts +1 -1
  497. package/browser/Plugins/Absorbers/index.js +3 -3
  498. package/browser/Plugins/Emitters/EmitterContainer.d.ts +2 -1
  499. package/browser/Plugins/Emitters/EmitterInstance.d.ts +10 -5
  500. package/browser/Plugins/Emitters/EmitterInstance.js +78 -49
  501. package/browser/Plugins/Emitters/Emitters.d.ts +6 -4
  502. package/browser/Plugins/Emitters/Emitters.js +27 -4
  503. package/{esm/Plugins/Emitters/EmittersMain.d.ts → browser/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  504. package/browser/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  505. package/browser/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  506. package/browser/Plugins/Emitters/Options/Classes/Emitter.d.ts +8 -7
  507. package/browser/Plugins/Emitters/Options/Classes/Emitter.js +4 -3
  508. package/browser/Plugins/Emitters/Options/Classes/EmitterLife.d.ts +1 -1
  509. package/browser/Plugins/Emitters/Options/Classes/EmitterRate.d.ts +1 -1
  510. package/browser/Plugins/Emitters/Options/Classes/EmitterSize.d.ts +1 -1
  511. package/browser/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +10 -6
  512. package/browser/Plugins/Emitters/Options/Interfaces/IEmitterOptions.d.ts +1 -1
  513. package/browser/Plugins/Emitters/Options/Interfaces/IEmitterSize.d.ts +1 -1
  514. package/browser/Plugins/Emitters/ShapeManager.d.ts +6 -3
  515. package/browser/Plugins/Emitters/ShapeManager.js +16 -4
  516. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  517. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  518. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  519. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  520. package/browser/Plugins/Emitters/index.d.ts +3 -3
  521. package/browser/Plugins/Emitters/index.js +33 -14
  522. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +5 -5
  523. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMask.js +1 -1
  524. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskDraw.d.ts +2 -2
  525. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskDraw.js +1 -1
  526. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.d.ts +2 -2
  527. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +2 -2
  528. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +3 -3
  529. package/browser/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +2 -2
  530. package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +3 -3
  531. package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +1 -1
  532. package/browser/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.d.ts +1 -1
  533. package/browser/Plugins/PolygonMask/PolygonMaskInstance.d.ts +3 -3
  534. package/browser/Plugins/PolygonMask/PolygonMaskInstance.js +2 -2
  535. package/browser/Plugins/PolygonMask/Types.d.ts +1 -1
  536. package/browser/Plugins/PolygonMask/index.d.ts +1 -1
  537. package/browser/Plugins/PolygonMask/index.js +3 -3
  538. package/browser/Shapes/Circle/index.d.ts +1 -1
  539. package/browser/Shapes/Circle/index.js +2 -2
  540. package/browser/Shapes/Image/index.d.ts +1 -1
  541. package/browser/Shapes/Image/index.js +3 -3
  542. package/browser/Shapes/Line/index.d.ts +1 -1
  543. package/browser/Shapes/Line/index.js +2 -2
  544. package/browser/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
  545. package/browser/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
  546. package/browser/Shapes/Polygon/index.d.ts +3 -3
  547. package/browser/Shapes/Polygon/index.js +7 -7
  548. package/browser/Shapes/Square/index.d.ts +1 -1
  549. package/browser/Shapes/Square/index.js +3 -3
  550. package/browser/Shapes/Star/index.d.ts +1 -1
  551. package/browser/Shapes/Star/index.js +2 -2
  552. package/browser/Shapes/Text/index.d.ts +1 -1
  553. package/browser/Shapes/Text/index.js +3 -3
  554. package/browser/Types/ShapeData.d.ts +1 -1
  555. package/browser/Types/ShapeDrawerFunctions.d.ts +1 -1
  556. package/browser/Updaters/Angle/index.d.ts +1 -1
  557. package/browser/Updaters/Angle/index.js +2 -2
  558. package/browser/Updaters/Color/index.d.ts +1 -1
  559. package/browser/Updaters/Color/index.js +2 -2
  560. package/browser/Updaters/Life/index.d.ts +1 -1
  561. package/browser/Updaters/Life/index.js +2 -2
  562. package/browser/Updaters/Opacity/index.d.ts +1 -1
  563. package/browser/Updaters/Opacity/index.js +2 -2
  564. package/browser/Updaters/OutModes/IBounceData.d.ts +1 -1
  565. package/browser/Updaters/OutModes/OutOfCanvasUpdater.js +1 -1
  566. package/browser/Updaters/OutModes/index.d.ts +1 -1
  567. package/browser/Updaters/OutModes/index.js +2 -2
  568. package/browser/Updaters/Roll/index.d.ts +1 -1
  569. package/browser/Updaters/Roll/index.js +2 -2
  570. package/browser/Updaters/Size/index.d.ts +1 -1
  571. package/browser/Updaters/Size/index.js +2 -2
  572. package/browser/Updaters/StrokeColor/index.d.ts +1 -1
  573. package/browser/Updaters/StrokeColor/index.js +2 -2
  574. package/browser/Updaters/Tilt/index.d.ts +1 -1
  575. package/browser/Updaters/Tilt/index.js +2 -2
  576. package/browser/Updaters/Wobble/index.d.ts +1 -1
  577. package/browser/Updaters/Wobble/index.js +2 -2
  578. package/browser/Utils/CanvasUtils.d.ts +2 -3
  579. package/browser/Utils/CanvasUtils.js +1 -1
  580. package/browser/Utils/ColorUtils.js +1 -1
  581. package/browser/Utils/NumberUtils.d.ts +2 -2
  582. package/browser/Utils/Utils.d.ts +3 -3
  583. package/browser/Utils/Utils.js +1 -1
  584. package/browser/engine.d.ts +7 -3
  585. package/browser/engine.js +22 -17
  586. package/browser/full.d.ts +1 -1
  587. package/browser/full.js +14 -14
  588. package/browser/index.d.ts +1 -1
  589. package/browser/index.engine.d.ts +1 -1
  590. package/browser/index.engine.js +1 -1
  591. package/browser/index.js +1 -1
  592. package/browser/index.slim.d.ts +1 -1
  593. package/browser/index.slim.js +1 -1
  594. package/browser/pjs.d.ts +1 -1
  595. package/browser/slim.d.ts +1 -1
  596. package/browser/slim.js +40 -40
  597. package/engine.d.ts +5 -2
  598. package/engine.js +20 -16
  599. package/esm/Core/Canvas.d.ts +1 -1
  600. package/esm/Core/Canvas.js +1 -1
  601. package/esm/Core/Container.d.ts +8 -6
  602. package/esm/Core/Container.js +33 -18
  603. package/esm/Core/Interfaces/Gradients.d.ts +2 -2
  604. package/esm/Core/Interfaces/ICircleBouncer.d.ts +1 -1
  605. package/esm/Core/Interfaces/IContainerPlugin.d.ts +4 -4
  606. package/esm/Core/Interfaces/IExternalInteractor.d.ts +1 -1
  607. package/esm/Core/Interfaces/IInteractor.d.ts +1 -1
  608. package/esm/Core/Interfaces/IParticle.d.ts +8 -8
  609. package/esm/Core/Interfaces/IParticleGradientAnimation.d.ts +1 -1
  610. package/esm/Core/Interfaces/IParticleSpin.d.ts +1 -1
  611. package/esm/Core/Interfaces/IParticlesInteractor.d.ts +2 -2
  612. package/esm/Core/Interfaces/IPlugin.d.ts +1 -1
  613. package/esm/Core/Loader.d.ts +13 -10
  614. package/esm/Core/Loader.js +36 -20
  615. package/esm/Core/Particle.d.ts +6 -4
  616. package/esm/Core/Particle.js +19 -4
  617. package/esm/Core/Particles.d.ts +6 -4
  618. package/esm/Core/Particles.js +22 -7
  619. package/esm/Core/Utils/Circle.d.ts +1 -1
  620. package/esm/Core/Utils/CircleWarp.d.ts +1 -1
  621. package/esm/Core/Utils/CircleWarp.js +1 -1
  622. package/esm/Core/Utils/EventListeners.js +1 -1
  623. package/esm/Core/Utils/ExternalInteractorBase.d.ts +1 -1
  624. package/esm/Core/Utils/InteractionManager.d.ts +6 -4
  625. package/esm/Core/Utils/InteractionManager.js +19 -3
  626. package/esm/Core/Utils/ParticlesInteractorBase.d.ts +1 -1
  627. package/esm/Core/Utils/ParticlesMover.d.ts +1 -1
  628. package/esm/Core/Utils/Plugins.d.ts +30 -16
  629. package/esm/Core/Utils/Plugins.js +58 -46
  630. package/esm/Core/Utils/QuadTree.d.ts +3 -3
  631. package/esm/Core/Utils/QuadTree.js +1 -1
  632. package/esm/Core/Utils/Rectangle.d.ts +1 -1
  633. package/esm/Core/Utils/Vector3d.d.ts +1 -1
  634. package/esm/Interactions/External/Attract/Attractor.d.ts +1 -1
  635. package/esm/Interactions/External/Attract/Attractor.js +1 -1
  636. package/esm/Interactions/External/Attract/index.d.ts +1 -1
  637. package/esm/Interactions/External/Attract/index.js +2 -2
  638. package/esm/Interactions/External/Bounce/Bouncer.d.ts +1 -1
  639. package/esm/Interactions/External/Bounce/Bouncer.js +1 -1
  640. package/esm/Interactions/External/Bounce/index.d.ts +1 -1
  641. package/esm/Interactions/External/Bounce/index.js +2 -2
  642. package/esm/Interactions/External/Bubble/Bubbler.d.ts +1 -1
  643. package/esm/Interactions/External/Bubble/Bubbler.js +1 -1
  644. package/esm/Interactions/External/Bubble/index.d.ts +1 -1
  645. package/esm/Interactions/External/Bubble/index.js +2 -2
  646. package/esm/Interactions/External/Connect/Connector.js +1 -1
  647. package/esm/Interactions/External/Connect/index.d.ts +1 -1
  648. package/esm/Interactions/External/Connect/index.js +2 -2
  649. package/esm/Interactions/External/Grab/Grabber.d.ts +1 -1
  650. package/esm/Interactions/External/Grab/Grabber.js +1 -1
  651. package/esm/Interactions/External/Grab/index.d.ts +1 -1
  652. package/esm/Interactions/External/Grab/index.js +2 -2
  653. package/esm/Interactions/External/Repulse/Repulser.d.ts +1 -1
  654. package/esm/Interactions/External/Repulse/Repulser.js +1 -1
  655. package/esm/Interactions/External/Repulse/index.d.ts +1 -1
  656. package/esm/Interactions/External/Repulse/index.js +2 -2
  657. package/esm/Interactions/External/Trail/TrailMaker.js +1 -1
  658. package/esm/Interactions/External/Trail/index.d.ts +1 -1
  659. package/esm/Interactions/External/Trail/index.js +2 -2
  660. package/esm/Interactions/Particles/Attract/Attractor.js +1 -1
  661. package/esm/Interactions/Particles/Attract/index.d.ts +1 -1
  662. package/esm/Interactions/Particles/Attract/index.js +2 -2
  663. package/esm/Interactions/Particles/Collisions/index.d.ts +1 -1
  664. package/esm/Interactions/Particles/Collisions/index.js +2 -2
  665. package/esm/Interactions/Particles/Links/LinkParticle.d.ts +1 -1
  666. package/esm/Interactions/Particles/Links/Linker.d.ts +1 -1
  667. package/esm/Interactions/Particles/Links/Linker.js +1 -1
  668. package/esm/Interactions/Particles/Links/index.d.ts +1 -1
  669. package/esm/Interactions/Particles/Links/index.js +4 -4
  670. package/esm/Interactions/Particles/Links/interaction.d.ts +1 -1
  671. package/esm/Interactions/Particles/Links/interaction.js +2 -2
  672. package/esm/Interactions/Particles/Links/plugin.d.ts +1 -1
  673. package/esm/Interactions/Particles/Links/plugin.js +2 -2
  674. package/esm/Options/Classes/AnimatableColor.d.ts +3 -3
  675. package/esm/Options/Classes/AnimatableColor.js +1 -1
  676. package/esm/Options/Classes/AnimatableGradient.d.ts +6 -6
  677. package/esm/Options/Classes/AnimationOptions.d.ts +2 -2
  678. package/esm/Options/Classes/Background/Background.d.ts +2 -2
  679. package/esm/Options/Classes/BackgroundMask/BackgroundMask.d.ts +2 -2
  680. package/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +2 -2
  681. package/esm/Options/Classes/ColorAnimation.d.ts +1 -1
  682. package/esm/Options/Classes/HslAnimation.d.ts +2 -2
  683. package/esm/Options/Classes/Interactivity/Events/ClickEvent.d.ts +2 -2
  684. package/esm/Options/Classes/Interactivity/Events/DivEvent.d.ts +1 -1
  685. package/esm/Options/Classes/Interactivity/Events/Events.d.ts +2 -2
  686. package/esm/Options/Classes/Interactivity/Events/HoverEvent.d.ts +3 -3
  687. package/esm/Options/Classes/Interactivity/Events/Parallax.d.ts +1 -1
  688. package/esm/Options/Classes/Interactivity/Interactivity.d.ts +2 -2
  689. package/esm/Options/Classes/Interactivity/Modes/Attract.d.ts +2 -2
  690. package/esm/Options/Classes/Interactivity/Modes/Bubble.d.ts +2 -2
  691. package/esm/Options/Classes/Interactivity/Modes/Bubble.js +1 -1
  692. package/esm/Options/Classes/Interactivity/Modes/BubbleBase.d.ts +1 -1
  693. package/esm/Options/Classes/Interactivity/Modes/BubbleDiv.d.ts +1 -1
  694. package/esm/Options/Classes/Interactivity/Modes/Connect.d.ts +2 -2
  695. package/esm/Options/Classes/Interactivity/Modes/ConnectLinks.d.ts +1 -1
  696. package/esm/Options/Classes/Interactivity/Modes/Grab.d.ts +2 -2
  697. package/esm/Options/Classes/Interactivity/Modes/GrabLinks.d.ts +2 -2
  698. package/esm/Options/Classes/Interactivity/Modes/Light.d.ts +1 -1
  699. package/esm/Options/Classes/Interactivity/Modes/Modes.d.ts +7 -7
  700. package/esm/Options/Classes/Interactivity/Modes/Modes.js +4 -4
  701. package/esm/Options/Classes/Interactivity/Modes/Push.d.ts +1 -1
  702. package/esm/Options/Classes/Interactivity/Modes/Remove.d.ts +1 -1
  703. package/esm/Options/Classes/Interactivity/Modes/Repulse.d.ts +3 -3
  704. package/esm/Options/Classes/Interactivity/Modes/Repulse.js +1 -1
  705. package/esm/Options/Classes/Interactivity/Modes/RepulseBase.d.ts +2 -2
  706. package/esm/Options/Classes/Interactivity/Modes/RepulseDiv.d.ts +1 -1
  707. package/esm/Options/Classes/Interactivity/Modes/Slow.d.ts +1 -1
  708. package/esm/Options/Classes/Interactivity/Modes/Trail.d.ts +2 -2
  709. package/esm/Options/Classes/ManualParticle.d.ts +2 -2
  710. package/esm/Options/Classes/Motion/Motion.d.ts +1 -1
  711. package/esm/Options/Classes/Options.d.ts +9 -8
  712. package/esm/Options/Classes/Options.js +20 -13
  713. package/esm/Options/Classes/OptionsColor.d.ts +2 -2
  714. package/esm/Options/Classes/Particles/Bounce/Bounce.d.ts +1 -1
  715. package/esm/Options/Classes/Particles/Collisions/Collisions.d.ts +4 -4
  716. package/esm/Options/Classes/Particles/Collisions/CollisionsOverlap.d.ts +2 -2
  717. package/esm/Options/Classes/Particles/Destroy/Destroy.d.ts +1 -1
  718. package/esm/Options/Classes/Particles/Destroy/Split.d.ts +3 -3
  719. package/esm/Options/Classes/Particles/Life/Life.d.ts +1 -1
  720. package/esm/Options/Classes/Particles/Links/Links.d.ts +2 -2
  721. package/esm/Options/Classes/Particles/Links/LinksShadow.d.ts +2 -2
  722. package/esm/Options/Classes/Particles/Links/LinksTriangle.d.ts +1 -1
  723. package/esm/Options/Classes/Particles/Move/Attract.d.ts +2 -2
  724. package/esm/Options/Classes/Particles/Move/Move.d.ts +5 -5
  725. package/esm/Options/Classes/Particles/Move/Move.js +3 -3
  726. package/esm/Options/Classes/Particles/Move/OutModes.d.ts +2 -2
  727. package/esm/Options/Classes/Particles/Move/Path/Path.d.ts +3 -3
  728. package/esm/Options/Classes/Particles/Move/Spin.d.ts +3 -3
  729. package/esm/Options/Classes/Particles/Move/Trail.d.ts +2 -2
  730. package/esm/Options/Classes/Particles/Number/Density.d.ts +1 -1
  731. package/esm/Options/Classes/Particles/Number/ParticlesNumber.d.ts +2 -2
  732. package/esm/Options/Classes/Particles/Opacity/Opacity.d.ts +1 -1
  733. package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.d.ts +3 -3
  734. package/esm/Options/Classes/Particles/Orbit/Orbit.d.ts +5 -5
  735. package/esm/Options/Classes/Particles/Orbit/Orbit.js +2 -2
  736. package/esm/Options/Classes/Particles/Orbit/OrbitRotation.d.ts +1 -1
  737. package/esm/Options/Classes/Particles/ParticlesOptions.d.ts +16 -16
  738. package/esm/Options/Classes/Particles/ParticlesOptions.js +13 -13
  739. package/esm/Options/Classes/Particles/Repulse/Repulse.d.ts +1 -1
  740. package/esm/Options/Classes/Particles/Roll/Roll.d.ts +2 -2
  741. package/esm/Options/Classes/Particles/Roll/RollLight.d.ts +1 -1
  742. package/esm/Options/Classes/Particles/Rotate/Rotate.d.ts +3 -3
  743. package/esm/Options/Classes/Particles/Rotate/RotateAnimation.d.ts +1 -1
  744. package/esm/Options/Classes/Particles/Shadow.d.ts +3 -3
  745. package/esm/Options/Classes/Particles/Shape/Shape.d.ts +5 -5
  746. package/esm/Options/Classes/Particles/Size/Size.d.ts +2 -2
  747. package/esm/Options/Classes/Particles/Size/SizeAnimation.d.ts +3 -3
  748. package/esm/Options/Classes/Particles/Stroke.d.ts +2 -2
  749. package/esm/Options/Classes/Particles/Tilt/Tilt.d.ts +3 -3
  750. package/esm/Options/Classes/Particles/Tilt/TiltAnimation.d.ts +1 -1
  751. package/esm/Options/Classes/Particles/Twinkle/Twinkle.d.ts +1 -1
  752. package/esm/Options/Classes/Particles/Twinkle/TwinkleValues.d.ts +2 -2
  753. package/esm/Options/Classes/Particles/Wobble/Wobble.d.ts +2 -2
  754. package/esm/Options/Classes/Particles/ZIndex/ZIndex.d.ts +1 -1
  755. package/esm/Options/Classes/Random.d.ts +1 -1
  756. package/esm/Options/Classes/Responsive.d.ts +2 -2
  757. package/esm/Options/Classes/Theme/Theme.d.ts +2 -2
  758. package/esm/Options/Classes/Theme/Theme.js +1 -1
  759. package/esm/Options/Classes/Theme/ThemeDefault.d.ts +2 -2
  760. package/esm/Options/Classes/ValueWithRandom.d.ts +2 -2
  761. package/esm/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +1 -1
  762. package/esm/Options/Interfaces/IAnimatableColor.d.ts +1 -1
  763. package/esm/Options/Interfaces/IAnimatableGradient.d.ts +1 -1
  764. package/esm/Options/Interfaces/IColorAnimation.d.ts +1 -1
  765. package/esm/Options/Interfaces/IManualParticle.d.ts +1 -1
  766. package/esm/Options/Interfaces/IOptions.d.ts +6 -6
  767. package/esm/Options/Interfaces/IOptionsGradient.d.ts +2 -2
  768. package/esm/Options/Interfaces/IResponsive.d.ts +2 -2
  769. package/esm/Options/Interfaces/IValueWithRandom.d.ts +1 -1
  770. package/esm/Options/Interfaces/Interactivity/Events/IEvents.d.ts +1 -1
  771. package/esm/Options/Interfaces/Interactivity/IInteractivity.d.ts +1 -1
  772. package/esm/Options/Interfaces/Interactivity/Modes/IBubble.d.ts +2 -2
  773. package/esm/Options/Interfaces/Interactivity/Modes/IBubbleBase.d.ts +1 -1
  774. package/esm/Options/Interfaces/Interactivity/Modes/IModes.d.ts +2 -2
  775. package/esm/Options/Interfaces/Interactivity/Modes/IRepulse.d.ts +2 -2
  776. package/esm/Options/Interfaces/Interactivity/Modes/IRepulseDiv.d.ts +1 -1
  777. package/esm/Options/Interfaces/Particles/Destroy/ISplit.d.ts +1 -1
  778. package/esm/Options/Interfaces/Particles/IParticles.d.ts +14 -14
  779. package/esm/Options/Interfaces/Particles/IShadow.d.ts +1 -1
  780. package/esm/Options/Interfaces/Particles/IStroke.d.ts +1 -1
  781. package/esm/Options/Interfaces/Particles/Links/ILinks.d.ts +1 -1
  782. package/esm/Options/Interfaces/Particles/Move/IMove.d.ts +5 -5
  783. package/esm/Options/Interfaces/Particles/Move/Path/{iPath.d.ts → IPath.d.ts} +0 -0
  784. package/esm/Options/Interfaces/Particles/Move/Path/{iPath.js → IPath.js} +0 -0
  785. package/esm/Options/Interfaces/Particles/Orbit/IOrbit.d.ts +3 -3
  786. package/esm/Options/Interfaces/Particles/Roll/IRoll.d.ts +1 -1
  787. package/esm/Options/Interfaces/Particles/Rotate/IRotate.d.ts +1 -1
  788. package/esm/Options/Interfaces/Particles/Shape/IShape.d.ts +3 -3
  789. package/esm/Options/Interfaces/Particles/Tilt/ITilt.d.ts +1 -1
  790. package/esm/Options/Interfaces/Theme/ITheme.d.ts +2 -2
  791. package/esm/Plugins/Absorbers/AbsorberInstance.d.ts +5 -4
  792. package/esm/Plugins/Absorbers/AbsorberInstance.js +18 -18
  793. package/esm/Plugins/Absorbers/Absorbers.d.ts +3 -3
  794. package/esm/Plugins/Absorbers/Absorbers.js +1 -1
  795. package/esm/Plugins/Absorbers/Options/Classes/Absorber.d.ts +4 -4
  796. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -2
  797. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.js +1 -1
  798. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +2 -2
  799. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorber.d.ts +1 -2
  800. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberOptions.d.ts +1 -1
  801. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +1 -1
  802. package/esm/Plugins/Absorbers/index.d.ts +1 -1
  803. package/esm/Plugins/Absorbers/index.js +3 -3
  804. package/esm/Plugins/Emitters/EmitterContainer.d.ts +2 -1
  805. package/esm/Plugins/Emitters/EmitterInstance.d.ts +10 -5
  806. package/esm/Plugins/Emitters/EmitterInstance.js +78 -49
  807. package/esm/Plugins/Emitters/Emitters.d.ts +6 -4
  808. package/esm/Plugins/Emitters/Emitters.js +27 -4
  809. package/{Plugins/Emitters/EmittersMain.d.ts → esm/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  810. package/esm/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  811. package/esm/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  812. package/esm/Plugins/Emitters/Options/Classes/Emitter.d.ts +8 -7
  813. package/esm/Plugins/Emitters/Options/Classes/Emitter.js +4 -3
  814. package/esm/Plugins/Emitters/Options/Classes/EmitterLife.d.ts +1 -1
  815. package/esm/Plugins/Emitters/Options/Classes/EmitterRate.d.ts +1 -1
  816. package/esm/Plugins/Emitters/Options/Classes/EmitterSize.d.ts +1 -1
  817. package/esm/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +7 -6
  818. package/esm/Plugins/Emitters/Options/Interfaces/IEmitterOptions.d.ts +1 -1
  819. package/esm/Plugins/Emitters/Options/Interfaces/IEmitterSize.d.ts +1 -1
  820. package/esm/Plugins/Emitters/ShapeManager.d.ts +6 -3
  821. package/esm/Plugins/Emitters/ShapeManager.js +16 -4
  822. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  823. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  824. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  825. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  826. package/esm/Plugins/Emitters/index.d.ts +3 -3
  827. package/esm/Plugins/Emitters/index.js +33 -14
  828. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMask.d.ts +5 -5
  829. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMask.js +1 -1
  830. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskDraw.d.ts +2 -2
  831. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskDraw.js +1 -1
  832. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskDrawStroke.d.ts +2 -2
  833. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskInline.d.ts +2 -2
  834. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskLocalSvg.d.ts +3 -3
  835. package/esm/Plugins/PolygonMask/Options/Classes/PolygonMaskMove.d.ts +2 -2
  836. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMask.d.ts +3 -3
  837. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskDraw.d.ts +1 -1
  838. package/esm/Plugins/PolygonMask/Options/Interfaces/IPolygonMaskLocalSvg.d.ts +1 -1
  839. package/esm/Plugins/PolygonMask/PolygonMaskInstance.d.ts +3 -3
  840. package/esm/Plugins/PolygonMask/PolygonMaskInstance.js +2 -2
  841. package/esm/Plugins/PolygonMask/Types.d.ts +1 -1
  842. package/esm/Plugins/PolygonMask/index.d.ts +1 -1
  843. package/esm/Plugins/PolygonMask/index.js +3 -3
  844. package/esm/Shapes/Circle/index.d.ts +1 -1
  845. package/esm/Shapes/Circle/index.js +2 -2
  846. package/esm/Shapes/Image/index.d.ts +1 -1
  847. package/esm/Shapes/Image/index.js +3 -3
  848. package/esm/Shapes/Line/index.d.ts +1 -1
  849. package/esm/Shapes/Line/index.js +2 -2
  850. package/esm/Shapes/Polygon/PolygonDrawer.d.ts +1 -1
  851. package/esm/Shapes/Polygon/TriangleDrawer.d.ts +1 -1
  852. package/esm/Shapes/Polygon/index.d.ts +3 -3
  853. package/esm/Shapes/Polygon/index.js +7 -7
  854. package/esm/Shapes/Square/index.d.ts +1 -1
  855. package/esm/Shapes/Square/index.js +3 -3
  856. package/esm/Shapes/Star/index.d.ts +1 -1
  857. package/esm/Shapes/Star/index.js +2 -2
  858. package/esm/Shapes/Text/index.d.ts +1 -1
  859. package/esm/Shapes/Text/index.js +3 -3
  860. package/esm/Types/ShapeData.d.ts +1 -1
  861. package/esm/Types/ShapeDrawerFunctions.d.ts +1 -1
  862. package/esm/Updaters/Angle/index.d.ts +1 -1
  863. package/esm/Updaters/Angle/index.js +2 -2
  864. package/esm/Updaters/Color/index.d.ts +1 -1
  865. package/esm/Updaters/Color/index.js +2 -2
  866. package/esm/Updaters/Life/index.d.ts +1 -1
  867. package/esm/Updaters/Life/index.js +2 -2
  868. package/esm/Updaters/Opacity/index.d.ts +1 -1
  869. package/esm/Updaters/Opacity/index.js +2 -2
  870. package/esm/Updaters/OutModes/IBounceData.d.ts +1 -1
  871. package/esm/Updaters/OutModes/OutOfCanvasUpdater.js +1 -1
  872. package/esm/Updaters/OutModes/index.d.ts +1 -1
  873. package/esm/Updaters/OutModes/index.js +2 -2
  874. package/esm/Updaters/Roll/index.d.ts +1 -1
  875. package/esm/Updaters/Roll/index.js +2 -2
  876. package/esm/Updaters/Size/index.d.ts +1 -1
  877. package/esm/Updaters/Size/index.js +2 -2
  878. package/esm/Updaters/StrokeColor/index.d.ts +1 -1
  879. package/esm/Updaters/StrokeColor/index.js +2 -2
  880. package/esm/Updaters/Tilt/index.d.ts +1 -1
  881. package/esm/Updaters/Tilt/index.js +2 -2
  882. package/esm/Updaters/Wobble/index.d.ts +1 -1
  883. package/esm/Updaters/Wobble/index.js +2 -2
  884. package/esm/Utils/CanvasUtils.d.ts +2 -3
  885. package/esm/Utils/CanvasUtils.js +1 -1
  886. package/esm/Utils/ColorUtils.js +1 -1
  887. package/esm/Utils/NumberUtils.d.ts +2 -2
  888. package/esm/Utils/Utils.d.ts +3 -3
  889. package/esm/Utils/Utils.js +1 -1
  890. package/esm/engine.d.ts +5 -2
  891. package/esm/engine.js +20 -16
  892. package/esm/full.d.ts +1 -1
  893. package/esm/full.js +14 -14
  894. package/esm/index.d.ts +1 -1
  895. package/esm/index.engine.d.ts +1 -1
  896. package/esm/index.engine.js +1 -1
  897. package/esm/index.js +1 -1
  898. package/esm/index.slim.d.ts +1 -1
  899. package/esm/index.slim.js +1 -1
  900. package/esm/pjs.d.ts +1 -1
  901. package/esm/slim.d.ts +1 -1
  902. package/esm/slim.js +40 -40
  903. package/full.d.ts +1 -1
  904. package/full.js +14 -14
  905. package/index.d.ts +1 -1
  906. package/index.engine.d.ts +1 -1
  907. package/index.engine.js +1 -1
  908. package/index.js +1 -1
  909. package/index.slim.d.ts +1 -1
  910. package/index.slim.js +1 -1
  911. package/package.json +11 -5
  912. package/pjs.d.ts +1 -1
  913. package/report.html +2 -2
  914. package/report.slim.html +2 -2
  915. package/slim.d.ts +1 -1
  916. package/slim.js +40 -40
  917. package/tsparticles.engine.js +2537 -2428
  918. package/tsparticles.engine.min.js +2 -2
  919. package/tsparticles.interaction.external.attract.js +4093 -3988
  920. package/tsparticles.interaction.external.attract.min.js +2 -2
  921. package/tsparticles.interaction.external.bounce.js +4102 -3997
  922. package/tsparticles.interaction.external.bounce.min.js +2 -2
  923. package/tsparticles.interaction.external.bubble.js +4102 -3997
  924. package/tsparticles.interaction.external.bubble.min.js +2 -2
  925. package/tsparticles.interaction.external.connect.js +4288 -4183
  926. package/tsparticles.interaction.external.connect.min.js +2 -2
  927. package/tsparticles.interaction.external.grab.js +4288 -4183
  928. package/tsparticles.interaction.external.grab.min.js +2 -2
  929. package/tsparticles.interaction.external.repulse.js +4102 -3997
  930. package/tsparticles.interaction.external.repulse.min.js +2 -2
  931. package/tsparticles.interaction.external.trail.js +4288 -4183
  932. package/tsparticles.interaction.external.trail.min.js +2 -2
  933. package/tsparticles.interaction.particles.attract.js +4288 -4183
  934. package/tsparticles.interaction.particles.attract.min.js +2 -2
  935. package/tsparticles.interaction.particles.collisions.js +1249 -1144
  936. package/tsparticles.interaction.particles.collisions.min.js +2 -2
  937. package/tsparticles.interaction.particles.links.js +4400 -4295
  938. package/tsparticles.interaction.particles.links.min.js +2 -2
  939. package/tsparticles.js +5946 -5749
  940. package/tsparticles.min.js +2 -2
  941. package/tsparticles.pathseg.min.js +1 -1
  942. package/tsparticles.plugins.absorbers.js +1210 -1106
  943. package/tsparticles.plugins.absorbers.min.js +2 -2
  944. package/tsparticles.plugins.emitters.js +1875 -1681
  945. package/tsparticles.plugins.emitters.min.js +2 -2
  946. package/tsparticles.plugins.polygonMask.js +2785 -2680
  947. package/tsparticles.plugins.polygonMask.min.js +2 -2
  948. package/tsparticles.shape.circle.js +2 -2
  949. package/tsparticles.shape.circle.min.js +1 -1
  950. package/tsparticles.shape.image.js +1237 -1132
  951. package/tsparticles.shape.image.min.js +2 -2
  952. package/tsparticles.shape.line.js +2 -2
  953. package/tsparticles.shape.line.min.js +1 -1
  954. package/tsparticles.shape.polygon.js +7 -7
  955. package/tsparticles.shape.polygon.min.js +1 -1
  956. package/tsparticles.shape.square.js +3 -3
  957. package/tsparticles.shape.square.min.js +1 -1
  958. package/tsparticles.shape.star.js +2 -2
  959. package/tsparticles.shape.star.min.js +1 -1
  960. package/tsparticles.shape.text.js +1249 -1144
  961. package/tsparticles.shape.text.min.js +2 -2
  962. package/tsparticles.slim.js +3710 -3601
  963. package/tsparticles.slim.min.js +2 -2
  964. package/tsparticles.updater.angle.js +1249 -1144
  965. package/tsparticles.updater.angle.min.js +2 -2
  966. package/tsparticles.updater.color.js +1249 -1144
  967. package/tsparticles.updater.color.min.js +2 -2
  968. package/tsparticles.updater.life.js +1249 -1144
  969. package/tsparticles.updater.life.min.js +2 -2
  970. package/tsparticles.updater.opacity.js +1249 -1144
  971. package/tsparticles.updater.opacity.min.js +2 -2
  972. package/tsparticles.updater.outModes.js +1249 -1144
  973. package/tsparticles.updater.outModes.min.js +2 -2
  974. package/tsparticles.updater.roll.js +1249 -1144
  975. package/tsparticles.updater.roll.min.js +2 -2
  976. package/tsparticles.updater.size.js +1249 -1144
  977. package/tsparticles.updater.size.min.js +2 -2
  978. package/tsparticles.updater.strokeColor.js +1249 -1144
  979. package/tsparticles.updater.strokeColor.min.js +2 -2
  980. package/tsparticles.updater.tilt.js +1249 -1144
  981. package/tsparticles.updater.tilt.min.js +2 -2
  982. package/tsparticles.updater.wobble.js +1249 -1144
  983. package/tsparticles.updater.wobble.min.js +2 -2
@@ -43,6 +43,31 @@
43
43
  return loadEmittersPlugin;
44
44
  }
45
45
  });
46
+ class CircleShape {
47
+ randomPosition(position, size, fill) {
48
+ const generateTheta = (x, y) => {
49
+ const u = Math.random() / 4;
50
+ const theta = Math.atan(y / x * Math.tan(2 * Math.PI * u));
51
+ const v = Math.random();
52
+ if (v < .25) {
53
+ return theta;
54
+ } else if (v < .5) {
55
+ return Math.PI - theta;
56
+ } else if (v < .75) {
57
+ return Math.PI + theta;
58
+ } else {
59
+ return -theta;
60
+ }
61
+ };
62
+ const radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2);
63
+ const [a, b] = [ size.width / 2, size.height / 2 ];
64
+ const randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(Math.random()) : maxRadius;
65
+ return {
66
+ x: position.x + randomRadius * Math.cos(randomTheta),
67
+ y: position.y + randomRadius * Math.sin(randomTheta)
68
+ };
69
+ }
70
+ }
46
71
  class Circle_Circle extends(null && Range){
47
72
  constructor(x, y, radius) {
48
73
  super(x, y);
@@ -506,15 +531,32 @@
506
531
  }
507
532
  }
508
533
  }
534
+ var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
535
+ if (kind === "m") throw new TypeError("Private method is not writable");
536
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
537
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
538
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
539
+ value;
540
+ };
541
+ var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
542
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
543
+ 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");
544
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
545
+ };
546
+ var _InteractionManager_engine;
509
547
  class InteractionManager_InteractionManager {
510
- constructor(container) {
548
+ constructor(engine, container) {
511
549
  this.container = container;
550
+ _InteractionManager_engine.set(this, void 0);
551
+ __classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
512
552
  this.externalInteractors = [];
513
553
  this.particleInteractors = [];
514
554
  this.init();
515
555
  }
516
556
  init() {
517
- const interactors = Plugins.getInteractors(this.container, true);
557
+ const interactors = __classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
558
+ this.externalInteractors = [];
559
+ this.particleInteractors = [];
518
560
  for (const interactor of interactors) {
519
561
  switch (interactor.type) {
520
562
  case 0:
@@ -545,6 +587,7 @@
545
587
  }
546
588
  }
547
589
  }
590
+ _InteractionManager_engine = new WeakMap;
548
591
  function applyDistance(particle) {
549
592
  const initialPosition = particle.initialPosition;
550
593
  const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
@@ -718,26 +761,38 @@
718
761
  return proximityFactor / slowFactor;
719
762
  }
720
763
  }
721
- const plugins = null && [];
722
- const interactorsInitializers = new Map;
723
- const updatersInitializers = new Map;
724
- const interactors = new Map;
725
- const updaters = new Map;
726
- const presets = new Map;
727
- const drawers = new Map;
728
- const pathGenerators = new Map;
729
- class Plugins_Plugins {
730
- static getPlugin(plugin) {
731
- return plugins.find((t => t.id === plugin));
764
+ var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
765
+ if (kind === "m") throw new TypeError("Private method is not writable");
766
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
767
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
768
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
769
+ value;
770
+ };
771
+ var _Plugins_engine;
772
+ class Plugins {
773
+ constructor(engine) {
774
+ _Plugins_engine.set(this, void 0);
775
+ Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
776
+ this.plugins = [];
777
+ this.interactorsInitializers = new Map;
778
+ this.updatersInitializers = new Map;
779
+ this.interactors = new Map;
780
+ this.updaters = new Map;
781
+ this.presets = new Map;
782
+ this.drawers = new Map;
783
+ this.pathGenerators = new Map;
784
+ }
785
+ getPlugin(plugin) {
786
+ return this.plugins.find((t => t.id === plugin));
732
787
  }
733
- static addPlugin(plugin) {
734
- if (!Plugins_Plugins.getPlugin(plugin.id)) {
735
- plugins.push(plugin);
788
+ addPlugin(plugin) {
789
+ if (!this.getPlugin(plugin.id)) {
790
+ this.plugins.push(plugin);
736
791
  }
737
792
  }
738
- static getAvailablePlugins(container) {
793
+ getAvailablePlugins(container) {
739
794
  const res = new Map;
740
- for (const plugin of plugins) {
795
+ for (const plugin of this.plugins) {
741
796
  if (!plugin.needsPlugin(container.actualOptions)) {
742
797
  continue;
743
798
  }
@@ -745,61 +800,62 @@
745
800
  }
746
801
  return res;
747
802
  }
748
- static loadOptions(options, sourceOptions) {
749
- for (const plugin of plugins) {
803
+ loadOptions(options, sourceOptions) {
804
+ for (const plugin of this.plugins) {
750
805
  plugin.loadOptions(options, sourceOptions);
751
806
  }
752
807
  }
753
- static getPreset(preset) {
754
- return presets.get(preset);
808
+ getPreset(preset) {
809
+ return this.presets.get(preset);
755
810
  }
756
- static addPreset(presetKey, options, override = false) {
757
- if (override || !Plugins_Plugins.getPreset(presetKey)) {
758
- presets.set(presetKey, options);
811
+ addPreset(presetKey, options, override = false) {
812
+ if (override || !this.getPreset(presetKey)) {
813
+ this.presets.set(presetKey, options);
759
814
  }
760
815
  }
761
- static addShapeDrawer(type, drawer) {
762
- if (!Plugins_Plugins.getShapeDrawer(type)) {
763
- drawers.set(type, drawer);
816
+ addShapeDrawer(type, drawer) {
817
+ if (!this.getShapeDrawer(type)) {
818
+ this.drawers.set(type, drawer);
764
819
  }
765
820
  }
766
- static getShapeDrawer(type) {
767
- return drawers.get(type);
821
+ getShapeDrawer(type) {
822
+ return this.drawers.get(type);
768
823
  }
769
- static getSupportedShapes() {
770
- return drawers.keys();
824
+ getSupportedShapes() {
825
+ return this.drawers.keys();
771
826
  }
772
- static getPathGenerator(type) {
773
- return pathGenerators.get(type);
827
+ getPathGenerator(type) {
828
+ return this.pathGenerators.get(type);
774
829
  }
775
- static addPathGenerator(type, pathGenerator) {
776
- if (!Plugins_Plugins.getPathGenerator(type)) {
777
- pathGenerators.set(type, pathGenerator);
830
+ addPathGenerator(type, pathGenerator) {
831
+ if (!this.getPathGenerator(type)) {
832
+ this.pathGenerators.set(type, pathGenerator);
778
833
  }
779
834
  }
780
- static getInteractors(container, force = false) {
781
- let res = interactors.get(container);
835
+ getInteractors(container, force = false) {
836
+ let res = this.interactors.get(container);
782
837
  if (!res || force) {
783
- res = [ ...interactorsInitializers.values() ].map((t => t(container)));
784
- interactors.set(container, res);
838
+ res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
839
+ this.interactors.set(container, res);
785
840
  }
786
841
  return res;
787
842
  }
788
- static addInteractor(name, initInteractor) {
789
- interactorsInitializers.set(name, initInteractor);
843
+ addInteractor(name, initInteractor) {
844
+ this.interactorsInitializers.set(name, initInteractor);
790
845
  }
791
- static getUpdaters(container, force = false) {
792
- let res = updaters.get(container);
846
+ getUpdaters(container, force = false) {
847
+ let res = this.updaters.get(container);
793
848
  if (!res || force) {
794
- res = [ ...updatersInitializers.values() ].map((t => t(container)));
795
- updaters.set(container, res);
849
+ res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
850
+ this.updaters.set(container, res);
796
851
  }
797
852
  return res;
798
853
  }
799
- static addParticleUpdater(name, initUpdater) {
800
- updatersInitializers.set(name, initUpdater);
854
+ addParticleUpdater(name, initUpdater) {
855
+ this.updatersInitializers.set(name, initUpdater);
801
856
  }
802
857
  }
858
+ _Plugins_engine = new WeakMap;
803
859
  class QuadTree_QuadTree {
804
860
  constructor(rectangle, capacity) {
805
861
  this.rectangle = rectangle;
@@ -1170,517 +1226,357 @@
1170
1226
  }));
1171
1227
  }
1172
1228
  }
1173
- class ValueWithRandom_ValueWithRandom {
1229
+ class Trail_Trail {
1174
1230
  constructor() {
1175
- this.random = new Random;
1176
- this.value = 0;
1231
+ this.delay = 1;
1232
+ this.pauseOnStop = false;
1233
+ this.quantity = 1;
1177
1234
  }
1178
1235
  load(data) {
1179
- if (!data) {
1236
+ if (data === undefined) {
1180
1237
  return;
1181
1238
  }
1182
- if (typeof data.random === "boolean") {
1183
- this.random.enable = data.random;
1184
- } else {
1185
- this.random.load(data.random);
1239
+ if (data.delay !== undefined) {
1240
+ this.delay = data.delay;
1186
1241
  }
1187
- if (data.value !== undefined) {
1188
- this.value = setRangeValue(data.value, this.random.enable ? this.random.minimumValue : undefined);
1242
+ if (data.quantity !== undefined) {
1243
+ this.quantity = data.quantity;
1244
+ }
1245
+ if (data.particles !== undefined) {
1246
+ this.particles = deepExtend({}, data.particles);
1247
+ }
1248
+ if (data.pauseOnStop !== undefined) {
1249
+ this.pauseOnStop = data.pauseOnStop;
1189
1250
  }
1190
1251
  }
1191
1252
  }
1192
- class PathDelay_PathDelay extends(null && ValueWithRandom){
1253
+ class Modes_Modes {
1193
1254
  constructor() {
1194
- super();
1255
+ this.attract = new Attract;
1256
+ this.bounce = new Bounce;
1257
+ this.bubble = new Bubble;
1258
+ this.connect = new Connect;
1259
+ this.grab = new Grab;
1260
+ this.light = new Light;
1261
+ this.push = new Push;
1262
+ this.remove = new Remove;
1263
+ this.repulse = new Repulse;
1264
+ this.slow = new Slow;
1265
+ this.trail = new Trail;
1266
+ }
1267
+ load(data) {
1268
+ if (data === undefined) {
1269
+ return;
1270
+ }
1271
+ this.attract.load(data.attract);
1272
+ this.bubble.load(data.bubble);
1273
+ this.connect.load(data.connect);
1274
+ this.grab.load(data.grab);
1275
+ this.light.load(data.light);
1276
+ this.push.load(data.push);
1277
+ this.remove.load(data.remove);
1278
+ this.repulse.load(data.repulse);
1279
+ this.slow.load(data.slow);
1280
+ this.trail.load(data.trail);
1195
1281
  }
1196
1282
  }
1197
- class Path_Path {
1283
+ class Interactivity_Interactivity {
1198
1284
  constructor() {
1199
- this.clamp = true;
1200
- this.delay = new PathDelay;
1201
- this.enable = false;
1202
- this.options = {};
1285
+ this.detectsOn = "window";
1286
+ this.events = new Events;
1287
+ this.modes = new Modes;
1288
+ }
1289
+ get detect_on() {
1290
+ return this.detectsOn;
1291
+ }
1292
+ set detect_on(value) {
1293
+ this.detectsOn = value;
1203
1294
  }
1204
1295
  load(data) {
1296
+ var _a, _b, _c;
1205
1297
  if (data === undefined) {
1206
1298
  return;
1207
1299
  }
1208
- if (data.clamp !== undefined) {
1209
- this.clamp = data.clamp;
1300
+ const detectsOn = (_a = data.detectsOn) !== null && _a !== void 0 ? _a : data.detect_on;
1301
+ if (detectsOn !== undefined) {
1302
+ this.detectsOn = detectsOn;
1210
1303
  }
1211
- this.delay.load(data.delay);
1212
- if (data.enable !== undefined) {
1213
- this.enable = data.enable;
1304
+ this.events.load(data.events);
1305
+ this.modes.load(data.modes);
1306
+ if (((_c = (_b = data.modes) === null || _b === void 0 ? void 0 : _b.slow) === null || _c === void 0 ? void 0 : _c.active) === true) {
1307
+ if (this.events.onHover.mode instanceof Array) {
1308
+ if (this.events.onHover.mode.indexOf("slow") < 0) {
1309
+ this.events.onHover.mode.push("slow");
1310
+ }
1311
+ } else if (this.events.onHover.mode !== "slow") {
1312
+ this.events.onHover.mode = [ this.events.onHover.mode, "slow" ];
1313
+ }
1214
1314
  }
1215
- this.generator = data.generator;
1216
- if (data.options) {
1217
- this.options = deepExtend(this.options, data.options);
1315
+ }
1316
+ }
1317
+ class ManualParticle_ManualParticle {
1318
+ load(data) {
1319
+ var _a, _b;
1320
+ if (!data) {
1321
+ return;
1322
+ }
1323
+ if (data.position !== undefined) {
1324
+ this.position = {
1325
+ x: (_a = data.position.x) !== null && _a !== void 0 ? _a : 50,
1326
+ y: (_b = data.position.y) !== null && _b !== void 0 ? _b : 50
1327
+ };
1328
+ }
1329
+ if (data.options !== undefined) {
1330
+ this.options = deepExtend({}, data.options);
1218
1331
  }
1219
1332
  }
1220
1333
  }
1221
- class Spin_Spin {
1334
+ class AnimatableGradient_AnimatableGradient {
1222
1335
  constructor() {
1223
- this.acceleration = 0;
1224
- this.enable = false;
1336
+ this.angle = new GradientAngle;
1337
+ this.colors = [];
1338
+ this.type = "random";
1225
1339
  }
1226
1340
  load(data) {
1227
1341
  if (!data) {
1228
1342
  return;
1229
1343
  }
1230
- if (data.acceleration !== undefined) {
1231
- this.acceleration = setRangeValue(data.acceleration);
1344
+ this.angle.load(data.angle);
1345
+ if (data.colors !== undefined) {
1346
+ this.colors = data.colors.map((s => {
1347
+ const tmp = new AnimatableGradientColor;
1348
+ tmp.load(s);
1349
+ return tmp;
1350
+ }));
1232
1351
  }
1233
- if (data.enable !== undefined) {
1234
- this.enable = data.enable;
1352
+ if (data.type !== undefined) {
1353
+ this.type = data.type;
1235
1354
  }
1236
- this.position = data.position ? deepExtend({}, data.position) : undefined;
1237
1355
  }
1238
1356
  }
1239
- class Move_Move {
1357
+ class GradientAngle {
1240
1358
  constructor() {
1241
- this.angle = new MoveAngle;
1242
- this.attract = new Attract;
1243
- this.decay = 0;
1244
- this.distance = {};
1245
- this.direction = "none";
1246
- this.drift = 0;
1247
- this.enable = false;
1248
- this.gravity = new MoveGravity;
1249
- this.path = new Path;
1250
- this.outModes = new OutModes;
1251
- this.random = false;
1252
- this.size = false;
1253
- this.speed = 2;
1254
- this.spin = new Spin;
1255
- this.straight = false;
1256
- this.trail = new Trail;
1257
- this.vibrate = false;
1258
- this.warp = false;
1259
- }
1260
- get collisions() {
1261
- return false;
1262
- }
1263
- set collisions(value) {}
1264
- get bounce() {
1265
- return this.collisions;
1266
- }
1267
- set bounce(value) {
1268
- this.collisions = value;
1269
- }
1270
- get out_mode() {
1271
- return this.outMode;
1272
- }
1273
- set out_mode(value) {
1274
- this.outMode = value;
1275
- }
1276
- get outMode() {
1277
- return this.outModes.default;
1278
- }
1279
- set outMode(value) {
1280
- this.outModes.default = value;
1281
- }
1282
- get noise() {
1283
- return this.path;
1284
- }
1285
- set noise(value) {
1286
- this.path = value;
1359
+ this.value = 0;
1360
+ this.animation = new GradientAngleAnimation;
1361
+ this.direction = "clockwise";
1287
1362
  }
1288
1363
  load(data) {
1289
- var _a, _b, _c;
1290
- if (data === undefined) {
1364
+ if (!data) {
1291
1365
  return;
1292
1366
  }
1293
- if (data.angle !== undefined) {
1294
- if (typeof data.angle === "number") {
1295
- this.angle.value = data.angle;
1296
- } else {
1297
- this.angle.load(data.angle);
1298
- }
1299
- }
1300
- this.attract.load(data.attract);
1301
- if (data.decay !== undefined) {
1302
- this.decay = data.decay;
1367
+ this.animation.load(data.animation);
1368
+ if (data.value !== undefined) {
1369
+ this.value = data.value;
1303
1370
  }
1304
1371
  if (data.direction !== undefined) {
1305
1372
  this.direction = data.direction;
1306
1373
  }
1307
- if (data.distance !== undefined) {
1308
- this.distance = typeof data.distance === "number" ? {
1309
- horizontal: data.distance,
1310
- vertical: data.distance
1311
- } : deepExtend({}, data.distance);
1374
+ }
1375
+ }
1376
+ class GradientColorOpacity {
1377
+ constructor() {
1378
+ this.value = 0;
1379
+ this.animation = new GradientColorOpacityAnimation;
1380
+ }
1381
+ load(data) {
1382
+ if (!data) {
1383
+ return;
1312
1384
  }
1313
- if (data.drift !== undefined) {
1314
- this.drift = setRangeValue(data.drift);
1315
- }
1316
- if (data.enable !== undefined) {
1317
- this.enable = data.enable;
1318
- }
1319
- this.gravity.load(data.gravity);
1320
- const outMode = (_a = data.outMode) !== null && _a !== void 0 ? _a : data.out_mode;
1321
- if (data.outModes !== undefined || outMode !== undefined) {
1322
- if (typeof data.outModes === "string" || data.outModes === undefined && outMode !== undefined) {
1323
- this.outModes.load({
1324
- default: (_b = data.outModes) !== null && _b !== void 0 ? _b : outMode
1325
- });
1326
- } else {
1327
- this.outModes.load(data.outModes);
1328
- }
1329
- }
1330
- this.path.load((_c = data.path) !== null && _c !== void 0 ? _c : data.noise);
1331
- if (data.random !== undefined) {
1332
- this.random = data.random;
1333
- }
1334
- if (data.size !== undefined) {
1335
- this.size = data.size;
1336
- }
1337
- if (data.speed !== undefined) {
1338
- this.speed = setRangeValue(data.speed);
1339
- }
1340
- this.spin.load(data.spin);
1341
- if (data.straight !== undefined) {
1342
- this.straight = data.straight;
1343
- }
1344
- this.trail.load(data.trail);
1345
- if (data.vibrate !== undefined) {
1346
- this.vibrate = data.vibrate;
1347
- }
1348
- if (data.warp !== undefined) {
1349
- this.warp = data.warp;
1385
+ this.animation.load(data.animation);
1386
+ if (data.value !== undefined) {
1387
+ this.value = setRangeValue(data.value);
1350
1388
  }
1351
1389
  }
1352
1390
  }
1353
- class Opacity_Opacity extends(null && ValueWithRandom){
1391
+ class AnimatableGradientColor {
1354
1392
  constructor() {
1355
- super();
1356
- this.animation = new OpacityAnimation;
1357
- this.random.minimumValue = .1;
1358
- this.value = 1;
1359
- }
1360
- get anim() {
1361
- return this.animation;
1362
- }
1363
- set anim(value) {
1364
- this.animation = value;
1393
+ this.stop = 0;
1394
+ this.value = new AnimatableColor;
1365
1395
  }
1366
1396
  load(data) {
1367
- var _a;
1368
1397
  if (!data) {
1369
1398
  return;
1370
1399
  }
1371
- super.load(data);
1372
- const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
1373
- if (animation !== undefined) {
1374
- this.animation.load(animation);
1375
- this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
1400
+ if (data.stop !== undefined) {
1401
+ this.stop = data.stop;
1402
+ }
1403
+ this.value = AnimatableColor.create(this.value, data.value);
1404
+ if (data.opacity !== undefined) {
1405
+ this.opacity = new GradientColorOpacity;
1406
+ if (typeof data.opacity === "number") {
1407
+ this.opacity.value = data.opacity;
1408
+ } else {
1409
+ this.opacity.load(data.opacity);
1410
+ }
1376
1411
  }
1377
1412
  }
1378
1413
  }
1379
- class Shape_Shape {
1414
+ class GradientAngleAnimation {
1380
1415
  constructor() {
1381
- this.options = {};
1382
- this.type = "circle";
1383
- }
1384
- get image() {
1385
- var _a;
1386
- return (_a = this.options["image"]) !== null && _a !== void 0 ? _a : this.options["images"];
1387
- }
1388
- set image(value) {
1389
- this.options["image"] = value;
1390
- this.options["images"] = value;
1391
- }
1392
- get custom() {
1393
- return this.options;
1394
- }
1395
- set custom(value) {
1396
- this.options = value;
1397
- }
1398
- get images() {
1399
- return this.image;
1400
- }
1401
- set images(value) {
1402
- this.image = value;
1403
- }
1404
- get stroke() {
1405
- return [];
1406
- }
1407
- set stroke(_value) {}
1408
- get character() {
1409
- var _a;
1410
- return (_a = this.options["character"]) !== null && _a !== void 0 ? _a : this.options["char"];
1411
- }
1412
- set character(value) {
1413
- this.options["character"] = value;
1414
- this.options["char"] = value;
1415
- }
1416
- get polygon() {
1417
- var _a;
1418
- return (_a = this.options["polygon"]) !== null && _a !== void 0 ? _a : this.options["star"];
1419
- }
1420
- set polygon(value) {
1421
- this.options["polygon"] = value;
1422
- this.options["star"] = value;
1416
+ this.count = 0;
1417
+ this.enable = false;
1418
+ this.speed = 0;
1419
+ this.sync = false;
1423
1420
  }
1424
1421
  load(data) {
1425
- var _a, _b, _c;
1426
- if (data === undefined) {
1422
+ if (!data) {
1427
1423
  return;
1428
1424
  }
1429
- const options = (_a = data.options) !== null && _a !== void 0 ? _a : data.custom;
1430
- if (options !== undefined) {
1431
- for (const shape in options) {
1432
- const item = options[shape];
1433
- if (item !== undefined) {
1434
- this.options[shape] = deepExtend((_b = this.options[shape]) !== null && _b !== void 0 ? _b : {}, item);
1435
- }
1436
- }
1425
+ if (data.count !== undefined) {
1426
+ this.count = data.count;
1437
1427
  }
1438
- this.loadShape(data.character, "character", "char", true);
1439
- this.loadShape(data.polygon, "polygon", "star", false);
1440
- this.loadShape((_c = data.image) !== null && _c !== void 0 ? _c : data.images, "image", "images", true);
1441
- if (data.type !== undefined) {
1442
- this.type = data.type;
1428
+ if (data.enable !== undefined) {
1429
+ this.enable = data.enable;
1443
1430
  }
1444
- }
1445
- loadShape(item, mainKey, altKey, altOverride) {
1446
- var _a, _b, _c, _d;
1447
- if (item === undefined) {
1448
- return;
1431
+ if (data.speed !== undefined) {
1432
+ this.speed = data.speed;
1449
1433
  }
1450
- if (item instanceof Array) {
1451
- if (!(this.options[mainKey] instanceof Array)) {
1452
- this.options[mainKey] = [];
1453
- if (!this.options[altKey] || altOverride) {
1454
- this.options[altKey] = [];
1455
- }
1456
- }
1457
- this.options[mainKey] = deepExtend((_a = this.options[mainKey]) !== null && _a !== void 0 ? _a : [], item);
1458
- if (!this.options[altKey] || altOverride) {
1459
- this.options[altKey] = deepExtend((_b = this.options[altKey]) !== null && _b !== void 0 ? _b : [], item);
1460
- }
1461
- } else {
1462
- if (this.options[mainKey] instanceof Array) {
1463
- this.options[mainKey] = {};
1464
- if (!this.options[altKey] || altOverride) {
1465
- this.options[altKey] = {};
1466
- }
1467
- }
1468
- this.options[mainKey] = deepExtend((_c = this.options[mainKey]) !== null && _c !== void 0 ? _c : {}, item);
1469
- if (!this.options[altKey] || altOverride) {
1470
- this.options[altKey] = deepExtend((_d = this.options[altKey]) !== null && _d !== void 0 ? _d : {}, item);
1471
- }
1434
+ if (data.sync !== undefined) {
1435
+ this.sync = data.sync;
1472
1436
  }
1473
1437
  }
1474
1438
  }
1475
- class Size_Size extends(null && ValueWithRandom){
1439
+ class GradientColorOpacityAnimation {
1476
1440
  constructor() {
1477
- super();
1478
- this.animation = new SizeAnimation;
1479
- this.random.minimumValue = 1;
1480
- this.value = 3;
1481
- }
1482
- get anim() {
1483
- return this.animation;
1484
- }
1485
- set anim(value) {
1486
- this.animation = value;
1441
+ this.count = 0;
1442
+ this.enable = false;
1443
+ this.speed = 0;
1444
+ this.sync = false;
1445
+ this.startValue = "random";
1487
1446
  }
1488
1447
  load(data) {
1489
- var _a;
1490
1448
  if (!data) {
1491
1449
  return;
1492
1450
  }
1493
- super.load(data);
1494
- const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
1495
- if (animation !== undefined) {
1496
- this.animation.load(animation);
1497
- this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
1451
+ if (data.count !== undefined) {
1452
+ this.count = data.count;
1453
+ }
1454
+ if (data.enable !== undefined) {
1455
+ this.enable = data.enable;
1456
+ }
1457
+ if (data.speed !== undefined) {
1458
+ this.speed = data.speed;
1459
+ }
1460
+ if (data.sync !== undefined) {
1461
+ this.sync = data.sync;
1462
+ }
1463
+ if (data.startValue !== undefined) {
1464
+ this.startValue = data.startValue;
1498
1465
  }
1499
1466
  }
1500
1467
  }
1501
- class Rotate_Rotate extends(null && ValueWithRandom){
1468
+ class ValueWithRandom_ValueWithRandom {
1502
1469
  constructor() {
1503
- super();
1504
- this.animation = new RotateAnimation;
1505
- this.direction = "clockwise";
1506
- this.path = false;
1470
+ this.random = new Random;
1507
1471
  this.value = 0;
1508
1472
  }
1509
1473
  load(data) {
1510
1474
  if (!data) {
1511
1475
  return;
1512
1476
  }
1513
- super.load(data);
1514
- if (data.direction !== undefined) {
1515
- this.direction = data.direction;
1477
+ if (typeof data.random === "boolean") {
1478
+ this.random.enable = data.random;
1479
+ } else {
1480
+ this.random.load(data.random);
1516
1481
  }
1517
- this.animation.load(data.animation);
1518
- if (data.path !== undefined) {
1519
- this.path = data.path;
1482
+ if (data.value !== undefined) {
1483
+ this.value = setRangeValue(data.value, this.random.enable ? this.random.minimumValue : undefined);
1520
1484
  }
1521
1485
  }
1522
1486
  }
1523
- class OptionsColor_OptionsColor {
1487
+ class BounceFactor_BounceFactor extends(null && ValueWithRandom){
1524
1488
  constructor() {
1525
- this.value = "#fff";
1489
+ super();
1490
+ this.random.minimumValue = .1;
1491
+ this.value = 1;
1526
1492
  }
1527
- static create(source, data) {
1528
- const color = new OptionsColor_OptionsColor;
1529
- color.load(source);
1530
- if (data !== undefined) {
1531
- if (typeof data === "string" || data instanceof Array) {
1532
- color.load({
1533
- value: data
1534
- });
1535
- } else {
1536
- color.load(data);
1537
- }
1538
- }
1539
- return color;
1493
+ }
1494
+ class Bounce_Bounce {
1495
+ constructor() {
1496
+ this.horizontal = new BounceFactor;
1497
+ this.vertical = new BounceFactor;
1540
1498
  }
1541
1499
  load(data) {
1542
- if ((data === null || data === void 0 ? void 0 : data.value) === undefined) {
1500
+ if (!data) {
1543
1501
  return;
1544
1502
  }
1545
- this.value = data.value;
1503
+ this.horizontal.load(data.horizontal);
1504
+ this.vertical.load(data.vertical);
1546
1505
  }
1547
1506
  }
1548
- class ColorAnimation {
1507
+ class Collisions_Collisions {
1549
1508
  constructor() {
1550
- this.count = 0;
1509
+ this.bounce = new Bounce;
1551
1510
  this.enable = false;
1552
- this.offset = 0;
1553
- this.speed = 1;
1554
- this.sync = true;
1511
+ this.mode = "bounce";
1512
+ this.overlap = new CollisionsOverlap;
1555
1513
  }
1556
1514
  load(data) {
1557
1515
  if (data === undefined) {
1558
1516
  return;
1559
1517
  }
1560
- if (data.count !== undefined) {
1561
- this.count = data.count;
1562
- }
1518
+ this.bounce.load(data.bounce);
1563
1519
  if (data.enable !== undefined) {
1564
1520
  this.enable = data.enable;
1565
1521
  }
1566
- if (data.offset !== undefined) {
1567
- this.offset = NumberUtils_setRangeValue(data.offset);
1568
- }
1569
- if (data.speed !== undefined) {
1570
- this.speed = data.speed;
1571
- }
1572
- if (data.sync !== undefined) {
1573
- this.sync = data.sync;
1522
+ if (data.mode !== undefined) {
1523
+ this.mode = data.mode;
1574
1524
  }
1525
+ this.overlap.load(data.overlap);
1575
1526
  }
1576
1527
  }
1577
- class HslAnimation {
1528
+ class SplitFactor_SplitFactor extends(null && ValueWithRandom){
1578
1529
  constructor() {
1579
- this.h = new ColorAnimation;
1580
- this.s = new ColorAnimation;
1581
- this.l = new ColorAnimation;
1582
- }
1583
- load(data) {
1584
- if (!data) {
1585
- return;
1586
- }
1587
- this.h.load(data.h);
1588
- this.s.load(data.s);
1589
- this.l.load(data.l);
1530
+ super();
1531
+ this.value = 3;
1590
1532
  }
1591
1533
  }
1592
- class AnimatableColor_AnimatableColor extends OptionsColor_OptionsColor {
1534
+ class SplitRate_SplitRate extends(null && ValueWithRandom){
1593
1535
  constructor() {
1594
1536
  super();
1595
- this.animation = new HslAnimation;
1596
- }
1597
- static create(source, data) {
1598
- const color = new AnimatableColor_AnimatableColor;
1599
- color.load(source);
1600
- if (data !== undefined) {
1601
- if (typeof data === "string" || data instanceof Array) {
1602
- color.load({
1603
- value: data
1604
- });
1605
- } else {
1606
- color.load(data);
1607
- }
1608
- }
1609
- return color;
1610
- }
1611
- load(data) {
1612
- super.load(data);
1613
- if (!data) {
1614
- return;
1615
- }
1616
- const colorAnimation = data.animation;
1617
- if (colorAnimation !== undefined) {
1618
- if (colorAnimation.enable !== undefined) {
1619
- this.animation.h.load(colorAnimation);
1620
- } else {
1621
- this.animation.load(data.animation);
1622
- }
1623
- }
1537
+ this.value = {
1538
+ min: 4,
1539
+ max: 9
1540
+ };
1624
1541
  }
1625
1542
  }
1626
- class Stroke_Stroke {
1543
+ class Split_Split {
1627
1544
  constructor() {
1628
- this.width = 0;
1545
+ this.count = 1;
1546
+ this.factor = new SplitFactor;
1547
+ this.rate = new SplitRate;
1548
+ this.sizeOffset = true;
1629
1549
  }
1630
1550
  load(data) {
1631
- if (data === undefined) {
1551
+ if (!data) {
1632
1552
  return;
1633
1553
  }
1634
- if (data.color !== undefined) {
1635
- this.color = AnimatableColor.create(this.color, data.color);
1554
+ if (data.count !== undefined) {
1555
+ this.count = data.count;
1636
1556
  }
1637
- if (data.width !== undefined) {
1638
- this.width = data.width;
1557
+ this.factor.load(data.factor);
1558
+ this.rate.load(data.rate);
1559
+ if (data.particles !== undefined) {
1560
+ this.particles = deepExtend({}, data.particles);
1639
1561
  }
1640
- if (data.opacity !== undefined) {
1641
- this.opacity = data.opacity;
1562
+ if (data.sizeOffset !== undefined) {
1563
+ this.sizeOffset = data.sizeOffset;
1642
1564
  }
1643
1565
  }
1644
1566
  }
1645
- class BounceFactor_BounceFactor extends(null && ValueWithRandom){
1646
- constructor() {
1647
- super();
1648
- this.random.minimumValue = .1;
1649
- this.value = 1;
1650
- }
1651
- }
1652
- class Bounce_Bounce {
1567
+ class Destroy_Destroy {
1653
1568
  constructor() {
1654
- this.horizontal = new BounceFactor;
1655
- this.vertical = new BounceFactor;
1569
+ this.mode = "none";
1570
+ this.split = new Split;
1656
1571
  }
1657
1572
  load(data) {
1658
1573
  if (!data) {
1659
1574
  return;
1660
1575
  }
1661
- this.horizontal.load(data.horizontal);
1662
- this.vertical.load(data.vertical);
1663
- }
1664
- }
1665
- class Collisions_Collisions {
1666
- constructor() {
1667
- this.bounce = new Bounce;
1668
- this.enable = false;
1669
- this.mode = "bounce";
1670
- this.overlap = new CollisionsOverlap;
1671
- }
1672
- load(data) {
1673
- if (data === undefined) {
1674
- return;
1675
- }
1676
- this.bounce.load(data.bounce);
1677
- if (data.enable !== undefined) {
1678
- this.enable = data.enable;
1679
- }
1680
1576
  if (data.mode !== undefined) {
1681
1577
  this.mode = data.mode;
1682
1578
  }
1683
- this.overlap.load(data.overlap);
1579
+ this.split.load(data.split);
1684
1580
  }
1685
1581
  }
1686
1582
  class LifeDelay_LifeDelay extends(null && ValueWithRandom){
@@ -1731,151 +1627,190 @@
1731
1627
  this.duration.load(data.duration);
1732
1628
  }
1733
1629
  }
1734
- class SplitFactor_SplitFactor extends(null && ValueWithRandom){
1735
- constructor() {
1736
- super();
1737
- this.value = 3;
1738
- }
1739
- }
1740
- class SplitRate_SplitRate extends(null && ValueWithRandom){
1630
+ class PathDelay_PathDelay extends(null && ValueWithRandom){
1741
1631
  constructor() {
1742
1632
  super();
1743
- this.value = {
1744
- min: 4,
1745
- max: 9
1746
- };
1747
- }
1748
- }
1749
- class Split_Split {
1750
- constructor() {
1751
- this.count = 1;
1752
- this.factor = new SplitFactor;
1753
- this.rate = new SplitRate;
1754
- this.sizeOffset = true;
1755
- }
1756
- load(data) {
1757
- if (!data) {
1758
- return;
1759
- }
1760
- if (data.count !== undefined) {
1761
- this.count = data.count;
1762
- }
1763
- this.factor.load(data.factor);
1764
- this.rate.load(data.rate);
1765
- if (data.particles !== undefined) {
1766
- this.particles = deepExtend({}, data.particles);
1767
- }
1768
- if (data.sizeOffset !== undefined) {
1769
- this.sizeOffset = data.sizeOffset;
1770
- }
1771
- }
1772
- }
1773
- class Destroy_Destroy {
1774
- constructor() {
1775
- this.mode = "none";
1776
- this.split = new Split;
1777
- }
1778
- load(data) {
1779
- if (!data) {
1780
- return;
1781
- }
1782
- if (data.mode !== undefined) {
1783
- this.mode = data.mode;
1784
- }
1785
- this.split.load(data.split);
1786
1633
  }
1787
1634
  }
1788
- class Wobble_Wobble {
1635
+ class Path_Path {
1789
1636
  constructor() {
1790
- this.distance = 5;
1637
+ this.clamp = true;
1638
+ this.delay = new PathDelay;
1791
1639
  this.enable = false;
1792
- this.speed = 50;
1640
+ this.options = {};
1793
1641
  }
1794
1642
  load(data) {
1795
- if (!data) {
1643
+ if (data === undefined) {
1796
1644
  return;
1797
1645
  }
1798
- if (data.distance !== undefined) {
1799
- this.distance = setRangeValue(data.distance);
1646
+ if (data.clamp !== undefined) {
1647
+ this.clamp = data.clamp;
1800
1648
  }
1649
+ this.delay.load(data.delay);
1801
1650
  if (data.enable !== undefined) {
1802
1651
  this.enable = data.enable;
1803
1652
  }
1804
- if (data.speed !== undefined) {
1805
- this.speed = setRangeValue(data.speed);
1653
+ this.generator = data.generator;
1654
+ if (data.options) {
1655
+ this.options = deepExtend(this.options, data.options);
1806
1656
  }
1807
1657
  }
1808
1658
  }
1809
- class Tilt_Tilt extends(null && ValueWithRandom){
1659
+ class Spin_Spin {
1810
1660
  constructor() {
1811
- super();
1812
- this.animation = new TiltAnimation;
1813
- this.direction = "clockwise";
1661
+ this.acceleration = 0;
1814
1662
  this.enable = false;
1815
- this.value = 0;
1816
1663
  }
1817
1664
  load(data) {
1818
1665
  if (!data) {
1819
1666
  return;
1820
1667
  }
1821
- super.load(data);
1822
- this.animation.load(data.animation);
1823
- if (data.direction !== undefined) {
1824
- this.direction = data.direction;
1668
+ if (data.acceleration !== undefined) {
1669
+ this.acceleration = setRangeValue(data.acceleration);
1825
1670
  }
1826
1671
  if (data.enable !== undefined) {
1827
1672
  this.enable = data.enable;
1828
1673
  }
1674
+ this.position = data.position ? deepExtend({}, data.position) : undefined;
1829
1675
  }
1830
1676
  }
1831
- class Roll_Roll {
1677
+ class Move_Move {
1832
1678
  constructor() {
1833
- this.darken = new RollLight;
1679
+ this.angle = new MoveAngle;
1680
+ this.attract = new Attract;
1681
+ this.decay = 0;
1682
+ this.distance = {};
1683
+ this.direction = "none";
1684
+ this.drift = 0;
1834
1685
  this.enable = false;
1835
- this.enlighten = new RollLight;
1836
- this.mode = "vertical";
1837
- this.speed = 25;
1838
- }
1839
- load(data) {
1840
- if (!data) {
1841
- return;
1842
- }
1843
- if (data.backColor !== undefined) {
1844
- this.backColor = OptionsColor.create(this.backColor, data.backColor);
1845
- }
1846
- this.darken.load(data.darken);
1847
- if (data.enable !== undefined) {
1848
- this.enable = data.enable;
1849
- }
1850
- this.enlighten.load(data.enlighten);
1851
- if (data.mode !== undefined) {
1852
- this.mode = data.mode;
1853
- }
1854
- if (data.speed !== undefined) {
1855
- this.speed = setRangeValue(data.speed);
1856
- }
1686
+ this.gravity = new MoveGravity;
1687
+ this.path = new Path;
1688
+ this.outModes = new OutModes;
1689
+ this.random = false;
1690
+ this.size = false;
1691
+ this.speed = 2;
1692
+ this.spin = new Spin;
1693
+ this.straight = false;
1694
+ this.trail = new Trail;
1695
+ this.vibrate = false;
1696
+ this.warp = false;
1697
+ }
1698
+ get collisions() {
1699
+ return false;
1700
+ }
1701
+ set collisions(value) {}
1702
+ get bounce() {
1703
+ return this.collisions;
1704
+ }
1705
+ set bounce(value) {
1706
+ this.collisions = value;
1707
+ }
1708
+ get out_mode() {
1709
+ return this.outMode;
1710
+ }
1711
+ set out_mode(value) {
1712
+ this.outMode = value;
1713
+ }
1714
+ get outMode() {
1715
+ return this.outModes.default;
1716
+ }
1717
+ set outMode(value) {
1718
+ this.outModes.default = value;
1719
+ }
1720
+ get noise() {
1721
+ return this.path;
1722
+ }
1723
+ set noise(value) {
1724
+ this.path = value;
1725
+ }
1726
+ load(data) {
1727
+ var _a, _b, _c;
1728
+ if (data === undefined) {
1729
+ return;
1730
+ }
1731
+ if (data.angle !== undefined) {
1732
+ if (typeof data.angle === "number") {
1733
+ this.angle.value = data.angle;
1734
+ } else {
1735
+ this.angle.load(data.angle);
1736
+ }
1737
+ }
1738
+ this.attract.load(data.attract);
1739
+ if (data.decay !== undefined) {
1740
+ this.decay = data.decay;
1741
+ }
1742
+ if (data.direction !== undefined) {
1743
+ this.direction = data.direction;
1744
+ }
1745
+ if (data.distance !== undefined) {
1746
+ this.distance = typeof data.distance === "number" ? {
1747
+ horizontal: data.distance,
1748
+ vertical: data.distance
1749
+ } : deepExtend({}, data.distance);
1750
+ }
1751
+ if (data.drift !== undefined) {
1752
+ this.drift = setRangeValue(data.drift);
1753
+ }
1754
+ if (data.enable !== undefined) {
1755
+ this.enable = data.enable;
1756
+ }
1757
+ this.gravity.load(data.gravity);
1758
+ const outMode = (_a = data.outMode) !== null && _a !== void 0 ? _a : data.out_mode;
1759
+ if (data.outModes !== undefined || outMode !== undefined) {
1760
+ if (typeof data.outModes === "string" || data.outModes === undefined && outMode !== undefined) {
1761
+ this.outModes.load({
1762
+ default: (_b = data.outModes) !== null && _b !== void 0 ? _b : outMode
1763
+ });
1764
+ } else {
1765
+ this.outModes.load(data.outModes);
1766
+ }
1767
+ }
1768
+ this.path.load((_c = data.path) !== null && _c !== void 0 ? _c : data.noise);
1769
+ if (data.random !== undefined) {
1770
+ this.random = data.random;
1771
+ }
1772
+ if (data.size !== undefined) {
1773
+ this.size = data.size;
1774
+ }
1775
+ if (data.speed !== undefined) {
1776
+ this.speed = setRangeValue(data.speed);
1777
+ }
1778
+ this.spin.load(data.spin);
1779
+ if (data.straight !== undefined) {
1780
+ this.straight = data.straight;
1781
+ }
1782
+ this.trail.load(data.trail);
1783
+ if (data.vibrate !== undefined) {
1784
+ this.vibrate = data.vibrate;
1785
+ }
1786
+ if (data.warp !== undefined) {
1787
+ this.warp = data.warp;
1788
+ }
1857
1789
  }
1858
1790
  }
1859
- class ZIndex_ZIndex extends(null && ValueWithRandom){
1791
+ class Opacity_Opacity extends(null && ValueWithRandom){
1860
1792
  constructor() {
1861
1793
  super();
1862
- this.opacityRate = 1;
1863
- this.sizeRate = 1;
1864
- this.velocityRate = 1;
1794
+ this.animation = new OpacityAnimation;
1795
+ this.random.minimumValue = .1;
1796
+ this.value = 1;
1797
+ }
1798
+ get anim() {
1799
+ return this.animation;
1800
+ }
1801
+ set anim(value) {
1802
+ this.animation = value;
1865
1803
  }
1866
1804
  load(data) {
1867
- super.load(data);
1805
+ var _a;
1868
1806
  if (!data) {
1869
1807
  return;
1870
1808
  }
1871
- if (data.opacityRate !== undefined) {
1872
- this.opacityRate = data.opacityRate;
1873
- }
1874
- if (data.sizeRate !== undefined) {
1875
- this.sizeRate = data.sizeRate;
1876
- }
1877
- if (data.velocityRate !== undefined) {
1878
- this.velocityRate = data.velocityRate;
1809
+ super.load(data);
1810
+ const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
1811
+ if (animation !== undefined) {
1812
+ this.animation.load(animation);
1813
+ this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
1879
1814
  }
1880
1815
  }
1881
1816
  }
@@ -1955,137 +1890,260 @@
1955
1890
  }
1956
1891
  }
1957
1892
  }
1958
- class AnimatableGradient_AnimatableGradient {
1893
+ class Roll_Roll {
1959
1894
  constructor() {
1960
- this.angle = new GradientAngle;
1961
- this.colors = [];
1962
- this.type = "random";
1895
+ this.darken = new RollLight;
1896
+ this.enable = false;
1897
+ this.enlighten = new RollLight;
1898
+ this.mode = "vertical";
1899
+ this.speed = 25;
1963
1900
  }
1964
1901
  load(data) {
1965
1902
  if (!data) {
1966
1903
  return;
1967
1904
  }
1968
- this.angle.load(data.angle);
1969
- if (data.colors !== undefined) {
1970
- this.colors = data.colors.map((s => {
1971
- const tmp = new AnimatableGradientColor;
1972
- tmp.load(s);
1973
- return tmp;
1974
- }));
1905
+ if (data.backColor !== undefined) {
1906
+ this.backColor = OptionsColor.create(this.backColor, data.backColor);
1975
1907
  }
1976
- if (data.type !== undefined) {
1977
- this.type = data.type;
1908
+ this.darken.load(data.darken);
1909
+ if (data.enable !== undefined) {
1910
+ this.enable = data.enable;
1911
+ }
1912
+ this.enlighten.load(data.enlighten);
1913
+ if (data.mode !== undefined) {
1914
+ this.mode = data.mode;
1915
+ }
1916
+ if (data.speed !== undefined) {
1917
+ this.speed = setRangeValue(data.speed);
1978
1918
  }
1979
1919
  }
1980
1920
  }
1981
- class GradientAngle {
1921
+ class Rotate_Rotate extends(null && ValueWithRandom){
1982
1922
  constructor() {
1983
- this.value = 0;
1984
- this.animation = new GradientAngleAnimation;
1923
+ super();
1924
+ this.animation = new RotateAnimation;
1985
1925
  this.direction = "clockwise";
1926
+ this.path = false;
1927
+ this.value = 0;
1986
1928
  }
1987
1929
  load(data) {
1988
1930
  if (!data) {
1989
1931
  return;
1990
1932
  }
1991
- this.animation.load(data.animation);
1992
- if (data.value !== undefined) {
1993
- this.value = data.value;
1994
- }
1933
+ super.load(data);
1995
1934
  if (data.direction !== undefined) {
1996
1935
  this.direction = data.direction;
1997
1936
  }
1998
- }
1999
- }
2000
- class GradientColorOpacity {
2001
- constructor() {
2002
- this.value = 0;
2003
- this.animation = new GradientColorOpacityAnimation;
2004
- }
2005
- load(data) {
2006
- if (!data) {
2007
- return;
2008
- }
2009
1937
  this.animation.load(data.animation);
2010
- if (data.value !== undefined) {
2011
- this.value = setRangeValue(data.value);
1938
+ if (data.path !== undefined) {
1939
+ this.path = data.path;
2012
1940
  }
2013
1941
  }
2014
1942
  }
2015
- class AnimatableGradientColor {
1943
+ class Shape_Shape {
2016
1944
  constructor() {
2017
- this.stop = 0;
2018
- this.value = new AnimatableColor;
1945
+ this.options = {};
1946
+ this.type = "circle";
1947
+ }
1948
+ get image() {
1949
+ var _a;
1950
+ return (_a = this.options["image"]) !== null && _a !== void 0 ? _a : this.options["images"];
1951
+ }
1952
+ set image(value) {
1953
+ this.options["image"] = value;
1954
+ this.options["images"] = value;
1955
+ }
1956
+ get custom() {
1957
+ return this.options;
1958
+ }
1959
+ set custom(value) {
1960
+ this.options = value;
1961
+ }
1962
+ get images() {
1963
+ return this.image;
1964
+ }
1965
+ set images(value) {
1966
+ this.image = value;
1967
+ }
1968
+ get stroke() {
1969
+ return [];
1970
+ }
1971
+ set stroke(_value) {}
1972
+ get character() {
1973
+ var _a;
1974
+ return (_a = this.options["character"]) !== null && _a !== void 0 ? _a : this.options["char"];
1975
+ }
1976
+ set character(value) {
1977
+ this.options["character"] = value;
1978
+ this.options["char"] = value;
1979
+ }
1980
+ get polygon() {
1981
+ var _a;
1982
+ return (_a = this.options["polygon"]) !== null && _a !== void 0 ? _a : this.options["star"];
1983
+ }
1984
+ set polygon(value) {
1985
+ this.options["polygon"] = value;
1986
+ this.options["star"] = value;
2019
1987
  }
2020
1988
  load(data) {
2021
- if (!data) {
1989
+ var _a, _b, _c;
1990
+ if (data === undefined) {
2022
1991
  return;
2023
1992
  }
2024
- if (data.stop !== undefined) {
2025
- this.stop = data.stop;
2026
- }
2027
- this.value = AnimatableColor.create(this.value, data.value);
2028
- if (data.opacity !== undefined) {
2029
- this.opacity = new GradientColorOpacity;
2030
- if (typeof data.opacity === "number") {
2031
- this.opacity.value = data.opacity;
2032
- } else {
2033
- this.opacity.load(data.opacity);
1993
+ const options = (_a = data.options) !== null && _a !== void 0 ? _a : data.custom;
1994
+ if (options !== undefined) {
1995
+ for (const shape in options) {
1996
+ const item = options[shape];
1997
+ if (item !== undefined) {
1998
+ this.options[shape] = deepExtend((_b = this.options[shape]) !== null && _b !== void 0 ? _b : {}, item);
1999
+ }
2034
2000
  }
2035
2001
  }
2002
+ this.loadShape(data.character, "character", "char", true);
2003
+ this.loadShape(data.polygon, "polygon", "star", false);
2004
+ this.loadShape((_c = data.image) !== null && _c !== void 0 ? _c : data.images, "image", "images", true);
2005
+ if (data.type !== undefined) {
2006
+ this.type = data.type;
2007
+ }
2036
2008
  }
2037
- }
2038
- class GradientAngleAnimation {
2039
- constructor() {
2040
- this.count = 0;
2009
+ loadShape(item, mainKey, altKey, altOverride) {
2010
+ var _a, _b, _c, _d;
2011
+ if (item === undefined) {
2012
+ return;
2013
+ }
2014
+ if (item instanceof Array) {
2015
+ if (!(this.options[mainKey] instanceof Array)) {
2016
+ this.options[mainKey] = [];
2017
+ if (!this.options[altKey] || altOverride) {
2018
+ this.options[altKey] = [];
2019
+ }
2020
+ }
2021
+ this.options[mainKey] = deepExtend((_a = this.options[mainKey]) !== null && _a !== void 0 ? _a : [], item);
2022
+ if (!this.options[altKey] || altOverride) {
2023
+ this.options[altKey] = deepExtend((_b = this.options[altKey]) !== null && _b !== void 0 ? _b : [], item);
2024
+ }
2025
+ } else {
2026
+ if (this.options[mainKey] instanceof Array) {
2027
+ this.options[mainKey] = {};
2028
+ if (!this.options[altKey] || altOverride) {
2029
+ this.options[altKey] = {};
2030
+ }
2031
+ }
2032
+ this.options[mainKey] = deepExtend((_c = this.options[mainKey]) !== null && _c !== void 0 ? _c : {}, item);
2033
+ if (!this.options[altKey] || altOverride) {
2034
+ this.options[altKey] = deepExtend((_d = this.options[altKey]) !== null && _d !== void 0 ? _d : {}, item);
2035
+ }
2036
+ }
2037
+ }
2038
+ }
2039
+ class Size_Size extends(null && ValueWithRandom){
2040
+ constructor() {
2041
+ super();
2042
+ this.animation = new SizeAnimation;
2043
+ this.random.minimumValue = 1;
2044
+ this.value = 3;
2045
+ }
2046
+ get anim() {
2047
+ return this.animation;
2048
+ }
2049
+ set anim(value) {
2050
+ this.animation = value;
2051
+ }
2052
+ load(data) {
2053
+ var _a;
2054
+ if (!data) {
2055
+ return;
2056
+ }
2057
+ super.load(data);
2058
+ const animation = (_a = data.animation) !== null && _a !== void 0 ? _a : data.anim;
2059
+ if (animation !== undefined) {
2060
+ this.animation.load(animation);
2061
+ this.value = setRangeValue(this.value, this.animation.enable ? this.animation.minimumValue : undefined);
2062
+ }
2063
+ }
2064
+ }
2065
+ class Stroke_Stroke {
2066
+ constructor() {
2067
+ this.width = 0;
2068
+ }
2069
+ load(data) {
2070
+ if (data === undefined) {
2071
+ return;
2072
+ }
2073
+ if (data.color !== undefined) {
2074
+ this.color = AnimatableColor.create(this.color, data.color);
2075
+ }
2076
+ if (data.width !== undefined) {
2077
+ this.width = data.width;
2078
+ }
2079
+ if (data.opacity !== undefined) {
2080
+ this.opacity = data.opacity;
2081
+ }
2082
+ }
2083
+ }
2084
+ class Tilt_Tilt extends(null && ValueWithRandom){
2085
+ constructor() {
2086
+ super();
2087
+ this.animation = new TiltAnimation;
2088
+ this.direction = "clockwise";
2041
2089
  this.enable = false;
2042
- this.speed = 0;
2043
- this.sync = false;
2090
+ this.value = 0;
2044
2091
  }
2045
2092
  load(data) {
2046
2093
  if (!data) {
2047
2094
  return;
2048
2095
  }
2049
- if (data.count !== undefined) {
2050
- this.count = data.count;
2096
+ super.load(data);
2097
+ this.animation.load(data.animation);
2098
+ if (data.direction !== undefined) {
2099
+ this.direction = data.direction;
2051
2100
  }
2052
2101
  if (data.enable !== undefined) {
2053
2102
  this.enable = data.enable;
2054
2103
  }
2055
- if (data.speed !== undefined) {
2056
- this.speed = data.speed;
2057
- }
2058
- if (data.sync !== undefined) {
2059
- this.sync = data.sync;
2060
- }
2061
2104
  }
2062
2105
  }
2063
- class GradientColorOpacityAnimation {
2106
+ class Wobble_Wobble {
2064
2107
  constructor() {
2065
- this.count = 0;
2108
+ this.distance = 5;
2066
2109
  this.enable = false;
2067
- this.speed = 0;
2068
- this.sync = false;
2069
- this.startValue = "random";
2110
+ this.speed = 50;
2070
2111
  }
2071
2112
  load(data) {
2072
2113
  if (!data) {
2073
2114
  return;
2074
2115
  }
2075
- if (data.count !== undefined) {
2076
- this.count = data.count;
2116
+ if (data.distance !== undefined) {
2117
+ this.distance = setRangeValue(data.distance);
2077
2118
  }
2078
2119
  if (data.enable !== undefined) {
2079
2120
  this.enable = data.enable;
2080
2121
  }
2081
2122
  if (data.speed !== undefined) {
2082
- this.speed = data.speed;
2123
+ this.speed = setRangeValue(data.speed);
2083
2124
  }
2084
- if (data.sync !== undefined) {
2085
- this.sync = data.sync;
2125
+ }
2126
+ }
2127
+ class ZIndex_ZIndex extends(null && ValueWithRandom){
2128
+ constructor() {
2129
+ super();
2130
+ this.opacityRate = 1;
2131
+ this.sizeRate = 1;
2132
+ this.velocityRate = 1;
2133
+ }
2134
+ load(data) {
2135
+ super.load(data);
2136
+ if (!data) {
2137
+ return;
2086
2138
  }
2087
- if (data.startValue !== undefined) {
2088
- this.startValue = data.startValue;
2139
+ if (data.opacityRate !== undefined) {
2140
+ this.opacityRate = data.opacityRate;
2141
+ }
2142
+ if (data.sizeRate !== undefined) {
2143
+ this.sizeRate = data.sizeRate;
2144
+ }
2145
+ if (data.velocityRate !== undefined) {
2146
+ this.velocityRate = data.velocityRate;
2089
2147
  }
2090
2148
  }
2091
2149
  }
@@ -2203,303 +2261,517 @@
2203
2261
  }
2204
2262
  }
2205
2263
  }
2206
- const fixOutMode = data => {
2207
- if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
2208
- if (data.coord > data.maxCoord - data.radius * 2) {
2209
- data.setCb(-data.radius);
2210
- } else if (data.coord < data.radius * 2) {
2211
- data.setCb(data.radius);
2212
- }
2264
+ class Responsive_Responsive {
2265
+ constructor() {
2266
+ this.maxWidth = Infinity;
2267
+ this.options = {};
2268
+ this.mode = "canvas";
2213
2269
  }
2214
- };
2215
- class Particle_Particle {
2216
- constructor(id, container, position, overrideOptions, group) {
2217
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2218
- this.id = id;
2219
- this.container = container;
2220
- this.group = group;
2221
- this.fill = true;
2222
- this.close = true;
2223
- this.lastPathTime = 0;
2224
- this.destroyed = false;
2225
- this.unbreakable = false;
2226
- this.splitCount = 0;
2227
- this.misplaced = false;
2228
- this.retina = {
2229
- maxDistance: {}
2230
- };
2231
- const pxRatio = container.retina.pixelRatio;
2232
- const mainOptions = container.actualOptions;
2233
- const particlesOptions = new ParticlesOptions;
2234
- particlesOptions.load(mainOptions.particles);
2235
- const shapeType = particlesOptions.shape.type;
2236
- const reduceDuplicates = particlesOptions.reduceDuplicates;
2237
- this.shape = shapeType instanceof Array ? itemFromArray(shapeType, this.id, reduceDuplicates) : shapeType;
2238
- if (overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.shape) {
2239
- if (overrideOptions.shape.type) {
2240
- const overrideShapeType = overrideOptions.shape.type;
2241
- this.shape = overrideShapeType instanceof Array ? itemFromArray(overrideShapeType, this.id, reduceDuplicates) : overrideShapeType;
2242
- }
2243
- const shapeOptions = new Shape;
2244
- shapeOptions.load(overrideOptions.shape);
2245
- if (this.shape) {
2246
- this.shapeData = this.loadShapeData(shapeOptions, reduceDuplicates);
2247
- }
2248
- } else {
2249
- this.shapeData = this.loadShapeData(particlesOptions.shape, reduceDuplicates);
2250
- }
2251
- if (overrideOptions !== undefined) {
2252
- particlesOptions.load(overrideOptions);
2270
+ load(data) {
2271
+ if (!data) {
2272
+ return;
2253
2273
  }
2254
- if (((_a = this.shapeData) === null || _a === void 0 ? void 0 : _a.particles) !== undefined) {
2255
- particlesOptions.load((_b = this.shapeData) === null || _b === void 0 ? void 0 : _b.particles);
2274
+ if (data.maxWidth !== undefined) {
2275
+ this.maxWidth = data.maxWidth;
2256
2276
  }
2257
- this.fill = (_d = (_c = this.shapeData) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.fill;
2258
- this.close = (_f = (_e = this.shapeData) === null || _e === void 0 ? void 0 : _e.close) !== null && _f !== void 0 ? _f : this.close;
2259
- this.options = particlesOptions;
2260
- this.pathDelay = getValue(this.options.move.path.delay) * 1e3;
2261
- const zIndexValue = getRangeValue(this.options.zIndex.value);
2262
- container.retina.initParticle(this);
2263
- const sizeOptions = this.options.size, sizeRange = sizeOptions.value;
2264
- this.size = {
2265
- enable: sizeOptions.animation.enable,
2266
- value: getValue(sizeOptions) * container.retina.pixelRatio,
2267
- max: getRangeMax(sizeRange) * pxRatio,
2268
- min: getRangeMin(sizeRange) * pxRatio,
2269
- loops: 0,
2270
- maxLoops: sizeOptions.animation.count
2271
- };
2272
- const sizeAnimation = sizeOptions.animation;
2273
- if (sizeAnimation.enable) {
2274
- this.size.status = 0;
2275
- switch (sizeAnimation.startValue) {
2276
- case "min":
2277
- this.size.value = this.size.min;
2278
- this.size.status = 0;
2279
- break;
2280
-
2281
- case "random":
2282
- this.size.value = randomInRange(this.size) * pxRatio;
2283
- this.size.status = Math.random() >= .5 ? 0 : 1;
2284
- break;
2285
-
2286
- case "max":
2287
- default:
2288
- this.size.value = this.size.max;
2289
- this.size.status = 1;
2290
- break;
2291
- }
2292
- this.size.velocity = ((_g = this.retina.sizeAnimationSpeed) !== null && _g !== void 0 ? _g : container.retina.sizeAnimationSpeed) / 100 * container.retina.reduceFactor;
2293
- if (!sizeAnimation.sync) {
2294
- this.size.velocity *= Math.random();
2277
+ if (data.mode !== undefined) {
2278
+ if (data.mode === "screen") {
2279
+ this.mode = "screen";
2280
+ } else {
2281
+ this.mode = "canvas";
2295
2282
  }
2296
2283
  }
2297
- this.direction = getParticleDirectionAngle(this.options.move.direction);
2298
- this.bubble = {
2299
- inRange: false
2300
- };
2301
- this.initialVelocity = this.calculateVelocity();
2302
- this.velocity = this.initialVelocity.copy();
2303
- this.moveDecay = 1 - getRangeValue(this.options.move.decay);
2304
- this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
2305
- this.initialPosition = this.position.copy();
2306
- this.offset = Vector.origin;
2307
- const particles = container.particles;
2308
- particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
2309
- particles.lastZIndex = this.position.z;
2310
- this.zIndexFactor = this.position.z / container.zLayers;
2311
- this.sides = 24;
2312
- let drawer = container.drawers.get(this.shape);
2313
- if (!drawer) {
2314
- drawer = Plugins.getShapeDrawer(this.shape);
2315
- if (drawer) {
2316
- container.drawers.set(this.shape, drawer);
2317
- }
2284
+ if (data.options !== undefined) {
2285
+ this.options = deepExtend({}, data.options);
2318
2286
  }
2319
- if (drawer === null || drawer === void 0 ? void 0 : drawer.loadShape) {
2320
- drawer === null || drawer === void 0 ? void 0 : drawer.loadShape(this);
2321
- }
2322
- const sideCountFunc = drawer === null || drawer === void 0 ? void 0 : drawer.getSidesCount;
2323
- if (sideCountFunc) {
2324
- this.sides = sideCountFunc(this);
2325
- }
2326
- this.life = this.loadLife();
2327
- this.spawning = this.life.delay > 0;
2328
- if (this.options.move.spin.enable) {
2329
- const spinPos = (_h = this.options.move.spin.position) !== null && _h !== void 0 ? _h : {
2330
- x: 50,
2331
- y: 50
2332
- };
2333
- const spinCenter = {
2334
- x: spinPos.x / 100 * container.canvas.size.width,
2335
- y: spinPos.y / 100 * container.canvas.size.height
2336
- };
2337
- const pos = this.getPosition();
2338
- const distance = getDistance(pos, spinCenter);
2339
- this.spin = {
2340
- center: spinCenter,
2341
- direction: this.velocity.x >= 0 ? "clockwise" : "counter-clockwise",
2342
- angle: this.velocity.angle,
2343
- radius: distance,
2344
- acceleration: (_j = this.retina.spinAcceleration) !== null && _j !== void 0 ? _j : getRangeValue(this.options.move.spin.acceleration)
2345
- };
2346
- }
2347
- this.shadowColor = colorToRgb(this.options.shadow.color);
2348
- for (const updater of container.particles.updaters) {
2349
- if (updater.init) {
2350
- updater.init(this);
2351
- }
2287
+ }
2288
+ }
2289
+ class Theme_Theme {
2290
+ constructor() {
2291
+ this.name = "";
2292
+ this.default = new ThemeDefault;
2293
+ }
2294
+ load(data) {
2295
+ if (data === undefined) {
2296
+ return;
2352
2297
  }
2353
- if (drawer && drawer.particleInit) {
2354
- drawer.particleInit(container, this);
2298
+ if (data.name !== undefined) {
2299
+ this.name = data.name;
2355
2300
  }
2356
- for (const [, plugin] of container.plugins) {
2357
- if (plugin.particleCreated) {
2358
- plugin.particleCreated(this);
2359
- }
2301
+ this.default.load(data.default);
2302
+ if (data.options !== undefined) {
2303
+ this.options = deepExtend({}, data.options);
2360
2304
  }
2361
2305
  }
2362
- isVisible() {
2363
- return !this.destroyed && !this.spawning && this.isInsideCanvas();
2364
- }
2365
- isInsideCanvas() {
2366
- const radius = this.getRadius();
2367
- const canvasSize = this.container.canvas.size;
2368
- return this.position.x >= -radius && this.position.y >= -radius && this.position.y <= canvasSize.height + radius && this.position.x <= canvasSize.width + radius;
2306
+ }
2307
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2308
+ if (kind === "m") throw new TypeError("Private method is not writable");
2309
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2310
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2311
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2312
+ value;
2313
+ };
2314
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2315
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2316
+ 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");
2317
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2318
+ };
2319
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
2320
+ class Options_Options {
2321
+ constructor(engine) {
2322
+ _Options_instances.add(this);
2323
+ _Options_engine.set(this, void 0);
2324
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
2325
+ this.autoPlay = true;
2326
+ this.background = new Background;
2327
+ this.backgroundMask = new BackgroundMask;
2328
+ this.fullScreen = new FullScreen;
2329
+ this.detectRetina = true;
2330
+ this.duration = 0;
2331
+ this.fpsLimit = 120;
2332
+ this.interactivity = new Interactivity;
2333
+ this.manualParticles = [];
2334
+ this.motion = new Motion;
2335
+ this.particles = new ParticlesOptions;
2336
+ this.pauseOnBlur = true;
2337
+ this.pauseOnOutsideViewport = true;
2338
+ this.responsive = [];
2339
+ this.style = {};
2340
+ this.themes = [];
2341
+ this.zLayers = 100;
2369
2342
  }
2370
- draw(delta) {
2371
- const container = this.container;
2372
- for (const [, plugin] of container.plugins) {
2373
- container.canvas.drawParticlePlugin(plugin, this, delta);
2374
- }
2375
- container.canvas.drawParticle(this, delta);
2343
+ get fps_limit() {
2344
+ return this.fpsLimit;
2376
2345
  }
2377
- getPosition() {
2378
- return {
2379
- x: this.position.x + this.offset.x,
2380
- y: this.position.y + this.offset.y,
2381
- z: this.position.z
2382
- };
2346
+ set fps_limit(value) {
2347
+ this.fpsLimit = value;
2383
2348
  }
2384
- getRadius() {
2385
- var _a;
2386
- return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
2349
+ get retina_detect() {
2350
+ return this.detectRetina;
2387
2351
  }
2388
- getMass() {
2389
- return this.getRadius() ** 2 * Math.PI / 2;
2352
+ set retina_detect(value) {
2353
+ this.detectRetina = value;
2390
2354
  }
2391
- getFillColor() {
2392
- var _a, _b, _c;
2393
- const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
2394
- if (color && this.roll && (this.backColor || this.roll.alter)) {
2395
- const rolled = Math.floor(((_c = (_b = this.roll) === null || _b === void 0 ? void 0 : _b.angle) !== null && _c !== void 0 ? _c : 0) / (Math.PI / 2)) % 2;
2396
- if (rolled) {
2397
- if (this.backColor) {
2398
- return this.backColor;
2399
- }
2400
- if (this.roll.alter) {
2401
- return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
2402
- }
2403
- }
2404
- }
2405
- return color;
2355
+ get backgroundMode() {
2356
+ return this.fullScreen;
2406
2357
  }
2407
- getStrokeColor() {
2408
- var _a, _b;
2409
- return (_b = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor)) !== null && _b !== void 0 ? _b : this.getFillColor();
2358
+ set backgroundMode(value) {
2359
+ this.fullScreen.load(value);
2410
2360
  }
2411
- destroy(override) {
2412
- this.destroyed = true;
2413
- this.bubble.inRange = false;
2414
- if (this.unbreakable) {
2361
+ load(data) {
2362
+ var _a, _b, _c, _d, _e;
2363
+ if (data === undefined) {
2415
2364
  return;
2416
2365
  }
2417
- this.destroyed = true;
2418
- this.bubble.inRange = false;
2419
- for (const [, plugin] of this.container.plugins) {
2420
- if (plugin.particleDestroyed) {
2421
- plugin.particleDestroyed(this, override);
2366
+ if (data.preset !== undefined) {
2367
+ if (data.preset instanceof Array) {
2368
+ for (const preset of data.preset) {
2369
+ this.importPreset(preset);
2370
+ }
2371
+ } else {
2372
+ this.importPreset(data.preset);
2422
2373
  }
2423
2374
  }
2424
- if (override) {
2425
- return;
2426
- }
2427
- const destroyOptions = this.options.destroy;
2428
- if (destroyOptions.mode === "split") {
2429
- this.split();
2375
+ if (data.autoPlay !== undefined) {
2376
+ this.autoPlay = data.autoPlay;
2430
2377
  }
2431
- }
2432
- reset() {
2433
- if (this.opacity) {
2434
- this.opacity.loops = 0;
2378
+ const detectRetina = (_a = data.detectRetina) !== null && _a !== void 0 ? _a : data.retina_detect;
2379
+ if (detectRetina !== undefined) {
2380
+ this.detectRetina = detectRetina;
2435
2381
  }
2436
- this.size.loops = 0;
2437
- }
2438
- split() {
2439
- const splitOptions = this.options.destroy.split;
2440
- if (splitOptions.count >= 0 && this.splitCount++ > splitOptions.count) {
2441
- return;
2382
+ if (data.duration !== undefined) {
2383
+ this.duration = data.duration;
2442
2384
  }
2443
- const rate = getRangeValue(splitOptions.rate.value);
2444
- for (let i = 0; i < rate; i++) {
2445
- this.container.particles.addSplitParticle(this);
2385
+ const fpsLimit = (_b = data.fpsLimit) !== null && _b !== void 0 ? _b : data.fps_limit;
2386
+ if (fpsLimit !== undefined) {
2387
+ this.fpsLimit = fpsLimit;
2446
2388
  }
2447
- }
2448
- calcPosition(container, position, zIndex, tryCount = 0) {
2449
- var _a, _b, _c, _d, _e, _f;
2450
- for (const [, plugin] of container.plugins) {
2451
- const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
2452
- if (pluginPos !== undefined) {
2453
- return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
2454
- }
2389
+ if (data.pauseOnBlur !== undefined) {
2390
+ this.pauseOnBlur = data.pauseOnBlur;
2455
2391
  }
2456
- const canvasSize = container.canvas.size;
2457
- 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);
2458
- const radius = this.getRadius();
2459
- const outModes = this.options.move.outModes, fixHorizontal = outMode => {
2460
- fixOutMode({
2461
- outMode: outMode,
2462
- checkModes: [ "bounce", "bounce-horizontal" ],
2463
- coord: pos.x,
2464
- maxCoord: container.canvas.size.width,
2465
- setCb: value => pos.x += value,
2466
- radius: radius
2467
- });
2468
- }, fixVertical = outMode => {
2469
- fixOutMode({
2470
- outMode: outMode,
2471
- checkModes: [ "bounce", "bounce-vertical" ],
2472
- coord: pos.y,
2473
- maxCoord: container.canvas.size.height,
2474
- setCb: value => pos.y += value,
2475
- radius: radius
2476
- });
2477
- };
2478
- fixHorizontal((_c = outModes.left) !== null && _c !== void 0 ? _c : outModes.default);
2479
- fixHorizontal((_d = outModes.right) !== null && _d !== void 0 ? _d : outModes.default);
2480
- fixVertical((_e = outModes.top) !== null && _e !== void 0 ? _e : outModes.default);
2481
- fixVertical((_f = outModes.bottom) !== null && _f !== void 0 ? _f : outModes.default);
2482
- if (this.checkOverlap(pos, tryCount)) {
2483
- return this.calcPosition(container, undefined, zIndex, tryCount + 1);
2392
+ if (data.pauseOnOutsideViewport !== undefined) {
2393
+ this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
2484
2394
  }
2485
- return pos;
2486
- }
2487
- checkOverlap(pos, tryCount = 0) {
2488
- const collisionsOptions = this.options.collisions;
2489
- const radius = this.getRadius();
2490
- if (!collisionsOptions.enable) {
2491
- return false;
2395
+ if (data.zLayers !== undefined) {
2396
+ this.zLayers = data.zLayers;
2492
2397
  }
2493
- const overlapOptions = collisionsOptions.overlap;
2494
- if (overlapOptions.enable) {
2495
- return false;
2398
+ this.background.load(data.background);
2399
+ const fullScreen = (_c = data.fullScreen) !== null && _c !== void 0 ? _c : data.backgroundMode;
2400
+ if (typeof fullScreen === "boolean") {
2401
+ this.fullScreen.enable = fullScreen;
2402
+ } else {
2403
+ this.fullScreen.load(fullScreen);
2496
2404
  }
2497
- const retries = overlapOptions.retries;
2498
- if (retries >= 0 && tryCount > retries) {
2499
- throw new Error("Particle is overlapping and can't be placed");
2405
+ this.backgroundMask.load(data.backgroundMask);
2406
+ this.interactivity.load(data.interactivity);
2407
+ if (data.manualParticles !== undefined) {
2408
+ this.manualParticles = data.manualParticles.map((t => {
2409
+ const tmp = new ManualParticle;
2410
+ tmp.load(t);
2411
+ return tmp;
2412
+ }));
2500
2413
  }
2501
- let overlaps = false;
2502
- for (const particle of this.container.particles.array) {
2414
+ this.motion.load(data.motion);
2415
+ this.particles.load(data.particles);
2416
+ this.style = deepExtend(this.style, data.style);
2417
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
2418
+ if (data.responsive !== undefined) {
2419
+ for (const responsive of data.responsive) {
2420
+ const optResponsive = new Responsive;
2421
+ optResponsive.load(responsive);
2422
+ this.responsive.push(optResponsive);
2423
+ }
2424
+ }
2425
+ this.responsive.sort(((a, b) => a.maxWidth - b.maxWidth));
2426
+ if (data.themes !== undefined) {
2427
+ for (const theme of data.themes) {
2428
+ const optTheme = new Theme;
2429
+ optTheme.load(theme);
2430
+ this.themes.push(optTheme);
2431
+ }
2432
+ }
2433
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2434
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
2435
+ }
2436
+ setTheme(name) {
2437
+ if (name) {
2438
+ const chosenTheme = this.themes.find((theme => theme.name === name));
2439
+ if (chosenTheme) {
2440
+ this.load(chosenTheme.options);
2441
+ }
2442
+ } else {
2443
+ const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch && mediaMatch.matches, defaultTheme = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, clientDarkMode ? "dark" : "light");
2444
+ if (defaultTheme) {
2445
+ this.load(defaultTheme.options);
2446
+ }
2447
+ }
2448
+ }
2449
+ setResponsive(width, pxRatio, defaultOptions) {
2450
+ this.load(defaultOptions);
2451
+ const responsiveOptions = this.responsive.find((t => t.mode === "screen" && screen ? t.maxWidth * pxRatio > screen.availWidth : t.maxWidth * pxRatio > width));
2452
+ this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
2453
+ return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
2454
+ }
2455
+ importPreset(preset) {
2456
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
2457
+ }
2458
+ }
2459
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
2460
+ var _a;
2461
+ 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"));
2462
+ };
2463
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2464
+ if (kind === "m") throw new TypeError("Private method is not writable");
2465
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2466
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2467
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2468
+ value;
2469
+ };
2470
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2471
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2472
+ 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");
2473
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2474
+ };
2475
+ var _Particle_engine;
2476
+ const fixOutMode = data => {
2477
+ if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
2478
+ if (data.coord > data.maxCoord - data.radius * 2) {
2479
+ data.setCb(-data.radius);
2480
+ } else if (data.coord < data.radius * 2) {
2481
+ data.setCb(data.radius);
2482
+ }
2483
+ }
2484
+ };
2485
+ class Particle_Particle {
2486
+ constructor(engine, id, container, position, overrideOptions, group) {
2487
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2488
+ this.id = id;
2489
+ this.container = container;
2490
+ this.group = group;
2491
+ _Particle_engine.set(this, void 0);
2492
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
2493
+ this.fill = true;
2494
+ this.close = true;
2495
+ this.lastPathTime = 0;
2496
+ this.destroyed = false;
2497
+ this.unbreakable = false;
2498
+ this.splitCount = 0;
2499
+ this.misplaced = false;
2500
+ this.retina = {
2501
+ maxDistance: {}
2502
+ };
2503
+ const pxRatio = container.retina.pixelRatio;
2504
+ const mainOptions = container.actualOptions;
2505
+ const particlesOptions = new ParticlesOptions;
2506
+ particlesOptions.load(mainOptions.particles);
2507
+ const shapeType = particlesOptions.shape.type;
2508
+ const reduceDuplicates = particlesOptions.reduceDuplicates;
2509
+ this.shape = shapeType instanceof Array ? itemFromArray(shapeType, this.id, reduceDuplicates) : shapeType;
2510
+ if (overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.shape) {
2511
+ if (overrideOptions.shape.type) {
2512
+ const overrideShapeType = overrideOptions.shape.type;
2513
+ this.shape = overrideShapeType instanceof Array ? itemFromArray(overrideShapeType, this.id, reduceDuplicates) : overrideShapeType;
2514
+ }
2515
+ const shapeOptions = new Shape;
2516
+ shapeOptions.load(overrideOptions.shape);
2517
+ if (this.shape) {
2518
+ this.shapeData = this.loadShapeData(shapeOptions, reduceDuplicates);
2519
+ }
2520
+ } else {
2521
+ this.shapeData = this.loadShapeData(particlesOptions.shape, reduceDuplicates);
2522
+ }
2523
+ if (overrideOptions !== undefined) {
2524
+ particlesOptions.load(overrideOptions);
2525
+ }
2526
+ if (((_a = this.shapeData) === null || _a === void 0 ? void 0 : _a.particles) !== undefined) {
2527
+ particlesOptions.load((_b = this.shapeData) === null || _b === void 0 ? void 0 : _b.particles);
2528
+ }
2529
+ this.fill = (_d = (_c = this.shapeData) === null || _c === void 0 ? void 0 : _c.fill) !== null && _d !== void 0 ? _d : this.fill;
2530
+ this.close = (_f = (_e = this.shapeData) === null || _e === void 0 ? void 0 : _e.close) !== null && _f !== void 0 ? _f : this.close;
2531
+ this.options = particlesOptions;
2532
+ this.pathDelay = getValue(this.options.move.path.delay) * 1e3;
2533
+ const zIndexValue = getRangeValue(this.options.zIndex.value);
2534
+ container.retina.initParticle(this);
2535
+ const sizeOptions = this.options.size, sizeRange = sizeOptions.value;
2536
+ this.size = {
2537
+ enable: sizeOptions.animation.enable,
2538
+ value: getValue(sizeOptions) * container.retina.pixelRatio,
2539
+ max: getRangeMax(sizeRange) * pxRatio,
2540
+ min: getRangeMin(sizeRange) * pxRatio,
2541
+ loops: 0,
2542
+ maxLoops: sizeOptions.animation.count
2543
+ };
2544
+ const sizeAnimation = sizeOptions.animation;
2545
+ if (sizeAnimation.enable) {
2546
+ this.size.status = 0;
2547
+ switch (sizeAnimation.startValue) {
2548
+ case "min":
2549
+ this.size.value = this.size.min;
2550
+ this.size.status = 0;
2551
+ break;
2552
+
2553
+ case "random":
2554
+ this.size.value = randomInRange(this.size) * pxRatio;
2555
+ this.size.status = Math.random() >= .5 ? 0 : 1;
2556
+ break;
2557
+
2558
+ case "max":
2559
+ default:
2560
+ this.size.value = this.size.max;
2561
+ this.size.status = 1;
2562
+ break;
2563
+ }
2564
+ this.size.velocity = ((_g = this.retina.sizeAnimationSpeed) !== null && _g !== void 0 ? _g : container.retina.sizeAnimationSpeed) / 100 * container.retina.reduceFactor;
2565
+ if (!sizeAnimation.sync) {
2566
+ this.size.velocity *= Math.random();
2567
+ }
2568
+ }
2569
+ this.direction = getParticleDirectionAngle(this.options.move.direction);
2570
+ this.bubble = {
2571
+ inRange: false
2572
+ };
2573
+ this.initialVelocity = this.calculateVelocity();
2574
+ this.velocity = this.initialVelocity.copy();
2575
+ this.moveDecay = 1 - getRangeValue(this.options.move.decay);
2576
+ this.position = this.calcPosition(container, position, clamp(zIndexValue, 0, container.zLayers));
2577
+ this.initialPosition = this.position.copy();
2578
+ this.offset = Vector.origin;
2579
+ const particles = container.particles;
2580
+ particles.needsSort = particles.needsSort || particles.lastZIndex < this.position.z;
2581
+ particles.lastZIndex = this.position.z;
2582
+ this.zIndexFactor = this.position.z / container.zLayers;
2583
+ this.sides = 24;
2584
+ let drawer = container.drawers.get(this.shape);
2585
+ if (!drawer) {
2586
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
2587
+ if (drawer) {
2588
+ container.drawers.set(this.shape, drawer);
2589
+ }
2590
+ }
2591
+ if (drawer === null || drawer === void 0 ? void 0 : drawer.loadShape) {
2592
+ drawer === null || drawer === void 0 ? void 0 : drawer.loadShape(this);
2593
+ }
2594
+ const sideCountFunc = drawer === null || drawer === void 0 ? void 0 : drawer.getSidesCount;
2595
+ if (sideCountFunc) {
2596
+ this.sides = sideCountFunc(this);
2597
+ }
2598
+ this.life = this.loadLife();
2599
+ this.spawning = this.life.delay > 0;
2600
+ if (this.options.move.spin.enable) {
2601
+ const spinPos = (_h = this.options.move.spin.position) !== null && _h !== void 0 ? _h : {
2602
+ x: 50,
2603
+ y: 50
2604
+ };
2605
+ const spinCenter = {
2606
+ x: spinPos.x / 100 * container.canvas.size.width,
2607
+ y: spinPos.y / 100 * container.canvas.size.height
2608
+ };
2609
+ const pos = this.getPosition();
2610
+ const distance = getDistance(pos, spinCenter);
2611
+ this.spin = {
2612
+ center: spinCenter,
2613
+ direction: this.velocity.x >= 0 ? "clockwise" : "counter-clockwise",
2614
+ angle: this.velocity.angle,
2615
+ radius: distance,
2616
+ acceleration: (_j = this.retina.spinAcceleration) !== null && _j !== void 0 ? _j : getRangeValue(this.options.move.spin.acceleration)
2617
+ };
2618
+ }
2619
+ this.shadowColor = colorToRgb(this.options.shadow.color);
2620
+ for (const updater of container.particles.updaters) {
2621
+ if (updater.init) {
2622
+ updater.init(this);
2623
+ }
2624
+ }
2625
+ if (drawer && drawer.particleInit) {
2626
+ drawer.particleInit(container, this);
2627
+ }
2628
+ for (const [, plugin] of container.plugins) {
2629
+ if (plugin.particleCreated) {
2630
+ plugin.particleCreated(this);
2631
+ }
2632
+ }
2633
+ }
2634
+ isVisible() {
2635
+ return !this.destroyed && !this.spawning && this.isInsideCanvas();
2636
+ }
2637
+ isInsideCanvas() {
2638
+ const radius = this.getRadius();
2639
+ const canvasSize = this.container.canvas.size;
2640
+ return this.position.x >= -radius && this.position.y >= -radius && this.position.y <= canvasSize.height + radius && this.position.x <= canvasSize.width + radius;
2641
+ }
2642
+ draw(delta) {
2643
+ const container = this.container;
2644
+ for (const [, plugin] of container.plugins) {
2645
+ container.canvas.drawParticlePlugin(plugin, this, delta);
2646
+ }
2647
+ container.canvas.drawParticle(this, delta);
2648
+ }
2649
+ getPosition() {
2650
+ return {
2651
+ x: this.position.x + this.offset.x,
2652
+ y: this.position.y + this.offset.y,
2653
+ z: this.position.z
2654
+ };
2655
+ }
2656
+ getRadius() {
2657
+ var _a;
2658
+ return (_a = this.bubble.radius) !== null && _a !== void 0 ? _a : this.size.value;
2659
+ }
2660
+ getMass() {
2661
+ return this.getRadius() ** 2 * Math.PI / 2;
2662
+ }
2663
+ getFillColor() {
2664
+ var _a, _b, _c;
2665
+ const color = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.color);
2666
+ if (color && this.roll && (this.backColor || this.roll.alter)) {
2667
+ const rolled = Math.floor(((_c = (_b = this.roll) === null || _b === void 0 ? void 0 : _b.angle) !== null && _c !== void 0 ? _c : 0) / (Math.PI / 2)) % 2;
2668
+ if (rolled) {
2669
+ if (this.backColor) {
2670
+ return this.backColor;
2671
+ }
2672
+ if (this.roll.alter) {
2673
+ return alterHsl(color, this.roll.alter.type, this.roll.alter.value);
2674
+ }
2675
+ }
2676
+ }
2677
+ return color;
2678
+ }
2679
+ getStrokeColor() {
2680
+ var _a, _b;
2681
+ return (_b = (_a = this.bubble.color) !== null && _a !== void 0 ? _a : getHslFromAnimation(this.strokeColor)) !== null && _b !== void 0 ? _b : this.getFillColor();
2682
+ }
2683
+ destroy(override) {
2684
+ this.destroyed = true;
2685
+ this.bubble.inRange = false;
2686
+ if (this.unbreakable) {
2687
+ return;
2688
+ }
2689
+ this.destroyed = true;
2690
+ this.bubble.inRange = false;
2691
+ for (const [, plugin] of this.container.plugins) {
2692
+ if (plugin.particleDestroyed) {
2693
+ plugin.particleDestroyed(this, override);
2694
+ }
2695
+ }
2696
+ if (override) {
2697
+ return;
2698
+ }
2699
+ const destroyOptions = this.options.destroy;
2700
+ if (destroyOptions.mode === "split") {
2701
+ this.split();
2702
+ }
2703
+ }
2704
+ reset() {
2705
+ if (this.opacity) {
2706
+ this.opacity.loops = 0;
2707
+ }
2708
+ this.size.loops = 0;
2709
+ }
2710
+ split() {
2711
+ const splitOptions = this.options.destroy.split;
2712
+ if (splitOptions.count >= 0 && this.splitCount++ > splitOptions.count) {
2713
+ return;
2714
+ }
2715
+ const rate = getRangeValue(splitOptions.rate.value);
2716
+ for (let i = 0; i < rate; i++) {
2717
+ this.container.particles.addSplitParticle(this);
2718
+ }
2719
+ }
2720
+ calcPosition(container, position, zIndex, tryCount = 0) {
2721
+ var _a, _b, _c, _d, _e, _f;
2722
+ for (const [, plugin] of container.plugins) {
2723
+ const pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position, this) : undefined;
2724
+ if (pluginPos !== undefined) {
2725
+ return Vector3d.create(pluginPos.x, pluginPos.y, zIndex);
2726
+ }
2727
+ }
2728
+ const canvasSize = container.canvas.size;
2729
+ 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);
2730
+ const radius = this.getRadius();
2731
+ const outModes = this.options.move.outModes, fixHorizontal = outMode => {
2732
+ fixOutMode({
2733
+ outMode: outMode,
2734
+ checkModes: [ "bounce", "bounce-horizontal" ],
2735
+ coord: pos.x,
2736
+ maxCoord: container.canvas.size.width,
2737
+ setCb: value => pos.x += value,
2738
+ radius: radius
2739
+ });
2740
+ }, fixVertical = outMode => {
2741
+ fixOutMode({
2742
+ outMode: outMode,
2743
+ checkModes: [ "bounce", "bounce-vertical" ],
2744
+ coord: pos.y,
2745
+ maxCoord: container.canvas.size.height,
2746
+ setCb: value => pos.y += value,
2747
+ radius: radius
2748
+ });
2749
+ };
2750
+ fixHorizontal((_c = outModes.left) !== null && _c !== void 0 ? _c : outModes.default);
2751
+ fixHorizontal((_d = outModes.right) !== null && _d !== void 0 ? _d : outModes.default);
2752
+ fixVertical((_e = outModes.top) !== null && _e !== void 0 ? _e : outModes.default);
2753
+ fixVertical((_f = outModes.bottom) !== null && _f !== void 0 ? _f : outModes.default);
2754
+ if (this.checkOverlap(pos, tryCount)) {
2755
+ return this.calcPosition(container, undefined, zIndex, tryCount + 1);
2756
+ }
2757
+ return pos;
2758
+ }
2759
+ checkOverlap(pos, tryCount = 0) {
2760
+ const collisionsOptions = this.options.collisions;
2761
+ const radius = this.getRadius();
2762
+ if (!collisionsOptions.enable) {
2763
+ return false;
2764
+ }
2765
+ const overlapOptions = collisionsOptions.overlap;
2766
+ if (overlapOptions.enable) {
2767
+ return false;
2768
+ }
2769
+ const retries = overlapOptions.retries;
2770
+ if (retries >= 0 && tryCount > retries) {
2771
+ throw new Error("Particle is overlapping and can't be placed");
2772
+ }
2773
+ let overlaps = false;
2774
+ for (const particle of this.container.particles.array) {
2503
2775
  if (getDistance(pos, particle.position) < radius + particle.getRadius()) {
2504
2776
  overlaps = true;
2505
2777
  break;
@@ -2551,9 +2823,25 @@
2551
2823
  return life;
2552
2824
  }
2553
2825
  }
2826
+ _Particle_engine = new WeakMap;
2827
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2828
+ if (kind === "m") throw new TypeError("Private method is not writable");
2829
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2830
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2831
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2832
+ value;
2833
+ };
2834
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2835
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2836
+ 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");
2837
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2838
+ };
2839
+ var _Particles_engine;
2554
2840
  class Particles_Particles {
2555
- constructor(container) {
2841
+ constructor(engine, container) {
2556
2842
  this.container = container;
2843
+ _Particles_engine.set(this, void 0);
2844
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
2557
2845
  this.nextId = 0;
2558
2846
  this.array = [];
2559
2847
  this.zArray = [];
@@ -2565,11 +2853,11 @@
2565
2853
  links: new Map,
2566
2854
  triangles: new Map
2567
2855
  };
2568
- this.interactionManager = new InteractionManager(container);
2856
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
2569
2857
  const canvasSize = this.container.canvas.size;
2570
2858
  this.linksColors = new Map;
2571
2859
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
2572
- this.updaters = Plugins.getUpdaters(container, true);
2860
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
2573
2861
  }
2574
2862
  get count() {
2575
2863
  return this.array.length;
@@ -2583,7 +2871,7 @@
2583
2871
  this.freqs.links = new Map;
2584
2872
  this.freqs.triangles = new Map;
2585
2873
  let handled = false;
2586
- this.updaters = Plugins.getUpdaters(container, true);
2874
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
2587
2875
  this.interactionManager.init();
2588
2876
  for (const [, plugin] of container.plugins) {
2589
2877
  if (plugin.particlesInitialization !== undefined) {
@@ -2607,633 +2895,354 @@
2607
2895
  }
2608
2896
  }
2609
2897
  container.pathGenerator.init(container);
2610
- }
2611
- redraw() {
2612
- this.clear();
2613
- this.init();
2614
- this.draw({
2615
- value: 0,
2616
- factor: 0
2617
- });
2618
- }
2619
- removeAt(index, quantity = 1, group, override) {
2620
- if (!(index >= 0 && index <= this.count)) {
2621
- return;
2622
- }
2623
- let deleted = 0;
2624
- for (let i = index; deleted < quantity && i < this.count; i++) {
2625
- const particle = this.array[i];
2626
- if (!particle || particle.group !== group) {
2627
- continue;
2628
- }
2629
- particle.destroy(override);
2630
- this.array.splice(i--, 1);
2631
- const zIdx = this.zArray.indexOf(particle);
2632
- this.zArray.splice(zIdx, 1);
2633
- deleted++;
2634
- }
2635
- }
2636
- remove(particle, group, override) {
2637
- this.removeAt(this.array.indexOf(particle), undefined, group, override);
2638
- }
2639
- update(delta) {
2640
- const container = this.container;
2641
- const particlesToDelete = [];
2642
- container.pathGenerator.update();
2643
- for (const [, plugin] of container.plugins) {
2644
- if (plugin.update !== undefined) {
2645
- plugin.update(delta);
2646
- }
2647
- }
2648
- for (const particle of this.array) {
2649
- const resizeFactor = container.canvas.resizeFactor;
2650
- if (resizeFactor) {
2651
- particle.position.x *= resizeFactor.width;
2652
- particle.position.y *= resizeFactor.height;
2653
- }
2654
- particle.bubble.inRange = false;
2655
- for (const [, plugin] of this.container.plugins) {
2656
- if (particle.destroyed) {
2657
- break;
2658
- }
2659
- if (plugin.particleUpdate) {
2660
- plugin.particleUpdate(particle, delta);
2661
- }
2662
- }
2663
- this.mover.move(particle, delta);
2664
- if (particle.destroyed) {
2665
- particlesToDelete.push(particle);
2666
- continue;
2667
- }
2668
- this.quadTree.insert(new Point(particle.getPosition(), particle));
2669
- }
2670
- for (const particle of particlesToDelete) {
2671
- this.remove(particle);
2672
- }
2673
- this.interactionManager.externalInteract(delta);
2674
- for (const particle of container.particles.array) {
2675
- for (const updater of this.updaters) {
2676
- updater.update(particle, delta);
2677
- }
2678
- if (!particle.destroyed && !particle.spawning) {
2679
- this.interactionManager.particlesInteract(particle, delta);
2680
- }
2681
- }
2682
- delete container.canvas.resizeFactor;
2683
- }
2684
- draw(delta) {
2685
- const container = this.container;
2686
- container.canvas.clear();
2687
- const canvasSize = this.container.canvas.size;
2688
- this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
2689
- this.update(delta);
2690
- if (this.needsSort) {
2691
- this.zArray.sort(((a, b) => b.position.z - a.position.z || a.id - b.id));
2692
- this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
2693
- this.needsSort = false;
2694
- }
2695
- for (const [, plugin] of container.plugins) {
2696
- container.canvas.drawPlugin(plugin, delta);
2697
- }
2698
- for (const p of this.zArray) {
2699
- p.draw(delta);
2700
- }
2701
- }
2702
- clear() {
2703
- this.array = [];
2704
- this.zArray = [];
2705
- }
2706
- push(nb, mouse, overrideOptions, group) {
2707
- this.pushing = true;
2708
- for (let i = 0; i < nb; i++) {
2709
- this.addParticle(mouse === null || mouse === void 0 ? void 0 : mouse.position, overrideOptions, group);
2710
- }
2711
- this.pushing = false;
2712
- }
2713
- addParticle(position, overrideOptions, group) {
2714
- const container = this.container, options = container.actualOptions, limit = options.particles.number.limit * container.density;
2715
- if (limit > 0) {
2716
- const countToRemove = this.count + 1 - limit;
2717
- if (countToRemove > 0) {
2718
- this.removeQuantity(countToRemove);
2719
- }
2720
- }
2721
- return this.pushParticle(position, overrideOptions, group);
2722
- }
2723
- addSplitParticle(parent) {
2724
- const splitOptions = parent.options.destroy.split, options = new ParticlesOptions;
2725
- options.load(parent.options);
2726
- const factor = getRangeValue(splitOptions.factor.value);
2727
- options.color.load({
2728
- value: {
2729
- hsl: parent.getFillColor()
2730
- }
2731
- });
2732
- if (typeof options.size.value === "number") {
2733
- options.size.value /= factor;
2734
- } else {
2735
- options.size.value.min /= factor;
2736
- options.size.value.max /= factor;
2737
- }
2738
- options.load(splitOptions.particles);
2739
- const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : 0;
2740
- const position = {
2741
- x: parent.position.x + randomInRange(offset),
2742
- y: parent.position.y + randomInRange(offset)
2743
- };
2744
- return this.pushParticle(position, options, parent.group, (particle => {
2745
- if (particle.size.value < .5) {
2746
- return false;
2747
- }
2748
- particle.velocity.length = randomInRange(setRangeValue(parent.velocity.length, particle.velocity.length));
2749
- particle.splitCount = parent.splitCount + 1;
2750
- particle.unbreakable = true;
2751
- setTimeout((() => {
2752
- particle.unbreakable = false;
2753
- }), 500);
2754
- return true;
2755
- }));
2756
- }
2757
- removeQuantity(quantity, group) {
2758
- this.removeAt(0, quantity, group);
2759
- }
2760
- getLinkFrequency(p1, p2) {
2761
- const range = setRangeValue(p1.id, p2.id), key = `${getRangeMin(range)}_${getRangeMax(range)}`;
2762
- let res = this.freqs.links.get(key);
2763
- if (res === undefined) {
2764
- res = Math.random();
2765
- this.freqs.links.set(key, res);
2766
- }
2767
- return res;
2768
- }
2769
- getTriangleFrequency(p1, p2, p3) {
2770
- let [id1, id2, id3] = [ p1.id, p2.id, p3.id ];
2771
- if (id1 > id2) {
2772
- [id2, id1] = [ id1, id2 ];
2773
- }
2774
- if (id2 > id3) {
2775
- [id3, id2] = [ id2, id3 ];
2776
- }
2777
- if (id1 > id3) {
2778
- [id3, id1] = [ id1, id3 ];
2779
- }
2780
- const key = `${id1}_${id2}_${id3}`;
2781
- let res = this.freqs.triangles.get(key);
2782
- if (res === undefined) {
2783
- res = Math.random();
2784
- this.freqs.triangles.set(key, res);
2785
- }
2786
- return res;
2787
- }
2788
- addManualParticles() {
2789
- const container = this.container, options = container.actualOptions;
2790
- for (const particle of options.manualParticles) {
2791
- const pos = particle.position ? {
2792
- x: particle.position.x * container.canvas.size.width / 100,
2793
- y: particle.position.y * container.canvas.size.height / 100
2794
- } : undefined;
2795
- this.addParticle(pos, particle.options);
2796
- }
2797
- }
2798
- setDensity() {
2799
- const options = this.container.actualOptions;
2800
- for (const group in options.particles.groups) {
2801
- this.applyDensity(options.particles.groups[group], 0, group);
2802
- }
2803
- this.applyDensity(options.particles, options.manualParticles.length);
2804
- }
2805
- applyDensity(options, manualCount, group) {
2806
- var _a;
2807
- if (!((_a = options.number.density) === null || _a === void 0 ? void 0 : _a.enable)) {
2808
- return;
2809
- }
2810
- const numberOptions = options.number;
2811
- const densityFactor = this.initDensityFactor(numberOptions.density);
2812
- const optParticlesNumber = numberOptions.value;
2813
- const optParticlesLimit = numberOptions.limit > 0 ? numberOptions.limit : optParticlesNumber;
2814
- const particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + manualCount;
2815
- const particlesCount = Math.min(this.count, this.array.filter((t => t.group === group)).length);
2816
- this.limit = numberOptions.limit * densityFactor;
2817
- if (particlesCount < particlesNumber) {
2818
- this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
2819
- } else if (particlesCount > particlesNumber) {
2820
- this.removeQuantity(particlesCount - particlesNumber, group);
2821
- }
2822
- }
2823
- initDensityFactor(densityOptions) {
2824
- const container = this.container;
2825
- if (!container.canvas.element || !densityOptions.enable) {
2826
- return 1;
2827
- }
2828
- const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
2829
- return canvas.width * canvas.height / (densityOptions.factor * pxRatio ** 2 * densityOptions.area);
2830
- }
2831
- pushParticle(position, overrideOptions, group, initializer) {
2832
- try {
2833
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
2834
- let canAdd = true;
2835
- if (initializer) {
2836
- canAdd = initializer(particle);
2837
- }
2838
- if (!canAdd) {
2839
- return;
2840
- }
2841
- this.array.push(particle);
2842
- this.zArray.push(particle);
2843
- this.nextId++;
2844
- return particle;
2845
- } catch (e) {
2846
- console.warn(`error adding particle: ${e}`);
2898
+ }
2899
+ redraw() {
2900
+ this.clear();
2901
+ this.init();
2902
+ this.draw({
2903
+ value: 0,
2904
+ factor: 0
2905
+ });
2906
+ }
2907
+ removeAt(index, quantity = 1, group, override) {
2908
+ if (!(index >= 0 && index <= this.count)) {
2847
2909
  return;
2848
2910
  }
2911
+ let deleted = 0;
2912
+ for (let i = index; deleted < quantity && i < this.count; i++) {
2913
+ const particle = this.array[i];
2914
+ if (!particle || particle.group !== group) {
2915
+ continue;
2916
+ }
2917
+ particle.destroy(override);
2918
+ this.array.splice(i--, 1);
2919
+ const zIdx = this.zArray.indexOf(particle);
2920
+ this.zArray.splice(zIdx, 1);
2921
+ deleted++;
2922
+ }
2849
2923
  }
2850
- }
2851
- class Retina_Retina {
2852
- constructor(container) {
2853
- this.container = container;
2924
+ remove(particle, group, override) {
2925
+ this.removeAt(this.array.indexOf(particle), undefined, group, override);
2854
2926
  }
2855
- init() {
2927
+ update(delta) {
2856
2928
  const container = this.container;
2857
- const options = container.actualOptions;
2858
- this.pixelRatio = !options.detectRetina || isSsr() ? 1 : window.devicePixelRatio;
2859
- const motionOptions = this.container.actualOptions.motion;
2860
- if (motionOptions && (motionOptions.disable || motionOptions.reduce.value)) {
2861
- if (isSsr() || typeof matchMedia === "undefined" || !matchMedia) {
2862
- this.reduceFactor = 1;
2863
- } else {
2864
- const mediaQuery = matchMedia("(prefers-reduced-motion: reduce)");
2865
- if (mediaQuery) {
2866
- this.handleMotionChange(mediaQuery);
2867
- const handleChange = () => {
2868
- this.handleMotionChange(mediaQuery);
2869
- container.refresh().catch((() => {}));
2870
- };
2871
- if (mediaQuery.addEventListener !== undefined) {
2872
- mediaQuery.addEventListener("change", handleChange);
2873
- } else if (mediaQuery.addListener !== undefined) {
2874
- mediaQuery.addListener(handleChange);
2875
- }
2876
- }
2929
+ const particlesToDelete = [];
2930
+ container.pathGenerator.update();
2931
+ for (const [, plugin] of container.plugins) {
2932
+ if (plugin.update !== undefined) {
2933
+ plugin.update(delta);
2877
2934
  }
2878
- } else {
2879
- this.reduceFactor = 1;
2880
- }
2881
- const ratio = this.pixelRatio;
2882
- if (container.canvas.element) {
2883
- const element = container.canvas.element;
2884
- container.canvas.size.width = element.offsetWidth * ratio;
2885
- container.canvas.size.height = element.offsetHeight * ratio;
2886
2935
  }
2887
- const particles = options.particles;
2888
- this.attractDistance = particles.move.attract.distance * ratio;
2889
- this.linksDistance = particles.links.distance * ratio;
2890
- this.linksWidth = particles.links.width * ratio;
2891
- this.sizeAnimationSpeed = particles.size.animation.speed * ratio;
2892
- this.maxSpeed = particles.move.gravity.maxSpeed * ratio;
2893
- if (particles.orbit.radius !== undefined) {
2894
- this.orbitRadius = particles.orbit.radius * this.container.retina.pixelRatio;
2895
- }
2896
- const modes = options.interactivity.modes;
2897
- this.connectModeDistance = modes.connect.distance * ratio;
2898
- this.connectModeRadius = modes.connect.radius * ratio;
2899
- this.grabModeDistance = modes.grab.distance * ratio;
2900
- this.repulseModeDistance = modes.repulse.distance * ratio;
2901
- this.bounceModeDistance = modes.bounce.distance * ratio;
2902
- this.attractModeDistance = modes.attract.distance * ratio;
2903
- this.slowModeRadius = modes.slow.radius * ratio;
2904
- this.bubbleModeDistance = modes.bubble.distance * ratio;
2905
- if (modes.bubble.size) {
2906
- this.bubbleModeSize = modes.bubble.size * ratio;
2936
+ for (const particle of this.array) {
2937
+ const resizeFactor = container.canvas.resizeFactor;
2938
+ if (resizeFactor) {
2939
+ particle.position.x *= resizeFactor.width;
2940
+ particle.position.y *= resizeFactor.height;
2941
+ }
2942
+ particle.bubble.inRange = false;
2943
+ for (const [, plugin] of this.container.plugins) {
2944
+ if (particle.destroyed) {
2945
+ break;
2946
+ }
2947
+ if (plugin.particleUpdate) {
2948
+ plugin.particleUpdate(particle, delta);
2949
+ }
2950
+ }
2951
+ this.mover.move(particle, delta);
2952
+ if (particle.destroyed) {
2953
+ particlesToDelete.push(particle);
2954
+ continue;
2955
+ }
2956
+ this.quadTree.insert(new Point(particle.getPosition(), particle));
2907
2957
  }
2908
- }
2909
- initParticle(particle) {
2910
- const options = particle.options;
2911
- const ratio = this.pixelRatio;
2912
- const moveDistance = options.move.distance;
2913
- const props = particle.retina;
2914
- props.attractDistance = options.move.attract.distance * ratio;
2915
- props.linksDistance = options.links.distance * ratio;
2916
- props.linksWidth = options.links.width * ratio;
2917
- props.moveDrift = getRangeValue(options.move.drift) * ratio;
2918
- props.moveSpeed = getRangeValue(options.move.speed) * ratio;
2919
- props.sizeAnimationSpeed = options.size.animation.speed * ratio;
2920
- if (particle.spin) {
2921
- props.spinAcceleration = getRangeValue(options.move.spin.acceleration) * ratio;
2958
+ for (const particle of particlesToDelete) {
2959
+ this.remove(particle);
2922
2960
  }
2923
- const maxDistance = props.maxDistance;
2924
- maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
2925
- maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
2926
- props.maxSpeed = options.move.gravity.maxSpeed * ratio;
2927
- }
2928
- handleMotionChange(mediaQuery) {
2929
- const options = this.container.actualOptions;
2930
- if (mediaQuery.matches) {
2931
- const motion = options.motion;
2932
- this.reduceFactor = motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1;
2933
- } else {
2934
- this.reduceFactor = 1;
2961
+ this.interactionManager.externalInteract(delta);
2962
+ for (const particle of container.particles.array) {
2963
+ for (const updater of this.updaters) {
2964
+ updater.update(particle, delta);
2965
+ }
2966
+ if (!particle.destroyed && !particle.spawning) {
2967
+ this.interactionManager.particlesInteract(particle, delta);
2968
+ }
2935
2969
  }
2970
+ delete container.canvas.resizeFactor;
2936
2971
  }
2937
- }
2938
- class Trail_Trail {
2939
- constructor() {
2940
- this.delay = 1;
2941
- this.pauseOnStop = false;
2942
- this.quantity = 1;
2943
- }
2944
- load(data) {
2945
- if (data === undefined) {
2946
- return;
2947
- }
2948
- if (data.delay !== undefined) {
2949
- this.delay = data.delay;
2950
- }
2951
- if (data.quantity !== undefined) {
2952
- this.quantity = data.quantity;
2972
+ draw(delta) {
2973
+ const container = this.container;
2974
+ container.canvas.clear();
2975
+ const canvasSize = this.container.canvas.size;
2976
+ this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
2977
+ this.update(delta);
2978
+ if (this.needsSort) {
2979
+ this.zArray.sort(((a, b) => b.position.z - a.position.z || a.id - b.id));
2980
+ this.lastZIndex = this.zArray[this.zArray.length - 1].position.z;
2981
+ this.needsSort = false;
2953
2982
  }
2954
- if (data.particles !== undefined) {
2955
- this.particles = deepExtend({}, data.particles);
2983
+ for (const [, plugin] of container.plugins) {
2984
+ container.canvas.drawPlugin(plugin, delta);
2956
2985
  }
2957
- if (data.pauseOnStop !== undefined) {
2958
- this.pauseOnStop = data.pauseOnStop;
2986
+ for (const p of this.zArray) {
2987
+ p.draw(delta);
2959
2988
  }
2960
2989
  }
2961
- }
2962
- class Modes_Modes {
2963
- constructor() {
2964
- this.attract = new Attract;
2965
- this.bounce = new Bounce;
2966
- this.bubble = new Bubble;
2967
- this.connect = new Connect;
2968
- this.grab = new Grab;
2969
- this.light = new Light;
2970
- this.push = new Push;
2971
- this.remove = new Remove;
2972
- this.repulse = new Repulse;
2973
- this.slow = new Slow;
2974
- this.trail = new Trail;
2990
+ clear() {
2991
+ this.array = [];
2992
+ this.zArray = [];
2975
2993
  }
2976
- load(data) {
2977
- if (data === undefined) {
2978
- return;
2994
+ push(nb, mouse, overrideOptions, group) {
2995
+ this.pushing = true;
2996
+ for (let i = 0; i < nb; i++) {
2997
+ this.addParticle(mouse === null || mouse === void 0 ? void 0 : mouse.position, overrideOptions, group);
2979
2998
  }
2980
- this.attract.load(data.attract);
2981
- this.bubble.load(data.bubble);
2982
- this.connect.load(data.connect);
2983
- this.grab.load(data.grab);
2984
- this.light.load(data.light);
2985
- this.push.load(data.push);
2986
- this.remove.load(data.remove);
2987
- this.repulse.load(data.repulse);
2988
- this.slow.load(data.slow);
2989
- this.trail.load(data.trail);
2990
- }
2991
- }
2992
- class Interactivity_Interactivity {
2993
- constructor() {
2994
- this.detectsOn = "window";
2995
- this.events = new Events;
2996
- this.modes = new Modes;
2997
- }
2998
- get detect_on() {
2999
- return this.detectsOn;
3000
- }
3001
- set detect_on(value) {
3002
- this.detectsOn = value;
2999
+ this.pushing = false;
3003
3000
  }
3004
- load(data) {
3005
- var _a, _b, _c;
3006
- if (data === undefined) {
3007
- return;
3008
- }
3009
- const detectsOn = (_a = data.detectsOn) !== null && _a !== void 0 ? _a : data.detect_on;
3010
- if (detectsOn !== undefined) {
3011
- this.detectsOn = detectsOn;
3001
+ addParticle(position, overrideOptions, group) {
3002
+ const container = this.container, options = container.actualOptions, limit = options.particles.number.limit * container.density;
3003
+ if (limit > 0) {
3004
+ const countToRemove = this.count + 1 - limit;
3005
+ if (countToRemove > 0) {
3006
+ this.removeQuantity(countToRemove);
3007
+ }
3012
3008
  }
3013
- this.events.load(data.events);
3014
- this.modes.load(data.modes);
3015
- if (((_c = (_b = data.modes) === null || _b === void 0 ? void 0 : _b.slow) === null || _c === void 0 ? void 0 : _c.active) === true) {
3016
- if (this.events.onHover.mode instanceof Array) {
3017
- if (this.events.onHover.mode.indexOf("slow") < 0) {
3018
- this.events.onHover.mode.push("slow");
3019
- }
3020
- } else if (this.events.onHover.mode !== "slow") {
3021
- this.events.onHover.mode = [ this.events.onHover.mode, "slow" ];
3009
+ return this.pushParticle(position, overrideOptions, group);
3010
+ }
3011
+ addSplitParticle(parent) {
3012
+ const splitOptions = parent.options.destroy.split, options = new ParticlesOptions;
3013
+ options.load(parent.options);
3014
+ const factor = getRangeValue(splitOptions.factor.value);
3015
+ options.color.load({
3016
+ value: {
3017
+ hsl: parent.getFillColor()
3022
3018
  }
3019
+ });
3020
+ if (typeof options.size.value === "number") {
3021
+ options.size.value /= factor;
3022
+ } else {
3023
+ options.size.value.min /= factor;
3024
+ options.size.value.max /= factor;
3023
3025
  }
3026
+ options.load(splitOptions.particles);
3027
+ const offset = splitOptions.sizeOffset ? setRangeValue(-parent.size.value, parent.size.value) : 0;
3028
+ const position = {
3029
+ x: parent.position.x + randomInRange(offset),
3030
+ y: parent.position.y + randomInRange(offset)
3031
+ };
3032
+ return this.pushParticle(position, options, parent.group, (particle => {
3033
+ if (particle.size.value < .5) {
3034
+ return false;
3035
+ }
3036
+ particle.velocity.length = randomInRange(setRangeValue(parent.velocity.length, particle.velocity.length));
3037
+ particle.splitCount = parent.splitCount + 1;
3038
+ particle.unbreakable = true;
3039
+ setTimeout((() => {
3040
+ particle.unbreakable = false;
3041
+ }), 500);
3042
+ return true;
3043
+ }));
3024
3044
  }
3025
- }
3026
- class Theme_Theme {
3027
- constructor() {
3028
- this.name = "";
3029
- this.default = new ThemeDefault;
3045
+ removeQuantity(quantity, group) {
3046
+ this.removeAt(0, quantity, group);
3030
3047
  }
3031
- load(data) {
3032
- if (data === undefined) {
3033
- return;
3048
+ getLinkFrequency(p1, p2) {
3049
+ const range = setRangeValue(p1.id, p2.id), key = `${getRangeMin(range)}_${getRangeMax(range)}`;
3050
+ let res = this.freqs.links.get(key);
3051
+ if (res === undefined) {
3052
+ res = Math.random();
3053
+ this.freqs.links.set(key, res);
3034
3054
  }
3035
- if (data.name !== undefined) {
3036
- this.name = data.name;
3055
+ return res;
3056
+ }
3057
+ getTriangleFrequency(p1, p2, p3) {
3058
+ let [id1, id2, id3] = [ p1.id, p2.id, p3.id ];
3059
+ if (id1 > id2) {
3060
+ [id2, id1] = [ id1, id2 ];
3037
3061
  }
3038
- this.default.load(data.default);
3039
- if (data.options !== undefined) {
3040
- this.options = deepExtend({}, data.options);
3062
+ if (id2 > id3) {
3063
+ [id3, id2] = [ id2, id3 ];
3041
3064
  }
3042
- }
3043
- }
3044
- class ManualParticle_ManualParticle {
3045
- load(data) {
3046
- var _a, _b;
3047
- if (!data) {
3048
- return;
3065
+ if (id1 > id3) {
3066
+ [id3, id1] = [ id1, id3 ];
3049
3067
  }
3050
- if (data.position !== undefined) {
3051
- this.position = {
3052
- x: (_a = data.position.x) !== null && _a !== void 0 ? _a : 50,
3053
- y: (_b = data.position.y) !== null && _b !== void 0 ? _b : 50
3054
- };
3068
+ const key = `${id1}_${id2}_${id3}`;
3069
+ let res = this.freqs.triangles.get(key);
3070
+ if (res === undefined) {
3071
+ res = Math.random();
3072
+ this.freqs.triangles.set(key, res);
3055
3073
  }
3056
- if (data.options !== undefined) {
3057
- this.options = deepExtend({}, data.options);
3074
+ return res;
3075
+ }
3076
+ addManualParticles() {
3077
+ const container = this.container, options = container.actualOptions;
3078
+ for (const particle of options.manualParticles) {
3079
+ const pos = particle.position ? {
3080
+ x: particle.position.x * container.canvas.size.width / 100,
3081
+ y: particle.position.y * container.canvas.size.height / 100
3082
+ } : undefined;
3083
+ this.addParticle(pos, particle.options);
3058
3084
  }
3059
3085
  }
3060
- }
3061
- class Responsive_Responsive {
3062
- constructor() {
3063
- this.maxWidth = Infinity;
3064
- this.options = {};
3065
- this.mode = "canvas";
3086
+ setDensity() {
3087
+ const options = this.container.actualOptions;
3088
+ for (const group in options.particles.groups) {
3089
+ this.applyDensity(options.particles.groups[group], 0, group);
3090
+ }
3091
+ this.applyDensity(options.particles, options.manualParticles.length);
3066
3092
  }
3067
- load(data) {
3068
- if (!data) {
3093
+ applyDensity(options, manualCount, group) {
3094
+ var _a;
3095
+ if (!((_a = options.number.density) === null || _a === void 0 ? void 0 : _a.enable)) {
3069
3096
  return;
3070
3097
  }
3071
- if (data.maxWidth !== undefined) {
3072
- this.maxWidth = data.maxWidth;
3098
+ const numberOptions = options.number;
3099
+ const densityFactor = this.initDensityFactor(numberOptions.density);
3100
+ const optParticlesNumber = numberOptions.value;
3101
+ const optParticlesLimit = numberOptions.limit > 0 ? numberOptions.limit : optParticlesNumber;
3102
+ const particlesNumber = Math.min(optParticlesNumber, optParticlesLimit) * densityFactor + manualCount;
3103
+ const particlesCount = Math.min(this.count, this.array.filter((t => t.group === group)).length);
3104
+ this.limit = numberOptions.limit * densityFactor;
3105
+ if (particlesCount < particlesNumber) {
3106
+ this.push(Math.abs(particlesNumber - particlesCount), undefined, options, group);
3107
+ } else if (particlesCount > particlesNumber) {
3108
+ this.removeQuantity(particlesCount - particlesNumber, group);
3073
3109
  }
3074
- if (data.mode !== undefined) {
3075
- if (data.mode === "screen") {
3076
- this.mode = "screen";
3077
- } else {
3078
- this.mode = "canvas";
3079
- }
3110
+ }
3111
+ initDensityFactor(densityOptions) {
3112
+ const container = this.container;
3113
+ if (!container.canvas.element || !densityOptions.enable) {
3114
+ return 1;
3080
3115
  }
3081
- if (data.options !== undefined) {
3082
- this.options = deepExtend({}, data.options);
3116
+ const canvas = container.canvas.element, pxRatio = container.retina.pixelRatio;
3117
+ return canvas.width * canvas.height / (densityOptions.factor * pxRatio ** 2 * densityOptions.area);
3118
+ }
3119
+ pushParticle(position, overrideOptions, group, initializer) {
3120
+ try {
3121
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
3122
+ let canAdd = true;
3123
+ if (initializer) {
3124
+ canAdd = initializer(particle);
3125
+ }
3126
+ if (!canAdd) {
3127
+ return;
3128
+ }
3129
+ this.array.push(particle);
3130
+ this.zArray.push(particle);
3131
+ this.nextId++;
3132
+ return particle;
3133
+ } catch (e) {
3134
+ console.warn(`error adding particle: ${e}`);
3135
+ return;
3083
3136
  }
3084
3137
  }
3085
3138
  }
3086
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3087
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3088
- 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");
3089
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3090
- };
3091
- var _Options_instances, _Options_findDefaultTheme;
3092
- class Options_Options {
3093
- constructor() {
3094
- _Options_instances.add(this);
3095
- this.autoPlay = true;
3096
- this.background = new Background;
3097
- this.backgroundMask = new BackgroundMask;
3098
- this.fullScreen = new FullScreen;
3099
- this.detectRetina = true;
3100
- this.duration = 0;
3101
- this.fpsLimit = 60;
3102
- this.interactivity = new Interactivity;
3103
- this.manualParticles = [];
3104
- this.motion = new Motion;
3105
- this.particles = new ParticlesOptions;
3106
- this.pauseOnBlur = true;
3107
- this.pauseOnOutsideViewport = true;
3108
- this.responsive = [];
3109
- this.style = {};
3110
- this.themes = [];
3111
- this.zLayers = 100;
3112
- }
3113
- get fps_limit() {
3114
- return this.fpsLimit;
3115
- }
3116
- set fps_limit(value) {
3117
- this.fpsLimit = value;
3118
- }
3119
- get retina_detect() {
3120
- return this.detectRetina;
3121
- }
3122
- set retina_detect(value) {
3123
- this.detectRetina = value;
3124
- }
3125
- get backgroundMode() {
3126
- return this.fullScreen;
3127
- }
3128
- set backgroundMode(value) {
3129
- this.fullScreen.load(value);
3139
+ _Particles_engine = new WeakMap;
3140
+ class Retina_Retina {
3141
+ constructor(container) {
3142
+ this.container = container;
3130
3143
  }
3131
- load(data) {
3132
- var _a, _b, _c, _d, _e;
3133
- if (data === undefined) {
3134
- return;
3135
- }
3136
- if (data.preset !== undefined) {
3137
- if (data.preset instanceof Array) {
3138
- for (const preset of data.preset) {
3139
- this.importPreset(preset);
3140
- }
3144
+ init() {
3145
+ const container = this.container;
3146
+ const options = container.actualOptions;
3147
+ this.pixelRatio = !options.detectRetina || isSsr() ? 1 : window.devicePixelRatio;
3148
+ const motionOptions = this.container.actualOptions.motion;
3149
+ if (motionOptions && (motionOptions.disable || motionOptions.reduce.value)) {
3150
+ if (isSsr() || typeof matchMedia === "undefined" || !matchMedia) {
3151
+ this.reduceFactor = 1;
3141
3152
  } else {
3142
- this.importPreset(data.preset);
3153
+ const mediaQuery = matchMedia("(prefers-reduced-motion: reduce)");
3154
+ if (mediaQuery) {
3155
+ this.handleMotionChange(mediaQuery);
3156
+ const handleChange = () => {
3157
+ this.handleMotionChange(mediaQuery);
3158
+ container.refresh().catch((() => {}));
3159
+ };
3160
+ if (mediaQuery.addEventListener !== undefined) {
3161
+ mediaQuery.addEventListener("change", handleChange);
3162
+ } else if (mediaQuery.addListener !== undefined) {
3163
+ mediaQuery.addListener(handleChange);
3164
+ }
3165
+ }
3143
3166
  }
3144
- }
3145
- if (data.autoPlay !== undefined) {
3146
- this.autoPlay = data.autoPlay;
3147
- }
3148
- const detectRetina = (_a = data.detectRetina) !== null && _a !== void 0 ? _a : data.retina_detect;
3149
- if (detectRetina !== undefined) {
3150
- this.detectRetina = detectRetina;
3151
- }
3152
- if (data.duration !== undefined) {
3153
- this.duration = data.duration;
3154
- }
3155
- const fpsLimit = (_b = data.fpsLimit) !== null && _b !== void 0 ? _b : data.fps_limit;
3156
- if (fpsLimit !== undefined) {
3157
- this.fpsLimit = fpsLimit;
3158
- }
3159
- if (data.pauseOnBlur !== undefined) {
3160
- this.pauseOnBlur = data.pauseOnBlur;
3161
- }
3162
- if (data.pauseOnOutsideViewport !== undefined) {
3163
- this.pauseOnOutsideViewport = data.pauseOnOutsideViewport;
3164
- }
3165
- if (data.zLayers !== undefined) {
3166
- this.zLayers = data.zLayers;
3167
- }
3168
- this.background.load(data.background);
3169
- const fullScreen = (_c = data.fullScreen) !== null && _c !== void 0 ? _c : data.backgroundMode;
3170
- if (typeof fullScreen === "boolean") {
3171
- this.fullScreen.enable = fullScreen;
3172
3167
  } else {
3173
- this.fullScreen.load(fullScreen);
3168
+ this.reduceFactor = 1;
3169
+ }
3170
+ const ratio = this.pixelRatio;
3171
+ if (container.canvas.element) {
3172
+ const element = container.canvas.element;
3173
+ container.canvas.size.width = element.offsetWidth * ratio;
3174
+ container.canvas.size.height = element.offsetHeight * ratio;
3174
3175
  }
3175
- this.backgroundMask.load(data.backgroundMask);
3176
- this.interactivity.load(data.interactivity);
3177
- if (data.manualParticles !== undefined) {
3178
- this.manualParticles = data.manualParticles.map((t => {
3179
- const tmp = new ManualParticle;
3180
- tmp.load(t);
3181
- return tmp;
3182
- }));
3176
+ const particles = options.particles;
3177
+ this.attractDistance = particles.move.attract.distance * ratio;
3178
+ this.linksDistance = particles.links.distance * ratio;
3179
+ this.linksWidth = particles.links.width * ratio;
3180
+ this.sizeAnimationSpeed = particles.size.animation.speed * ratio;
3181
+ this.maxSpeed = particles.move.gravity.maxSpeed * ratio;
3182
+ if (particles.orbit.radius !== undefined) {
3183
+ this.orbitRadius = particles.orbit.radius * this.container.retina.pixelRatio;
3183
3184
  }
3184
- this.motion.load(data.motion);
3185
- this.particles.load(data.particles);
3186
- this.style = deepExtend(this.style, data.style);
3187
- Plugins.loadOptions(this, data);
3188
- if (data.responsive !== undefined) {
3189
- for (const responsive of data.responsive) {
3190
- const optResponsive = new Responsive;
3191
- optResponsive.load(responsive);
3192
- this.responsive.push(optResponsive);
3193
- }
3185
+ const modes = options.interactivity.modes;
3186
+ this.connectModeDistance = modes.connect.distance * ratio;
3187
+ this.connectModeRadius = modes.connect.radius * ratio;
3188
+ this.grabModeDistance = modes.grab.distance * ratio;
3189
+ this.repulseModeDistance = modes.repulse.distance * ratio;
3190
+ this.bounceModeDistance = modes.bounce.distance * ratio;
3191
+ this.attractModeDistance = modes.attract.distance * ratio;
3192
+ this.slowModeRadius = modes.slow.radius * ratio;
3193
+ this.bubbleModeDistance = modes.bubble.distance * ratio;
3194
+ if (modes.bubble.size) {
3195
+ this.bubbleModeSize = modes.bubble.size * ratio;
3194
3196
  }
3195
- this.responsive.sort(((a, b) => a.maxWidth - b.maxWidth));
3196
- if (data.themes !== undefined) {
3197
- for (const theme of data.themes) {
3198
- const optTheme = new Theme;
3199
- optTheme.load(theme);
3200
- this.themes.push(optTheme);
3201
- }
3197
+ }
3198
+ initParticle(particle) {
3199
+ const options = particle.options;
3200
+ const ratio = this.pixelRatio;
3201
+ const moveDistance = options.move.distance;
3202
+ const props = particle.retina;
3203
+ props.attractDistance = options.move.attract.distance * ratio;
3204
+ props.linksDistance = options.links.distance * ratio;
3205
+ props.linksWidth = options.links.width * ratio;
3206
+ props.moveDrift = getRangeValue(options.move.drift) * ratio;
3207
+ props.moveSpeed = getRangeValue(options.move.speed) * ratio;
3208
+ props.sizeAnimationSpeed = options.size.animation.speed * ratio;
3209
+ if (particle.spin) {
3210
+ props.spinAcceleration = getRangeValue(options.move.spin.acceleration) * ratio;
3202
3211
  }
3203
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3204
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3212
+ const maxDistance = props.maxDistance;
3213
+ maxDistance.horizontal = moveDistance.horizontal !== undefined ? moveDistance.horizontal * ratio : undefined;
3214
+ maxDistance.vertical = moveDistance.vertical !== undefined ? moveDistance.vertical * ratio : undefined;
3215
+ props.maxSpeed = options.move.gravity.maxSpeed * ratio;
3205
3216
  }
3206
- setTheme(name) {
3207
- if (name) {
3208
- const chosenTheme = this.themes.find((theme => theme.name === name));
3209
- if (chosenTheme) {
3210
- this.load(chosenTheme.options);
3211
- }
3217
+ handleMotionChange(mediaQuery) {
3218
+ const options = this.container.actualOptions;
3219
+ if (mediaQuery.matches) {
3220
+ const motion = options.motion;
3221
+ this.reduceFactor = motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1;
3212
3222
  } else {
3213
- 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");
3214
- if (defaultTheme) {
3215
- this.load(defaultTheme.options);
3216
- }
3223
+ this.reduceFactor = 1;
3217
3224
  }
3218
3225
  }
3219
- setResponsive(width, pxRatio, defaultOptions) {
3220
- this.load(defaultOptions);
3221
- const responsiveOptions = this.responsive.find((t => t.mode === "screen" && screen ? t.maxWidth * pxRatio > screen.availWidth : t.maxWidth * pxRatio > width));
3222
- this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
3223
- return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
3224
- }
3225
- importPreset(preset) {
3226
- this.load(Plugins.getPreset(preset));
3227
- }
3228
3226
  }
3229
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3230
- var _a;
3231
- 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"));
3227
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3228
+ if (kind === "m") throw new TypeError("Private method is not writable");
3229
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3230
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3231
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3232
+ value;
3233
+ };
3234
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3235
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3236
+ 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");
3237
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3232
3238
  };
3239
+ var _Container_engine;
3233
3240
  class Container_Container {
3234
- constructor(id, sourceOptions, ...presets) {
3241
+ constructor(engine, id, sourceOptions, ...presets) {
3235
3242
  this.id = id;
3236
- this.fpsLimit = 60;
3243
+ _Container_engine.set(this, void 0);
3244
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
3245
+ this.fpsLimit = 120;
3237
3246
  this.duration = 0;
3238
3247
  this.lifeTime = 0;
3239
3248
  this.firstStart = true;
@@ -3247,7 +3256,7 @@
3247
3256
  this._initialSourceOptions = sourceOptions;
3248
3257
  this.retina = new Retina(this);
3249
3258
  this.canvas = new Canvas(this);
3250
- this.particles = new Particles(this);
3259
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
3251
3260
  this.drawer = new FrameManager(this);
3252
3261
  this.presets = presets;
3253
3262
  this.pathGenerator = {
@@ -3276,8 +3285,8 @@
3276
3285
  this.plugins = new Map;
3277
3286
  this.drawers = new Map;
3278
3287
  this.density = 1;
3279
- this._options = new Options;
3280
- this.actualOptions = new Options;
3288
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3289
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3281
3290
  this.eventListeners = new EventListeners(this);
3282
3291
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
3283
3292
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -3392,7 +3401,7 @@
3392
3401
  return this.start();
3393
3402
  }
3394
3403
  reset() {
3395
- this._options = new Options;
3404
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3396
3405
  return this.refresh();
3397
3406
  }
3398
3407
  stop() {
@@ -3406,7 +3415,7 @@
3406
3415
  this.particles.clear();
3407
3416
  this.canvas.clear();
3408
3417
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
3409
- this.intersectionObserver.observe(this.interactivity.element);
3418
+ this.intersectionObserver.unobserve(this.interactivity.element);
3410
3419
  }
3411
3420
  for (const [, plugin] of this.plugins) {
3412
3421
  if (plugin.stop) {
@@ -3533,20 +3542,20 @@
3533
3542
  return false;
3534
3543
  }
3535
3544
  async init() {
3536
- this._options = new Options;
3545
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3537
3546
  for (const preset of this.presets) {
3538
- this._options.load(Plugins.getPreset(preset));
3547
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
3539
3548
  }
3540
- const shapes = Plugins.getSupportedShapes();
3549
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
3541
3550
  for (const type of shapes) {
3542
- const drawer = Plugins.getShapeDrawer(type);
3551
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
3543
3552
  if (drawer) {
3544
3553
  this.drawers.set(type, drawer);
3545
3554
  }
3546
3555
  }
3547
3556
  this._options.load(this._initialSourceOptions);
3548
3557
  this._options.load(this._sourceOptions);
3549
- this.actualOptions = new Options;
3558
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3550
3559
  this.actualOptions.load(this._options);
3551
3560
  this.retina.init();
3552
3561
  this.canvas.init();
@@ -3556,8 +3565,8 @@
3556
3565
  this.zLayers = this.actualOptions.zLayers;
3557
3566
  this.duration = getRangeValue(this.actualOptions.duration);
3558
3567
  this.lifeTime = 0;
3559
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
3560
- const availablePlugins = Plugins.getAvailablePlugins(this);
3568
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
3569
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
3561
3570
  for (const [id, plugin] of availablePlugins) {
3562
3571
  this.plugins.set(id, plugin);
3563
3572
  }
@@ -3575,7 +3584,7 @@
3575
3584
  }
3576
3585
  const pathOptions = this.actualOptions.particles.move.path;
3577
3586
  if (pathOptions.generator) {
3578
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
3587
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
3579
3588
  if (customGenerator) {
3580
3589
  if (customGenerator.init) {
3581
3590
  this.pathGenerator.init = customGenerator.init;
@@ -3612,24 +3621,41 @@
3612
3621
  }
3613
3622
  }
3614
3623
  }
3615
- const tsParticlesDom = null && [];
3624
+ _Container_engine = new WeakMap;
3625
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3626
+ if (kind === "m") throw new TypeError("Private method is not writable");
3627
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3628
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3629
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3630
+ value;
3631
+ };
3632
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3633
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3634
+ 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");
3635
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3636
+ };
3637
+ var _Loader_engine;
3616
3638
  function fetchError(statusCode) {
3617
3639
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
3618
3640
  console.error("Error tsParticles - File config not found");
3619
3641
  }
3620
3642
  class Loader {
3621
- static dom() {
3622
- return tsParticlesDom;
3643
+ constructor(engine) {
3644
+ _Loader_engine.set(this, void 0);
3645
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
3623
3646
  }
3624
- static domItem(index) {
3625
- const dom = Loader.dom();
3647
+ dom() {
3648
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
3649
+ }
3650
+ domItem(index) {
3651
+ const dom = this.dom();
3626
3652
  const item = dom[index];
3627
3653
  if (item && !item.destroyed) {
3628
3654
  return item;
3629
3655
  }
3630
3656
  dom.splice(index, 1);
3631
3657
  }
3632
- static async loadOptions(params) {
3658
+ async loadOptions(params) {
3633
3659
  var _a, _b, _c;
3634
3660
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
3635
3661
  const {options: options, index: index} = params;
@@ -3640,10 +3666,10 @@
3640
3666
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
3641
3667
  }
3642
3668
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
3643
- const dom = Loader.dom();
3669
+ const dom = this.dom();
3644
3670
  const oldIndex = dom.findIndex((v => v.id === tagId));
3645
3671
  if (oldIndex >= 0) {
3646
- const old = Loader.domItem(oldIndex);
3672
+ const old = this.domItem(oldIndex);
3647
3673
  if (old && !old.destroyed) {
3648
3674
  old.destroy();
3649
3675
  dom.splice(oldIndex, 1);
@@ -3666,7 +3692,7 @@
3666
3692
  domContainer.appendChild(canvasEl);
3667
3693
  }
3668
3694
  }
3669
- const newItem = new Container(tagId, currentOptions);
3695
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
3670
3696
  if (oldIndex >= 0) {
3671
3697
  dom.splice(oldIndex, 0, newItem);
3672
3698
  } else {
@@ -3676,7 +3702,7 @@
3676
3702
  await newItem.start();
3677
3703
  return newItem;
3678
3704
  }
3679
- static async loadRemoteOptions(params) {
3705
+ async loadRemoteOptions(params) {
3680
3706
  const {url: jsonUrl, index: index} = params;
3681
3707
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
3682
3708
  if (!url) {
@@ -3688,14 +3714,14 @@
3688
3714
  return;
3689
3715
  }
3690
3716
  const data = await response.json();
3691
- return await Loader.loadOptions({
3717
+ return this.loadOptions({
3692
3718
  tagId: params.tagId,
3693
3719
  element: params.element,
3694
3720
  index: index,
3695
3721
  options: data
3696
3722
  });
3697
3723
  }
3698
- static load(tagId, options, index) {
3724
+ load(tagId, options, index) {
3699
3725
  const params = {
3700
3726
  index: index
3701
3727
  };
@@ -3711,7 +3737,7 @@
3711
3737
  }
3712
3738
  return this.loadOptions(params);
3713
3739
  }
3714
- static async set(id, domContainer, options, index) {
3740
+ async set(id, domContainer, options, index) {
3715
3741
  const params = {
3716
3742
  index: index
3717
3743
  };
@@ -3732,7 +3758,7 @@
3732
3758
  }
3733
3759
  return this.loadOptions(params);
3734
3760
  }
3735
- static async loadJSON(tagId, jsonUrl, index) {
3761
+ async loadJSON(tagId, jsonUrl, index) {
3736
3762
  let url, id;
3737
3763
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
3738
3764
  url = tagId;
@@ -3740,13 +3766,13 @@
3740
3766
  id = tagId;
3741
3767
  url = jsonUrl;
3742
3768
  }
3743
- return await Loader.loadRemoteOptions({
3769
+ return this.loadRemoteOptions({
3744
3770
  tagId: id,
3745
3771
  url: url,
3746
3772
  index: index
3747
3773
  });
3748
3774
  }
3749
- static async setJSON(id, domContainer, jsonUrl, index) {
3775
+ async setJSON(id, domContainer, jsonUrl, index) {
3750
3776
  let url, newId, newIndex, element;
3751
3777
  if (id instanceof HTMLElement) {
3752
3778
  element = id;
@@ -3758,15 +3784,15 @@
3758
3784
  url = jsonUrl;
3759
3785
  newIndex = index;
3760
3786
  }
3761
- return await Loader.loadRemoteOptions({
3787
+ return this.loadRemoteOptions({
3762
3788
  tagId: newId,
3763
3789
  url: url,
3764
3790
  index: newIndex,
3765
3791
  element: element
3766
3792
  });
3767
3793
  }
3768
- static setOnClickHandler(callback) {
3769
- const dom = Loader.dom();
3794
+ setOnClickHandler(callback) {
3795
+ const dom = this.dom();
3770
3796
  if (dom.length === 0) {
3771
3797
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
3772
3798
  }
@@ -3775,6 +3801,7 @@
3775
3801
  }
3776
3802
  }
3777
3803
  }
3804
+ _Loader_engine = new WeakMap;
3778
3805
  function NumberUtils_clamp(num, min, max) {
3779
3806
  return Math.min(Math.max(num, min), max);
3780
3807
  }
@@ -4809,18 +4836,160 @@
4809
4836
  if (width === 0) {
4810
4837
  return;
4811
4838
  }
4812
- context.lineWidth = width;
4813
- const rotationRadian = rotation * Math.PI / 180;
4814
- context.beginPath();
4815
- context.ellipse(pos.x, pos.y, radius / 2, radius * 2, rotationRadian, start, end);
4816
- context.stroke();
4817
- }
4818
- function CanvasUtils_alterHsl(color, type, value) {
4819
- return {
4820
- h: color.h,
4821
- s: color.s,
4822
- l: color.l + (type === "darken" ? -1 : 1) * value
4823
- };
4839
+ context.lineWidth = width;
4840
+ const rotationRadian = rotation * Math.PI / 180;
4841
+ context.beginPath();
4842
+ context.ellipse(pos.x, pos.y, radius / 2, radius * 2, rotationRadian, start, end);
4843
+ context.stroke();
4844
+ }
4845
+ function CanvasUtils_alterHsl(color, type, value) {
4846
+ return {
4847
+ h: color.h,
4848
+ s: color.s,
4849
+ l: color.l + (type === "darken" ? -1 : 1) * value
4850
+ };
4851
+ }
4852
+ class ColorAnimation {
4853
+ constructor() {
4854
+ this.count = 0;
4855
+ this.enable = false;
4856
+ this.offset = 0;
4857
+ this.speed = 1;
4858
+ this.sync = true;
4859
+ }
4860
+ load(data) {
4861
+ if (data === undefined) {
4862
+ return;
4863
+ }
4864
+ if (data.count !== undefined) {
4865
+ this.count = data.count;
4866
+ }
4867
+ if (data.enable !== undefined) {
4868
+ this.enable = data.enable;
4869
+ }
4870
+ if (data.offset !== undefined) {
4871
+ this.offset = NumberUtils_setRangeValue(data.offset);
4872
+ }
4873
+ if (data.speed !== undefined) {
4874
+ this.speed = data.speed;
4875
+ }
4876
+ if (data.sync !== undefined) {
4877
+ this.sync = data.sync;
4878
+ }
4879
+ }
4880
+ }
4881
+ class HslAnimation {
4882
+ constructor() {
4883
+ this.h = new ColorAnimation;
4884
+ this.s = new ColorAnimation;
4885
+ this.l = new ColorAnimation;
4886
+ }
4887
+ load(data) {
4888
+ if (!data) {
4889
+ return;
4890
+ }
4891
+ this.h.load(data.h);
4892
+ this.s.load(data.s);
4893
+ this.l.load(data.l);
4894
+ }
4895
+ }
4896
+ class OptionsColor_OptionsColor {
4897
+ constructor() {
4898
+ this.value = "#fff";
4899
+ }
4900
+ static create(source, data) {
4901
+ const color = new OptionsColor_OptionsColor;
4902
+ color.load(source);
4903
+ if (data !== undefined) {
4904
+ if (typeof data === "string" || data instanceof Array) {
4905
+ color.load({
4906
+ value: data
4907
+ });
4908
+ } else {
4909
+ color.load(data);
4910
+ }
4911
+ }
4912
+ return color;
4913
+ }
4914
+ load(data) {
4915
+ if ((data === null || data === void 0 ? void 0 : data.value) === undefined) {
4916
+ return;
4917
+ }
4918
+ this.value = data.value;
4919
+ }
4920
+ }
4921
+ class AnimatableColor_AnimatableColor extends OptionsColor_OptionsColor {
4922
+ constructor() {
4923
+ super();
4924
+ this.animation = new HslAnimation;
4925
+ }
4926
+ static create(source, data) {
4927
+ const color = new AnimatableColor_AnimatableColor;
4928
+ color.load(source);
4929
+ if (data !== undefined) {
4930
+ if (typeof data === "string" || data instanceof Array) {
4931
+ color.load({
4932
+ value: data
4933
+ });
4934
+ } else {
4935
+ color.load(data);
4936
+ }
4937
+ }
4938
+ return color;
4939
+ }
4940
+ load(data) {
4941
+ super.load(data);
4942
+ if (!data) {
4943
+ return;
4944
+ }
4945
+ const colorAnimation = data.animation;
4946
+ if (colorAnimation !== undefined) {
4947
+ if (colorAnimation.enable !== undefined) {
4948
+ this.animation.h.load(colorAnimation);
4949
+ } else {
4950
+ this.animation.load(data.animation);
4951
+ }
4952
+ }
4953
+ }
4954
+ }
4955
+ class EmitterLife {
4956
+ constructor() {
4957
+ this.wait = false;
4958
+ }
4959
+ load(data) {
4960
+ if (data === undefined) {
4961
+ return;
4962
+ }
4963
+ if (data.count !== undefined) {
4964
+ this.count = data.count;
4965
+ }
4966
+ if (data.delay !== undefined) {
4967
+ this.delay = data.delay;
4968
+ }
4969
+ if (data.duration !== undefined) {
4970
+ this.duration = data.duration;
4971
+ }
4972
+ if (data.wait !== undefined) {
4973
+ this.wait = data.wait;
4974
+ }
4975
+ }
4976
+ }
4977
+ class EmitterRate {
4978
+ constructor() {
4979
+ this.quantity = 1;
4980
+ this.delay = .1;
4981
+ }
4982
+ load(data) {
4983
+ if (data === undefined) {
4984
+ return;
4985
+ }
4986
+ if (data.quantity !== undefined) {
4987
+ this.quantity = NumberUtils_setRangeValue(data.quantity);
4988
+ }
4989
+ if (data.delay !== undefined) {
4990
+ this.delay = NumberUtils_setRangeValue(data.delay);
4991
+ }
4992
+ }
4824
4993
  }
4825
4994
  class EmitterSize {
4826
4995
  constructor() {
@@ -4843,21 +5012,62 @@
4843
5012
  }
4844
5013
  }
4845
5014
  }
4846
- const shapes = new Map;
4847
- class ShapeManager {
4848
- static addShape(name, drawer) {
4849
- if (!ShapeManager.getShape(name)) {
4850
- shapes.set(name, drawer);
4851
- }
4852
- }
4853
- static getShape(name) {
4854
- return shapes.get(name);
5015
+ class Emitter {
5016
+ constructor() {
5017
+ this.autoPlay = true;
5018
+ this.fill = true;
5019
+ this.life = new EmitterLife;
5020
+ this.rate = new EmitterRate;
5021
+ this.shape = "square";
5022
+ this.startCount = 0;
4855
5023
  }
4856
- static getSupportedShapes() {
4857
- return shapes.keys();
5024
+ load(data) {
5025
+ if (data === undefined) {
5026
+ return;
5027
+ }
5028
+ if (data.autoPlay !== undefined) {
5029
+ this.autoPlay = data.autoPlay;
5030
+ }
5031
+ if (data.size !== undefined) {
5032
+ if (this.size === undefined) {
5033
+ this.size = new EmitterSize;
5034
+ }
5035
+ this.size.load(data.size);
5036
+ }
5037
+ if (data.direction !== undefined) {
5038
+ this.direction = data.direction;
5039
+ }
5040
+ this.domId = data.domId;
5041
+ if (data.fill !== undefined) {
5042
+ this.fill = data.fill;
5043
+ }
5044
+ this.life.load(data.life);
5045
+ this.name = data.name;
5046
+ if (data.particles !== undefined) {
5047
+ this.particles = Utils_deepExtend({}, data.particles);
5048
+ }
5049
+ this.rate.load(data.rate);
5050
+ if (data.shape !== undefined) {
5051
+ this.shape = data.shape;
5052
+ }
5053
+ if (data.position !== undefined) {
5054
+ this.position = {
5055
+ x: data.position.x,
5056
+ y: data.position.y
5057
+ };
5058
+ }
5059
+ if (data.spawnColor !== undefined) {
5060
+ if (this.spawnColor === undefined) {
5061
+ this.spawnColor = new AnimatableColor_AnimatableColor;
5062
+ }
5063
+ this.spawnColor.load(data.spawnColor);
5064
+ }
5065
+ if (data.startCount !== undefined) {
5066
+ this.startCount = data.startCount;
5067
+ }
4858
5068
  }
4859
5069
  }
4860
- var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5070
+ var EmitterInstance_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4861
5071
  if (kind === "m") throw new TypeError("Private method is not writable");
4862
5072
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4863
5073
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -4869,37 +5079,43 @@
4869
5079
  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");
4870
5080
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4871
5081
  };
4872
- var _EmitterInstance_firstSpawn, _EmitterInstance_startParticlesAdded;
5082
+ var _EmitterInstance_firstSpawn, _EmitterInstance_startParticlesAdded, _EmitterInstance_engine;
4873
5083
  class EmitterInstance {
4874
- constructor(emitters, container, emitterOptions, position) {
5084
+ constructor(engine, emitters, container, options, position) {
4875
5085
  var _a, _b, _c, _d, _e, _f;
4876
5086
  var _g;
4877
5087
  this.emitters = emitters;
4878
5088
  this.container = container;
4879
5089
  _EmitterInstance_firstSpawn.set(this, void 0);
4880
5090
  _EmitterInstance_startParticlesAdded.set(this, void 0);
5091
+ _EmitterInstance_engine.set(this, void 0);
5092
+ EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_engine, engine, "f");
4881
5093
  this.currentDuration = 0;
4882
5094
  this.currentEmitDelay = 0;
4883
5095
  this.currentSpawnDelay = 0;
4884
5096
  this.initialPosition = position;
4885
- this.emitterOptions = Utils_deepExtend({}, emitterOptions);
4886
- this.spawnDelay = ((_a = this.emitterOptions.life.delay) !== null && _a !== void 0 ? _a : 0) * 1e3 / this.container.retina.reduceFactor;
4887
- this.position = (_b = this.initialPosition) !== null && _b !== void 0 ? _b : this.calcPosition();
4888
- this.name = emitterOptions.name;
4889
- this.shape = ShapeManager.getShape(emitterOptions.shape);
4890
- this.fill = emitterOptions.fill;
4891
- __classPrivateFieldSet(this, _EmitterInstance_firstSpawn, !this.emitterOptions.life.wait, "f");
4892
- __classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, false, "f");
4893
- let particlesOptions = Utils_deepExtend({}, this.emitterOptions.particles);
5097
+ if (options instanceof Emitter) {
5098
+ this.options = options;
5099
+ } else {
5100
+ this.options = new Emitter;
5101
+ this.options.load(options);
5102
+ }
5103
+ this.spawnDelay = ((_a = this.options.life.delay) !== null && _a !== void 0 ? _a : 0) * 1e3 / this.container.retina.reduceFactor;
5104
+ this.name = this.options.name;
5105
+ this.shape = (_b = EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_engine, "f").emitterShapeManager) === null || _b === void 0 ? void 0 : _b.getShape(this.options.shape);
5106
+ this.fill = this.options.fill;
5107
+ EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_firstSpawn, !this.options.life.wait, "f");
5108
+ EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, false, "f");
5109
+ let particlesOptions = Utils_deepExtend({}, this.options.particles);
4894
5110
  particlesOptions !== null && particlesOptions !== void 0 ? particlesOptions : particlesOptions = {};
4895
5111
  (_c = particlesOptions.move) !== null && _c !== void 0 ? _c : particlesOptions.move = {};
4896
- (_d = (_g = particlesOptions.move).direction) !== null && _d !== void 0 ? _d : _g.direction = this.emitterOptions.direction;
4897
- if (this.emitterOptions.spawnColor !== undefined) {
4898
- this.spawnColor = ColorUtils_colorToHsl(this.emitterOptions.spawnColor);
5112
+ (_d = (_g = particlesOptions.move).direction) !== null && _d !== void 0 ? _d : _g.direction = this.options.direction;
5113
+ if (this.options.spawnColor) {
5114
+ this.spawnColor = ColorUtils_colorToHsl(this.options.spawnColor);
4899
5115
  }
4900
- this.paused = !this.emitterOptions.autoPlay;
5116
+ this.paused = !this.options.autoPlay;
4901
5117
  this.particlesOptions = particlesOptions;
4902
- this.size = (_e = this.emitterOptions.size) !== null && _e !== void 0 ? _e : (() => {
5118
+ this.size = (_e = this.options.size) !== null && _e !== void 0 ? _e : (() => {
4903
5119
  const size = new EmitterSize;
4904
5120
  size.load({
4905
5121
  height: 0,
@@ -4908,7 +5124,7 @@
4908
5124
  });
4909
5125
  return size;
4910
5126
  })();
4911
- this.lifeCount = (_f = this.emitterOptions.life.count) !== null && _f !== void 0 ? _f : -1;
5127
+ this.lifeCount = (_f = this.options.life.count) !== null && _f !== void 0 ? _f : -1;
4912
5128
  this.immortal = this.lifeCount <= 0;
4913
5129
  this.play();
4914
5130
  }
@@ -4925,9 +5141,9 @@
4925
5141
  if (this.paused) {
4926
5142
  return;
4927
5143
  }
4928
- if (this.container.retina.reduceFactor && (this.lifeCount > 0 || this.immortal || !this.emitterOptions.life.count) && (EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_firstSpawn, "f") || this.currentSpawnDelay >= ((_a = this.spawnDelay) !== null && _a !== void 0 ? _a : 0))) {
5144
+ if (this.container.retina.reduceFactor && (this.lifeCount > 0 || this.immortal || !this.options.life.count) && (EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_firstSpawn, "f") || this.currentSpawnDelay >= ((_a = this.spawnDelay) !== null && _a !== void 0 ? _a : 0))) {
4929
5145
  if (this.emitDelay === undefined) {
4930
- const delay = NumberUtils_getRangeValue(this.emitterOptions.rate.delay);
5146
+ const delay = NumberUtils_getRangeValue(this.options.rate.delay);
4931
5147
  this.emitDelay = 1e3 * delay / this.container.retina.reduceFactor;
4932
5148
  }
4933
5149
  if (this.lifeCount > 0 || this.immortal) {
@@ -4951,13 +5167,13 @@
4951
5167
  return;
4952
5168
  }
4953
5169
  if (EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_firstSpawn, "f")) {
4954
- __classPrivateFieldSet(this, _EmitterInstance_firstSpawn, false, "f");
5170
+ EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_firstSpawn, false, "f");
4955
5171
  this.currentSpawnDelay = (_a = this.spawnDelay) !== null && _a !== void 0 ? _a : 0;
4956
5172
  this.currentEmitDelay = (_b = this.emitDelay) !== null && _b !== void 0 ? _b : 0;
4957
5173
  }
4958
5174
  if (!EmitterInstance_classPrivateFieldGet(this, _EmitterInstance_startParticlesAdded, "f")) {
4959
- __classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, true, "f");
4960
- this.emitParticles(this.emitterOptions.startCount);
5175
+ EmitterInstance_classPrivateFieldSet(this, _EmitterInstance_startParticlesAdded, true, "f");
5176
+ this.emitParticles(this.options.startCount);
4961
5177
  }
4962
5178
  if (this.duration !== undefined) {
4963
5179
  this.currentDuration += delta.value;
@@ -4971,7 +5187,7 @@
4971
5187
  }
4972
5188
  if (this.lifeCount > 0 || this.immortal) {
4973
5189
  this.position = this.calcPosition();
4974
- this.spawnDelay = ((_c = this.emitterOptions.life.delay) !== null && _c !== void 0 ? _c : 0) * 1e3 / this.container.retina.reduceFactor;
5190
+ this.spawnDelay = ((_c = this.options.life.delay) !== null && _c !== void 0 ? _c : 0) * 1e3 / this.container.retina.reduceFactor;
4975
5191
  } else {
4976
5192
  this.destroy();
4977
5193
  }
@@ -4995,12 +5211,42 @@
4995
5211
  }
4996
5212
  }
4997
5213
  }
5214
+ getPosition() {
5215
+ if (this.options.domId) {
5216
+ const container = this.container, element = document.getElementById(this.options.domId);
5217
+ if (element) {
5218
+ const elRect = element.getBoundingClientRect();
5219
+ return {
5220
+ x: (elRect.x + elRect.width / 2) * container.retina.pixelRatio,
5221
+ y: (elRect.y + elRect.height / 2) * container.retina.pixelRatio
5222
+ };
5223
+ }
5224
+ }
5225
+ return this.position;
5226
+ }
5227
+ getSize() {
5228
+ const container = this.container;
5229
+ if (this.options.domId) {
5230
+ const element = document.getElementById(this.options.domId);
5231
+ if (element) {
5232
+ const elRect = element.getBoundingClientRect();
5233
+ return {
5234
+ width: elRect.width * container.retina.pixelRatio,
5235
+ height: elRect.height * container.retina.pixelRatio
5236
+ };
5237
+ }
5238
+ }
5239
+ return {
5240
+ width: this.size.mode === "percent" ? container.canvas.size.width * this.size.width / 100 : this.size.width,
5241
+ height: this.size.mode === "percent" ? container.canvas.size.height * this.size.height / 100 : this.size.height
5242
+ };
5243
+ }
4998
5244
  prepareToDie() {
4999
5245
  var _a;
5000
5246
  if (this.paused) {
5001
5247
  return;
5002
5248
  }
5003
- const duration = (_a = this.emitterOptions.life) === null || _a === void 0 ? void 0 : _a.duration;
5249
+ const duration = (_a = this.options.life) === null || _a === void 0 ? void 0 : _a.duration;
5004
5250
  if (this.container.retina.reduceFactor && (this.lifeCount > 0 || this.immortal) && duration !== undefined && duration > 0) {
5005
5251
  this.duration = duration * 1e3;
5006
5252
  }
@@ -5011,7 +5257,7 @@
5011
5257
  calcPosition() {
5012
5258
  var _a, _b;
5013
5259
  const container = this.container;
5014
- const percentPosition = this.emitterOptions.position;
5260
+ const percentPosition = this.options.position;
5015
5261
  return {
5016
5262
  x: ((_a = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.x) !== null && _a !== void 0 ? _a : Math.random() * 100) / 100 * container.canvas.size.width,
5017
5263
  y: ((_b = percentPosition === null || percentPosition === void 0 ? void 0 : percentPosition.y) !== null && _b !== void 0 ? _b : Math.random() * 100) / 100 * container.canvas.size.height
@@ -5021,31 +5267,22 @@
5021
5267
  if (this.paused) {
5022
5268
  return;
5023
5269
  }
5024
- const quantity = NumberUtils_getRangeValue(this.emitterOptions.rate.quantity);
5270
+ const quantity = NumberUtils_getRangeValue(this.options.rate.quantity);
5025
5271
  this.emitParticles(quantity);
5026
5272
  }
5027
5273
  emitParticles(quantity) {
5028
5274
  var _a, _b, _c;
5029
5275
  const container = this.container;
5030
- const position = this.position;
5031
- const offset = {
5032
- x: this.size.mode === "percent" ? container.canvas.size.width * this.size.width / 100 : this.size.width,
5033
- y: this.size.mode === "percent" ? container.canvas.size.height * this.size.height / 100 : this.size.height
5034
- };
5276
+ const position = this.getPosition();
5277
+ const size = this.getSize();
5035
5278
  for (let i = 0; i < quantity; i++) {
5036
5279
  const particlesOptions = Utils_deepExtend({}, this.particlesOptions);
5037
5280
  if (this.spawnColor) {
5038
- const colorAnimation = (_a = this.emitterOptions.spawnColor) === null || _a === void 0 ? void 0 : _a.animation;
5039
- if (colorAnimation) {
5040
- const hueAnimation = colorAnimation;
5041
- if (hueAnimation.enable) {
5042
- this.spawnColor.h = this.setColorAnimation(hueAnimation, this.spawnColor.h, 360);
5043
- } else {
5044
- const hslAnimation = colorAnimation;
5045
- this.spawnColor.h = this.setColorAnimation(hslAnimation.h, this.spawnColor.h, 360);
5046
- this.spawnColor.s = this.setColorAnimation(hslAnimation.s, this.spawnColor.s, 100);
5047
- this.spawnColor.l = this.setColorAnimation(hslAnimation.l, this.spawnColor.l, 100);
5048
- }
5281
+ const hslAnimation = (_a = this.options.spawnColor) === null || _a === void 0 ? void 0 : _a.animation;
5282
+ if (hslAnimation) {
5283
+ this.spawnColor.h = this.setColorAnimation(hslAnimation.h, this.spawnColor.h, 360);
5284
+ this.spawnColor.s = this.setColorAnimation(hslAnimation.s, this.spawnColor.s, 100);
5285
+ this.spawnColor.l = this.setColorAnimation(hslAnimation.l, this.spawnColor.l, 100);
5049
5286
  }
5050
5287
  if (!particlesOptions.color) {
5051
5288
  particlesOptions.color = {
@@ -5055,7 +5292,10 @@
5055
5292
  particlesOptions.color.value = this.spawnColor;
5056
5293
  }
5057
5294
  }
5058
- const pPosition = (_c = (_b = this.shape) === null || _b === void 0 ? void 0 : _b.randomPosition(position, offset, this.fill)) !== null && _c !== void 0 ? _c : position;
5295
+ if (!position) {
5296
+ return;
5297
+ }
5298
+ const pPosition = (_c = (_b = this.shape) === null || _b === void 0 ? void 0 : _b.randomPosition(position, size, this.fill)) !== null && _c !== void 0 ? _c : position;
5059
5299
  container.particles.addParticle(pPosition, particlesOptions);
5060
5300
  }
5061
5301
  }
@@ -5066,115 +5306,44 @@
5066
5306
  return initValue;
5067
5307
  }
5068
5308
  const colorOffset = NumberUtils_randomInRange(animation.offset);
5069
- const delay = NumberUtils_getRangeValue(this.emitterOptions.rate.delay);
5309
+ const delay = NumberUtils_getRangeValue(this.options.rate.delay);
5070
5310
  const emitFactor = 1e3 * delay / container.retina.reduceFactor;
5071
5311
  const colorSpeed = (_a = animation.speed) !== null && _a !== void 0 ? _a : 0;
5072
5312
  return (initValue + colorSpeed * container.fpsLimit / emitFactor + colorOffset * 3.6) % maxValue;
5073
5313
  }
5074
5314
  }
5075
- _EmitterInstance_firstSpawn = new WeakMap, _EmitterInstance_startParticlesAdded = new WeakMap;
5076
- class EmitterRate {
5077
- constructor() {
5078
- this.quantity = 1;
5079
- this.delay = .1;
5080
- }
5081
- load(data) {
5082
- if (data === undefined) {
5083
- return;
5084
- }
5085
- if (data.quantity !== undefined) {
5086
- this.quantity = NumberUtils_setRangeValue(data.quantity);
5087
- }
5088
- if (data.delay !== undefined) {
5089
- this.delay = NumberUtils_setRangeValue(data.delay);
5090
- }
5091
- }
5092
- }
5093
- class EmitterLife {
5094
- constructor() {
5095
- this.wait = false;
5096
- }
5097
- load(data) {
5098
- if (data === undefined) {
5099
- return;
5100
- }
5101
- if (data.count !== undefined) {
5102
- this.count = data.count;
5103
- }
5104
- if (data.delay !== undefined) {
5105
- this.delay = data.delay;
5106
- }
5107
- if (data.duration !== undefined) {
5108
- this.duration = data.duration;
5109
- }
5110
- if (data.wait !== undefined) {
5111
- this.wait = data.wait;
5112
- }
5113
- }
5114
- }
5115
- class Emitter {
5116
- constructor() {
5117
- this.autoPlay = true;
5118
- this.fill = true;
5119
- this.life = new EmitterLife;
5120
- this.rate = new EmitterRate;
5121
- this.shape = "square";
5122
- this.startCount = 0;
5123
- }
5124
- load(data) {
5125
- if (data === undefined) {
5126
- return;
5127
- }
5128
- if (data.autoPlay !== undefined) {
5129
- this.autoPlay = data.autoPlay;
5130
- }
5131
- if (data.size !== undefined) {
5132
- if (this.size === undefined) {
5133
- this.size = new EmitterSize;
5134
- }
5135
- this.size.load(data.size);
5136
- }
5137
- if (data.direction !== undefined) {
5138
- this.direction = data.direction;
5139
- }
5140
- if (data.fill !== undefined) {
5141
- this.fill = data.fill;
5142
- }
5143
- this.life.load(data.life);
5144
- this.name = data.name;
5145
- if (data.particles !== undefined) {
5146
- this.particles = Utils_deepExtend({}, data.particles);
5147
- }
5148
- this.rate.load(data.rate);
5149
- if (data.shape !== undefined) {
5150
- this.shape = data.shape;
5151
- }
5152
- if (data.position !== undefined) {
5153
- this.position = {
5154
- x: data.position.x,
5155
- y: data.position.y
5156
- };
5157
- }
5158
- if (data.spawnColor !== undefined) {
5159
- if (this.spawnColor === undefined) {
5160
- this.spawnColor = new AnimatableColor_AnimatableColor;
5161
- }
5162
- this.spawnColor.load(data.spawnColor);
5163
- }
5164
- if (data.startCount !== undefined) {
5165
- this.startCount = data.startCount;
5166
- }
5167
- }
5168
- }
5315
+ _EmitterInstance_firstSpawn = new WeakMap, _EmitterInstance_startParticlesAdded = new WeakMap,
5316
+ _EmitterInstance_engine = new WeakMap;
5317
+ var Emitters_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5318
+ if (kind === "m") throw new TypeError("Private method is not writable");
5319
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5320
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5321
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5322
+ value;
5323
+ };
5324
+ var Emitters_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
5325
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5326
+ 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");
5327
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5328
+ };
5329
+ var _Emitters_engine;
5169
5330
  class Emitters {
5170
- constructor(container) {
5331
+ constructor(engine, container) {
5171
5332
  this.container = container;
5333
+ _Emitters_engine.set(this, void 0);
5334
+ Emitters_classPrivateFieldSet(this, _Emitters_engine, engine, "f");
5172
5335
  this.array = [];
5173
5336
  this.emitters = [];
5174
5337
  this.interactivityEmitters = [];
5175
5338
  const overridableContainer = container;
5176
5339
  overridableContainer.getEmitter = idxOrName => idxOrName === undefined || typeof idxOrName === "number" ? this.array[idxOrName || 0] : this.array.find((t => t.name === idxOrName));
5177
5340
  overridableContainer.addEmitter = (options, position) => this.addEmitter(options, position);
5341
+ overridableContainer.removeEmitter = idxOrName => {
5342
+ const emitter = overridableContainer.getEmitter(idxOrName);
5343
+ if (emitter) {
5344
+ this.removeEmitter(emitter);
5345
+ }
5346
+ };
5178
5347
  overridableContainer.playEmitter = idxOrName => {
5179
5348
  const emitter = overridableContainer.getEmitter(idxOrName);
5180
5349
  if (emitter) {
@@ -5272,7 +5441,9 @@
5272
5441
  }
5273
5442
  }
5274
5443
  addEmitter(options, position) {
5275
- const emitter = new EmitterInstance(this, this.container, options, position);
5444
+ const emitterOptions = new Emitter;
5445
+ emitterOptions.load(options);
5446
+ const emitter = new EmitterInstance(Emitters_classPrivateFieldGet(this, _Emitters_engine, "f"), this, this.container, emitterOptions, position);
5276
5447
  this.array.push(emitter);
5277
5448
  return emitter;
5278
5449
  }
@@ -5283,43 +5454,46 @@
5283
5454
  }
5284
5455
  }
5285
5456
  }
5286
- class CircleShape {
5287
- randomPosition(position, offset, fill) {
5288
- const generateTheta = (x, y) => {
5289
- const u = Math.random() / 4;
5290
- const theta = Math.atan(y / x * Math.tan(2 * Math.PI * u));
5291
- const v = Math.random();
5292
- if (v < .25) {
5293
- return theta;
5294
- } else if (v < .5) {
5295
- return Math.PI - theta;
5296
- } else if (v < .75) {
5297
- return Math.PI + theta;
5298
- } else {
5299
- return -theta;
5300
- }
5301
- };
5302
- const radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** 2 + (x * Math.sin(theta)) ** 2);
5303
- const [a, b] = [ offset.x / 2, offset.y / 2 ];
5304
- const randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(Math.random()) : maxRadius;
5305
- return {
5306
- x: position.x + randomRadius * Math.cos(randomTheta),
5307
- y: position.y + randomRadius * Math.sin(randomTheta)
5308
- };
5457
+ _Emitters_engine = new WeakMap;
5458
+ var ShapeManager_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5459
+ if (kind === "m") throw new TypeError("Private method is not writable");
5460
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5461
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5462
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5463
+ value;
5464
+ };
5465
+ var _ShapeManager_engine;
5466
+ const shapes = new Map;
5467
+ class ShapeManager {
5468
+ constructor(engine) {
5469
+ _ShapeManager_engine.set(this, void 0);
5470
+ ShapeManager_classPrivateFieldSet(this, _ShapeManager_engine, engine, "f");
5471
+ }
5472
+ addShape(name, drawer) {
5473
+ if (!this.getShape(name)) {
5474
+ shapes.set(name, drawer);
5475
+ }
5476
+ }
5477
+ getShape(name) {
5478
+ return shapes.get(name);
5479
+ }
5480
+ getSupportedShapes() {
5481
+ return shapes.keys();
5309
5482
  }
5310
5483
  }
5484
+ _ShapeManager_engine = new WeakMap;
5311
5485
  function randomSquareCoordinate(position, offset) {
5312
5486
  return position + offset * (Math.random() - .5);
5313
5487
  }
5314
5488
  class SquareShape {
5315
- randomPosition(position, offset, fill) {
5489
+ randomPosition(position, size, fill) {
5316
5490
  if (fill) {
5317
5491
  return {
5318
- x: randomSquareCoordinate(position.x, offset.x),
5319
- y: randomSquareCoordinate(position.y, offset.y)
5492
+ x: randomSquareCoordinate(position.x, size.width),
5493
+ y: randomSquareCoordinate(position.y, size.height)
5320
5494
  };
5321
5495
  } else {
5322
- const halfW = offset.x / 2, halfH = offset.y / 2, side = Math.floor(Math.random() * 4), v = (Math.random() - .5) * 2;
5496
+ const halfW = size.width / 2, halfH = size.height / 2, side = Math.floor(Math.random() * 4), v = (Math.random() - .5) * 2;
5323
5497
  switch (side) {
5324
5498
  case 0:
5325
5499
  return {
@@ -5349,12 +5523,27 @@
5349
5523
  }
5350
5524
  }
5351
5525
  }
5526
+ var Plugins_Emitters_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5527
+ if (kind === "m") throw new TypeError("Private method is not writable");
5528
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5529
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5530
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5531
+ value;
5532
+ };
5533
+ var Plugins_Emitters_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
5534
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5535
+ 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");
5536
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5537
+ };
5538
+ var _EmittersPlugin_engine;
5352
5539
  class EmittersPlugin {
5353
- constructor() {
5540
+ constructor(engine) {
5541
+ _EmittersPlugin_engine.set(this, void 0);
5542
+ Plugins_Emitters_classPrivateFieldSet(this, _EmittersPlugin_engine, engine, "f");
5354
5543
  this.id = "emitters";
5355
5544
  }
5356
5545
  getPlugin(container) {
5357
- return new Emitters(container);
5546
+ return new Emitters(Plugins_Emitters_classPrivateFieldGet(this, _EmittersPlugin_engine, "f"), container);
5358
5547
  }
5359
5548
  needsPlugin(options) {
5360
5549
  var _a, _b, _c;
@@ -5403,16 +5592,21 @@
5403
5592
  }
5404
5593
  }
5405
5594
  }
5406
- async function loadEmittersPlugin(tsParticles) {
5407
- const plugin = new EmittersPlugin;
5408
- await tsParticles.addPlugin(plugin);
5409
- if (!tsParticles.addEmitterShape) {
5410
- tsParticles.addEmitterShape = (name, shape) => {
5411
- ShapeManager.addShape(name, shape);
5595
+ _EmittersPlugin_engine = new WeakMap;
5596
+ async function loadEmittersPlugin(engine) {
5597
+ if (!engine.emitterShapeManager) {
5598
+ engine.emitterShapeManager = new ShapeManager(engine);
5599
+ }
5600
+ if (!engine.addEmitterShape) {
5601
+ engine.addEmitterShape = (name, shape) => {
5602
+ var _a;
5603
+ (_a = engine.emitterShapeManager) === null || _a === void 0 ? void 0 : _a.addShape(name, shape);
5412
5604
  };
5413
5605
  }
5414
- tsParticles.addEmitterShape("circle", new CircleShape);
5415
- tsParticles.addEmitterShape("square", new SquareShape);
5606
+ const plugin = new EmittersPlugin(engine);
5607
+ await engine.addPlugin(plugin);
5608
+ engine.addEmitterShape("circle", new CircleShape);
5609
+ engine.addEmitterShape("square", new SquareShape);
5416
5610
  }
5417
5611
  return __webpack_exports__;
5418
5612
  }();