Assignment 3.1

posted Jun 23, 2010, 9:05 PM by Unknown user

I used the following code to recreate and expand upon mr. dickie's image. The image is drawn in all 4 corners with a grayscale radial gradient in the center, and the line's stroke color is set to the x or y value of the line, resulting in a rainbow type pattern.

Here is the image:

Here is the code:

void setup() {

size(400, 400); //set size to 400 x 400 pixels

background(0,0,0); //set initial background color to black

}

//function to create radial gradient emanating from point (centerx, centery)

void createGSRadialGradient(int centerx, int centery)

{

colorMode(RGB, width); //set mode to rgb from 0 - 400 (screen width)

for(int i = width; i >= 0; i-=1) { //set up for loop, decrement from outside-in