<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>VML - Angle</title>
<STYLE>
v/:* { BEHAVIOR: url(#default#VML) }
</STYLE>
<SCRIPT Language="JavaScript">
/*
All Files are Designed & Writen by Windy_sk, you can use it freely but ...
YOU MUST KEEP THIS ITEM !
Email: seasonx@163.net
*/
var timer = null;
var time_unit = 30;
var A_speed = 10;
var L_speed = 15;
var move_x, move_y;
function MoveIt(){
var the_top = parseInt(angle.style.top);
var the_left = parseInt(angle.style.left);
angle.style.top = the_top + move_y;
angle.style.left = the_left + move_x;
if(the_top < 0 || the_top > document.body.offsetHeight){
angle.Rotation = 180 - angle.Rotation;
move_y = -move_y;
angle.style.top = the_top<0?0:document.body.offsetHeight + move_y;
}
if(the_left < 0 || the_left > document.body.offsetWidth){
angle.Rotation = 360 - angle.Rotation;
move_x = -move_x;
angle.style.left = the_left<0?0:document.body.offsetWidth + move_x;
}
}
document.onkeydown = function(){
angle.Rotation = angle.Rotation % 360
if(timer!=null) return;
var the_angle = Math.PI * angle.Rotation / 180;
switch(event.keyCode){
case 37: //left
timer = setInterval("angle.Rotation -= A_speed",time_unit);
break;
case 39: //right
timer = setInterval("angle.Rotation += A_speed",time_unit);
break;
case 40: //down
the_angle += Math.PI;
case 38: //up
move_y = -Math.floor(L_speed * Math.cos(the_angle));
move_x = +Math.floor(L_speed * Math.sin(the_angle));
timer = setInterval("MoveIt()",time_unit);
break;
}
return;
}
document.onkeyup = function(){
if(timer!=null) clearInterval(timer);
timer = null;
}
window.onload = function(){
setInterval("window.status='Rotation: '+angle.Rotation+'; Top: '+angle.style.top+'; Left: '+angle.style.left",time_unit);
}
</SCRIPT>
</head>
<body scroll="no">
<v:group id="angle" style='position:absolute;top:0;left:0;width:20;height:20;z-index:999' coordorigin="-10,-10" coordsize="20,20">
<v:shape CoordOrig="-10,-10" CoordSize="20,20" style="width:20;height:20" Title="Hello" FillColor="red" Filled="true" StrokeColor="black" StrokeWeight="1pt">
<v:Stroke StrokeColor="blue" StrokeWeight="1pt" />
<v:fill type='gradient' color='blue'/>
<v:Path v="m 0,-10 l -10,10 l 0,5 l 10,10 x e" />
</v:shape>
</v:group>
</body>
</html>