How to create circle animation using CSS?
<!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>
body {
background: #454a59ab;
}
.circle-animation {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
width: 100px; /* Adjust the width*/
height: 100px; /* Adjust the height*/
}
.circle-animation:before {
content: '';
position: relative;
display: block;
width: 300%;
height: 300%;
box-sizing: border-box;
margin-left: -100%;
margin-top: -100%;
border-radius: 176px;
background-color: #ad2417;
animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
.circle-animation:after {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: block;
width: 50px; /* Adjust the width*/
height: 50px; /* Adjust the height*/
background-color: #cb6426;
border-radius: 50%;
box-shadow: 0px 0px 25px #ffff006b;
}
@keyframes pulse-ring {
0% {
transform: scale(0.33);
}
80%, 100% {
opacity: 0;
}
}
@keyframes pulse-dot {
0% {
transform: scale(0.8);
}
50% {
transform: scale(1);
}
100% {
transform: scale(0.8);
}
}
</style>
</head>
<body>
<div class="circle-animation"></div>
</body>
</html>
This CSS block defines the styles for the .circle-animation class. It sets the position of the element to be centered both horizontally and vertically on the page using the left: 50%; and top: 50%; properties along with the transform: translateX(-50%) translateY(-50%); property. The width and height properties are set to 100px, which determines the size of the circle.
.circle-animation {position: absolute;left: 50%;top: 50%;transform: translateX(-50%) translateY(-50%);width: 100px;height: 100px;}
.circle-animation:before {content: '';position: relative;display: block;width: 300%;height: 300%;box-sizing: border-box;margin-left: -100%;margin-top: -100%;border-radius: 176px;background-color: #ad2417;animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;}
Please do not entering spam link in the comment box ConversionConversion EmoticonEmoticon