关于html:气泡loading

代码来自头条号”前端小智”, 侵权删

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>气泡loading</title>
  <style>
    *{
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    body{
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      background-color: #111;
    }
    .container{
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }
    .box{ /* 气泡的父级元素  */
      position: relative;
      width: 200px;
      height: 200px;
      animation: rotateBox 10s linear infinite; /*这块的旋转动画,有跟没有没看进去区别*/
    }
    @keyframes rotateBox {
      0%{
        transform: rotate(0deg);
      }
      100%{
        transform: rotate((360deg))
      }
    }
    .circle{
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      background-color: #38c1ff;
      border-radius: 50%;
      animation: animation_1 5s linear infinite;
    }
    .circle:nth-child(2){
      background-color: #ff3378;
      animation-delay: -2.5s; /*提早第二个圆的动画  以便将两个圆离开*/

    }
    @keyframes animation_1{ /*气泡的动画 设置变形-scale属性(变大  变小) 和变动的原点 */
      0% {
        transform: scale(1);
        transform-origin: left;
      }
      50% {
        transform: scale(0);
        transform-origin: left;
      }
      50.01% {
        transform: scale(0);
        transform-origin: right;
      }
      100% {
        transform: scale(1);
        transform-origin: right;
      }
    }
    
    h2{
      margin-top: 20px;
      font-size: 20px;
      font-weight: 400;
      letter-spacing: 4px;
      color: #fff;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="box">
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <h2>loading</h2>
  </div>
</body>
</html>

【腾讯云】轻量 2核2G4M,首年65元

阿里云限时活动-云数据库 RDS MySQL  1核2G配置 1.88/月 速抢

本文由乐趣区整理发布,转载请注明出处,谢谢。

您可能还喜欢...

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据