記録

勉強したことに関するのノート。見返して分かるようにしてます。

PVectorとは

PVector v1=new PVector(width/2, 10);//(x,y)保存?
PVector v2=new PVector(10, height/2);

void setup() {
  size(100, 100);
  colorMode(HSB, 360, 100, 100);
  background(0, 0, 100);
  noLoop();
}

int r=12;

void draw() {
  fill(0, 100, 100);
  ellipse(v1.x, v1.y, r, r);
  fill(90, 100, 100);
  ellipse(v2.x, v2.y, r, r);
  v2.add(v1);//←なにこれ?
  fill(180, 100, 100);
  ellipse(v2.x, v2.y, r*2, r*2);
//上から2つ目のellipseとの座標の違いが分からない。描画が違うのはなぜ?
}

疑問とか色々コードの中に書いていった。これを解決するのがこれからの課題。わかることは円が書かれることとその位置くらい。

第5回 Processing実習 1 : 動きを生みだす – アニメーションとベクトル | yoppa orgでPVectorというものが紹介されてた。読んだけどよくわからない。とりあえずProcessingのreference見に行った。 PVector \ Language (API) \ Processing 2+のsanpleコードをちょっと整理して変えた。そしてその理解度が上のコード。