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 Tue Jul 11 06:52:24 2017.
Creative Commons License