PVector_ellipse05
int num = 500; PVector[] pos; PVector[] vel; color[] c; int d = 50; void setup() { size(500, 500); colorMode(HSB, 360, 100, 100, 100); smooth(); //noStroke(); background(0, 0, 100); pos = new PVector[num]; vel = new PVector[num]; c = new color[num]; for (int i =0; i <num; i ++) { pos[i] = new PVector(random(width), random(height)); c[i] = color(random(360), 80, 80, 50); } } void draw() { noStroke(); fill(0, 0, 100, 10); rect(0, 0, width, height); for (int i =0; i <num; i ++) { float r; r = radians(frameCount); vel[i] = new PVector(cos(r), sin(r)); pos[i].add(vel[i]); stroke(c[i]); ellipse(pos[i].x, pos[i] .y, d, d); r += r +1; } }
授業準備をはじめるつもりが,なぜかProcessingをしてしまった.配列の復習.何も見ないで書いたけど,やはり忘れていたので,最後には前回書いたものをみた.まだまだです.