The setup() function runs when the program starts. It is used to set the initial environment properties such as text-color, screen size, background-color and load the media file such as images and fonts. The program contains only one setup() function. The setup() function can not be called again after its initial execution.
Note: The variable declaration within setup() function can not be access by other functions including draw() function.
Below examples illustrate the setup() function in p5.js:
- ES6 | Environment Setup
- Environment setup for JSP
- How to Setup Browsersync for Web Development in Ubuntu?
- How to Setup View Engine in Node.js ?
- AWS EC2 Instance Setup with Apache Server
- How to Setup Sublime Text 3 for Python in Windows?
- How to Setup Handlebars View Engine in Node.js ?
- How to Setup Atom Editor with all the required Packages?
- Setup API for GeeksforGeeks user data using WebScraping and Flask
- Angular CLI | Angular Project Setup
- How to get the function name inside a function in PHP ?
- PHP | min( ) Function
- PHP | max( ) Function
- CSS min() Function
- p5.js | value() Function
- p5.js | max() function
- p5.js | tan() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.