💓Code for Heart Beating Animation💓
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<meta name="author" content="SpaceMan" />
<title>Animated Heart</title>
</head>
<body>
<div class="heart-box">
<div class="heart-left"></div>
<div class="heart-right"></div>
</div>
<style>
body,
.heart-box {
display: flex;
align-items: center;
justify-content: center;
}
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<meta name="author" content="SpaceMan" />
<title>Animated Heart</title>
</head>
<body>
<div class="heart-box">
<div class="heart-left"></div>
<div class="heart-right"></div>
</div>
<style>
body,
.heart-box {
display: flex;
align-items: center;
justify-content: center;
}
body {
min-height: 100vh;
background: #232323;
}
min-height: 100vh;
background: #232323;
}
.heart-box {
margin: 30px;
animation: beating 1s infinite linear;
}
margin: 30px;
animation: beating 1s infinite linear;
}
.heart-box .heart-left,
.heart-box .heart-right {
background: crimson;
width: 65px;
height: 110px;
margin: 5px -16px;
border-radius: 50px 50px 0 0;
}
.heart-box .heart-right {
background: crimson;
width: 65px;
height: 110px;
margin: 5px -16px;
border-radius: 50px 50px 0 0;
}
.heart-box .heart-left {
transform: rotate(-45deg);
}
transform: rotate(-45deg);
}
.heart-box .heart-right {
transform: rotate(45deg);
}
transform: rotate(45deg);
}
@keyframes beating {
20% {
transform: scale(1.3);
}
40% {
transform: scale(1);
}
50% {
transform: scale(1.25);
}
to {
transform: scale(1);
}
}
</style>
</body>
</html>
20% {
transform: scale(1.3);
}
40% {
transform: scale(1);
}
50% {
transform: scale(1.25);
}
to {
transform: scale(1);
}
}
</style>
</body>
</html>
Heartbeat Animation Code
Reviewed by Shaishav Anand
on
July 22, 2019
Rating:
No comments: