Sabtu, 14 Oktober 2023

Javascript move object around circle

 




html>

body>

DIV ID = "fly1" STYLE="position:absolute;left:0px;top:0px;width:40px;height:40px;visibility:hidden;z-index:3;"> 

A HREF = "belajar.html"><IMG SRC="1.gif" width="70" height="60" border=0 ></A

/DIV> 

DIV ID = "fly2" STYLE="position:absolute;left:0px;top:0px;width:40px;height:40px;visibility:hidden;z-index:3;"> 

A HREF = "komputer.html"><IMG SRC="2.gif" width="70" height="60" border=0 ></A

/DIV> 

DIV ID = "fly3" STYLE="position:absolute;left:0px;top:0px;width:40px;height:40px;visibility:hidden;z-index:3;"> 

A HREF = "denah.html"><IMG SRC="3.gif" width="70" height="60" border=0 ></A

/DIV> 

DIV ID = "fly4" STYLE="position:absolute;left:0px;top:0px;width:40px;height:40px;visibility:hidden;z-index:3;"> 

A HREF = "denah.html"><IMG SRC="4.gif" width="70" height="60" border=0 ></A 

/DIV> 

DIV ID = "fly5" STYLE="position:absolute;left:0px;top:0px;width:40px;height:40px;visibility:hidden;z-index:3;"> 

A HREF = "network.html"><IMG SRC="5.gif" width="70" height="60" border=0 ></A

/DIV> 

DIV ID = "fly6" STYLE="position:absolute;left:0px;top:0px;width:40px;height:40px;visibility:hidden;z-index:3;"> 

A HREF = "osis.html"><IMG SRC="6.gif" width="70" height="60" border=0 ></A

/DIV> 


SCRIPT LANGUAGE = "JavaScript"> 

var pos;var ra = 100;var rb = 100;var pi = Math.PI;var inc = pi / 180;var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4); 

var fly1 = (isNS) ? document.fly1 : document.all.fly1.style; 

var fly2 = (isNS) ? document.fly2 : document.all.fly2.style; 

var fly3 = (isNS) ? document.fly3 : document.all.fly3.style; 

var fly4 = (isNS) ? document.fly4 : document.all.fly4.style; 

var fly5 = (isNS) ? document.fly5 : document.all.fly5.style; 

var fly6 = (isNS) ? document.fly6 : document.all.fly6.style; 

var objets; 

objets = new Array(fly1, fly2, fly3, fly4, fly5, fly6);pos = new Array();pos[0] = 0; 

for (var i = 1; i < objets.length; i++) {pos[i] = parseFloat(pos[i - 1] + ((2 * pi) / objets.length));} 

function rotateObjets() { 

for (var i = 0; i < pos.length; i++) {pos[i] += inc;objets[i].left = (ra * Math.sin(pos[i])) + 450;objets[i].top = (rb * Math.cos(pos[i])) + 165;objets[i].visibility = "visible";} 

rotateTimer = window.setTimeout("rotateObjets()", 50); 

rotateObjets(); 

/SCRIPT> 

/body>

/html>

Tidak ada komentar: