Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mouseClicked() {
- for (int i=0; i<noCircles; i++) {
- float x = width/2 + sin(radians(frameCount*speed[i] ) + phase[i])* 200;
- if (dist(x, y[i], mouseX, mouseY) < 50) {
- if (speed[i]>0) { // if the circle is moving, stop it
- speed[i] = 0;
- phase[i] = 0;
- } else { // if the circle is not moving, restart it
- speed[i] = random(5);
- phase[i] = random(TWO_PI);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement