Guest User

Untitled

a guest
Nov 18th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 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.0;
  13. float dist = min(height, width) * 0.5 - radius;
  14. float radToDeg = 180.0 / PI;
  15. float countToRad = TWO_PI / float(count);
  16. float angle, hue, x, y;
  17.  
  18. String label = "";
  19.  
  20. for (int i = 0; i < count; ++i) {
  21. angle = i * countToRad;
  22. hue = angle * radToDeg;
  23. x = centerX + cos(angle) * dist;
  24. y = centerY + sin(angle) * dist;
  25. label = ceil(hue) + "\u00b0";
  26.  
  27. fill(color(hue, 99, 99));
  28. ellipse(x, y, radius, radius);
  29.  
  30. fill(0xff000000);
  31. text(label, x, y);
  32. fill(0xffffffff);
  33. text(label, x + 1, y - 1);
  34. }
Add Comment
Please, Sign In to add comment