CSS背景颜色关键帧动画

标签 css firefox animation

我正在尝试为 firefox(主题)中的工具栏背景颜色设置一个简单的淡入/淡出动画。问题是,我的颜色完全变透明了。我希望我的颜色褪色一半左右,然后开始逐渐变回全色。

我列出了我试过的代码...

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;}
}

我试过摆弄不透明度设置,但没有成功。感谢您的帮助。

最佳答案

@-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

关于CSS背景颜色关键帧动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24363205/

相关文章:

javascript - 修改 jParallax 滚动

javascript - imgAreaSelect JQuery插件Resizable Div的最小宽高

firefox - 是否可以通过插件在 Firefox 上设置配置设置

javascript - 一起运行多个 jquery 函数

html - 避免移动版左侧出现白色竖线

javascript - hypernator.js : How to only hyphenate words that overflow container?

c# - iMacros (Firefox) 通过 C# 控制

html - 为什么菜单出现在 Chrome 和 FireFox 中,而 IE 中没有?

css - 汉堡菜单 : Animation in CSS (Rotate and Transform of "two" lines)

c++ - C++空间入侵者:在屏幕上准确移动入侵者阵列