int w, h, gs = 2;
float minNoiseX = 0, maxNoiseX = 3;
float minNoiseY = 0, maxNoiseY = 3;
void setup() {
size(100,100);
w = width / gs;
h = height / gs;
frameRate(2);
}
void draw() {
for(int row = 0; row < h; row++) {
for(int col = 0; col < w; col++) {
int x = col*gs, y = row * gs;
float v = noise(map(x,0,width,minNoiseX,maxNoiseX),map(y,0,height,minNoiseY,maxNoiseY));
float distanceFromCenter = dist(x,y,width/2,height/2);
float v2 = map(distanceFromCenter,0,width/2 * sqrt(2),1,.5);
fill(noiseToColor(v*v2));
noStroke();
rect(x,y,gs,gs);
}
}
}
color noiseToColor(float v) {
v = map(v,0,1,0,100);
if(v < 30) {
return color(0,0,255);
}else if(v<40) {
return color(100,100,255);
}else if(v<43) {
return color(200,200,100);
}else if(v<48) {
return color(255,180,30);
}else if(v<55) {
return color(100,255,100);
}else if(v<75) {
return color(0,100,0);
}else{
return color(255);
}
}