11_Animation.html
Dosyayı İndir
<!DOCTYPE html>
<html>
<body>
<canvas id="mycanvas" width="300" height="240" style="border: 1px solid blue">
</canvas>
<script>
var mycanvas = document.getElementById('mycanvas');
var mycontext=mycanvas.getContext("2d");
var angle=0;
setInterval(drawShapes,100);
function drawShapes(){
angle+=Math.PI/180;
mycontext.fillStyle = "#FFFFFF";
mycontext.fillRect(0,0,300,240);
mycontext.save();
mycontext.fillStyle = "#0000FF";
mycontext.translate(150,120);
mycontext.rotate(angle);
mycontext.translate(-150,-120);
mycontext.fillRect(100,70,100,100);
mycontext.restore();
}
</script>
</body>
</html>
Dosyayı İndir