@tsparticles/pjs 3.0.0-beta.4 → 3.0.0-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/browser/VincentGarreau/particles.js +249 -1
- package/cjs/VincentGarreau/particles.js +249 -1
- package/esm/VincentGarreau/particles.js +249 -1
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.pjs.bundle.js +254 -16
- package/tsparticles.pjs.bundle.min.js +1 -1
- package/tsparticles.pjs.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.pjs.js +239 -2
- package/tsparticles.pjs.min.js +1 -1
- package/tsparticles.pjs.min.js.LICENSE.txt +1 -1
- package/types/VincentGarreau/IParticlesJS.d.ts +113 -2
- package/umd/VincentGarreau/particles.js +250 -2
package/tsparticles.pjs.js
CHANGED
@@ -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.0-beta.
|
7
|
+
* v3.0.0-beta.5
|
8
8
|
*/
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
@@ -183,11 +183,248 @@ class Particles {
|
|
183
183
|
}
|
184
184
|
}
|
185
185
|
;// CONCATENATED MODULE: ./dist/browser/VincentGarreau/particles.js
|
186
|
+
|
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"
|
204
|
+
},
|
205
|
+
polygon: {
|
206
|
+
nb_sides: 5
|
207
|
+
},
|
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"
|
262
|
+
},
|
263
|
+
onclick: {
|
264
|
+
enable: true,
|
265
|
+
mode: "push"
|
266
|
+
},
|
267
|
+
resize: true
|
268
|
+
},
|
269
|
+
modes: {
|
270
|
+
grab: {
|
271
|
+
distance: 100,
|
272
|
+
line_linked: {
|
273
|
+
opacity: 1
|
274
|
+
}
|
275
|
+
},
|
276
|
+
bubble: {
|
277
|
+
distance: 200,
|
278
|
+
size: 80,
|
279
|
+
duration: 0.4,
|
280
|
+
opacity: 1,
|
281
|
+
speed: 3
|
282
|
+
},
|
283
|
+
repulse: {
|
284
|
+
distance: 200,
|
285
|
+
duration: 0.4
|
286
|
+
},
|
287
|
+
push: {
|
288
|
+
particles_nb: 4
|
289
|
+
},
|
290
|
+
remove: {
|
291
|
+
particles_nb: 2
|
292
|
+
}
|
293
|
+
}
|
294
|
+
},
|
295
|
+
retina_detect: false
|
296
|
+
};
|
186
297
|
const initParticlesJS = engine => {
|
187
298
|
const particlesJS = (tagId, options) => {
|
299
|
+
const fixedOptions = (0,engine_root_window_.deepExtend)(defaultPjsOptions, options);
|
188
300
|
return engine.load({
|
189
301
|
id: tagId,
|
190
|
-
options
|
302
|
+
options: {
|
303
|
+
fullScreen: {
|
304
|
+
enable: false
|
305
|
+
},
|
306
|
+
detectRetina: fixedOptions.retina_detect,
|
307
|
+
smooth: true,
|
308
|
+
interactivity: {
|
309
|
+
detectsOn: fixedOptions.interactivity.detect_on,
|
310
|
+
events: {
|
311
|
+
onHover: {
|
312
|
+
enable: fixedOptions.interactivity.events.onhover.enable,
|
313
|
+
mode: fixedOptions.interactivity.events.onhover.mode
|
314
|
+
},
|
315
|
+
onClick: {
|
316
|
+
enable: fixedOptions.interactivity.events.onclick.enable,
|
317
|
+
mode: fixedOptions.interactivity.events.onclick.mode
|
318
|
+
},
|
319
|
+
resize: {
|
320
|
+
enable: fixedOptions.interactivity.events.resize
|
321
|
+
}
|
322
|
+
},
|
323
|
+
modes: {
|
324
|
+
grab: {
|
325
|
+
distance: fixedOptions.interactivity.modes.grab.distance,
|
326
|
+
links: {
|
327
|
+
opacity: fixedOptions.interactivity.modes.grab.line_linked.opacity
|
328
|
+
}
|
329
|
+
},
|
330
|
+
bubble: {
|
331
|
+
distance: fixedOptions.interactivity.modes.bubble.distance,
|
332
|
+
size: fixedOptions.interactivity.modes.bubble.size,
|
333
|
+
duration: fixedOptions.interactivity.modes.bubble.duration,
|
334
|
+
opacity: fixedOptions.interactivity.modes.bubble.opacity,
|
335
|
+
speed: fixedOptions.interactivity.modes.bubble.speed
|
336
|
+
},
|
337
|
+
repulse: {
|
338
|
+
distance: fixedOptions.interactivity.modes.repulse.distance,
|
339
|
+
duration: fixedOptions.interactivity.modes.repulse.duration
|
340
|
+
},
|
341
|
+
push: {
|
342
|
+
quantity: fixedOptions.interactivity.modes.push.particles_nb
|
343
|
+
},
|
344
|
+
remove: {
|
345
|
+
quantity: fixedOptions.interactivity.modes.remove.particles_nb
|
346
|
+
}
|
347
|
+
}
|
348
|
+
},
|
349
|
+
particles: {
|
350
|
+
collisions: {
|
351
|
+
enable: fixedOptions.particles.move.bounce
|
352
|
+
},
|
353
|
+
number: {
|
354
|
+
value: fixedOptions.particles.number.value,
|
355
|
+
density: {
|
356
|
+
enable: fixedOptions.particles.number.density.enable,
|
357
|
+
width: fixedOptions.particles.number.density.value_area
|
358
|
+
}
|
359
|
+
},
|
360
|
+
color: {
|
361
|
+
value: fixedOptions.particles.color.value
|
362
|
+
},
|
363
|
+
stroke: {
|
364
|
+
width: fixedOptions.particles.shape.stroke.width,
|
365
|
+
color: {
|
366
|
+
value: fixedOptions.particles.shape.stroke.color
|
367
|
+
}
|
368
|
+
},
|
369
|
+
shape: {
|
370
|
+
type: fixedOptions.particles.shape.type,
|
371
|
+
options: {
|
372
|
+
polygon: {
|
373
|
+
sides: fixedOptions.particles.shape.polygon.nb_sides
|
374
|
+
},
|
375
|
+
image: {
|
376
|
+
src: fixedOptions.particles.shape.image.src,
|
377
|
+
width: fixedOptions.particles.shape.image.width,
|
378
|
+
height: fixedOptions.particles.shape.image.height
|
379
|
+
}
|
380
|
+
}
|
381
|
+
},
|
382
|
+
opacity: {
|
383
|
+
value: fixedOptions.particles.opacity.random ? {
|
384
|
+
min: fixedOptions.particles.opacity.anim.enable ? fixedOptions.particles.opacity.anim.opacity_min : 0,
|
385
|
+
max: fixedOptions.particles.opacity.value
|
386
|
+
} : fixedOptions.particles.opacity.value,
|
387
|
+
animation: {
|
388
|
+
enable: fixedOptions.particles.opacity.anim.enable,
|
389
|
+
speed: fixedOptions.particles.opacity.anim.speed,
|
390
|
+
sync: fixedOptions.particles.opacity.anim.sync
|
391
|
+
}
|
392
|
+
},
|
393
|
+
size: {
|
394
|
+
value: fixedOptions.particles.size.random ? {
|
395
|
+
min: fixedOptions.particles.size.anim.enable ? fixedOptions.particles.size.anim.size_min : 0,
|
396
|
+
max: fixedOptions.particles.size.value
|
397
|
+
} : fixedOptions.particles.size.value,
|
398
|
+
animation: {
|
399
|
+
enable: fixedOptions.particles.size.anim.enable,
|
400
|
+
speed: fixedOptions.particles.size.anim.speed,
|
401
|
+
sync: fixedOptions.particles.size.anim.sync
|
402
|
+
}
|
403
|
+
},
|
404
|
+
links: {
|
405
|
+
enable: fixedOptions.particles.line_linked.enable,
|
406
|
+
distance: fixedOptions.particles.line_linked.distance,
|
407
|
+
color: fixedOptions.particles.line_linked.color,
|
408
|
+
opacity: fixedOptions.particles.line_linked.opacity,
|
409
|
+
width: fixedOptions.particles.line_linked.width
|
410
|
+
},
|
411
|
+
move: {
|
412
|
+
enable: fixedOptions.particles.move.enable,
|
413
|
+
speed: fixedOptions.particles.move.speed / 3,
|
414
|
+
direction: fixedOptions.particles.move.direction,
|
415
|
+
random: fixedOptions.particles.move.random,
|
416
|
+
straight: fixedOptions.particles.move.straight,
|
417
|
+
outModes: fixedOptions.particles.move.out_mode,
|
418
|
+
attract: {
|
419
|
+
enable: fixedOptions.particles.move.attract.enable,
|
420
|
+
rotate: {
|
421
|
+
x: fixedOptions.particles.move.attract.rotateX,
|
422
|
+
y: fixedOptions.particles.move.attract.rotateY
|
423
|
+
}
|
424
|
+
}
|
425
|
+
}
|
426
|
+
}
|
427
|
+
}
|
191
428
|
});
|
192
429
|
};
|
193
430
|
particlesJS.load = (tagId, pathConfigJson, callback) => {
|
package/tsparticles.pjs.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
/*! For license information please see tsparticles.pjs.min.js.LICENSE.txt */
|
2
|
-
!function(e,
|
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})()));
|
@@ -1 +1 @@
|
|
1
|
-
/*! tsParticles Particles.js v3.0.0-beta.
|
1
|
+
/*! tsParticles Particles.js v3.0.0-beta.5 by Matteo Bruni */
|
@@ -1,6 +1,117 @@
|
|
1
|
-
import type { Container,
|
1
|
+
import type { Container, IHsl, IRgb, IValueColor, InteractivityDetect, MoveDirection, OutMode } from "@tsparticles/engine";
|
2
|
+
export interface IParticlesJSOptions {
|
3
|
+
interactivity: {
|
4
|
+
detect_on: InteractivityDetect | keyof typeof InteractivityDetect;
|
5
|
+
events: {
|
6
|
+
onclick: {
|
7
|
+
enable: boolean;
|
8
|
+
mode: string;
|
9
|
+
};
|
10
|
+
onhover: {
|
11
|
+
enable: boolean;
|
12
|
+
mode: string;
|
13
|
+
};
|
14
|
+
resize: boolean;
|
15
|
+
};
|
16
|
+
modes: {
|
17
|
+
bubble: {
|
18
|
+
distance: number;
|
19
|
+
duration: number;
|
20
|
+
opacity: number;
|
21
|
+
size: number;
|
22
|
+
speed: number;
|
23
|
+
};
|
24
|
+
grab: {
|
25
|
+
distance: number;
|
26
|
+
line_linked: {
|
27
|
+
opacity: number;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
push: {
|
31
|
+
particles_nb: number;
|
32
|
+
};
|
33
|
+
remove: {
|
34
|
+
particles_nb: number;
|
35
|
+
};
|
36
|
+
repulse: {
|
37
|
+
distance: number;
|
38
|
+
duration: number;
|
39
|
+
};
|
40
|
+
};
|
41
|
+
};
|
42
|
+
particles: {
|
43
|
+
color: {
|
44
|
+
value: string | IRgb | IHsl | IValueColor;
|
45
|
+
};
|
46
|
+
line_linked: {
|
47
|
+
color: string;
|
48
|
+
distance: number;
|
49
|
+
enable: boolean;
|
50
|
+
opacity: number;
|
51
|
+
width: number;
|
52
|
+
};
|
53
|
+
move: {
|
54
|
+
attract: {
|
55
|
+
enable: boolean;
|
56
|
+
rotateX: number;
|
57
|
+
rotateY: number;
|
58
|
+
};
|
59
|
+
bounce: boolean;
|
60
|
+
direction: MoveDirection | keyof typeof MoveDirection;
|
61
|
+
enable: boolean;
|
62
|
+
out_mode: OutMode | keyof typeof OutMode;
|
63
|
+
random: boolean;
|
64
|
+
speed: number;
|
65
|
+
straight: boolean;
|
66
|
+
};
|
67
|
+
number: {
|
68
|
+
density: {
|
69
|
+
enable: boolean;
|
70
|
+
value_area: number;
|
71
|
+
};
|
72
|
+
value: number;
|
73
|
+
};
|
74
|
+
opacity: {
|
75
|
+
anim: {
|
76
|
+
enable: boolean;
|
77
|
+
opacity_min: number;
|
78
|
+
speed: number;
|
79
|
+
sync: boolean;
|
80
|
+
};
|
81
|
+
random: boolean;
|
82
|
+
value: number;
|
83
|
+
};
|
84
|
+
shape: {
|
85
|
+
image: {
|
86
|
+
height: number;
|
87
|
+
replace_color?: boolean;
|
88
|
+
src: string;
|
89
|
+
width: number;
|
90
|
+
};
|
91
|
+
polygon: {
|
92
|
+
nb_sides: number;
|
93
|
+
};
|
94
|
+
stroke: {
|
95
|
+
color: string | IRgb | IHsl | IValueColor;
|
96
|
+
width: number;
|
97
|
+
};
|
98
|
+
type: string;
|
99
|
+
};
|
100
|
+
size: {
|
101
|
+
anim: {
|
102
|
+
enable: boolean;
|
103
|
+
size_min: number;
|
104
|
+
speed: number;
|
105
|
+
sync: boolean;
|
106
|
+
};
|
107
|
+
random: boolean;
|
108
|
+
value: number;
|
109
|
+
};
|
110
|
+
};
|
111
|
+
retina_detect: boolean;
|
112
|
+
}
|
2
113
|
export interface IParticlesJS {
|
3
|
-
(tagId: string, options:
|
114
|
+
(tagId: string, options: IParticlesJSOptions): Promise<Container | undefined>;
|
4
115
|
load(tagId: string, pathConfigJson: string, callback: (container?: Container) => void): void;
|
5
116
|
setOnClickHandler(callback: EventListenerOrEventListenerObject): void;
|
6
117
|
}
|
@@ -4,15 +4,263 @@
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
5
5
|
}
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
7
|
-
define(["require", "exports"], factory);
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
8
8
|
}
|
9
9
|
})(function (require, exports) {
|
10
10
|
"use strict";
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.initParticlesJS = void 0;
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
14
|
+
const defaultPjsOptions = {
|
15
|
+
particles: {
|
16
|
+
number: {
|
17
|
+
value: 400,
|
18
|
+
density: {
|
19
|
+
enable: true,
|
20
|
+
value_area: 800,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
color: {
|
24
|
+
value: "#fff",
|
25
|
+
},
|
26
|
+
shape: {
|
27
|
+
type: "circle",
|
28
|
+
stroke: {
|
29
|
+
width: 0,
|
30
|
+
color: "#ff0000",
|
31
|
+
},
|
32
|
+
polygon: {
|
33
|
+
nb_sides: 5,
|
34
|
+
},
|
35
|
+
image: {
|
36
|
+
src: "",
|
37
|
+
width: 100,
|
38
|
+
height: 100,
|
39
|
+
},
|
40
|
+
},
|
41
|
+
opacity: {
|
42
|
+
value: 1,
|
43
|
+
random: false,
|
44
|
+
anim: {
|
45
|
+
enable: false,
|
46
|
+
speed: 2,
|
47
|
+
opacity_min: 0,
|
48
|
+
sync: false,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
size: {
|
52
|
+
value: 20,
|
53
|
+
random: false,
|
54
|
+
anim: {
|
55
|
+
enable: false,
|
56
|
+
speed: 20,
|
57
|
+
size_min: 0,
|
58
|
+
sync: false,
|
59
|
+
},
|
60
|
+
},
|
61
|
+
line_linked: {
|
62
|
+
enable: true,
|
63
|
+
distance: 100,
|
64
|
+
color: "#fff",
|
65
|
+
opacity: 1,
|
66
|
+
width: 1,
|
67
|
+
},
|
68
|
+
move: {
|
69
|
+
enable: true,
|
70
|
+
speed: 2,
|
71
|
+
direction: "none",
|
72
|
+
random: false,
|
73
|
+
straight: false,
|
74
|
+
out_mode: "out",
|
75
|
+
bounce: false,
|
76
|
+
attract: {
|
77
|
+
enable: false,
|
78
|
+
rotateX: 3000,
|
79
|
+
rotateY: 3000,
|
80
|
+
},
|
81
|
+
},
|
82
|
+
},
|
83
|
+
interactivity: {
|
84
|
+
detect_on: "canvas",
|
85
|
+
events: {
|
86
|
+
onhover: {
|
87
|
+
enable: true,
|
88
|
+
mode: "grab",
|
89
|
+
},
|
90
|
+
onclick: {
|
91
|
+
enable: true,
|
92
|
+
mode: "push",
|
93
|
+
},
|
94
|
+
resize: true,
|
95
|
+
},
|
96
|
+
modes: {
|
97
|
+
grab: {
|
98
|
+
distance: 100,
|
99
|
+
line_linked: {
|
100
|
+
opacity: 1,
|
101
|
+
},
|
102
|
+
},
|
103
|
+
bubble: {
|
104
|
+
distance: 200,
|
105
|
+
size: 80,
|
106
|
+
duration: 0.4,
|
107
|
+
opacity: 1,
|
108
|
+
speed: 3,
|
109
|
+
},
|
110
|
+
repulse: {
|
111
|
+
distance: 200,
|
112
|
+
duration: 0.4,
|
113
|
+
},
|
114
|
+
push: {
|
115
|
+
particles_nb: 4,
|
116
|
+
},
|
117
|
+
remove: {
|
118
|
+
particles_nb: 2,
|
119
|
+
},
|
120
|
+
},
|
121
|
+
},
|
122
|
+
retina_detect: false,
|
123
|
+
};
|
13
124
|
const initParticlesJS = (engine) => {
|
14
125
|
const particlesJS = (tagId, options) => {
|
15
|
-
|
126
|
+
const fixedOptions = (0, engine_1.deepExtend)(defaultPjsOptions, options);
|
127
|
+
return engine.load({
|
128
|
+
id: tagId,
|
129
|
+
options: {
|
130
|
+
fullScreen: {
|
131
|
+
enable: false,
|
132
|
+
},
|
133
|
+
detectRetina: fixedOptions.retina_detect,
|
134
|
+
smooth: true,
|
135
|
+
interactivity: {
|
136
|
+
detectsOn: fixedOptions.interactivity.detect_on,
|
137
|
+
events: {
|
138
|
+
onHover: {
|
139
|
+
enable: fixedOptions.interactivity.events.onhover.enable,
|
140
|
+
mode: fixedOptions.interactivity.events.onhover.mode,
|
141
|
+
},
|
142
|
+
onClick: {
|
143
|
+
enable: fixedOptions.interactivity.events.onclick.enable,
|
144
|
+
mode: fixedOptions.interactivity.events.onclick.mode,
|
145
|
+
},
|
146
|
+
resize: {
|
147
|
+
enable: fixedOptions.interactivity.events.resize,
|
148
|
+
},
|
149
|
+
},
|
150
|
+
modes: {
|
151
|
+
grab: {
|
152
|
+
distance: fixedOptions.interactivity.modes.grab.distance,
|
153
|
+
links: {
|
154
|
+
opacity: fixedOptions.interactivity.modes.grab.line_linked.opacity,
|
155
|
+
},
|
156
|
+
},
|
157
|
+
bubble: {
|
158
|
+
distance: fixedOptions.interactivity.modes.bubble.distance,
|
159
|
+
size: fixedOptions.interactivity.modes.bubble.size,
|
160
|
+
duration: fixedOptions.interactivity.modes.bubble.duration,
|
161
|
+
opacity: fixedOptions.interactivity.modes.bubble.opacity,
|
162
|
+
speed: fixedOptions.interactivity.modes.bubble.speed,
|
163
|
+
},
|
164
|
+
repulse: {
|
165
|
+
distance: fixedOptions.interactivity.modes.repulse.distance,
|
166
|
+
duration: fixedOptions.interactivity.modes.repulse.duration,
|
167
|
+
},
|
168
|
+
push: {
|
169
|
+
quantity: fixedOptions.interactivity.modes.push.particles_nb,
|
170
|
+
},
|
171
|
+
remove: {
|
172
|
+
quantity: fixedOptions.interactivity.modes.remove.particles_nb,
|
173
|
+
},
|
174
|
+
},
|
175
|
+
},
|
176
|
+
particles: {
|
177
|
+
collisions: {
|
178
|
+
enable: fixedOptions.particles.move.bounce,
|
179
|
+
},
|
180
|
+
number: {
|
181
|
+
value: fixedOptions.particles.number.value,
|
182
|
+
density: {
|
183
|
+
enable: fixedOptions.particles.number.density.enable,
|
184
|
+
width: fixedOptions.particles.number.density.value_area,
|
185
|
+
},
|
186
|
+
},
|
187
|
+
color: {
|
188
|
+
value: fixedOptions.particles.color.value,
|
189
|
+
},
|
190
|
+
stroke: {
|
191
|
+
width: fixedOptions.particles.shape.stroke.width,
|
192
|
+
color: {
|
193
|
+
value: fixedOptions.particles.shape.stroke.color,
|
194
|
+
},
|
195
|
+
},
|
196
|
+
shape: {
|
197
|
+
type: fixedOptions.particles.shape.type,
|
198
|
+
options: {
|
199
|
+
polygon: {
|
200
|
+
sides: fixedOptions.particles.shape.polygon.nb_sides,
|
201
|
+
},
|
202
|
+
image: {
|
203
|
+
src: fixedOptions.particles.shape.image.src,
|
204
|
+
width: fixedOptions.particles.shape.image.width,
|
205
|
+
height: fixedOptions.particles.shape.image.height,
|
206
|
+
},
|
207
|
+
},
|
208
|
+
},
|
209
|
+
opacity: {
|
210
|
+
value: fixedOptions.particles.opacity.random
|
211
|
+
? {
|
212
|
+
min: fixedOptions.particles.opacity.anim.enable
|
213
|
+
? fixedOptions.particles.opacity.anim.opacity_min
|
214
|
+
: 0,
|
215
|
+
max: fixedOptions.particles.opacity.value,
|
216
|
+
}
|
217
|
+
: fixedOptions.particles.opacity.value,
|
218
|
+
animation: {
|
219
|
+
enable: fixedOptions.particles.opacity.anim.enable,
|
220
|
+
speed: fixedOptions.particles.opacity.anim.speed,
|
221
|
+
sync: fixedOptions.particles.opacity.anim.sync,
|
222
|
+
},
|
223
|
+
},
|
224
|
+
size: {
|
225
|
+
value: fixedOptions.particles.size.random
|
226
|
+
? {
|
227
|
+
min: fixedOptions.particles.size.anim.enable
|
228
|
+
? fixedOptions.particles.size.anim.size_min
|
229
|
+
: 0,
|
230
|
+
max: fixedOptions.particles.size.value,
|
231
|
+
}
|
232
|
+
: fixedOptions.particles.size.value,
|
233
|
+
animation: {
|
234
|
+
enable: fixedOptions.particles.size.anim.enable,
|
235
|
+
speed: fixedOptions.particles.size.anim.speed,
|
236
|
+
sync: fixedOptions.particles.size.anim.sync,
|
237
|
+
},
|
238
|
+
},
|
239
|
+
links: {
|
240
|
+
enable: fixedOptions.particles.line_linked.enable,
|
241
|
+
distance: fixedOptions.particles.line_linked.distance,
|
242
|
+
color: fixedOptions.particles.line_linked.color,
|
243
|
+
opacity: fixedOptions.particles.line_linked.opacity,
|
244
|
+
width: fixedOptions.particles.line_linked.width,
|
245
|
+
},
|
246
|
+
move: {
|
247
|
+
enable: fixedOptions.particles.move.enable,
|
248
|
+
speed: fixedOptions.particles.move.speed / 3,
|
249
|
+
direction: fixedOptions.particles.move.direction,
|
250
|
+
random: fixedOptions.particles.move.random,
|
251
|
+
straight: fixedOptions.particles.move.straight,
|
252
|
+
outModes: fixedOptions.particles.move.out_mode,
|
253
|
+
attract: {
|
254
|
+
enable: fixedOptions.particles.move.attract.enable,
|
255
|
+
rotate: {
|
256
|
+
x: fixedOptions.particles.move.attract.rotateX,
|
257
|
+
y: fixedOptions.particles.move.attract.rotateY,
|
258
|
+
},
|
259
|
+
},
|
260
|
+
},
|
261
|
+
},
|
262
|
+
},
|
263
|
+
});
|
16
264
|
};
|
17
265
|
particlesJS.load = (tagId, pathConfigJson, callback) => {
|
18
266
|
engine
|