css loading

2021-01-21  本文已影响0人  真是个非常帅气的昵称呢
<!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>
    #loading{
      width: 50px;
      height: 50px;
      border: 3px solid lightblue;
      border-top-color: lightcoral;
      border-radius: 50%;
      animation: rotateloading 1s infinite;
    }
    @keyframes rotateloading {
      0%{
        transform: rotate(0deg);
      }
      100%{
        transform: rotate(360deg);
      }
    }
    .loading-svg{
      width: 100px;
      height: 100px;
      background-color: lightgray;
      animation: loading-rotate 1.5s infinite ease-in-out;
    }
    .path{
      stroke: #409eff;
      stroke-width: 2;
      animation: loading-dash 1.5s ease-in-out infinite;
    }
    @keyframes loading-rotate {
      to{
        transform: rotate(1turn);
      }
    }
    @keyframes loading-dash {
      0%{
        stroke-dasharray: 1,126;
        stroke-dashoffset: 0;
      }
      50%{
        stroke-dasharray: 95,126;
        stroke-dashoffset: -31px;
      }
      to{
        stroke-dasharray: 6,120;
        stroke-dashoffset: -120px;
      }
    }
  </style>
</head>
<body>
  <svg viewBox="0 0 50 50" class="loading-svg">
    <Circle cx="25" cy="25" r="20" fill="none" class="path"></Circle>
  </svg>




  <div id="loading"></div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读