赞
踩
您可以使用
steps作为计时功能暂停动画直到下一个关键帧
CSS:
-webkit-animation-timing-function: steps(1,end);
-moz-animation-timing-function: steps(1,end);
-ms-animation-timing-function: steps(1,end);
-o-animation-timing-function: steps(1,end);
animation-timing-function: steps(1,end);
示例代码:
@keyframes quick {
0% {
background-color:green;
}
50% {
-webkit-animation-timing-function: steps(1,end);
-moz-animation-timing-function: steps(1,end);
-ms-animation-timing-function: steps(1,end);
-o-animation-timing-function: steps(1,end);
animation-timing-function: steps(1,end);
background-color:blue;
}
100% {
background-color:red;
}
}
@-o-keyframes quick {
0% {
background-color:green;
}
50% {
-o-animation-timing-function: steps(1,end);
background-color:blue;
}
100% {
background-color:red;
}
}
@-moz-keyframes quick {
0% {
background-color:green;
}
50% {
-moz-animation-timing-function: steps(1,end);
background-color:blue;
}
100% {
background-color:red;
}
}
@-webkit-keyframes quick {
0% {
background-color:green;
}
50% {
-webkit-animation-timing-function: steps(1,end);
background-color:red;
}
100% {
background-color:blue;
}
}
body {
height:100%;
width:100%;
animation:quick 3s;
-moz-animation:quick 3s;
-webkit-animation:quick 3s;
-o-animation:quick 3s;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。