CSS sprite sheet animation

by leethelobster

HTML

<div class="hi"></div>

CSS

.hi {
    width: 315px;
    height: 243px;
    background-image: url("https://secretlocation.atlassian.net/secure/attachment/17523/1960s_activate_optimized.png");
    background-repeat: no-repeat;
    background-position: 0 0;
    
    -webkit-animation: play 1.8s steps(28) forwards;
       -moz-animation: play 1.8s steps(28) forwards;
        -ms-animation: play 1.8s steps(28) forwards;
         -o-animation: play 1.8s steps(28) forwards;
            animation: play 1.8s steps(28) forwards;
}

@-webkit-keyframes play {
   from { background-position:    0px; }
     to { background-position: -8820px; }
}

@-moz-keyframes play {
   from { background-position:    0px; }
     to { background-position: -8820px; }
}

@-ms-keyframes play {
   from { background-position:    0px; }
     to { background-position: -8820px; }
}

@-o-keyframes play {
   from { background-position:    0px; }
     to { background-position: -8820px; }
}

@keyframes play {
   from { background-position:    0px; }
     to { background-position: -8820px; }
}

JavaScript

// Sprite Sheet animation with CSS3 using the steps() feature.
// To change the speed, just edit the ".8s" animation time.

// Post: http://simurai.com/blog/2012/12/03/step-animation/

// Inspired by Lea's typing animation: http://t.co/9RPMmV7