Skip to content

Instantly share code, notes, and snippets.

@modster
Last active March 6, 2022 10:17
Show Gist options
  • Save modster/ca8e16a4d9d78dd3b20cd1d47a346f07 to your computer and use it in GitHub Desktop.
Save modster/ca8e16a4d9d78dd3b20cd1d47a346f07 to your computer and use it in GitHub Desktop.
canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Canvas tutorial</title>
<script>
function draw() {
var canvas = document.getElementById('tutorial');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
}
}
</script>
<style>
canvas { border: 1px solid black; }
</style>
</head>
<body onload="draw();">
<canvas id="tutorial" width="150" height="150"></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment