We are about to switch to a new forum software. Until then we have removed the registration on this forum.
To create a sketch in p5, we first create the canvas using function createCanvas(width, height); inside the setup()
Now, if I already have a canvas defined in my HTML having an id #myCanvas, How do I use it in my draw() function to create sketches. In other words, how can I make p5 understand that now it has to draw stuff in #myCanvas?
Answers
https://forum.processing.org/two/discussion/9378/draw-to-an-existing-canvas
https://twitter.com/beesandbombs/status/497463173772242944
Doesn't seem like you can. I would go with the .parent() method to pick a div to put it in. Unless you're okay with your specified canvas being #defaultCanvas.
AFAIK, p5.js always creates its own canvas. 8-|
Easiest thing we can do is to use parent() to move sketch's
<canvas>
to some pre-defined<div>
: :-\"http://p5js.org/reference/#/p5.Element/parent
https://GitHub.com/processing/p5.js/wiki/Positioning-your-canvas