How can i place the canvas inside a div tag? It always creates at the bottom of the body in the html and i want to put it inside a div.
function setup() {
createCanvas(400, 400);
audioContext = getAudioContext();
mic = new p5.AudioIn();
mic.start(listening);
}
i tried putting the function in the html under a div however it sill placed the canvas outside the div.
createCanvas()
returns p5.Renderer. You can attach the canvas to a parent()
element:
<div id="my_canvas"></div>
let my_canvas = createCanvas(400, 400);
my_canvas.parent('my_canvas')