p5.js
p5.js copied to clipboard
Updating reference for constant variables?
Topic
Looking to open an issue to update the reference/documentation for constant variables (PI, DEGREES, etc.) to mention they cannot be accessed before setUp() is run? I ran into this issue on a project and want to help others find the answer sooner.
New to open source, so please let me know your thoughts!
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!
I don't think that's quite correct. The constants should be available at any point after p5 is instantiated, which means the constants would also be available in the preload function. And that is consistent with the behavior of most other p5 features. You can't call any p5 functions prior to p5 being instantiated.
This should be covered by the FES already (a message will be printed if you tried to use p5.js constants outside of setup or draw with FES enabled) and including this info in the documentation feel a bit redundant, especially when it applies to almost all items in the documentation.
I will close this for now but feel free to continue the discussion if required. Thanks.