Created
November 27, 2015 13:17
-
-
Save philpoore/ffe0d7bf9ae63562f1c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Canvas Test</title> | |
</head> | |
<body> | |
<canvas id='myGame'></canvas> | |
<script src='main.js'></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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