@tsparticles/engine 4.0.0-alpha.1 → 4.0.0-alpha.14

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 (429) hide show
  1. package/219.min.js +1 -0
  2. package/README.md +2 -5
  3. package/browser/Core/Canvas.js +238 -154
  4. package/browser/Core/Container.js +111 -227
  5. package/browser/Core/Engine.js +84 -124
  6. package/browser/Core/Particle.js +236 -140
  7. package/browser/Core/Particles.js +212 -123
  8. package/browser/Core/Retina.js +5 -0
  9. package/browser/Core/Utils/Constants.js +2 -2
  10. package/browser/Core/Utils/EventListeners.js +69 -310
  11. package/browser/Core/Utils/Point.js +2 -0
  12. package/browser/Core/Utils/QuadTree.js +13 -8
  13. package/browser/Core/Utils/Ranges.js +4 -0
  14. package/browser/Core/Utils/Vectors.js +7 -4
  15. package/browser/Enums/Types/EasingType.js +18 -3
  16. package/browser/Options/Classes/AnimatableColor.js +1 -0
  17. package/browser/Options/Classes/AnimationOptions.js +8 -0
  18. package/browser/Options/Classes/Background/Background.js +6 -0
  19. package/browser/Options/Classes/ColorAnimation.js +1 -0
  20. package/browser/Options/Classes/FullScreen/FullScreen.js +2 -0
  21. package/browser/Options/Classes/HslAnimation.js +3 -5
  22. package/browser/Options/Classes/Options.js +32 -78
  23. package/browser/Options/Classes/OptionsColor.js +1 -0
  24. package/browser/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
  25. package/browser/Options/Classes/Particles/Effect/Effect.js +4 -0
  26. package/browser/Options/Classes/Particles/Move/Move.js +18 -0
  27. package/browser/Options/Classes/Particles/Move/MoveAngle.js +2 -0
  28. package/browser/Options/Classes/Particles/Move/MoveAttract.js +3 -0
  29. package/browser/Options/Classes/Particles/Move/MoveCenter.js +4 -0
  30. package/browser/Options/Classes/Particles/Move/MoveGravity.js +4 -0
  31. package/browser/Options/Classes/Particles/Move/OutModes.js +5 -0
  32. package/browser/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
  33. package/browser/Options/Classes/Particles/Move/Spin.js +3 -0
  34. package/browser/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
  35. package/browser/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
  36. package/browser/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
  37. package/browser/Options/Classes/Particles/Opacity/Opacity.js +1 -0
  38. package/browser/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
  39. package/browser/Options/Classes/Particles/ParticlesOptions.js +19 -11
  40. package/browser/Options/Classes/Particles/Shape/Shape.js +4 -0
  41. package/browser/Options/Classes/Particles/Size/Size.js +1 -0
  42. package/browser/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
  43. package/browser/Options/Classes/Particles/Stroke.js +3 -0
  44. package/browser/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
  45. package/{esm/Options/Classes/Interactivity/Events → browser/Options/Classes}/ResizeEvent.js +3 -1
  46. package/browser/Options/Classes/ValueWithRandom.js +3 -4
  47. package/browser/Utils/CanvasUtils.js +31 -106
  48. package/browser/Utils/ColorUtils.js +17 -2
  49. package/browser/Utils/EventDispatcher.js +1 -0
  50. package/browser/Utils/MathUtils.js +3 -2
  51. package/browser/Utils/Utils.js +53 -44
  52. package/browser/exports.js +1 -21
  53. package/cjs/Core/Canvas.js +238 -154
  54. package/cjs/Core/Container.js +111 -227
  55. package/cjs/Core/Engine.js +84 -124
  56. package/cjs/Core/Particle.js +236 -140
  57. package/cjs/Core/Particles.js +212 -123
  58. package/cjs/Core/Retina.js +5 -0
  59. package/cjs/Core/Utils/Constants.js +2 -2
  60. package/cjs/Core/Utils/EventListeners.js +69 -310
  61. package/cjs/Core/Utils/Point.js +2 -0
  62. package/cjs/Core/Utils/QuadTree.js +13 -8
  63. package/cjs/Core/Utils/Ranges.js +4 -0
  64. package/cjs/Core/Utils/Vectors.js +7 -4
  65. package/cjs/Enums/Types/EasingType.js +18 -3
  66. package/cjs/Options/Classes/AnimatableColor.js +1 -0
  67. package/cjs/Options/Classes/AnimationOptions.js +8 -0
  68. package/cjs/Options/Classes/Background/Background.js +6 -0
  69. package/cjs/Options/Classes/ColorAnimation.js +1 -0
  70. package/cjs/Options/Classes/FullScreen/FullScreen.js +2 -0
  71. package/cjs/Options/Classes/HslAnimation.js +3 -5
  72. package/cjs/Options/Classes/Options.js +32 -78
  73. package/cjs/Options/Classes/OptionsColor.js +1 -0
  74. package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
  75. package/cjs/Options/Classes/Particles/Effect/Effect.js +4 -0
  76. package/cjs/Options/Classes/Particles/Move/Move.js +18 -0
  77. package/cjs/Options/Classes/Particles/Move/MoveAngle.js +2 -0
  78. package/cjs/Options/Classes/Particles/Move/MoveAttract.js +3 -0
  79. package/cjs/Options/Classes/Particles/Move/MoveCenter.js +4 -0
  80. package/cjs/Options/Classes/Particles/Move/MoveGravity.js +4 -0
  81. package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -0
  82. package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
  83. package/cjs/Options/Classes/Particles/Move/Spin.js +3 -0
  84. package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
  85. package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
  86. package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
  87. package/cjs/Options/Classes/Particles/Opacity/Opacity.js +1 -0
  88. package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
  89. package/cjs/Options/Classes/Particles/ParticlesOptions.js +19 -11
  90. package/cjs/Options/Classes/Particles/Shape/Shape.js +4 -0
  91. package/cjs/Options/Classes/Particles/Size/Size.js +1 -0
  92. package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
  93. package/cjs/Options/Classes/Particles/Stroke.js +3 -0
  94. package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
  95. package/cjs/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +3 -1
  96. package/cjs/Options/Classes/ValueWithRandom.js +3 -4
  97. package/cjs/Utils/CanvasUtils.js +31 -106
  98. package/cjs/Utils/ColorUtils.js +17 -2
  99. package/cjs/Utils/EventDispatcher.js +1 -0
  100. package/cjs/Utils/MathUtils.js +3 -2
  101. package/cjs/Utils/Utils.js +53 -44
  102. package/cjs/exports.js +1 -21
  103. package/dist_browser_Core_Container_js.js +8 -18
  104. package/esm/Core/Canvas.js +238 -154
  105. package/esm/Core/Container.js +111 -227
  106. package/esm/Core/Engine.js +84 -124
  107. package/esm/Core/Particle.js +236 -140
  108. package/esm/Core/Particles.js +212 -123
  109. package/esm/Core/Retina.js +5 -0
  110. package/esm/Core/Utils/Constants.js +2 -2
  111. package/esm/Core/Utils/EventListeners.js +69 -310
  112. package/esm/Core/Utils/Point.js +2 -0
  113. package/esm/Core/Utils/QuadTree.js +13 -8
  114. package/esm/Core/Utils/Ranges.js +4 -0
  115. package/esm/Core/Utils/Vectors.js +7 -4
  116. package/esm/Enums/Types/EasingType.js +18 -3
  117. package/esm/Options/Classes/AnimatableColor.js +1 -0
  118. package/esm/Options/Classes/AnimationOptions.js +8 -0
  119. package/esm/Options/Classes/Background/Background.js +6 -0
  120. package/esm/Options/Classes/ColorAnimation.js +1 -0
  121. package/esm/Options/Classes/FullScreen/FullScreen.js +2 -0
  122. package/esm/Options/Classes/HslAnimation.js +3 -5
  123. package/esm/Options/Classes/Options.js +32 -78
  124. package/esm/Options/Classes/OptionsColor.js +1 -0
  125. package/esm/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
  126. package/esm/Options/Classes/Particles/Effect/Effect.js +4 -0
  127. package/esm/Options/Classes/Particles/Move/Move.js +18 -0
  128. package/esm/Options/Classes/Particles/Move/MoveAngle.js +2 -0
  129. package/esm/Options/Classes/Particles/Move/MoveAttract.js +3 -0
  130. package/esm/Options/Classes/Particles/Move/MoveCenter.js +4 -0
  131. package/esm/Options/Classes/Particles/Move/MoveGravity.js +4 -0
  132. package/esm/Options/Classes/Particles/Move/OutModes.js +5 -0
  133. package/esm/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
  134. package/esm/Options/Classes/Particles/Move/Spin.js +3 -0
  135. package/esm/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
  136. package/esm/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
  137. package/esm/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
  138. package/esm/Options/Classes/Particles/Opacity/Opacity.js +1 -0
  139. package/esm/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
  140. package/esm/Options/Classes/Particles/ParticlesOptions.js +19 -11
  141. package/esm/Options/Classes/Particles/Shape/Shape.js +4 -0
  142. package/esm/Options/Classes/Particles/Size/Size.js +1 -0
  143. package/esm/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
  144. package/esm/Options/Classes/Particles/Stroke.js +3 -0
  145. package/esm/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
  146. package/{browser/Options/Classes/Interactivity/Events → esm/Options/Classes}/ResizeEvent.js +3 -1
  147. package/esm/Options/Classes/ValueWithRandom.js +3 -4
  148. package/esm/Utils/CanvasUtils.js +31 -106
  149. package/esm/Utils/ColorUtils.js +17 -2
  150. package/esm/Utils/EventDispatcher.js +1 -0
  151. package/esm/Utils/MathUtils.js +3 -2
  152. package/esm/Utils/Utils.js +53 -44
  153. package/esm/exports.js +1 -21
  154. package/package.json +1 -1
  155. package/report.html +3 -3
  156. package/scripts/install.js +28 -9
  157. package/tsparticles.engine.js +67 -247
  158. package/tsparticles.engine.min.js +2 -2
  159. package/types/Core/Canvas.d.ts +15 -4
  160. package/types/Core/Container.d.ts +5 -20
  161. package/types/Core/Engine.d.ts +18 -32
  162. package/types/Core/Interfaces/IColorManager.d.ts +0 -1
  163. package/types/Core/Interfaces/IContainerPlugin.d.ts +12 -2
  164. package/types/Core/Interfaces/IDrawParticleParams.d.ts +1 -1
  165. package/types/Core/Interfaces/IMovePathGenerator.d.ts +1 -2
  166. package/types/Core/Interfaces/IParticleOpacityData.d.ts +4 -0
  167. package/types/Core/Interfaces/IParticleRotateData.d.ts +4 -0
  168. package/types/Core/Interfaces/IParticleTransformValues.d.ts +4 -4
  169. package/types/Core/Interfaces/IParticleUpdater.d.ts +1 -1
  170. package/types/Core/Interfaces/IPlugin.d.ts +5 -1
  171. package/types/Core/Interfaces/IShapeDrawer.d.ts +0 -1
  172. package/types/Core/Particle.d.ts +13 -2
  173. package/types/Core/Particles.d.ts +17 -8
  174. package/types/Core/Utils/Constants.d.ts +2 -2
  175. package/types/Core/Utils/EventListeners.d.ts +0 -14
  176. package/types/Enums/Types/EasingType.d.ts +20 -5
  177. package/types/Options/Classes/HslAnimation.d.ts +3 -4
  178. package/types/Options/Classes/Options.d.ts +2 -11
  179. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -2
  180. package/types/Options/Classes/ResizeEvent.d.ts +9 -0
  181. package/types/Options/Classes/ValueWithRandom.d.ts +0 -1
  182. package/types/Options/Interfaces/IOptions.d.ts +2 -8
  183. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -3
  184. package/types/Types/CustomEventListener.d.ts +1 -1
  185. package/types/Types/EngineInitializers.d.ts +19 -0
  186. package/types/Utils/CanvasUtils.d.ts +6 -25
  187. package/types/Utils/EventDispatcher.d.ts +1 -1
  188. package/types/Utils/Utils.d.ts +5 -7
  189. package/types/export-types.d.ts +3 -19
  190. package/types/exports.d.ts +1 -21
  191. package/umd/Core/Canvas.js +236 -152
  192. package/umd/Core/Container.js +111 -227
  193. package/umd/Core/Engine.js +83 -123
  194. package/umd/Core/Particle.js +236 -140
  195. package/umd/Core/Particles.js +213 -124
  196. package/umd/Core/Retina.js +5 -0
  197. package/umd/Core/Utils/Constants.js +3 -3
  198. package/umd/Core/Utils/EventListeners.js +69 -310
  199. package/umd/Core/Utils/Point.js +2 -0
  200. package/umd/Core/Utils/QuadTree.js +13 -8
  201. package/umd/Core/Utils/Ranges.js +4 -0
  202. package/umd/Core/Utils/Vectors.js +7 -4
  203. package/umd/Enums/Types/EasingType.js +18 -3
  204. package/umd/Options/Classes/AnimatableColor.js +1 -0
  205. package/umd/Options/Classes/AnimationOptions.js +8 -0
  206. package/umd/Options/Classes/Background/Background.js +6 -0
  207. package/umd/Options/Classes/ColorAnimation.js +1 -0
  208. package/umd/Options/Classes/FullScreen/FullScreen.js +2 -0
  209. package/umd/Options/Classes/HslAnimation.js +3 -5
  210. package/umd/Options/Classes/Options.js +32 -78
  211. package/umd/Options/Classes/OptionsColor.js +1 -0
  212. package/umd/Options/Classes/Particles/Bounce/ParticlesBounce.js +2 -0
  213. package/umd/Options/Classes/Particles/Effect/Effect.js +4 -0
  214. package/umd/Options/Classes/Particles/Move/Move.js +18 -0
  215. package/umd/Options/Classes/Particles/Move/MoveAngle.js +2 -0
  216. package/umd/Options/Classes/Particles/Move/MoveAttract.js +3 -0
  217. package/umd/Options/Classes/Particles/Move/MoveCenter.js +4 -0
  218. package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -0
  219. package/umd/Options/Classes/Particles/Move/OutModes.js +5 -0
  220. package/umd/Options/Classes/Particles/Move/Path/MovePath.js +5 -0
  221. package/umd/Options/Classes/Particles/Move/Spin.js +3 -0
  222. package/umd/Options/Classes/Particles/Number/ParticlesDensity.js +3 -0
  223. package/umd/Options/Classes/Particles/Number/ParticlesNumber.js +3 -0
  224. package/umd/Options/Classes/Particles/Number/ParticlesNumberLimit.js +2 -0
  225. package/umd/Options/Classes/Particles/Opacity/Opacity.js +1 -0
  226. package/umd/Options/Classes/Particles/Opacity/OpacityAnimation.js +1 -0
  227. package/umd/Options/Classes/Particles/ParticlesOptions.js +19 -11
  228. package/umd/Options/Classes/Particles/Shape/Shape.js +4 -0
  229. package/umd/Options/Classes/Particles/Size/Size.js +1 -0
  230. package/umd/Options/Classes/Particles/Size/SizeAnimation.js +1 -0
  231. package/umd/Options/Classes/Particles/Stroke.js +3 -0
  232. package/umd/Options/Classes/Particles/ZIndex/ZIndex.js +3 -0
  233. package/umd/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +4 -2
  234. package/umd/Options/Classes/ValueWithRandom.js +3 -4
  235. package/umd/Utils/CanvasUtils.js +30 -108
  236. package/umd/Utils/ColorUtils.js +17 -2
  237. package/umd/Utils/EventDispatcher.js +1 -0
  238. package/umd/Utils/MathUtils.js +3 -2
  239. package/umd/Utils/Utils.js +55 -48
  240. package/umd/exports.js +2 -22
  241. package/638.min.js +0 -2
  242. package/638.min.js.LICENSE.txt +0 -1
  243. package/browser/Core/Utils/ExternalInteractorBase.js +0 -7
  244. package/browser/Core/Utils/InteractionManager.js +0 -60
  245. package/browser/Core/Utils/ParticlesInteractorBase.js +0 -7
  246. package/browser/Enums/InteractivityDetect.js +0 -6
  247. package/browser/Enums/Modes/ResponsiveMode.js +0 -5
  248. package/browser/Enums/Modes/ThemeMode.js +0 -6
  249. package/browser/Enums/Types/DivType.js +0 -5
  250. package/browser/Enums/Types/InteractorType.js +0 -5
  251. package/browser/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  252. package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  253. package/browser/Options/Classes/Interactivity/Events/Events.js +0 -30
  254. package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  255. package/browser/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  256. package/browser/Options/Classes/Interactivity/Interactivity.js +0 -22
  257. package/browser/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  258. package/browser/Options/Classes/ManualParticle.js +0 -21
  259. package/browser/Options/Classes/Responsive.js +0 -29
  260. package/browser/Options/Classes/Theme/Theme.js +0 -21
  261. package/browser/Options/Classes/Theme/ThemeDefault.js +0 -23
  262. package/browser/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  263. package/browser/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  264. package/browser/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  265. package/browser/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  266. package/browser/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  267. package/browser/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  268. package/browser/Options/Interfaces/Theme/ITheme.js +0 -1
  269. package/browser/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  270. package/cjs/Core/Interfaces/IContainerInteractivity.js +0 -1
  271. package/cjs/Core/Interfaces/IExternalInteractor.js +0 -1
  272. package/cjs/Core/Interfaces/IInteractor.js +0 -1
  273. package/cjs/Core/Interfaces/IMouseData.js +0 -1
  274. package/cjs/Core/Interfaces/IParticlesInteractor.js +0 -1
  275. package/cjs/Core/Utils/ExternalInteractorBase.js +0 -7
  276. package/cjs/Core/Utils/InteractionManager.js +0 -60
  277. package/cjs/Core/Utils/ParticlesInteractorBase.js +0 -7
  278. package/cjs/Enums/InteractivityDetect.js +0 -6
  279. package/cjs/Enums/Modes/ResponsiveMode.js +0 -5
  280. package/cjs/Enums/Modes/ThemeMode.js +0 -6
  281. package/cjs/Enums/Types/DivType.js +0 -5
  282. package/cjs/Enums/Types/InteractorType.js +0 -5
  283. package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  284. package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  285. package/cjs/Options/Classes/Interactivity/Events/Events.js +0 -30
  286. package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  287. package/cjs/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  288. package/cjs/Options/Classes/Interactivity/Interactivity.js +0 -22
  289. package/cjs/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  290. package/cjs/Options/Classes/ManualParticle.js +0 -21
  291. package/cjs/Options/Classes/Responsive.js +0 -29
  292. package/cjs/Options/Classes/Theme/Theme.js +0 -21
  293. package/cjs/Options/Classes/Theme/ThemeDefault.js +0 -23
  294. package/cjs/Options/Interfaces/IManualParticle.js +0 -1
  295. package/cjs/Options/Interfaces/IResponsive.js +0 -1
  296. package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  297. package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  298. package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  299. package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  300. package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  301. package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  302. package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  303. package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  304. package/cjs/Options/Interfaces/Theme/ITheme.js +0 -1
  305. package/cjs/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  306. package/esm/Core/Interfaces/IContainerInteractivity.js +0 -1
  307. package/esm/Core/Interfaces/IExternalInteractor.js +0 -1
  308. package/esm/Core/Interfaces/IInteractor.js +0 -1
  309. package/esm/Core/Interfaces/IMouseData.js +0 -1
  310. package/esm/Core/Interfaces/IParticlesInteractor.js +0 -1
  311. package/esm/Core/Utils/ExternalInteractorBase.js +0 -7
  312. package/esm/Core/Utils/InteractionManager.js +0 -60
  313. package/esm/Core/Utils/ParticlesInteractorBase.js +0 -7
  314. package/esm/Enums/InteractivityDetect.js +0 -6
  315. package/esm/Enums/Modes/ResponsiveMode.js +0 -5
  316. package/esm/Enums/Modes/ThemeMode.js +0 -6
  317. package/esm/Enums/Types/DivType.js +0 -5
  318. package/esm/Enums/Types/InteractorType.js +0 -5
  319. package/esm/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  320. package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  321. package/esm/Options/Classes/Interactivity/Events/Events.js +0 -30
  322. package/esm/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  323. package/esm/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  324. package/esm/Options/Classes/Interactivity/Interactivity.js +0 -22
  325. package/esm/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  326. package/esm/Options/Classes/ManualParticle.js +0 -21
  327. package/esm/Options/Classes/Responsive.js +0 -29
  328. package/esm/Options/Classes/Theme/Theme.js +0 -21
  329. package/esm/Options/Classes/Theme/ThemeDefault.js +0 -23
  330. package/esm/Options/Interfaces/IManualParticle.js +0 -1
  331. package/esm/Options/Interfaces/IResponsive.js +0 -1
  332. package/esm/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  333. package/esm/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  334. package/esm/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  335. package/esm/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  336. package/esm/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  337. package/esm/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  338. package/esm/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  339. package/esm/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  340. package/esm/Options/Interfaces/Theme/ITheme.js +0 -1
  341. package/esm/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  342. package/tsparticles.engine.min.js.LICENSE.txt +0 -1
  343. package/types/Core/Interfaces/IContainerInteractivity.d.ts +0 -6
  344. package/types/Core/Interfaces/IExternalInteractor.d.ts +0 -12
  345. package/types/Core/Interfaces/IInteractor.d.ts +0 -16
  346. package/types/Core/Interfaces/IMouseData.d.ts +0 -9
  347. package/types/Core/Interfaces/IParticlesInteractor.d.ts +0 -7
  348. package/types/Core/Utils/ExternalInteractorBase.d.ts +0 -15
  349. package/types/Core/Utils/InteractionManager.d.ts +0 -17
  350. package/types/Core/Utils/ParticlesInteractorBase.d.ts +0 -15
  351. package/types/Enums/InteractivityDetect.d.ts +0 -5
  352. package/types/Enums/Modes/ResponsiveMode.d.ts +0 -4
  353. package/types/Enums/Modes/ThemeMode.d.ts +0 -5
  354. package/types/Enums/Types/DivType.d.ts +0 -4
  355. package/types/Enums/Types/InteractorType.d.ts +0 -4
  356. package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +0 -10
  357. package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -13
  358. package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -16
  359. package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +0 -12
  360. package/types/Options/Classes/Interactivity/Events/Parallax.d.ts +0 -10
  361. package/types/Options/Classes/Interactivity/Events/ResizeEvent.d.ts +0 -9
  362. package/types/Options/Classes/Interactivity/Interactivity.d.ts +0 -16
  363. package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +0 -12
  364. package/types/Options/Classes/ManualParticle.d.ts +0 -10
  365. package/types/Options/Classes/Responsive.d.ts +0 -12
  366. package/types/Options/Classes/Theme/Theme.d.ts +0 -12
  367. package/types/Options/Classes/Theme/ThemeDefault.d.ts +0 -11
  368. package/types/Options/Interfaces/IManualParticle.d.ts +0 -7
  369. package/types/Options/Interfaces/IResponsive.d.ts +0 -7
  370. package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +0 -5
  371. package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -8
  372. package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -11
  373. package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +0 -7
  374. package/types/Options/Interfaces/Interactivity/Events/IParallax.d.ts +0 -5
  375. package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -9
  376. package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -4
  377. package/types/Options/Interfaces/Interactivity/Modes/IModes.d.ts +0 -1
  378. package/types/Options/Interfaces/Theme/ITheme.d.ts +0 -7
  379. package/types/Options/Interfaces/Theme/IThemeDefault.d.ts +0 -6
  380. package/umd/Core/Interfaces/IMouseData.js +0 -12
  381. package/umd/Core/Interfaces/IParticlesInteractor.js +0 -12
  382. package/umd/Core/Utils/ExternalInteractorBase.js +0 -21
  383. package/umd/Core/Utils/InteractionManager.js +0 -74
  384. package/umd/Core/Utils/ParticlesInteractorBase.js +0 -21
  385. package/umd/Enums/InteractivityDetect.js +0 -19
  386. package/umd/Enums/Modes/ResponsiveMode.js +0 -18
  387. package/umd/Enums/Modes/ThemeMode.js +0 -19
  388. package/umd/Enums/Types/DivType.js +0 -18
  389. package/umd/Enums/Types/InteractorType.js +0 -18
  390. package/umd/Options/Classes/Interactivity/Events/ClickEvent.js +0 -32
  391. package/umd/Options/Classes/Interactivity/Events/DivEvent.js +0 -41
  392. package/umd/Options/Classes/Interactivity/Events/Events.js +0 -44
  393. package/umd/Options/Classes/Interactivity/Events/HoverEvent.js +0 -35
  394. package/umd/Options/Classes/Interactivity/Events/Parallax.js +0 -36
  395. package/umd/Options/Classes/Interactivity/Interactivity.js +0 -36
  396. package/umd/Options/Classes/Interactivity/Modes/Modes.js +0 -39
  397. package/umd/Options/Classes/ManualParticle.js +0 -35
  398. package/umd/Options/Classes/Responsive.js +0 -43
  399. package/umd/Options/Classes/Theme/Theme.js +0 -35
  400. package/umd/Options/Classes/Theme/ThemeDefault.js +0 -37
  401. package/umd/Options/Interfaces/IManualParticle.js +0 -12
  402. package/umd/Options/Interfaces/IResponsive.js +0 -12
  403. package/umd/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -12
  404. package/umd/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -12
  405. package/umd/Options/Interfaces/Interactivity/Events/IEvents.js +0 -12
  406. package/umd/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -12
  407. package/umd/Options/Interfaces/Interactivity/Events/IParallax.js +0 -12
  408. package/umd/Options/Interfaces/Interactivity/IInteractivity.js +0 -12
  409. package/umd/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -12
  410. package/umd/Options/Interfaces/Interactivity/Modes/IModes.js +0 -12
  411. package/umd/Options/Interfaces/Theme/ITheme.js +0 -12
  412. package/umd/Options/Interfaces/Theme/IThemeDefault.js +0 -12
  413. /package/browser/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
  414. /package/browser/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
  415. /package/browser/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  416. /package/browser/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
  417. /package/{browser/Core/Interfaces/IMouseData.js → cjs/Core/Interfaces/IParticleOpacityData.js} +0 -0
  418. /package/{browser/Core/Interfaces/IParticlesInteractor.js → cjs/Core/Interfaces/IParticleRotateData.js} +0 -0
  419. /package/cjs/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  420. /package/{browser/Options/Interfaces/IManualParticle.js → cjs/Types/EngineInitializers.js} +0 -0
  421. /package/{browser/Options/Interfaces/IResponsive.js → esm/Core/Interfaces/IParticleOpacityData.js} +0 -0
  422. /package/{browser/Options/Interfaces/Interactivity/Events/IClickEvent.js → esm/Core/Interfaces/IParticleRotateData.js} +0 -0
  423. /package/esm/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  424. /package/{browser/Options/Interfaces/Interactivity/Events/IDivEvent.js → esm/Types/EngineInitializers.js} +0 -0
  425. /package/types/Options/Interfaces/{Interactivity/Events/IResizeEvent.d.ts → IResizeEvent.d.ts} +0 -0
  426. /package/umd/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
  427. /package/umd/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
  428. /package/umd/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  429. /package/umd/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
package/219.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_engine=this.webpackChunk_tsparticles_engine||[]).push([[219],{3219(t,i,e){e.d(i,{Container:()=>M});var s=e(1913),a=e(7313),r=e(7927),n=e(5107),h=e(1964);function o(t,i,e=!1){if(!i)return;let s=t.style,a=new Set;for(let t=0;t<s.length;t++){let i=s.item(t);i&&a.add(i)}for(let t=0;t<i.length;t++){let e=i.item(t);e&&a.add(e)}for(let t of a){let a=i.getPropertyValue(t);a?s.setProperty(t,a,e?"important":""):s.removeProperty(t)}}class l{container;element;size;_canvasClearPlugins;_canvasPaintPlugins;_canvasSettings;_clearDrawPlugins;_colorPlugins;_context;_drawParticlePlugins;_drawParticlesCleanupPlugins;_drawParticlesSetupPlugins;_drawPlugins;_drawSettingsCleanupPlugins;_drawSettingsSetupPlugins;_engine;_generated;_mutationObserver;_originalStyle;_pointerEvents;_postDrawUpdaters;_preDrawUpdaters;_resizePlugins;_reusableColorStyles={};_reusablePluginColors=[void 0,void 0];_reusableTransform={};_standardSize;constructor(t,i){this.container=t,this._engine=i,this._standardSize={height:0,width:0};const e=t.retina.pixelRatio,s=this._standardSize;this.size={height:s.height*e,width:s.width*e},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesCleanupPlugins=[],this._drawParticlesSetupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[],this._pointerEvents="none"}get settings(){return this._canvasSettings}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}canvasClear(){this.container.actualOptions.clear&&this.draw(t=>{(0,r.IU)(t,this.size)})}clear(){let t=!1;for(let i of this._canvasClearPlugins)if(t=i.canvasClear?.()??!1)break;t||this.canvasClear()}destroy(){if(this.stop(),this._generated){let t=this.element;t?.remove(),this.element=void 0}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesCleanupPlugins=[],this._drawParticlesSetupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[]}draw(t){let i=this._context;if(i)return t(i)}drawParticle(t,i){if(t.spawning||t.destroyed)return;let e=t.getRadius();if(e<=a.w2)return;let s=t.getFillColor(),n=t.getStrokeColor()??s,[o,l]=this._getPluginParticleColors(t);if(o??=s,l??=n,!o&&!l)return;let c=this.container,d=t.options.zIndex,p=a.RV-t.zIndexFactor,{opacity:u,strokeOpacity:_}=t.getOpacity(),g=this._reusableTransform,f=this._reusableColorStyles,P=o?(0,h.LC)(o,c.hdr,u):void 0,m=l?(0,h.LC)(l,c.hdr,_):P;g.a=g.b=g.c=g.d=void 0,f.fill=P,f.stroke=m,this.draw(s=>{for(let e of this._drawParticlesSetupPlugins)e.drawParticleSetup?.(s,t,i);for(let a of(this._applyPreDrawUpdaters(s,t,e,u,f,g),(0,r.p0)({container:c,context:s,particle:t,delta:i,colorStyles:f,radius:e*p**d.sizeRate,opacity:u,transform:g}),this._applyPostDrawUpdaters(t),this._drawParticlesCleanupPlugins))a.drawParticleCleanup?.(s,t,i)})}drawParticlePlugins(t,i){this.draw(e=>{for(let s of this._drawParticlePlugins)(0,r.Wb)(e,s,t,i)})}drawParticles(t){let{particles:i}=this.container;this.clear(),i.update(t),this.draw(e=>{for(let i of this._drawSettingsSetupPlugins)i.drawSettingsSetup?.(e,t);for(let i of this._drawPlugins)i.draw?.(e,t);for(let s of(i.drawParticles(t),this._clearDrawPlugins))s.clearDraw?.(e,t);for(let i of this._drawSettingsCleanupPlugins)i.drawSettingsCleanup?.(e,t)})}init(){this._safeMutationObserver(t=>{t.disconnect()}),this._mutationObserver=(0,n.tG)(t=>{for(let i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()}),this.resize(),this._initStyle(),this.initBackground(),this._safeMutationObserver(t=>{this.element&&this.element instanceof Node&&t.observe(this.element,{attributes:!0})}),this.initUpdaters(),this.initPlugins(),this.paint()}initBackground(){let{container:t}=this,i=t.actualOptions.background,e=this.element;if(!e)return;let s=e.style,a=(0,h.BN)(this._engine,i.color);a?s.backgroundColor=(0,h.xx)(a,t.hdr,i.opacity):s.backgroundColor="",s.backgroundImage=i.image||"",s.backgroundPosition=i.position||"",s.backgroundRepeat=i.repeat||"",s.backgroundSize=i.size||""}initPlugins(){for(let t of(this._resizePlugins=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesSetupPlugins=[],this._drawParticlesCleanupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[],this.container.plugins))t.resize&&this._resizePlugins.push(t),(t.particleFillColor??t.particleStrokeColor)&&this._colorPlugins.push(t),t.canvasClear&&this._canvasClearPlugins.push(t),t.canvasPaint&&this._canvasPaintPlugins.push(t),t.drawParticle&&this._drawParticlePlugins.push(t),t.drawParticleSetup&&this._drawParticlesSetupPlugins.push(t),t.drawParticleCleanup&&this._drawParticlesCleanupPlugins.push(t),t.draw&&this._drawPlugins.push(t),t.drawSettingsSetup&&this._drawSettingsSetupPlugins.push(t),t.drawSettingsCleanup&&this._drawSettingsCleanupPlugins.push(t),t.clearDraw&&this._clearDrawPlugins.push(t)}initUpdaters(){for(let t of(this._preDrawUpdaters=[],this._postDrawUpdaters=[],this.container.particles.updaters))t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this._preDrawUpdaters.push(t)}loadCanvas(t){this._generated&&this.element&&this.element.remove();let i=this.container;this._generated=a.eb in t.dataset?"true"===t.dataset[a.eb]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=(0,n.td)(this.element.style);let e=this._standardSize;e.height=t.offsetHeight,e.width=t.offsetWidth;let s=this.container.retina.pixelRatio,r=this.size;t.height=r.height=e.height*s,t.width=r.width=e.width*s;let h=(0,n.lV)("(color-gamut: p3)");this._canvasSettings={alpha:!0,colorSpace:h?.matches&&i.hdr?"display-p3":"srgb",desynchronized:!0,willReadFrequently:!1},this._context=this.element.getContext("2d",this._canvasSettings),this._safeMutationObserver(t=>{t.disconnect()}),i.retina.init(),this.initBackground(),this._safeMutationObserver(t=>{this.element&&this.element instanceof Node&&t.observe(this.element,{attributes:!0})})}paint(){let t=!1;for(let i of this._canvasPaintPlugins)if(t=i.canvasPaint?.()??!1)break;t||this.paintBase()}paintBase(t){this.draw(i=>{(0,r.Sn)(i,this.size,t)})}paintImage(t,i){this.draw(e=>{(0,r.Md)(e,this.size,t,i)})}resize(){if(!this.element)return!1;let t=this.container,i=t.canvas._standardSize,e={width:this.element.offsetWidth,height:this.element.offsetHeight},s=t.retina.pixelRatio,a={width:e.width*s,height:e.height*s};if(e.height===i.height&&e.width===i.width&&a.height===this.element.height&&a.width===this.element.width)return!1;let r={...i};i.height=e.height,i.width=e.width;let n=this.size;return this.element.width=n.width=a.width,this.element.height=n.height=a.height,this.container.started&&t.particles.setResizeFactor({width:i.width/r.width,height:i.height/r.height}),!0}setPointerEvents(t){this.element&&(this._pointerEvents=t,this._repairStyle())}stop(){this._safeMutationObserver(t=>{t.disconnect()}),this._mutationObserver=void 0,this.draw(t=>{(0,r.IU)(t,this.size)})}async windowResize(){if(!this.element||!this.resize())return;let t=this.container,i=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}_applyPostDrawUpdaters=t=>{for(let i of this._postDrawUpdaters)i.afterDraw?.(t)};_applyPreDrawUpdaters=(t,i,e,s,r,n)=>{for(let h of this._preDrawUpdaters){if(h.getColorStyles){let{fill:a,stroke:n}=h.getColorStyles(i,t,e,s);a&&(r.fill=a),n&&(r.stroke=n)}if(h.getTransformValues){let t=h.getTransformValues(i);for(let i in t)!function(t,i,e){let s=i[e];void 0!==s&&(t[e]=(t[e]??a.zs)*s)}(n,t,i)}h.beforeDraw?.(i)}};_applyResizePlugins=()=>{for(let t of this._resizePlugins)t.resize?.()};_getPluginParticleColors=t=>{let i,e;for(let s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,h.R5)(this._engine,s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,h.R5)(this._engine,s.particleStrokeColor(t))),i&&e)break;return this._reusablePluginColors[0]=i,this._reusablePluginColors[1]=e,this._reusablePluginColors};_initStyle=()=>{let t=this.element,i=this.container.actualOptions;if(t)for(let e in this._fullScreen?this._setFullScreenStyle():this._resetOriginalStyle(),i.style){if(!e||!Object.hasOwn(i.style,e))continue;let s=i.style[e];s&&t.style.setProperty(e,s,"important")}};_repairStyle=()=>{let t=this.element;if(!t)return;this._safeMutationObserver(t=>{t.disconnect()}),this._initStyle(),this.initBackground();let i=this._pointerEvents;t.style.pointerEvents=i,t.setAttribute("pointer-events",i),this._safeMutationObserver(i=>{t instanceof Node&&i.observe(t,{attributes:!0})})};_resetOriginalStyle=()=>{let t=this.element,i=this._originalStyle;t&&i&&o(t,i,!0)};_safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)};_setFullScreenStyle=()=>{let t=this.element;t&&o(t,(0,n.hJ)(this.container.actualOptions.fullScreen.zIndex),!0)}}class c{container;_handlers;_resizeObserver;_resizeTimeout;constructor(t){this.container=t,this._handlers={visibilityChange:()=>{this._handleVisibilityChange()},resize:()=>{this._handleWindowResize()}}}addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}_handleVisibilityChange=()=>{let t=this.container;t.actualOptions.pauseOnBlur&&((0,n.T5)().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))};_handleWindowResize=()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout);let t=async()=>{let t=this.container.canvas;await t.windowResize()};this._resizeTimeout=setTimeout(()=>void t(),this.container.actualOptions.resize.delay*a.Xu)};_manageListeners=t=>{let i=this._handlers;this._manageResize(t),(0,n.Kp)(document,a.nK,i.visibilityChange,t,!1)};_manageResize=t=>{let i=this._handlers,e=this.container;if(!e.actualOptions.resize.enable)return;if("u"<typeof ResizeObserver)return void(0,n.Kp)(globalThis,a.NF,i.resize,t);let s=e.canvas.element;this._resizeObserver&&!t?(s&&this._resizeObserver.unobserve(s),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&s&&(this._resizeObserver=new ResizeObserver(t=>{t.find(t=>t.target===s)&&this._handleWindowResize()}),this._resizeObserver.observe(s))}}var d=e(299),p=e(6996),u=e(5398),_=e(2740),g=e(546),f=e(5045),P=e(8405),m=e(2679);function y(t){if(!(0,n.hn)(t.outMode,t.checkModes))return;let i=t.radius*a.gd;t.coord>t.maxCoord-i?t.setCb(-t.radius):t.coord<i&&t.setCb(t.radius)}class w{container;backColor;bubble;color;destroyed;direction;effect;effectClose;effectData;effectFill;group;id;ignoresResizeRatio;initialPosition;initialVelocity;isRotating;lastPathTime;misplaced;moveCenter;moveDecay;offset;opacity;options;outType;pathDelay;pathGenerator;pathRotation;position;randomIndexData;retina;roll;rotation;shape;shapeClose;shapeData;shapeFill;sides;size;slow;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;_cachedOpacityData={opacity:a.hv,strokeOpacity:a.hv};_cachedPosition=_.p.origin;_cachedRotateData={sin:0,cos:0};_cachedTransform={a:1,b:0,c:0,d:1};_engine;constructor(t,i){this.container=i,this._engine=t}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;let i=this.container,e=this.pathGenerator,s=this.shape?i.particles.shapeDrawers.get(this.shape):void 0;for(let e of(s?.particleDestroy?.(this),i.particleDestroyedPlugins))e.particleDestroyed?.(this,t);for(let e of i.particles.updaters)e.particleDestroyed?.(this,t);e?.reset(this),this._engine.dispatchEvent(d.B.particleDestroyed,{container:this.container,data:{particle:this}})}draw(t){let i=this.container.canvas;i.drawParticlePlugins(this,t),i.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:a.tA)}getFillColor(){return this._getRollColor(this.bubble.color??(0,h.O_)(this.color))}getMass(){return this.getRadius()**a.dm*Math.PI*a.MX}getOpacity(){let t=this.options.zIndex,i=a.RV-this.zIndexFactor,e=i**t.opacityRate,r=this.bubble.opacity??(0,s.VG)(this.opacity?.value??a.hv),n=this.strokeOpacity??r;return this._cachedOpacityData.opacity=r*e,this._cachedOpacityData.strokeOpacity=n*e,this._cachedOpacityData}getPosition(){return this._cachedPosition.x=this.position.x+this.offset.x,this._cachedPosition.y=this.position.y+this.offset.y,this._cachedPosition.z=this.position.z,this._cachedPosition}getRadius(){return this.bubble.radius??this.size.value}getRotateData(){let t=this.getAngle();return this._cachedRotateData.sin=Math.sin(t),this._cachedRotateData.cos=Math.cos(t),this._cachedRotateData}getStrokeColor(){return this._getRollColor(this.bubble.color??(0,h.O_)(this.strokeColor))}getTransformData(t){let i=this.getRotateData(),e=this.isRotating;return this._cachedTransform.a=i.cos*(t.a??a.Ug.a),this._cachedTransform.b=e?i.sin*(t.b??a.D_):t.b??a.Ug.b,this._cachedTransform.c=e?-i.sin*(t.c??a.D_):t.c??a.Ug.c,this._cachedTransform.d=i.cos*(t.d??a.Ug.d),this._cachedTransform}init(t,i,e,r){var h,o,l,c;let d,p,u,_,g=this.container;this.id=t,this.group=r,this.effectClose=!0,this.effectFill=!0,this.shapeClose=!0,this.shapeFill=!0,this.pathRotation=!1,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.isRotating=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType=P.x.normal,this.ignoresResizeRatio=!0;let f=g.retina.pixelRatio,y=g.actualOptions,w=(0,m.y)(this._engine,g,y.particles),v=w.reduceDuplicates,b=w.effect.type,z=w.shape.type;this.effect=(0,n.TA)(b,this.id,v),this.shape=(0,n.TA)(z,this.id,v);let S=w.effect,C=w.shape;if(e){if(e.effect?.type){let t=e.effect.type,i=(0,n.TA)(t,this.id,v);i&&(this.effect=i,S.load(e.effect))}if(e.shape?.type){let t=e.shape.type,i=(0,n.TA)(t,this.id,v);i&&(this.shape=i,C.load(e.shape))}}if(this.effect===a.mR){let t=[...this.container.particles.effectDrawers.keys()];this.effect=t[Math.floor((0,s.G0)()*t.length)]}if(this.shape===a.mR){let t=[...this.container.particles.shapeDrawers.keys()];this.shape=t[Math.floor((0,s.G0)()*t.length)]}this.effectData=this.effect?(h=this.effect,o=this.id,u=S.options[h],(0,n.zw)({close:S.close,fill:S.fill},(0,n.TA)(u,o,v))):void 0,this.shapeData=this.shape?(l=this.shape,c=this.id,_=C.options[l],(0,n.zw)({close:C.close,fill:C.fill},(0,n.TA)(_,c,v))):void 0,w.load(e);let D=this.effectData;D&&w.load(D.particles);let x=this.shapeData;x&&w.load(x.particles),this.effectFill=D?.fill??w.effect.fill,this.effectClose=D?.close??w.effect.close,this.shapeFill=x?.fill??w.shape.fill,this.shapeClose=x?.close??w.shape.close,this.options=w;let R=this.options.move.path;if(this.pathDelay=(0,s.VG)(R.delay.value)*a.Xu,R.generator){let t=this.container.particles.pathGenerators.get(R.generator);!t&&(t=this.container.particles.availablePathGenerators.get(R.generator))&&(this.container.particles.pathGenerators.set(R.generator,t),t.init()),this.pathGenerator=t}g.retina.initParticle(this),this.size=(0,n.Xs)(this.options.size,f),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(i),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy(),this.moveDecay=a.WH-(0,s.VG)(this.options.move.decay);let O=g.particles;O.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/g.zLayers,this.sides=24,this.effect&&(d=g.particles.effectDrawers.get(this.effect)),d?.loadEffect&&d.loadEffect(this),this.shape&&(p=g.particles.shapeDrawers.get(this.shape)),p?.loadShape&&p.loadShape(this);let M=p?.getSidesCount;for(let t of(M&&(this.sides=M(this)),this.spawning=!1,O.updaters))t.init(this);for(let t of O.movers)t.init(this);for(let t of(d?.particleInit?.(g,this),p?.particleInit?.(g,this),g.particleCreatedPlugins))t.particleCreated?.(this)}isInsideCanvas(){let t=this.getRadius(),i=this.container.canvas.size,e=this.position;return e.x>=-t&&e.y>=-t&&e.y<=i.height+t&&e.x<=i.width+t}isShowingBack(){if(!this.roll)return!1;let t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){let i=t%a.R1,e=i<a.tA?i+a.R1:i;return e>=Math.PI*a.MX&&e<Math.PI*a.Nu*a.MX}if(this.roll.horizontal){let i=(t+Math.PI*a.MX)%(Math.PI*a.gd),e=i<a.tA?i+Math.PI*a.gd:i;return e>=Math.PI&&e<Math.PI*a.gd}if(this.roll.vertical){let i=t%(Math.PI*a.gd),e=i<a.tA?i+Math.PI*a.gd:i;return e>=Math.PI&&e<Math.PI*a.gd}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(let t of this.container.particles.updaters)t.reset?.(this)}_calcPosition=(t,i)=>{let e=a.rq,r=t?_.p.create(t.x,t.y,i):void 0,n=this.container,h=n.particlePositionPlugins,o=this.options.move.outModes,l=this.getRadius(),c=n.canvas.size,{signal:d}=new AbortController;for(;!d.aborted;){for(let t of h){let e=t.particlePosition?.(r,this);if(e)return _.p.create(e.x,e.y,i)}let t=(0,s.Nx)({size:c,position:r}),d=_.p.create(t.x,t.y,i);this._fixHorizontal(d,l,o.left??o.default),this._fixHorizontal(d,l,o.right??o.default),this._fixVertical(d,l,o.top??o.default),this._fixVertical(d,l,o.bottom??o.default);let p=!0;for(let t of n.particles.checkParticlePositionPlugins)if(!(p=t.checkParticlePosition?.(this,d,e)??!0))break;if(p)return d;e+=a.Eo,r=void 0}return r};_calculateVelocity=()=>{let t=(0,s.$m)(this.direction).copy(),i=this.options.move;if(i.direction===g.F.inside||i.direction===g.F.outside)return t;let e=(0,s.pu)((0,s.VG)(i.angle.value)),r=(0,s.pu)((0,s.VG)(i.angle.offset)),n={left:r-e*a.MX,right:r+e*a.MX};return i.straight||(t.angle+=(0,s.vE)((0,s.DT)(n.left,n.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,s.G0)()),t};_fixHorizontal=(t,i,e)=>{y({outMode:e,checkModes:[f.Y.bounce],coord:t.x,maxCoord:this.container.canvas.size.width,setCb:i=>t.x+=i,radius:i})};_fixVertical=(t,i,e)=>{y({outMode:e,checkModes:[f.Y.bounce],coord:t.y,maxCoord:this.container.canvas.size.height,setCb:i=>t.y+=i,radius:i})};_getRollColor=t=>t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?(0,r.yx)(t,this.roll.alter.type,this.roll.alter.value):t:t;_initPosition=t=>{let i=this.container,e=(0,s.VG)(this.options.zIndex.value),r=this._calcPosition(t,(0,s.qE)(e,a.X_,i.zLayers));if(!r)throw Error("a valid position cannot be found for particle");this.position=r,this.initialPosition=this.position.copy();let h=i.canvas.size;switch(this.moveCenter={...(0,n.E9)(this.options.move.center,h),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=(0,s.JY)(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case g.F.inside:this.outType=P.x.inside;break;case g.F.outside:this.outType=P.x.outside}this.offset=_.M.origin}}var v=e(8150),b=e(5668);class z{rectangle;capacity;_divided;_points;_subs;constructor(t,i){this.rectangle=t,this.capacity=i,this._points=[],this._divided=!1,this._subs=[]}insert(t){return!!this.rectangle.contains(t.position)&&(this._points.length<this.capacity?(this._points.push(t),!0):(this._divided||this._subdivide(),this._subs.some(i=>i.insert(t))))}query(t,i){let e=[];if(!t.intersects(this.rectangle))return[];for(let a of this._points)!t.contains(a.position)&&(0,s.Yf)(t.position,a.position)>a.particle.getRadius()&&(!i||i(a.particle))||e.push(a.particle);if(this._divided)for(let s of this._subs)e.push(...s.query(t,i));return e}queryCircle(t,i,e){return this.query(new b.jl(t.x,t.y,i),e)}queryRectangle(t,i,e){return this.query(new b.M_(t.x,t.y,i.width,i.height),e)}_subdivide=()=>{let{x:t,y:i}=this.rectangle.position,{width:e,height:s}=this.rectangle.size,{capacity:r}=this;for(let n=0;n<a.Pg;n++){let h=n%a.gd;this._subs.push(new z(new b.M_(t+e*a.MX*h,i+s*a.MX*(Math.round(n*a.MX)-h),e*a.MX,s*a.MX),r))}this._divided=!0}}var S=e(8963);let C=t=>{let{height:i,width:e}=t;return new b.M_(a.un*e,a.un*i,a.Rh*e,a.Rh*i)};class D{availablePathGenerators;checkParticlePositionPlugins;effectDrawers;movers;pathGenerators;quadTree;shapeDrawers;updaters;_array;_container;_engine;_groupLimits;_limit;_maxZIndex;_minZIndex;_needsSort;_nextId;_particleResetPlugins;_particleUpdatePlugins;_pool;_postParticleUpdatePlugins;_postUpdatePlugins;_resizeFactor;_updatePlugins;_zArray;constructor(t,i){this._engine=t,this._container=i,this._nextId=0,this._array=[],this._zArray=[],this._pool=[],this._limit=0,this._groupLimits=new Map,this._needsSort=!1,this._minZIndex=0,this._maxZIndex=0;const e=i.canvas.size;this.quadTree=new z(C(e),a.Kw),this.effectDrawers=new Map,this.movers=[],this.availablePathGenerators=new Map,this.pathGenerators=new Map,this.shapeDrawers=new Map,this.updaters=[],this.checkParticlePositionPlugins=[],this._particleResetPlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._postParticleUpdatePlugins=[],this._updatePlugins=[]}get count(){return this._array.length}addParticle(t,i,e,s){let r=this._container.actualOptions.particles.number.limit.mode,n=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,h=this.count;if(n>a.ou)switch(r){case u.d.delete:{let t=h+a.nq-n;t>a.wM&&this.removeQuantity(t);break}case u.d.wait:if(h>=n)return}try{let a=this._pool.pop()??new w(this._engine,this._container);a.init(this._nextId,t,i,e);let r=!0;if(s&&(r=s(a)),!r)return void this._pool.push(a);return this._array.push(a),this._zArray.push(a),this._nextId++,this._engine.dispatchEvent(d.B.particleAdded,{container:this._container,data:{particle:a}}),a}catch(t){(0,S.t)().warning(`error adding particle: ${t}`)}}clear(){this._array=[],this._zArray=[]}destroy(){let t=this._container;for(let[,i]of this.effectDrawers)i.destroy?.(t);for(let[,i]of this.shapeDrawers)i.destroy?.(t);this._array=[],this._pool.length=0,this._zArray=[],this.effectDrawers=new Map,this.movers=[],this.availablePathGenerators=new Map,this.pathGenerators=new Map,this.shapeDrawers=new Map,this.updaters=[],this.checkParticlePositionPlugins=[],this._particleResetPlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._postParticleUpdatePlugins=[],this._updatePlugins=[]}drawParticles(t){for(let i of this._zArray)i.draw(t)}filter(t){return this._array.filter(t)}find(t){return this._array.find(t)}get(t){return this._array[t]}async init(){let t=this._container,i=t.actualOptions;for(let i of(this._minZIndex=0,this._maxZIndex=0,this._needsSort=!1,this.checkParticlePositionPlugins=[],this._updatePlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._particleResetPlugins=[],this._postParticleUpdatePlugins=[],t.plugins))i.redrawInit&&await i.redrawInit(),i.checkParticlePosition&&this.checkParticlePositionPlugins.push(i),i.update&&this._updatePlugins.push(i),i.particleUpdate&&this._particleUpdatePlugins.push(i),i.postUpdate&&this._postUpdatePlugins.push(i),i.particleReset&&this._particleResetPlugins.push(i),i.postParticleUpdate&&this._postParticleUpdatePlugins.push(i);for(let i of(await this.initPlugins(),this.effectDrawers.values()))await i.init?.(t);for(let i of this.shapeDrawers.values())await i.init?.(t);let e=!1;for(let i of t.plugins)if(e=i.particlesInitialization?.()??e)break;if(!e){let t=i.particles,e=t.groups;for(let i in e){let s=e[i];if(s)for(let e=this.count,a=0;a<s.number.value&&e<t.number.value;e++,a++)this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)this.addParticle()}}async initPlugins(){let t=this._container;for(let i of(this.effectDrawers=await this._engine.getEffectDrawers(t,!0),this.movers=await this._engine.getMovers(t,!0),this.availablePathGenerators=await this._engine.getPathGenerators(t,!0),this.pathGenerators=new Map,this.shapeDrawers=await this._engine.getShapeDrawers(t,!0),this.updaters=await this._engine.getUpdaters(t,!0),this.pathGenerators.values()))i.init()}push(t,i,e,s){for(let a=0;a<t;a++)this.addParticle(i,e,s)}async redraw(){this.clear(),await this.init(),this._container.canvas.drawParticles({value:0,factor:0})}remove(t,i,e){this.removeAt(this._array.indexOf(t),void 0,i,e)}removeAt(t,i=a.xd,e,s){if(t<a.z9||t>this.count)return;let r=0;for(let a=t;r<i&&a<this.count;a++)this._removeParticle(a,e,s)&&(a--,r++)}removeQuantity(t,i){this.removeAt(a.z9,t,i)}setDensity(){let t=this._container.actualOptions,i=t.particles.groups,e=0;for(let t of this._container.plugins)t.particlesDensityCount&&(e+=t.particlesDensityCount());for(let t in i){let s=i[t];if(!s)continue;let a=(0,m.y)(this._engine,this._container,s);this._applyDensity(a,e,t)}this._applyDensity(t.particles,e)}setLastZIndex(t){this._needsSort||=t>=this._maxZIndex||t>this._minZIndex&&t<this._maxZIndex}setResizeFactor(t){this._resizeFactor=t}update(t){let i=this._container,e=new Set;for(let t of(this.quadTree=new z(C(i.canvas.size),a.Kw),this.pathGenerators.values()))t.update();for(let i of this._updatePlugins)i.update?.(t);let s=this._resizeFactor;for(let i of this._array){for(let t of(s&&!i.ignoresResizeRatio&&(i.position.x*=s.width,i.position.y*=s.height,i.initialPosition.x*=s.width,i.initialPosition.y*=s.height),i.ignoresResizeRatio=!1,this._particleResetPlugins))t.particleReset?.(i);for(let e of this._particleUpdatePlugins){if(i.destroyed)break;e.particleUpdate?.(i,t)}for(let e of this.movers)e.isEnabled(i)&&e.move(i,t);if(i.destroyed){e.add(i);continue}this.quadTree.insert(new v.b(i.getPosition(),i))}if(e.size){let t=t=>!e.has(t);for(let i of(this._array=this.filter(t),this._zArray=this._zArray.filter(t),e))this._engine.dispatchEvent(d.B.particleRemoved,{container:this._container,data:{particle:i}});this._addToPool(...e)}for(let i of this._postUpdatePlugins)i.postUpdate?.(t);for(let i of this._array){for(let e of this.updaters)e.update(i,t);if(!i.destroyed&&!i.spawning)for(let e of this._postParticleUpdatePlugins)e.postParticleUpdate?.(i,t)}if(delete this._resizeFactor,this._needsSort){let t=this._zArray;t.sort((t,i)=>i.position.z-t.position.z||t.id-i.id);let i=t[a.z9],e=t[t.length-a.K3];if(!i||!e)return;this._maxZIndex=i.position.z,this._minZIndex=e.position.z,this._needsSort=!1}}_addToPool=(...t)=>{this._pool.push(...t)};_applyDensity=(t,i,e,s)=>{let r=t.number;if(!r.density.enable)return void(void 0===e?this._limit=r.limit.value:(s?.number.limit.value??r.limit.value)&&this._groupLimits.set(e,s?.number.limit.value??r.limit.value));let n=this._initDensityFactor(r.density),h=r.value,o=r.limit.value>a.ou?r.limit.value:h,l=Math.min(h,o)*n+i,c=Math.min(this.count,this.filter(t=>t.group===e).length);void 0===e?this._limit=r.limit.value*n:this._groupLimits.set(e,r.limit.value*n),c<l?this.push(Math.abs(l-c),void 0,t,e):c>l&&this.removeQuantity(c-l,e)};_initDensityFactor=t=>{let i=this._container;if(!i.canvas.element||!t.enable)return a.lA;let e=i.canvas.element,s=i.retina.pixelRatio;return e.width*e.height/(t.height*t.width*s**a.dm)};_removeParticle=(t,i,e)=>{let s=this._array[t];if(!s||s.group!==i)return!1;let r=this._zArray.indexOf(s);return this._array.splice(t,a.LD),this._zArray.splice(r,a.LD),s.destroy(e),this._engine.dispatchEvent(d.B.particleRemoved,{container:this._container,data:{particle:s}}),this._addToPool(s),!0}}class x{container;maxSpeed;pixelRatio;reduceFactor;sizeAnimationSpeed;constructor(t){this.container=t,this.pixelRatio=a.$x,this.reduceFactor=a.Zp}init(){let t=this.container,i=t.actualOptions;this.pixelRatio=i.detectRetina?devicePixelRatio:a.$x,this.reduceFactor=a.Zp;let e=this.pixelRatio,r=t.canvas;if(r.element){let t=r.element;r.size.width=t.offsetWidth*e,r.size.height=t.offsetHeight*e}let n=i.particles,h=n.move;this.maxSpeed=(0,s.VG)(h.gravity.maxSpeed)*e,this.sizeAnimationSpeed=(0,s.VG)(n.size.animation.speed)*e}initParticle(t){let i=t.options,e=this.pixelRatio,a=i.move,r=a.distance,n=t.retina;n.moveDrift=(0,s.VG)(a.drift)*e,n.moveSpeed=(0,s.VG)(a.speed)*e,n.sizeAnimationSpeed=(0,s.VG)(i.size.animation.speed)*e;let h=n.maxDistance;h.horizontal=void 0!==r.horizontal?r.horizontal*e:void 0,h.vertical=void 0!==r.vertical?r.vertical*e:void 0,n.maxSpeed=(0,s.VG)(a.gravity.maxSpeed)*e}}function R(t){return!t.destroyed}function O(t,i,...e){let s=new p.J(t,i);return(0,m.Z)(s,...e),s}class M{actualOptions;canvas;destroyed;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particles;plugins;retina;started;zLayers;_delay;_delayTimeout;_delta={value:0,factor:0};_drawAnimationFrame;_duration;_engine;_eventListeners;_firstStart;_initialSourceOptions;_lastFrameTime;_lifeTime;_options;_paused;_smooth;_sourceOptions;constructor(t,i,e){this._engine=t,this.id=Symbol(i),this.fpsLimit=120,this.hdr=!1,this._smooth=!1,this._delay=0,this._duration=0,this._lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this._lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=e,this._initialSourceOptions=e,this.retina=new x(this),this.canvas=new l(this,this._engine),this.particles=new D(this._engine,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this._options=O(this._engine,this),this.actualOptions=O(this._engine,this),this._eventListeners=new c(this),this._engine.dispatchEvent(d.B.containerBuilt,{container:this})}get animationStatus(){return!this._paused&&!this.pageHidden&&R(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addLifeTime(t){this._lifeTime+=t}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(t=!0){if(R(this)){for(let t of(this.stop(),this.particles.destroy(),this.canvas.destroy(),this.plugins))t.destroy?.();if(this.plugins.length=0,this._engine.clearPlugins(this),this.destroyed=!0,t){let t=this._engine.items,i=t.indexOf(this);i>=a.vF&&t.splice(i,a.JC)}this._engine.dispatchEvent(d.B.containerDestroyed,{container:this})}}draw(t){if(!R(this))return;let i=t,e=t=>{i&&(this._lastFrameTime=void 0,i=!1),this._nextFrame(t)};this._drawAnimationFrame=(0,s.i0)(t=>{e(t)})}async export(t,i={}){for(let e of this.plugins){if(!e.export)continue;let s=await e.export(t,i);if(s.supported)return s.blob}(0,S.t)().error(`Export plugin with type ${t} not found`)}async init(){if(!R(this))return;let t=new Map;for(let i of this._engine.plugins){let e=await i.getPlugin(this);e.preInit&&await e.preInit(),t.set(i,e)}for(let[i,e]of(await this.particles.initPlugins(),this._options=O(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=O(this._engine,this,this._options),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0,t))i.needsPlugin(this.actualOptions)&&(this.plugins.push(e),e.particleCreated&&this.particleCreatedPlugins.push(e),e.particleDestroyed&&this.particleDestroyedPlugins.push(e),e.particlePosition&&this.particlePositionPlugins.push(e));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();let{delay:i,duration:e,fpsLimit:r,hdr:n,smooth:h,zLayers:o}=this.actualOptions;for(let t of(this.hdr=n,this.zLayers=o,this._duration=(0,s.VG)(e)*a.Xu,this._delay=(0,s.VG)(i)*a.Xu,this._lifeTime=0,this.fpsLimit=r>a.DN?r:a.i8,this._smooth=h,this.plugins))await t.init?.();for(let t of(await this.particles.init(),this._engine.dispatchEvent(d.B.containerInit,{container:this}),this.particles.setDensity(),this.plugins))t.particlesSetup?.();this._engine.dispatchEvent(d.B.particlesSetup,{container:this})}pause(){if(R(this)&&(void 0!==this._drawAnimationFrame&&((0,s.px)(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(let t of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent(d.B.containerPaused,{container:this})}}play(t){if(!R(this))return;let i=this._paused||t;if(this._firstStart&&!this.actualOptions.autoPlay){this._firstStart=!1;return}if(this._paused&&(this._paused=!1),i)for(let t of this.plugins)t.play&&t.play();this._engine.dispatchEvent(d.B.containerPlay,{container:this}),this.draw(i??!1)}async refresh(){if(R(this))return this.stop(),this.start()}async reset(t){if(R(this))return this._initialSourceOptions=t,this._sourceOptions=t,this._options=O(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=O(this._engine,this,this._options),this.refresh()}async start(){R(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise(t=>{let i=async()=>{for(let t of(this._eventListeners.addListeners(),this.plugins))await t.start?.();this._engine.dispatchEvent(d.B.containerStarted,{container:this}),this.play(),t()};this._delayTimeout=setTimeout(()=>void i(),this._delay)}))}stop(){if(R(this)&&this.started){for(let t of(this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop(),this.plugins))t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this._sourceOptions=this._options,this._engine.dispatchEvent(d.B.containerStopped,{container:this})}}updateActualOptions(){let t=!1;for(let i of this.plugins)i.updateActualOptions&&(t=i.updateActualOptions()||t);return t}_nextFrame=t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+a.Xu/this.fpsLimit||(this._lastFrameTime??=t,!function(t,i,e=a.z$,s=!1){t.value=i,t.factor=s?a.z$/e:a.z$*i/a.Xu}(this._delta,t-this._lastFrameTime,this.fpsLimit,this._smooth),this.addLifeTime(this._delta.value),this._lastFrameTime=t,this._delta.value>a.Xu))return void this.draw(!1);if(this.canvas.drawParticles(this._delta),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,S.t)().error("error in animation loop",t)}}}}}]);
package/README.md CHANGED
@@ -295,7 +295,7 @@ tsParticles.setOnClickHandler((event, particles) => {
295
295
  // now you can control the animations too, it's possible to pause and resume the animations
296
296
  // these methods don't change the config so you're safe with all your configurations
297
297
  // domItem(0) returns the first tsParticles instance loaded in the dom
298
- const particles = tsParticles.domItem(0);
298
+ const particles = tsParticles.item(0);
299
299
 
300
300
  // play will start the animations, if the move is not enabled it won't enable it, it just updates the frame
301
301
  particles.play();
@@ -755,6 +755,7 @@ flowchart TD
755
755
  interaction-external-bubble[Bubble]
756
756
  interaction-external-connect[Connect]
757
757
  interaction-external-grab[Grab]
758
+ interaction-external-parallax[Parallax]
758
759
  interaction-external-pause[Pause]
759
760
  interaction-external-push[Push]
760
761
  interaction-external-remove[Remove]
@@ -770,10 +771,6 @@ flowchart TD
770
771
 
771
772
  end
772
773
 
773
- subgraph slim-movers [Movers]
774
- move-parallax[Parallax]
775
- end
776
-
777
774
  subgraph slim-plugins [Plugins]
778
775
 
779
776
  subgraph slim-plugins-easings [Easings]
@@ -1,7 +1,8 @@
1
- import { clear, clearDrawPlugin, drawParticle, drawParticlePlugin, drawPlugin, paintBase, paintImage, } from "../Utils/CanvasUtils.js";
1
+ import { clear, drawParticle, drawParticlePlugin, paintBase, paintImage } from "../Utils/CanvasUtils.js";
2
2
  import { cloneStyle, getFullScreenStyle, safeMatchMedia, safeMutationObserver } from "../Utils/Utils.js";
3
- import { defaultOpacity, defaultTransformValue, generatedAttribute, minimumSize, zIndexFactorOffset, } from "./Utils/Constants.js";
3
+ import { defaultTransformValue, generatedAttribute, minimumSize, zIndexFactorOffset } from "./Utils/Constants.js";
4
4
  import { getStyleFromHsl, getStyleFromRgb, rangeColorToHsl, rangeColorToRgb } from "../Utils/ColorUtils.js";
5
+ const fColorIndex = 0, sColorIndex = 1;
5
6
  function setTransformValue(factor, newFactor, key) {
6
7
  const newValue = newFactor[key];
7
8
  if (newValue !== undefined) {
@@ -38,115 +39,35 @@ function setStyle(canvas, style, important = false) {
38
39
  }
39
40
  }
40
41
  export class Canvas {
42
+ container;
43
+ element;
44
+ size;
45
+ _canvasClearPlugins;
46
+ _canvasPaintPlugins;
47
+ _canvasSettings;
48
+ _clearDrawPlugins;
49
+ _colorPlugins;
50
+ _context;
51
+ _drawParticlePlugins;
52
+ _drawParticlesCleanupPlugins;
53
+ _drawParticlesSetupPlugins;
54
+ _drawPlugins;
55
+ _drawSettingsCleanupPlugins;
56
+ _drawSettingsSetupPlugins;
57
+ _engine;
58
+ _generated;
59
+ _mutationObserver;
60
+ _originalStyle;
61
+ _pointerEvents;
62
+ _postDrawUpdaters;
63
+ _preDrawUpdaters;
64
+ _resizePlugins;
65
+ _reusableColorStyles = {};
66
+ _reusablePluginColors = [undefined, undefined];
67
+ _reusableTransform = {};
68
+ _standardSize;
41
69
  constructor(container, engine) {
42
70
  this.container = container;
43
- this._applyPostDrawUpdaters = particle => {
44
- for (const updater of this._postDrawUpdaters) {
45
- updater.afterDraw?.(particle);
46
- }
47
- };
48
- this._applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
49
- for (const updater of this._preDrawUpdaters) {
50
- if (updater.getColorStyles) {
51
- const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
52
- if (fill) {
53
- colorStyles.fill = fill;
54
- }
55
- if (stroke) {
56
- colorStyles.stroke = stroke;
57
- }
58
- }
59
- if (updater.getTransformValues) {
60
- const updaterTransform = updater.getTransformValues(particle);
61
- for (const key in updaterTransform) {
62
- setTransformValue(transform, updaterTransform, key);
63
- }
64
- }
65
- updater.beforeDraw?.(particle);
66
- }
67
- };
68
- this._applyResizePlugins = () => {
69
- for (const plugin of this._resizePlugins) {
70
- plugin.resize?.();
71
- }
72
- };
73
- this._getPluginParticleColors = particle => {
74
- let fColor, sColor;
75
- for (const plugin of this._colorPlugins) {
76
- if (!fColor && plugin.particleFillColor) {
77
- fColor = rangeColorToHsl(this._engine, plugin.particleFillColor(particle));
78
- }
79
- if (!sColor && plugin.particleStrokeColor) {
80
- sColor = rangeColorToHsl(this._engine, plugin.particleStrokeColor(particle));
81
- }
82
- if (fColor && sColor) {
83
- break;
84
- }
85
- }
86
- return [fColor, sColor];
87
- };
88
- this._initStyle = () => {
89
- const element = this.element, options = this.container.actualOptions;
90
- if (!element) {
91
- return;
92
- }
93
- if (this._fullScreen) {
94
- this._setFullScreenStyle();
95
- }
96
- else {
97
- this._resetOriginalStyle();
98
- }
99
- for (const key in options.style) {
100
- if (!key || !Object.prototype.hasOwnProperty.call(options.style, key)) {
101
- continue;
102
- }
103
- const value = options.style[key];
104
- if (!value) {
105
- continue;
106
- }
107
- element.style.setProperty(key, value, "important");
108
- }
109
- };
110
- this._repairStyle = () => {
111
- const element = this.element;
112
- if (!element) {
113
- return;
114
- }
115
- this._safeMutationObserver(observer => {
116
- observer.disconnect();
117
- });
118
- this._initStyle();
119
- this.initBackground();
120
- const pointerEvents = this._pointerEvents;
121
- element.style.pointerEvents = pointerEvents;
122
- element.setAttribute("pointer-events", pointerEvents);
123
- this._safeMutationObserver(observer => {
124
- if (!(element instanceof Node)) {
125
- return;
126
- }
127
- observer.observe(element, { attributes: true });
128
- });
129
- };
130
- this._resetOriginalStyle = () => {
131
- const element = this.element, originalStyle = this._originalStyle;
132
- if (!element || !originalStyle) {
133
- return;
134
- }
135
- setStyle(element, originalStyle, true);
136
- };
137
- this._safeMutationObserver = callback => {
138
- if (!this._mutationObserver) {
139
- return;
140
- }
141
- callback(this._mutationObserver);
142
- };
143
- this._setFullScreenStyle = () => {
144
- const element = this.element;
145
- if (!element) {
146
- return;
147
- }
148
- setStyle(element, getFullScreenStyle(this.container.actualOptions.fullScreen.zIndex), true);
149
- };
150
71
  this._engine = engine;
151
72
  this._standardSize = {
152
73
  height: 0,
@@ -163,8 +84,20 @@ export class Canvas {
163
84
  this._postDrawUpdaters = [];
164
85
  this._resizePlugins = [];
165
86
  this._colorPlugins = [];
87
+ this._canvasClearPlugins = [];
88
+ this._canvasPaintPlugins = [];
89
+ this._clearDrawPlugins = [];
90
+ this._drawParticlePlugins = [];
91
+ this._drawParticlesCleanupPlugins = [];
92
+ this._drawParticlesSetupPlugins = [];
93
+ this._drawPlugins = [];
94
+ this._drawSettingsSetupPlugins = [];
95
+ this._drawSettingsCleanupPlugins = [];
166
96
  this._pointerEvents = "none";
167
97
  }
98
+ get settings() {
99
+ return this._canvasSettings;
100
+ }
168
101
  get _fullScreen() {
169
102
  return this.container.actualOptions.fullScreen.enable;
170
103
  }
@@ -178,9 +111,10 @@ export class Canvas {
178
111
  }
179
112
  clear() {
180
113
  let pluginHandled = false;
181
- for (const plugin of this.container.plugins.values()) {
182
- if (!pluginHandled && plugin.canvasClear) {
183
- pluginHandled = plugin.canvasClear();
114
+ for (const plugin of this._canvasClearPlugins) {
115
+ pluginHandled = plugin.canvasClear?.() ?? false;
116
+ if (pluginHandled) {
117
+ break;
184
118
  }
185
119
  }
186
120
  if (pluginHandled) {
@@ -188,11 +122,6 @@ export class Canvas {
188
122
  }
189
123
  this.canvasClear();
190
124
  }
191
- clearDrawPlugin(plugin, delta) {
192
- this.draw(ctx => {
193
- clearDrawPlugin(ctx, plugin, delta);
194
- });
195
- }
196
125
  destroy() {
197
126
  this.stop();
198
127
  if (this._generated) {
@@ -207,6 +136,15 @@ export class Canvas {
207
136
  this._postDrawUpdaters = [];
208
137
  this._resizePlugins = [];
209
138
  this._colorPlugins = [];
139
+ this._canvasClearPlugins = [];
140
+ this._canvasPaintPlugins = [];
141
+ this._clearDrawPlugins = [];
142
+ this._drawParticlePlugins = [];
143
+ this._drawParticlesCleanupPlugins = [];
144
+ this._drawParticlesSetupPlugins = [];
145
+ this._drawPlugins = [];
146
+ this._drawSettingsSetupPlugins = [];
147
+ this._drawSettingsCleanupPlugins = [];
210
148
  }
211
149
  draw(cb) {
212
150
  const ctx = this._context;
@@ -230,22 +168,15 @@ export class Canvas {
230
168
  if (!fColor && !sColor) {
231
169
  return;
232
170
  }
233
- const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = particle.bubble.opacity ?? particle.opacity?.value ?? defaultOpacity, strokeOpacity = particle.strokeOpacity ?? opacity, zOpacity = opacity * zOpacityFactor, zStrokeOpacity = strokeOpacity * zOpacityFactor, transform = {}, getFillStyle = () => {
234
- if (!fColor) {
235
- return;
236
- }
237
- return getStyleFromHsl(fColor, container.hdr, zOpacity);
238
- }, colorStyles = {
239
- fill: getFillStyle(),
240
- }, getStrokestyle = () => {
241
- if (!sColor) {
242
- return colorStyles.fill;
243
- }
244
- return getStyleFromHsl(sColor, container.hdr, zStrokeOpacity);
245
- };
246
- colorStyles.stroke = getStrokestyle();
171
+ const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? getStyleFromHsl(fColor, container.hdr, opacity) : undefined, stroke = sColor ? getStyleFromHsl(sColor, container.hdr, strokeOpacity) : fill;
172
+ transform.a = transform.b = transform.c = transform.d = undefined;
173
+ colorStyles.fill = fill;
174
+ colorStyles.stroke = stroke;
247
175
  this.draw((context) => {
248
- this._applyPreDrawUpdaters(context, particle, radius, zOpacity, colorStyles, transform);
176
+ for (const plugin of this._drawParticlesSetupPlugins) {
177
+ plugin.drawParticleSetup?.(context, particle, delta);
178
+ }
179
+ this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);
249
180
  drawParticle({
250
181
  container,
251
182
  context,
@@ -253,34 +184,40 @@ export class Canvas {
253
184
  delta,
254
185
  colorStyles,
255
186
  radius: radius * zIndexFactor ** zIndexOptions.sizeRate,
256
- opacity: zOpacity,
187
+ opacity: opacity,
257
188
  transform,
258
189
  });
190
+ this._applyPostDrawUpdaters(particle);
191
+ for (const plugin of this._drawParticlesCleanupPlugins) {
192
+ plugin.drawParticleCleanup?.(context, particle, delta);
193
+ }
259
194
  });
260
- this._applyPostDrawUpdaters(particle);
261
195
  }
262
- drawParticlePlugin(plugin, particle, delta) {
196
+ drawParticlePlugins(particle, delta) {
263
197
  this.draw(ctx => {
264
- drawParticlePlugin(ctx, plugin, particle, delta);
198
+ for (const plugin of this._drawParticlePlugins) {
199
+ drawParticlePlugin(ctx, plugin, particle, delta);
200
+ }
265
201
  });
266
202
  }
267
203
  drawParticles(delta) {
268
- const { particles, plugins } = this.container;
204
+ const { particles } = this.container;
269
205
  this.clear();
270
206
  particles.update(delta);
271
- for (const plugin of plugins.values()) {
272
- this.drawPlugin(plugin, delta);
273
- }
274
- this.draw(() => {
275
- particles.drawParticles(delta);
276
- });
277
- for (const plugin of plugins.values()) {
278
- this.clearDrawPlugin(plugin, delta);
279
- }
280
- }
281
- drawPlugin(plugin, delta) {
282
207
  this.draw(ctx => {
283
- drawPlugin(ctx, plugin, delta);
208
+ for (const plugin of this._drawSettingsSetupPlugins) {
209
+ plugin.drawSettingsSetup?.(ctx, delta);
210
+ }
211
+ for (const plugin of this._drawPlugins) {
212
+ plugin.draw?.(ctx, delta);
213
+ }
214
+ particles.drawParticles(delta);
215
+ for (const plugin of this._clearDrawPlugins) {
216
+ plugin.clearDraw?.(ctx, delta);
217
+ }
218
+ for (const plugin of this._drawSettingsCleanupPlugins) {
219
+ plugin.drawSettingsCleanup?.(ctx, delta);
220
+ }
284
221
  });
285
222
  }
286
223
  init() {
@@ -326,13 +263,50 @@ export class Canvas {
326
263
  }
327
264
  initPlugins() {
328
265
  this._resizePlugins = [];
329
- for (const plugin of this.container.plugins.values()) {
266
+ this._colorPlugins = [];
267
+ this._canvasClearPlugins = [];
268
+ this._canvasPaintPlugins = [];
269
+ this._clearDrawPlugins = [];
270
+ this._drawParticlePlugins = [];
271
+ this._drawParticlesSetupPlugins = [];
272
+ this._drawParticlesCleanupPlugins = [];
273
+ this._drawPlugins = [];
274
+ this._drawSettingsSetupPlugins = [];
275
+ this._drawSettingsCleanupPlugins = [];
276
+ for (const plugin of this.container.plugins) {
330
277
  if (plugin.resize) {
331
278
  this._resizePlugins.push(plugin);
332
279
  }
333
280
  if (plugin.particleFillColor ?? plugin.particleStrokeColor) {
334
281
  this._colorPlugins.push(plugin);
335
282
  }
283
+ if (plugin.canvasClear) {
284
+ this._canvasClearPlugins.push(plugin);
285
+ }
286
+ if (plugin.canvasPaint) {
287
+ this._canvasPaintPlugins.push(plugin);
288
+ }
289
+ if (plugin.drawParticle) {
290
+ this._drawParticlePlugins.push(plugin);
291
+ }
292
+ if (plugin.drawParticleSetup) {
293
+ this._drawParticlesSetupPlugins.push(plugin);
294
+ }
295
+ if (plugin.drawParticleCleanup) {
296
+ this._drawParticlesCleanupPlugins.push(plugin);
297
+ }
298
+ if (plugin.draw) {
299
+ this._drawPlugins.push(plugin);
300
+ }
301
+ if (plugin.drawSettingsSetup) {
302
+ this._drawSettingsSetupPlugins.push(plugin);
303
+ }
304
+ if (plugin.drawSettingsCleanup) {
305
+ this._drawSettingsCleanupPlugins.push(plugin);
306
+ }
307
+ if (plugin.clearDraw) {
308
+ this._clearDrawPlugins.push(plugin);
309
+ }
336
310
  }
337
311
  }
338
312
  initUpdaters() {
@@ -364,12 +338,13 @@ export class Canvas {
364
338
  canvas.height = retinaSize.height = standardSize.height * pxRatio;
365
339
  canvas.width = retinaSize.width = standardSize.width * pxRatio;
366
340
  const canSupportHdrQuery = safeMatchMedia("(color-gamut: p3)");
367
- this._context = this.element.getContext("2d", {
341
+ this._canvasSettings = {
368
342
  alpha: true,
369
343
  colorSpace: canSupportHdrQuery?.matches && container.hdr ? "display-p3" : "srgb",
370
344
  desynchronized: true,
371
345
  willReadFrequently: false,
372
- });
346
+ };
347
+ this._context = this.element.getContext("2d", this._canvasSettings);
373
348
  this._safeMutationObserver(obs => {
374
349
  obs.disconnect();
375
350
  });
@@ -384,11 +359,11 @@ export class Canvas {
384
359
  }
385
360
  paint() {
386
361
  let handled = false;
387
- for (const plugin of this.container.plugins.values()) {
362
+ for (const plugin of this._canvasPaintPlugins) {
363
+ handled = plugin.canvasPaint?.() ?? false;
388
364
  if (handled) {
389
365
  break;
390
366
  }
391
- handled = plugin.canvasPaint?.() ?? false;
392
367
  }
393
368
  if (handled) {
394
369
  return;
@@ -464,4 +439,113 @@ export class Canvas {
464
439
  await container.refresh();
465
440
  }
466
441
  }
442
+ _applyPostDrawUpdaters = particle => {
443
+ for (const updater of this._postDrawUpdaters) {
444
+ updater.afterDraw?.(particle);
445
+ }
446
+ };
447
+ _applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform) => {
448
+ for (const updater of this._preDrawUpdaters) {
449
+ if (updater.getColorStyles) {
450
+ const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);
451
+ if (fill) {
452
+ colorStyles.fill = fill;
453
+ }
454
+ if (stroke) {
455
+ colorStyles.stroke = stroke;
456
+ }
457
+ }
458
+ if (updater.getTransformValues) {
459
+ const updaterTransform = updater.getTransformValues(particle);
460
+ for (const key in updaterTransform) {
461
+ setTransformValue(transform, updaterTransform, key);
462
+ }
463
+ }
464
+ updater.beforeDraw?.(particle);
465
+ }
466
+ };
467
+ _applyResizePlugins = () => {
468
+ for (const plugin of this._resizePlugins) {
469
+ plugin.resize?.();
470
+ }
471
+ };
472
+ _getPluginParticleColors = particle => {
473
+ let fColor, sColor;
474
+ for (const plugin of this._colorPlugins) {
475
+ if (!fColor && plugin.particleFillColor) {
476
+ fColor = rangeColorToHsl(this._engine, plugin.particleFillColor(particle));
477
+ }
478
+ if (!sColor && plugin.particleStrokeColor) {
479
+ sColor = rangeColorToHsl(this._engine, plugin.particleStrokeColor(particle));
480
+ }
481
+ if (fColor && sColor) {
482
+ break;
483
+ }
484
+ }
485
+ this._reusablePluginColors[fColorIndex] = fColor;
486
+ this._reusablePluginColors[sColorIndex] = sColor;
487
+ return this._reusablePluginColors;
488
+ };
489
+ _initStyle = () => {
490
+ const element = this.element, options = this.container.actualOptions;
491
+ if (!element) {
492
+ return;
493
+ }
494
+ if (this._fullScreen) {
495
+ this._setFullScreenStyle();
496
+ }
497
+ else {
498
+ this._resetOriginalStyle();
499
+ }
500
+ for (const key in options.style) {
501
+ if (!key || !Object.hasOwn(options.style, key)) {
502
+ continue;
503
+ }
504
+ const value = options.style[key];
505
+ if (!value) {
506
+ continue;
507
+ }
508
+ element.style.setProperty(key, value, "important");
509
+ }
510
+ };
511
+ _repairStyle = () => {
512
+ const element = this.element;
513
+ if (!element) {
514
+ return;
515
+ }
516
+ this._safeMutationObserver(observer => {
517
+ observer.disconnect();
518
+ });
519
+ this._initStyle();
520
+ this.initBackground();
521
+ const pointerEvents = this._pointerEvents;
522
+ element.style.pointerEvents = pointerEvents;
523
+ element.setAttribute("pointer-events", pointerEvents);
524
+ this._safeMutationObserver(observer => {
525
+ if (!(element instanceof Node)) {
526
+ return;
527
+ }
528
+ observer.observe(element, { attributes: true });
529
+ });
530
+ };
531
+ _resetOriginalStyle = () => {
532
+ const element = this.element, originalStyle = this._originalStyle;
533
+ if (!element || !originalStyle) {
534
+ return;
535
+ }
536
+ setStyle(element, originalStyle, true);
537
+ };
538
+ _safeMutationObserver = callback => {
539
+ if (!this._mutationObserver) {
540
+ return;
541
+ }
542
+ callback(this._mutationObserver);
543
+ };
544
+ _setFullScreenStyle = () => {
545
+ const element = this.element;
546
+ if (!element) {
547
+ return;
548
+ }
549
+ setStyle(element, getFullScreenStyle(this.container.actualOptions.fullScreen.zIndex), true);
550
+ };
467
551
  }