Skip to content

Instantly share code, notes, and snippets.

@ny0m
Created June 12, 2013 13:07
Show Gist options
  • Save ny0m/5765075 to your computer and use it in GitHub Desktop.
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
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