прыгающий мячик
by Ksenia Polyakova
HTML
<div class="box">
<div class="ball"></div>
</div>
CSS
@keyframes shadow {
100% {
transform: scale(1.5, 0.5);
}
}
@keyframes ball {
0% {
transform: translateY(0);
}
70% {
width: 50px;
height: 50px;
}
100% {
transform: translateY(150px);
width: 60px;
height: 40px;
}
}
.box {
height: 200px;
width: 100px;
text-align: center;
position: relative;
}
.ball, .box::before {
animation-duration: 1s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-in;
width: 50px;
height: 50px;
border-radius: 50%;
}
.ball {
display: inline-block;
animation-name: ball;
background-color: white;
box-shadow: inset 0 -10px 20px 12px lime, inset 0 0 3px 3px green;
}
.box::before {
position: absolute;
bottom: 0;
left: 25px;
animation-name: shadow;
content: '';
display: block;
background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0) 50%);
transform: scale(2.5, 0.5);
}
/* <сдвиг по x> <сдвиг по y> <размытие> <растяжение> <цвет> */