11


float increment = 0.01;
float zoff = 0.0;
float zincrement = 0.02;

void setup(){
size(400,400);
frameRate(30);
}

void draw(){
background(0);
//optional:adjust noise detail here
// noiseDetail(8,0.65f);

loadPixels();

float xoff = 0.0;
//for every x,y coordinate in a 2D space,calculate a noise value
for(int x = 0; x < width; x ++){
xoff += increment;
float yoff = 0.0;
for(int y =0; y < height; y++){
yoff += increment;

float bright = noise(xoff,yoff,zoff)*255;
//float bright = random(240,255);
pixels[x+y*width] = color(bright-20,0,bright);
}
}
updatePixels();

zoff += zincrement;

}

コメント