Html5:Curves

来自WHY42
imported>Soleverlee2016年6月16日 (四) 06:31的版本 (以“refer:http://www.html5canvastutorials.com/tutorials/html5-canvas-arcs/ =Arc= <source lang="js"> var canvas = document.getElementById('myCanvas'); var context = canva...”为内容创建页面)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

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();