@tsparticles/engine 3.9.1 → 4.0.0-alpha.1

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 (431) hide show
  1. package/638.min.js +2 -0
  2. package/638.min.js.LICENSE.txt +1 -0
  3. package/browser/Core/Canvas.js +126 -181
  4. package/browser/Core/Container.js +22 -18
  5. package/browser/Core/Engine.js +64 -54
  6. package/browser/Core/Particle.js +43 -48
  7. package/browser/Core/Particles.js +33 -24
  8. package/browser/Core/Retina.js +2 -3
  9. package/browser/Core/Utils/Constants.js +2 -2
  10. package/browser/Core/Utils/EventListeners.js +74 -64
  11. package/browser/Core/Utils/QuadTree.js +1 -1
  12. package/browser/Core/Utils/Ranges.js +2 -2
  13. package/browser/Core/Utils/Vectors.js +15 -21
  14. package/browser/Options/Classes/AnimatableColor.js +3 -3
  15. package/browser/Options/Classes/AnimationOptions.js +1 -1
  16. package/browser/Options/Classes/ColorAnimation.js +1 -1
  17. package/browser/Options/Classes/Options.js +13 -10
  18. package/browser/Options/Classes/Particles/Move/Move.js +1 -4
  19. package/browser/Options/Classes/Particles/Move/MoveAngle.js +1 -1
  20. package/browser/Options/Classes/Particles/Move/MoveAttract.js +1 -1
  21. package/browser/Options/Classes/Particles/Move/MoveGravity.js +1 -1
  22. package/browser/Options/Classes/Particles/Move/Spin.js +1 -1
  23. package/browser/Options/Classes/Particles/ParticlesOptions.js +0 -6
  24. package/browser/Options/Classes/Particles/Stroke.js +1 -1
  25. package/browser/Options/Classes/ValueWithRandom.js +1 -1
  26. package/browser/Utils/CanvasUtils.js +65 -21
  27. package/browser/Utils/ColorUtils.js +61 -45
  28. package/browser/Utils/EventDispatcher.js +3 -1
  29. package/browser/Utils/LogUtils.js +22 -0
  30. package/browser/Utils/{NumberUtils.js → MathUtils.js} +14 -7
  31. package/browser/Utils/Utils.js +23 -125
  32. package/browser/bundle.js +3 -3
  33. package/browser/export-types.js +1 -99
  34. package/browser/exports.js +2 -9
  35. package/browser/index.js +3 -7
  36. package/browser/initEngine.js +4 -0
  37. package/cjs/Core/Canvas.js +136 -195
  38. package/cjs/Core/Container.js +57 -57
  39. package/cjs/Core/Engine.js +77 -71
  40. package/cjs/Core/Interfaces/Colors.js +1 -2
  41. package/cjs/Core/Interfaces/IBounds.js +1 -2
  42. package/cjs/Core/Interfaces/IBubbleParticleData.js +1 -2
  43. package/cjs/Core/Interfaces/ICircleBouncer.js +1 -2
  44. package/cjs/Core/Interfaces/IColorManager.js +1 -2
  45. package/cjs/Core/Interfaces/IContainerInteractivity.js +1 -2
  46. package/cjs/Core/Interfaces/IContainerPlugin.js +1 -2
  47. package/cjs/Core/Interfaces/ICoordinates.js +1 -2
  48. package/cjs/Core/Interfaces/IDelta.js +1 -2
  49. package/cjs/Core/Interfaces/IDimension.js +1 -2
  50. package/cjs/Core/Interfaces/IDistance.js +1 -2
  51. package/cjs/Core/Interfaces/IDrawParticleParams.js +1 -2
  52. package/cjs/Core/Interfaces/IEffectDrawer.js +1 -2
  53. package/cjs/Core/Interfaces/IExternalInteractor.js +1 -2
  54. package/cjs/Core/Interfaces/IInteractor.js +1 -2
  55. package/cjs/Core/Interfaces/ILoadParams.js +1 -2
  56. package/cjs/Core/Interfaces/IMouseData.js +1 -2
  57. package/cjs/Core/Interfaces/IMovePathGenerator.js +1 -2
  58. package/cjs/Core/Interfaces/IParticleColorStyle.js +1 -2
  59. package/cjs/Core/Interfaces/IParticleHslAnimation.js +1 -2
  60. package/cjs/Core/Interfaces/IParticleLife.js +1 -2
  61. package/cjs/Core/Interfaces/IParticleMover.js +1 -2
  62. package/cjs/Core/Interfaces/IParticleRetinaProps.js +1 -2
  63. package/cjs/Core/Interfaces/IParticleRoll.js +1 -2
  64. package/cjs/Core/Interfaces/IParticleTransformValues.js +1 -2
  65. package/cjs/Core/Interfaces/IParticleUpdater.js +1 -2
  66. package/cjs/Core/Interfaces/IParticleValueAnimation.js +1 -2
  67. package/cjs/Core/Interfaces/IParticlesInteractor.js +1 -2
  68. package/cjs/Core/Interfaces/IPlugin.js +1 -2
  69. package/cjs/Core/Interfaces/IPositionFromSizeParams.js +1 -2
  70. package/cjs/Core/Interfaces/IRangeValue.js +1 -2
  71. package/cjs/Core/Interfaces/IShapeDrawData.js +1 -2
  72. package/cjs/Core/Interfaces/IShapeDrawer.js +1 -2
  73. package/cjs/Core/Interfaces/IShapeValues.js +1 -2
  74. package/cjs/Core/Interfaces/ISlowParticleData.js +1 -2
  75. package/cjs/Core/Particle.js +99 -108
  76. package/cjs/Core/Particles.js +63 -58
  77. package/cjs/Core/Retina.js +13 -18
  78. package/cjs/Core/Utils/Constants.js +3 -7
  79. package/cjs/Core/Utils/EventListeners.js +94 -88
  80. package/cjs/Core/Utils/ExternalInteractorBase.js +3 -7
  81. package/cjs/Core/Utils/InteractionManager.js +4 -8
  82. package/cjs/Core/Utils/ParticlesInteractorBase.js +3 -7
  83. package/cjs/Core/Utils/Point.js +1 -5
  84. package/cjs/Core/Utils/QuadTree.js +10 -14
  85. package/cjs/Core/Utils/Ranges.js +14 -20
  86. package/cjs/Core/Utils/Vectors.js +24 -35
  87. package/cjs/Enums/AnimationStatus.js +2 -5
  88. package/cjs/Enums/Directions/MoveDirection.js +2 -5
  89. package/cjs/Enums/Directions/OutModeDirection.js +2 -5
  90. package/cjs/Enums/Directions/RotateDirection.js +2 -5
  91. package/cjs/Enums/InteractivityDetect.js +2 -5
  92. package/cjs/Enums/Modes/AnimationMode.js +2 -5
  93. package/cjs/Enums/Modes/LimitMode.js +2 -5
  94. package/cjs/Enums/Modes/OutMode.js +2 -5
  95. package/cjs/Enums/Modes/PixelMode.js +2 -5
  96. package/cjs/Enums/Modes/ResponsiveMode.js +2 -5
  97. package/cjs/Enums/Modes/ThemeMode.js +2 -5
  98. package/cjs/Enums/Types/AlterType.js +2 -5
  99. package/cjs/Enums/Types/DestroyType.js +2 -5
  100. package/cjs/Enums/Types/DivType.js +2 -5
  101. package/cjs/Enums/Types/EasingType.js +2 -5
  102. package/cjs/Enums/Types/EventType.js +2 -5
  103. package/cjs/Enums/Types/GradientType.js +2 -5
  104. package/cjs/Enums/Types/InteractorType.js +2 -5
  105. package/cjs/Enums/Types/ParticleOutType.js +2 -5
  106. package/cjs/Enums/Types/StartValueType.js +2 -5
  107. package/cjs/Options/Classes/AnimatableColor.js +10 -14
  108. package/cjs/Options/Classes/AnimationOptions.js +14 -19
  109. package/cjs/Options/Classes/Background/Background.js +6 -10
  110. package/cjs/Options/Classes/ColorAnimation.js +6 -10
  111. package/cjs/Options/Classes/FullScreen/FullScreen.js +3 -7
  112. package/cjs/Options/Classes/HslAnimation.js +7 -11
  113. package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +3 -7
  114. package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +5 -9
  115. package/cjs/Options/Classes/Interactivity/Events/Events.js +14 -18
  116. package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +5 -9
  117. package/cjs/Options/Classes/Interactivity/Events/Parallax.js +3 -7
  118. package/cjs/Options/Classes/Interactivity/Events/ResizeEvent.js +3 -7
  119. package/cjs/Options/Classes/Interactivity/Interactivity.js +9 -13
  120. package/cjs/Options/Classes/Interactivity/Modes/Modes.js +3 -7
  121. package/cjs/Options/Classes/ManualParticle.js +10 -14
  122. package/cjs/Options/Classes/Options.js +41 -42
  123. package/cjs/Options/Classes/OptionsColor.js +5 -9
  124. package/cjs/Options/Classes/Particles/Bounce/ParticlesBounce.js +6 -10
  125. package/cjs/Options/Classes/Particles/Bounce/ParticlesBounceFactor.js +2 -6
  126. package/cjs/Options/Classes/Particles/Effect/Effect.js +5 -9
  127. package/cjs/Options/Classes/Particles/Move/Move.js +26 -33
  128. package/cjs/Options/Classes/Particles/Move/MoveAngle.js +6 -10
  129. package/cjs/Options/Classes/Particles/Move/MoveAttract.js +5 -9
  130. package/cjs/Options/Classes/Particles/Move/MoveCenter.js +5 -9
  131. package/cjs/Options/Classes/Particles/Move/MoveGravity.js +6 -10
  132. package/cjs/Options/Classes/Particles/Move/OutModes.js +5 -9
  133. package/cjs/Options/Classes/Particles/Move/Path/MovePath.js +7 -11
  134. package/cjs/Options/Classes/Particles/Move/Spin.js +7 -11
  135. package/cjs/Options/Classes/Particles/Number/ParticlesDensity.js +3 -7
  136. package/cjs/Options/Classes/Particles/Number/ParticlesNumber.js +7 -11
  137. package/cjs/Options/Classes/Particles/Number/ParticlesNumberLimit.js +5 -9
  138. package/cjs/Options/Classes/Particles/Opacity/Opacity.js +6 -10
  139. package/cjs/Options/Classes/Particles/Opacity/OpacityAnimation.js +6 -10
  140. package/cjs/Options/Classes/Particles/ParticlesOptions.js +29 -39
  141. package/cjs/Options/Classes/Particles/Shape/Shape.js +5 -9
  142. package/cjs/Options/Classes/Particles/Size/Size.js +6 -10
  143. package/cjs/Options/Classes/Particles/Size/SizeAnimation.js +6 -10
  144. package/cjs/Options/Classes/Particles/Stroke.js +8 -12
  145. package/cjs/Options/Classes/Particles/ZIndex/ZIndex.js +4 -8
  146. package/cjs/Options/Classes/Responsive.js +13 -17
  147. package/cjs/Options/Classes/Theme/Theme.js +7 -11
  148. package/cjs/Options/Classes/Theme/ThemeDefault.js +5 -9
  149. package/cjs/Options/Classes/ValueWithRandom.js +12 -18
  150. package/cjs/Options/Interfaces/Background/IBackground.js +1 -2
  151. package/cjs/Options/Interfaces/FullScreen/IFullScreen.js +1 -2
  152. package/cjs/Options/Interfaces/IAnimatable.js +1 -2
  153. package/cjs/Options/Interfaces/IAnimatableColor.js +1 -2
  154. package/cjs/Options/Interfaces/IAnimation.js +1 -2
  155. package/cjs/Options/Interfaces/IColorAnimation.js +1 -2
  156. package/cjs/Options/Interfaces/IHslAnimation.js +1 -2
  157. package/cjs/Options/Interfaces/IManualParticle.js +1 -2
  158. package/cjs/Options/Interfaces/IOptionLoader.js +1 -2
  159. package/cjs/Options/Interfaces/IOptions.js +1 -2
  160. package/cjs/Options/Interfaces/IOptionsColor.js +1 -2
  161. package/cjs/Options/Interfaces/IResponsive.js +1 -2
  162. package/cjs/Options/Interfaces/IValueWithRandom.js +1 -2
  163. package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +1 -2
  164. package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +1 -2
  165. package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +1 -2
  166. package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +1 -2
  167. package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +1 -2
  168. package/cjs/Options/Interfaces/Interactivity/Events/IResizeEvent.js +1 -2
  169. package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +1 -2
  170. package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +1 -2
  171. package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +1 -2
  172. package/cjs/Options/Interfaces/Particles/Bounce/IParticlesBounce.js +1 -2
  173. package/cjs/Options/Interfaces/Particles/Effect/IEffect.js +1 -2
  174. package/cjs/Options/Interfaces/Particles/IParticlesOptions.js +1 -2
  175. package/cjs/Options/Interfaces/Particles/IStroke.js +1 -2
  176. package/cjs/Options/Interfaces/Particles/Move/IMove.js +1 -2
  177. package/cjs/Options/Interfaces/Particles/Move/IMoveAngle.js +1 -2
  178. package/cjs/Options/Interfaces/Particles/Move/IMoveAttract.js +1 -2
  179. package/cjs/Options/Interfaces/Particles/Move/IMoveCenter.js +1 -2
  180. package/cjs/Options/Interfaces/Particles/Move/IMoveGravity.js +1 -2
  181. package/cjs/Options/Interfaces/Particles/Move/IOutModes.js +1 -2
  182. package/cjs/Options/Interfaces/Particles/Move/ISpin.js +1 -2
  183. package/cjs/Options/Interfaces/Particles/Move/Path/IMovePath.js +1 -2
  184. package/cjs/Options/Interfaces/Particles/Number/IParticlesDensity.js +1 -2
  185. package/cjs/Options/Interfaces/Particles/Number/IParticlesNumber.js +1 -2
  186. package/cjs/Options/Interfaces/Particles/Number/IParticlesNumberLimit.js +1 -2
  187. package/cjs/Options/Interfaces/Particles/Opacity/IOpacity.js +1 -2
  188. package/cjs/Options/Interfaces/Particles/Opacity/IOpacityAnimation.js +1 -2
  189. package/cjs/Options/Interfaces/Particles/Shape/IShape.js +1 -2
  190. package/cjs/Options/Interfaces/Particles/Size/ISize.js +1 -2
  191. package/cjs/Options/Interfaces/Particles/Size/ISizeAnimation.js +1 -2
  192. package/cjs/Options/Interfaces/Particles/ZIndex/IZIndex.js +1 -2
  193. package/cjs/Options/Interfaces/Theme/ITheme.js +1 -2
  194. package/cjs/Options/Interfaces/Theme/IThemeDefault.js +1 -2
  195. package/cjs/Types/CustomEventArgs.js +1 -2
  196. package/cjs/Types/CustomEventListener.js +1 -2
  197. package/cjs/Types/EasingFunction.js +1 -2
  198. package/cjs/Types/ExportResult.js +1 -2
  199. package/cjs/Types/ISourceOptions.js +1 -2
  200. package/cjs/Types/ParticlesGroups.js +1 -2
  201. package/cjs/Types/PathOptions.js +1 -2
  202. package/cjs/Types/RangeValue.js +1 -2
  203. package/cjs/Types/RecursivePartial.js +1 -2
  204. package/cjs/Types/ShapeData.js +1 -2
  205. package/cjs/Types/SingleOrMultiple.js +1 -2
  206. package/cjs/Utils/CanvasUtils.js +86 -55
  207. package/cjs/Utils/ColorUtils.js +136 -141
  208. package/cjs/Utils/EventDispatcher.js +8 -10
  209. package/cjs/Utils/LogUtils.js +22 -0
  210. package/{esm/Utils/NumberUtils.js → cjs/Utils/MathUtils.js} +14 -7
  211. package/cjs/Utils/OptionsUtils.js +4 -8
  212. package/cjs/Utils/TypeUtils.js +7 -16
  213. package/cjs/Utils/Utils.js +104 -239
  214. package/cjs/bundle.js +5 -22
  215. package/cjs/export-types.js +1 -115
  216. package/cjs/exports.js +77 -100
  217. package/cjs/index.js +5 -26
  218. package/cjs/initEngine.js +4 -0
  219. package/dist_browser_Core_Container_js.js +102 -0
  220. package/esm/Core/Canvas.js +126 -181
  221. package/esm/Core/Container.js +22 -18
  222. package/esm/Core/Engine.js +64 -54
  223. package/esm/Core/Particle.js +43 -48
  224. package/esm/Core/Particles.js +33 -24
  225. package/esm/Core/Retina.js +2 -3
  226. package/esm/Core/Utils/Constants.js +2 -2
  227. package/esm/Core/Utils/EventListeners.js +74 -64
  228. package/esm/Core/Utils/QuadTree.js +1 -1
  229. package/esm/Core/Utils/Ranges.js +2 -2
  230. package/esm/Core/Utils/Vectors.js +15 -21
  231. package/esm/Enums/RangeType.js +5 -0
  232. package/esm/Options/Classes/AnimatableColor.js +3 -3
  233. package/esm/Options/Classes/AnimationOptions.js +1 -1
  234. package/esm/Options/Classes/ColorAnimation.js +1 -1
  235. package/esm/Options/Classes/Options.js +13 -10
  236. package/esm/Options/Classes/Particles/Move/Move.js +1 -4
  237. package/esm/Options/Classes/Particles/Move/MoveAngle.js +1 -1
  238. package/esm/Options/Classes/Particles/Move/MoveAttract.js +1 -1
  239. package/esm/Options/Classes/Particles/Move/MoveGravity.js +1 -1
  240. package/esm/Options/Classes/Particles/Move/Spin.js +1 -1
  241. package/esm/Options/Classes/Particles/ParticlesOptions.js +0 -6
  242. package/esm/Options/Classes/Particles/Stroke.js +1 -1
  243. package/esm/Options/Classes/ValueWithRandom.js +1 -1
  244. package/esm/Utils/CanvasUtils.js +65 -21
  245. package/esm/Utils/ColorUtils.js +61 -45
  246. package/esm/Utils/EventDispatcher.js +3 -1
  247. package/esm/Utils/LogUtils.js +22 -0
  248. package/esm/Utils/MathUtils.js +158 -0
  249. package/esm/Utils/Utils.js +23 -125
  250. package/esm/bundle.js +3 -3
  251. package/esm/export-types.js +1 -99
  252. package/esm/exports.js +2 -9
  253. package/esm/index.js +3 -7
  254. package/esm/initEngine.js +4 -0
  255. package/package.json +3 -2
  256. package/report.html +5 -4
  257. package/scripts/install.js +204 -118
  258. package/tsparticles.engine.js +492 -451
  259. package/tsparticles.engine.min.js +1 -1
  260. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  261. package/types/Core/Canvas.d.ts +6 -9
  262. package/types/Core/Container.d.ts +1 -0
  263. package/types/Core/Engine.d.ts +20 -16
  264. package/types/Core/Interfaces/Colors.d.ts +46 -2
  265. package/types/Core/Interfaces/IColorManager.d.ts +1 -1
  266. package/types/Core/Interfaces/IContainerPlugin.d.ts +4 -0
  267. package/types/Core/Interfaces/IDrawParticleParams.d.ts +0 -4
  268. package/types/Core/Interfaces/IEffectDrawer.d.ts +2 -1
  269. package/types/Core/Interfaces/IShapeDrawData.d.ts +2 -0
  270. package/types/Core/Interfaces/IShapeDrawer.d.ts +1 -0
  271. package/types/Core/Particle.d.ts +4 -5
  272. package/types/Core/Particles.d.ts +1 -1
  273. package/types/Core/Utils/Constants.d.ts +2 -2
  274. package/types/Core/Utils/EventListeners.d.ts +1 -0
  275. package/types/Core/Utils/Vectors.d.ts +3 -3
  276. package/types/Options/Classes/Options.d.ts +1 -2
  277. package/types/Options/Classes/OptionsColor.d.ts +2 -2
  278. package/types/Options/Classes/Particles/Move/Move.d.ts +0 -2
  279. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -4
  280. package/types/Options/Interfaces/IOptions.d.ts +1 -2
  281. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -4
  282. package/types/Options/Interfaces/Particles/Move/IMove.d.ts +0 -2
  283. package/types/Utils/CanvasUtils.d.ts +4 -1
  284. package/types/Utils/ColorUtils.d.ts +2 -2
  285. package/types/Utils/LogUtils.d.ts +11 -0
  286. package/types/Utils/{NumberUtils.d.ts → MathUtils.d.ts} +2 -1
  287. package/types/Utils/TypeUtils.d.ts +2 -2
  288. package/types/Utils/Utils.d.ts +4 -16
  289. package/types/export-types.d.ts +91 -101
  290. package/types/exports.d.ts +2 -9
  291. package/types/index.d.ts +1 -1
  292. package/types/initEngine.d.ts +2 -0
  293. package/umd/Core/Canvas.js +123 -178
  294. package/umd/Core/Container.js +25 -21
  295. package/umd/Core/Engine.js +97 -53
  296. package/umd/Core/Particle.js +54 -59
  297. package/umd/Core/Particles.js +33 -24
  298. package/umd/Core/Retina.js +9 -10
  299. package/umd/Core/Utils/Constants.js +3 -3
  300. package/umd/Core/Utils/EventListeners.js +72 -62
  301. package/umd/Core/Utils/QuadTree.js +3 -3
  302. package/umd/Core/Utils/Ranges.js +4 -4
  303. package/umd/Core/Utils/Vectors.js +15 -21
  304. package/umd/Options/Classes/AnimatableColor.js +3 -3
  305. package/umd/Options/Classes/AnimationOptions.js +6 -6
  306. package/umd/Options/Classes/ColorAnimation.js +3 -3
  307. package/umd/Options/Classes/Options.js +16 -13
  308. package/umd/Options/Classes/Particles/Move/Move.js +5 -8
  309. package/umd/Options/Classes/Particles/Move/MoveAngle.js +4 -4
  310. package/umd/Options/Classes/Particles/Move/MoveAttract.js +3 -3
  311. package/umd/Options/Classes/Particles/Move/MoveGravity.js +4 -4
  312. package/umd/Options/Classes/Particles/Move/Spin.js +3 -3
  313. package/umd/Options/Classes/Particles/ParticlesOptions.js +1 -7
  314. package/umd/Options/Classes/Particles/Stroke.js +4 -4
  315. package/umd/Options/Classes/ValueWithRandom.js +3 -3
  316. package/umd/Utils/CanvasUtils.js +69 -22
  317. package/umd/Utils/ColorUtils.js +72 -56
  318. package/umd/Utils/EventDispatcher.js +3 -1
  319. package/umd/Utils/LogUtils.js +36 -0
  320. package/umd/Utils/{NumberUtils.js → MathUtils.js} +16 -8
  321. package/umd/Utils/Utils.js +36 -141
  322. package/umd/bundle.js +4 -4
  323. package/umd/export-types.js +1 -114
  324. package/umd/exports.js +3 -10
  325. package/umd/index.js +4 -8
  326. package/umd/{init.js → initEngine.js} +3 -5
  327. package/browser/Core/Interfaces/IRectSideResult.js +0 -1
  328. package/browser/Core/Interfaces/ITrailFillData.js +0 -1
  329. package/browser/Enums/Modes/CollisionMode.js +0 -6
  330. package/browser/Options/Classes/BackgroundMask/BackgroundMask.js +0 -24
  331. package/browser/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -21
  332. package/browser/Options/Classes/Particles/Collisions/Collisions.js +0 -33
  333. package/browser/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -14
  334. package/browser/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -18
  335. package/browser/Options/Classes/Particles/Move/MoveTrail.js +0 -23
  336. package/browser/Options/Classes/Particles/Move/MoveTrailFill.js +0 -15
  337. package/browser/Options/Classes/Particles/Shadow.js +0 -35
  338. package/browser/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -1
  339. package/browser/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -1
  340. package/browser/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -1
  341. package/browser/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -1
  342. package/browser/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -1
  343. package/browser/Options/Interfaces/Particles/IShadow.js +0 -1
  344. package/browser/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -1
  345. package/browser/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -1
  346. package/browser/init.js +0 -6
  347. package/cjs/Core/Interfaces/IRectSideResult.js +0 -2
  348. package/cjs/Core/Interfaces/ITrailFillData.js +0 -2
  349. package/cjs/Enums/Modes/CollisionMode.js +0 -9
  350. package/cjs/Options/Classes/BackgroundMask/BackgroundMask.js +0 -28
  351. package/cjs/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -25
  352. package/cjs/Options/Classes/Particles/Collisions/Collisions.js +0 -37
  353. package/cjs/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -18
  354. package/cjs/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -22
  355. package/cjs/Options/Classes/Particles/Move/MoveTrail.js +0 -27
  356. package/cjs/Options/Classes/Particles/Move/MoveTrailFill.js +0 -19
  357. package/cjs/Options/Classes/Particles/Shadow.js +0 -39
  358. package/cjs/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -2
  359. package/cjs/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -2
  360. package/cjs/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -2
  361. package/cjs/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -2
  362. package/cjs/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -2
  363. package/cjs/Options/Interfaces/Particles/IShadow.js +0 -2
  364. package/cjs/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -2
  365. package/cjs/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -2
  366. package/cjs/Types/RangeType.js +0 -8
  367. package/cjs/Utils/NumberUtils.js +0 -177
  368. package/cjs/init.js +0 -9
  369. package/esm/Core/Interfaces/IRectSideResult.js +0 -1
  370. package/esm/Core/Interfaces/ITrailFillData.js +0 -1
  371. package/esm/Enums/Modes/CollisionMode.js +0 -6
  372. package/esm/Options/Classes/BackgroundMask/BackgroundMask.js +0 -24
  373. package/esm/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -21
  374. package/esm/Options/Classes/Particles/Collisions/Collisions.js +0 -33
  375. package/esm/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -14
  376. package/esm/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -18
  377. package/esm/Options/Classes/Particles/Move/MoveTrail.js +0 -23
  378. package/esm/Options/Classes/Particles/Move/MoveTrailFill.js +0 -15
  379. package/esm/Options/Classes/Particles/Shadow.js +0 -35
  380. package/esm/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -1
  381. package/esm/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -1
  382. package/esm/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -1
  383. package/esm/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -1
  384. package/esm/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -1
  385. package/esm/Options/Interfaces/Particles/IShadow.js +0 -1
  386. package/esm/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -1
  387. package/esm/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -1
  388. package/esm/init.js +0 -6
  389. package/types/Core/Interfaces/IRectSideResult.d.ts +0 -5
  390. package/types/Core/Interfaces/ITrailFillData.d.ts +0 -6
  391. package/types/Enums/Modes/CollisionMode.d.ts +0 -5
  392. package/types/Options/Classes/BackgroundMask/BackgroundMask.d.ts +0 -11
  393. package/types/Options/Classes/BackgroundMask/BackgroundMaskCover.d.ts +0 -11
  394. package/types/Options/Classes/Particles/Collisions/Collisions.d.ts +0 -18
  395. package/types/Options/Classes/Particles/Collisions/CollisionsAbsorb.d.ts +0 -8
  396. package/types/Options/Classes/Particles/Collisions/CollisionsOverlap.d.ts +0 -9
  397. package/types/Options/Classes/Particles/Move/MoveTrail.d.ts +0 -11
  398. package/types/Options/Classes/Particles/Move/MoveTrailFill.d.ts +0 -9
  399. package/types/Options/Classes/Particles/Shadow.d.ts +0 -13
  400. package/types/Options/Interfaces/BackgroundMask/IBackgroundMask.d.ts +0 -8
  401. package/types/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.d.ts +0 -6
  402. package/types/Options/Interfaces/Particles/Collisions/ICollisions.d.ts +0 -13
  403. package/types/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.d.ts +0 -3
  404. package/types/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.d.ts +0 -4
  405. package/types/Options/Interfaces/Particles/IShadow.d.ts +0 -8
  406. package/types/Options/Interfaces/Particles/Move/IMoveTrail.d.ts +0 -6
  407. package/types/Options/Interfaces/Particles/Move/IMoveTrailFill.d.ts +0 -5
  408. package/types/init.d.ts +0 -2
  409. package/umd/Core/Interfaces/IRectSideResult.js +0 -12
  410. package/umd/Core/Interfaces/ITrailFillData.js +0 -12
  411. package/umd/Enums/Modes/CollisionMode.js +0 -19
  412. package/umd/Options/Classes/BackgroundMask/BackgroundMask.js +0 -38
  413. package/umd/Options/Classes/BackgroundMask/BackgroundMaskCover.js +0 -35
  414. package/umd/Options/Classes/Particles/Collisions/Collisions.js +0 -47
  415. package/umd/Options/Classes/Particles/Collisions/CollisionsAbsorb.js +0 -28
  416. package/umd/Options/Classes/Particles/Collisions/CollisionsOverlap.js +0 -32
  417. package/umd/Options/Classes/Particles/Move/MoveTrail.js +0 -37
  418. package/umd/Options/Classes/Particles/Move/MoveTrailFill.js +0 -29
  419. package/umd/Options/Classes/Particles/Shadow.js +0 -49
  420. package/umd/Options/Interfaces/BackgroundMask/IBackgroundMask.js +0 -12
  421. package/umd/Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js +0 -12
  422. package/umd/Options/Interfaces/Particles/Collisions/ICollisions.js +0 -12
  423. package/umd/Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js +0 -12
  424. package/umd/Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js +0 -12
  425. package/umd/Options/Interfaces/Particles/IShadow.js +0 -12
  426. package/umd/Options/Interfaces/Particles/Move/IMoveTrail.js +0 -12
  427. package/umd/Options/Interfaces/Particles/Move/IMoveTrailFill.js +0 -12
  428. /package/browser/{Types → Enums}/RangeType.js +0 -0
  429. /package/{esm/Types → cjs/Enums}/RangeType.js +0 -0
  430. /package/types/{Types → Enums}/RangeType.d.ts +0 -0
  431. /package/umd/{Types → Enums}/RangeType.js +0 -0
@@ -1,5 +1,5 @@
1
- import { clamp, collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, randomInRange, } from "./NumberUtils.js";
2
- import { half, millisecondsToSeconds, minVelocity, percentDenominator } from "../Core/Utils/Constants.js";
1
+ import { clamp, collisionVelocity, getDistances, getRandom, getRangeMax, getRangeMin, getRangeValue, randomInRangeValue, } from "./MathUtils.js";
2
+ import { half, millisecondsToSeconds, percentDenominator } from "../Core/Utils/Constants.js";
3
3
  import { isArray, isNull, isObject } from "./TypeUtils.js";
4
4
  import { AnimationMode } from "../Enums/Modes/AnimationMode.js";
5
5
  import { AnimationStatus } from "../Enums/AnimationStatus.js";
@@ -8,25 +8,7 @@ import { OutModeDirection } from "../Enums/Directions/OutModeDirection.js";
8
8
  import { PixelMode } from "../Enums/Modes/PixelMode.js";
9
9
  import { StartValueType } from "../Enums/Types/StartValueType.js";
10
10
  import { Vector } from "../Core/Utils/Vectors.js";
11
- const _logger = {
12
- debug: console.debug,
13
- error: console.error,
14
- info: console.info,
15
- log: console.log,
16
- verbose: console.log,
17
- warning: console.warn,
18
- };
19
- export function setLogger(logger) {
20
- _logger.debug = logger.debug || _logger.debug;
21
- _logger.error = logger.error || _logger.error;
22
- _logger.info = logger.info || _logger.info;
23
- _logger.log = logger.log || _logger.log;
24
- _logger.verbose = logger.verbose || _logger.verbose;
25
- _logger.warning = logger.warning || _logger.warning;
26
- }
27
- export function getLogger() {
28
- return _logger;
29
- }
11
+ const minRadius = 0;
30
12
  function memoize(fn) {
31
13
  const cache = new Map();
32
14
  return (...args) => {
@@ -39,32 +21,17 @@ function memoize(fn) {
39
21
  return result;
40
22
  };
41
23
  }
42
- function rectSideBounce(data) {
43
- const res = { bounced: false }, { pSide, pOtherSide, rectSide, rectOtherSide, velocity, factor } = data;
44
- if (pOtherSide.min < rectOtherSide.min ||
45
- pOtherSide.min > rectOtherSide.max ||
46
- pOtherSide.max < rectOtherSide.min ||
47
- pOtherSide.max > rectOtherSide.max) {
48
- return res;
49
- }
50
- if ((pSide.max >= rectSide.min && pSide.max <= (rectSide.max + rectSide.min) * half && velocity > minVelocity) ||
51
- (pSide.min <= rectSide.max && pSide.min > (rectSide.max + rectSide.min) * half && velocity < minVelocity)) {
52
- res.velocity = velocity * -factor;
53
- res.bounced = true;
54
- }
55
- return res;
56
- }
57
24
  function checkSelector(element, selectors) {
58
25
  const res = executeOnSingleOrMultiple(selectors, selector => {
59
26
  return element.matches(selector);
60
27
  });
61
28
  return isArray(res) ? res.some(t => t) : res;
62
29
  }
63
- export function isSsr() {
64
- return typeof window === "undefined" || !window || typeof window.document === "undefined" || !window.document;
65
- }
66
30
  export function hasMatchMedia() {
67
- return !isSsr() && typeof matchMedia !== "undefined";
31
+ return typeof matchMedia !== "undefined";
32
+ }
33
+ export function safeDocument() {
34
+ return globalThis.document;
68
35
  }
69
36
  export function safeMatchMedia(query) {
70
37
  if (!hasMatchMedia()) {
@@ -73,24 +40,23 @@ export function safeMatchMedia(query) {
73
40
  return matchMedia(query);
74
41
  }
75
42
  export function safeIntersectionObserver(callback) {
76
- if (isSsr() || typeof IntersectionObserver === "undefined") {
43
+ if (typeof IntersectionObserver === "undefined") {
77
44
  return;
78
45
  }
79
46
  return new IntersectionObserver(callback);
80
47
  }
81
48
  export function safeMutationObserver(callback) {
82
- if (isSsr() || typeof MutationObserver === "undefined") {
49
+ if (typeof MutationObserver === "undefined") {
83
50
  return;
84
51
  }
85
52
  return new MutationObserver(callback);
86
53
  }
87
54
  export function isInArray(value, array) {
88
- const invalidIndex = -1;
89
- return value === array || (isArray(array) && array.indexOf(value) > invalidIndex);
55
+ return value === array || (isArray(array) && array.includes(value));
90
56
  }
91
57
  export async function loadFont(font, weight) {
92
58
  try {
93
- await document.fonts.load(`${weight ?? "400"} 36px '${font ?? "Verdana"}'`);
59
+ await safeDocument().fonts.load(`${weight ?? "400"} 36px '${font ?? "Verdana"}'`);
94
60
  }
95
61
  catch {
96
62
  }
@@ -102,7 +68,6 @@ export function itemFromArray(array, index, useIndex = true) {
102
68
  return array[index !== undefined && useIndex ? index % array.length : arrayRandomIndex(array)];
103
69
  }
104
70
  export function isPointInside(point, size, offset, radius, direction) {
105
- const minRadius = 0;
106
71
  return areBoundsInside(calculateBounds(point, radius ?? minRadius), size, offset, direction);
107
72
  }
108
73
  export function areBoundsInside(bounds, size, offset, direction) {
@@ -203,64 +168,6 @@ export function circleBounce(p1, p2) {
203
168
  p2.velocity.x = vFinal2.x * p2.factor.x;
204
169
  p2.velocity.y = vFinal2.y * p2.factor.y;
205
170
  }
206
- export function rectBounce(particle, divBounds) {
207
- const pPos = particle.getPosition(), size = particle.getRadius(), bounds = calculateBounds(pPos, size), bounceOptions = particle.options.bounce, resH = rectSideBounce({
208
- pSide: {
209
- min: bounds.left,
210
- max: bounds.right,
211
- },
212
- pOtherSide: {
213
- min: bounds.top,
214
- max: bounds.bottom,
215
- },
216
- rectSide: {
217
- min: divBounds.left,
218
- max: divBounds.right,
219
- },
220
- rectOtherSide: {
221
- min: divBounds.top,
222
- max: divBounds.bottom,
223
- },
224
- velocity: particle.velocity.x,
225
- factor: getRangeValue(bounceOptions.horizontal.value),
226
- });
227
- if (resH.bounced) {
228
- if (resH.velocity !== undefined) {
229
- particle.velocity.x = resH.velocity;
230
- }
231
- if (resH.position !== undefined) {
232
- particle.position.x = resH.position;
233
- }
234
- }
235
- const resV = rectSideBounce({
236
- pSide: {
237
- min: bounds.top,
238
- max: bounds.bottom,
239
- },
240
- pOtherSide: {
241
- min: bounds.left,
242
- max: bounds.right,
243
- },
244
- rectSide: {
245
- min: divBounds.top,
246
- max: divBounds.bottom,
247
- },
248
- rectOtherSide: {
249
- min: divBounds.left,
250
- max: divBounds.right,
251
- },
252
- velocity: particle.velocity.y,
253
- factor: getRangeValue(bounceOptions.vertical.value),
254
- });
255
- if (resV.bounced) {
256
- if (resV.velocity !== undefined) {
257
- particle.velocity.y = resV.velocity;
258
- }
259
- if (resV.position !== undefined) {
260
- particle.position.y = resV.position;
261
- }
262
- }
263
- }
264
171
  export function executeOnSingleOrMultiple(obj, callback) {
265
172
  const defaultIndex = 0;
266
173
  return isArray(obj) ? obj.map((item, index) => callback(item, index)) : callback(obj, defaultIndex);
@@ -315,7 +222,7 @@ export function initParticleNumericAnimationValue(options, pxRatio) {
315
222
  break;
316
223
  case StartValueType.random:
317
224
  default:
318
- res.value = randomInRange(res);
225
+ res.value = randomInRangeValue(res);
319
226
  if (autoStatus) {
320
227
  res.status = getRandom() >= half ? AnimationStatus.increasing : AnimationStatus.decreasing;
321
228
  }
@@ -368,15 +275,12 @@ function checkDestroy(particle, destroyType, value, minValue, maxValue) {
368
275
  export function updateAnimation(particle, data, changeDirection, destroyType, delta) {
369
276
  const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minDecay = 1;
370
277
  if (particle.destroyed ||
371
- !data ||
372
278
  !data.enable ||
373
279
  ((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
374
280
  return;
375
281
  }
376
282
  const velocity = (data.velocity ?? minVelocity) * delta.factor, minValue = data.min, maxValue = data.max, decay = data.decay ?? minDecay;
377
- if (!data.time) {
378
- data.time = 0;
379
- }
283
+ data.time ??= 0;
380
284
  if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
381
285
  data.time += delta.value;
382
286
  }
@@ -392,9 +296,7 @@ export function updateAnimation(particle, data, changeDirection, destroyType, de
392
296
  else {
393
297
  data.value -= maxValue;
394
298
  }
395
- if (!data.loops) {
396
- data.loops = minLoops;
397
- }
299
+ data.loops ??= minLoops;
398
300
  data.loops++;
399
301
  }
400
302
  else {
@@ -409,9 +311,7 @@ export function updateAnimation(particle, data, changeDirection, destroyType, de
409
311
  else {
410
312
  data.value += maxValue;
411
313
  }
412
- if (!data.loops) {
413
- data.loops = minLoops;
414
- }
314
+ data.loops ??= minLoops;
415
315
  data.loops++;
416
316
  }
417
317
  else {
@@ -422,15 +322,10 @@ export function updateAnimation(particle, data, changeDirection, destroyType, de
422
322
  data.velocity *= decay;
423
323
  }
424
324
  checkDestroy(particle, destroyType, data.value, minValue, maxValue);
425
- if (!particle.destroyed) {
426
- data.value = clamp(data.value, minValue, maxValue);
427
- }
325
+ data.value = clamp(data.value, minValue, maxValue);
428
326
  }
429
327
  export function cloneStyle(style) {
430
- const clonedStyle = document.createElement("div").style;
431
- if (!style) {
432
- return clonedStyle;
433
- }
328
+ const clonedStyle = safeDocument().createElement("div").style;
434
329
  for (const key in style) {
435
330
  const styleKey = style[key];
436
331
  if (!Object.prototype.hasOwnProperty.call(style, key) || isNull(styleKey)) {
@@ -442,16 +337,16 @@ export function cloneStyle(style) {
442
337
  }
443
338
  const stylePriority = style.getPropertyPriority?.(styleKey);
444
339
  if (!stylePriority) {
445
- clonedStyle.setProperty?.(styleKey, styleValue);
340
+ clonedStyle.setProperty(styleKey, styleValue);
446
341
  }
447
342
  else {
448
- clonedStyle.setProperty?.(styleKey, styleValue, stylePriority);
343
+ clonedStyle.setProperty(styleKey, styleValue, stylePriority);
449
344
  }
450
345
  }
451
346
  return clonedStyle;
452
347
  }
453
348
  function computeFullScreenStyle(zIndex) {
454
- const fullScreenStyle = document.createElement("div").style, radix = 10, style = {
349
+ const fullScreenStyle = safeDocument().createElement("div").style, radix = 10, style = {
455
350
  width: "100%",
456
351
  height: "100%",
457
352
  margin: "0",
@@ -465,6 +360,9 @@ function computeFullScreenStyle(zIndex) {
465
360
  };
466
361
  for (const key in style) {
467
362
  const value = style[key];
363
+ if (value === undefined) {
364
+ continue;
365
+ }
468
366
  fullScreenStyle.setProperty(key, value);
469
367
  }
470
368
  return fullScreenStyle;
package/esm/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
- import { init } from "./init.js";
2
- const tsParticles = init();
3
- window.tsParticles = tsParticles;
1
+ import { initEngine } from "./initEngine.js";
2
+ const tsParticles = initEngine();
3
+ globalThis.tsParticles = tsParticles;
4
4
  export * from "./exports.js";
5
5
  export { tsParticles };
@@ -1,99 +1 @@
1
- export * from "./Core/Interfaces/Colors.js";
2
- export * from "./Core/Interfaces/IBounds.js";
3
- export * from "./Core/Interfaces/IBubbleParticleData.js";
4
- export * from "./Core/Interfaces/ICircleBouncer.js";
5
- export * from "./Core/Interfaces/IColorManager.js";
6
- export * from "./Core/Interfaces/IContainerInteractivity.js";
7
- export * from "./Core/Interfaces/IContainerPlugin.js";
8
- export * from "./Core/Interfaces/ICoordinates.js";
9
- export * from "./Core/Interfaces/IDelta.js";
10
- export * from "./Core/Interfaces/IDimension.js";
11
- export * from "./Core/Interfaces/IDistance.js";
12
- export * from "./Core/Interfaces/IDrawParticleParams.js";
13
- export * from "./Core/Interfaces/IEffectDrawer.js";
14
- export * from "./Core/Interfaces/IExternalInteractor.js";
15
- export * from "./Core/Interfaces/IInteractor.js";
16
- export * from "./Core/Interfaces/ILoadParams.js";
17
- export * from "./Core/Interfaces/IMouseData.js";
18
- export * from "./Core/Interfaces/IMovePathGenerator.js";
19
- export * from "./Core/Interfaces/IParticleColorStyle.js";
20
- export * from "./Core/Interfaces/IParticleHslAnimation.js";
21
- export * from "./Core/Interfaces/IParticleLife.js";
22
- export * from "./Core/Interfaces/IParticleMover.js";
23
- export * from "./Core/Interfaces/IParticleRetinaProps.js";
24
- export * from "./Core/Interfaces/IParticleRoll.js";
25
- export * from "./Core/Interfaces/IParticleTransformValues.js";
26
- export * from "./Core/Interfaces/IParticleUpdater.js";
27
- export * from "./Core/Interfaces/IParticleValueAnimation.js";
28
- export * from "./Core/Interfaces/IParticlesInteractor.js";
29
- export * from "./Core/Interfaces/IPlugin.js";
30
- export * from "./Core/Interfaces/IPositionFromSizeParams.js";
31
- export * from "./Core/Interfaces/IRangeValue.js";
32
- export * from "./Core/Interfaces/IRectSideResult.js";
33
- export * from "./Core/Interfaces/IShapeDrawData.js";
34
- export * from "./Core/Interfaces/IShapeDrawer.js";
35
- export * from "./Core/Interfaces/IShapeValues.js";
36
- export * from "./Core/Interfaces/ISlowParticleData.js";
37
- export * from "./Core/Interfaces/ITrailFillData.js";
38
- export * from "./Options/Interfaces/Background/IBackground.js";
39
- export * from "./Options/Interfaces/BackgroundMask/IBackgroundMask.js";
40
- export * from "./Options/Interfaces/BackgroundMask/IBackgroundMaskCover.js";
41
- export * from "./Options/Interfaces/FullScreen/IFullScreen.js";
42
- export * from "./Options/Interfaces/IAnimatable.js";
43
- export * from "./Options/Interfaces/IAnimatableColor.js";
44
- export * from "./Options/Interfaces/IAnimation.js";
45
- export * from "./Options/Interfaces/IColorAnimation.js";
46
- export * from "./Options/Interfaces/IHslAnimation.js";
47
- export * from "./Options/Interfaces/IManualParticle.js";
48
- export * from "./Options/Interfaces/IOptionLoader.js";
49
- export * from "./Options/Interfaces/IOptions.js";
50
- export * from "./Options/Interfaces/IOptionsColor.js";
51
- export * from "./Options/Interfaces/IResponsive.js";
52
- export * from "./Options/Interfaces/IValueWithRandom.js";
53
- export * from "./Options/Interfaces/Interactivity/Events/IClickEvent.js";
54
- export * from "./Options/Interfaces/Interactivity/Events/IDivEvent.js";
55
- export * from "./Options/Interfaces/Interactivity/Events/IEvents.js";
56
- export * from "./Options/Interfaces/Interactivity/Events/IHoverEvent.js";
57
- export * from "./Options/Interfaces/Interactivity/Events/IParallax.js";
58
- export * from "./Options/Interfaces/Interactivity/Events/IResizeEvent.js";
59
- export * from "./Options/Interfaces/Interactivity/Modes/IModeDiv.js";
60
- export * from "./Options/Interfaces/Interactivity/Modes/IModes.js";
61
- export * from "./Options/Interfaces/Interactivity/IInteractivity.js";
62
- export * from "./Options/Interfaces/Particles/Bounce/IParticlesBounce.js";
63
- export * from "./Options/Interfaces/Particles/Collisions/ICollisions.js";
64
- export * from "./Options/Interfaces/Particles/Collisions/ICollisionsAbsorb.js";
65
- export * from "./Options/Interfaces/Particles/Collisions/ICollisionsOverlap.js";
66
- export * from "./Options/Interfaces/Particles/Effect/IEffect.js";
67
- export * from "./Options/Interfaces/Particles/IParticlesOptions.js";
68
- export * from "./Options/Interfaces/Particles/IShadow.js";
69
- export * from "./Options/Interfaces/Particles/IStroke.js";
70
- export * from "./Options/Interfaces/Particles/Move/IMoveAttract.js";
71
- export * from "./Options/Interfaces/Particles/Move/IMove.js";
72
- export * from "./Options/Interfaces/Particles/Move/IMoveAngle.js";
73
- export * from "./Options/Interfaces/Particles/Move/IMoveCenter.js";
74
- export * from "./Options/Interfaces/Particles/Move/IMoveGravity.js";
75
- export * from "./Options/Interfaces/Particles/Move/Path/IMovePath.js";
76
- export * from "./Options/Interfaces/Particles/Move/IOutModes.js";
77
- export * from "./Options/Interfaces/Particles/Move/ISpin.js";
78
- export * from "./Options/Interfaces/Particles/Move/IMoveTrail.js";
79
- export * from "./Options/Interfaces/Particles/Number/IParticlesDensity.js";
80
- export * from "./Options/Interfaces/Particles/Number/IParticlesNumber.js";
81
- export * from "./Options/Interfaces/Particles/Number/IParticlesNumberLimit.js";
82
- export * from "./Options/Interfaces/Particles/Opacity/IOpacity.js";
83
- export * from "./Options/Interfaces/Particles/Opacity/IOpacityAnimation.js";
84
- export * from "./Options/Interfaces/Particles/Shape/IShape.js";
85
- export * from "./Options/Interfaces/Particles/Size/ISize.js";
86
- export * from "./Options/Interfaces/Particles/Size/ISizeAnimation.js";
87
- export * from "./Options/Interfaces/Particles/ZIndex/IZIndex.js";
88
- export * from "./Options/Interfaces/Theme/ITheme.js";
89
- export * from "./Options/Interfaces/Theme/IThemeDefault.js";
90
- export * from "./Types/CustomEventArgs.js";
91
- export * from "./Types/CustomEventListener.js";
92
- export * from "./Types/ExportResult.js";
93
- export * from "./Types/ISourceOptions.js";
94
- export * from "./Types/ParticlesGroups.js";
95
- export * from "./Types/PathOptions.js";
96
- export * from "./Types/RangeValue.js";
97
- export * from "./Types/RecursivePartial.js";
98
- export * from "./Types/ShapeData.js";
99
- export * from "./Types/SingleOrMultiple.js";
1
+ export {};
package/esm/exports.js CHANGED
@@ -8,7 +8,6 @@ export * from "./Enums/Directions/MoveDirection.js";
8
8
  export * from "./Enums/Directions/RotateDirection.js";
9
9
  export * from "./Enums/Directions/OutModeDirection.js";
10
10
  export * from "./Enums/Modes/AnimationMode.js";
11
- export * from "./Enums/Modes/CollisionMode.js";
12
11
  export * from "./Enums/Modes/LimitMode.js";
13
12
  export * from "./Enums/Modes/OutMode.js";
14
13
  export * from "./Enums/Modes/PixelMode.js";
@@ -28,8 +27,6 @@ export * from "./Enums/InteractivityDetect.js";
28
27
  export * from "./Options/Classes/AnimatableColor.js";
29
28
  export * from "./Options/Classes/AnimationOptions.js";
30
29
  export * from "./Options/Classes/Background/Background.js";
31
- export * from "./Options/Classes/BackgroundMask/BackgroundMask.js";
32
- export * from "./Options/Classes/BackgroundMask/BackgroundMaskCover.js";
33
30
  export * from "./Options/Classes/ColorAnimation.js";
34
31
  export * from "./Options/Classes/FullScreen/FullScreen.js";
35
32
  export * from "./Options/Classes/HslAnimation.js";
@@ -48,11 +45,7 @@ export * from "./Options/Classes/Options.js";
48
45
  export * from "./Options/Classes/OptionsColor.js";
49
46
  export * from "./Options/Classes/Particles/Bounce/ParticlesBounce.js";
50
47
  export * from "./Options/Classes/Particles/Bounce/ParticlesBounceFactor.js";
51
- export * from "./Options/Classes/Particles/Collisions/Collisions.js";
52
- export * from "./Options/Classes/Particles/Collisions/CollisionsAbsorb.js";
53
- export * from "./Options/Classes/Particles/Collisions/CollisionsOverlap.js";
54
48
  export * from "./Options/Classes/Particles/ParticlesOptions.js";
55
- export * from "./Options/Classes/Particles/Shadow.js";
56
49
  export * from "./Options/Classes/Particles/Stroke.js";
57
50
  export * from "./Options/Classes/Particles/Move/MoveAttract.js";
58
51
  export * from "./Options/Classes/Particles/Move/Move.js";
@@ -62,7 +55,6 @@ export * from "./Options/Classes/Particles/Move/MoveGravity.js";
62
55
  export * from "./Options/Classes/Particles/Move/OutModes.js";
63
56
  export * from "./Options/Classes/Particles/Move/Path/MovePath.js";
64
57
  export * from "./Options/Classes/Particles/Move/Spin.js";
65
- export * from "./Options/Classes/Particles/Move/MoveTrail.js";
66
58
  export * from "./Options/Classes/Particles/Number/ParticlesNumber.js";
67
59
  export * from "./Options/Classes/Particles/Number/ParticlesNumberLimit.js";
68
60
  export * from "./Options/Classes/Particles/Number/ParticlesDensity.js";
@@ -78,7 +70,8 @@ export * from "./Options/Classes/Theme/ThemeDefault.js";
78
70
  export * from "./Options/Classes/ValueWithRandom.js";
79
71
  export * from "./Utils/CanvasUtils.js";
80
72
  export * from "./Utils/ColorUtils.js";
81
- export * from "./Utils/NumberUtils.js";
73
+ export * from "./Utils/LogUtils.js";
74
+ export * from "./Utils/MathUtils.js";
82
75
  export * from "./Utils/OptionsUtils.js";
83
76
  export * from "./Utils/Utils.js";
84
77
  export * from "./Utils/TypeUtils.js";
package/esm/index.js CHANGED
@@ -1,9 +1,5 @@
1
- import { init } from "./init.js";
2
- import { isSsr } from "./Utils/Utils.js";
3
- const tsParticles = init();
4
- if (!isSsr()) {
5
- window.tsParticles = tsParticles;
6
- }
1
+ import { initEngine } from "./initEngine.js";
2
+ const tsParticles = initEngine();
3
+ globalThis.tsParticles = tsParticles;
7
4
  export * from "./exports.js";
8
- export * from "./export-types.js";
9
5
  export { tsParticles };
@@ -0,0 +1,4 @@
1
+ import { Engine } from "./Core/Engine.js";
2
+ export function initEngine() {
3
+ return new Engine();
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/engine",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
5
5
  "homepage": "https://particles.js.org",
6
6
  "scripts": {
@@ -103,5 +103,6 @@
103
103
  },
104
104
  "publishConfig": {
105
105
  "access": "public"
106
- }
106
+ },
107
+ "type": "module"
107
108
  }