SOURCE

console 命令行工具 X clear

                    
>
console
<div class="demo">
  <div>
    <div class="left">
      left
    </div>
    <div class="right">
      right
    </div>
    <div class="top">
      top
    </div>
    <div class="bottom">
      bottom
    </div>
    <div class="front">
      front
    </div>
    <div class="back">
      back
    </div>
  </div>
</div>
* {
  padding: 0;
  margin: 0;
}

.demo {
  perspective: 1000px
}

.demo>div {
  width: 200px;
  height: 200px;
  position: relative;
  margin: 100px auto;
  transform-style: preserve-3d;
  animation: rotate 5s 6s linear infinite both;
}

.demo>div:before {
  content: "";
  position: absolute;
  width: 0;
  height: 200%;
  border: 1px solid #000;
  left: 100px;
  top: -100px
}

.demo>div>div {
  position: absolute;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid #000;
  text-align: center;
  line-height: 200px;
  font-size: 40px;
}

.left {
  animation: left 1s both;
}

.right {
  animation: right 1s both 1s;
}

.top {
  animation: top 1s both 2s;
}

.bottom {
  animation: bottom 1s both 3s;
}

.back {
  animation: back 1s both 4s;
}

.front {
  animation: front 1s both 5s;
}

@keyframes left {
  to {
    transform: translateX(-100px) rotateY(-90deg);
  }
}

@keyframes right {
  to {
    transform: translateX(100px) rotateY(90deg);
  }
}

@keyframes top {
  to {
    transform: translateY(-100px) rotateX(90deg);
  }
}

@keyframes bottom {
  to {
    transform: translateY(100px) rotateX(-90deg);
  }
}

@keyframes back {
  to {
    transform: translateZ(-100px) rotateY(180deg);
  }
}

@keyframes front {
  to {
    transform: translateZ(100px);
  }
}

@keyframes rotate {
  to {
    transform: rotate3d(1, 1, 1, 360deg);
  }
}