- Variable p5 is globally declared and initialized right after the library is loaded.
- An instance of p5 is created right after the p5js finds a setup() or draw() in the global context.
- Otherwise, p5js rechecks for their existence onload() event.
- Then preload() & setup() are called back once everything is properly initialized.