Skip to content

Instantly share code, notes, and snippets.

Created February 17, 2014 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9045259 to your computer and use it in GitHub Desktop.
Save anonymous/9045259 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Canvas tutorial</title>
<script type="text/javascript">
function draw(){
var canvas = document.getElementById('canvas');
if(canvas.getContext)
{
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.moveTo(75, 50);
ctx.lineTo(100, 75);
ctx.lineTo(100, 25);
ctx.fill();
}
}
</script>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body onload="draw();">
<canvas></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment