CSS3 webkit-progress-bar 动画背景位置
CSS3 webkit-progress-bar animate background-position
我正在寻找一个可行的解决方案,以 animate background-position
属性 of an html5 progress element in webkit/blink.
HTML:
<progress max="100" value="0"></progress>
CSS:
progress[value]::-webkit-progress-bar {
-webkit-animation: moveBackground 2s steps(30) infinite;
background-image: repeating-linear-gradient(to right, green 0%, orange 50%, blue 100%);
background-size: 30rem;
}
@-webkit-keyframes moveBackground
{
0% {
background-position: 0 0;
}
100% {
background-position: -50rem 0;
}
}
Fiddle: https://jsfiddle.net/6gekeegg/
不过,gecko支持background-position
属性的动画,简单例子:
progress[value] {
...
}
我正在寻找一个可行的解决方案,以 animate background-position
属性 of an html5 progress element in webkit/blink.
HTML:
<progress max="100" value="0"></progress>
CSS:
progress[value]::-webkit-progress-bar {
-webkit-animation: moveBackground 2s steps(30) infinite;
background-image: repeating-linear-gradient(to right, green 0%, orange 50%, blue 100%);
background-size: 30rem;
}
@-webkit-keyframes moveBackground
{
0% {
background-position: 0 0;
}
100% {
background-position: -50rem 0;
}
}
Fiddle: https://jsfiddle.net/6gekeegg/
不过,gecko支持background-position
属性的动画,简单例子:
progress[value] {
...
}