xxxxxxxxxx
28
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
noFill();
// a for loop has three parts
// 1 - INITALIZATION
// declaration of a variable (usually is i)
// 2 - TESTING STATEMENT
// statement which tests the variable at each loop
// 3 - UPDATING VARIABLE
// updating the value of i at each loop
for( let i = 0 ; i < width ; i = i + 30){
// this will be evaluated as long as the statement is true
fill(i / 2);
circle(width/2,height/2, width - i);
}
}