LayerRotate(JS)



 

 

 

<script language="JavaScript">
var deg = 0;
var rad = Math.PI/180;
var radius = 120;
var T = null;

function rotate()
{
	r = deg * rad;
	Layer1.style.top = y+radius*Math.sin(r);
	Layer1.style.left = x+radius*Math.cos(r);
	r = (deg + 120) * rad;
	Layer2.style.top = y+radius*Math.sin(r);
	Layer2.style.left = x+radius*Math.cos(r);
	r = (deg + 240) * rad;
	Layer3.style.top = y+radius*Math.sin(r);
	Layer3.style.left = x+radius*Math.cos(r);
	T = setTimeout("rotate()", 100);
	deg -= 5;
}
 
function init()
{
	if (T)
	{
		clearTimeout(T);
	}
	x = document.body.clientWidth / 2 - 75;
	y = 160;
	rotate();
}
   
</script>

<body  onLoad="init()" onResize="init()">