Ball Bounce

by VisheshBansal

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta author="Vishesh Bansal">
    <link rel="stylesheet" href="ballmovement.css">
</head>
<body>
<div class="ball-bounce"></div>
</body>
</html>

CSS

/* Ball bouncing animations */
.ball-bounce {
    position: absolute;
    width: 80px;
    height: 80px;
    align-self: center;
    border-radius: 100%;
    animation: bounce 1s;
    transform: translateY(0px);
    animation-iteration-count: infinite;
    margin: 50px;
    background: -webkit-radial-gradient(25px 25px, circle, red, #000);
    background: -moz-radial-gradient(25px 25px, circle, red, #000);
    background: radial-gradient(25px 25px, circle, red, #000);
}


@keyframes bounce {
    0% {
        top: 0;
        -webkit-animation-timing-function: ease-in;
    }
    40% {
    }
    50% {
        top: 140px;
        height: 80px;
        -webkit-animation-timing-function: ease-out;
    }
    55% {
        top: 160px;
        height: 70px;
        -webkit-animation-timing-function: ease-in;
    }
    65% {
        top: 120px;
        height: 70px;
        -webkit-animation-timing-function: ease-out;
    }
    95% {
        top: 0;
        -webkit-animation-timing-function: ease-in;
    }
    100% {
        top: 0;
        -webkit-animation-timing-function: ease-in;
    }
}