Watch Fun Programming [ video 23]
Here’s a program I wrote:
size(500,500);
background(0);
colorMode(HSB);
fill(0,255,255);
rect(0,250,40,40);
fill(25,255,255);
rect(50,250,40,40);
fill(50,255,255);
rect(100,250,40,40);
fill(75,255,255);
rect(150,250,40,40);
fill(100,255,255);
rect(200,250,40,40);
fill(125,255,255);
rect(250,250,40,40);
fill(150,255,255);
rect(300,250,40,40);
fill(175,255,255);
rect(350,250,40,40);
fill(200,255,255);
rect(400,250,40,40);
fill(225,255,255);
rect(450,250,40,40);
Change the program to use a while loop (Hint - put the “fill” and the “rect” inside the while loop and use a variable e.g... “fill(i*25, 255,255)”
Now change the program to draw 100 rectangles in the rainbow:
Show a mentor, mark the board and get a prize.