Wednesday, 2 July 2014

Scaling the canvas

I was unsure of what size to make the canvas because I wanted it to take up a large portion of the screen but when scaled down I still wanted the text to be legible. I’m also concerned about how it will look on a tablet, portrait and landscape. I posted on the Adobe forum and asked for some advice, I was told to make my canvas any size and just use the following code:
canvas.style.width = window.innerWidth+"px";
canvas.style.height = window.innerHeight+"px";

This worked however it squashes some elements when viewed portrait so I think I’ll need a fixed height or some way of doing it. I also saw some information about keeping the aspect ratio of the canvas to 4:3 on this website http://blog.toggl.com/2013/05/6-performance-tips-for-html-canvas-and-createjs/

No comments:

Post a Comment