Cool CSS Sliding Animation Effect

In this tutorial we will see how to create a Cool CSS Sliding Animation Effect. Simple HTML and CSS is used for this purpose, complete code is given.

HTML Code

Take a look at the HTML code given below.

<!DOCTYPE html>
<html>
    <head>
        <title>climbing cube animation effect </title>
        <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>
        <div class="container">
            <div class="box">
                <div class="cube"></div>
            </div>
        </div>
    </body>
</html>

CSS Code

CSS code is given below.

<style>
*
{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #000;
    overflow: hidden;
}
.container{
    position: relative;
    width: 100%;
    transform: rotate(-35deg);
}
.container .box{
    display: flex;
    position: relative;
    left: -200px;
    justify-content: center;
    align-items: center;
    width: calc(100% + 400px);
    -webkit-box-reflect: below 1px linear-gradient(transparent, #0004);
    animation: animateSurface 1.5s ease-in-out infinite;

}
@keyframes animateSurface {
    0% {
        transform: translateX(0px);
    }
    100%{
        transform: translateX(-200px);
    }
}
.container .box .cube{
    position: relative;
    width: 200px;
    height: 200px;
    background: hsl(64, 98%, 48%);
    box-shadow: 0 0 5px rgb(244, 244, 3),
    0 0 25px rgb(244, 224, 3),
    0 0 50px rgb(224, 244, 3),
    0 0 100px rgb(244, 228, 3),
    0 0 200px rgba(244, 220, 3, 0.5),
    0 0 300px rgba(244, 244, 3, 0.5);
    transform-origin: bottom right;
    animation: animate 1.5s ease-in-out infinite;
}
@keyframes animate{
    0% {
        transform: rotate(0deg);
    }
    60% {
        transform: rotate(90deg);
        
    }
    65% {
        transform: rotate(85deg);
        
    }
    70% {
        transform: rotate(90deg);
        
    }
    75% {
        transform: rotate(85.5deg);
        
    }
    80%, 100% {
        transform: rotate(90deg);
        
    }
}
</style>           

Video Tutorial

Watch our video tutorial on How To Create Cool CSS Sliding Animation Effect.