-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
47 lines (37 loc) · 867 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
document.addEventListener("click", event => {
bursty(event.pageX, event.pageY);
});
setInterval(() => randomizedConfetti(), 500);
function bursty(x, y) {
const burst = new mojs.Burst({
left: 0,
top: 0,
radius: { 0: 200 },
count: 20,
degree: 360,
children: {
fill: { white: "#34E1FF" },
duration: 2000 } }).
tune({
x: x,
y: y });
burst.replay();
}
function randomizedConfetti() {
let randomX = Math.floor(Math.random() * (document.body.clientWidth - 100) + 0);
let randomY = Math.floor(Math.random() * (window.innerHeight - 200) + 0);
const burst = new mojs.Burst({
left: 0,
top: 0,
radius: { 0: 200 },
count: 20,
degree: 360,
children: {
fill: { white: "#34E1FF" },
duration: 2000 } }).
tune({
x: randomX,
y: randomY });
burst.replay();
}
Splitting();