Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

Perlin RGB

/**
* Perlin RGB
*
* @author aa_debdeb
* @date 2015/08/28
*/

// step size for color
float cStep = 0.01;
// bias for eatch RGB color
float[] cBias = {0.0, 100.0, 200.0};

float t = 0.0;
// step size for time
float tStep = 0.05;

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

void draw(){
  loadPixels();
  for(int h = 0; h < height; h++){
    for(int w = 0; w < width; w++){
      float r = noise(w * cStep + cBias[0], h * cStep + cBias[0], t) * 255;
      float g = noise(w * cStep + cBias[1], h * cStep + cBias[1], t) * 255;
      float b = noise(w * cStep + cBias[2], h * cStep + cBias[2], t) * 255;
      pixels[h * width + w] = color(r, g, b);
    }
  }
  updatePixels();
  t += tStep;
}