float x, y; float vx, vy; float cx, cy; float G = 500; float[] ox = new float[256]; float[] oy = new float[256]; int t = 0; float mx, my; boolean pause = false; void setup(){ size(800, 800); cx = width/2; cy = height/2; smooth(); //円の縁を滑らかにする noStroke(); strokeWeight(3); frameRate(30); background(0); ellipse(cx, cy, 20, 20); x = width/2; y = height/4; vx = 1.3; vy = -0; } void mousePressed(){ x = mouseX; y = mouseY; mx = mouseX; my = mouseY; vx = 0; vy = 0; pause = true; } void mouseDragged(){ vx = 0; vy = 0; noStroke(); } void mouseReleased(){ vx = 0.02*(mouseX - mx); vy = 0.02*(mouseY - my); pause = false; } void draw(){ float r; float r2; float fx; float fy; r2 = pow(x-cx,2)+pow(y-cy,2); r = sqrt(r2); fx = + G/r2 * (cx-x)/r; fy = + G/r2 * (cy-y)/r; background(0); fill(255,255,0,200); ellipse(cx, cy, 20, 20); int c=0; for(int i = t+1; i<256; i++){ fill(255,255,255,c); ellipse(ox[i],oy[i],3,3); c++; } for(int i = 0; i