CS 100 Spring 2014
Lab 2
Repetition and Gradient
Due Monday, Februrary, 24th

To review the lecture material refer to the references page on for loop and color mode.

1. [2 pts] Consider the following code that draws many lines. There are 13 calls to the line function: observe the parameters that stay the same and the ones that change.

Write a program called manyLinesLoop.pde that produces the same output using a for loop. Only 3 statements are needed in your program.

2. [4 pts] Write a program manyLinesGrid.pde that uses a for loop to create an output similar to the image below.

The grid should be centered in the window with space all around.

3. [2 pts] Write a program ellipseLoop.pde that creates an output similar to the image below.

4. [2 pts] Consider the following code that creates a rainbow gradient as shown below.

Write a program ellipseRainbow.pde that creates an output similar to the image below.




Bonus Write a program to create a gradient similar to the one shown in the following image.

Once you have successfully made a monochrome gradient change the gradient to color (red or blue or green for example).