div两个盒子翻转

html

<div class="box-out anniu" v-else @click="showMedalVew">
             <div class="inner"></div>
             <div class="inner2"></div>
 </div>

js

  showMedalVew: function() {
      var inner = document.getElementsByClassName("box-out")[0];
      inner.classList.add("move");
    },

css

.box-out {
  position: absolute;
  display: block;
  width: 4.305556rem;
  height: 4.444444rem;
  top: 36%;
  left: 50%;
  margin: -2.152778rem;
  z-index: 1;
}

.inner,
.inner2 {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 4.305556rem;
  height: 4.444444rem;
}
.inner {
  background: url("../../../static/img/redRain/inner.png") no-repeat;
  background-size: 100% 100%;
}
.inner2 {
  background: url("../../../static/img/redRain/inner2.png") no-repeat;
  background-size: 100% 100%;
  -webkit-backface-visibility: hidden;  
/*上面一行兼容ios处理*/
  backface-visibility: hidden;
}
.box-out.move {
  animation: 1.5s move;
  transform-style: preserve-3d;
}

@keyframes move {
  0% {
    transform: rotateY(0deg);
    -webkit-transform: rotateY(0deg);
  }

  100% {
    transform: rotateY(270deg);
    -webkit-transform: rotateY(270deg);
  }
}

效果:


未命名.gif