<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>14_아날로그 시계</title>
<style>
#wrap{
width: 600px;
height: 600px;
position: fixed;
left: 50%;
top: 50%;
margin: -300px 0 0 -300px;
font-family: bon, sans-serif;
}
#wrap h3{
height: 80px;
font-size: 50px;
text-align: center;
line-height: 80px;
font-weight: 700;
color: darkkhaki;
}
#clock{
width: 500px;
height: 500px;
background: url(../images/Clock-face.png);
background-size: 100% 100%;
margin: auto;
position: relative;
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 24),0 17px 50px 0 rgba(0, 0, 0, 19);
}
#hour{background: url(../images/hour_hand.png);}
#min{background: url(../images/minute_hand.png);}
#sec{background: url(../images/second_hand.png);}
.hand{
width: 500px;
height: 500px;
position: absolute;
left: 0;
top: 0;
}
</style>
<script src="jquery-3.6.4.min.js"></script>
<script src="moment-with-locales.min.js"></script>
</head>
<body>
<div id="wrap">
<h3>아날로그 시계</h3>
<div id="clock">
<div id="hour" class="hand"></div>
<div id="min" class="hand"></div>
<div id="sec" class="hand"></div>
</div>
</div>
<script>
runtime();
function runtime(){
let now=moment();
let hour=now.hour();
let min=now.minute();
let sec=now.second();
$("#sec").css("transform", "rotate("+(sec* 6) +"deg)");
$("#min").css("transform", "rotate("+((min* 6)+0.1*sec) +"deg)");
$("#hour").css("transform", "rotate("+((hour* 30)+0.5*min) +"deg)");
}
setInterval(runtime,1000);
</script>
</body>
</html>