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