CSS 各种loading 实现

CSS3实现了几种常见的Loading效果,虽然很简单,但还是分享一下,对自己做个总结吧……

1:loading 简单实现(圆形闪烁)


.load{

    width: 40px;

    height: 40px;

    border-radius: 50px;

    background: red;

    animation: fadeOut 1.0s infinite ease-in-out;

    -webkit-animation: fadeOut 1.0s infinite ease-in-out;

}

@keyframes fadeOut {

      from{transform: scale(0.0)}

      to{transform: scale(1.0);opacity: 0}

  }

  @-webkit-keyframes  fadeOut{

      from{transform: scale(0.0)}

      to{transform: scale(1.0);opacity: 0}

  }

<div class="load"></div>


2:线条波动效果


代码实现:(主要依赖 : animation-delay)

.box .lineload >div{

      width: 3px;

      height: 50px;

      background: green;

      animation: strechdeley 1.2s infinite ease-in-out;

      -webkit-animation: strechdeley 1.2s infinite ease-in-out;;

      margin-left: 3px;

  }

.box .lineload .line1{

  animation-delay: -1.1s;

}

.box .lineload .line2{

  animation-delay: -1s;

}

.box .lineload .line3{

  animation-delay: -0.9s;

}

.box .lineload .line4{

  animation-delay: -0.8s;

}

.box .lineload .line5{

  animation-delay: -0.7s;

}

    @keyframes strechdeley{

        0%,40%,100%{

          transform: scale(0.4);

        }

      20%{

          transform: scale(1.0);

      }

  }

@-webkit-keyframes  strechdeley{

  0%,40%,100%{

      -webkit-transform: scale(0.4);

  }

  20%{

      -webkit-transform: scale(1.0);

  }

html

<div class="lineload">

    <div class="line1"></div>

    <div class="line2"></div>

    <div class="line3"></div>

    <div class="line4"></div>

    <div class="line5"></div>

</div>

3:圆环loading 旋转动画


@keyframes am-ringload {

    from { transform: rotate(0deg)}

    to{ transform: rotate(360deg)}

}

@-webkit-keyframes  am-ringload {

  from { -webkit-transform: rotate(0deg)}

  to{ -webkit-transform: rotate(360deg)}

}

.box .ringload {

  width: 60px;

  height: 60px;

  background: black;

  border: 5px solid #666666;

  border-left-color:#ffffff ;

  margin-left: 50px;

  border-radius: 50%;

  animation: am-ringload 1s infinite ease;

  -webkit-animation: am-ringload 1s infinite ease;

}

<div class="ringload">

</div>

4:使用1,2原理可实现省略号效果的loading ,自身尝试吧!

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,417评论 0 11
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 2,099评论 0 2
  • 1 CSS属性 1.1 滤镜 1.1.1 blur属性 1.1.1.1 代码示例 CSS代码: .blur { ...
    Kevin_Junbaozi阅读 796评论 1 4
  • 2018-07-20 正在合作的年度客户,既有合作多年,最近因客户组织调整而需要重新提案的,也有从完全陌生的到招标...
    念即起行阅读 1,385评论 0 0
  • 一首诗 风花雪月的日子 只有在诗里 才会长久 那不经意间的相逢 总是在热情淡退后 才变得珍惜 用一双饱满泪水的眼,...
    碎尘啊阅读 243评论 0 1

友情链接更多精彩内容