<!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>
.heart{
width: 200px;
height: 200px;
background: #e74c3c;
transform: rotate(45deg) scale(0.5);
animation-name: hd;
animation-duration: 2s;
animation-iteration-count: infinite;
}
.heart::before{
content: ‘‘;
width: 200px;
height: 200px;
border-radius: 50%;
position: absolute;
background: #e74c3c;
transform: translateX(-100px) ;
}
@keyframes hd {
25%{
transform: rotate(45deg) scale(1);
}
50%{
transform: rotate(45deg) scale(.5);
}
75%{
transform: rotate(45deg) scale(1);
}
100%{
transform: rotate(45deg) scale(.5);
}
}
.heart::after{
content: ‘‘;
width: 200px;
height: 200px;
border-radius: 50%;
position: absolute;
background: #e74c3c;
transform: translateY(-100px);
}
body{
width: 100vw;
height: 100vh;
background: #34495e;
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<div class="heart"></div>
<script src="./index.js"></script>
</body>
</html>
原文:https://www.cnblogs.com/lceihen/p/14643825.html