jeudi 24 octobre 2019

Run!

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Page</title>
<style>
html,body{
height:100%;
margin:0;
}
body{
overflow:hidden;
}
#div1{
position:absolute;
top:0;
right:0;
}
</style>
</head>

<body>
<canvas id="can1"></canvas>
<script>
var ww=window.innerWidth;
var wh=window.innerHeight;
var can1=document.getElementById("can1");
var ctx=can1.getContext("2d");
var img=new Image();
var x=0;
var x2=0;
can1.setAttribute("width",ww);
can1.setAttribute("height",wh);
img.addEventListener("load",function(){
setInterval(run,50);
},false);
img.src="http://social.msdn.microsoft.com/Forums/getfile/167649";
function run(){
if(x>275){x=0};
if(x2>ww){x2=0};
ctx.clearRect(0,0,ww,wh);
ctx.drawImage(img,x,0,55,76,x2,wh/2-76,110,152);
x=x+55;
x2=x2+18;
};
</script>
</body>
</html>
</html>