直接上代码(后续其他效果可以自行添加)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>跳动的小心心</title>
<style>
.container{
width: 200px;
height: 200px;
background-color: pink;
position: fixed;
left: 50%;
top: 36%;
margin-left: -100px;
margin-left: -100px;
/* box-shadow: 3px 3px pink; */
animation: my 400ms linear infinite;
}
.harf1{
width: 200px;
height: 200px;
background-color: pink;
border-radius: 100px;
position: absolute;
bottom: 50%;
}
.harf2{
width: 200px;
height: 200px;
background-color: pink;
border-radius: 100px;
right: 50%;
position: absolute;
}
@keyframes my {
0%{
transform: rotate(45deg) scale(0.8);
}
20%{
transform: rotate(45deg) scale(1.2);
}
60%{
transform: rotate(45deg) scale(1.5);
}
80%{
transform: rotate(45deg) scale(1.2);
}
100%{
transform: rotate(45deg) scale(0.8);
}
}
</style>
</head>
<body>
<div class="container">
<div class="harf1"></div>
<div class="harf2"></div>
</div>
<div class="container">
<div class="harf1"></div>
<div class="harf2"></div>
</div>
</body>
</html>