-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
35 lines (31 loc) · 1.08 KB
/
index.html
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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>vanilla particules</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script>
document.addEventListener('mousemove', function (e){
let body = document.querySelector('body');
let particules = document.createElement('span');
let x = e.offsetX;
let y = e.offsetY;
particules.style.left = x+ 'px';
particules.style.top = y+ 'px';
let size = Math.random() * 6;
particules.style.width = 1 + size+ 'px';
particules.style.height = 1 + size+ 'px';
let transformValue = Math.random() * 360;
particules.style.transform = 'rotate('+transformValue+'deg)';
body.appendChild(particules);
setTimeout (function(){
particules.remove()
},2000)
})
</script>
</body>
</html>