Is there a way to create a continuous raining effect for my weather app using CSS only? I have achieved a satisfactory look, but the rain effects seem to only cover random chunks of the screen rather than the entire screen. How can I make it cover the entire screen consistently?
body {
overflow: hidden;
}
#background {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#background.night {
background: linear-gradient(#0F2129, #47334A);
}
#background>.cloud {
width: 900px;
height: 900px;
position: absolute;
background-color: #fff;
border-radius: 50%;
animation: cloud 10s infinite alternate;
}
#background.rain>.cloud {
opacity: .5;
}
#background>.cloud:nth-child(even) {
animation-delay: 3s;
}
#background.night>.cloud {
background-color: grey;
}
#background.rain>.cloud:before,
#background.rain>.cloud:after {
animation: rain 1s infinite linear;
content: '';
border-radius: 50%;
display: block;
height: 6px;
width: 3px;
opacity: 1;
margin-top: 700px;
}
#background.rain>.cloud:after {
transform: translate(50px);
}
#background.rain>.cloud:nth-child(even):before,
#background.rain>.cloud:nth-child(even):after {
animation-delay: .3s;
}
@keyframes rain {
0% {
box-shadow: #cccccc 30px 30px, #cccccc 40px 40px, #cccccc 50px 75px, #cccccc 55px 50px, #cccccc 70px 100px, #cccccc 80px 95px, #cccccc 110px 45px, #cccccc 75px 50px, #cccccc 80px 20px, #cccccc 65px 40px, #cccccc 100px 80px, #cccccc 45px 85px, #cccccc 95px 50px, #cccccc 90px 35px;
}
100% {
box-shadow: #cccccc 30px 970px, #cccccc 40px 980px, #cccccc 50px 945px, #cccccc 55px 980px, #cccccc 70px 960px, #cccccc 80px 945px, #cccccc 110px 995px, #cccccc 75px 950px, #cccccc 80px 920px, #cccccc 65px 940px, #cccccc 100px 980px, #cccccc 45px 985px, #cccccc 95px 950px, #cccccc 90px 985px;
}
}
@keyframes cloud {
100% {
transform: translate(-50px) scale(1.05);
}
}
<div id="background" class="rain night">
<div class="cloud" style="top: -797.689px; left: -315px;"></div>
<div class="cloud" style="top: -865.689px; left: -225px;"></div>
<div class="cloud" style="top: -814.689px; left: -65px;"></div>
<div class="cloud" style="top: -853.689px; left: 253px;"></div>
<div class="cloud" style="top: -823.689px; left: 23px;"></div>
<div class="cloud" style="top: -843.689px; left: 109px;"></div>
</div>