开源实现:https://github.com/lugolabs/circles

自行实现:圆环与svg画布间剩的空间太多。

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<title>圆环进度条</title>
<style type="text/css">
circle{
-webkit-transition: stroke-dasharray .25s;
transition: stroke-dasharray .25s;
}
</style>
<script>
window.onload = function () {
if (window.addEventListener) {
var range = document.querySelector("#range");
var circle = document.querySelectorAll("circle")[1];
if (range && circle) {
range.addEventListener("change", function () {
console.log(this.value,2*Math.PI*50);
var percent = this.value / 100, lineLength = 2*Math.PI * 50;
circle.setAttribute('stroke-dasharray', lineLength* percent + " " + lineLength * (1 - percent));
});
}
}
}
</script>
</head>
<body>
<svg width="200" height="200">
<circle cx="100" cy="100" r="50" stroke-width="10" stroke="#D1D3D7" fill="none"></circle>
<circle cx="100" cy="100" r="50" stroke-width="10" stroke="#00A5E0" fill="none" stroke-dasharray="0 50">
</circle>
</svg>
<p>拖我:<input id="range" type="range" min="0" max="100" value="0" style="width:300px;"></p>
</body>
</html>

最新文章

  1. 使用 PowerDesigner 和 PDMReader 逆向生成 MySQL 数据字典
  2. 深入理解PHP内核(八)变量及数据类型-预定义变量
  3. spring + redis 实现数据的缓存
  4. AX Dynamic 2012 tabletype:TempDB使用
  5. java 12 - 5 带有缓冲区的字符流
  6. jszs 历史管理
  7. 【百度地图API】JS版本的常见问题
  8. 搜索-hdu-3720-Arranging Your Team
  9. Hadoop学习之HBase和Hive的区别
  10. UIButton 中高亮取消
  11. ssm maven spring AOP读写分离
  12. iptables nat及端口映射
  13. poj1183 反正切函数
  14. centos7之zabbix服务器的常规优化
  15. 请求http页面的相关过程
  16. indexOf实现引申出来的各种字符串匹配算法
  17. windows下解决端口被占用的问题
  18. Going deeper with convolutions 这篇论文
  19. Thinkphp---自定义服务类!
  20. HTML5的拖放事件

热门文章

  1. [Beta]第八次 Scrum Meeting
  2. 第06组 Beta冲刺(4/5)
  3. 关于资源获取(请把https改为http)
  4. 请写出css3样式的优先级,并排序
  5. linux 的 两种磁盘扩容
  6. git - 3.分支
  7. 【JS】AJAX跨域-被调用方与调用方解决方案(二)
  8. 零起点Python大数据与量化交易
  9. java判断手机还是电脑访问
  10. Kafka生产者性能优化之吞吐量VS延迟