I want an ionicon (guess its SVG) to iteratively change color. I tried the following, but it only shows the svg icon in purple:
element
<a class="ion-social-twitter button-home"></a>
css
.button-home {
fill: #fff;
-webkit-animation: animation-button 20000ms infinite;
-moz-animation: animation-button 20000ms infinite;
-o-animation: animation-button 20000ms infinite;
animation: animation-button 20000ms infinite;
font-size: 25vh;
}
@-webkit-keyframes animation-button {
0% {fill:red; }
25% {fill:yellow; }
50% {fill:blue; }
75% {fill:green; }
100% {fill:red; }
}
@keyframes animation-button {
0% {fill:red; }
25% {fill:yellow; }
50% {fill:blue; }
75% {fill:green; }
100% {fill:red; }
}
You use ionicons as font. Just change the fill
to color
, like this -
@-webkit-keyframes animation-button {
0% {color:red; }
25% {color:yellow; }
50% {color:blue; }
75% {color:green; }
100% {color:red; }
}
@keyframes animation-button {
0% {color:red; }
25% {color:yellow; }
50% {color:blue; }
75% {color:green; }
100% {color:red; }
}
Here a demo with Bootstrap Glyphicons.