<html>
<head>
<script type="text/javascript">


function rotate_exe() {
    s += 2;
    var sx = Math.cos((s)*1*deg)*r;
    var sy = Math.sin((s)*1*deg)*r;


    document.getElementById('star').style.left = Math.round(cx + r + sx  ) + 'px';
    document.getElementById('star').style.top = Math.round(cy + r + sy  ) + 'px';
}


function start_rotate() {
    r = 30;   //반지름
    deg = Math.PI/180; //degrees
    s = 0;


    document.getElementById('star' ).style.position = 'absolute';
    document.getElementById('star' ).innerHTML = '+';
    
    cx = 300;  //별이 회전하는 축의 x
    cy = 300;  //별이 회전하는 축의 y
    aa = setInterval("rotate_exe()", 50);      
}




</script>
</head>
<body onload="start_rotate();" >
  <div id="star"  style=""  ></div>
</body>
</html>

 

 

 

 

Posted by 혜화초보
,