How do I get the ProcessingJS canvas to span an etnire webpage?

Maybe I just missed something, but every time I see a site using ProcessingJS, I need to set "Size (x, y)" to create a work area inside the canvas. I'm sure the canvas height and width can use CSS to set the values ​​to 100%, but I can't find a way to make the size of the renderable area inside the canvas a solid canvas even when the user resizes the browser window.

My plan is to use ProcessingJS's drawing feature to create a non-removable background for a web page, but perhaps I'm approaching this from the wrong angle. Any help or advice would be appreciated, even if it helps me learn how to use a different library.

+3


source to share


1 answer


Try the following:

var w = window.innerWidth;
var h = window.innerHeight;

      



Then use these values ​​to set x and y.

+1


source







All Articles