var myxx,myyy,sha;
var myx,myx1=300,myxx=400;
var myy,myy1=500,myyy=600;
var dx=0,dy=0;
var tim3ID=0;
var h=0.2;          //回転スピード。ｈを小さくするとこまやかな動きになるが速度が遅くなる。
var n=1;               //表示させる画像の数
var k=50;       //回転する軌道円の半径
var s=50;      //sを小さくすると早い動きになるが負荷が大きくなる。
var bakudan=4*Math.PI;
xp=new Array();
yp=new Array();
for (m=1;m<(n+1);m++){
xp[m]=k*Math.sin((m-1)*2*3.14/n);
yp[m]=k*Math.cos((m-1)*2*3.14/n);
}
var p=0;
var myx=10;     //画像毎に円の中心補正が必要になります。
var myy=10;     //画像毎に円の中心補正が必要になります。　　　
timerID=0;
 
function STAR_WARS() {
p=p%bakudan+h;
for (m=1;m<(n+1);m++){
document.all["dot"+m].style.pixelTop = yp[m]+myy2;
document.all["dot"+m].style.pixelLeft = xp[m]+myx2;
xp[m]=k*Math.sin((m-1)*2*3.14/n+p);
yp[m]=k*Math.cos((m-1)*2*3.14/n+p/2);
document.all["dot"+m].style.display="block";
}
timerID=setTimeout("STAR_WARS()",s);
}
 
function moveImage1(){
doc_width =document.body.clientWidth;
doc_height =document.body.clientHeight;
myixx=doc_width*Math.random();
myiyy=doc_height*Math.random();
time3ID=setTimeout("moveImage1()",30);
}
var tim4ID=0;
function mymove1(){
shai=Math.sqrt(Math.pow((myixx-myxx),2)+Math.pow((myiyy-myyy),2));
shai1=4/shai;
dx=dx+(myixx-myxx)*shai1/15;
dy=dy+(myiyy-myyy)*shai1/15;
myxx=myxx+dx;
myyy=myyy+dy;
time4ID=setTimeout("mymove1()",30);
}
var time2ID=0;
function mymove2(){
sha=Math.sqrt(Math.pow((myxx-myx1),2)+Math.pow((myyy-myy1),2));
sha1=5/sha;
myx1=myx1+(myxx-myx1)*sha1/2;
myx2=doc_width/2+(myx1-doc_width/2)*2.5;
myy1=myy1+(myyy-myy1)*sha1/2;
myy2=doc_height/2+(myy1-doc_height/2)*2.;
time2ID=setTimeout("mymove2()",50);
}
function mutsutama(){
moveImage1();
mymove1();
mymove2();
STAR_WARS();
}

