This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sorry.html
73 lines (65 loc) · 2.29 KB
/
sorry.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
<!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>smile</title>
<link rel ="stylesheet" href="sorry.css">
</head>
<body>
<div class ="position">
<div class="center">
<strong> 제목: 해커톤하면서 우리가 느낀 감정.. </strong>
</div>
<button type = "button" id ="upset" onclick="ChangeUpest()" >맞았다..</button>
<button type = "button" id = "sad" onclick="ChangeSad()">또 맞았다...</button>
<button type = "button" id ="tired" onclick="ChangeHappy()">행복했다.</button>
<button type = "button" id ="die" onclick="ChangeDie()">죽고싶어졌다..</button>
<div id="face">
<div class="eyes">
<div class="eye"></div>
<div class="eye"></div>
</div>
</div>
</div>
<script>
document.querySelector("body").addEventListener("mousemove", eyeball);
function eyeball() {
'use strict';
var eye = document.querySelectorAll(".eye");
eye.forEach(function (eye) {
let x = (eye.getBoundingClientRect().left) + (eye.clientWidth / 2)
let y = (eye.getBoundingClientRect().top) + (eye.clientHeight / 2);
let radian = Math.atan2(event.pageX - x, event.pageY - y);
let rot = (radian * (180 / Math.PI) * -1) + 270;
eye.style.transform = "rotate("+ rot +"deg)"
})
}
</script>
<script>
function ChangeUpest() {
let x = document.querySelector('#face');
x.style.backgroundColor="#EC431F";
let y= document.querySelector('.eye');
y.style.border= "5px solid";
}
function ChangeSad() {
let x = document.querySelector("#face").style.backgroundColor="blue";
let y= document.querySelector('#eye');
y.style.border= "5px solid";
}
function ChangeHappy() {
let x = document.querySelector("#face").style.backgroundColor="#ffcd00";
let y= document.querySelector('.eye');
y.style.border= "0px solid";
}
function ChangeDie() {
let x = document.querySelector("#face").style.backgroundColor="black";
let z= document.querySelector('#eye');
z.style.border= "5px solid";
z.style.border ="blue";
}
</script>
</body>
</html>