xxxxxxxxxx
int black=-16777216; //get() returns an int to represent color so using this to compair pixel colors lets us get colors with a red value of 0;
void setup(){
//size(700,700);
fullScreen();
reset();
}
void draw(){
for(int m=0;m<width*height;m++){
int a = floor(random(1,width));
int b = floor(random(1,height));
if((get(a,b))!=black){// if pixel is not black
int c = floor(random(0,4));// one of 4 directions
int d = 0;// an x offset for direction
int e = 0;// an y offset for direction
if(c==0){// assign x and y offsets
d=1;
e=0;
}else if(c==1){
d=0;
e=1;
}else if(c==2){
d=-1;
e=0;
}else if(c==3){
d=0;
e=-1;
}
if((get(a+d,b+e)==black)&&((a+d>0)&&(b+e>0)&&(a+d<width)&&(b+e<height))){// if the target is inside screen and is black
int ran = 10;// makes the color change
color clr = get(a,b);//
int re = int(constrain(red(clr)+random(-ran,ran),0,255));
int gr = int(constrain(green(clr)+random(-ran,ran),0,255));
int bu = int(constrain(blue(clr)+random(-ran,ran),0,255));
set(a+d,b+e,color(re,gr,bu));
}
}
}
}
void keyPressed(){
if(key==' '){
reset();
}
}
void reset(){
background(0);
noFill();
stroke(255,135,0);// orange
//stroke(random(255),random(255),random(255));
point(width/2,height/2);
}