generative_noise_if01
float xstart, xnoise, ystart, ynoise; float xstartNoise, ystartNoise; void setup() { size(500, 500); smooth(); background(255); frameRate(6); xstartNoise = random(20); ystartNoise = random(20); xstart = random(10); ystart = random(10); } void draw() { background(255); xstartNoise += 0.01; ystartNoise += 0.01; xstart += (noise(xstartNoise)*0.5) - 0.25; ystart += (noise(ystartNoise)*0.5) - 0.25; xnoise = xstart; ynoise = ystart; for (int y = 0; y <= height; y += 5) { ynoise += 0.1; xnoise = xstart; for (int x = 0; x <= width; x += 5) { xnoise += 0.1; if (frameCount%2 ==0) { drawPoint1(x, y, noise(xnoise, ynoise)); } else { drawPoint2(x, y, noise(xnoise, ynoise)); } } } } void drawPoint1(float x, float y, float noiseFactor) { pushMatrix(); translate(x, y); rotate(noiseFactor*radians(540)); noStroke(); float edgeSize = noiseFactor*35; float grey = 150 + (noiseFactor*120); float alph = 150 + (noiseFactor*120); fill(grey, alph); ellipse(0, 0, edgeSize, edgeSize/2); popMatrix(); } void drawPoint2(float x, float y, float noiseFactor) { pushMatrix(); translate(x+noiseFactor, y+noiseFactor); rotate(noiseFactor*radians(frameCount%360)); stroke(random(255), random(255), random(255)); line(0, 0, 20, 0); popMatrix(); }
久しぶりのスケッチ.3日あげないと久しぶり感がある.今回も写経して,その後,書いたコードを切り替えるためにif
をつかった.