我想在分組進度條中添加動畫,每個進度條從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 –