copy from node-drawing-game project::http://tutorialzine.com/2012/08/nodejs-drawing-game/