<div class="loading">
  <div class="cube cube1"></div>
  <div class="cube cube2"></div>
  <div class="cube cube4"></div>
  <div class="cube cube3"></div>
</div>

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000c18;
}
.loading {
    width: 100px;
    height: 100px;
    position: relative;
    transform: rotateZ(45deg);
}
.loading .cube {
    float: left;
    width: 50%;
    height: 50%;
    position: relative;
    transform: scale(1.1);
}
.loading .cube::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #00a6bc;
    animation: fold 2.4s infinite linear both;
    transform-origin: 100% 100%;
}
@keyframes fold {
    0%, 10% {
        transform: perspective(140px) rotateX(-180deg);
        opacity: 0;
    }
    25%, 75% {
        transform: perspective(140px) rotateX(0deg);
        opacity: 1;
    }
    90%, 100% {
        transform: perspective(140px) rotateY(180deg);
        opacity: 0;
    }
}
.loading .cube2 {
    transform: scale(1.1) rotateZ(90deg);
}
.loading .cube3 {
    transform: scale(1.1) rotateZ(180deg);
}
.loading .cube4 {
    transform: scale(1.1) rotateZ(270deg);
}
.loading .cube2::before {
    animation-delay: 0.3s;
}
.loading .cube3::before {
    animation-delay: 0.6s;
}
.loading .cube4::before {
    animation-delay: 0.9s;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.