【发布时间】:2016-09-15 18:56:22
【问题描述】:
所以我遇到的问题是我正在尝试为圆形 html 元素的填充设置动画。圆圈开始是灰色的,用户将提供一个数字,圆圈将通过另一个蓝色圆圈填充到用户指定的原始圆圈的百分比来改变颜色。我无法弄清楚如何动画或创建蓝色圆圈的填充。
HTML
<div class="circle circle-outer-border">
<div class="circle circle-background">
<div class="circle circle-fill"></div>
</div>
</div>
CSS
.circle{
height: 200px;
width: 200px;
-moz-border-radius: 100px;
-webkit-border-radius: 100px;
}
.circle-outer-border{
border: 1px solid black;
}
.circle-background{
border: 20px solid #b1b1b1;
background-color: transparent;
margin-left: -1px; margin-top: -1px /** to make up for outer-border margin**/
}
.circle-fill{
border: 20px solid #147fc3;
background-color: transparent;
margin-left: -21px; margin-top: -21px;
}
所以我有 3 个圆圈,一个仅用于黑色边框,一个仅显示灰色边框,第三个是第三个圆圈,我将使用动画来充当我堆叠的“蓝色填充”它们彼此重叠,以使其具有表盘填充的效果。同样,我只是不确定如何制作动画,有没有办法只显示蓝色圆圈的一部分并不断显示更多,直到它显示整个蓝色圆圈?感谢您的帮助。我正在一个 angularjs 应用程序中编写此代码,但尚未编写 angularjs 代码。
【问题讨论】:
标签: javascript html css angularjs css-transitions