Team:StuyGem NYC
From 2014hs.igem.org
(Difference between revisions)
Kelvinn1996 (Talk | contribs) |
Kelvinn1996 (Talk | contribs) |
||
Line 209: | Line 209: | ||
} | } | ||
- | + | function writeMessage(canvas, message) { | |
- | + | var context = canvas.getContext('2d'); | |
- | + | context.clearRect(0, 0, canvas.width, canvas.height); | |
- | + | context.font = '18pt Calibri'; | |
- | + | context.fillStyle = 'black'; | |
- | + | context.fillText(message, 10, 25); | |
- | + | } | |
- | + | ||
- | } | + | canvas.addEventListener('mousemove', function(evt) { |
- | ); | + | var mousePos = getMousePos(canvas, evt); |
+ | var message = 'Mouse position: ' + mousePos.x + ',' + mousePos.y; | ||
+ | writeMessage(canvas, message); | ||
+ | }, false); | ||
+ | |||
+ | |||
</script> | </script> | ||
</body> | </body> | ||
</html> | </html> |
Revision as of 03:35, 18 April 2014
Get in touch!
Visit Our Twitter Page!