选中此项,您可以使用svg
它适用于strokeoffset
。只需点击中心并输入一个值
$('input').keyup(function(){
var val=$(this).val()
val=parseInt(val);
$('.path').css('stroke-dashoffset',(val*-315/100))
})
.path {
fill:none;
stroke-dasharray: 800;
stroke-dashoffset: 0;
transition:.5s all;
}
input{
width:50px;
height:50px;
border-radius:50%;
position:absolute;
margin-left:170px;
margin-top:70px;
font-size:30px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="text" maxlength="3"/>
<svg width="1100" height="800">
<circle cx="200" cy="100" r="50" stroke-width="50" stroke="cornflowerblue" fill="none"/>
<circle cx="200" cy="100" r="50" stroke-width="50" stroke="black" class="path"/>
</svg>
也许你可以阅读教程,并尝试建立,也可以下载源代码。 http://tympanus.net/codrops/2014/04/09/how-to-create-a-circular-progress-button/ – 2015-02-08 18:49:41
是的,我把上面的链接。我正在寻找类似但更简单的动画。谢谢@托尼巴恩斯 – 2015-02-08 19:05:29