morel-theme 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,671 @@
1
+ function hexToRgb(e) {
2
+ let a = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
3
+ e = e.replace(a, function(e, a, t, i) {
4
+ return a + a + t + t + i + i;
5
+ });
6
+ let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
7
+ return t ? {
8
+ r: parseInt(t[1], 16),
9
+ g: parseInt(t[2], 16),
10
+ b: parseInt(t[3], 16)
11
+ } : null;
12
+ }
13
+
14
+ function clamp(e, a, t) {
15
+ return Math.min(Math.max(e, a), t);
16
+ }
17
+
18
+ function isInArray(e, a) {
19
+ return a.indexOf(e) > -1;
20
+ }
21
+ let pJS = function(e, a) {
22
+ let t = document.querySelector("#" + e + " > .particles-js-canvas-el");
23
+ this.pJS = {
24
+ canvas: {
25
+ el: t,
26
+ w: t.offsetWidth,
27
+ h: t.offsetHeight
28
+ },
29
+ particles: {
30
+ number: {
31
+ value: 50,
32
+ density: {
33
+ enable: !0,
34
+ value_area: 1000
35
+ }
36
+ },
37
+ color: {
38
+ value: "#fff"
39
+ },
40
+ shape: {
41
+ type: "image",
42
+ stroke: {
43
+ width: 5,
44
+ color: "#ff0000"
45
+ },
46
+ polygon: {
47
+ nb_sides: 5
48
+ },
49
+ image: {
50
+ src: "/assets/tema/img/m.png",
51
+ width: 87,
52
+ height: 98
53
+ }
54
+ },
55
+ opacity: {
56
+ value: 1,
57
+ random: !1,
58
+ anim: {
59
+ enable: !1,
60
+ speed: 2,
61
+ opacity_min: 0,
62
+ sync: !1
63
+ }
64
+ },
65
+ size: {
66
+ value: 20,
67
+ random: !1,
68
+ anim: {
69
+ enable: !1,
70
+ speed: 20,
71
+ size_min: 20,
72
+ sync: !1
73
+ }
74
+ },
75
+ line_linked: {
76
+ enable: !0,
77
+ distance: 100,
78
+ color: "#fff",
79
+ opacity: 1,
80
+ width: 1
81
+ },
82
+ move: {
83
+ enable: !0,
84
+ speed: 2,
85
+ direction: "none",
86
+ random: !1,
87
+ straight: !1,
88
+ out_mode: "out",
89
+ bounce: !1,
90
+ attract: {
91
+ enable: !1,
92
+ rotateX: 3e3,
93
+ rotateY: 3e3
94
+ }
95
+ },
96
+ array: []
97
+ },
98
+ interactivity: {
99
+ detect_on: "canvas",
100
+ events: {
101
+ onhover: {
102
+ enable: !0,
103
+ mode: "grab"
104
+ },
105
+ onclick: {
106
+ enable: !0,
107
+ mode: "push"
108
+ },
109
+ resize: !0
110
+ },
111
+ modes: {
112
+ grab: {
113
+ distance: 100,
114
+ line_linked: {
115
+ opacity: 1
116
+ }
117
+ },
118
+ bubble: {
119
+ distance: 200,
120
+ size: 80,
121
+ duration: .4
122
+ },
123
+ repulse: {
124
+ distance: 200,
125
+ duration: .4
126
+ },
127
+ push: {
128
+ particles_nb: 4
129
+ },
130
+ remove: {
131
+ particles_nb: 2
132
+ }
133
+ },
134
+ mouse: {}
135
+ },
136
+ retina_detect: !1,
137
+ fn: {
138
+ interact: {},
139
+ modes: {},
140
+ vendors: {}
141
+ },
142
+ tmp: {}
143
+ };
144
+ let i = this.pJS;
145
+ a && Object.deepExtend(i, a), i.tmp.obj = {
146
+ size_value: i.particles.size.value,
147
+ size_anim_speed: i.particles.size.anim.speed,
148
+ move_speed: i.particles.move.speed,
149
+ line_linked_distance: i.particles.line_linked.distance,
150
+ line_linked_width: i.particles.line_linked.width,
151
+ mode_grab_distance: i.interactivity.modes.grab.distance,
152
+ mode_bubble_distance: i.interactivity.modes.bubble.distance,
153
+ mode_bubble_size: i.interactivity.modes.bubble.size,
154
+ mode_repulse_distance: i.interactivity.modes.repulse.distance
155
+ }, i.fn.retinaInit = function() {
156
+ i.retina_detect && window.devicePixelRatio > 1 ? (i.canvas.pxratio = window.devicePixelRatio, i.tmp.retina = !0) : (i.canvas.pxratio = 1, i.tmp.retina = !1), i.canvas.w = i.canvas.el.offsetWidth * i.canvas.pxratio, i.canvas.h = i.canvas.el.offsetHeight * i.canvas.pxratio, i.particles.size.value = i.tmp.obj.size_value * i.canvas.pxratio, i.particles.size.anim.speed = i.tmp.obj.size_anim_speed * i.canvas.pxratio, i.particles.move.speed = i.tmp.obj.move_speed * i.canvas.pxratio, i.particles.line_linked.distance = i.tmp.obj.line_linked_distance * i.canvas.pxratio, i.interactivity.modes.grab.distance = i.tmp.obj.mode_grab_distance * i.canvas.pxratio, i.interactivity.modes.bubble.distance = i.tmp.obj.mode_bubble_distance * i.canvas.pxratio, i.particles.line_linked.width = i.tmp.obj.line_linked_width * i.canvas.pxratio, i.interactivity.modes.bubble.size = i.tmp.obj.mode_bubble_size * i.canvas.pxratio, i.interactivity.modes.repulse.distance = i.tmp.obj.mode_repulse_distance * i.canvas.pxratio;
157
+ }, i.fn.canvasInit = function() {
158
+ i.canvas.ctx = i.canvas.el.getContext("2d");
159
+ }, i.fn.canvasSize = function() {
160
+ i.canvas.el.width = i.canvas.w, i.canvas.el.height = i.canvas.h, i && i.interactivity.events.resize && window.addEventListener("resize", function() {
161
+ i.canvas.w = i.canvas.el.offsetWidth, i.canvas.h = i.canvas.el.offsetHeight, i.tmp.retina && (i.canvas.w *= i.canvas.pxratio, i.canvas.h *= i.canvas.pxratio), i.canvas.el.width = i.canvas.w, i.canvas.el.height = i.canvas.h, i.particles.move.enable || (i.fn.particlesEmpty(), i.fn.particlesCreate(), i.fn.particlesDraw(), i.fn.vendors.densityAutoParticles()), i.fn.vendors.densityAutoParticles();
162
+ });
163
+ }, i.fn.canvasPaint = function() {
164
+ i.canvas.ctx.fillRect(0, 0, i.canvas.w, i.canvas.h);
165
+ }, i.fn.canvasClear = function() {
166
+ i.canvas.ctx.clearRect(0, 0, i.canvas.w, i.canvas.h);
167
+ }, i.fn.particle = function(e, a, t) {
168
+ if (this.radius = (i.particles.size.random ? Math.random() : 1) * i.particles.size.value, i.particles.size.anim.enable && (this.size_status = !1, this.vs = i.particles.size.anim.speed / 100, i.particles.size.anim.sync || (this.vs = this.vs * Math.random())), this.x = t ? t.x : Math.random() * i.canvas.w, this.y = t ? t.y : Math.random() * i.canvas.h, this.x > i.canvas.w - 2 * this.radius ? this.x = this.x - this.radius : this.x < 2 * this.radius && (this.x = this.x + this.radius), this.y > i.canvas.h - 2 * this.radius ? this.y = this.y - this.radius : this.y < 2 * this.radius && (this.y = this.y + this.radius), i.particles.move.bounce && i.fn.vendors.checkOverlap(this, t), this.color = {}, "object" == typeof e.value)
169
+ if (e.value instanceof Array) {
170
+ let s = e.value[Math.floor(Math.random() * i.particles.color.value.length)];
171
+ this.color.rgb = hexToRgb(s);
172
+ } else void 0 != e.value.r && void 0 != e.value.g && void 0 != e.value.b && (this.color.rgb = {
173
+ r: e.value.r,
174
+ g: e.value.g,
175
+ b: e.value.b
176
+ }), void 0 != e.value.h && void 0 != e.value.s && void 0 != e.value.l && (this.color.hsl = {
177
+ h: e.value.h,
178
+ s: e.value.s,
179
+ l: e.value.l
180
+ });
181
+ else "random" == e.value ? this.color.rgb = {
182
+ r: Math.floor(256 * Math.random()) + 0,
183
+ g: Math.floor(256 * Math.random()) + 0,
184
+ b: Math.floor(256 * Math.random()) + 0
185
+ } : "string" == typeof e.value && (this.color = e, this.color.rgb = hexToRgb(this.color.value));
186
+ this.opacity = (i.particles.opacity.random ? Math.random() : 1) * i.particles.opacity.value, i.particles.opacity.anim.enable && (this.opacity_status = !1, this.vo = i.particles.opacity.anim.speed / 100, i.particles.opacity.anim.sync || (this.vo = this.vo * Math.random()));
187
+ let n = {};
188
+ switch (i.particles.move.direction) {
189
+ case "top":
190
+ n = {
191
+ x: 0,
192
+ y: -1
193
+ };
194
+ break;
195
+ case "top-right":
196
+ n = {
197
+ x: .5,
198
+ y: -.5
199
+ };
200
+ break;
201
+ case "right":
202
+ n = {
203
+ x: 1,
204
+ y: -0
205
+ };
206
+ break;
207
+ case "bottom-right":
208
+ n = {
209
+ x: .5,
210
+ y: .5
211
+ };
212
+ break;
213
+ case "bottom":
214
+ n = {
215
+ x: 0,
216
+ y: 1
217
+ };
218
+ break;
219
+ case "bottom-left":
220
+ n = {
221
+ x: -.5,
222
+ y: 1
223
+ };
224
+ break;
225
+ case "left":
226
+ n = {
227
+ x: -1,
228
+ y: 0
229
+ };
230
+ break;
231
+ case "top-left":
232
+ n = {
233
+ x: -.5,
234
+ y: -.5
235
+ };
236
+ break;
237
+ default:
238
+ n = {
239
+ x: 0,
240
+ y: 0
241
+ };
242
+ }
243
+ i.particles.move.straight ? (this.vx = n.x, this.vy = n.y, i.particles.move.random && (this.vx = this.vx * Math.random(), this.vy = this.vy * Math.random())) : (this.vx = n.x + Math.random() - .5, this.vy = n.y + Math.random() - .5), this.vx_i = this.vx, this.vy_i = this.vy;
244
+ let r = i.particles.shape.type;
245
+ if ("object" == typeof r) {
246
+ if (r instanceof Array) {
247
+ let c = r[Math.floor(Math.random() * r.length)];
248
+ this.shape = c;
249
+ }
250
+ } else this.shape = r;
251
+
252
+ let substring = this.shape.substring(0, 5);
253
+ if ("image" == substring) {
254
+ let o = i.particles.shape;
255
+ this.img = {
256
+ src: o.image.src,
257
+ ratio: o.image.width / o.image.height
258
+ }, this.img.ratio || (this.img.ratio = 1), "svg" == i.tmp.img_type && void 0 != i.tmp.source_svg && (i.fn.vendors.createSvgImg(this), i.tmp.pushing && (this.img.loaded = !1));
259
+ }
260
+ }, i.fn.particle.prototype.draw = function() {
261
+ function e() {
262
+ i.canvas.ctx.drawImage(r, a.x - t, a.y - t, 2 * t, 2 * t / a.img.ratio);
263
+ }
264
+ var a = this;
265
+ if (void 0 != a.radius_bubble) var t = a.radius_bubble;
266
+ else var t = a.radius;
267
+ if (void 0 != a.opacity_bubble) var s = a.opacity_bubble;
268
+ else var s = a.opacity;
269
+ if (a.color.rgb) var n = "rgba(" + a.color.rgb.r + "," + a.color.rgb.g + "," + a.color.rgb.b + "," + s + ")";
270
+ else var n = "hsla(" + a.color.hsl.h + "," + a.color.hsl.s + "%," + a.color.hsl.l + "%," + s + ")";
271
+ switch (i.canvas.ctx.fillStyle = n, i.canvas.ctx.beginPath(), a.shape) {
272
+ case "circle":
273
+ i.canvas.ctx.arc(a.x, a.y, t, 0, 2 * Math.PI, !1);
274
+ break;
275
+ case "edge":
276
+ i.canvas.ctx.rect(a.x - t, a.y - t, 2 * t, 2 * t);
277
+ break;
278
+ case "triangle":
279
+ i.fn.vendors.drawShape(i.canvas.ctx, a.x - t, a.y + t / 1.66, 2 * t, 3, 2);
280
+ break;
281
+ case "polygon":
282
+ i.fn.vendors.drawShape(i.canvas.ctx, a.x - t / (i.particles.shape.polygon.nb_sides / 3.5), a.y - t / .76, 2.66 * t / (i.particles.shape.polygon.nb_sides / 3), i.particles.shape.polygon.nb_sides, 1);
283
+ break;
284
+ case "star":
285
+ i.fn.vendors.drawShape(i.canvas.ctx, a.x - 2 * t / (i.particles.shape.polygon.nb_sides / 4), a.y - t / 1.52, 2 * t * 2.66 / (i.particles.shape.polygon.nb_sides / 3), i.particles.shape.polygon.nb_sides, 2);
286
+ break;
287
+ case "image":
288
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
289
+ else var r = i.tmp.img_obj;
290
+ r && e();
291
+ break;
292
+ case "image2":
293
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
294
+ else var r = i.tmp.img_obj;
295
+ var element = document.createElement('img');
296
+ element.src = 'assets/img/tema/m.png';
297
+ r = element;
298
+ r && e();
299
+ break;
300
+ case "image3":
301
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
302
+ else var r = i.tmp.img_obj;
303
+ var element = document.createElement('img');
304
+ element.src = '/assets/img/tema/o.png';
305
+ r = element;
306
+ r && e();
307
+ break;
308
+ case "image4":
309
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
310
+ else var r = i.tmp.img_obj;
311
+ var element = document.createElement('img');
312
+ element.src = '/assets/img/tema/r.png';
313
+ r = element;
314
+ r && e();
315
+ break;
316
+ case "image5":
317
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
318
+ else var r = i.tmp.img_obj;
319
+ var element = document.createElement('img');
320
+ element.src = '/assets/img/tema/e.png';
321
+ r = element;
322
+ r && e();
323
+ break;
324
+ case "image6":
325
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
326
+ else var r = i.tmp.img_obj;
327
+ var element = document.createElement('img');
328
+ element.src = '/assets/img/tema/l.png';
329
+ r = element;
330
+ r && e();
331
+ break;
332
+ case "image7":
333
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
334
+ else var r = i.tmp.img_obj;
335
+ var element = document.createElement('img');
336
+ element.src = 'https://d35408cyocioye.cloudfront.net/legacy/hex7a.png';
337
+ r = element;
338
+ r && e();
339
+ break;
340
+ case "image8":
341
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
342
+ else var r = i.tmp.img_obj;
343
+ var element = document.createElement('img');
344
+ element.src = 'https://d35408cyocioye.cloudfront.net/legacy/hex8a.png';
345
+ r = element;
346
+ r && e();
347
+ break;
348
+ case "image9":
349
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
350
+ else var r = i.tmp.img_obj;
351
+ var element = document.createElement('img');
352
+ element.src = 'https://d35408cyocioye.cloudfront.net/legacy/hex9a.png';
353
+ r = element;
354
+ r && e();
355
+ break;
356
+ case "image10":
357
+ if ("svg" == i.tmp.img_type) var r = a.img.obj;
358
+ else var r = i.tmp.img_obj;
359
+ var element = document.createElement('img');
360
+ element.src = 'https://d35408cyocioye.cloudfront.net/legacy/hex10a.png';
361
+ r = element;
362
+ r && e();
363
+ }
364
+ i.canvas.ctx.closePath(), i.particles.shape.stroke.width > 0 && (i.canvas.ctx.strokeStyle = i.particles.shape.stroke.color, i.canvas.ctx.lineWidth = i.particles.shape.stroke.width, i.canvas.ctx.stroke()), i.canvas.ctx.fill();
365
+ }, i.fn.particlesCreate = function() {
366
+ for (let e = 0; e < i.particles.number.value; e++) i.particles.array.push(new i.fn.particle(i.particles.color, i.particles.opacity.value));
367
+ }, i.fn.particlesUpdate = function() {
368
+ for (let e = 0; e < i.particles.array.length; e++) {
369
+ let a = i.particles.array[e];
370
+ if (i.particles.move.enable) {
371
+ let t = i.particles.move.speed / 2;
372
+ a.x += a.vx * t, a.y += a.vy * t;
373
+ }
374
+ if (i.particles.opacity.anim.enable && (1 == a.opacity_status ? (a.opacity >= i.particles.opacity.value && (a.opacity_status = !1), a.opacity += a.vo) : (a.opacity <= i.particles.opacity.anim.opacity_min && (a.opacity_status = !0), a.opacity -= a.vo), a.opacity < 0 && (a.opacity = 0)), i.particles.size.anim.enable && (1 == a.size_status ? (a.radius >= i.particles.size.value && (a.size_status = !1), a.radius += a.vs) : (a.radius <= i.particles.size.anim.size_min && (a.size_status = !0), a.radius -= a.vs), a.radius < 0 && (a.radius = 0)), "bounce" == i.particles.move.out_mode) var s = {
375
+ x_left: a.radius,
376
+ x_right: i.canvas.w,
377
+ y_top: a.radius,
378
+ y_bottom: i.canvas.h
379
+ };
380
+ else var s = {
381
+ x_left: -a.radius,
382
+ x_right: i.canvas.w + a.radius,
383
+ y_top: -a.radius,
384
+ y_bottom: i.canvas.h + a.radius
385
+ };
386
+ switch (a.x - a.radius > i.canvas.w ? (a.x = s.x_left, a.y = Math.random() * i.canvas.h) : a.x + a.radius < 0 && (a.x = s.x_right, a.y = Math.random() * i.canvas.h), a.y - a.radius > i.canvas.h ? (a.y = s.y_top, a.x = Math.random() * i.canvas.w) : a.y + a.radius < 0 && (a.y = s.y_bottom, a.x = Math.random() * i.canvas.w), i.particles.move.out_mode) {
387
+ case "bounce":
388
+ a.x + a.radius > i.canvas.w ? a.vx = -a.vx : a.x - a.radius < 0 && (a.vx = -a.vx), a.y + a.radius > i.canvas.h ? a.vy = -a.vy : a.y - a.radius < 0 && (a.vy = -a.vy);
389
+ }
390
+ if (isInArray("grab", i.interactivity.events.onhover.mode) && i.fn.modes.grabParticle(a), (isInArray("bubble", i.interactivity.events.onhover.mode) || isInArray("bubble", i.interactivity.events.onclick.mode)) && i.fn.modes.bubbleParticle(a), (isInArray("repulse", i.interactivity.events.onhover.mode) || isInArray("repulse", i.interactivity.events.onclick.mode)) && i.fn.modes.repulseParticle(a), i.particles.line_linked.enable || i.particles.move.attract.enable)
391
+ for (let n = e + 1; n < i.particles.array.length; n++) {
392
+ let r = i.particles.array[n];
393
+ i.particles.line_linked.enable && i.fn.interact.linkParticles(a, r), i.particles.move.attract.enable && i.fn.interact.attractParticles(a, r), i.particles.move.bounce && i.fn.interact.bounceParticles(a, r);
394
+ }
395
+ }
396
+ }, i.fn.particlesDraw = function() {
397
+ i.canvas.ctx.clearRect(0, 0, i.canvas.w, i.canvas.h), i.fn.particlesUpdate();
398
+ for (let e = 0; e < i.particles.array.length; e++) {
399
+ let a = i.particles.array[e];
400
+ a.draw();
401
+ }
402
+ }, i.fn.particlesEmpty = function() {
403
+ i.particles.array = [];
404
+ }, i.fn.particlesRefresh = function() {
405
+ cancelRequestAnimFrame(i.fn.checkAnimFrame), cancelRequestAnimFrame(i.fn.drawAnimFrame), i.tmp.source_svg = void 0, i.tmp.img_obj = void 0, i.tmp.count_svg = 0, i.fn.particlesEmpty(), i.fn.canvasClear(), i.fn.vendors.start();
406
+ }, i.fn.interact.linkParticles = function(e, a) {
407
+ let t = e.x - a.x,
408
+ s = e.y - a.y,
409
+ n = Math.sqrt(t * t + s * s);
410
+ if (n <= i.particles.line_linked.distance) {
411
+ let r = i.particles.line_linked.opacity - n / (1 / i.particles.line_linked.opacity) / i.particles.line_linked.distance;
412
+ if (r > 0) {
413
+ let c = i.particles.line_linked.color_rgb_line;
414
+ i.canvas.ctx.strokeStyle = "rgba(" + c.r + "," + c.g + "," + c.b + "," + r + ")", i.canvas.ctx.lineWidth = i.particles.line_linked.width, i.canvas.ctx.beginPath(), i.canvas.ctx.moveTo(e.x, e.y), i.canvas.ctx.lineTo(a.x, a.y), i.canvas.ctx.stroke(), i.canvas.ctx.closePath();
415
+ }
416
+ }
417
+ }, i.fn.interact.attractParticles = function(e, a) {
418
+ let t = e.x - a.x,
419
+ s = e.y - a.y,
420
+ n = Math.sqrt(t * t + s * s);
421
+ if (n <= i.particles.line_linked.distance) {
422
+ let r = t / (1e3 * i.particles.move.attract.rotateX),
423
+ c = s / (1e3 * i.particles.move.attract.rotateY);
424
+ e.vx -= r, e.vy -= c, a.vx += r, a.vy += c;
425
+ }
426
+ }, i.fn.interact.bounceParticles = function(e, a) {
427
+ let t = e.x - a.x,
428
+ i = e.y - a.y,
429
+ s = Math.sqrt(t * t + i * i),
430
+ n = e.radius + a.radius;
431
+ n >= s && (e.vx = -e.vx, e.vy = -e.vy, a.vx = -a.vx, a.vy = -a.vy);
432
+ }, i.fn.modes.pushParticles = function(e, a) {
433
+ i.tmp.pushing = !0;
434
+ for (let t = 0; e > t; t++) i.particles.array.push(new i.fn.particle(i.particles.color, i.particles.opacity.value, {
435
+ x: a ? a.pos_x : Math.random() * i.canvas.w,
436
+ y: a ? a.pos_y : Math.random() * i.canvas.h
437
+ })), t == e - 1 && (i.particles.move.enable || i.fn.particlesDraw(), i.tmp.pushing = !1);
438
+ }, i.fn.modes.removeParticles = function(e) {
439
+ i.particles.array.splice(0, e), i.particles.move.enable || i.fn.particlesDraw();
440
+ }, i.fn.modes.bubbleParticle = function(e) {
441
+ function a() {
442
+ e.opacity_bubble = e.opacity, e.radius_bubble = e.radius;
443
+ }
444
+
445
+ function t(a, t, s, n, c) {
446
+ if (a != t)
447
+ if (i.tmp.bubble_duration_end) {
448
+ if (void 0 != s) {
449
+ let o = n - p * (n - a) / i.interactivity.modes.bubble.duration,
450
+ l = a - o;
451
+ d = a + l, "size" == c && (e.radius_bubble = d), "opacity" == c && (e.opacity_bubble = d);
452
+ }
453
+ } else if (r <= i.interactivity.modes.bubble.distance) {
454
+ if (void 0 != s) var v = s;
455
+ else var v = n;
456
+ if (v != a) {
457
+ var d = n - p * (n - a) / i.interactivity.modes.bubble.duration;
458
+ "size" == c && (e.radius_bubble = d), "opacity" == c && (e.opacity_bubble = d);
459
+ }
460
+ } else "size" == c && (e.radius_bubble = void 0), "opacity" == c && (e.opacity_bubble = void 0);
461
+ }
462
+ if (i.interactivity.events.onhover.enable && isInArray("bubble", i.interactivity.events.onhover.mode)) {
463
+ var s = e.x - i.interactivity.mouse.pos_x,
464
+ n = e.y - i.interactivity.mouse.pos_y,
465
+ r = Math.sqrt(s * s + n * n),
466
+ c = 1 - r / i.interactivity.modes.bubble.distance;
467
+ if (r <= i.interactivity.modes.bubble.distance) {
468
+ if (c >= 0 && "mousemove" == i.interactivity.status) {
469
+ if (i.interactivity.modes.bubble.size != i.particles.size.value)
470
+ if (i.interactivity.modes.bubble.size > i.particles.size.value) {
471
+ var o = e.radius + i.interactivity.modes.bubble.size * c;
472
+ o >= 0 && (e.radius_bubble = o);
473
+ } else {
474
+ var l = e.radius - i.interactivity.modes.bubble.size,
475
+ o = e.radius - l * c;
476
+ o > 0 ? e.radius_bubble = o : e.radius_bubble = 0;
477
+ }
478
+ if (i.interactivity.modes.bubble.opacity != i.particles.opacity.value)
479
+ if (i.interactivity.modes.bubble.opacity > i.particles.opacity.value) {
480
+ var v = i.interactivity.modes.bubble.opacity * c;
481
+ v > e.opacity && v <= i.interactivity.modes.bubble.opacity && (e.opacity_bubble = v);
482
+ } else {
483
+ var v = e.opacity - (i.particles.opacity.value - i.interactivity.modes.bubble.opacity) * c;
484
+ v < e.opacity && v >= i.interactivity.modes.bubble.opacity && (e.opacity_bubble = v);
485
+ }
486
+ }
487
+ } else a();
488
+ "mouseleave" == i.interactivity.status && a();
489
+ } else if (i.interactivity.events.onclick.enable && isInArray("bubble", i.interactivity.events.onclick.mode)) {
490
+ if (i.tmp.bubble_clicking) {
491
+ var s = e.x - i.interactivity.mouse.click_pos_x,
492
+ n = e.y - i.interactivity.mouse.click_pos_y,
493
+ r = Math.sqrt(s * s + n * n),
494
+ p = ((new Date).getTime() - i.interactivity.mouse.click_time) / 1e3;
495
+ p > i.interactivity.modes.bubble.duration && (i.tmp.bubble_duration_end = !0), p > 2 * i.interactivity.modes.bubble.duration && (i.tmp.bubble_clicking = !1, i.tmp.bubble_duration_end = !1);
496
+ }
497
+ i.tmp.bubble_clicking && (t(i.interactivity.modes.bubble.size, i.particles.size.value, e.radius_bubble, e.radius, "size"), t(i.interactivity.modes.bubble.opacity, i.particles.opacity.value, e.opacity_bubble, e.opacity, "opacity"));
498
+ }
499
+ }, i.fn.modes.repulseParticle = function(e) {
500
+ function a() {
501
+ let a = Math.atan2(d, p);
502
+ if (e.vx = u * Math.cos(a), e.vy = u * Math.sin(a), "bounce" == i.particles.move.out_mode) {
503
+ let t = {
504
+ x: e.x + e.vx,
505
+ y: e.y + e.vy
506
+ };
507
+ t.x + e.radius > i.canvas.w ? e.vx = -e.vx : t.x - e.radius < 0 && (e.vx = -e.vx), t.y + e.radius > i.canvas.h ? e.vy = -e.vy : t.y - e.radius < 0 && (e.vy = -e.vy);
508
+ }
509
+ }
510
+ if (i.interactivity.events.onhover.enable && isInArray("repulse", i.interactivity.events.onhover.mode) && "mousemove" == i.interactivity.status) {
511
+ var t = e.x - i.interactivity.mouse.pos_x,
512
+ s = e.y - i.interactivity.mouse.pos_y,
513
+ n = Math.sqrt(t * t + s * s),
514
+ r = {
515
+ x: t / n,
516
+ y: s / n
517
+ },
518
+ c = i.interactivity.modes.repulse.distance,
519
+ o = 100,
520
+ l = clamp(1 / c * (-1 * Math.pow(n / c, 2) + 1) * c * o, 0, 50),
521
+ v = {
522
+ x: e.x + r.x * l,
523
+ y: e.y + r.y * l
524
+ };
525
+ "bounce" == i.particles.move.out_mode ? (v.x - e.radius > 0 && v.x + e.radius < i.canvas.w && (e.x = v.x), v.y - e.radius > 0 && v.y + e.radius < i.canvas.h && (e.y = v.y)) : (e.x = v.x, e.y = v.y);
526
+ } else if (i.interactivity.events.onclick.enable && isInArray("repulse", i.interactivity.events.onclick.mode))
527
+ if (i.tmp.repulse_finish || (i.tmp.repulse_count++, i.tmp.repulse_count == i.particles.array.length && (i.tmp.repulse_finish = !0)), i.tmp.repulse_clicking) {
528
+ var c = Math.pow(i.interactivity.modes.repulse.distance / 6, 3),
529
+ p = i.interactivity.mouse.click_pos_x - e.x,
530
+ d = i.interactivity.mouse.click_pos_y - e.y,
531
+ m = p * p + d * d,
532
+ u = -c / m * 1;
533
+ c >= m && a();
534
+ } else 0 == i.tmp.repulse_clicking && (e.vx = e.vx_i, e.vy = e.vy_i);
535
+ }, i.fn.modes.grabParticle = function(e) {
536
+ if (i.interactivity.events.onhover.enable && "mousemove" == i.interactivity.status) {
537
+ let a = e.x - i.interactivity.mouse.pos_x,
538
+ t = e.y - i.interactivity.mouse.pos_y,
539
+ s = Math.sqrt(a * a + t * t);
540
+ if (s <= i.interactivity.modes.grab.distance) {
541
+ let n = i.interactivity.modes.grab.line_linked.opacity - s / (1 / i.interactivity.modes.grab.line_linked.opacity) / i.interactivity.modes.grab.distance;
542
+ if (n > 0) {
543
+ let r = i.particles.line_linked.color_rgb_line;
544
+ i.canvas.ctx.strokeStyle = "rgba(" + r.r + "," + r.g + "," + r.b + "," + n + ")", i.canvas.ctx.lineWidth = i.particles.line_linked.width, i.canvas.ctx.beginPath(), i.canvas.ctx.moveTo(e.x, e.y), i.canvas.ctx.lineTo(i.interactivity.mouse.pos_x, i.interactivity.mouse.pos_y), i.canvas.ctx.stroke(), i.canvas.ctx.closePath();
545
+ }
546
+ }
547
+ }
548
+ }, i.fn.vendors.eventsListeners = function() {
549
+ "window" == i.interactivity.detect_on ? i.interactivity.el = window : i.interactivity.el = i.canvas.el, (i.interactivity.events.onhover.enable || i.interactivity.events.onclick.enable) && (i.interactivity.el.addEventListener("mousemove", function(e) {
550
+ if (i.interactivity.el == window) var a = e.clientX,
551
+ t = e.clientY;
552
+ else var a = e.offsetX || e.clientX,
553
+ t = e.offsetY || e.clientY;
554
+ i.interactivity.mouse.pos_x = a, i.interactivity.mouse.pos_y = t, i.tmp.retina && (i.interactivity.mouse.pos_x *= i.canvas.pxratio, i.interactivity.mouse.pos_y *= i.canvas.pxratio), i.interactivity.status = "mousemove";
555
+ }), i.interactivity.el.addEventListener("mouseleave", function(e) {
556
+ i.interactivity.mouse.pos_x = null, i.interactivity.mouse.pos_y = null, i.interactivity.status = "mouseleave";
557
+ })), i.interactivity.events.onclick.enable && i.interactivity.el.addEventListener("click", function() {
558
+ if (i.interactivity.mouse.click_pos_x = i.interactivity.mouse.pos_x, i.interactivity.mouse.click_pos_y = i.interactivity.mouse.pos_y, i.interactivity.mouse.click_time = (new Date).getTime(), i.interactivity.events.onclick.enable) switch (i.interactivity.events.onclick.mode) {
559
+ case "push":
560
+ i.particles.move.enable ? i.fn.modes.pushParticles(i.interactivity.modes.push.particles_nb, i.interactivity.mouse) : 1 == i.interactivity.modes.push.particles_nb ? i.fn.modes.pushParticles(i.interactivity.modes.push.particles_nb, i.interactivity.mouse) : i.interactivity.modes.push.particles_nb > 1 && i.fn.modes.pushParticles(i.interactivity.modes.push.particles_nb);
561
+ break;
562
+ case "remove":
563
+ i.fn.modes.removeParticles(i.interactivity.modes.remove.particles_nb);
564
+ break;
565
+ case "bubble":
566
+ i.tmp.bubble_clicking = !0;
567
+ break;
568
+ case "repulse":
569
+ i.tmp.repulse_clicking = !0, i.tmp.repulse_count = 0, i.tmp.repulse_finish = !1, setTimeout(function() {
570
+ i.tmp.repulse_clicking = !1;
571
+ }, 1e3 * i.interactivity.modes.repulse.duration);
572
+ }
573
+ });
574
+ }, i.fn.vendors.densityAutoParticles = function() {
575
+ if (i.particles.number.density.enable) {
576
+ let e = i.canvas.el.width * i.canvas.el.height / 1e3;
577
+ i.tmp.retina && (e /= 2 * i.canvas.pxratio);
578
+ let a = e * i.particles.number.value / i.particles.number.density.value_area,
579
+ t = i.particles.array.length - a;
580
+ 0 > t ? i.fn.modes.pushParticles(Math.abs(t)) : i.fn.modes.removeParticles(t);
581
+ }
582
+ }, i.fn.vendors.checkOverlap = function(e, a) {
583
+ for (let t = 0; t < i.particles.array.length; t++) {
584
+ let s = i.particles.array[t],
585
+ n = e.x - s.x,
586
+ r = e.y - s.y,
587
+ c = Math.sqrt(n * n + r * r);
588
+ c <= e.radius + s.radius && (e.x = a ? a.x : Math.random() * i.canvas.w, e.y = a ? a.y : Math.random() * i.canvas.h, i.fn.vendors.checkOverlap(e));
589
+ }
590
+ }, i.fn.vendors.createSvgImg = function(e) {
591
+ let a = i.tmp.source_svg,
592
+ t = /#([0-9A-F]{3,6})/gi,
593
+ s = a.replace(t, function(a, t, i, s) {
594
+ if (e.color.rgb) var n = "rgba(" + e.color.rgb.r + "," + e.color.rgb.g + "," + e.color.rgb.b + "," + e.opacity + ")";
595
+ else var n = "hsla(" + e.color.hsl.h + "," + e.color.hsl.s + "%," + e.color.hsl.l + "%," + e.opacity + ")";
596
+ return n;
597
+ }),
598
+ n = new Blob([s], {
599
+ type: "image/svg+xml;charset=utf-8"
600
+ }),
601
+ r = window.URL || window.webkitURL || window,
602
+ c = r.createObjectURL(n),
603
+ o = new Image;
604
+ o.addEventListener("load", function() {
605
+ e.img.obj = o, e.img.loaded = !0, r.revokeObjectURL(c), i.tmp.count_svg++;
606
+ }), o.src = c;
607
+ }, i.fn.vendors.destroypJS = function() {
608
+ cancelAnimationFrame(i.fn.drawAnimFrame), t.remove(), pJSDom = null;
609
+ }, i.fn.vendors.drawShape = function(e, a, t, i, s, n) {
610
+ let r = s * n,
611
+ c = s / n,
612
+ o = 180 * (c - 2) / c,
613
+ l = Math.PI - Math.PI * o / 180;
614
+ e.save(), e.beginPath(), e.translate(a, t), e.moveTo(0, 0);
615
+ for (let v = 0; r > v; v++) e.lineTo(i, 0), e.translate(i, 0), e.rotate(l);
616
+ e.fill(), e.restore();
617
+ }, i.fn.vendors.exportImg = function() {
618
+ window.open(i.canvas.el.toDataURL("image/png"), "_blank");
619
+ }, i.fn.vendors.loadImg = function(e) {
620
+ if (i.tmp.img_error = void 0, "" != i.particles.shape.image.src)
621
+ if ("svg" == e) {
622
+ let a = new XMLHttpRequest;
623
+ a.open("GET", i.particles.shape.image.src), a.onreadystatechange = function(e) {
624
+ 4 == a.readyState && (200 == a.status ? (i.tmp.source_svg = e.currentTarget.response, i.fn.vendors.checkBeforeDraw()) : (console.log("Error pJS - Image not found"), i.tmp.img_error = !0));
625
+ }, a.send();
626
+ } else {
627
+ let t = new Image;
628
+ t.addEventListener("load", function() {
629
+ i.tmp.img_obj = t, i.fn.vendors.checkBeforeDraw();
630
+ }), t.src = i.particles.shape.image.src;
631
+ } else console.log("Error pJS - No image.src"), i.tmp.img_error = !0;
632
+ }, i.fn.vendors.draw = function() {
633
+ "image" == i.particles.shape.type ? "svg" == i.tmp.img_type ? i.tmp.count_svg >= i.particles.number.value ? (i.fn.particlesDraw(), i.particles.move.enable ? i.fn.drawAnimFrame = requestAnimFrame(i.fn.vendors.draw) : cancelRequestAnimFrame(i.fn.drawAnimFrame)) : i.tmp.img_error || (i.fn.drawAnimFrame = requestAnimFrame(i.fn.vendors.draw)) : void 0 != i.tmp.img_obj ? (i.fn.particlesDraw(), i.particles.move.enable ? i.fn.drawAnimFrame = requestAnimFrame(i.fn.vendors.draw) : cancelRequestAnimFrame(i.fn.drawAnimFrame)) : i.tmp.img_error || (i.fn.drawAnimFrame = requestAnimFrame(i.fn.vendors.draw)) : (i.fn.particlesDraw(), i.particles.move.enable ? i.fn.drawAnimFrame = requestAnimFrame(i.fn.vendors.draw) : cancelRequestAnimFrame(i.fn.drawAnimFrame));
634
+ }, i.fn.vendors.checkBeforeDraw = function() {
635
+ "image" == i.particles.shape.type ? "svg" == i.tmp.img_type && void 0 == i.tmp.source_svg ? i.tmp.checkAnimFrame = requestAnimFrame(check) : (cancelRequestAnimFrame(i.tmp.checkAnimFrame), i.tmp.img_error || (i.fn.vendors.init(), i.fn.vendors.draw())) : (i.fn.vendors.init(), i.fn.vendors.draw());
636
+ }, i.fn.vendors.init = function() {
637
+ i.fn.retinaInit(), i.fn.canvasInit(), i.fn.canvasSize(), i.fn.canvasPaint(), i.fn.particlesCreate(), i.fn.vendors.densityAutoParticles(), i.particles.line_linked.color_rgb_line = hexToRgb(i.particles.line_linked.color);
638
+ }, i.fn.vendors.start = function() {
639
+ isInArray("image", i.particles.shape.type) ? (i.tmp.img_type = i.particles.shape.image.src.substr(i.particles.shape.image.src.length - 3), i.fn.vendors.loadImg(i.tmp.img_type)) : i.fn.vendors.checkBeforeDraw();
640
+ }, i.fn.vendors.eventsListeners(), i.fn.vendors.start();
641
+ };
642
+ Object.deepExtend = function(e, a) {
643
+ for (let t in a) a[t] && a[t].constructor && a[t].constructor === Object ? (e[t] = e[t] || {}, arguments.callee(e[t], a[t])) : e[t] = a[t];
644
+ return e;
645
+ }, window.requestAnimFrame = function() {
646
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(e) {
647
+ window.setTimeout(e, 1e3 / 60);
648
+ };
649
+ }(), window.cancelRequestAnimFrame = function() {
650
+ return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || clearTimeout;
651
+ }(), window.pJSDom = [], window.particlesJS = function(e, a) {
652
+ "string" != typeof e && (a = e, e = "particles-js"), e || (e = "particles-js");
653
+ let t = document.getElementById(e),
654
+ i = "particles-js-canvas-el",
655
+ s = t.getElementsByClassName(i);
656
+ if (s.length)
657
+ for (; s.length > 0;) t.removeChild(s[0]);
658
+ let n = document.createElement("canvas");
659
+ n.className = i, n.style.width = "100%", n.style.height = "100%";
660
+ let r = document.getElementById(e).appendChild(n);
661
+ null != r && pJSDom.push(new pJS(e, a));
662
+ }, window.particlesJS.load = function(e, a, t) {
663
+ let i = new XMLHttpRequest;
664
+ i.open("GET", a), i.onreadystatechange = function(a) {
665
+ if (4 == i.readyState)
666
+ if (200 == i.status) {
667
+ let s = JSON.parse(a.currentTarget.response);
668
+ window.particlesJS(e, s), t && t();
669
+ } else console.log("Error pJS - XMLHttpRequest status: " + i.status), console.log("Error pJS - File config not found");
670
+ }, i.send();
671
+ };