Html5:Curves:修订间差异
imported>Soleverlee 以“refer:http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/ =Arc= <source lang="js"> var canvas = document.getElementById('myCanvas'); var context = canva...”为内容创建页面 |
imported>Soleverlee |
||
第1行: | 第1行: | ||
refer:http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/ | refer:http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/ | ||
=Arc= | =Arc= | ||
<source lang=" | <source lang="javascript"> | ||
var canvas = document.getElementById('myCanvas'); | var canvas = document.getElementById('myCanvas'); | ||
var context = canvas.getContext('2d'); | var context = canvas.getContext('2d'); |
2016年6月16日 (四) 06:31的最新版本
refer:http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/
Arc
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var x = canvas.width / 2;
var y = canvas.height / 2;
var radius = 50;
var startAngle = 0;
var endAngle = 2 * Math.PI;
var counterClockwise = false;
context.fillStyle='red';
context.beginPath();
context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
context.lineWidth = 0;
context.fill();
// line color
context.strokeStyle = 'red';
context.stroke();