Koło i okrąg
Koło z konturem rysujemy, używając poleceń stroke()
i fill()
.
Listing
var cv = document.getElementById("canvas"); var ctx = cv.getContext("2d"); ctx.beginPath(); var x = 200; var y= 150; var radius= 100; var startAngle = 2*Math.PI; var endAngle = 0; var counterClockwise = false; ctx.arc(x, y, radius, startAngle, endAngle, counterClockwise); ctx.lineWidth = 5; ctx.strokeStyle = "#000000"; ctx.stroke(); ctx.fillStyle = "#00aaff"; ctx.fill();