Processing を体験してみよう
三角関数を使う。cos sin の理解が必要。

processing は https://processing.org/download/ よりダウンロードできるが、ファイルサイズが大きいため、Dojo の時間内に終わらない可能性がある。

そこで、Web で簡単に processing が体験できる https://processin.ga を使う。

以下のコードを実行する。

int size = 40;
float degree;
PVector location;

void setup() {
frameRate(60);
smooth();
background(255);
radius = height / 4.0;
location = new PVector(0, 0);
degree = 0.0;
velocity = 1.0;
}

void draw() {
background(255);
translate(width / 2, height / 2);
location.x = cos(radians(degree)) * radius;
location.y = sin(radians(degree)) * radius;
ellipse(location.x, location.y, size, size);
degree += velocity;
}

QR コードを読み取ることで、スマホ上に表示することもできる。

サンプルプログラム

cdc/kokuryou (username/pw)