Hi im trying to create a ripple using mouse dragged. i have the code but i dont know how to change the color im hopping to have it be random whenever its dragged across, and for it to play music and stop once the mouse is released.
int cols=200;
int rows=200;
float[][] current= new float [cols][rows];
float[][] past= new float [cols][rows];
float damp=0.999;
void setup()
{
size(1000,1000);
cols=width;
rows=height;
current= new float [cols][rows];
past= new float [cols][rows];
}
void draw()
{
background(0);
loadPixels();
for(int i=1;i<cols-1; i++){
for(int j=1; j<cols-1; j++){
current[i][j] = (past[i-1][j]
+past[i+1][j]
+past[i][j-1]+past[i][j+1])/2-
current[i][j];
int b=i+j*cols;
float c=random(255);
current[i][j]=current[i][j]*damp;
pixels[b]= color(current[i][j]);
}
}
updatePixels();
float [][] temp=past;
past=current;
current=temp;
}
void mouseDragged(){
past[mouseX][mouseY]=500;
}