Circles and triganomatry
Circles and triganomatry
I need to add some divs to a circle, which I have done however they are not consistant. I think my cos and sin equation is wrong, can anyone help??
-
$('.box').each(function(i) {
var boxw = $(this).width() / 2;
var boxh = $(this).height() / 2;
ii = i + 1;
var angle = Math.round(pincr * i); // gets the angle for each li 2*Math.PI/360
$('#results').append('<em>Next Angle: ' + angle + '</em><br />');
// now get the xpos and ypos for the li refererence angle
var pxpos = Math.round((pradi * Math.cos(angle)) + pradi - boxw);
var pypos = Math.round((pradi * Math.sin(angle)) + pradi - boxh);
// try and change the li position.....
$(this).css('left', pxpos);
$(this).css('top', pypos);
$(this).css('z-index', ii);
$(this).append(ii);
});