canvas 绘制环形进度条
结果:

代码:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
body {
text-align: center;
}
canvas {
background: #ddd;
}
</style>
</head>
<body>
<h3>绘制路径——圆形</h3>
<canvas id="c13" width="500" height="400"></canvas>
<script>
var ctx = c13.getContext('2d'); //绘制灰色的背景圆环
ctx.beginPath();
ctx.arc(250,200,100,0, 2*Math.PI);
ctx.lineWidth = 20;
ctx.strokeStyle = '#aaa';
ctx.stroke(); //绘制圆形进度条
var start = -90; //进度条的起始角度
var end = -90; //进度条的终止角度
var t = setInterval(function(){
//此练习中可以省略“清除画布”步骤
ctx.beginPath();
ctx.arc(250,200,100,start*Math.PI/180,end*Math.PI/180);
ctx.strokeStyle = '#0a0';
ctx.stroke(); end += 3;
if(end>270){
clearInterval(t);
}
}, 50)
</script>
</body>
</html>
canvas 绘制环形进度条的更多相关文章
- html5 canvas绘制环形进度条,环形渐变色仪表图
html5 canvas绘制环形进度条,环形渐变色仪表图 在绘制圆环前,我们需要知道canvas arc() 方 ...
- canvas绘制环形进度条
<!DOCTYPE html> <html > <head> <meta http-equiv="content-type" conten ...
- canvas绘制圆形进度条(或显示当前已浏览网页百分比)
使用canvas绘制圆形进度条,或者是网页加载进度条 或者是显示你浏览了本网页多少-- 由于个浏览器的计算差异,打开浏览器时 初始值有所不同,但是当拉倒网页底部时,均显示100%. 兼容性:测试浏览器 ...
- Canvas实现环形进度条
Canvas实现环形进度条 直接上代码: <canvas width="200" height="200" >60%</canvas> ...
- canvas 绘制圆形进度条
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 使用canvas实现环形进度条
html代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> < ...
- CSS3绘制环形进度条
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- canvas环形进度条
<style> canvas { border: 1px solid red; margin: 100px; }</style> <canvas id="rin ...
- iOS带动画的环形进度条(进度条和数字同步)
本篇写的是实现环形进度条,并带动画效果,要实现这些,仅能通过自己画一个 方法直接看代码 为了方便多次调用,用继承UIView的方式 .m文件 #import <UIKit/UIKit.h> ...
随机推荐
- 在Ubuntu上安装Chrome浏览器和ChromeDriver
启动脚本后报错 selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have w ...
- iOS程序的启动过程介绍
大家在学习iPhone开发时候,都会写HelloWorld程序.大家一般都是通过向导,生成项目,然后通过模拟器启动应用程序.但是大家知道其背后的启动过程吗?也就是当点击程序图标启动程序开始到退出程序整 ...
- ado.net(增删改)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- js使用经验之谈
1. js 对象,先有的起作用.CSS属性,后有的起作用. 2. 方法中使用submit提交表单,如果提交后面还有代码需要执行,不能保证顺序.例如,提交后关闭页面,很可能会在提交前关闭页面,导致提交 ...
- C++中char类型的十六进制字符串转换成字节流
如a[5]="1234"转换成a[5]={0x12,0x34} 代码如下: void HexStrToByte(const char* source, unsigned char* ...
- Cookie应用参考
内容来自imooc.
- 检索并打印一个DNS主机条目
检索并打印一个DNS主机条目的 C 程序 --- Linux/Unix /*************************************************************** ...
- Python中求阶乘(factorial)
1. math.factorial(x) import math value = math.factorial(x) 2. reduce函数 def factorial(n): return redu ...
- 织梦DedeCMS实现 三级栏目_二级栏目_一级栏目_网站名称 的效果代码
1.将官方原来的排列方式反过来,找到include/typelink.class.php第164行 $this->valuePositionName = $tinfos['typename']. ...
- PAT1073. Scientific Notation (20)
#include <iostream> using namespace std; string a; int expo; int dotPos; int expoPos; int i; i ...