tsparticles 1.36.0 → 1.37.3

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 (299) hide show
  1. package/Core/Container.d.ts +3 -1
  2. package/Core/Container.js +16 -11
  3. package/Core/InteractionManager.d.ts +1 -0
  4. package/Core/InteractionManager.js +4 -1
  5. package/Core/Particles.d.ts +1 -1
  6. package/Core/Particles.js +3 -1
  7. package/Enums/Modes/ResponsiveMode.d.ts +4 -0
  8. package/Enums/Modes/ResponsiveMode.js +8 -0
  9. package/Enums/Modes/index.d.ts +1 -0
  10. package/Enums/Modes/index.js +1 -0
  11. package/Interactions/External/Attract/index.d.ts +1 -1
  12. package/Interactions/External/Attract/index.js +2 -2
  13. package/Interactions/External/Bounce/index.d.ts +1 -1
  14. package/Interactions/External/Bounce/index.js +2 -2
  15. package/Interactions/External/Bubble/index.d.ts +1 -1
  16. package/Interactions/External/Bubble/index.js +2 -2
  17. package/Interactions/External/Connect/index.d.ts +1 -1
  18. package/Interactions/External/Connect/index.js +2 -2
  19. package/Interactions/External/Grab/index.d.ts +1 -1
  20. package/Interactions/External/Grab/index.js +2 -2
  21. package/Interactions/External/Repulse/index.d.ts +1 -1
  22. package/Interactions/External/Repulse/index.js +2 -2
  23. package/Interactions/External/Trail/index.d.ts +1 -1
  24. package/Interactions/External/Trail/index.js +2 -2
  25. package/Interactions/Particles/Attract/index.d.ts +1 -1
  26. package/Interactions/Particles/Attract/index.js +2 -2
  27. package/Interactions/Particles/Collisions/index.d.ts +1 -1
  28. package/Interactions/Particles/Collisions/index.js +2 -2
  29. package/Interactions/Particles/Links/index.d.ts +2 -2
  30. package/Interactions/Particles/Links/index.js +5 -5
  31. package/Interactions/Particles/Links/plugin.d.ts +1 -1
  32. package/Interactions/Particles/Links/plugin.js +2 -2
  33. package/Options/Classes/FullScreen/FullScreen.js +2 -2
  34. package/Options/Classes/Interactivity/Interactivity.js +1 -1
  35. package/Options/Classes/Options.js +3 -1
  36. package/Options/Classes/Responsive.d.ts +2 -0
  37. package/Options/Classes/Responsive.js +10 -0
  38. package/Options/Interfaces/IResponsive.d.ts +2 -0
  39. package/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  40. package/Plugins/Absorbers/AbsorberInstance.js +21 -9
  41. package/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  42. package/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  43. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  44. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +21 -0
  45. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  46. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  47. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +2 -0
  48. package/Plugins/Absorbers/plugin.d.ts +1 -1
  49. package/Plugins/Absorbers/plugin.js +2 -2
  50. package/Plugins/Emitters/plugin.d.ts +1 -1
  51. package/Plugins/Emitters/plugin.js +2 -2
  52. package/Plugins/PolygonMask/plugin.js +1 -1
  53. package/Shapes/Circle/index.d.ts +1 -1
  54. package/Shapes/Circle/index.js +2 -2
  55. package/Shapes/Image/index.d.ts +1 -1
  56. package/Shapes/Image/index.js +3 -3
  57. package/Shapes/Line/index.d.ts +1 -1
  58. package/Shapes/Line/index.js +2 -2
  59. package/Shapes/Polygon/index.d.ts +3 -3
  60. package/Shapes/Polygon/index.js +7 -7
  61. package/Shapes/Square/index.d.ts +1 -1
  62. package/Shapes/Square/index.js +3 -3
  63. package/Shapes/Star/index.d.ts +1 -1
  64. package/Shapes/Star/index.js +2 -2
  65. package/Shapes/Text/index.d.ts +1 -1
  66. package/Shapes/Text/index.js +2 -2
  67. package/Updaters/Angle/index.d.ts +1 -1
  68. package/Updaters/Angle/index.js +2 -2
  69. package/Updaters/Color/index.d.ts +1 -1
  70. package/Updaters/Color/index.js +2 -2
  71. package/Updaters/Life/index.d.ts +1 -1
  72. package/Updaters/Life/index.js +2 -2
  73. package/Updaters/Opacity/index.d.ts +1 -1
  74. package/Updaters/Opacity/index.js +2 -2
  75. package/Updaters/OutModes/index.d.ts +1 -1
  76. package/Updaters/OutModes/index.js +2 -2
  77. package/Updaters/Roll/index.d.ts +1 -1
  78. package/Updaters/Roll/index.js +2 -2
  79. package/Updaters/Size/index.d.ts +1 -1
  80. package/Updaters/Size/index.js +2 -2
  81. package/Updaters/StrokeColor/index.d.ts +1 -1
  82. package/Updaters/StrokeColor/index.js +2 -2
  83. package/Updaters/Tilt/index.d.ts +1 -1
  84. package/Updaters/Tilt/index.js +2 -2
  85. package/Updaters/Wobble/index.d.ts +1 -1
  86. package/Updaters/Wobble/index.js +2 -2
  87. package/Utils/Plugins.d.ts +2 -2
  88. package/Utils/Plugins.js +4 -4
  89. package/Utils/Utils.d.ts +1 -2
  90. package/browser/Core/Container.d.ts +3 -1
  91. package/browser/Core/Container.js +17 -12
  92. package/browser/Core/InteractionManager.d.ts +1 -0
  93. package/browser/Core/InteractionManager.js +4 -1
  94. package/browser/Core/Particles.d.ts +1 -1
  95. package/browser/Core/Particles.js +3 -1
  96. package/browser/Enums/Modes/ResponsiveMode.d.ts +4 -0
  97. package/browser/Enums/Modes/ResponsiveMode.js +5 -0
  98. package/browser/Enums/Modes/index.d.ts +1 -0
  99. package/browser/Enums/Modes/index.js +1 -0
  100. package/browser/Interactions/External/Attract/index.d.ts +1 -1
  101. package/browser/Interactions/External/Attract/index.js +2 -2
  102. package/browser/Interactions/External/Bounce/index.d.ts +1 -1
  103. package/browser/Interactions/External/Bounce/index.js +2 -2
  104. package/browser/Interactions/External/Bubble/index.d.ts +1 -1
  105. package/browser/Interactions/External/Bubble/index.js +2 -2
  106. package/browser/Interactions/External/Connect/index.d.ts +1 -1
  107. package/browser/Interactions/External/Connect/index.js +2 -2
  108. package/browser/Interactions/External/Grab/index.d.ts +1 -1
  109. package/browser/Interactions/External/Grab/index.js +2 -2
  110. package/browser/Interactions/External/Repulse/index.d.ts +1 -1
  111. package/browser/Interactions/External/Repulse/index.js +2 -2
  112. package/browser/Interactions/External/Trail/index.d.ts +1 -1
  113. package/browser/Interactions/External/Trail/index.js +2 -2
  114. package/browser/Interactions/Particles/Attract/index.d.ts +1 -1
  115. package/browser/Interactions/Particles/Attract/index.js +2 -2
  116. package/browser/Interactions/Particles/Collisions/index.d.ts +1 -1
  117. package/browser/Interactions/Particles/Collisions/index.js +2 -2
  118. package/browser/Interactions/Particles/Links/index.d.ts +2 -2
  119. package/browser/Interactions/Particles/Links/index.js +5 -5
  120. package/browser/Interactions/Particles/Links/plugin.d.ts +1 -1
  121. package/browser/Interactions/Particles/Links/plugin.js +2 -2
  122. package/browser/Options/Classes/FullScreen/FullScreen.js +2 -2
  123. package/browser/Options/Classes/Interactivity/Interactivity.js +1 -1
  124. package/browser/Options/Classes/Options.js +4 -2
  125. package/browser/Options/Classes/Responsive.d.ts +2 -0
  126. package/browser/Options/Classes/Responsive.js +11 -0
  127. package/browser/Options/Interfaces/IResponsive.d.ts +2 -0
  128. package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  129. package/browser/Plugins/Absorbers/AbsorberInstance.js +21 -9
  130. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  131. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  132. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  133. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +17 -0
  134. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  135. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  136. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +1 -0
  137. package/browser/Plugins/Absorbers/plugin.d.ts +1 -1
  138. package/browser/Plugins/Absorbers/plugin.js +2 -2
  139. package/browser/Plugins/Emitters/plugin.d.ts +1 -1
  140. package/browser/Plugins/Emitters/plugin.js +2 -2
  141. package/browser/Plugins/PolygonMask/plugin.js +4 -2
  142. package/browser/Shapes/Circle/index.d.ts +1 -1
  143. package/browser/Shapes/Circle/index.js +2 -2
  144. package/browser/Shapes/Image/index.d.ts +1 -1
  145. package/browser/Shapes/Image/index.js +3 -3
  146. package/browser/Shapes/Line/index.d.ts +1 -1
  147. package/browser/Shapes/Line/index.js +2 -2
  148. package/browser/Shapes/Polygon/index.d.ts +3 -3
  149. package/browser/Shapes/Polygon/index.js +7 -7
  150. package/browser/Shapes/Square/index.d.ts +1 -1
  151. package/browser/Shapes/Square/index.js +3 -3
  152. package/browser/Shapes/Star/index.d.ts +1 -1
  153. package/browser/Shapes/Star/index.js +2 -2
  154. package/browser/Shapes/Text/index.d.ts +1 -1
  155. package/browser/Shapes/Text/index.js +2 -2
  156. package/browser/Updaters/Angle/index.d.ts +1 -1
  157. package/browser/Updaters/Angle/index.js +2 -2
  158. package/browser/Updaters/Color/index.d.ts +1 -1
  159. package/browser/Updaters/Color/index.js +2 -2
  160. package/browser/Updaters/Life/index.d.ts +1 -1
  161. package/browser/Updaters/Life/index.js +2 -2
  162. package/browser/Updaters/Opacity/index.d.ts +1 -1
  163. package/browser/Updaters/Opacity/index.js +2 -2
  164. package/browser/Updaters/OutModes/index.d.ts +1 -1
  165. package/browser/Updaters/OutModes/index.js +2 -2
  166. package/browser/Updaters/Roll/index.d.ts +1 -1
  167. package/browser/Updaters/Roll/index.js +2 -2
  168. package/browser/Updaters/Size/index.d.ts +1 -1
  169. package/browser/Updaters/Size/index.js +2 -2
  170. package/browser/Updaters/StrokeColor/index.d.ts +1 -1
  171. package/browser/Updaters/StrokeColor/index.js +2 -2
  172. package/browser/Updaters/Tilt/index.d.ts +1 -1
  173. package/browser/Updaters/Tilt/index.js +2 -2
  174. package/browser/Updaters/Wobble/index.d.ts +1 -1
  175. package/browser/Updaters/Wobble/index.js +2 -2
  176. package/browser/Utils/Plugins.d.ts +2 -2
  177. package/browser/Utils/Plugins.js +4 -4
  178. package/browser/Utils/Utils.d.ts +1 -2
  179. package/browser/full.d.ts +1 -1
  180. package/browser/full.js +9 -9
  181. package/browser/index.js +1 -1
  182. package/browser/index.slim.js +1 -1
  183. package/browser/main.d.ts +10 -6
  184. package/browser/main.js +20 -6
  185. package/browser/slim.d.ts +1 -1
  186. package/browser/slim.js +24 -24
  187. package/esm/Core/Container.d.ts +3 -1
  188. package/esm/Core/Container.js +16 -11
  189. package/esm/Core/InteractionManager.d.ts +1 -0
  190. package/esm/Core/InteractionManager.js +4 -1
  191. package/esm/Core/Particles.d.ts +1 -1
  192. package/esm/Core/Particles.js +3 -1
  193. package/esm/Enums/Modes/ResponsiveMode.d.ts +4 -0
  194. package/esm/Enums/Modes/ResponsiveMode.js +5 -0
  195. package/esm/Enums/Modes/index.d.ts +1 -0
  196. package/esm/Enums/Modes/index.js +1 -0
  197. package/esm/Interactions/External/Attract/index.d.ts +1 -1
  198. package/esm/Interactions/External/Attract/index.js +2 -2
  199. package/esm/Interactions/External/Bounce/index.d.ts +1 -1
  200. package/esm/Interactions/External/Bounce/index.js +2 -2
  201. package/esm/Interactions/External/Bubble/index.d.ts +1 -1
  202. package/esm/Interactions/External/Bubble/index.js +2 -2
  203. package/esm/Interactions/External/Connect/index.d.ts +1 -1
  204. package/esm/Interactions/External/Connect/index.js +2 -2
  205. package/esm/Interactions/External/Grab/index.d.ts +1 -1
  206. package/esm/Interactions/External/Grab/index.js +2 -2
  207. package/esm/Interactions/External/Repulse/index.d.ts +1 -1
  208. package/esm/Interactions/External/Repulse/index.js +2 -2
  209. package/esm/Interactions/External/Trail/index.d.ts +1 -1
  210. package/esm/Interactions/External/Trail/index.js +2 -2
  211. package/esm/Interactions/Particles/Attract/index.d.ts +1 -1
  212. package/esm/Interactions/Particles/Attract/index.js +2 -2
  213. package/esm/Interactions/Particles/Collisions/index.d.ts +1 -1
  214. package/esm/Interactions/Particles/Collisions/index.js +2 -2
  215. package/esm/Interactions/Particles/Links/index.d.ts +2 -2
  216. package/esm/Interactions/Particles/Links/index.js +5 -5
  217. package/esm/Interactions/Particles/Links/plugin.d.ts +1 -1
  218. package/esm/Interactions/Particles/Links/plugin.js +2 -2
  219. package/esm/Options/Classes/FullScreen/FullScreen.js +2 -2
  220. package/esm/Options/Classes/Interactivity/Interactivity.js +1 -1
  221. package/esm/Options/Classes/Options.js +4 -2
  222. package/esm/Options/Classes/Responsive.d.ts +2 -0
  223. package/esm/Options/Classes/Responsive.js +10 -0
  224. package/esm/Options/Interfaces/IResponsive.d.ts +2 -0
  225. package/esm/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  226. package/esm/Plugins/Absorbers/AbsorberInstance.js +21 -9
  227. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  228. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  229. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  230. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +17 -0
  231. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  232. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  233. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +1 -0
  234. package/esm/Plugins/Absorbers/plugin.d.ts +1 -1
  235. package/esm/Plugins/Absorbers/plugin.js +2 -2
  236. package/esm/Plugins/Emitters/plugin.d.ts +1 -1
  237. package/esm/Plugins/Emitters/plugin.js +2 -2
  238. package/esm/Plugins/PolygonMask/plugin.js +1 -1
  239. package/esm/Shapes/Circle/index.d.ts +1 -1
  240. package/esm/Shapes/Circle/index.js +2 -2
  241. package/esm/Shapes/Image/index.d.ts +1 -1
  242. package/esm/Shapes/Image/index.js +3 -3
  243. package/esm/Shapes/Line/index.d.ts +1 -1
  244. package/esm/Shapes/Line/index.js +2 -2
  245. package/esm/Shapes/Polygon/index.d.ts +3 -3
  246. package/esm/Shapes/Polygon/index.js +7 -7
  247. package/esm/Shapes/Square/index.d.ts +1 -1
  248. package/esm/Shapes/Square/index.js +3 -3
  249. package/esm/Shapes/Star/index.d.ts +1 -1
  250. package/esm/Shapes/Star/index.js +2 -2
  251. package/esm/Shapes/Text/index.d.ts +1 -1
  252. package/esm/Shapes/Text/index.js +2 -2
  253. package/esm/Updaters/Angle/index.d.ts +1 -1
  254. package/esm/Updaters/Angle/index.js +2 -2
  255. package/esm/Updaters/Color/index.d.ts +1 -1
  256. package/esm/Updaters/Color/index.js +2 -2
  257. package/esm/Updaters/Life/index.d.ts +1 -1
  258. package/esm/Updaters/Life/index.js +2 -2
  259. package/esm/Updaters/Opacity/index.d.ts +1 -1
  260. package/esm/Updaters/Opacity/index.js +2 -2
  261. package/esm/Updaters/OutModes/index.d.ts +1 -1
  262. package/esm/Updaters/OutModes/index.js +2 -2
  263. package/esm/Updaters/Roll/index.d.ts +1 -1
  264. package/esm/Updaters/Roll/index.js +2 -2
  265. package/esm/Updaters/Size/index.d.ts +1 -1
  266. package/esm/Updaters/Size/index.js +2 -2
  267. package/esm/Updaters/StrokeColor/index.d.ts +1 -1
  268. package/esm/Updaters/StrokeColor/index.js +2 -2
  269. package/esm/Updaters/Tilt/index.d.ts +1 -1
  270. package/esm/Updaters/Tilt/index.js +2 -2
  271. package/esm/Updaters/Wobble/index.d.ts +1 -1
  272. package/esm/Updaters/Wobble/index.js +2 -2
  273. package/esm/Utils/Plugins.d.ts +2 -2
  274. package/esm/Utils/Plugins.js +4 -4
  275. package/esm/Utils/Utils.d.ts +1 -2
  276. package/esm/full.d.ts +1 -1
  277. package/esm/full.js +9 -9
  278. package/esm/index.js +1 -1
  279. package/esm/index.slim.js +1 -1
  280. package/esm/main.d.ts +7 -6
  281. package/esm/main.js +17 -6
  282. package/esm/slim.d.ts +1 -1
  283. package/esm/slim.js +24 -24
  284. package/full.d.ts +1 -1
  285. package/full.js +9 -9
  286. package/index.js +1 -1
  287. package/index.slim.js +1 -1
  288. package/main.d.ts +7 -6
  289. package/main.js +17 -6
  290. package/package.json +1 -1
  291. package/report.html +2 -2
  292. package/report.slim.html +2 -2
  293. package/slim.d.ts +1 -1
  294. package/slim.js +24 -24
  295. package/tsparticles.js +743 -363
  296. package/tsparticles.min.js +2 -2
  297. package/tsparticles.pathseg.js +2 -2
  298. package/tsparticles.slim.js +539 -284
  299. package/tsparticles.slim.min.js +2 -2
@@ -1,4 +1,4 @@
1
1
  import { Collider } from "./Collider";
2
- export function loadParticlesCollisionsInteraction(tsParticles) {
3
- tsParticles.addInteractor("particlesCollisions", (container) => new Collider(container));
2
+ export async function loadParticlesCollisionsInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("particlesCollisions", (container) => new Collider(container));
4
4
  }
@@ -1,3 +1,3 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadInteraction(tsParticles: Main): void;
3
- export declare function loadParticlesLinksInteraction(tsParticles: Main): void;
2
+ export declare function loadInteraction(tsParticles: Main): Promise<void>;
3
+ export declare function loadParticlesLinksInteraction(tsParticles: Main): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import { Linker } from "./Linker";
2
2
  import { loadPlugin } from "./plugin";
3
- export function loadInteraction(tsParticles) {
4
- tsParticles.addInteractor("particlesLinks", (container) => new Linker(container));
3
+ export async function loadInteraction(tsParticles) {
4
+ await tsParticles.addInteractor("particlesLinks", (container) => new Linker(container));
5
5
  }
6
- export function loadParticlesLinksInteraction(tsParticles) {
7
- loadInteraction(tsParticles);
8
- loadPlugin(tsParticles);
6
+ export async function loadParticlesLinksInteraction(tsParticles) {
7
+ await loadInteraction(tsParticles);
8
+ await loadPlugin(tsParticles);
9
9
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadPlugin(tsParticles: Main): void;
2
+ export declare function loadPlugin(tsParticles: Main): Promise<void>;
@@ -12,7 +12,7 @@ class Plugin {
12
12
  loadOptions() {
13
13
  }
14
14
  }
15
- export function loadPlugin(tsParticles) {
15
+ export async function loadPlugin(tsParticles) {
16
16
  const plugin = new Plugin();
17
- tsParticles.addPlugin(plugin);
17
+ await tsParticles.addPlugin(plugin);
18
18
  }
@@ -1,7 +1,7 @@
1
1
  export class FullScreen {
2
2
  constructor() {
3
- this.enable = false;
4
- this.zIndex = -1;
3
+ this.enable = true;
4
+ this.zIndex = 0;
5
5
  }
6
6
  load(data) {
7
7
  if (!data) {
@@ -3,7 +3,7 @@ import { Events } from "./Events/Events";
3
3
  import { Modes } from "./Modes/Modes";
4
4
  export class Interactivity {
5
5
  constructor() {
6
- this.detectsOn = InteractivityDetect.canvas;
6
+ this.detectsOn = InteractivityDetect.window;
7
7
  this.events = new Events();
8
8
  this.modes = new Modes();
9
9
  }
@@ -10,7 +10,7 @@ import { BackgroundMask } from "./BackgroundMask/BackgroundMask";
10
10
  import { Background } from "./Background/Background";
11
11
  import { Plugins } from "../../Utils";
12
12
  import { Theme } from "./Theme/Theme";
13
- import { ThemeMode } from "../../Enums";
13
+ import { ResponsiveMode, ThemeMode } from "../../Enums";
14
14
  import { FullScreen } from "./FullScreen/FullScreen";
15
15
  import { Motion } from "./Motion/Motion";
16
16
  import { ManualParticle } from "./ManualParticle";
@@ -145,7 +145,9 @@ export class Options {
145
145
  }
146
146
  setResponsive(width, pxRatio, defaultOptions) {
147
147
  this.load(defaultOptions);
148
- const responsiveOptions = this.responsive.find((t) => t.maxWidth * pxRatio > width);
148
+ const responsiveOptions = this.responsive.find((t) => t.mode === ResponsiveMode.screen && screen
149
+ ? t.maxWidth * pxRatio > screen.availWidth
150
+ : t.maxWidth * pxRatio > width);
149
151
  this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
150
152
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
151
153
  }
@@ -2,9 +2,11 @@ import type { IResponsive } from "../Interfaces/IResponsive";
2
2
  import type { IOptionLoader } from "../Interfaces/IOptionLoader";
3
3
  import type { RecursivePartial } from "../../Types";
4
4
  import type { IOptions } from "../Interfaces/IOptions";
5
+ import { ResponsiveMode } from "../../Enums";
5
6
  export declare class Responsive implements IResponsive, IOptionLoader<IResponsive> {
6
7
  maxWidth: number;
7
8
  options: RecursivePartial<IOptions>;
9
+ mode: ResponsiveMode;
8
10
  constructor();
9
11
  load(data?: RecursivePartial<IResponsive>): void;
10
12
  }
@@ -1,8 +1,10 @@
1
1
  import { deepExtend } from "../../Utils";
2
+ import { ResponsiveMode } from "../../Enums";
2
3
  export class Responsive {
3
4
  constructor() {
4
5
  this.maxWidth = Infinity;
5
6
  this.options = {};
7
+ this.mode = ResponsiveMode.canvas;
6
8
  }
7
9
  load(data) {
8
10
  if (!data) {
@@ -11,6 +13,14 @@ export class Responsive {
11
13
  if (data.maxWidth !== undefined) {
12
14
  this.maxWidth = data.maxWidth;
13
15
  }
16
+ if (data.mode !== undefined) {
17
+ if (data.mode === ResponsiveMode.screen) {
18
+ this.mode = ResponsiveMode.screen;
19
+ }
20
+ else {
21
+ this.mode = ResponsiveMode.canvas;
22
+ }
23
+ }
14
24
  if (data.options !== undefined) {
15
25
  this.options = deepExtend({}, data.options);
16
26
  }
@@ -1,6 +1,8 @@
1
+ import { ResponsiveMode } from "../../Enums";
1
2
  import type { RecursivePartial } from "../../Types";
2
3
  import type { IOptions } from "./IOptions";
3
4
  export interface IResponsive {
4
5
  maxWidth: number;
5
6
  options: RecursivePartial<IOptions>;
7
+ mode: ResponsiveMode;
6
8
  }
@@ -5,6 +5,7 @@ import type { IAbsorber } from "./Options/Interfaces/IAbsorber";
5
5
  import type { Absorbers } from "./Absorbers";
6
6
  import { Vector } from "../../Core/Particle/Vector";
7
7
  import { RotateDirection } from "../../Enums";
8
+ import { IAbsorberSizeLimit } from "./Options/Interfaces/IAbsorberSizeLimit";
8
9
  declare type OrbitingParticle = Particle & {
9
10
  absorberOrbit?: Vector;
10
11
  absorberOrbitDirection?: RotateDirection;
@@ -17,7 +18,7 @@ export declare class AbsorberInstance {
17
18
  opacity: number;
18
19
  size: number;
19
20
  color: IRgb;
20
- limit?: number;
21
+ limit: IAbsorberSizeLimit;
21
22
  readonly name?: string;
22
23
  position: Vector;
23
24
  private dragging;
@@ -3,7 +3,7 @@ import { Vector } from "../../Core/Particle/Vector";
3
3
  import { RotateDirection } from "../../Enums";
4
4
  export class AbsorberInstance {
5
5
  constructor(absorbers, container, options, position) {
6
- var _a, _b, _c;
6
+ var _a, _b, _c, _d, _e;
7
7
  this.absorbers = absorbers;
8
8
  this.container = container;
9
9
  this.initialPosition = position ? Vector.create(position.x, position.y) : undefined;
@@ -14,14 +14,23 @@ export class AbsorberInstance {
14
14
  this.size = getRangeValue(options.size.value) * container.retina.pixelRatio;
15
15
  this.mass = this.size * options.size.density * container.retina.reduceFactor;
16
16
  const limit = options.size.limit;
17
- this.limit = limit !== undefined ? limit * container.retina.pixelRatio * container.retina.reduceFactor : limit;
17
+ this.limit =
18
+ typeof limit === "number"
19
+ ? {
20
+ radius: limit * container.retina.pixelRatio * container.retina.reduceFactor,
21
+ mass: 0,
22
+ }
23
+ : {
24
+ radius: ((_a = limit === null || limit === void 0 ? void 0 : limit.radius) !== null && _a !== void 0 ? _a : 0) * container.retina.pixelRatio * container.retina.reduceFactor,
25
+ mass: (_b = limit === null || limit === void 0 ? void 0 : limit.mass) !== null && _b !== void 0 ? _b : 0,
26
+ };
18
27
  const color = typeof options.color === "string" ? { value: options.color } : options.color;
19
- this.color = (_a = colorToRgb(color)) !== null && _a !== void 0 ? _a : {
28
+ this.color = (_c = colorToRgb(color)) !== null && _c !== void 0 ? _c : {
20
29
  b: 0,
21
30
  g: 0,
22
31
  r: 0,
23
32
  };
24
- this.position = (_c = (_b = this.initialPosition) === null || _b === void 0 ? void 0 : _b.copy()) !== null && _c !== void 0 ? _c : this.calcPosition();
33
+ this.position = (_e = (_d = this.initialPosition) === null || _d === void 0 ? void 0 : _d.copy()) !== null && _e !== void 0 ? _e : this.calcPosition();
25
34
  }
26
35
  attract(particle) {
27
36
  const container = this.container;
@@ -64,10 +73,12 @@ export class AbsorberInstance {
64
73
  }
65
74
  this.updateParticlePosition(particle, v);
66
75
  }
67
- if (this.limit === undefined || this.size < this.limit) {
76
+ if (this.limit.radius <= 0 || this.size < this.limit.radius) {
68
77
  this.size += sizeFactor;
69
78
  }
70
- this.mass += sizeFactor * this.options.size.density * container.retina.reduceFactor;
79
+ if (this.limit.mass <= 0 || this.mass < this.limit.mass) {
80
+ this.mass += sizeFactor * this.options.size.density * container.retina.reduceFactor;
81
+ }
71
82
  }
72
83
  else {
73
84
  this.updateParticlePosition(particle, v);
@@ -102,9 +113,10 @@ export class AbsorberInstance {
102
113
  const container = this.container;
103
114
  const canvasSize = container.canvas.size;
104
115
  if (particle.needsNewPosition) {
105
- const pSize = particle.getRadius();
106
- particle.position.x = (canvasSize.width - pSize * 2) * (1 + (Math.random() * 0.2 - 0.1)) + pSize;
107
- particle.position.y = (canvasSize.height - pSize * 2) * (1 + (Math.random() * 0.2 - 0.1)) + pSize;
116
+ particle.position.x = Math.floor(Math.random() * canvasSize.width);
117
+ particle.position.y = Math.floor(Math.random() * canvasSize.height);
118
+ particle.velocity.setTo(particle.initialVelocity);
119
+ particle.absorberOrbit = undefined;
108
120
  particle.needsNewPosition = false;
109
121
  }
110
122
  if (this.options.orbits) {
@@ -2,9 +2,10 @@ import type { IAbsorberSize } from "../Interfaces/IAbsorberSize";
2
2
  import type { RecursivePartial } from "../../../../Types";
3
3
  import type { IOptionLoader } from "../../../../Options/Interfaces/IOptionLoader";
4
4
  import { ValueWithRandom } from "../../../../Options/Classes/ValueWithRandom";
5
+ import { AbsorberSizeLimit } from "./AbsorberSizeLimit";
5
6
  export declare class AbsorberSize extends ValueWithRandom implements IAbsorberSize, IOptionLoader<IAbsorberSize> {
6
7
  density: number;
7
- limit?: number;
8
+ limit: AbsorberSizeLimit;
8
9
  constructor();
9
10
  load(data?: RecursivePartial<IAbsorberSize>): void;
10
11
  }
@@ -1,10 +1,12 @@
1
1
  import { ValueWithRandom } from "../../../../Options/Classes/ValueWithRandom";
2
+ import { AbsorberSizeLimit } from "./AbsorberSizeLimit";
2
3
  export class AbsorberSize extends ValueWithRandom {
3
4
  constructor() {
4
5
  super();
5
6
  this.density = 5;
6
7
  this.random.minimumValue = 1;
7
8
  this.value = 50;
9
+ this.limit = new AbsorberSizeLimit();
8
10
  }
9
11
  load(data) {
10
12
  if (!data) {
@@ -14,11 +16,11 @@ export class AbsorberSize extends ValueWithRandom {
14
16
  if (data.density !== undefined) {
15
17
  this.density = data.density;
16
18
  }
17
- if (data.limit !== undefined) {
18
- this.limit = data.limit;
19
+ if (typeof data.limit === "number") {
20
+ this.limit.radius = data.limit;
19
21
  }
20
- if (data.limit !== undefined) {
21
- this.limit = data.limit;
22
+ else {
23
+ this.limit.load(data.limit);
22
24
  }
23
25
  }
24
26
  }
@@ -0,0 +1,9 @@
1
+ import type { RecursivePartial } from "../../../../Types";
2
+ import type { IOptionLoader } from "../../../../Options/Interfaces/IOptionLoader";
3
+ import type { IAbsorberSizeLimit } from "../Interfaces/IAbsorberSizeLimit";
4
+ export declare class AbsorberSizeLimit implements IAbsorberSizeLimit, IOptionLoader<IAbsorberSizeLimit> {
5
+ radius: number;
6
+ mass: number;
7
+ constructor();
8
+ load(data?: RecursivePartial<IAbsorberSizeLimit>): void;
9
+ }
@@ -0,0 +1,17 @@
1
+ export class AbsorberSizeLimit {
2
+ constructor() {
3
+ this.radius = 0;
4
+ this.mass = 0;
5
+ }
6
+ load(data) {
7
+ if (!data) {
8
+ return;
9
+ }
10
+ if (data.mass !== undefined) {
11
+ this.mass = data.mass;
12
+ }
13
+ if (data.radius !== undefined) {
14
+ this.radius = data.radius;
15
+ }
16
+ }
17
+ }
@@ -1,5 +1,6 @@
1
- import { IValueWithRandom } from "../../../../Options/Interfaces/IValueWithRandom";
1
+ import type { IValueWithRandom } from "../../../../Options/Interfaces/IValueWithRandom";
2
+ import type { IAbsorberSizeLimit } from "./IAbsorberSizeLimit";
2
3
  export interface IAbsorberSize extends IValueWithRandom {
3
- limit?: number;
4
+ limit?: number | IAbsorberSizeLimit;
4
5
  density: number;
5
6
  }
@@ -0,0 +1,4 @@
1
+ export interface IAbsorberSizeLimit {
2
+ radius: number;
3
+ mass: number;
4
+ }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadAbsorbersPlugin(tsParticles: Main): void;
2
+ export declare function loadAbsorbersPlugin(tsParticles: Main): Promise<void>;
@@ -71,7 +71,7 @@ class Plugin {
71
71
  }
72
72
  }
73
73
  }
74
- export function loadAbsorbersPlugin(tsParticles) {
74
+ export async function loadAbsorbersPlugin(tsParticles) {
75
75
  const plugin = new Plugin();
76
- tsParticles.addPlugin(plugin);
76
+ await tsParticles.addPlugin(plugin);
77
77
  }
@@ -1,3 +1,3 @@
1
1
  import { EmittersMain } from "./EmittersMain";
2
- export declare function loadEmittersPlugin(tsParticles: EmittersMain): void;
2
+ export declare function loadEmittersPlugin(tsParticles: EmittersMain): Promise<void>;
3
3
  export * from "./EmittersMain";
@@ -64,9 +64,9 @@ class EmittersPlugin {
64
64
  }
65
65
  }
66
66
  }
67
- export function loadEmittersPlugin(tsParticles) {
67
+ export async function loadEmittersPlugin(tsParticles) {
68
68
  const plugin = new EmittersPlugin();
69
- tsParticles.addPlugin(plugin);
69
+ await tsParticles.addPlugin(plugin);
70
70
  if (!tsParticles.addEmitterShape) {
71
71
  tsParticles.addEmitterShape = (name, shape) => {
72
72
  ShapeManager.addShape(name, shape);
@@ -30,5 +30,5 @@ export async function loadPolygonMaskPlugin(tsParticles) {
30
30
  await import("./pathseg");
31
31
  }
32
32
  const plugin = new Plugin();
33
- tsParticles.addPlugin(plugin);
33
+ await tsParticles.addPlugin(plugin);
34
34
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadCircleShape(tsParticles: Main): void;
2
+ export declare function loadCircleShape(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { CircleDrawer } from "./CircleDrawer";
2
- export function loadCircleShape(tsParticles) {
3
- tsParticles.addShape("circle", new CircleDrawer());
2
+ export async function loadCircleShape(tsParticles) {
3
+ await tsParticles.addShape("circle", new CircleDrawer());
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadImageShape(tsParticles: Main): void;
2
+ export declare function loadImageShape(tsParticles: Main): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { ImageDrawer } from "./ImageDrawer";
2
- export function loadImageShape(tsParticles) {
2
+ export async function loadImageShape(tsParticles) {
3
3
  const imageDrawer = new ImageDrawer();
4
- tsParticles.addShape("image", imageDrawer);
5
- tsParticles.addShape("images", imageDrawer);
4
+ await tsParticles.addShape("image", imageDrawer);
5
+ await tsParticles.addShape("images", imageDrawer);
6
6
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadLineShape(tsParticles: Main): void;
2
+ export declare function loadLineShape(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { LineDrawer } from "./LineDrawer";
2
- export function loadLineShape(tsParticles) {
3
- tsParticles.addShape("line", new LineDrawer());
2
+ export async function loadLineShape(tsParticles) {
3
+ await tsParticles.addShape("line", new LineDrawer());
4
4
  }
@@ -1,4 +1,4 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadGenericPolygonShape(tsParticles: Main): void;
3
- export declare function loadTriangleShape(tsParticles: Main): void;
4
- export declare function loadPolygonShape(tsParticles: Main): void;
2
+ export declare function loadGenericPolygonShape(tsParticles: Main): Promise<void>;
3
+ export declare function loadTriangleShape(tsParticles: Main): Promise<void>;
4
+ export declare function loadPolygonShape(tsParticles: Main): Promise<void>;
@@ -1,12 +1,12 @@
1
1
  import { PolygonDrawer } from "./PolygonDrawer";
2
2
  import { TriangleDrawer } from "./TriangleDrawer";
3
- export function loadGenericPolygonShape(tsParticles) {
4
- tsParticles.addShape("polygon", new PolygonDrawer());
3
+ export async function loadGenericPolygonShape(tsParticles) {
4
+ await tsParticles.addShape("polygon", new PolygonDrawer());
5
5
  }
6
- export function loadTriangleShape(tsParticles) {
7
- tsParticles.addShape("triangle", new TriangleDrawer());
6
+ export async function loadTriangleShape(tsParticles) {
7
+ await tsParticles.addShape("triangle", new TriangleDrawer());
8
8
  }
9
- export function loadPolygonShape(tsParticles) {
10
- loadGenericPolygonShape(tsParticles);
11
- loadTriangleShape(tsParticles);
9
+ export async function loadPolygonShape(tsParticles) {
10
+ await loadGenericPolygonShape(tsParticles);
11
+ await loadTriangleShape(tsParticles);
12
12
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadSquareShape(tsParticles: Main): void;
2
+ export declare function loadSquareShape(tsParticles: Main): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { SquareDrawer } from "./SquareDrawer";
2
- export function loadSquareShape(tsParticles) {
2
+ export async function loadSquareShape(tsParticles) {
3
3
  const drawer = new SquareDrawer();
4
- tsParticles.addShape("edge", drawer);
5
- tsParticles.addShape("square", drawer);
4
+ await tsParticles.addShape("edge", drawer);
5
+ await tsParticles.addShape("square", drawer);
6
6
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadStarShape(tsParticles: Main): void;
2
+ export declare function loadStarShape(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { StarDrawer } from "./StarDrawer";
2
- export function loadStarShape(tsParticles) {
3
- tsParticles.addShape("star", new StarDrawer());
2
+ export async function loadStarShape(tsParticles) {
3
+ await tsParticles.addShape("star", new StarDrawer());
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadTextShape(tsParticles: Main): void;
2
+ export declare function loadTextShape(tsParticles: Main): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { validTypes, TextDrawer } from "./TextDrawer";
2
- export function loadTextShape(tsParticles) {
2
+ export async function loadTextShape(tsParticles) {
3
3
  const drawer = new TextDrawer();
4
4
  for (const type of validTypes) {
5
- tsParticles.addShape(type, drawer);
5
+ await tsParticles.addShape(type, drawer);
6
6
  }
7
7
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadAngleUpdater(tsParticles: Main): void;
2
+ export declare function loadAngleUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { AngleUpdater } from "./AngleUpdater";
2
- export function loadAngleUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("angle", (container) => new AngleUpdater(container));
2
+ export async function loadAngleUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("angle", (container) => new AngleUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadColorUpdater(tsParticles: Main): void;
2
+ export declare function loadColorUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { ColorUpdater } from "./ColorUpdater";
2
- export function loadColorUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("color", (container) => new ColorUpdater(container));
2
+ export async function loadColorUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("color", (container) => new ColorUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadLifeUpdater(tsParticles: Main): void;
2
+ export declare function loadLifeUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { LifeUpdater } from "./LifeUpdater";
2
- export function loadLifeUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("life", (container) => new LifeUpdater(container));
2
+ export async function loadLifeUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("life", (container) => new LifeUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadOpacityUpdater(tsParticles: Main): void;
2
+ export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { OpacityUpdater } from "./OpacityUpdater";
2
- export function loadOpacityUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater(container));
2
+ export async function loadOpacityUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadOutModesUpdater(tsParticles: Main): void;
2
+ export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater";
2
- export function loadOutModesUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container));
2
+ export async function loadOutModesUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadRollUpdater(tsParticles: Main): void;
2
+ export declare function loadRollUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { RollUpdater } from "./RollUpdater";
2
- export function loadRollUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("roll", () => new RollUpdater());
2
+ export async function loadRollUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("roll", () => new RollUpdater());
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadSizeUpdater(tsParticles: Main): void;
2
+ export declare function loadSizeUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { SizeUpdater } from "./SizeUpdater";
2
- export function loadSizeUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("size", () => new SizeUpdater());
2
+ export async function loadSizeUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("size", () => new SizeUpdater());
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadStrokeColorUpdater(tsParticles: Main): void;
2
+ export declare function loadStrokeColorUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { StrokeColorUpdater } from "./StrokeColorUpdater";
2
- export function loadStrokeColorUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater(container));
2
+ export async function loadStrokeColorUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadTiltUpdater(tsParticles: Main): void;
2
+ export declare function loadTiltUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { TiltUpdater } from "./TiltUpdater";
2
- export function loadTiltUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("tilt", (container) => new TiltUpdater(container));
2
+ export async function loadTiltUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("tilt", (container) => new TiltUpdater(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadWobbleUpdater(tsParticles: Main): void;
2
+ export declare function loadWobbleUpdater(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { WobbleUpdater } from "./WobbleUpdater";
2
- export function loadWobbleUpdater(tsParticles) {
3
- tsParticles.addParticleUpdater("wobble", (container) => new WobbleUpdater(container));
2
+ export async function loadWobbleUpdater(tsParticles) {
3
+ await tsParticles.addParticleUpdater("wobble", (container) => new WobbleUpdater(container));
4
4
  }