Name | setup() |
---|---|
Examples |
a = 0 def setup(): size(200, 200) background(0) noStroke() fill(102) def draw(): background(0) global a a = (a + 1) % width rect(a, 10, 2, 80) |
Description | The setup() function is called once when the program starts. It's used to define initial enviroment properties such as screen size and background color and to load media such as images and fonts as the program starts. There can only be one setup() function for each program and it shouldn't be called again after its initial execution. Note: Variables declared within setup() are not accessible within other functions, including draw(). |
Syntax | setup() |
Related |
size() loop() noLoop() draw() |
Updated on Mon Sep 21 15:53:25 2020.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License