分别使用了left和transform在2秒内向右平移了500px的位移。代码如下:
style >
.box-ps,.box-tf { position : absolute ; top : 0 ; left : 0 ; width : 100px ; height : 100px ; background-color : red ; }
.box-ps { -webkit-animation : box-ps 2s linear ; }
.box-tf { -webkit-animation : box-tf 2s linear ; }
@-webkit-keyframes box-ps {
0%{
left : 0 ;
} 100% {
left : 500px ;
}
}
@-webkit-keyframes box-tf {
0%{
-webkit-transform : translate(0,0) ;
} 100% {
-webkit-transform : translate(500px,0) ;
}
}
style >
body >
div class ="box-ps" > div >
div class ="box-tf" > div >
body >
查看更多关于css属性的选择对动画性能的影响-dehua.Chen的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did115680