vue实现动画旋转

这是jQuery实现地址:https://www.jq22.com/jquery-info17962

 

<template>
  <div>
    <div id="advert">
      <div class="bg1">
        <div :class="end ? 'not_bg1_box' : 'bg1_box'">
          <img
            src="././icons/icon-01.png"
            alt=""
            :class="['icon01', end ? 'not_img_box' : 'img_box']"
          />
          <img
            src="./icons/icon-02.png"
            alt=""
            :class="['icon02', end ? 'not_img_box' : 'img_box']"
          />
          <img
            src="./icons/icon-03.png"
            alt=""
            :class="['icon03', end ? 'not_img_box' : 'img_box']"
          />
          <img
            src="./icons/icon-04.png"
            alt=""
            :class="['icon04', end ? 'not_img_box' : 'img_box']"
          />
          <img
            src="./icons/icon-05.png"
            alt=""
            :class="['icon05', end ? 'not_img_box' : 'img_box']"
          />
          <img
            src="./icons/icon-06.png"
            alt=""
            :class="['icon06', end ? 'not_img_box' : 'img_box']"
          />
          <img
            src="./icons/icon-07.png"
            alt=""
            :class="['icon07', end ? 'not_img_box' : 'img_box']"
          />
        </div>
      </div>
      <div class="bg2">
        <div>
          <span class="icon08">
            <img src="./icons/icon-08.png" alt="" width="10px" />
          </span>
          <span class="icon09">
            <img src="./icons/icon-09.png" alt="" width="30px" />
          </span>
          <span class="icon10">
            <img src="./icons/icon-10.png" alt="" width="20px" />
          </span>
        </div>
      </div>
      <van-circle
        v-model="currentRate"
        :rate="200"
        :speed="30"
        :text="text"
        class="circle"
        layer-color="#999999"
        :stroke-width="90"
        :color="gradientColor"
      />
      <!-- <div class="bg3">
        <div>
          <span class="icon11">
            <img src="./icons/icon-11.png" alt="" width="26px" />
          </span>
          <span class="icon12">
            <img src="./icons/icon-12.png" alt="" width="18px" />
          </span>
        </div>
      </div> -->
      <!-- <div class="content">
        <span>立即</span>
        <img
          src="./icons/finger.png"
          alt=""
          style="height: 22px; vertical-align: middle"
        />
      </div> -->
    </div>
    <!-- <div id="applyfor">
      <form>
        <div>
          <i></i>
          <span>信息提交</span>
        </div>
        <input type="text" placeholder="公司名称" />
        <input type="text" placeholder="联系人" />
        <input type="tel" placeholder="联系人电话" />
        <button type="submit">立即申请</button>
      </form>
      <div id="shadow"></div>
    </div> -->
  </div>
</template>
 
<script>
import Vue from 'vue';
import { Circle } from 'vant';

Vue.use(Circle);
export default {
  data: function () {
    return {
      currentRate: 0,
      gradientColor: {
        '0%': '#3fecff',
        '100%': '#6149f6',
      },
      rate: 200,
      end: false
    }
  },
  computed: {
    text () {
      let num = this.currentRate.toFixed() * 2;
      console.log(this.currentRate)
      return num + '/' + 200
      // return this.currentRate.toFixed() + '%';
    },
  },
}
</script>
 
<style>
html,
body {
  padding: 0;
  margin: 0;
  font-family: "lucida grande", "lucida sans unicode", lucida, helvetica,
    "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  font-size: 16px;
  color: #000000;
}

body {
  /* background-image: url(images/bg.jpg); */
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* 外圈大环的旋转 */
@keyframes animtran {
  from {
    transform: rotateZ(0deg);
  }

  to {
    transform: rotateZ(360deg);
  }
}

/* 内圈环的旋转 */
@keyframes animtrans {
  from {
    transform: rotateZ(360deg);
  }

  to {
    transform: rotateZ(0deg);
  }
}

/* 最内圈环的旋转  */
@-webkit-keyframes animtran {
  from {
    transform: rotateZ(0deg);
  }

  to {
    transform: rotateZ(360deg);
  }
}

@-webkit-keyframes animtrans {
  from {
    transform: rotateZ(360deg);
  }

  to {
    transform: rotateZ(0deg);
  }
}
#advert {
  width: 300px;
  height: 300px;
  margin: 10% auto;
  position: relative;
}

#advert .bg1 {
  width: 260px;
  height: 260px;
  position: absolute;
  top: 25px;
  left: 20px;
  z-index: 10;
  transform-style: preserve-3d;
  transform: perspective(800px) rotateX(-43deg) rotateY(0) rotateZ(100deg);
}

#advert .bg1 .bg1_box {
  width: 260px;
  height: 260px;
  border: #ccc 1px solid;
  border-radius: 15em;
  position: relative;
  animation: animtran 5s linear infinite;
  -webkit-animation: animtran 5s linear infinite;
}
#advert .bg1 .not_bg1_box {
  width: 260px;
  height: 260px;
  border: #ccc 1px solid;
  border-radius: 15em;
  position: relative;
}

#advert .bg1 .img_box {
  width: 50px;
  position: absolute;
  animation: animtrans 5s linear infinite;
  -webkit-animation: animtrans 5s linear infinite;
}
#advert .bg1 .not_img_box {
  width: 50px;
  position: absolute;
}

#advert .bg1 .icon01 {
  bottom: 25px;
  left: 7px;
}
.icon01:hover {
  transform: rotateY(0deg) translateZ(400px);
}

#advert .bg1 .icon02 {
  top: 80px;
  left: -24px;
}

#advert .bg1 .icon03 {
  top: -7px;
  left: 44px;
}

#advert .bg1 .icon04 {
  top: -7px;
  right: 44px;
}

#advert .bg1 .icon05 {
  top: 80px;
  right: -24px;
}

#advert .bg1 .icon06 {
  bottom: 25px;
  right: 7px;
}

#advert .bg1 .icon07 {
  bottom: -25px;
  left: 105px;
}

#advert .bg2 {
  width: 180px;
  height: 180px;
  position: absolute;
  top: 66px;
  left: 60px;
  z-index: 9;
  transform-style: preserve-3d;
  transform: perspective(800px) rotateX(-43deg) rotateY(0) rotateZ(100deg);
}

#advert .bg2 div {
  width: 180px;
  height: 180px;
  border: #e376bd 1px solid;
  border-radius: 15em;
  position: relative;
  animation: animtrans 12s linear infinite;
  -webkit-animation: animtrans 12s linear infinite;
}

#advert .bg2 span {
  display: inline-block;
  background-color: #ffffff;
  overflow: hidden;
  border-radius: 15em;
  position: absolute;
  animation: animtran 6s linear infinite;
  -webkit-animation: animtran 6s linear infinite;
}

#advert .bg2 img {
  padding: 10px;
  display: block;
}

#advert .bg2 .icon08 {
  top: 10px;
  left: 13px;
}

#advert .bg2 .icon09 {
  bottom: 0;
  left: 7px;
}

#advert .bg2 .icon10 {
  bottom: 40px;
  right: -15px;
}

#advert .bg3 {
  width: 100px;
  height: 100px;
  position: absolute;
  top: 100px;
  left: 100px;
  z-index: 8;
}

#advert .bg3 div {
  width: 100px;
  height: 100px;
  border: #e077bf 1px dotted;
  border-radius: 15em;
  position: relative;
  animation: animtran 8s linear infinite;
  -webkit-animation: animtran 8s linear infinite;
}

#advert .bg3 span {
  display: inline-block;
  background-color: #ffffff;
  overflow: hidden;
  border-radius: 15em;
  position: absolute;
  animation: animtrans 4s linear infinite;
  -webkit-animation: animtrans 4s linear infinite;
}

#advert .bg3 img {
  padding: 10px;
  display: block;
}

#advert .bg3 .icon11 {
  top: -14px;
  right: 0px;
}

#advert .bg3 .icon12 {
  bottom: -13px;
  right: 10px;
}

#advert .content {
  width: 130px;
  height: 50px;
  background: linear-gradient(to right, #fa71ad, #c77dd1);
  position: absolute;
  z-index: 11;
  left: 85px;
  top: 125px;
  border-radius: 5px;
  text-align: center;
  line-height: 50px;
  color: #fff;
  font-size: 20px;
  box-shadow: #f6f6f6 8px 8px 8px 4px;
  cursor: pointer;
}

@keyframes ani-one {
  from {
    left: 260px;
  }

  to {
    left: 16px;
  }
}

@keyframes ani-two {
  from {
    left: 260px;
  }

  to {
    left: 70px;
  }
}

@keyframes ani-three {
  from {
    top: 0;
    left: 0;
  }

  to {
    top: 8px;
    left: 8px;
  }
}

@keyframes ani-four {
  0% {
    width: 130px;
    height: 50px;
    left: 85px;
    top: 125px;
    box-shadow: #f6f6f6 8px 8px 8px 4px;
    border: #eee 0px solid;
    margin-left: 0;
  }

  100% {
    width: 259px;
    height: 333px;
    left: 50%;
    top: 0px;
    box-shadow: #ffffff 0 0 0 0;
    border: #eee 1px solid;
    margin-left: -130px;
  }
}

@keyframes ani-five {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes ani-six {
  from {
    left: 260px;
  }

  to {
    left: 0;
  }
}

@-webkit-keyframes ani-one {
  from {
    left: 260px;
  }

  to {
    left: 16px;
  }
}

@-webkit-keyframes ani-two {
  from {
    left: 260px;
  }

  to {
    left: 70px;
  }
}

@-webkit-keyframes ani-three {
  from {
    top: 0;
    left: 0;
  }

  to {
    top: 8px;
    left: 8px;
  }
}

@-webkit-keyframes ani-four {
  0% {
    width: 130px;
    height: 50px;
    left: 85px;
    top: 125px;
    box-shadow: #f6f6f6 8px 8px 8px 4px;
    border: #eee 0px solid;
    margin-left: 0;
  }

  100% {
    width: 259px;
    height: 333px;
    left: 50%;
    top: 0px;
    box-shadow: #ffffff 0 0 0 0;
    border: #eee 1px solid;
    margin-left: -130px;
  }
}

@-webkit-keyframes ani-five {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@-webkit-keyframes ani-six {
  from {
    left: 260px;
  }

  to {
    left: 0;
  }
}

#applyfor {
  width: 259px;
  height: 333px;
  margin: 20% auto;
  position: relative;
  display: none;
}

#applyfor form {
  padding: 13px 16px 30px;
  width: 225px;
  height: 288px;
  border: #eee 1px solid;
  border-radius: 6px;
  /* box-shadow: #f6f6f6 10px 10px 0px; */
  position: relative;
  background-color: #fff;
  overflow: hidden;
}

#applyfor #shadow {
  width: 259px;
  height: 333px;
  border-radius: 5px;
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  background-color: #f3f3f3;
}

#applyfor button {
  width: 120px;
  height: 46px;
  background: linear-gradient(to right, #fa71ad, #c77dd1);
  border-radius: 5px;
  text-align: center;
  line-height: 46px;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  box-shadow: #f6f6f6 8px 8px 8px 4px;
  border: none;
  margin: 30px 0;
  padding: 0;
  position: absolute;
  top: 228px;
  left: 260px;
}

#applyfor input {
  width: 225px;
  border: none;
  border-bottom: #eee 1px solid;
  margin-top: 20px;
  padding: 10px 0 10px 26px;
  font-size: 16px;
  box-sizing: border-box;
  background-repeat: no-repeat;
  background-size: auto 18px;
  background-position: 0 center;
  position: absolute;
  left: 260px;
}

#applyfor input:nth-child(2) {
  background-image: url(./icons/tower.png);
  margin-top: 30px;
  top: 41px;
}

#applyfor input:nth-child(3) {
  background-image: url(./icons/people.png);
  top: 110px;
}

#applyfor input:nth-child(4) {
  background-image: url(./icons/tel.png);
  top: 169px;
}

#applyfor form div {
  position: absolute;
  width: 257px;
  height: 50px;
  line-height: 50px;
  top: 0;
  left: 0;
  background-color: #f6f6f6;
}

#applyfor i {
  display: inline-block;
  width: 6px;
  height: 18px;
  background: linear-gradient(to bottom, #fa71ad, #c77dd1);
  border-radius: 2px;
  position: absolute;
  top: 16px;
  left: 16px;
}

#applyfor span {
  margin-left: 34px;
  color: #333333;
  /* position: absolute;
            display: inline-block;
            width: 64px; */
}

input::-webkit-input-placeholder {
  /* WebKit browsers */
  color: #999999;
}

input:-moz-placeholder {
  /* Mozilla Firefox 4 to 18 */
  color: #999999;
}

input::-moz-placeholder {
  /* Mozilla Firefox 19+ */
  color: #999999;
}

input:-ms-input-placeholder {
  /* Internet Explorer 10+ */
  color: #999999;
}

.animation-paused {
  animation-play-state: paused !important;
  -webkit-animation-play-state: paused !important;
}

.animation-one {
  animation: ani-one 0.6s ease 1;
  -webkit-animation: ani-one 0.6s ease 1;
}

.animation-two {
  animation: ani-two 0.6s ease 1;
  -webkit-animation: ani-two 0.6s ease 1;
}

.animation-three {
  animation: ani-three 0.6s ease 1;
  -webkit-animation: ani-three 0.6s ease 1;
}

.animation-four {
  animation: ani-four 0.3s ease 1;
  -webkit-animation: ani-four 0.3s ease 1;
}

.animation-five {
  animation: ani-five 0.5s ease 1;
  -webkit-animation: ani-five 0.5s ease 1;
}

.animation-six {
  animation: ani-six 0.6s ease 1;
  -webkit-animation: ani-six 0.6s ease 1;
}

.opacity0 {
  opacity: 0;
}
.circle {
  width: 100px;
  height: 100px;
  position: absolute;
  top: 100px;
  left: 100px;
  z-index: 8;
}
</style>

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值