css 3d 旋转正方形

<template>
  <div class="stuation">
    <div id="warp">
      <div id="div1">
        <div class="box1">一级保护区</div>
        <div class="box2">二级保护区</div>
        <div class="box3">准保护区1</div>
        <div class="box4">准保护区2</div>
        <div class="box5"><img src="../../../assets/images/logo.png" alt="logo"></div>
        <div class="box6"><img src="../../../assets/images/logo.png" alt="logo"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {};
  },
  computed: {},
  watch: {},
  methods: {},
  created() {},
  mounted() {}
};
</script>

<style scoped>
.stuation {
  width: 100%;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9;
  background-image: url("../../../assets/images/statusbg.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

#warp {
  /* 元素距离视图的距离 */
  perspective: 1200px;
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
}
#div1 {
  width: 1.5rem;
  height: 1.5rem;
  position: relative;
  color: white;
  transform-style: preserve-3d;
  font-size: 0.2rem;
  text-align: center; 
  animation: 10s rotate linear infinite;
}

#div1:hover {
  animation-play-state: paused;
}
@keyframes rotate {
  0% {
    transform: rotatex(-20deg) rotateY(0deg);
  }

  50% {
    transform: rotatex(-20deg) rotateY(180deg);
  }

  100% {
    transform: rotatex(-20deg) rotateY(360deg);
  }
}

.box1,
.box2,
.box3,
.box4,
.box5,
.box6 {
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1.5rem;
  position: absolute;
  transform-style: preserve-3d;
  opacity: 0.6; 
  font-size: .22rem;
  font-family: PingFangSC-Semibold, PingFang SC;
  font-weight: 600;
  color: #00E6FF;
  opacity: .8;
}
.box1,
.box2,
.box3,
.box4{
  width: 1.5rem;
  height: 1.3rem;
  line-height: 1.3rem;
}
.box1 {
  border: 0.01rem solid #00e6ff;
  background: #185f92;
  box-shadow: inset 0px 0px 0.4rem 0px;
  transform: rotateY(0deg) translateZ(.75rem);
}
.box2 {
  border: 0.01rem solid #00e6ff;
  background: #185f92;
  box-shadow: inset 0px 0px 0.4rem 0px;
  transform: rotateY(90deg) translateZ(.75rem);
}
.box3 {
  border: 0.01rem solid #00e6ff;
  background: #185f92;
  box-shadow: inset 0px 0px 0.4rem 0px;
  transform: rotateY(180deg) translateZ(.75rem);
}
.box4 {
  border: 0.01rem solid #00e6ff;
  background: #185f92;
  box-shadow: inset 0px 0px 0.4rem 0px #45b1ff;
  transform: rotateY(270deg) translateZ(.75rem);
}
.box5 {
  border: 0.01rem solid #00e6ff;
  background: linear-gradient(180deg, #285ec6 0%, #29b7ec 100%);
  box-shadow: inset 0px 0px 0.05rem 0px #67eeff;
  transform: rotateX(-90deg) translateZ(.55rem);
}
.box6 {
  border: 0.01rem solid #00e6ff;
  background: linear-gradient(180deg, #285ec6 0%, #29b7ec 100%);
  box-shadow: inset 0px 0px 0.05rem 0px #67eeff;
  transform: rotateX(90deg) translateZ(.75rem);
}
</style>`在这里插入代码片`
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值