Created
May 22, 2012 19:27
-
-
Save lean8086/2771108 to your computer and use it in GitHub Desktop.
Set the 2D context of a canvas
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
var context = (function () { | |
"use strict"; | |
// Get the HTML Canvas element | |
var canvas = document.querySelector("canvas"); | |
// Set canvas size | |
canvas.width = 200; | |
canvas.height = 200; | |
// Return context | |
return canvas.getContext("2d"); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment