BoderAnimation.vue 1.4 KB
Newer Older
hucy's avatar
hucy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
<script setup lang="ts"></script>
<template>
  <div class="content fit center">
    <div class="box">
      <span></span>
      <h2>02</h2>
    </div>
  </div>
</template>

<style lang="scss" scoped>
@import url('https://fonts.googleapis.com/css2?family=Fjalla+One&display=swap');
@keyframes animate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.content {
  background-color: #0c1022;
  font-family: 'Fjalla One', cursive;
}
.box {
  position: relative;
  width: 340px;
  height: 195px;
  background-color: rgba(0, 0, 0, 0.75);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 400px;
    background-image: conic-gradient(
      transparent,
      transparent,
      transparent,
      #00ccff
    );
    animation: animate 3s linear infinite;
  }

  &::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 400px;
    background-image: conic-gradient(
      transparent,
      transparent,
      transparent,
      #d400d4
    );
    animation: animate 3s linear infinite;
    animation-delay: -1.5s;
  }

  span {
    position: absolute;
    inset: 5px;
    background: #0c1022;
    border-radius: 8px;
    z-index: 1;
  }
  h2 {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: 8em;
  }
}
</style>