How about the code when the ball is retracted and returned to its original position?

float rot = PI;
float d_rot = 0.05;
float xoff = 0.0;
float xincrement = 0.01;
//float xoff_xincrement = 0.05;

void setup() {
size(800, 800);
noStroke();
fill(255);
}

void draw() {
background(0);
translate(width/2, height/2);

rot += d_rot;
rotate( rot );

ellipse(0, 200, 40, 40);

rotate(radians(120));
ellipse(0, 200, 40, 40);

rotate(radians(120));
ellipse(0, 200, 40, 40);
// With each cycle, increment xoff

// Create an alpha blended background
fill(0, 10);
rect(0,0,width,height);

//float n = random(0,width); // Try this line instead of noise

// Get a noise value based on xoff and scale it according to the window’s width
float n = noise(xoff)*width;

// With each cycle, increment xoff
xoff += xincrement;

// Draw the ellipse at the value produced by perlin noise
fill(200);
ellipse(n,height/2, 64, 64);
}

// When the mouse is pressed,
void mousePressed(){
// If there is no rotation right now,
if( d_rot == 0 ){
// Start doing rotation.
d_rot = 0.03;
} else { // Or if there was some,
// Stop doing rotation.
d_rot = 0;
}
}

You expect us to do that for you?

You did not even format your code which means you haven’t even read the pin thread on how to ask question which you are suppose to read before posting something. I’m speaking of this one in case you are interested: Guidelines—Tips on Asking Questions

And most importantly you don’t even write a sentence in your post… I’m not even speaking of politeness words like “hello” or “please” or “thanks”… I’m just speaking of the fact that there is not a single word… just a video and your code…

So please edit your post and be more friendly, maybe someone will consider helping you then.

And trust me, I’m taking on me to not be rude!

Sorry Poor english :sweat::sweat:

When the mouse is pressed, it turns around the circle and retracts at the same time. When the mouse is released, it returns to the original radius.