Create Ring Animation with html css
Source codes:
<!DOCTYPE html>
<html>
<head>
<title>Ring Animation</title>
<style type=”text/css”>
body{
margin: 0;
padding: 0;
display: flex;
background: linear-gradient(45deg, #FFC107, #4CAF50,
#3F51B5, #009688);
justify-content: center;
align-items: center;
min-height: 100vh;
}
div{
display: flex;
position: relative;
width: 180px;
height: 180px;
justify-content: center;
position: absolute;
transform: perspective(500px) rotateX(45deg);
transform-style: preserve-3d;
}
div span{
box-shadow: 0 10px #9999ff, inset 0 10px 0 #9999ff;
border-radius: 50%;
box-sizing: border-box;
border: 15px solid #000;
animation: a 4.5s linear infinite;
position: absolute;
display: block;
}
div span:nth-child(1){
animation-delay: 0s;
}
div span:nth-child(2){
animation-delay: 1.5s;
}
div span:nth-child(3){
animation-delay: 3s;
}
@keyframes a{
0%{
transform: translateZ(-100px);
width: 100%;
height: 100%;
}
25%{
transform: translateZ(100px);
width: 100%;
height: 100%;
}
50%{
transform: translateZ(100px);
}
75%{
transform: translateZ(-100px);
width: 35%;
height: 35%;
}
100%{
transform: translateZ(-100px);
width: 100%;
height: 100%;
}
}
</style>
</head>
<body>
<div>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html