I'm trying to animate a sprite image, and found this great example:
Blog: http://simurai.com/blog/2012/12/03/step-animation/ (has succumbed to linkrot).
Wayback Machine: http://web.archive.org/web/20140208085706/http://simurai.com/blog/2012/12/03/step-animation/
Code Fiddle: https://codepen.io/simurai/pen/tukwj
JSFiddle: http://jsfiddle.net/simurai/CGmCe/
.hi { width: 50px; height: 72px; background-image: url("http://s.cdpn.io/79/sprite-steps.png"); -webkit-animation: play .8s steps(10) infinite; -moz-animation: play .8s steps(10) infinite; -ms-animation: play .8s steps(10) infinite; -o-animation: play .8s steps(10) infinite; animation: play .8s steps(10) infinite; }
@-webkit-keyframes play { from { background-position: 0px; } to { background-position: -500px; } }
@-moz-keyframes play { from { background-position: 0px; } to { background-position: -500px; } }
@-ms-keyframes play { from { background-position: 0px; } to { background-position: -500px; } }
@-o-keyframes play { from { background-position: 0px; } to { background-position: -500px; } }
@keyframes play { from { background-position: 0px; } to { background-position: -500px; } }
I'd like to do the same thing, but using a square (power-or-two sized) image atlas instead of an animation strip. For example, this one: