generative_noise03
float xstart, xnoise, ynoise; int num = 2; void setup() { size(500, 500); smooth(); background(0); frameRate(1); float xstart =random(10); float xnoise = xstart; float ynoise = random(10); } void draw() { for (int y = 0; y < height; y+=5 ) { ynoise += 0.1; xnoise = xstart; for (int x = 0; x <= width; x +=5) { xnoise += 0.1; num = int(random(0, 2)); switch(num) { case 1: drawPoint0(x, y, noise(xnoise, ynoise)); break; case 2: drawPoint1(x, y, noise(xnoise, ynoise)); break; } } } } void drawPoint0(float x, float y, float noiseFactor) { float len = 10*noiseFactor; rect(x, y, len, len); } void drawPoint1(float x, float y, float noiseFactor) { pushMatrix(); translate(x, y); rotate(noiseFactor*radians(540)); float edgeSize = noiseFactor*35; float grey = 150 + (noiseFactor*120); float alpha = 150+(noiseFactor*120); noStroke(); fill(grey, alpha); ellipse(0, 0, edgeSize, edgeSize/2); popMatrix(); }
switch
をつかって描くパターンを切り替えようとしたけど失敗.最初は3つのパターンの切り替えだったのでswitch
をつかったのだけど,2つのパターンの切り替えだったら別の方法がある気がしている.いずれにしても失敗でした.歯医者のためタイムアップ.