制作页面loading加载动画需要用到很多CSS3中的属性,比如:animation动画,display,transform属性等等,如有不清楚的小伙伴可以看看我以前的文章,之前都有介绍过,或者访问CSS3视频教程。
实例示范:制作一个柱状动画加载效果,条纹由长变短再变长,具体代码如下:
HTML部分:
<divclass="box">
<divclass="r1"></div>
<divclass="r2"></div>
<divclass="r3"></div>
<divclass="r4"></div>
<divclass="r5"></div>
</div>
CSS部分:
.box{
margin:100pxauto;
width:50px;
height:60px;
}
.box>div{
background-color:#67CF22;
height:100%;
width:6px;
display:inline-block;
-webkit-animation:stretchdelay1.2sinfiniteease-in-out;
animation:stretchdelay1.2sinfiniteease-in-out;
}
.box.r2{
-webkit-animation-delay:-1.1s;
animation-delay:-1.1s;
}
.box.r3{
-webkit-animation-delay:-1.0s;
animation-delay:-1.0s;
}
.box.r4{
-webkit-animation-delay:-0.9s;
animation-delay:-0.9s;
}
.box.r5{
-webkit-animation-delay:-0.8s;
animation-delay:-0.8s;
}
@-webkit-keyframesstretchdelay{
0%,
40%,
100%{
-webkit-transform:scaleY(0.4)
}
20%{
-webkit-transform:scaleY(1.0)
}
}
@keyframesstretchdelay{
0%,
40%,
100%{
transform:scaleY(0.4);
-webkit-transform:scaleY(0.4);
}
20%{
transform:scaleY(1.0);
-webkit-transform:scaleY(1.0);
}
}


本文转载自中文网


本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c57318.shtml