forked from Shubham56-droid/Web-Components-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (21 loc) · 644 Bytes
/
script.js
File metadata and controls
21 lines (21 loc) · 644 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function rain()
{
let amount = 150;
let body = document.querySelector('body');
let i = 0;
while( i < amount)
{
let drop = document.createElement('i');
let size = Math.random() * 7;
let posX = Math.floor(Math.random() * window.innerWidth);
let delay = Math.random() * -20;
let durantion = Math.random() * 5;
drop.style.width = 0.2 * size + 'px';
drop.style.left = posX + 'px';
drop.style.animationDelay = delay + 's';
drop.style.animationDuration = 1 + durantion + 's';
body.appendChild(drop);
i++;
}
}
rain();