A Number
system variable that tracks the mouse's horizontal movement.
movedX
tracks how many pixels the mouse moves left or right between frames. movedX
will have a negative value if the mouse moves left between frames and a positive value if it moves right. movedX
can be calculated as mouseX - pmouseX
.
Note: movedX
continues updating even when requestPointerLock() is active. But keep in mind that during an active pointer lock, mouseX and pmouseX are locked, so movedX
is based on the MouseEvent's movementX value (which may behave differently in different browsers when the user is zoomed in or out).
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
A String system variable that contains the value of the last mouse button pressed.
mouseClicked
A function that's called once after a mouse button is pressed and released.