-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmoji_cursor_trail_effect.html
107 lines (85 loc) · 3 KB
/
Emoji_cursor_trail_effect.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<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>Emoji Cursor Trail</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
}
body{
min-height: 100vh;
background-color: #111;
overflow: hidden;
}
span{
position: absolute;
pointer-events: none;
animation: animate 1s linear infinite;
}
@keyframes animate{
0%{
translate: 0 0;
opacity: 0;
}
10%{
opacity: 1;
}
30%{
translate: 0 100px;
opacity: 1;
}
90%{
opacity: 1;
}
100%{
translate: 0 80px;
opacity: 0;
}
}
</style>
</head>
<body>
<script>
var image = ['😀' , '😃' , '😄' , '😇' , '😍' , '😰' , '🌜' , '👍' , '🌧' , '🌊' , '🤍' , '❤️' , '🍉' , '❄️' , '💂♂️' , '😡' , '🎃' , '👽' , '👾' , '👻' , '💩' , '💀' , '😈' , '☢️']
document.addEventListener("mousemove" , function(e){
var body = document.body;
var emoji = document.createElement("span");
var x = e.offsetX;
var y = e.offsetY;
emoji.style.left = x + "px";
emoji.style.top = y + "px";
emoji.innerText = image[Math.floor(Math.random() * image.length)];
emoji.style.fontSize = 5 + Math.random() * 50 + "px";
emoji.style.transform = 'translateX(' + Math.floor((Math.random() * ((1 - 200)) + 200)) + 'px)' ;
body.appendChild(emoji);
setTimeout(function(){
emoji.remove();
},1000);
});
document.addEventListener("touchmove" , function(e){
var body = document.body;
var emoji = document.createElement("span");
var x = e.touches[0].clientX;
var y = e.touches[0].clientY;
emoji.style.left = x + "px";
emoji.style.top = y + "px";
emoji.innerText = image[Math.floor(Math.random() * image.length)];
emoji.style.fontSize = 5 + Math.random() * 20 + "px";
emoji.style.transform = 'translateX(' + Math.floor((Math.random() * ((1 - 50)) + 50)) + 'px)' ;
body.appendChild(emoji);
setTimeout(function(){
emoji.remove();
},1000);
});
</script>
</body>
</html>