src/components/Loading/index.module.less

// 规则循环旋转 one
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  .loader {
    --dim: 48px;
    width: var(--dim);
    height: var(--dim);
    position: relative;
    animation: spin988 2s linear infinite;
    margin-top: -360px;

    .circle {
      --color: #333;
      --dim: 20px;
      width: var(--dim);
      height: var(--dim);
      background-color: var(--color);
      border-radius: 50%;
      position: absolute;
    }
  }
  
  .loader .circle:nth-child(1) {
    top: 0;
    left: 0;
  }
  
  .loader .circle:nth-child(2) {
    top: 0;
    right: 0;
  }
  
  .loader .circle:nth-child(3) {
    bottom: 0;
    left: 0;
  }
  
  .loader .circle:nth-child(4) {
    bottom: 0;
    right: 0;
  }
  
  @keyframes spin988 {
    0% {
      transform: scale(1) rotate(0);
    }
  
    20%,
    25% {
      transform: scale(1.3) rotate(90deg);
    }
  
    45%,
    50% {
      transform: scale(1) rotate(180deg);
    }
  
    70%,
    75% {
      transform: scale(1.3) rotate(270deg);
    }
  
    95%,
    100% {
      transform: scale(1) rotate(360deg);
    }
  }
}


.loading-two {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  
  .loader {
    animation: rotate 2s infinite;
    height: 50px;
    width: 50px;
    margin-top: -360px;
  }
  
  .loader:before,
  .loader:after {
    border-radius: 50%;
    content: '';
    display: block;
    height: 20px;
    width: 20px;
  }
  
  .loader:before {
    animation: ball1 1s infinite;
    background-color: #cb2025;
    box-shadow: 30px 0 0 #f8b334;
    margin-bottom: 10px;
  }
  
  .loader:after {
    animation: ball2 2s infinite;
    background-color: #00a096;
    box-shadow: 30px 0 0 #97bf0d;
  }
  
  @keyframes rotate {
    0% {
      -webkit-transform: rotate(0deg) scale(1);
      -moz-transform: rotate(0deg) scale(1);
    }
  
    50% {
      -webkit-transform: rotate(360deg) scale(1.4);
      -moz-transform: rotate(360deg) scale(1.4);
    }
  
    100% {
      -webkit-transform: rotate(720deg) scale(1);
      -moz-transform: rotate(720deg) scale(1);
    }
  }
  
  @keyframes ball1 {
    0% {
      box-shadow: 30px 0 0 #f8b334;
    }
  
    50% {
      box-shadow: 0 0 0 #f8b334;
      margin-bottom: 0;
      -webkit-transform: translate(15px,15px);
      -moz-transform: translate(15px, 15px);
    }
  
    100% {
      box-shadow: 30px 0 0 #f8b334;
      margin-bottom: 10px;
    }
  }
  
  @keyframes ball2 {
    0% {
      box-shadow: 30px 0 0 #97bf0d;
    }
  
    50% {
      box-shadow: 0 0 0 #97bf0d;
      margin-top: -20px;
      -webkit-transform: translate(15px,15px);
      -moz-transform: translate(15px, 15px);
    }
  
    100% {
      box-shadow: 30px 0 0 #97bf0d;
      margin-top: 0;
    }
  }
}