<!DOCTYPE html>
<html>
<head>
<title>钟表效果</title>
<style type="text/css" media="screen">
*{
padding:0px;
margin: 0px;
}
@keyframes secondrun{
0%{
transform: rotate(180deg);
}
100%{
transform: rotate(540deg);
}
}
@keyframes minuterun{
0%{
transform: rotate(180deg);
}
100%{
transform: rotate(540deg);
}
}
.clock{
position:relative;
width:512px;
height: 512px;
background-image: url(./clock.png);
background-size: cover;
background-repeat:no-repeat;
}
.second{
position: absolute;
left:247px;
top:180px;
width:16px;
height:278px;
background-image: url(./second.png);
background-size: cover;
background-repeat:no-repeat;
z-index:3;
transform:rotate(180deg);
transform-origin:center 76px;
animation:secondrun 60s steps(60,end) infinite;
}
.minute{
position: absolute;
left:238px;
top:240px;
width:32px;
height:218px;
background-image: url(./minute.png);
background-size: cover;
background-repeat:no-repeat;
z-index:2;
transform:rotate(180deg);
transform-origin:center 16px;
animation:minuterun 3600s steps(60,end);
}
.hour{
position: absolute;
left:238px;
top:240px;
width:32px;
height:148px;
background-image: url(./hour.png);
background-size: cover;
background-repeat:no-repeat;
z-index:1;
transform-origin: inherit;center 16px;
}
</style>
</head>
<body>
<div class="clock">
<div class="second"></div>
<div class="minute"></div>
<div class="hour"></div>
</div>
</body>
</html>
css3--animation实现钟表效果
最新推荐文章于 2021-11-30 21:44:30 发布