demo.html

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8"> <title>arc</title>
<script>
function init() {
var canvas=document.getElementById('canvas');
var ctx=canvas.getContext("2d");
ctx.beginPath();
ctx.arc(100,100,80,0,1.5*Math.PI,false);
ctx.closePath();
ctx.fillStyle="#ccc";
ctx.fill();
}
</script>
</head>
<body onload="init();">
<canvas id="canvas" width="400" height="300" style="border:2px blueviolet solid"></canvas>
</body>
</html>

  效果:

定义和用法

arc() 方法创建弧/曲线(用于创建圆或部分圆)。

提示:如需通过 arc() 来创建圆,请把起始角设置为 0,结束角设置为 2*Math.PI。

提示:请使用 stroke() 或 fill() 方法在画布上绘制实际的弧。

  • 中心:arc(100,75,50,0*Math.PI,1.5*Math.PI)
  • 起始角:arc(100,75,50,0,1.5*Math.PI)
  • 结束角:arc(100,75,50,0*Math.PI,1.5*Math.PI)

2017-09-08  12:54:48

最新文章

  1. google觉得好用的插件(不断更新)
  2. eclipse maven plugin 插件 安装 和 配置
  3. 【算法和数据结构】_11_小算法_itoa、ftoa及字符串倒置
  4. Laravel
  5. Failed to instantiate the default view controller for UIMainStoryboardFile &#39;Main&#39;
  6. hdu_3001_Travelling(状压DP)
  7. cglib动态代理举例
  8. 将html table 转成 excel
  9. 获取iframe 内容
  10. linux 清空catalina.out日志 不需要重启tomcat(五种方法)【转】
  11. 把路由器改装成git服务器(OpenWRT环境的GIT服务器搭建)
  12. uiautomatorviewer 查看元素报错: Error taking device screenshot: null 原因
  13. sql server自定义函数学习笔记
  14. Java通过POI读取Excel
  15. Delphi程序的主题(Theme)设置
  16. 机器学习算法(5):卷积神经网络原理及其keras实现
  17. 3.2 x86体系结构
  18. RelativeLayout用代码兑现布局
  19. Web开发中的显示与隐藏
  20. LR11中webservice协议的性能测试应用

热门文章

  1. 阿里云Serverless应用引擎(SAE)3大核心优势全解析
  2. leetcode_1293. Shortest Path in a Grid with Obstacles Elimination_[dp动态规划]
  3. Cluster基础(三):配置HAProxy负载平衡集群、Keepalived高可用服务器、Keepalived+LVS服务器
  4. c++读取数据
  5. day15—jQuery UI之widgets插件
  6. python2.7+RobotFramework的UI自动化环境搭建
  7. rap安装mysql
  8. Vue动态添加响应式属性
  9. 性能工具之JMeter+InfluxDB+Grafana打造压测可视化实时监控
  10. git报错-Initial commit Untracked files nothing added to commit but untracked ……