Guest User

Untitled

a guest
Feb 28th, 2023
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. int r = 50;
  2. boolean donut = false;
  3. float x, x1, x2, y1, y2;
  4. float y = -60;
  5.  
  6. void setup(){
  7. size(500,500);
  8. }
  9.  
  10. void draw(){
  11. background(255, 255, 0);
  12. fill(255);
  13. ellipse((width/2)-50, (height/2), r, r);
  14. ellipse((width/2)+50, (height/2), r, r);
  15.  
  16. if(donut==false){
  17. x1 = map(mouseX, 0, width, -15, 15);
  18. y1= map(mouseY, 0, height, -15, 15);
  19.  
  20. fill(0);
  21. ellipse(((width/2)-50)+x1, (height/2)+y1, 10, 10);
  22.  
  23. x2 = map(mouseX, 0, width, -15, 15);
  24. y2 = map(mouseY, 0, height, -15, 15);
  25.  
  26. ellipse(((width/2)+50)+x2, (height/2)+y2, 10, 10);
  27. }else{
  28. x1 = map(x, 0, width, -15, 15);
  29. y1= map(y, 0, height, -15, 15);
  30.  
  31. fill(0);
  32. ellipse(((width/2)-50)+x1, (height/2)+y1, 10, 10);
  33.  
  34. x2 = map(x, 0, width, -15, 15);
  35. y2 = map(y, 0, height, -15, 15);
  36.  
  37. ellipse(((width/2)+50)+x2, (height/2)+y2, 10, 10);
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
  45.  
  46. void mousePressed(){
  47.  
  48.  
  49. }
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment