int eSize = 0; //オブジェクトのサイズ int speed = 30; //オブジェクトのスピード int y = 0; //オブジェクトのy座標 int x = 0; //オブジェクトのx座標 void setup() { size(400, 400); noStroke(); //輪郭を描かない fill(0); //オブジェクトは黒 } void draw() { background(255); /* 軌跡を残す場合は、下の3行をON、backgoundをOFFにする fill(255, 50); //透明度のあるrectを描画 rect(0, 0, width, height); fill(0); //オブジェクトは黒 */ ellipse(200, y, eSize, eSize); //円を描く ellipse(x,200, eSize, eSize); ellipse(200,200, eSize, eSize); y += speed; //y座標にspeedの値を足す x += speed; //x座標にspeedの値を足す //もし、xの値が画面の幅以上になったら、xを0に戻す if (y >= 200) { y = 0; eSize = 50; } if (x >= 200) { x = 0; } }