VOOZH about

URL: https://www.geeksforgeeks.org/javascript/p5-js-setup-function/

⇱ p5.js setup() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

p5.js setup() Function

Last Updated : 16 Aug, 2023
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. Syntax:
setup()
Below examples illustrate the setup() function in p5.js: Example 1: Output: 👁 image
Example 2:
Output: 👁 Image
Comment