Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. size(512, 512);
  2. background(0xffffffff);
  3. noStroke();
  4. colorMode(HSB, 359, 99, 99);
  5. ellipseMode(RADIUS);
  6. textAlign(CENTER, CENTER);
  7.  
  8. int count = 16;
  9.  
  10. float centerX = width * 0.5;
  11. float centerY = height * 0.5;
  12. float radius = 42;
  13. float dist = min(height, width) * 0.5 - radius;
  14. float angle;
  15. float hue;
  16. float x;
  17. float y;
  18. float radToDeg = 360 / TWO_PI;
  19. float countToRad = TWO_PI / float(count);
  20.  
  21. String label = "";
  22.  
  23. for (int i = 0; i < count; ++i) {
  24. angle = i * countToRad;
  25. hue = angle * radToDeg;
  26. x = centerX + cos(angle) * dist;
  27. y = centerY + sin(angle) * dist;
  28. label = ceil(hue) + "\u00b0";
  29.  
  30. fill(color(hue, 99, 99));
  31. ellipse(x, y, radius, radius);
  32.  
  33. fill(0xff000000);
  34. text(label, x, y);
  35. fill(0xffffffff);
  36. text(label, x + 1, y - 1);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement