Bouncing Bubbles
by amindunited
HTML
<div class="anim-container">
<div class="ball" id="ball_1"></div>
<div class="ball" id="ball_2"></div>
<div class="ball" id="ball_3"></div>
<div class="ball" id="ball_4"></div>
<div class="ball" id="ball_5"></div>
<div class="ball" id="ball_6"></div>
</div>
CSS
.anim-container {
position: relative;
width: 100vw;
height: 100vh;
background-color: rgba(0,0,0,.5);
}
.ball {
border-radius: 50%;
background-color: rgba(127, 0, 0, .5);
width: 25px;
height: 25px;
position: absolute;
top: 0
left: 0;
animation: Bounce 5s infinite;
animation-direction: alternate;
animation-timing-function: ease-in-out;
animation-delay: 250ms;
}
@media screen and (prefers-reduced-motion) {
.ball {
animation: none;
}
}
#ball_1 {
background-color: rgba(127, 0, 0, .5);
left: 60px;
animation-delay: 250ms;
}
#ball_2 {
background-color: rgba(127, 0, 0, .5);
left: 110px;
animation-delay: 1250ms;
}
#ball_3 {
background-color: rgba(127, 0, 0, .5);
left: 170px;
animation-delay: 450ms;
}
#ball_4 {
background-color: rgba(127, 0, 0, .5);
left: 230px;
animation-delay: 750ms;
}
#ball_5 {
background-color: rgba(127, 0, 0, .5);
left: 290px;
animation-delay: 50ms;
}
#ball_6 {
background-color: rgba(127, 0, 0, .5);
left: 320px;
animation-delay: 2250ms;
}
@keyframes Bounce {
0% { opacity: 0; top: 0; }
100% { opacity: 1; top: 100vh; }
}