html
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
<!DOCTYPE html>
<html lang="en">
<head>
<title> Eye follow cursor </title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css"></link>
</head>
<body>
<div id ="container">
<div class ="square"></div>
<div class="eye left">
<div class="circle">
<div class="pupil pup-left"></div>
</div>
</div>
<div class="eye right">
<div class="circle">
<div class="pupil pup-right"></div>
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
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
body {
background: #ffffff;
}
#container {
width: 500px;
height: 500px;
background: #ffffff;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.square {
width: 75px;
height: 75px;
background: #f2f2b6;
transform: rotate(45deg);
position: absolute;
top: 20vh;
}
/* this div .eye is used as a standard for constructing .left and .right */
.eye {
width: 115px;
height: 115px;
background: #f2f2b6;
border-radius: 0px 60px 60px 60px;
position: absolute;
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
//this code is TO WAKE UP Owl by click on it after waiting for 3s
setTimeout(function(){
document.getElementById("container").onclick = function(){
var newStyle = document.createElement('style');
newStyle.innerHTML =`.pupil{
height:30px;
animation: none !important;
top: 20px;
}`
document.head.appendChild(newStyle);
}
}, 3000)
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run