114 lines
2.4 KiB
HTML
114 lines
2.4 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>BlinkIt</title>
|
||
|
<style type='text/css'>
|
||
|
body {margin:0}
|
||
|
#movia {position:absolute}
|
||
|
#minf {position:absolute; left:5px; bottom:5px; font-family:'trebuchet ms'; font-size:14px}
|
||
|
</style>
|
||
|
<script type='text/javascript'>
|
||
|
function movia()
|
||
|
{
|
||
|
if (self.innerHeight)
|
||
|
{
|
||
|
w = self.innerWidth;
|
||
|
h = self.innerHeight;
|
||
|
}
|
||
|
else if (document.documentElement && document.documentElement.clientHeight)
|
||
|
{
|
||
|
w = document.documentElement.clientWidth;
|
||
|
h = document.documentElement.clientHeight;
|
||
|
}
|
||
|
else if (document.body) // other Explorers
|
||
|
{
|
||
|
w = document.body.clientWidth;
|
||
|
h = document.body.clientHeight;
|
||
|
}
|
||
|
|
||
|
pt=Math.round((h-75)/2)
|
||
|
pl=Math.round((w-75)/2)
|
||
|
pr=Math.round((w-75)/2)
|
||
|
pb=Math.round((h-75)/2)
|
||
|
pw=75
|
||
|
ph=75
|
||
|
bg="rgb(0,0,0)"
|
||
|
bgbg="rgb(255,255,255)"
|
||
|
movib()
|
||
|
}
|
||
|
|
||
|
function movib()
|
||
|
{
|
||
|
document.getElementById("movia").style.top=pt+"px"
|
||
|
document.getElementById("movia").style.left=pl+"px"
|
||
|
document.getElementById("movia").style.right=pr+"px"
|
||
|
document.getElementById("movia").style.bottom=pb+"px"
|
||
|
document.getElementById("movia").style.backgroundColor=bg
|
||
|
document.getElementById("minf").style.color=bg
|
||
|
document.body.style.backgroundColor=bgbg
|
||
|
|
||
|
if (pw<101 && ph<101 && pw>0 && ph>0 && pt>99 && pb>99 && pl>149 && pr>149)
|
||
|
{
|
||
|
|
||
|
rand=Math.floor(Math.random()*7)-3
|
||
|
pt=pt+rand
|
||
|
|
||
|
rand=Math.floor(Math.random()*7)-3
|
||
|
pl=pl+rand
|
||
|
|
||
|
rand=Math.floor(Math.random()*7)-3
|
||
|
pr=pr+rand
|
||
|
|
||
|
rand=Math.floor(Math.random()*7)-3
|
||
|
pb=pb+rand
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
|
||
|
if (pw>90)
|
||
|
{
|
||
|
pl=pl+2
|
||
|
pr=pl+2
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
pl=pl-2
|
||
|
pr=pr-2
|
||
|
}
|
||
|
|
||
|
if (ph>90)
|
||
|
{
|
||
|
pt=pt+2
|
||
|
pb=pb+2
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
pt=pt-2
|
||
|
pb=pb-2
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
box_r=Math.floor(Math.random()*256)
|
||
|
box_g=Math.floor(Math.random()*256)
|
||
|
box_b=Math.floor(Math.random()*256)
|
||
|
bg_r=255-box_r
|
||
|
bg_g=255-box_g
|
||
|
bg_b=255-box_b
|
||
|
bg="rgb("+box_r+","+box_g+","+box_b+")"
|
||
|
bgbg="rgb("+bg_r+","+bg_g+","+bg_b+")"
|
||
|
|
||
|
pw=w-pl-pr
|
||
|
ph=h-pt-pb
|
||
|
|
||
|
document.getElementById("minf").innerHTML="Top: "+pt+"<br />Left: "+pl+"<br />Right: "+pr+"<br />Bottom: "+pb+"<br />Width: "+pw+"<br />Height: "+ph+"<br />Box color: "+bg+"<br />Background color: "+bgbg
|
||
|
t=setTimeout("movib()",50)
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body onload='movia()' onresize='movia()'>
|
||
|
<div id='minf'></div>
|
||
|
<div id='movia' onclick='clearTimeout(t)' ondblclick='movib()'></div>
|
||
|
</body>
|
||
|
</html>
|