1.动画旋转和移动效果
keyframes的rotate旋转 和move移动效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.close{
width: 32px;
height: 32px;
margin: 0 auto;
}
.close img{
animation: rotmote 1s linear infinite;
-webkit-animation: rotmote 1s linear infinite;
width: 100%;
height: 100%;
}
@keyframes rotmote{
0%{
transform: rotate(0deg);
}
100%{
transform: rotate(360deg);
}
}
-webkit-@keyframes rotmote{
0%{
transform: rotate(0deg);
}
100%{
transform: rotate(360deg);
}
}
.moveImg{
width: 100%;
height: 300px;
padding-top: 300px;
background-color: #ccc;
position: relative;
}
.moveImg img{
width: 50px;
height: 50px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
animation: move 5s ease-in-out infinite;
-webkit-animation: move 5s ease-in-out infinite;
}
@keyframes move{
from{
top: -10px;
}
to{
top: 100px;
}
}
-webkit-@keyframes move{
from{
top: -10px;
}
to{
top: 100px;
}
}
</style>
</head>
<body>
<!-- 旋转效果 -->
<div class="close">
<img src="./img/close.png" alt="">
</div>
<!-- 移动效果 -->
<div class="moveImg">
<img src="./img/close.png" alt="">
</div>
</body>
</html>