basic setup

master
Christian Dreier 2017-05-24 22:43:38 +02:00
commit 9952509a9e
2 changed files with 22 additions and 0 deletions

6
index.html 100644
View File

@ -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>

16
main.js 100644
View File

@ -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);
}