rotate_rects02
int step = 50; void setup() { size(500, 500); colorMode(HSB, 360, 100, 100, 100); frameRate(12); noStroke(); smooth(); } void draw() { for ( int y = 0; y < height; y += step) { for ( int x = 0; x < width; x += step) { pushMatrix(); translate(x, y); fill(random(0, 360), 100, 100, 20); rotate(sin(frameCount)); rect(0, 0, step, step); popMatrix(); } } }
昨日,高尾さんに習ったtranslate
rotate
を復習.translate
を使って,タイル状に四角を描いて,四角をrotate
させて動きをつけて,最後に色をつけてみた.1ステップずつ,確かめながらやっていくことで,translate
と rotate
のことがわかりつつある.