p5.js functions not working on ajax success

后端 未结 1 1250
误落风尘
误落风尘 2021-01-28 13:41

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

相关标签:
1条回答
  • 2021-01-28 14:02

    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.

    0 讨论(0)
提交回复
热议问题