我想在分组进度条中添加动画,每个进度条从0加载到它的值。例如在下面的示例代码中,我想先加载红色进度条,然后加载绿色进度条。我怎样才能做到这一点?加载每个进度条从0到它的值在多个进度条动画
请检查this jsfiddle中的代码。
HTML:
<div class="progress-bar-outer">
<div class="progress-bar-inner">
</div>
<div class="progress-bar-inner2">
</div>
</div>
CSS:
.progress-bar-outer {
width: 300px;
height: 40px;
flex: auto;
display: flex;
flex-direction: row;
border-radius: 0.5em;
overflow: hidden;
background-color: gray;
}
.progress-bar-inner {
/* You can change the `width` to change the amount of progress. */
width: 75%;
height: 100%;
background-color: red;
}
.progress-bar-inner2 {
/* You can change the `width` to change the amount of progress. */
width: 50%;
height: 100%;
background-color: green;
}
.progress-bar-outer div {
animation:loadbar 3s;
-webkit-animation:loadbar 3s;
}
@keyframes loadbar {
0% {width: 0%;left:0;right:0}
}
使用拖延和不透明度将让你得到绿色的酒吧,在那里你想让它开始,你可以通过我的答案... HTTPS看到://计算器。 com/a/45148563/2720927 –