The code of
keleyi.htm is as follows:
html rotate canvas
The code of jb51.js is as follows:
/*
* Function: canvas rotation
*/
(function(){
var canvas=null,
context=null,
angle=0;
function resetCanvas(){
canvas=document.getElementById("jb51");
canvas.width=window.innerWidth;
canvas.height=window.innerHeight;
context=canvas.getContext(" 2d");
}
function animate(){
context.save();
try{
//Clear canvas
context.clearRect(0, 0, canvas. width, canvas.height);
//Set the origin
context.translate(canvas.width * 0.5, canvas.height * 0.5);
//Rotate angle
context.rotate(angle) ;
//Set fill color
context.fillStyle = "#FF0000";
//Draw rectangle
context.fillRect(-30, -30, 60, 60);
angle = 0.05 * Math.PI;
}
finally{
context.restore();
}
}
$(window).bind("resize",resetCanvas). bind("reorient",resetCanvas);
$(document).ready(function(){
window.scrollTo(0,1);
resetCanvas();
setInterval(animate,40 );
});
})();