首先10种效果图如下:
接下来简单分析一下进度条最重要的两个属性控制:
1.@keyframes
语法规则:@keyframes turn{ 0%{ transform: rotate(0deg); border-color: lightgreen; } 50%{ transform: rotate(180deg); border-color: lightyellow; } } 2.@keyframes displear{ 0%{ transform: translateX(0); opacity: 1; } 50%{ transform: translate(80px,-100%); opacity: 0; } 100%{ opacity: 1; } }
2.animation
<!DOCTYPE html>
<html>
<head>
<title>进度条</title>
<meta charset="utf-8"/>
<style type="text/css">
background-color : grey;
div{
margin : 25px;
}
#caseVerte,#blue,#border,#yuan,#loader,#loading1,.loading4,.load1,.load2,.load3{
float:left;
margin-right: 25px;
margin-top: 20px;
}
#caseVerte {
background-color : #30bf82 ;
height : 140px ;
width : 150px;
padding-top : 10px ;
}
#caseVerte #load {
color : #fbfbfb ;
font- family : calibri ;
text-align : center ;
}
#caseVerte #case1
{
height : 10px;
width : 100px;
background-color : #fbfbfb;
animation : case1 2.25s infinite infinite ;
}
@keyframes case1 {
0% {width : 0%; }
50% {width : 90px; }
100% {width : 0%;}
}
#caseVerte #case2{
height : 10px;
width : 10px;
background-color : #fbfbfb;
animation : case2 2s infinite ;
}
@keyframes case2 {
0% {width : 0%; }
50% {width : 100px; }
100% {width : 0%;}
}
#caseVerte #case3{
height : 10px;
width : 10px;
background-color : #fbfbfb;
animation : case3 1.75s infinite ;
}
@keyframes case3{
0% {width : 0%; }
50% {width : 95px; }
100% {width : 0%;}
}
#caseVerte #case4{
height : 10px;
width : 10px;
background-color : #fbfbfb;
animation : case4 2.5s infinite ;
}
@keyframes case4{
0% {width : 0%; }
50% {width : 80px; }
100% {width : 0%;}
}
#caseVerte #case5{
height : 10px;
width : 10px;
background-color : #fbfbfb;
animation : case5 1.5s infinite ;
}
@keyframes case5{
0% {width : 0%; }
50% {width : 105px; }
100% {width : 0%;}
}
#blue{
background-color : blue;height : 140px ;
width : 150px;
padding-top : 10px ;
}
#blue #load {
color : blue ;
font- family : calibri ;
text-align : center ;
}
#blue #list1 {
height : 10px;
width : 100px;
background-color : yellow;
animation : list1 2.25s infinite infinite ;
}
@keyframes list1 {
0% {width : 0%; }
50% {width : 90px; }
100% {width : 0%;}
}
#blue #list2{
height : 10px;
width : 10px;
background-color :yellow;
animation : list2 2s infinite ;
}
@keyframes list2 {
0% {width : 0%; }
50% {width : 100px; }
100% {width : 0%;}
}
#blue #list3{
height : 10px;
width : 10px;
background-color : yellow;
animation : list3 1.75s infinite ;
}
@keyframes list3{
0% {width : 0%; }
50% {width : 95px; }
100% {width : 0%;}
}
#blue #list4{
height : 10px;
width : 10px;
background-color :yellow;
animation :list4 2.5s infinite ;
}
@keyframes list4{
0% {width : 0%; }
50% {width : 80px; }
100% {width : 0%;}
}
#blue #list5{
height : 10px;
width : 10px;
background-color : yellow;
animation : list5 1.5s infinite ;
}
@keyframes list5{
0% {width : 0%; }
50% {width : 105px; }
100% {width : 0%;}
}
#border{
background-color : black;
height : 140px ;
width : 150px;
padding-top : 10px ;
}/*四边不同颜色色*/
#border #load {
color : black ;
font- family : calibri ;
text-align : center ;
}
#border .lst1{
height : 10px;
width : 10px;
background-color :yellow;
margin: 40px 10px 40px 0px;
border-radius:20px;
animation : lst1 2s infinite ;
animation-delay: 2s;
}
@keyframes lst1 {
0% {width : 0%; }
25% {width : 50px;}
50%{width : 100px;}
100% {width : 0%;}
}
#yuan{
background-color :#752e0e;
height : 140px ;
width : 150px;
padding-top : 10px ;
}
#yuan #load {
color : white ;
font- family : calibri ;
text-align : center ;
}
#yuan #circle{
width: 30px;
height: 30px;
border-radius: 100%;
margin: 40px 10px 40px 0px;
background-color :yellow;
animation-name: around;
animation-duration: 10s;
animation-timing-function: ease-in-out;
animation-delay: 1s;
animation-iteration-count: infinite;
}
@keyframes around{
0%{
transform: translateX(0);
opacity: 1;
}
100%{
transform: translate(80px,-50%);
opacity: 0;
}
}
#loader #load{
color :red;
font- family : calibri ;
text-align : right;
}
#loader{
background-color :red;
height : 140px ;
width : 150px;
padding-top : 10px ;
}
#loader #first1{
margin: 30px;
}
#loader #first2{
margin:40px 40px 0 20px;
}
#loader #first3{
position:relative;
left:100px;
}
#loader #first1,#loader #first2,#loader #first3{
width: 10px;
height: 10px;
border-radius: 100%;
background-color :white;
animation-name: displear;
animation-duration: 10s;
animation-timing-function: ease-in-out;
animation-delay: 1s;
animation-iteration-count: infinite;
}
@keyframes displear{
0%{
transform: translateX(0);
opacity: 1;
}
50%{
transform: translate(80px,-100%);
opacity: 0;
}
100%{
opacity: 1;
}
}
#loading1{
width:150px;
height:140px;
padding-top: 10px;
text-align:center;
background-color: green;
}
#loading1 span{
width:5px;
height:100%;
display:inline-block;
background:#67CF22;;
animation: mymove 1.2s infinite ease-in-out;
-webkit-animation:mymove 1.2s infinite ease-in-out;
/*
mymove代表动画名字
1.2s代表执行时间
infinite表示一直循环执行
ease-in-out表示先慢后快的缓动
*/
}
#loading1 >span:nth-child(2){
-webkit-animation-delay:-1.0s;
animation-delay:-1.0s;
}
#loading1 >span:nth-child(3){
-webkit-animation-delay:-0.9s;
animation-delay:-0.9s;
}
#loading1 >span:nth-child(4){
-webkit-animation-delay:-0.8s;
animation-delay:-0.8s;
}
#loading1 >span:nth-child(5){
-webkit-animation-delay:-0.7s;
animation-delay:-0.7s;
}
@keyframes mymove{
0%{transform:scaleY(0.4);}
25%{transform:scaleY(1.0);}
50%{transform:scaleY(0.4);}
75%{transform:scaleY(0.4);}
100%{transform:scaleY(0.4);}
}
@-webkit-keyframes mymove{
0%{transform:scaleY(0.4);}
25%{transform:scaleY(1.0);}
50%{transform:scaleY(0.4);}
75%{transform:scaleY(0.4);}
100%{transform:scaleY(0.4);}
}
.loading4{
width:150px;
height:140px;
/*margin:50px auto;*/
background-color: #000000;
padding-top: 10px;
text-align: center;
}
.loading4 >div{
width: 18px;
height: 18px;
border-radius: 100%;
display:inline-block;
background-color: red;
-webkit-animation: three 1.4s infinite ease-in-out;
animation: three 1.4s infinite ease-in-out;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.loading4 .three1{
-webkit-animation-delay: -0.30s;
animation-delay: -0.30s;
}
.loading4 .three2{
-webkit-animation-delay: -0.15s;
animation-delay: -0.15s;
}
@-webkit-keyframes three {
0%, 80%, 100% {-webkit-transform: scale(0.0) }
40% { -webkit-transform: scale(1.0) }
}
@keyframes three {
0%, 80%, 100% {-webkit-transform: scale(0.0) }
40% { -webkit-transform: scale(1.0) }
}
.loading5{
width:100px;
height:100px;
border-radius: 50%;
margin-top: 100px
margin:0 auto;
position:relative;
padding-top:10px;
border:5px solid lightgreen;
animation: turn 2s linear infinite;
}
.loading5 span{
display:inline-block;
width:30px;
height:30px;
border-radius: 100%;
background-color: lightgreen;
position:absolute;
left:50%;
margin-top:-15px;
margin-left:-15px;
animation: changeColor 1.5s linear infinite;
}
@keyframes changeColor{
0%{
background-color: lightgreen;
}
100%{
background-color: lightyellow;
}
}
@keyframes turn{
0%{
transform: rotate(0deg);
border-color: lightgreen;
}
50%{
transform: rotate(180deg);
border-color: lightyellow;
}
}
.load1{
width:150px;
height:140px;
padding-top: 10px;
background-color: #752e0e;
}
.load2{
width:150px;
height:140px;
padding-top: 10px;
background-color: lightblue;
}
.loading6{
width: 150px;
height: 4px;
border-radius: 2px;
position: relative;
background: green;
-webkit-animation: changeBgColor 1.04s ease-in infinite alternate;
}
.loading6 span{
display: inline-block;
width: 16px;
height: 16px;
border-radius: 50%;
background: lightgreen;
position: absolute;
margin-top: -7px;
margin-left:-8px;
-webkit-animation: changePosition 1.04s ease-in infinite alternate;
}
@-webkit-keyframes changeBgColor{
0%{
background: green;
}
100%{
background:blue;
}
}
@-webkit-keyframes changePosition{
0%{
background: green;
}
100%{
margin-left: 142px;
background: blue;
}
}
.load3{
width:150px;
height:140px;
padding-top:10px;
background-color:#9093f8;
}
.loading10{
position: relative;
width: 80px;
height: 80px;
top: 28%;
top: -webkit-calc(50% - 43px);
top: calc(50% - 43px);
left: 35%;
left: -webkit-calc(50% - 43px);
left: calc(50% - 43px);
border-radius: 50px;
background-color: rgba(231, 76, 60, 0.1);
border-width: 40px;
border-style: double;
border-color:transparent white;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50% ;
-webkit-animation: turn 2s linear infinite;
animation: turn 2s linear infinite;
}
@keyframes turn{
0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}
}
</style>
</head>
<body>
<div id= "caseVerte">
<div id= "case1"></div>
<div id="case2"></div>
<div id="case3"></div>
<div id="case4"></div>
<div id="case5"></div>
<div id="load"></div>
<p> loading...</p>
</div>
<div id= "blue">
<div id= "list1"></div>
<div id="list2"></div>
<div id="list3"></div>
<div id="list4"></div>
<div id="list5"></div>
<div id="load"></div>
<p> loading...</p>
</div>
<div id="border">
<div class="lst1"></div>
<div id="load"></div>
<p>loading..</p>
</div>
<div id="yuan">
<div id="circle"></div>
<div id="load"></div>
<p>loading..</p>
</div>
<div id="loader">
<div id="first1"></div>
<div id="first2"></div>
<div id="first3"></div>
<div id="load"></div>
<p>loading..</p>
</div>
<div id="loading1">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<p>loading..</p>
</div>
<div class="loading4">
<div class="three1"></div>
<div class="three2"></div>
<div class="three3"></div>
<p>loading..</p>
</div>
<div class="load1">
<div class="loading5">
<span></span></div>
<p>loading..</p>
</div>
<div class=load2>
<div class="loading6"><span></span></div>
<p>loading..</p>
</div>
<div id="inner">
<div id="spiner"></div>
<div id= "iller"></div>
<div id="masker"></div>
</div>
<div class="load3">
<div class="loading10"></div>
<p>loading..</p>
</div>
</body>
</html>
在这里插入代码片