I have a p5.js canvas on my website, contained within a canvasDiv class, and I have a script that goes to the website and clicks the canvas, which downloads it etc. How do I scale down the canvas so that it doesn't take up most of the screen, while still keeping the 1000x1000px resolution? Thanks and have a good day!
HTML
<div id="canvasDiv">
<script src="sketch.js" id="astrum"></script>
<script src="functions.js"></script>
<script src="shapes.js"></script>
</div>
CSS
#canvasDiv {
display: block;
width: 1000px;
padding-left: 0;
padding-right: 0;
margin-left: auto;
margin-right: auto;
font-family: 'Source Code Pro', monospace;
}
JS
function setup() {
const myCanvas = createCanvas(1000, 1000);
myCanvas.parent('canvasDiv');
background(40);
angleMode(DEGREES);
rectMode(CENTER);
noStroke();
}
function mousePressed(){
if(mouseX > 0 && mouseX < width){
if(mouseY > 0 && mouseY < height){
save("AM.png");
}
}
}