LoginSignup
5
2

More than 5 years have passed since last update.

Processing GenerativeArt入門

Posted at

tri.jpeg

この作品,重要なのは三角形しているけど内側の線はランダムに引かれているところ。
さらによく見ると何層もの三角形が重なっているようになっているところもGood!

ProcessingでGenerativeな作品を作るときに初心者が意識するといいのは

「円や四角形などellipse()やrect()で描ける図形を関数を使って書かない」

これは,先ほどの作品でもそうだけどGenerativeな作品では
「有機性」や「無秩序さ」をうまく表現することが大切で,ellipse()やrect()を使った図形では
決められた関数に従って同じ図形が機械的に生成されてしまうからである。

ellipse()は,短い直線を繋げたり点を円状に配置すると良いだろう。
こうすることで「有機性」や「無秩序さ」を表現するのに重要な「ランダム」や「ノイズ」を使うことができる。
例えば,ellipse()ではただの円しか描くことはできないが,短い直線を繋いで円を作れば直線にノイズを乗せることができる。

おまけ(今回使用した作品のソースコード)

float ang,rad,x,y,radius,centx,centy;
float lastx,lasty;
float r_noise,r_random;
int i;

void setup(){
  size(displayWidth,displayHeight); 
  frameRate(60);
  background(0);

  stroke(255);
  strokeWeight(0.01);

  ang=0;
  radius=1;
  centx=width/2;
  centy=height/2;
  lastx=lasty=-999;
  i=0;
}

void draw(){
  i++;
  for(;ang<=360;){
    rad=radians(ang);
    radius=noise(random(r_noise))*i/2; 
    x=centx+radius*cos(rad);
    y=centy+radius*sin(rad);

    stroke(255,20);
    if(lastx > -999)
    line(lastx,lasty,x,y);

    ang+=120;
    r_noise+=1;
    lastx=x;
    lasty=y;
  }
  ang=120;
}
5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2