Wednesday, October 31, 2012

Resizing the HTML5 Canvas for different screen sizes

I've been doing some testing with the html5 canvas to fit it to different screen sizes. My idea is to apply responsive design techniques to the canvas,  so that  for game design, for instance, it looks good on any device screen size.

I thought I'd post some demos here. If anyone wants to grab the code, just right-click and view source: Remember to adjust your window size and see what happens.   -   resizes canvas to fit 80% of the screen width and height, displays height and width of canvas   -   detects and displays whether canvas is square, portrait or landscape shaped   -   removes and resizes three elements on the canvas according to screen size

No comments:

Post a Comment