title: Design pattern that implements draw and setup function in p5.js?
body: <p>To start a p5.js or processing sketch we do this</p>
  
  <pre><code>setup() {
     // do setup
  }
  
  draw() {
     // draw each frame
  }
  </code></pre>
  
  <p>How does this work in p5 js. Is there a thread in the background that calls these functions? I'm having trouble understanding how these methods get called. Is this a design pattern? If so, what would this be called?</p>