-1

I want to place some menu icons on a circle so that it almost looks like a clock. Depending on the amount of icons, the space between them may vary. Whats the best way to put each of these icons in the form of a circle?

Wain
  • 118,658
  • 15
  • 128
  • 151
DanielR
  • 701
  • 2
  • 12
  • 24
  • Tried. What have you? – PeeHaa Feb 01 '14 at 12:35
  • I managed to do it but depending on the amount of icons I want to place, the layout is always different. How can I put the first icon always on the top of the circle and start from there? – DanielR Feb 04 '14 at 19:07

1 Answers1

0

Mathematics.

If you know how many items you have then you can find the angle between them because you know there are 360 degrees (2pi radians) in a circle. Choose a start point and then use

x = centerX + r * cos(angle)
y = centerY + r * sin(angle)

Using the center point of the circle, the radius and the angle (in radians), increasing the angle for each item.

Wain
  • 118,658
  • 15
  • 128
  • 151