Skip to content

Instantly share code, notes, and snippets.

@seanmcgary
Created April 26, 2010 23:37
Show Gist options
  • Save seanmcgary/380094 to your computer and use it in GitHub Desktop.
Save seanmcgary/380094 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<head>
<title>Canvas Tutorial</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function draw(){
//get a reference to the canvas
var canvas = $('#canvas')[0].getContext("2d");
//draw a circle
canvas.beginPath();
// x coord, y coord, radius, start angle, end angle, anticlockwise
canvas.arc(200, 100, 20, 0, Math.PI*2, true);
canvas.closePath();
canvas.fill();
}
</script>
</head>
<body onload="draw()">
<canvas id="canvas" width="500" height="500"></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment