A Number
variable that tracks the mouse's horizontal position within the browser.
winMouseX
keeps track of the mouse's position relative to the top-left corner of the browser window. For example, if the mouse is 50 pixels from the left edge of the browser, then winMouseX
will be 50.
On a touchscreen device, winMouseX
will hold the x-coordinate of the most recent touch point.
Note: Use mouseX to track the mouse’s x-coordinate within the canvas.
Examples
Related References
doubleClicked
A function that's called once when a mouse button is clicked twice quickly.
exitPointerLock
Exits a pointer lock started with requestPointerLock.
mouseButton
An object that tracks the current state of mouse buttons, showing which buttons are pressed at any given moment.
mouseClicked
A function that's called once after a mouse button is pressed and released.