Create Jumping Rings using css| Spring Action

Span is a tag that has no inbuilt properties but is powerful because it can work as any tag in HTML including the input tag. Here I created a jumping rings of circle using the span tag. I think here i used 14 span tags used to make 14 concentric circles. By making the box-sizing property to border-box makes the box size flexible (auto width and height).Note that the positionz need a 3d platform for proper jumping of the circles. So we create a property as follows

transform: perspective(500px) rotatex(60deg);

Here I also implemented the property rotatex to rotate the X-axis of the circle containing box.


LIVE PREVIEW:








See how the circles are jumping. To look the circle like jumping like a spring, I set a delay in time of the animations that I applied to the circle.

Here is the code of the jumping concentric circles.


CODE:


<html>
<head>
<style>
.box
{
width:270px;
height:270px;
position:relative;
transform-style:preserve-3d;
transform: perspective(500px) rotatex(60deg);
}
.box span
{
display:block;
position:absolute;
box-sizing:border-box;
border-radius:50%;
border:4px solid black;
box-shadow:0 5px 0 #888888,
           inset 0 5px 0 #888888;
box-sizing:border-box;
animation:animate 3s ease-in-out infinite;
}
.box span:nth-child(1)
{
top:0px;
left:0px;
right:0px;
bottom:0px;
animation-delay:1.3s;
}
.box span:nth-child(2)
{
top:10px;
left:10px;
right:10px;
bottom:10px;
animation-delay:1.2s;
}
.box span:nth-child(3)
{
top:20px;
left:20px;
right:20px;
bottom:20px;
animation-delay:1.1s;
}
.box span:nth-child(4)
{
top:30px;
left:30px;
right:30px;
bottom:30px;
animation-delay:1s;
}
.box span:nth-child(5)
{
top:40px;
left:40px;
right:40px;
bottom:40px;
animation-delay:.9s;
}

.box span:nth-child(6)
{
top:50px;
left:50px;
right:50px;
bottom:50px;
animation-delay:0.8s;
}

.box span:nth-child(7)
{
top:60px;
left:60px;
right:60px;
bottom:60px;
animation-delay:0.7s;
}
.box span:nth-child(8)
{
top:70px;
left:70px;
right:70px;
bottom:70px;
animation-delay:0.6s;
}
.box span:nth-child(9)
{
top:80px;
left:80px;
right:80px;
bottom:80px;
animation-delay:0.5s;
}
.box span:nth-child(10)
{
top:90px;
left:90px;
right:90px;
bottom:90px;
animation-delay:0.4s;
}
.box span:nth-child(11)
{
top:100px;
left:100px;
right:100px;
bottom:100px;
animation-delay:0.3s;
}
.box span:nth-child(12)
{
top:110px;
left:110px;
right:110px;
bottom:110px;
animation-delay:0.2s;
}
.box span:nth-child(13)
{
top:120px;
left:120px;
right:120px;
bottom:120px;
animation-delay:0.1s;
}
.box span:nth-child(14)
{
top:130px;
left:130px;
right:130px;
bottom:130px;
animation-delay:0s;
}
@keyframes animate
{
100%,0%
{
transform: translateZ(-100px);
}
50%
{
transform: translateZ(100px);
}
}
</style>
</head>
<body>
<center>
<div class=box>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</center>
</div> </body>
</html>
Execute

Comments

Popular posts from this blog

Node.js Cheat Sheet

Codeigniter ! Simple But Powerful

Introducing Cloudflare Pages ⚡