HTML5 Canvas Mouse Coordinates Tutorial
To get the mouse coordinates relative to an HTML5 Canvas, we can create a getMousePos() method which returns the mouse coordinates based on the position of the client mouse and the position of the canvas obtained from the getBoundingClientRect() method of the window object.
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed