onload = draw;
function draw() {
var canvas = document.getElementById('canvas');
if (!canvas || ! canvas.getContext) {
return false;
}
var ctx = canvas.getContext('2d');
fillText(ctx,"strokeRect",25,45);
ctx.strokeRect(25,50,150,150);
fillText(ctx,"arc(circle)",225,45);
ctx.beginPath();
ctx.arc(300,130,75,0,Math.PI * 2, true);
ctx.stroke();
fillText(ctx,"arc(quater sector)",25,220);
ctx.beginPath();
ctx.moveTo(25,230);
ctx.lineTo(175,230);
ctx.arc(25,230,150,0,Math.PI * 0.5, false);
ctx.closePath();
ctx.stroke();
}
function fillText(ctx, str, x, y) {
if (ctx.fillText) {ctx.fillText(str, x, y)}
}
function draw() {
var canvas = document.getElementById('canvas');
if (!canvas || ! canvas.getContext) {
return false;
}
var ctx = canvas.getContext('2d');
fillText(ctx,"strokeRect",25,45);
ctx.strokeRect(25,50,150,150);
fillText(ctx,"arc(circle)",225,45);
ctx.beginPath();
ctx.arc(300,130,75,0,Math.PI * 2, true);
ctx.stroke();
fillText(ctx,"arc(quater sector)",25,220);
ctx.beginPath();
ctx.moveTo(25,230);
ctx.lineTo(175,230);
ctx.arc(25,230,150,0,Math.PI * 0.5, false);
ctx.closePath();
ctx.stroke();
}
function fillText(ctx, str, x, y) {
if (ctx.fillText) {ctx.fillText(str, x, y)}
}