Skip to content

Instantly share code, notes, and snippets.

@toddbranch
Last active December 2, 2016 19:00
Show Gist options
  • Save toddbranch/537e08f5fa631e14fc0cda6093bdde38 to your computer and use it in GitHub Desktop.
Save toddbranch/537e08f5fa631e14fc0cda6093bdde38 to your computer and use it in GitHub Desktop.
// Drawing example we used in class.
<canvas id="myCanvas" width="400" height="400"></canvas>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.fillStyle = 'pink';
canvas.addEventListener('mousemove', function(event) {
console.log(event);
context.fillRect(event.x, event.y, 10, 10);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment