float x,y; //オブジェクトx,y座標 float X ,Y; //オブジェクトX,Y座標 float Angle = 0; //初期角度 float R = 70; // 半径 void setup() { size(400, 400); background(255); noStroke(); fill(0); frameRate(10); } void draw(){ x = mouseX; y = mouseY; ellipse(x, y, 20, 20); //マウスと共に動く円 Angle = Angle + 30; //角度を30度ずつ増加させる X = x + ( R * cos(radians(Angle)) ); //角度を度からラジアンに変換させる Y = y + ( R * sin(radians(Angle)) ); //角度を度からラジアンに変換させる ellipse(X, Y, 10, 10); //円の外周を回る円 } void mousePressed() { background(255); //マウスが押されたら背景を白にする }