keyPressed Help

to avoid the fast change of colors make aColor a global variable (define it before setup()) and say in a new function mousePressed() :

void mousePressed() {
       aColor = color( random(255),random(255),random(255) );
}

Delete this from draw()

color aColor = color( random(255),random(255),random(255) );

1 Like