Daily Creative Coding

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

地獄の太陽

/**
* evil sun
* 
* @author aa_debdeb
* @date 2016/06/06
*/

PVector xStart, yStart;

void setup(){
  size(500, 500);
  noStroke();
  xStart = new PVector(random(1000), random(1000), random(1000));
  yStart = new PVector(random(1000), random(1000), random(1000));
}

void draw(){
  colorMode(RGB, 255, 255, 255);
  background(255, 240, 245);
  colorMode(HSB, 360, 100, 100);
  translate(width / 2, height / 2);
  for(float radious = 200; radious >= 0; radious -= 3){
    float sat = map(sq(radious), 0, sq(200), 0, 100);
    fill(0, sat, 100);
    beginShape();
    for(float radian = 0; radian < TWO_PI; radian += PI / 128){
      float xOffset = radious * cos(radian);
      float yOffset = radious * sin(radian);
      float xNoise = map(noise(xOffset + xStart.x, yOffset + xStart.y, frameCount * 0.01 + xStart.z), 0, 1, -50, 50);
      float yNoise = map(noise(xOffset + yStart.x, yOffset + yStart.y, frameCount * 0.01 + yStart.z), 0, 1, -50, 50);      
      float x = xOffset + xNoise;
      float y = yOffset + yNoise;
      vertex(x, y);    
    }
    endShape(CLOSE);
  }
}