WaterPolo.vue 2.04 KB
<template>
  <div class="polo">
    <div class="polo-box">
      <div :class="['number','box-center',{'white':num > 50 }]">
        {{num}}<span>%</span>
      </div>
      <template v-if="num > 0">
        <div
          class="three"
          :style="{top:`${100 - num - 10}%`}"
        ></div>
        <div
          class="two"
          :style="{top:`${100 - num - 5}%`}"
        ></div>
        <div
          class="one"
          :style="{top:`${100 - num}%`}"
        ></div>
      </template>
    </div>
  </div>
</template>

<script type='text/ecmascript-6'>
export default {
  name: 'WaterPolo',
  props: {
    num: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      // num:60
    }
  },
  mounted() {},
  methods: {}
}
</script>

<style scoped lang='scss'>
.polo {
  width: 100%;
  height: 100%;
  border: 1px solid var(--themeColor);
  overflow: hidden;
  border-radius: 100%;
  .polo-box {
    position: relative;
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
    overflow: hidden;
    border-radius: 100%;
  }
  .number {
    font-size: 13px;
    font-weight: 500;
    color: var(--themeColor);
    z-index: 2;
    span {
      font-size: 7px;
    }
  }
  .white {
    color: #fff;
    text-shadow: 1px 1px var(--themeColor);
  }
  .one,
  .two,
  .three {
    position: absolute;
    // width: 200%;
    // height: 200%;
    width: 150%;
    height: 150%;
    z-index: 0;
  }
  .one {
    border-radius: 40% 50% 40% 60%;
    background-color: var(--themeColor);
    left: -25%;
    // left: -50%;
    animation: ball-move linear infinite 5s;
  }
  .two {
    border-radius: 45% 35% 50% 60%;
    background-color: rgb(197, 215, 239);
    left: -25%;
    // left: -50%;
    animation: ball-move linear infinite 7.5s;
  }
  .three {
    border-radius: 40% 60% 50% 40%;
    background-color: rgb(235, 241, 249);
    left: -10%;
    // left: -20%;
    animation: ball-move linear infinite 10s;
  }
  @keyframes ball-move {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
}
</style>