<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
img{
position: absolute;
left: 50%;
top: 100px;
transform: translateX(-250px);
}
.div1{
height: 20px;
width: 120px;
border-radius: 10px;
background-color: black;
position: absolute;
left: 735px;
top: 350px;
transform-origin: 10% 50%;
animation:hour 24*3600s steps(24) infinite;
}
.div2{
height: 20px;
width: 160px;
border-radius: 10px;
background-color: cyan;
position: absolute;
left: 735px;
top: 350px;
transform-origin: 10% 50%;
animation:minute 3600s steps(60) infinite;
}
.div3{
height: 20px;
width: 180px;
border-radius: 20px;
background-color: red;
position: absolute;
left: 735px;
top: 350px;
transform-origin: 10% 50%;
animation:second 60s steps(60) infinite;
}
@keyframes hour{
0%{transform:rotate(0)}
100%{transform:rotate(360deg)}
}
@keyframes minute{
0%{transform:rotate(0)}
100%{transform:rotate(360deg)}
}
@keyframes second{
0%{transform:rotate(0)}
100%{transform:rotate(360deg)}
}
</style>
</head>
<body>
<div>
<img src="../lib/image/时钟.png" >
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
</div>
</body>
</html>
animation 中的 steps() 的使用 做一个时钟
最新推荐文章于 2022-03-04 19:58:09 发布