Why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup

Just looking at the error would suggest that there is an issue with one of your variables. P5.js can assign variables before setup, however they do have limitations such as cos and sin can only be used in setup and draw, so if paired with variables called or created outside it might cause a problem. However your issue reminds me of when i declare an object variable without initialisation which then causes a problem later as the program cannot understand it, so i set the object to null.

1 Like