<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<style>
.bp{
width: 500px;
height: 500px;
margin: 0 auto;
border-radius:250px ;
border: 2px dashed aqua;
position: relative;
background-image: url("timg.png");
background-size:cover ;
}
#sz{
width: 100px;
height: 5px;
background: black;
position: absolute;
left: 249px;
top: 248px;
transform-origin:0 center ;
}
#fz{
width: 150px;
height: 5px;
background: red;
position: absolute;
left: 249px;
top: 248px;
transform-origin:0 center ;
}
#mz{
width: 200px;
height: 5px;
background: green;
position: absolute;
left: 249px;
top: 248px;
transform-origin:0 center ;
}
</style>
<div class="bp">
<div id="sz"></div>
<div id="fz"></div>
<div id="mz"></div>
</div>
</body>
<script>
onload=function(){
setInterval(function(){
getTm();
}
,1000)
function getTm(){
var sz=document.getElementById("sz");
var fz= document.getElementById("fz");
var mz=document.getElementById("mz");
var date=new Date();
sz.style.transform="rotate("+(date.getHours()*30-90)+"deg)"
fz.style.transform="rotate("+(date.getMinutes()*6-90)+"deg)"
mz.style.transform="rotate("+(date.getSeconds()*6-90)+"deg)"
}
}
</script>
</html>
效果图:
可以根据自己喜欢的表盘自己设置
如果想要现在这个图片 可以私信博主