I\'m attempting to integrate a p5.js into a webpage that draws upon receipt of a successful response. I want to draw a tree based on a user entering information that becomes a
Your root problem is that while the functions setup()
and draw()
are defined, they are never beeing called.
A more fundamental issue is that you are defining a function inside an if
statement. While Javascript will allow this, it's pretty bad practice. What you'd normally do is define setup()
and draw()
at top or object levels, then call them when you need them.