Created
June 12, 2013 13:07
-
-
Save ny0m/5765075 to your computer and use it in GitHub Desktop.
Function I use to plot menu items around a fixed point on http://cmnd.li
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function plot(points, diameter, offset){ | |
var x, y, | |
angle = 0, | |
links = $('nav a'), | |
increase = Math.PI * 2 / points; | |
for (var i=0; i <= points; i++) { | |
x = diameter * Math.cos(angle) + offset | |
y = diameter * Math.sin(angle) + offset | |
angle += increase | |
$(links[i]).css({left: x, top: y}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment