float x; //マウスのx座標設定 float y; //マウスのy座標を設定 float px; //1フレーム前のマウスのx座標 float py; //1フレーム前のマウスのy座標 float easing = 0.005; //マウスの動きに変化 int velocity = 5; //オブジェクトのスピード void setup() { size(400, 400); } void draw() { background(255); fill(0); //画面中心から6方向で同時に線を描く for (int angle = 0; angle < 360; angle += 360/10) { translate(width / 2, height / 2); //画面の中心へいどう rotate(radians(angle)); //angleの角度だけ回転 translate(-width/2, -height/2); //位置を戻す float targetX = mouseX; //マウスxに代入 x += (targetX - x) * easing; //マウスの動きに代入 float targetY = mouseY; //マウスyに代入 y += (targetY - y) * easing; //マウスの動きに代入 ellipse(x, y, py, py); //円を作る py = y; px = x; } }