basic setup
commit
9952509a9e
|
|
@ -0,0 +1,6 @@
|
|||
<html>
|
||||
<body>
|
||||
<canvas id="canvas" width="400" height="600" style="border: 1px solid #333"></canvas>
|
||||
<script src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
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);
|
||||
}
|
||||
Loading…
Reference in New Issue