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 thegetBoundingClientRect() method of the window object.

Instructions: Mouseover the canvas to see the mouse coordinates

邮箱:
密码:

微信扫描二维码捐赠

当前实例由www.100sucai.com整理,
仅作学习参考。感谢大家对本站的支持
web前端交流群:Css Js 网站美工