3d loader

by tomik23

HTML

<div class="loader">
  <span></span>
  <span></span>
  <span></span>
</div>

CSS

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html {
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: linear-gradient(to left bottom, #051937, #004d7a, #008793, #00bf72, #a8eb12);
}

/*loader style*/
.loader {
  position: relative;
  height: 200px;
  width: 200px;
  justify-content: center;
  display: flex;
  align-items: center;
  transform-style: preserve-3d;
  transform: perspective(500px) rotateX(45deg);
}

.loader span {
  position: absolute;
  border: 10px solid #04f7df;
  border-radius: 50%;
  box-shadow: 0 10px 0 #007e80, inset 0 10px #007e80;
  animation: animate 3s ease-in-out infinite;
}

.loader span:nth-child(1) {
  animation-delay: 1s;
}

.loader span:nth-child(2) {
  animation-delay: 2s;
}

.loader span:nth-child(3) {
  animation-delay: 3s;
}


@keyframes animate {
  0% {
    transform: translateZ(-100px);
    height: 100%;
    width: 100%;
  }

  25% {
    transform: translateZ(100px);
    height: 100%;
    width: 100%;
  }

  50% {
    transform: translateZ(100px);
    height: 30%;
    width: 30%;
  }

  75% {
    transform: translateZ(-100px);
    height: 30%;
    width: 30%;
  }

  100% {
    transform: translateZ(-100px);
    height: 100%;
    width: 100%;
  }

}