Building a Cube Wheel Loader Animation Using HTML and CSS

Building a Cube Wheel Loader Animation Using HTML and CSS

Are you ready to embark on a thrilling coding adventure? Strap in as we dive into the mesmerizing world of front-end development with an exciting project: the Animated Cube Wheel Loader! This project, part of Day 35 in the #100DaysOfCode Challenge, will not only enhance your coding skills but also leave you captivated by the beauty of animation.

Step 1: Setting the Stage

Before we delve into the intricacies of code, let's understand the structure of our project. We'll begin with the HTML markup. This sets the foundation for our animated cube wheel loader. Here's a snippet of the HTML code:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="#" type="image/x-icon">
    <link rel="stylesheet" href="style.css">
    <title>Animated Cube Wheel Loader</title>
</head>

<body>
    <div class='assembly'>
        <div class='wheel'>
            <div class='rotor'>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
            </div>
        </div>
        <div class='wheel'>
            <div class='rotor'>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
                <div class='cube'>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                    <div class='cube__face'></div>
                </div>
            </div>
        </div>
    </div>

</body>

</html>

In this snippet, we've defined the basic structure of our HTML document. It includes the necessary meta tags and a body section where our animated cube wheel loader will be displayed.

Step 2: Styling the Magic

Now, let's add some magic to our project with CSS. We'll style our cubes, wheels, and animations to create a visually stunning experience. Here's a glimpse of the CSS code:

body {
    overflow: hidden;
    margin: 0;
    height: 100vh;
    perspective: 64em;
    perspective-origin: calc(50% + 5em) calc(50% - 5em);
background-image: linear-gradient(to top, #a8edea 0%, #fed6e3 100%);
}

div,
:before,
:after {
    position: absolute;
    transform-style: preserve-3d;
}

.assembly {
    top: 50%;
    left: 50%;
    transform: rotateX(-15deg) rotateY(45deg);
    font-size: 2vmin;
}

.wheel:nth-child(1) {
    transform: translate(6.38157em);
}

.wheel:nth-child(1)>* {
    animation-direction: reverse;
}

.wheel:nth-child(1) .cube__face:nth-child(1):after {
    opacity: 0.8;
    background: #d9d9d9;
}

.wheel:nth-child(1) .cube__face:nth-child(2):after {
    opacity: 0.9;
    background: #dfdfdf;
}

.wheel:nth-child(1) .cube__face:nth-child(3):after {
    opacity: 0.8;
    background: #ccc;
}

.wheel:nth-child(1) .cube__face:nth-child(4):after {
    opacity: 0.9;
    background: #bbb;
}

.wheel:nth-child(1) .cube__face:nth-child(5):after {
    opacity: 0.9;
    background: #e5e5e5;
}

.wheel:nth-child(1) .cube:nth-child(1) :nth-child(1):after {
    animation-delay: -4s;
}

.wheel:nth-child(1) .cube:nth-child(1) :nth-child(2):after {
    animation-delay: -8s;
}

.wheel:nth-child(1) .cube:nth-child(1) :nth-child(3):after {
    animation-delay: -2s;
}

.wheel:nth-child(1) .cube:nth-child(1) :nth-child(4):after {
    animation-delay: -3s;
}

.wheel:nth-child(1) .cube:nth-child(1) :nth-child(5):after {
    animation-delay: -3s;
}

.wheel:nth-child(1) .cube:nth-child(2) :nth-child(1):after {
    animation-delay: -4.83333s;
}

.wheel:nth-child(1) .cube:nth-child(2) :nth-child(2):after {
    animation-delay: -8.83333s;
}

.wheel:nth-child(1) .cube:nth-child(2) :nth-child(3):after {
    animation-delay: -2.83333s;
}

.wheel:nth-child(1) .cube:nth-child(2) :nth-child(4):after {
    animation-delay: -3.83333s;
}

.wheel:nth-child(1) .cube:nth-child(2) :nth-child(5):after {
    animation-delay: -3.83333s;
}

.wheel:nth-child(1) .cube:nth-child(3) :nth-child(1):after {
    animation-delay: -5.66667s;
}

.wheel:nth-child(1) .cube:nth-child(3) :nth-child(2):after {
    animation-delay: -9.66667s;
}

.wheel:nth-child(1) .cube:nth-child(3) :nth-child(3):after {
    animation-delay: -3.66667s;
}

.wheel:nth-child(1) .cube:nth-child(3) :nth-child(4):after {
    animation-delay: -4.66667s;
}

.wheel:nth-child(1) .cube:nth-child(3) :nth-child(5):after {
    animation-delay: -4.66667s;
}

.wheel:nth-child(1) .cube:nth-child(4) :nth-child(1):after {
    animation-delay: -6.5s;
}

.wheel:nth-child(1) .cube:nth-child(4) :nth-child(2):after {
    animation-delay: -10.5s;
}

.wheel:nth-child(1) .cube:nth-child(4) :nth-child(3):after {
    animation-delay: -4.5s;
}

.wheel:nth-child(1) .cube:nth-child(4) :nth-child(4):after {
    animation-delay: -5.5s;
}

.wheel:nth-child(1) .cube:nth-child(4) :nth-child(5):after {
    animation-delay: -5.5s;
}

.wheel:nth-child(1) .cube:nth-child(5) :nth-child(1):after {
    animation-delay: -7.33333s;
}

.wheel:nth-child(1) .cube:nth-child(5) :nth-child(2):after {
    animation-delay: -11.33333s;
}

.wheel:nth-child(1) .cube:nth-child(5) :nth-child(3):after {
    animation-delay: -5.33333s;
}

.wheel:nth-child(1) .cube:nth-child(5) :nth-child(4):after {
    animation-delay: -6.33333s;
}

.wheel:nth-child(1) .cube:nth-child(5) :nth-child(5):after {
    animation-delay: -6.33333s;
}

.wheel:nth-child(1) .cube:nth-child(6) :nth-child(1):after {
    animation-delay: -8.16667s;
}

.wheel:nth-child(1) .cube:nth-child(6) :nth-child(2):after {
    animation-delay: -12.16667s;
}

.wheel:nth-child(1) .cube:nth-child(6) :nth-child(3):after {
    animation-delay: -6.16667s;
}

.wheel:nth-child(1) .cube:nth-child(6) :nth-child(4):after {
    animation-delay: -7.16667s;
}

.wheel:nth-child(1) .cube:nth-child(6) :nth-child(5):after {
    animation-delay: -7.16667s;
}

.wheel:nth-child(1) .cube:nth-child(7) :nth-child(1):after {
    animation-delay: -9s;
}

.wheel:nth-child(1) .cube:nth-child(7) :nth-child(2):after {
    animation-delay: -13s;
}

.wheel:nth-child(1) .cube:nth-child(7) :nth-child(3):after {
    animation-delay: -7s;
}

.wheel:nth-child(1) .cube:nth-child(7) :nth-child(4):after {
    animation-delay: -8s;
}

.wheel:nth-child(1) .cube:nth-child(7) :nth-child(5):after {
    animation-delay: -8s;
}

.wheel:nth-child(1) .cube:nth-child(8) :nth-child(1):after {
    animation-delay: -9.83333s;
}

.wheel:nth-child(1) .cube:nth-child(8) :nth-child(2):after {
    animation-delay: -13.83333s;
}

.wheel:nth-child(1) .cube:nth-child(8) :nth-child(3):after {
    animation-delay: -7.83333s;
}

.wheel:nth-child(1) .cube:nth-child(8) :nth-child(4):after {
    animation-delay: -8.83333s;
}

.wheel:nth-child(1) .cube:nth-child(8) :nth-child(5):after {
    animation-delay: -8.83333s;
}

.wheel:nth-child(1) .cube:nth-child(9) :nth-child(1):after {
    animation-delay: -10.66667s;
}

.wheel:nth-child(1) .cube:nth-child(9) :nth-child(2):after {
    animation-delay: -14.66667s;
}

.wheel:nth-child(1) .cube:nth-child(9) :nth-child(3):after {
    animation-delay: -8.66667s;
}

.wheel:nth-child(1) .cube:nth-child(9) :nth-child(4):after {
    animation-delay: -9.66667s;
}

.wheel:nth-child(1) .cube:nth-child(9) :nth-child(5):after {
    animation-delay: -9.66667s;
}

.wheel:nth-child(1) .cube:nth-child(10) :nth-child(1):after {
    animation-delay: -11.5s;
}

.wheel:nth-child(1) .cube:nth-child(10) :nth-child(2):after {
    animation-delay: -15.5s;
}

.wheel:nth-child(1) .cube:nth-child(10) :nth-child(3):after {
    animation-delay: -9.5s;
}

.wheel:nth-child(1) .cube:nth-child(10) :nth-child(4):after {
    animation-delay: -10.5s;
}

.wheel:nth-child(1) .cube:nth-child(10) :nth-child(5):after {
    animation-delay: -10.5s;
}

.wheel:nth-child(1) .cube:nth-child(11) :nth-child(1):after {
    animation-delay: -12.33333s;
}

.wheel:nth-child(1) .cube:nth-child(11) :nth-child(2):after {
    animation-delay: -16.33333s;
}

.wheel:nth-child(1) .cube:nth-child(11) :nth-child(3):after {
    animation-delay: -10.33333s;
}

.wheel:nth-child(1) .cube:nth-child(11) :nth-child(4):after {
    animation-delay: -11.33333s;
}

.wheel:nth-child(1) .cube:nth-child(11) :nth-child(5):after {
    animation-delay: -11.33333s;
}

.wheel:nth-child(1) .cube:nth-child(12) :nth-child(1):after {
    animation-delay: -13.16667s;
}

.wheel:nth-child(1) .cube:nth-child(12) :nth-child(2):after {
    animation-delay: -17.16667s;
}

.wheel:nth-child(1) .cube:nth-child(12) :nth-child(3):after {
    animation-delay: -11.16667s;
}

.wheel:nth-child(1) .cube:nth-child(12) :nth-child(4):after {
    animation-delay: -12.16667s;
}

.wheel:nth-child(1) .cube:nth-child(12) :nth-child(5):after {
    animation-delay: -12.16667s;
}

.wheel:nth-child(2) {
    transform: translate(-6.38157em) rotateX(-90deg);
}

.wheel:nth-child(2) .cube__face:nth-child(1):after {
    opacity: 1;
    background: #d6d6d6;
}

.wheel:nth-child(2) .cube__face:nth-child(2):after {
    opacity: 0.8;
    background: #dfdfdf;
}

.wheel:nth-child(2) .cube__face:nth-child(3):after {
    opacity: 1;
    background: #bbb;
}

.wheel:nth-child(2) .cube__face:nth-child(4):after {
    opacity: 0.8;
    background: #ccc;
}

.wheel:nth-child(2) .cube__face:nth-child(5):after {
    opacity: 0.9;
    background: #e3e3e3;
}

.wheel:nth-child(2) .cube:nth-child(1) :nth-child(1):after {
    animation-delay: -11s;
}

.wheel:nth-child(2) .cube:nth-child(1) :nth-child(2):after {
    animation-delay: -12s;
}

.wheel:nth-child(2) .cube:nth-child(1) :nth-child(3):after {
    animation-delay: -13s;
}

.wheel:nth-child(2) .cube:nth-child(1) :nth-child(4):after {
    animation-delay: -13s;
}

.wheel:nth-child(2) .cube:nth-child(1) :nth-child(5):after {
    animation-delay: -12s;
}

.wheel:nth-child(2) .cube:nth-child(2) :nth-child(1):after {
    animation-delay: -10.16667s;
}

.wheel:nth-child(2) .cube:nth-child(2) :nth-child(2):after {
    animation-delay: -11.16667s;
}

.wheel:nth-child(2) .cube:nth-child(2) :nth-child(3):after {
    animation-delay: -12.16667s;
}

.wheel:nth-child(2) .cube:nth-child(2) :nth-child(4):after {
    animation-delay: -12.16667s;
}

.wheel:nth-child(2) .cube:nth-child(2) :nth-child(5):after {
    animation-delay: -11.16667s;
}

.wheel:nth-child(2) .cube:nth-child(3) :nth-child(1):after {
    animation-delay: -9.33333s;
}

.wheel:nth-child(2) .cube:nth-child(3) :nth-child(2):after {
    animation-delay: -10.33333s;
}

.wheel:nth-child(2) .cube:nth-child(3) :nth-child(3):after {
    animation-delay: -11.33333s;
}

.wheel:nth-child(2) .cube:nth-child(3) :nth-child(4):after {
    animation-delay: -11.33333s;
}

.wheel:nth-child(2) .cube:nth-child(3) :nth-child(5):after {
    animation-delay: -10.33333s;
}

.wheel:nth-child(2) .cube:nth-child(4) :nth-child(1):after {
    animation-delay: -8.5s;
}

.wheel:nth-child(2) .cube:nth-child(4) :nth-child(2):after {
    animation-delay: -9.5s;
}

.wheel:nth-child(2) .cube:nth-child(4) :nth-child(3):after {
    animation-delay: -10.5s;
}

.wheel:nth-child(2) .cube:nth-child(4) :nth-child(4):after {
    animation-delay: -10.5s;
}

.wheel:nth-child(2) .cube:nth-child(4) :nth-child(5):after {
    animation-delay: -9.5s;
}

.wheel:nth-child(2) .cube:nth-child(5) :nth-child(1):after {
    animation-delay: -7.66667s;
}

.wheel:nth-child(2) .cube:nth-child(5) :nth-child(2):after {
    animation-delay: -8.66667s;
}

.wheel:nth-child(2) .cube:nth-child(5) :nth-child(3):after {
    animation-delay: -9.66667s;
}

.wheel:nth-child(2) .cube:nth-child(5) :nth-child(4):after {
    animation-delay: -9.66667s;
}

.wheel:nth-child(2) .cube:nth-child(5) :nth-child(5):after {
    animation-delay: -8.66667s;
}

.wheel:nth-child(2) .cube:nth-child(6) :nth-child(1):after {
    animation-delay: -6.83333s;
}

.wheel:nth-child(2) .cube:nth-child(6) :nth-child(2):after {
    animation-delay: -7.83333s;
}

.wheel:nth-child(2) .cube:nth-child(6) :nth-child(3):after {
    animation-delay: -8.83333s;
}

.wheel:nth-child(2) .cube:nth-child(6) :nth-child(4):after {
    animation-delay: -8.83333s;
}

.wheel:nth-child(2) .cube:nth-child(6) :nth-child(5):after {
    animation-delay: -7.83333s;
}

.wheel:nth-child(2) .cube:nth-child(7) :nth-child(1):after {
    animation-delay: -6s;
}

.wheel:nth-child(2) .cube:nth-child(7) :nth-child(2):after {
    animation-delay: -7s;
}

.wheel:nth-child(2) .cube:nth-child(7) :nth-child(3):after {
    animation-delay: -8s;
}

.wheel:nth-child(2) .cube:nth-child(7) :nth-child(4):after {
    animation-delay: -8s;
}

.wheel:nth-child(2) .cube:nth-child(7) :nth-child(5):after {
    animation-delay: -7s;
}

.wheel:nth-child(2) .cube:nth-child(8) :nth-child(1):after {
    animation-delay: -5.16667s;
}

.wheel:nth-child(2) .cube:nth-child(8) :nth-child(2):after {
    animation-delay: -6.16667s;
}

.wheel:nth-child(2) .cube:nth-child(8) :nth-child(3):after {
    animation-delay: -7.16667s;
}

.wheel:nth-child(2) .cube:nth-child(8) :nth-child(4):after {
    animation-delay: -7.16667s;
}

.wheel:nth-child(2) .cube:nth-child(8) :nth-child(5):after {
    animation-delay: -6.16667s;
}

.wheel:nth-child(2) .cube:nth-child(9) :nth-child(1):after {
    animation-delay: -4.33333s;
}

.wheel:nth-child(2) .cube:nth-child(9) :nth-child(2):after {
    animation-delay: -5.33333s;
}

.wheel:nth-child(2) .cube:nth-child(9) :nth-child(3):after {
    animation-delay: -6.33333s;
}

.wheel:nth-child(2) .cube:nth-child(9) :nth-child(4):after {
    animation-delay: -6.33333s;
}

.wheel:nth-child(2) .cube:nth-child(9) :nth-child(5):after {
    animation-delay: -5.33333s;
}

.wheel:nth-child(2) .cube:nth-child(10) :nth-child(1):after {
    animation-delay: -3.5s;
}

.wheel:nth-child(2) .cube:nth-child(10) :nth-child(2):after {
    animation-delay: -4.5s;
}

.wheel:nth-child(2) .cube:nth-child(10) :nth-child(3):after {
    animation-delay: -5.5s;
}

.wheel:nth-child(2) .cube:nth-child(10) :nth-child(4):after {
    animation-delay: -5.5s;
}

.wheel:nth-child(2) .cube:nth-child(10) :nth-child(5):after {
    animation-delay: -4.5s;
}

.wheel:nth-child(2) .cube:nth-child(11) :nth-child(1):after {
    animation-delay: -2.66667s;
}

.wheel:nth-child(2) .cube:nth-child(11) :nth-child(2):after {
    animation-delay: -3.66667s;
}

.wheel:nth-child(2) .cube:nth-child(11) :nth-child(3):after {
    animation-delay: -4.66667s;
}

.wheel:nth-child(2) .cube:nth-child(11) :nth-child(4):after {
    animation-delay: -4.66667s;
}

.wheel:nth-child(2) .cube:nth-child(11) :nth-child(5):after {
    animation-delay: -3.66667s;
}

.wheel:nth-child(2) .cube:nth-child(12) :nth-child(1):after {
    animation-delay: -1.83333s;
}

.wheel:nth-child(2) .cube:nth-child(12) :nth-child(2):after {
    animation-delay: -2.83333s;
}

.wheel:nth-child(2) .cube:nth-child(12) :nth-child(3):after {
    animation-delay: -3.83333s;
}

.wheel:nth-child(2) .cube:nth-child(12) :nth-child(4):after {
    animation-delay: -3.83333s;
}

.wheel:nth-child(2) .cube:nth-child(12) :nth-child(5):after {
    animation-delay: -2.83333s;
}

.rotor {
    animation: r 10s linear infinite;
}

.cube:nth-child(1) {
    transform: rotateY(0deg) translateZ(12.76314em);
}

.cube:nth-child(2) {
    transform: rotateY(30deg) translateZ(12.76314em);
}

.cube:nth-child(3) {
    transform: rotateY(60deg) translateZ(12.76314em);
}

.cube:nth-child(4) {
    transform: rotateY(90deg) translateZ(12.76314em);
}

.cube:nth-child(5) {
    transform: rotateY(120deg) translateZ(12.76314em);
}

.cube:nth-child(6) {
    transform: rotateY(150deg) translateZ(12.76314em);
}

.cube:nth-child(7) {
    transform: rotateY(180deg) translateZ(12.76314em);
}

.cube:nth-child(8) {
    transform: rotateY(210deg) translateZ(12.76314em);
}

.cube:nth-child(9) {
    transform: rotateY(240deg) translateZ(12.76314em);
}

.cube:nth-child(10) {
    transform: rotateY(270deg) translateZ(12.76314em);
}

.cube:nth-child(11) {
    transform: rotateY(300deg) translateZ(12.76314em);
}

.cube:nth-child(12) {
    transform: rotateY(330deg) translateZ(12.76314em);
}

.cube__face {
    margin: -2.5em;
    width: 5em;
    height: 5em;
    backface-visibility: hidden;
    box-shadow: 0 0 1px #eee;
    background: #fafafa;
    border: 1px solid #c2c0c0; /* optional */
}

.cube__face:nth-child(-n + 4) {
    background: linear-gradient(#ffffff, #dddddd);
}

.cube__face:nth-child(1) {
    transform: rotateY(0deg) translateZ(2.5em);
}

.cube__face:nth-child(2) {
    transform: rotateY(90deg) translateZ(2.5em);
}

.cube__face:nth-child(3) {
    transform: rotateY(180deg) translateZ(2.5em);
}

.cube__face:nth-child(4) {
    transform: rotateY(270deg) translateZ(2.5em);
}

.cube__face:nth-child(5) {
    transform: rotateX(90deg) translateZ(2.5em);
}

.cube__face:before,
.cube__face:after {
    width: inherit;
    height: inherit;
    animation: a 5s ease-in-out infinite alternate;
    content: '';
}

This CSS snippet sets the stage for our animated cube wheel loader. We define styles for the body, assembly, wheels, cubes, and cube faces, ensuring each element contributes to the overall visual appeal.

Step 3: Adding Animation

The heart of our project lies in its animation. We'll use keyframes to breathe life into our cubes, making them spin and dance with elegance. Here's how we define animation in CSS:

@keyframes r {
    0% {
        transform: rotateY(1turn);
    }
}

@keyframes a {
    to {
        opacity: .2;
    }
}

These keyframes define the rotation and opacity animations that bring our cube wheel loader to life. By strategically applying these animations to our elements, we achieve a mesmerizing visual effect.

Step 4: Bringing It All Together

With our HTML structure in place and CSS styles defined, it's time to witness the magic unfold. As you integrate the HTML and CSS code, you'll see the animated cube wheel loader come to life before your eyes.

Step 5: Conclusion

Congratulations! You've successfully completed Day 35 of the #100DaysOfCode Challenge by creating a captivating animated cube wheel loader. Through HTML, CSS, and animation, you've not only honed your coding skills but also unleashed your creativity.

Download the Full Source Code

Ready to dive deeper into the code? Download the full source code from the link below and explore the project at your own pace:

Download Source Code

Connect with Me

Have questions or want to share your experience with this project? Reach out to me via my website:

Contact Me

Start your coding journey today and stay tuned for more exciting projects in the #100DaysOfCode Challenge!

Did you find this article valuable?

Support Aarzoo by becoming a sponsor. Any amount is appreciated!