showing results for - "how to save in p5 js"
Linda
30 Jan 2021
1// note that this example has the same result as above
2// if no canvas is specified, defaults to main canvas
3function setup() {
4let c = createCanvas(100, 100);
5background(255, 0, 0);
6saveCanvas('myCanvas', 'jpg');
7
8// all of the following are valid
9saveCanvas(c, 'myCanvas', 'jpg');
10saveCanvas(c, 'myCanvas.jpg');
11saveCanvas(c, 'myCanvas');
12saveCanvas(c);
13saveCanvas('myCanvas', 'png');
14saveCanvas('myCanvas');
15saveCanvas();
16}