// resize testrsz=20;// resize button sizefunctionsetup(){// initial 600 wide and 400 highconstcanvas=createCanvas(600,400);varmainElement=document.querySelector('main');canvas.parent(mainElement);textSize(16);}// draw the "toggle full screen" icon in the lower right cornerfunctiondrawResize(){wR=width-rsz;// with less resize button widthhR=height-rsz;// height less resize button widthfill('white');rect(wR,hR,rsz,rsz);stroke('black')line(wR+4,hR+4,wR+4,hR+8);// ul vline(wR+4,hR+4,wR+8,hR+4);// ul hline(width-4,hR+4,width-8,hR+4);// ur vline(width-4,hR+4,width-4,hR+8);// ur hline(wR+4,height-4,wR+4,height-8);// ll vline(wR+4,height-4,wR+8,height-4);// ll hline(width-4,height-4,width-4,height-8);// lr vline(width-4,height-4,width-8,height-4);// lr h}functiondraw(){background('lightgray');drawResize();// draw the full screen togglefill('black')noStroke();text("Window Width: "+str(windowWidth),10,20)text("Window Height: "+str(windowHeight),10,50)}// If the mouse is pressed in the resize box, toggle full-screen mode.functionmousePressed(){if(mouseX>width-rsz&&mouseX<width&&mouseY>height-rsz&&mouseY<height){// get the current value (0,1)letfs=fullscreen();// toggle the valuefullscreen(!fs);}}// this works down to w=500 and h=254functionwindowResized(){// console.log('windowResized', windowWidth, windowWidth);resizeCanvas(windowWidth-20,windowHeight-35);}