Hey guys! New to Processing and just implementing the basics. This is actually for a project. Nothing spectacular just, an array of colors that change in a loop. The mouse when rolled over a coordinate in the array will reset the color to black. Comments are welcome...go easy on me. Processing is pretty neat.
/* *File: MyGrid *Author: Robert Castro *Date: 10/ 27 / 2010 *Description: An array of changing colors. */
Grid[][] myGrid;
int cols = 15; int rows = 15;
void setup() { size(cols * 20, rows * 20); myGrid = new Grid[cols][rows]; for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { myGrid[i][j] = new Grid(i*20, j*20, 20, 20, i+j, (int)random(0,255), (int)random(0,255)); } } }
void draw() { background(0); for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { myGrid[i][j].changeColor(); myGrid[i][j].display(); } }