PVector_ellipse03
PVector pos; PVector vel; PVector fri; void setup() { size(500, 500); colorMode(HSB, 360, 100, 100); smooth(); noStroke(); pos = new PVector(width/2, 0); vel = new PVector(0, 1); fri = new PVector(0, 0); } void draw() { fill(0, 0, 100); rect(0, 0, width, height); pos.add(vel); vel.add(fri); fill(80, 100, 100); ellipse(pos.x, pos.y, 30, 30); vel.y += 0.01; fri.y += 0.0001; if (pos.y< 0 || pos.y > height) { vel.y = - vel.y; pos.x = random(width); } }
バウンドする感じをつくりたかった.何も見ないでここまで出来たのは,この夏の成果といっていいかもしれない.頭のなかでなにがどう変わったのかはまだ意識できないけれど,とりあえず何も見ないでProcessingのコードを書く領域の土台が出来てきた感じがある.明日からは,配列をやろう.