首页htmlspriteAnimation - 如何创建sprite表动画

Animation - 如何创建sprite表动画

我们想知道如何创建sprite表动画。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.motion {
  width: 200px;
  height: 200px;
  background-image: url("http://www.w3cschool.cn/style/download.png");
  -webkit-animation: play 1.8s steps(15) infinite;
  -moz-animation: play 1.8s steps(15) infinite;
  -ms-animation: play 1.8s steps(15) infinite;
  -o-animation: play 1.8s steps(15) infinite;
  animation: play 1.8s steps(15) infinite;
}

@-webkit-keyframes play {
   from { background-position:0px;}
   to {background-position: -1050px;}
}
@-moz-keyframes play {
   from { background-position:0px;}
   to {background-position: -1050px;}
}
@-ms-keyframes play {
   from { background-position:0px;}
   to {background-position: -1050px;}
}
@-o-keyframes play {
   from { background-position:0px;}
   to {  background-position: -1050px;}
}
@keyframes play {
    from { background-position:0px;}
    to {background-position: -1050px;}
}
</style>
</head>
<body>
  <div class="motion"></div>
</body>
</html>