Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. float radius = 35;
  2.  
  3. float x;
  4. float y;
  5. float direction;
  6.  
  7. void setup() {
  8. fullScreen();
  9. pixelDensity(displayDensity());
  10. background(255);
  11. strokeWeight(2);
  12.  
  13. x = width/2;
  14. y = height/2;
  15. direction = 0;
  16. }
  17.  
  18. void draw() {
  19. direction = direction + random(-1.3, 1.3);
  20.  
  21. x = x + 10 * cos(direction);
  22. y = y + 10 * sin(direction);
  23.  
  24. if (x > width + radius) {
  25. x = -radius;
  26. }
  27. if (x < -radius) {
  28. x = width + radius;
  29. }
  30. if (y > height + radius) {
  31. y = -radius;
  32. }
  33. if (y < -radius) {
  34. y = height + radius;
  35. }
  36.  
  37. float diameter = 2 * radius;
  38. float a = random(6);
  39. if (a < 1) {
  40. fill(221, 188, 210); // Pinkie pie
  41. } else if (a < 2) {
  42. fill(238, 239, 243); // Rarty
  43. } else if (a < 3) {
  44. fill(199, 165, 229); // Twlith sparkle
  45. } else if (a < 4) {
  46. fill(236, 189, 103); // Applejack
  47. } else if (a < 5) {
  48. fill(253, 248, 176); // Flutter shy
  49. } else {
  50. fill(180, 218, 255); // Rainbow dash
  51. }
  52. ellipse(x, y, diameter, diameter);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement