<template>
  <div class="rain-container">
    <div v-for="i in 50" :key="i" class="drop"></div>
  </div>
</template>

<style lang="scss" scoped>
  .rain-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .drop {
    position: absolute;
    width: 2px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    animation: fall linear infinite;
  }

  @keyframes fall {
    0% {
      transform: translateY(-10px);
      opacity: 1;
    }
    100% {
      transform: translateY(200px);
      opacity: 0;
    }
  }

  /* 随机动画 */
  .drop:nth-child(odd) {
    left: 10%;
    animation-duration: 1s;
  }
  .drop:nth-child(even) {
    left: 20%;
    animation-duration: 1.5s;
  }
  .drop:nth-child(3n) {
    left: 30%;
    animation-duration: 1.2s;
  }
  .drop:nth-child(4n) {
    left: 40%;
    animation-duration: 1.3s;
  }
  .drop:nth-child(5n) {
    left: 50%;
    animation-duration: 1.1s;
  }
  .drop:nth-child(6n) {
    left: 60%;
    animation-duration: 1.4s;
  }
  .drop:nth-child(7n) {
    left: 70%;
    animation-duration: 1.2s;
  }
  .drop:nth-child(8n) {
    left: 80%;
    animation-duration: 1.3s;
  }
  .drop:nth-child(9n) {
    left: 90%;
    animation-duration: 1.1s;
  }
</style>
