http://liamosler.ca/demos/canvasgame/
Just Another Space Game
Demonstrates uses of gradients and canvas animation, interactive environments, 2D gravity simulation, state changes, keyboard inputs, mouse input. Self contained in the html file, open it with a web browser to play the game.