TOP /すぐに使えるJavaScript | ロケット(IE5.5以上) |
---|
IE5.5以上以外は何も表示されません
矢印キー[↑]で移動します。
移動中に矢印キー[→]で右回転します。
移動中に矢印キー[←]で左回転します。
<script language="JavaScript"><!-- locketurl="locket.gif"; //ロケット画像 fireurl="fire.gif "; //炎画像 iw=50; //画像の大きさ locketspeed=4; //移動スピード //----------------------------------- lockettop=document.body.clientHeight-iw-20; if(window.createPopup){ document.write("<STYLE TYPE='text/css'>#Mat{filter:progid:DXImageTransform.Microsoft.Matrix("); document.write("M11=1.0,M12=0.0,M21=0.0,M22=1.0,Dx=1.0,Dy=1.0,FilterType='bilinear',sizingMethod='auto expand')"); document.write("progid:DXImageTransform.Microsoft.BasicImage(Rotation=0);"); document.write("position:absolute;top:"+lockettop+"px;left:"+(iw/2)+"px;width:"+iw+"px;height:"+iw+"px;}"); document.write("#imgMat{width:"+iw+"px;height:"+iw+"px;}"); document.write("#imgF{filter: Alpha(opacity=0,style=2);width:"+(iw*6/10)+"px;height:10px;}</STYLE>"); document.write("<div id='Mat'><table cellspacing=0 cellpadding=0><tr><td>"); document.write("<IMG id='imgMat'SRC='"+locketurl+"'></td></tr><tr><td>"); document.write("<center><IMG id='imgF'SRC='"+fireurl+"'></center></td></tr></table></div>"); } taikaku=Math.floor(Math.sqrt(Math.pow(iw,2)/2)); fm12=0;fm21=0;len=1;turn_flag=0;locketleft=iw/2;Rot=0;LRcheck="";sa=0;idou_flag=0; function ImageTurn(){ turn_flag=1; (LRcheck=="L")?fm12+=0.1:fm12-=0.1; fm12=Math.round(fm12*10)/10; document.all.Mat.filters[0].M12=fm12; document.all.Mat.filters[0].M21=-fm12; len=Math.floor(iw/Math.sqrt(fm12*fm12+1)); document.all.Mat.style.width=len; document.all.imgMat.style.width=len; document.all.imgF.style.width=len*6/10; document.all.Mat.style.height=len; document.all.imgMat.style.height=len; sa=Math.floor(Math.sqrt(Math.pow(taikaku,2)-Math.pow((1-Math.abs(fm12))*iw/2,2))-(iw/2)); document.all.Mat.style.top=lockettop-sa; document.all.Mat.style.left=locketleft-sa; document.all.Mat.filters[1].Rotation=Rot; if(LRcheck=="L"){ if(fm12>=1){fm12=-1;Rot--;if(Rot<0)Rot=3;} }else{ if(fm12<=-1){fm12=1;Rot++;Rot%=4;} } } function checkkey(){ if(!window.createPopup)return; if(!turn_flag && idou_flag){ if(event.keyCode=="39")LRcheck="R"; else if(event.keyCode=="37")LRcheck="L"; else LRcheck=""; if(LRcheck && !turn_flag){turn_flag=1;setin=setInterval("ImageTurn()", 100);}} if(event.keyCode=="38"&& !idou_flag){idou_flag=1;movein=setInterval("idou()", 100)} } alp=0; function idou(){ if(Rot==0){lockettop-=locketspeed;locketleft-=(fm12*locketspeed);} else if(Rot==1){locketleft+=locketspeed;lockettop-=(fm12*locketspeed);} else if(Rot==2){lockettop+=locketspeed;locketleft+=(fm12*locketspeed);} else{locketleft-=locketspeed;lockettop+=(fm12*locketspeed);} document.all.Mat.style.top=lockettop-sa; document.all.Mat.style.left=locketleft-sa; if(alp<40)alp++; document.all.imgF.style.filter="alpha(opacity:"+ alp*2 +",style=2)"; } function checkkeyup(){ if(!window.createPopup)return; if(turn_flag){turn_flag=0;clearInterval(setin);} if(idou_flag && event.keyCode=="38"){idou_flag=0;clearInterval(movein); document.all.imgF.style.filter="alpha(opacity:0)";alp=0; } } document.onkeydown =new Function("checkkey();if(event.keyCode=='39'||event.keyCode=='37'||event.keyCode=='38')return false;"); document.onkeyup=checkkeyup; /* himajin.moo.jp */ // --></script>