Daily Creative Coding

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

One Stroke Bezier

/**
* One Stroke by Bezier
*
* @author aa_debdeb
* @date 2015/08/24
*
*/

void setup(){
  size(500, 500);
  smooth();
  background(0);
  
  noFill();
  stroke(255);
  strokeWeight(0.5); 
  float x1 = 0;
  float y1 = 0;
  float cx1 = 0;
  float cy1 = 0;
  float x2 = 0;
  float y2 = 0;
  float cx2 = 0;
  float cy2 = 0;
  for(int i = 0; i < 100; i++){
    if(i == 0){
      x1 = random(width);
      y1 = random(height);
    } else {
      x1 = x2;
      y1 = y2;
    }
    cx1 = random(width);
    cy1 = random(height);
    x2 = random(width);
    y2 = random(height);
    cx2 = random(width);
    cy2 = random(height); 
    bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
  }
  
}