Skip to content

Instantly share code, notes, and snippets.

@philpoore
Created November 27, 2015 13:17
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 philpoore/ffe0d7bf9ae63562f1c5 to your computer and use it in GitHub Desktop.
Save philpoore/ffe0d7bf9ae63562f1c5 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Canvas Test</title>
</head>
<body>
<canvas id='myGame'></canvas>
<script src='main.js'></script>
</body>
</html>
// get the canvas element
var element = document.getElementById('myGame');
// get 2d context to draw onto
var ctx = element.getContext('2d');
// Draw a black rectange
ctx.fillRect(10, 10, 100, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment