Skip to content

Instantly share code, notes, and snippets.

Created March 17, 2014 15:41
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 anonymous/9601617 to your computer and use it in GitHub Desktop.
Save anonymous/9601617 to your computer and use it in GitHub Desktop.
HTML5: Offscreen Canvas
<html>
<head>
<script type="application/javascript">
function main(){
// here we create an OFFSCREEN canvas
var offscreenCanvas = document.createElement('canvas');
offscreenCanvas.width = 300px;
offscreenCanvas.height = 300px;
var context = offscreenCanvas.getContext('2d');
// draw something into the OFFSCREEN context
context.fillRect(10,10,290,290);
// ...
}
</script>
</head>
<body onload='main()'>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment