canvas 画图扇形
2015-05-26 11:05
148 查看
//扇形 CanvasRenderingContext2D.prototype.sector = function(x, y, radius, sDeg, eDeg) { // 初始保存 this.save(); // 位移到目标点 this.translate(x, y); this.beginPath(); // 画出圆弧 this.arc(0, 0, radius, sDeg, eDeg); // 再次保存以备旋转 this.save(); // 旋转至起始角度 this.rotate(eDeg); // 移动到终点,准备连接终点与圆心 this.moveTo(radius, 0); // 连接到圆心 this.lineTo(0, 0); // 还原 this.restore(); // 旋转至起点角度 this.rotate(sDeg); // 从圆心连接到起点 this.lineTo(radius, 0); this.closePath(); // 还原到最初保存的状态 this.restore(); return this; }
相关文章推荐
- html5<canvas>画图
- android画图之canvas
- 玩转html5<canvas>画图
- HTML5 Canvas实现web画图
- canvas.drawText() 文本画图
- html5 (canvas) +css+js 实现画图工具
- html5 Canvas画图教程(1)―画图的基本常识
- Android画图之抗锯齿 paint 和 Canvas 两种方式
- 玩转html5<canvas>画图
- html5 canvas画图之图形随拖动而复制(有操作指示)
- canvas 画图(有点想法版)
- 简单聊聊CANVAS画图
- JavaScript基础——使用Canvas画图
- HTML5中canvas画图之画圆形
- Canvas -画图
- [转]html5 Canvas画图4:填充和渐变
- Android画图之抗锯齿 paint 和 Canvas 两种方式
- canvas实战之一(画图,矩阵转换,定时)
- WPF InkCanvas 画图 基础使用教程
- Html5 Canvas+Javascript实现一个简单画图程序(一)