xxxxxxxxxx
29
/* setup is a p5.js function */
function setup() {
createCanvas(400, 400);
}
/* in this user declared function we have
three parameters, parameterOne, parameterTwo and colour as
seen in line 11.
in lines 12 and 13 we call the function circle using those
parameters */
function iHaveParameters(parameterOne, parameterTwo, colour) {
fill(colour);
circle(parameterOne, parameterTwo, 200);
}
/* draw is a p5.js function */
function draw() {
/* background and fill are p5.js functions */
background('indigo');
/* here we call the function iHaveParameters
and pass two arguments, 200 and 200 to be used as
the parameters in the function */
iHaveParameters(200, 200,'hotpink');
}
/* change the arguments in line 24 and observe the results */
/* create other function with parameters and call it
in the draw function */