Circles that will disappear when the mouse hovers

Hi,
I am new to coding, I’ve only just starting being taught it. I need to create a project - I have an idea for it but am unsure how to create it.
Essentially I want to create a line of circles going vertically down the page that will disappear when the mouse hovers over them.
Is anyone able to help with this?
I use Processing and have included a picture of where I’m up to.Screenshot 2020-03-26 at 12.48.17
Thank you

1 Like

First, add a call to background() inside your draw() function.

Next, think about what it means for the mouse to be over one of these circles. What can you say about the distance between the center of the circle and the mouse, in relation to the radius of the circle? (Hint: Look up “dist()”, “mouseX”, and “mouseY”!)

Finally, you will need to draw each circle only if some condition is met (or not met!). To do this you will need a conditional statement. Actually, you will need three of them, one for each circle. (Hint: look up the key word “if”!)

Try it yourself. Post the code of your attempt (not an IMAGE of the code, but the code itself! (And format it with the </> format code button!)) for more help.

2 Likes