Skip to content

Instantly share code, notes, and snippets.

@devyn
Created November 12, 2009 07:09
Show Gist options
  • Save devyn/232676 to your computer and use it in GitHub Desktop.
Save devyn/232676 to your computer and use it in GitHub Desktop.
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
<script>
function init() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
setInterval(function() {
resize(canvas);
ctx.clearRect(0,0,canvas.width,canvas.height);
ctx.fillStyle="#000000";
ctx.fillRect(0,0,canvas.width,canvas.height);
ctx.fillStyle="#ffffff";
ctx.fillRect(canvas.width/4,canvas.height/4,canvas.width/2,canvas.height/2);
}, 33);
}
function resize(canvas) {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
</script>
</head>
<body onload="init();">
<canvas id="canvas"></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment