这篇文章主要介绍“怎么用CSS3+Sprite实现僵尸行走动画特效”,在日常操作中,相信很多人在怎么用CSS3+Sprite实现僵尸行走动画特效问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么用CSS3+Sprite实现僵尸行走动画特效”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
植物大战僵尸游戏相信大家都玩过吧,那么具体实现代码大家知道吗,下面小编给大家分享代码,在没分享代码之前先给大家展示下效果图:
css代码:
代码如下:
@charset "utf-8";
*{
padding:0px;
margin:0px;
}
body,html {
width:100%;
height:100%;
margin:0px;
padding:0px;
font-family: "Roboto", sans-serif;
font-size: 12px;
font-weight: 700;
}
body{
position:relative;
background: transparent url("../img/background.jpg") no-repeat scroll center top / cover;
background-attachment:fixed;
}
.zoombie {
width: 200px;
height: 312px;
background-image: url("../img/walkingdead.png");
-webkit-animation: play 1.8s steps(10) infinite;
-moz-animation: play 1.8s steps(10) infinite;
-ms-animation: play 1.8s steps(10) infinite;
-o-animation: play 1.8s steps(10) infinite;
animation: play 1.8s steps(10) infinite ;
}
@-webkit-keyframes play {
from { background-position: 0px; }
to { background-position: -2000px; }
}
@-moz-keyframes play {
from { background-position: 0px; }
to { background-position: -2000px; }
}
@-ms-keyframes play {
from { background-position: 0px; }
to { background-position: -2000px; }
}
@-o-keyframes play {
from { background-position: 0px; }
to { background-position: -2000px; }
}
@keyframes play {
from { background-position: 0px; }
to { background-position: -2000px; }
}
#wrapper {
transform: translate(-50%, -50%);
position: absolute;
top: 50%;
left: 50%;
}
到此,关于“怎么用CSS3+Sprite实现僵尸行走动画特效”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程网网站,小编会继续努力为大家带来更多实用的文章!