We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am new to p5.js and I want to access a Canvas I created in my index.html and apply the function draw on it, instead of creating a new canvas in the setup function. I tried to saved the Canvas into a variable with getElementById() but to reference to it in the draw function?
Answers
http://p5js.org/reference/#/p5.Element/parent
http://p5js.org/reference/#/p5.Element/id
https://developer.Mozilla.org/en-US/docs/Web/HTML/Element/canvas
new p5(sketch, 'my_canvas_id');
:-??Thank you so much for the info.
I was able to turn the problem around, removed the canvas tag from my html, then made p5 create it, only to find it , create a context and draw a loaded image from the dom. So now it looks better, and feels better to me.
I still miss a clean p5 alternative to the functionality from the drawimage method though. But this will do. An excerpt from my new code: