Created
April 29, 2016 01:00
-
-
Save Zerrien/2dbb51bc8349a03ffcd36a7ce7a7b488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
var canvas, ctx; | |
var sTime, dTime, pTime, tTime; | |
function init() { | |
canvas = document.getElementById("aCanvas"); | |
ctx = canvas.getContext('2d'); | |
pTime = (new Date()).getTime(); | |
tTime = 0; | |
setInterval(main, 10); | |
} | |
function main() { | |
sTime = (new Date()).getTime(); | |
dTime = sTime - pTime; | |
tTime += dTime; | |
// Add logic here. | |
pTime = sTime; | |
} | |
</script> | |
</head> | |
<body onload="init()"> | |
<canvas id="aCanvas"></canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment