Daily Creative Coding

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

斜め線

/**
* slanting lines
*
* @author aa_debdeb
* @date 2016/08/21
*/

float e = 2;

void setup(){
  size(500, 500);
  noStroke();
  mousePressed();
}

void draw(){}

void mousePressed(){
  background(random(255), random(255), random(255));
  fill(random(255), random(255), random(255));
  boolean[] rule = new boolean[20];
  for(int i = 0; i < 20; i++){
    rule[i] = random(1) < 0.5;
  }
  for(int x = 0; x * e < width; x++){
    for(int y = 0; y * e < height; y++){
      if(rule[(x + y) % 20]){
        rect(x * e, y * e, e, e);
      }
    }
  }
}
f:id:aa_debdeb:20160816104127j:plain