I'm trying to animate a simple fade in/out for a toolbar background color in firefox (themeing). Problem is, my color fades completely out to transparent. I would prefer my color to fade about half way then start easing back to full color.
I listed the code I've tried...
toolbar{
animation-name: animation;
animation-duration: 5s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-play-state: running;
}
@keyframes animation {
50.0% {background-color:red;}
}
I've tried fiddling around with opacity settings with no luck. Any help is appreciated.
You can use the CSS3 transition property to smoothly animate the background-color of an element on mouseover, such as a hyperlink or a button.
An animation lets an element gradually change from one style to another. You can change as many CSS properties you want, as many times as you want. To use CSS animation, you must first specify some keyframes for the animation. Keyframes hold what styles the element will have at certain times.
@-webkit-keyframes animation {
0% {background-color:red;}
50.0% {background-color:#ff6666;} /* your chosen 'mid' color */
100.0% {background-color:red;}
}
@keyframes animation {
0% {background-color:red;}
50.0% {background-color:#ff6666;}
100.0% {background-color:red;}
}
JSfiddle Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With