Facebook loading animation using CSS3

背景虚化加载,用css3实现facebook的loading的实现方式。


image.png

To display loading effect in webpage based application, you need some ideas on CSS3. Here we are using CSS3 Keyframes to create desire effect.
Content Placeholder Animation like Facebook using Shimmer
Lets start with loading animation.
Animation 1 :
Here we are using animation1.css file to display loading effect in webpage.

animation1.html

<html>
<head>
<link rel="stylesheet" type="text/css" href="animation1.css">
</head>
<body>
<div class="animationLoading">
 <div id="container">
  <div id="one"></div>
  <div id="two"></div>
  <div id="three"></div>
 </div>
<div id="four"></div>
<div id="five"></div>
<div id="six"></div>
</div>
</body>
</html>

animation1.css
style-sheet file which helps to display loading effect.

body{
  
  margin:90px auto;
  width: 500px;
   background-color: #e9eaed;
}

.animationLoading{
  background: #fff;
  border: 1px solid;
  border-color: #e5e6e9;
  border-radius: 3px; 
  display: block;
  height: 324px;
  width: 494px;
  padding: 12px;
}
@keyframes animate {
    from {transition:none;}
    to {background-color:#f6f7f8;transition: all 0.3s ease-out;}
}

#container{
  width:100%;
  height:30px;
}
#one,#two,#three,#four,#five,#six
{
  position:relative;
  background-color: #CCC;
  height: 6px;
  animation-name: animate; 
  animation-duration: 2s; 
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

#one{  
  left:0; 
  height: 40px;
  width: 40px;  
}

#two{
  left:50px;
  top:-33px;
  width: 25%;
}

#Three{
  left:50px;
  top:-20px;
  width: 15%;
}

#four{
  left:0px;
  top:30px;
  width: 80%;
}

#five{
  left:0px;
  top:45px;
  width: 90%;
}

#six{
  left:0px;
  top:60px;
  width: 50%;
}

Animation 2 :
Here we have designed one more animation effect, that you can easily integrate in web application. You need to include animation2.css here.
animation2.html

<html>
<head>
<link rel="stylesheet" type="text/css" href="animation2.css">
</head>
<body>
<div class="animationLoading">
 <div id="container">
  <div id="one"></div>
  <div id="two"></div>
  <div id="three"></div>
 </div>
<div id="four"></div>
<div id="five"></div>
<div id="six"></div>
</div>
</body>
</html>

animation2.css
style-sheet file which helps to display loading effect.

body{
  
  margin:90px auto;
  width: 500px;
   background-color: #e9eaed;
}

.animationLoading{
  background: #fff;
  border: 1px solid;
  border-color: #e5e6e9;
  border-radius: 3px; 
  display: block;
  height: 324px;
  width: 494px;
  padding: 12px;
}
@keyframes animate {
     0% {
     background-position: -468px 0
   }
   100% {
     background-position: 468px 0
   }

}

#container{
  width:100%;
  height:30px;
}
#one,#two,#three,#four,#five,#six
{
  position:relative;
  background-color: #CCC;
  height: 6px;
  animation-name: animate; 
  animation-duration: 2s; 
  animation-iteration-count: infinite;
  animation-timing-function: linear;   
  background: -webkit-gradient(linear, left top, right top, color-stop(8%, #eeeeee), color-stop(18%, #dddddd), color-stop(33%, #eeeeee));
  background: -webkit-linear-gradient(left, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);
  background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);
  -webkit-background-size: 800px 104px;  
}

#one{  
  left:0; 
  height: 40px;
  width: 40px;  
}

#two{
  left:50px;
  top:-33px;
  width: 25%;
}

#Three{
  left:50px;
  top:-20px;
  width: 15%;
}

#four{
  left:0px;
  top:30px;
  width: 80%;
}

#five{
  left:0px;
  top:45px;
  width: 90%;
}

#six{
  left:0px;
  top:60px;
  width: 50%;
}

Download Link :
------------------------------
https://github.com/skptricks/php-Tutorials/tree/master/Facebook%20loading%20animation%20using%20CSS3

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    wgl0419阅读 11,480评论 1 9
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,680评论 2 45
  • 1、我争取我应得的,我努力做我该做的。无论工作还是生活,遇到事首先要清楚表达自己的态度,其次听取对方的想法,然后达...
    又一只飞猫阅读 2,675评论 0 0
  • 打卡
    飘絮_阅读 994评论 2 0
  • 转眼间已到星期一,周末的时间过的飞快。 余枫和筱雅都投入工作中去。忙碌的工作并没让他们彼此疏远,而是越走越近。 筱...
    顾苏橙阅读 3,599评论 7 8