Created
February 5, 2015 14:15
-
-
Save AllThingsSmitty/9f3d6da7a44596025058 to your computer and use it in GitHub Desktop.
Twitter's "fave" animation using CSS steps()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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. */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="fave"></section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment