Bouncing Ball Animation Tutorial

The Bouncing Ball Effect gif
Bouncing Ball Animation gif

Learn how to create Bouncing Ball Animation using only HTML and CSS.

Watch the Bouncing Ball animation tutorial video here-




The VS Code extensions used in this video are Live Server and Prettier.

HTML Source Code-

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>bouncing ball effect</title>
    <link rel="stylesheet" href="./style.css">
</head>
<body>
    <div class="box">
        <div class="ball"></div>
    </div>
</body>
</html>

Download HTML source file

CSS Source Code-

*{
    padding:0px;
    margin0px;
    background-colorrgb(656565);
}

.box{
    positionabsolute;
    width400px;
    height500px;
    background-colorrgb(110218110);
    left50%;
    top50%;
    transformtranslate(-50%,-50%);
}

.ball{
    positionrelative;
    width70px;
    height70px;
    border-radius50%;
    backgroundlinear-gradient(to rightrgb(235110172),rgb(2353562));
    marginauto;
    animation: bounce 1.3s infinite;
}

@keyframes bounce{
    0%{
        width70px;
        height70px;
    }
    30%{
        width60px;
        height70px;
    }
    50%{
        width77px;
        height50px;
        transformtranslateY(452px);
        box-shadow20px 10px 10px black;
    }
    75%{
        width77px;
        height70px;
    }
    100%{
        transformtranslateY(0px);
    }
}

Download CSS source file

Post a Comment

0 Comments