爱心移动的动画
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
padding: 0px;
margin: 0;
box-sizing: border-box;
}
.box{
margin-top: 60px;
margin-left: auto;
margin-right: auto;
width: 500px;
height: 500px;
}
.left, .right{
width: 50px;
height: 100px;
border-radius: 75px 75px 0 0 ;
background-color: red;
float: left;
position: relative;
left: 200px;
top: 200px;
animation: move 10s infinite ;
}
.left{
transform: rotate(-45deg) translate(10px);
}
.right{
transform: rotate(45deg) translate(-10px);
}
@keyframes move{
0%{
left: 200px;
top: 200px;
}
20%{
top: 0px;
left: 200px;
}
40%{
left: 0px;
top: 200px;
}
60%{
left: 200px;
top: 400px;
}
80%{
left: 400px;
top: 200px;
}
100%{
left: 200px;
top: 200px;
}
}
</style>
</head>
<body>
<div class="box">
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>