For this specific scenario, transitioning between frames may not be necessary since they all belong to the same color scheme (white, gray, black). A similar effect (though not identical) can be achieved using font-based icons (e.g., Font Awesome) with the transition
property and changing their color on hover
: jsfiddle
HTML:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
...
...
<div class="icon-circle">
<i class="fa fa-instagram"></i>
</div>
CSS:
.icon-circle {
position: relative;
border-radius: 50%;
width: 512px;
height: 512px;
border: 2rem solid black;
transition: all .8s linear;
}
.icon-circle:hover {
background-color: black;
color: white;
}
.fa-instagram {
font-size: 20rem;
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
}
If you still prefer using images, sprite images can be implemented through CSS animation
with the steps()
property: jsfiddle
HTML:
<div id="instagram"></div>
CSS:
#instagram {
width: 512px; height: 512px;
background: url('http://andreimartalog.com/host/instagram.png') no-repeat;
}
#instagram:hover { animation: enter 0.3s steps(3) forwards; }
@keyframes enter { 100% { background-position: -1536px } }