Created
June 15, 2014 22:25
-
-
Save cshier/45cd5f500d5eddb7f4e8 to your computer and use it in GitHub Desktop.
This file contains 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
canvas = document.querySelectorAll("canvas")[0] | |
ctx = canvas.getContext '2d' | |
do canvas.resizeHandler = -> | |
canvas.width = window.innerWidth | |
canvas.height = window.innerHeight | |
window.addEventListener "resize", canvas.resizeHandler, false | |
PI = Math.PI | |
sin = (a) -> Math.sin(a) | |
cos = (a) -> Math.cos(a) | |
start = Date.now() | |
t = 0 | |
do animloop = -> | |
animloop.id = requestAnimationFrame animloop | |
t = (Date.now() - start)/1000 | |
ctx.fillStyle = 'black' | |
ctx.fillRect 0, 0, canvas.width, canvas.height |
This file contains 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
body, canvas { | |
margin: 0; | |
border: 0; | |
padding: 0; | |
position: fixed; | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<canvas></canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment