Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. float px, py;
  2. float v1x, v2x, v3x;
  3. float v1y, v2y, v3y;
  4.  
  5.  
  6. void setup() {
  7. fullScreen();
  8. background(0);
  9.  
  10. v1x = width/2;
  11. v2x = width/6;
  12. v3x = 5*width/6;
  13.  
  14. v1y = 50;
  15. v2y = v3y = height-50;
  16.  
  17. fill(125, 255, 0);
  18. ellipse(v1x, v1y, 5, 5);
  19. ellipse(v2x, v2y, 5, 5);
  20. ellipse(v3x, v3y, 5, 5);
  21.  
  22. px = v1x;
  23. py = v1y;
  24. }
  25.  
  26. void draw() {
  27.  
  28. float tempvx, tempvy;
  29.  
  30. for(int i = 0; i < 50; ++i) {
  31. int v = (int)random(3) + 1;
  32. switch(v) {
  33. case 1: tempvx = v1x; tempvy = v1y; break;
  34. case 2: tempvx = v2x; tempvy = v2y; break;
  35. default: tempvx = v3x; tempvy = v3y;
  36. }
  37.  
  38. px = (px + tempvx)/2;
  39. py = (py + tempvy)/2;
  40.  
  41. ellipse(px, py, 5, 5);
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement