int eSize = 40; //オブジェクトのサイズ int velocity = 5; //オブジェクトのスピード 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(x, height/2, eSize, eSize); //円を描く x += velocity; //x座標にvelocityの値を足す //もし、xの値が画面の幅以上になったら、xを0に戻す if (x >= width) { x = 0; } }