Fill in the grid with colors
in
Programming Questions
•
4 months ago
I'm trying to figure out how to apply a grey color of 127 in the grid when i move the mouse (The function is supposed to be 'mouseMoved' but it doesn't work when I try it on another program). Please help? This is my code. Optional help: I also need to do something where when I key press 'r', it changes the colour to red. Same goes for blue and green.
final int rows = 20, columns = 20;
final int numRect = 20;
void setup(){
background(255);
size(400,400);
}
void draw() {
for (int i = 0; i < columns; i++) {
// Begin loop for rows
for (int j = 0; j < rows; j++) {
int x = i*numRect;
int y = j*numRect;
fill(255);
stroke(0);
rect(x,y,numRect,numRect);
}
}
}
1