radius_lines01
void setup() { size(500, 500); colorMode(HSB, 360, 100, 100, 100); background(0, 0, 100); strokeWeight(1); frameRate(10); smooth(); } void draw() { float radius = 5; int centx =width/2; int centy = height/2; float x, y; float lastx = -999; float lasty = -999; float radiusNoise = random(10); for (float ang = 0; ang <= 360*10; ang += 5) { radiusNoise += 0.05; radius += 0.5; float thisRadius = radius + (noise(radiusNoise) * 200) - 100; float rad = radians(ang); x = centx + (thisRadius * cos(rad)); y = centy + (thisRadius * sin(rad)); if (lastx > -999) { stroke(360%radiusNoise, 80, 80); line(x, y, lastx, lasty); stroke(100, 80%radiusNoise, 80); line(y, x, lasty, lastx); } lastx = x; lasty = y; } } void mousePressed() { fill(0, 0, 100); rect(0, 0, width, height); }
教科書にした『ジェネラティブ・アート』に戻って,「円を描く間違った方法」をやってみた.一度,教科書を写経して,その後,void setup
void draw
で書き直した.しばらくは,教科書に沿ってやってみようかな.
写経をしているときに,頭がはたらかない.テキストの写経のときは,どこか頭が働いていて,その後,どうするかということが無意識で動いている感じがあるけれど,コードの写経においては,頭は真っ白な感じがある.プログラミングに慣れてきたら,コードを写経しているときに,次のことが意識的でも,無意識的でも思い浮かぶのだろうか.