Currently, I have a circular div
that has been styled using CSS animations. My goal is to keep the size of the circle consistent when it moves to the bottom, but reduce its size when it bounces back to the top. I am uncertain if this can be achieved solely with CSS or if I will need to involve JS. Can anyone provide a solution or guidance on the best approach?
Thank you in advance.
HTML:
<div class="hello"></div>
CSS:
.hello{
width:100px;
height:100px;
border:5px solid black;
border-radius:55px;
}
div {
width: 100px;
height: 100px;
background-color: red;
position: relative;
-webkit-animation-name: example;
-webkit-animation-duration: 4s;
animation-name: example;
animation-duration: 4s;
}
@keyframes example {
0% {background-color:red; left:0px; top:0px;}
75% {background-color:green; left:0px; top:200px;}
100% {background-color:red; left:0px; top:0px;}
}