PVector_curveVertex01
PVector pos; PVector vel; void setup() { size(500, 500); colorMode(HSB, 360, 100, 100, 100); smooth(); noStroke(); background(0, 0, 100); pos = new PVector(width/2, 0); vel = new PVector(0, 5); } void draw() { fill(0, 0, 100, 10); rect(0, 0, width, height); pos.add(vel); fill(random(360), 100, 100); beginShape(); curveVertex(pos.x, pos.y); curveVertex(random(width), random(height)); curveVertex(random(width), random(height)); curveVertex(random(width), random(height)); curveVertex(random(width), random(height)); curveVertex(random(width), random(height)); curveVertex(random(width), random(height)); curveVertex(pos.x, pos.y); endShape(); bound(); } void bound() { if (pos.y < 0 || pos.y > height) { vel.y = - vel.y; } }
想像してものができた.中心のライン移動する点を起点にして図形を描き続ける.curveVertex
をはじめて使った.あとは,mousePressed();
から得た感覚でbound();
というのもをつくってみた.いつもと少しちがうことをした.そして,動いたのでよし.それも,15分程度でできたので,さらによし.