@tsparticles/pjs 3.0.3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.3
7
+ * v3.1.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -98,6 +98,10 @@ __webpack_require__.d(__webpack_exports__, {
98
98
  var engine_root_window_ = __webpack_require__(533);
99
99
  ;// CONCATENATED MODULE: ./dist/browser/marcbruederlin/Particles.js
100
100
 
101
+ const linksMinDistance = 120,
102
+ moveMinSpeed = 0.5,
103
+ particlesMinCount = 100,
104
+ sizeMinValue = 3;
101
105
  class Particles {
102
106
  static init(options) {
103
107
  const particles = new Particles(),
@@ -109,9 +113,9 @@ class Particles {
109
113
  if (!el) {
110
114
  throw new Error("No element found for selector");
111
115
  }
112
- engine_root_window_.tsParticles.load({
113
- id: selector.replace(".", "").replace("!", ""),
116
+ void engine_root_window_.tsParticles.load({
114
117
  element: el,
118
+ id: selector.replace(".", "").replace("!", ""),
115
119
  options: {
116
120
  fullScreen: {
117
121
  enable: false
@@ -122,20 +126,20 @@ class Particles {
122
126
  },
123
127
  links: {
124
128
  color: "random",
125
- distance: options.minDistance ?? 120,
129
+ distance: options.minDistance ?? linksMinDistance,
126
130
  enable: options.connectParticles ?? false
127
131
  },
128
132
  move: {
129
133
  enable: true,
130
- speed: options.speed ?? 0.5
134
+ speed: options.speed ?? moveMinSpeed
131
135
  },
132
136
  number: {
133
- value: options.maxParticles ?? 100
137
+ value: options.maxParticles ?? particlesMinCount
134
138
  },
135
139
  size: {
136
140
  value: {
137
141
  min: 1,
138
- max: options.sizeVariations ?? 3
142
+ max: options.sizeVariations ?? sizeMinValue
139
143
  }
140
144
  }
141
145
  },
@@ -171,129 +175,132 @@ class Particles {
171
175
  }
172
176
  destroy() {
173
177
  const container = this._container;
174
- container && container.destroy();
178
+ container?.destroy();
175
179
  }
176
180
  pauseAnimation() {
177
181
  const container = this._container;
178
- container && container.pause();
182
+ container?.pause();
179
183
  }
180
184
  resumeAnimation() {
181
185
  const container = this._container;
182
- container && container.play();
186
+ container?.play();
183
187
  }
184
188
  }
185
189
  ;// CONCATENATED MODULE: ./dist/browser/VincentGarreau/particles.js
186
190
 
187
- const defaultPjsOptions = {
188
- particles: {
189
- number: {
190
- value: 400,
191
- density: {
192
- enable: true,
193
- value_area: 800
194
- }
195
- },
196
- color: {
197
- value: "#fff"
198
- },
199
- shape: {
200
- type: "circle",
201
- stroke: {
202
- width: 0,
203
- color: "#ff0000"
191
+ const defaultMinOpacity = 0,
192
+ defaultMinSize = 0,
193
+ speedFactor = 3,
194
+ defaultPjsOptions = {
195
+ particles: {
196
+ number: {
197
+ value: 400,
198
+ density: {
199
+ enable: true,
200
+ value_area: 800
201
+ }
204
202
  },
205
- polygon: {
206
- nb_sides: 5
203
+ color: {
204
+ value: "#fff"
207
205
  },
208
- image: {
209
- src: "",
210
- width: 100,
211
- height: 100
212
- }
213
- },
214
- opacity: {
215
- value: 1,
216
- random: false,
217
- anim: {
218
- enable: false,
219
- speed: 2,
220
- opacity_min: 0,
221
- sync: false
222
- }
223
- },
224
- size: {
225
- value: 20,
226
- random: false,
227
- anim: {
228
- enable: false,
229
- speed: 20,
230
- size_min: 0,
231
- sync: false
232
- }
233
- },
234
- line_linked: {
235
- enable: true,
236
- distance: 100,
237
- color: "#fff",
238
- opacity: 1,
239
- width: 1
240
- },
241
- move: {
242
- enable: true,
243
- speed: 2,
244
- direction: "none",
245
- random: false,
246
- straight: false,
247
- out_mode: "out",
248
- bounce: false,
249
- attract: {
250
- enable: false,
251
- rotateX: 3000,
252
- rotateY: 3000
253
- }
254
- }
255
- },
256
- interactivity: {
257
- detect_on: "canvas",
258
- events: {
259
- onhover: {
260
- enable: true,
261
- mode: "grab"
206
+ shape: {
207
+ type: "circle",
208
+ stroke: {
209
+ width: 0,
210
+ color: "#ff0000"
211
+ },
212
+ polygon: {
213
+ nb_sides: 5
214
+ },
215
+ image: {
216
+ src: "",
217
+ width: 100,
218
+ height: 100
219
+ }
262
220
  },
263
- onclick: {
264
- enable: true,
265
- mode: "push"
221
+ opacity: {
222
+ value: 1,
223
+ random: false,
224
+ anim: {
225
+ enable: false,
226
+ speed: 2,
227
+ opacity_min: 0,
228
+ sync: false
229
+ }
266
230
  },
267
- resize: true
268
- },
269
- modes: {
270
- grab: {
271
- distance: 100,
272
- line_linked: {
273
- opacity: 1
231
+ size: {
232
+ value: 20,
233
+ random: false,
234
+ anim: {
235
+ enable: false,
236
+ speed: 20,
237
+ size_min: 0,
238
+ sync: false
274
239
  }
275
240
  },
276
- bubble: {
277
- distance: 200,
278
- size: 80,
279
- duration: 0.4,
241
+ line_linked: {
242
+ enable: true,
243
+ distance: 100,
244
+ color: "#fff",
280
245
  opacity: 1,
281
- speed: 3
282
- },
283
- repulse: {
284
- distance: 200,
285
- duration: 0.4
246
+ width: 1
286
247
  },
287
- push: {
288
- particles_nb: 4
248
+ move: {
249
+ enable: true,
250
+ speed: 2,
251
+ direction: "none",
252
+ random: false,
253
+ straight: false,
254
+ out_mode: "out",
255
+ bounce: false,
256
+ attract: {
257
+ enable: false,
258
+ rotateX: 3000,
259
+ rotateY: 3000
260
+ }
261
+ }
262
+ },
263
+ interactivity: {
264
+ detect_on: "canvas",
265
+ events: {
266
+ onhover: {
267
+ enable: true,
268
+ mode: "grab"
269
+ },
270
+ onclick: {
271
+ enable: true,
272
+ mode: "push"
273
+ },
274
+ resize: true
289
275
  },
290
- remove: {
291
- particles_nb: 2
276
+ modes: {
277
+ grab: {
278
+ distance: 100,
279
+ line_linked: {
280
+ opacity: 1
281
+ }
282
+ },
283
+ bubble: {
284
+ distance: 200,
285
+ size: 80,
286
+ duration: 0.4,
287
+ opacity: 1,
288
+ speed: 3
289
+ },
290
+ repulse: {
291
+ distance: 200,
292
+ duration: 0.4
293
+ },
294
+ push: {
295
+ particles_nb: 4
296
+ },
297
+ remove: {
298
+ particles_nb: 2
299
+ }
292
300
  }
293
- }
294
- },
295
- retina_detect: false
296
- };
301
+ },
302
+ retina_detect: false
303
+ };
297
304
  const initParticlesJS = engine => {
298
305
  const particlesJS = (tagId, options) => {
299
306
  const fixedOptions = (0,engine_root_window_.deepExtend)(defaultPjsOptions, options);
@@ -381,7 +388,7 @@ const initParticlesJS = engine => {
381
388
  },
382
389
  opacity: {
383
390
  value: fixedOptions.particles.opacity.random ? {
384
- min: fixedOptions.particles.opacity.anim.enable ? fixedOptions.particles.opacity.anim.opacity_min : 0,
391
+ min: fixedOptions.particles.opacity.anim.enable ? fixedOptions.particles.opacity.anim.opacity_min : defaultMinOpacity,
385
392
  max: fixedOptions.particles.opacity.value
386
393
  } : fixedOptions.particles.opacity.value,
387
394
  animation: {
@@ -392,7 +399,7 @@ const initParticlesJS = engine => {
392
399
  },
393
400
  size: {
394
401
  value: fixedOptions.particles.size.random ? {
395
- min: fixedOptions.particles.size.anim.enable ? fixedOptions.particles.size.anim.size_min : 0,
402
+ min: fixedOptions.particles.size.anim.enable ? fixedOptions.particles.size.anim.size_min : defaultMinSize,
396
403
  max: fixedOptions.particles.size.value
397
404
  } : fixedOptions.particles.size.value,
398
405
  animation: {
@@ -410,7 +417,7 @@ const initParticlesJS = engine => {
410
417
  },
411
418
  move: {
412
419
  enable: fixedOptions.particles.move.enable,
413
- speed: fixedOptions.particles.move.speed / 3,
420
+ speed: fixedOptions.particles.move.speed / speedFactor,
414
421
  direction: fixedOptions.particles.move.direction,
415
422
  random: fixedOptions.particles.move.random,
416
423
  straight: fixedOptions.particles.move.straight,
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.pjs.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var a in i)("object"==typeof exports?exports:e)[a]=i[a]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.d=(e,t)=>{for(var i in t)a.o(t,i)&&!a.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{a.r(n),a.d(n,{initPjs:()=>o});var e=a(533);class t{static init(i){const a=new t,n=i.selector;if(!n)throw new Error("No selector provided");const o=document.querySelector(n);if(!o)throw new Error("No element found for selector");return e.tsParticles.load({id:n.replace(".","").replace("!",""),element:o,options:{fullScreen:{enable:!1},particles:{color:{value:i.color??"!000000"},links:{color:"random",distance:i.minDistance??120,enable:i.connectParticles??!1},move:{enable:!0,speed:i.speed??.5},number:{value:i.maxParticles??100},size:{value:{min:1,max:i.sizeVariations??3}}},responsive:i.responsive?.map((e=>({maxWidth:e.breakpoint,options:{particles:{color:{value:e.options?.color},links:{distance:e.options?.minDistance,enable:e.options?.connectParticles},number:{value:i.maxParticles},move:{enable:!0,speed:e.options?.speed},size:{value:e.options?.sizeVariations}}}})))}}).then((e=>{a._container=e})),a}destroy(){const e=this._container;e&&e.destroy()}pauseAnimation(){const e=this._container;e&&e.pause()}resumeAnimation(){const e=this._container;e&&e.play()}}const i={particles:{number:{value:400,density:{enable:!0,value_area:800}},color:{value:"#fff"},shape:{type:"circle",stroke:{width:0,color:"#ff0000"},polygon:{nb_sides:5},image:{src:"",width:100,height:100}},opacity:{value:1,random:!1,anim:{enable:!1,speed:2,opacity_min:0,sync:!1}},size:{value:20,random:!1,anim:{enable:!1,speed:20,size_min:0,sync:!1}},line_linked:{enable:!0,distance:100,color:"#fff",opacity:1,width:1},move:{enable:!0,speed:2,direction:"none",random:!1,straight:!1,out_mode:"out",bounce:!1,attract:{enable:!1,rotateX:3e3,rotateY:3e3}}},interactivity:{detect_on:"canvas",events:{onhover:{enable:!0,mode:"grab"},onclick:{enable:!0,mode:"push"},resize:!0},modes:{grab:{distance:100,line_linked:{opacity:1}},bubble:{distance:200,size:80,duration:.4,opacity:1,speed:3},repulse:{distance:200,duration:.4},push:{particles_nb:4},remove:{particles_nb:2}}},retina_detect:!1},o=a=>{const{particlesJS:n,pJSDom:o}=(t=>{const a=(a,n)=>{const o=(0,e.deepExtend)(i,n);return t.load({id:a,options:{fullScreen:{enable:!1},detectRetina:o.retina_detect,smooth:!0,interactivity:{detectsOn:o.interactivity.detect_on,events:{onHover:{enable:o.interactivity.events.onhover.enable,mode:o.interactivity.events.onhover.mode},onClick:{enable:o.interactivity.events.onclick.enable,mode:o.interactivity.events.onclick.mode},resize:{enable:o.interactivity.events.resize}},modes:{grab:{distance:o.interactivity.modes.grab.distance,links:{opacity:o.interactivity.modes.grab.line_linked.opacity}},bubble:{distance:o.interactivity.modes.bubble.distance,size:o.interactivity.modes.bubble.size,duration:o.interactivity.modes.bubble.duration,opacity:o.interactivity.modes.bubble.opacity,speed:o.interactivity.modes.bubble.speed},repulse:{distance:o.interactivity.modes.repulse.distance,duration:o.interactivity.modes.repulse.duration},push:{quantity:o.interactivity.modes.push.particles_nb},remove:{quantity:o.interactivity.modes.remove.particles_nb}}},particles:{collisions:{enable:o.particles.move.bounce},number:{value:o.particles.number.value,density:{enable:o.particles.number.density.enable,width:o.particles.number.density.value_area}},color:{value:o.particles.color.value},stroke:{width:o.particles.shape.stroke.width,color:{value:o.particles.shape.stroke.color}},shape:{type:o.particles.shape.type,options:{polygon:{sides:o.particles.shape.polygon.nb_sides},image:{src:o.particles.shape.image.src,width:o.particles.shape.image.width,height:o.particles.shape.image.height}}},opacity:{value:o.particles.opacity.random?{min:o.particles.opacity.anim.enable?o.particles.opacity.anim.opacity_min:0,max:o.particles.opacity.value}:o.particles.opacity.value,animation:{enable:o.particles.opacity.anim.enable,speed:o.particles.opacity.anim.speed,sync:o.particles.opacity.anim.sync}},size:{value:o.particles.size.random?{min:o.particles.size.anim.enable?o.particles.size.anim.size_min:0,max:o.particles.size.value}:o.particles.size.value,animation:{enable:o.particles.size.anim.enable,speed:o.particles.size.anim.speed,sync:o.particles.size.anim.sync}},links:{enable:o.particles.line_linked.enable,distance:o.particles.line_linked.distance,color:o.particles.line_linked.color,opacity:o.particles.line_linked.opacity,width:o.particles.line_linked.width},move:{enable:o.particles.move.enable,speed:o.particles.move.speed/3,direction:o.particles.move.direction,random:o.particles.move.random,straight:o.particles.move.straight,outModes:o.particles.move.out_mode,attract:{enable:o.particles.move.attract.enable,rotate:{x:o.particles.move.attract.rotateX,y:o.particles.move.attract.rotateY}}}}}})};return a.load=(e,i,a)=>{t.load({id:e,url:i}).then((e=>{e&&a(e)})).catch((()=>{a(void 0)}))},a.setOnClickHandler=e=>{t.setOnClickHandler(e)},{particlesJS:a,pJSDom:t.dom()}})(a);return window.particlesJS=n,window.pJSDom=o,window.Particles=t,{particlesJS:n,pJSDom:o,Particles:t}}})(),n})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var a in i)("object"==typeof exports?exports:e)[a]=i[a]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.d=(e,t)=>{for(var i in t)a.o(t,i)&&!a.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{a.r(n),a.d(n,{initPjs:()=>o});var e=a(533);class t{static init(i){const a=new t,n=i.selector;if(!n)throw new Error("No selector provided");const o=document.querySelector(n);if(!o)throw new Error("No element found for selector");return e.tsParticles.load({element:o,id:n.replace(".","").replace("!",""),options:{fullScreen:{enable:!1},particles:{color:{value:i.color??"!000000"},links:{color:"random",distance:i.minDistance??120,enable:i.connectParticles??!1},move:{enable:!0,speed:i.speed??.5},number:{value:i.maxParticles??100},size:{value:{min:1,max:i.sizeVariations??3}}},responsive:i.responsive?.map((e=>({maxWidth:e.breakpoint,options:{particles:{color:{value:e.options?.color},links:{distance:e.options?.minDistance,enable:e.options?.connectParticles},number:{value:i.maxParticles},move:{enable:!0,speed:e.options?.speed},size:{value:e.options?.sizeVariations}}}})))}}).then((e=>{a._container=e})),a}destroy(){const e=this._container;e?.destroy()}pauseAnimation(){const e=this._container;e?.pause()}resumeAnimation(){const e=this._container;e?.play()}}const i={particles:{number:{value:400,density:{enable:!0,value_area:800}},color:{value:"#fff"},shape:{type:"circle",stroke:{width:0,color:"#ff0000"},polygon:{nb_sides:5},image:{src:"",width:100,height:100}},opacity:{value:1,random:!1,anim:{enable:!1,speed:2,opacity_min:0,sync:!1}},size:{value:20,random:!1,anim:{enable:!1,speed:20,size_min:0,sync:!1}},line_linked:{enable:!0,distance:100,color:"#fff",opacity:1,width:1},move:{enable:!0,speed:2,direction:"none",random:!1,straight:!1,out_mode:"out",bounce:!1,attract:{enable:!1,rotateX:3e3,rotateY:3e3}}},interactivity:{detect_on:"canvas",events:{onhover:{enable:!0,mode:"grab"},onclick:{enable:!0,mode:"push"},resize:!0},modes:{grab:{distance:100,line_linked:{opacity:1}},bubble:{distance:200,size:80,duration:.4,opacity:1,speed:3},repulse:{distance:200,duration:.4},push:{particles_nb:4},remove:{particles_nb:2}}},retina_detect:!1},o=a=>{const{particlesJS:n,pJSDom:o}=(t=>{const a=(a,n)=>{const o=(0,e.deepExtend)(i,n);return t.load({id:a,options:{fullScreen:{enable:!1},detectRetina:o.retina_detect,smooth:!0,interactivity:{detectsOn:o.interactivity.detect_on,events:{onHover:{enable:o.interactivity.events.onhover.enable,mode:o.interactivity.events.onhover.mode},onClick:{enable:o.interactivity.events.onclick.enable,mode:o.interactivity.events.onclick.mode},resize:{enable:o.interactivity.events.resize}},modes:{grab:{distance:o.interactivity.modes.grab.distance,links:{opacity:o.interactivity.modes.grab.line_linked.opacity}},bubble:{distance:o.interactivity.modes.bubble.distance,size:o.interactivity.modes.bubble.size,duration:o.interactivity.modes.bubble.duration,opacity:o.interactivity.modes.bubble.opacity,speed:o.interactivity.modes.bubble.speed},repulse:{distance:o.interactivity.modes.repulse.distance,duration:o.interactivity.modes.repulse.duration},push:{quantity:o.interactivity.modes.push.particles_nb},remove:{quantity:o.interactivity.modes.remove.particles_nb}}},particles:{collisions:{enable:o.particles.move.bounce},number:{value:o.particles.number.value,density:{enable:o.particles.number.density.enable,width:o.particles.number.density.value_area}},color:{value:o.particles.color.value},stroke:{width:o.particles.shape.stroke.width,color:{value:o.particles.shape.stroke.color}},shape:{type:o.particles.shape.type,options:{polygon:{sides:o.particles.shape.polygon.nb_sides},image:{src:o.particles.shape.image.src,width:o.particles.shape.image.width,height:o.particles.shape.image.height}}},opacity:{value:o.particles.opacity.random?{min:o.particles.opacity.anim.enable?o.particles.opacity.anim.opacity_min:0,max:o.particles.opacity.value}:o.particles.opacity.value,animation:{enable:o.particles.opacity.anim.enable,speed:o.particles.opacity.anim.speed,sync:o.particles.opacity.anim.sync}},size:{value:o.particles.size.random?{min:o.particles.size.anim.enable?o.particles.size.anim.size_min:0,max:o.particles.size.value}:o.particles.size.value,animation:{enable:o.particles.size.anim.enable,speed:o.particles.size.anim.speed,sync:o.particles.size.anim.sync}},links:{enable:o.particles.line_linked.enable,distance:o.particles.line_linked.distance,color:o.particles.line_linked.color,opacity:o.particles.line_linked.opacity,width:o.particles.line_linked.width},move:{enable:o.particles.move.enable,speed:o.particles.move.speed/3,direction:o.particles.move.direction,random:o.particles.move.random,straight:o.particles.move.straight,outModes:o.particles.move.out_mode,attract:{enable:o.particles.move.attract.enable,rotate:{x:o.particles.move.attract.rotateX,y:o.particles.move.attract.rotateY}}}}}})};return a.load=(e,i,a)=>{t.load({id:e,url:i}).then((e=>{e&&a(e)})).catch((()=>{a(void 0)}))},a.setOnClickHandler=e=>{t.setOnClickHandler(e)},{particlesJS:a,pJSDom:t.dom()}})(a);return window.particlesJS=n,window.pJSDom=o,window.Particles=t,{particlesJS:n,pJSDom:o,Particles:t}}})(),n})()));
@@ -1 +1 @@
1
- /*! tsParticles Particles.js v3.0.3 by Matteo Bruni */
1
+ /*! tsParticles Particles.js v3.1.0 by Matteo Bruni */
@@ -11,7 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.initParticlesJS = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
- const defaultPjsOptions = {
14
+ const defaultMinOpacity = 0, defaultMinSize = 0, speedFactor = 3, defaultPjsOptions = {
15
15
  particles: {
16
16
  number: {
17
17
  value: 400,
@@ -211,7 +211,7 @@
211
211
  ? {
212
212
  min: fixedOptions.particles.opacity.anim.enable
213
213
  ? fixedOptions.particles.opacity.anim.opacity_min
214
- : 0,
214
+ : defaultMinOpacity,
215
215
  max: fixedOptions.particles.opacity.value,
216
216
  }
217
217
  : fixedOptions.particles.opacity.value,
@@ -226,7 +226,7 @@
226
226
  ? {
227
227
  min: fixedOptions.particles.size.anim.enable
228
228
  ? fixedOptions.particles.size.anim.size_min
229
- : 0,
229
+ : defaultMinSize,
230
230
  max: fixedOptions.particles.size.value,
231
231
  }
232
232
  : fixedOptions.particles.size.value,
@@ -245,7 +245,7 @@
245
245
  },
246
246
  move: {
247
247
  enable: fixedOptions.particles.move.enable,
248
- speed: fixedOptions.particles.move.speed / 3,
248
+ speed: fixedOptions.particles.move.speed / speedFactor,
249
249
  direction: fixedOptions.particles.move.direction,
250
250
  random: fixedOptions.particles.move.random,
251
251
  straight: fixedOptions.particles.move.straight,
@@ -11,6 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Particles = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
+ const linksMinDistance = 120, moveMinSpeed = 0.5, particlesMinCount = 100, sizeMinValue = 3;
14
15
  class Particles {
15
16
  static init(options) {
16
17
  const particles = new Particles(), selector = options.selector;
@@ -21,10 +22,10 @@
21
22
  if (!el) {
22
23
  throw new Error("No element found for selector");
23
24
  }
24
- engine_1.tsParticles
25
+ void engine_1.tsParticles
25
26
  .load({
26
- id: selector.replace(".", "").replace("!", ""),
27
27
  element: el,
28
+ id: selector.replace(".", "").replace("!", ""),
28
29
  options: {
29
30
  fullScreen: {
30
31
  enable: false,
@@ -35,18 +36,18 @@
35
36
  },
36
37
  links: {
37
38
  color: "random",
38
- distance: options.minDistance ?? 120,
39
+ distance: options.minDistance ?? linksMinDistance,
39
40
  enable: options.connectParticles ?? false,
40
41
  },
41
42
  move: {
42
43
  enable: true,
43
- speed: options.speed ?? 0.5,
44
+ speed: options.speed ?? moveMinSpeed,
44
45
  },
45
46
  number: {
46
- value: options.maxParticles ?? 100,
47
+ value: options.maxParticles ?? particlesMinCount,
47
48
  },
48
49
  size: {
49
- value: { min: 1, max: options.sizeVariations ?? 3 },
50
+ value: { min: 1, max: options.sizeVariations ?? sizeMinValue },
50
51
  },
51
52
  },
52
53
  responsive: options.responsive?.map((responsive) => ({
@@ -82,15 +83,15 @@
82
83
  }
83
84
  destroy() {
84
85
  const container = this._container;
85
- container && container.destroy();
86
+ container?.destroy();
86
87
  }
87
88
  pauseAnimation() {
88
89
  const container = this._container;
89
- container && container.pause();
90
+ container?.pause();
90
91
  }
91
92
  resumeAnimation() {
92
93
  const container = this._container;
93
- container && container.play();
94
+ container?.play();
94
95
  }
95
96
  }
96
97
  exports.Particles = Particles;