效果图
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
.box{
width:150px;
height:400px;
background: url("clock.png") no-repeat;
margin: auto;
/* animation : 动画的名字 时间 匀速 无限 */
animation:move 2s linear infinite;
transform-origin: top center;
}
/* @keyframes: 自定义动画 */
@keyframes move{
0%{
transform: rotate(0deg);
}
25%{
transform: rotate(45deg);
}
50%{
transform: rotate(0deg);
}
75%{
transform: rotate(-45deg);
}
100%{
transform: rotate(0deg);
}
}
</style>
</head>
<body>
<div class="box"></div>
<script>
</script>
</body>
</html>
图片资源
clock.png