Skip to content

Instantly share code, notes, and snippets.

@AllThingsSmitty
Created February 5, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllThingsSmitty/9f3d6da7a44596025058 to your computer and use it in GitHub Desktop.
Save AllThingsSmitty/9f3d6da7a44596025058 to your computer and use it in GitHub Desktop.
Twitter's "fave" animation using CSS steps()
.fave {
width: 70px;
height: 50px;
background: url(http://cssanimation.rocks/assets/images/posts/steps/twitter_fave.png) no-repeat;
background-position: 0 0;
}
.fave:hover {
background-position: -3519px 0;
transition: background 2s steps(55);
}
/* The hover state specifies that the background position be moved to the end of the series of images. The `steps()` timing function is given a value of 55 as there are 55 frames in the animation. Hover jumps through the transition in 55 equal steps. */
<section class="fave"></section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment