-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarmerEyes.html
More file actions
74 lines (66 loc) · 1.56 KB
/
warmerEyes.html
File metadata and controls
74 lines (66 loc) · 1.56 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Eyes that watch you</title>
</head>
<style>
body {
margin: 0;
padding: 0;
background: palevioletred;
}
.eyes {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
}
.eye {
width: 240px;
height: 120px;
background: #fff;
display: inline-block;
margin: 40px;
border-radius: 50%;
position: relative;
overflow: hidden;
}
.ball {
width: 80px;
height: 80px;
background: #000;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
}
</style>
<body>
<div class="eyes">
<div class="eye">
<div class="ball"></div>
</div>
<div class="eye">
<div class="ball"></div>
</div>
</div>
<p>Woooooo.... this is spooky, also quite useful, and sometimes reassuring.
Call me. Maybe.
</p>
</body>
<script>
var balls = document.getElementsByClassName("ball");
document.onmousemove = () => {
var x = (event.clientX * 100) / window.innerWidth + "%";
var y = (event.clientY * 100) / window.innerHeight + "%";
for (let i = 0; i < 2; i++) {
balls[i].style.left = x;
balls[i].style.top = y;
balls[i].transfoorm = "translate(-" + x + ",-" + y + ")";
}
};
</script>
</html>