|
var canvas = document.getElementById("canvas")
|
|
var ctx = canvas.getContext("2d")
|
|
|
|
|
|
ctx.fillStyle = 'rgb(200,0,0)';
|
|
ctx.fillRect(10, 10, 55, 50);
|
|
|
|
|
|
var fps = 30;
|
|
function draw() {
|
|
setTimeout(function() {
|
|
requestAnimationFrame(draw);
|
|
// Drawing code goes here
|
|
|
|
}, 1000 / fps);
|
|
} |