Processing資料(4) アニメーション

6
アニメーション Processing資料(4)

Transcript of Processing資料(4) アニメーション

Page 1: Processing資料(4) アニメーション

アニメーション

Processing資料(4)

Page 2: Processing資料(4) アニメーション

円が動くアニメーション

int x = 0;

void setup() { size(400, 400); background(255,255,255);}

void draw() { background(255, 255, 255); ellipse(x, 200, 50, 50); x++;}

Page 3: Processing資料(4) アニメーション

ループさせる

画面の端まで動いたら 反対の端から出てくる

Page 4: Processing資料(4) アニメーション

void draw() { background(255, 255, 255);

ellipse(x, height/2, r, r);

x++;

if (x > width) { x = 0; }}

int r = 50;int x = 0;

void setup() { size(400, 400); background(255, 255, 255);}

Page 5: Processing資料(4) アニメーション

void draw() { background(255, 255, 255);

ellipse(x, height/2, r, r); x++;

if (x > width + r/2) { x = -r/2; }}

int r = 50;int x = -r/2;

void setup() { size(400, 400); background(255, 255, 255);}

なめらかにループさせる

Page 6: Processing資料(4) アニメーション

例題

画面の端まで動いたら反対方向へはねかえる円