abstract noise
@author
int layerNum = 10;
color[] layerColors;
void setup(){
size(500, 500);
mousePressed();
}
void mousePressed(){
layerColors = new color[layerNum + 1];
for(int i = 0; i < layerNum + 1; i++){
layerColors[i] = color(random(255), random(255), random(255));
}
PVector offset = new PVector(random(10000), random(10000));
for(int w = 0; w < width; w++){
for(int h = 0; h < height; h++){
float v = mapToQuad(noise(w * 0.005 + offset.x, h * 0.005 + offset.y));
int layer = int(v * layerNum);
stroke(lerpColor(layerColors[layer], layerColors[layer + 1], v * layerNum - layer));
point(w, h);
}
}
}
float mapToQuad(float v){
if(v < 0.5){
return 2.0 * v * v;
} else {
return -2.0 * (v - 1.0) * (v - 1.0) + 1.0;
}
}
void draw(){
}