Fri Jul 15 2022
Heart Beating Effect
CSS5509 views
File Name: heart-beating-effect.html
<!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>Heart Beating Effect</title>
<style>
* {
margin: 0;
padding: 0;
}
body { background-color: #383838; }
section {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
div.heart {
width: 200px;
height: 160px;
position: relative;
animation: beating 1s infinite ease-in-out;
}
div.heart::before,
div.heart::after {
background-color: #f00;
position: absolute;
content: '';
width: 50%;
height: 100%;
top: -50%;
border-radius: 50px 50px 0 0;
}
div.heart::before {
left: 15%;
transform: rotate(45deg);
transform-origin: 0 100%;
}
div.heart::after {
left: 35%;
transform: rotate(-45deg);
transform-origin: 100% 100%;
}
@keyframes beating {
0% {
transform: scale(1);
}
30% {
transform: scale(0.8);
}
50% {
transform: scale(1);
}
70% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
</style>
</head>
<body>
<section>
<div class="heart"></div>
</section>
</body>
</html>
Result Screenshot(s)
Author:Geekboots