凉城a
宁在一思进,莫在一思停。

 

不要花里胡哨的loading,要简简单单朴实无华的loading,硬是找半天没找到想要的,自己动手吧!

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .load {
      width: 50px;
      height: 50px;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
    }

    .loading {
      stroke: rgb(53, 157, 218);
      stroke-width: 5;
      fill: none;
    }


    @keyframes loading-dash {
      0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
      }

      50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -40px;
      }

      100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -120px;
      }
    }

    .loading {
      stroke: rgb(53, 157, 218);
      fill: none;
      /* animation: dash 1.5s linear infinite; */
      animation: loading-dash 1.5s ease-in-out infinite;
      stroke-dasharray: 90, 150;
      stroke-dashoffset: 0;
      stroke-width: 2;
      stroke: #409eff;
      stroke-linecap: round;
    }

    #load {
      display: block;
      width: 100%;
      height: 100%;
      z-index: 2;
      position: absolute;
      background-color: hsla(0, 0%, 100%, .2);
      margin: 0;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      transition: opacity .3s;
    }
  </style>
</head>

<body>
  <div id="load">
    <svg class="load" viewBox="25 25 50 50">
      <circle class="loading" cx="50" cy="50" r="20" fill="none" />
    </svg>
  </div>
</body>

</html>

效果图:

 

posted on 2020-12-31 10:30  凉城a  阅读(209)  评论(0)    收藏  举报