Skip to content

Instantly share code, notes, and snippets.

@cshier
Created June 15, 2014 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cshier/45cd5f500d5eddb7f4e8 to your computer and use it in GitHub Desktop.
Save cshier/45cd5f500d5eddb7f4e8 to your computer and use it in GitHub Desktop.
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
body, canvas {
margin: 0;
border: 0;
padding: 0;
position: fixed;
}
<!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