Created
October 30, 2014 22:16
-
-
Save nateperry/d96b7280bb2800dee1ac to your computer and use it in GitHub Desktop.
This is a simple starter for working with 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
/* | |
Created by Nate Perry | |
http://github.com/nateperry | |
*/ | |
var App; | |
App = { | |
canvas: null, | |
ctx: null, | |
init : function () { | |
App.addEventListeners(); | |
App.setupCanvas(); | |
}, | |
addEventListeners : function () { | |
window.onresize = App.onResize; | |
}, | |
onResize : function () { | |
App.resizeCanvas(); | |
}, | |
setupCanvas : function () { | |
App.canvas = document.getElementById('canvas'); | |
App.ctx = App.canvas.getContext('2d'); | |
App.resizeCanvas(); | |
}, | |
resizeCanvas : function () { | |
App.canvas.height = window.innerHeight; | |
App.canvas.width = window.innerWidth; | |
} | |
}; | |
window.onload = App.init; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment