Two new parameters to mouse events—movementX and movementY—provide the
change in mouse positions. The values of the parameters are the same as
the difference between the values of MouseEvent properties, screenX and
screenY, which are stored in two subsequent mousemove events, eNow and
ePrevious. In other words, the Pointer lock parameter
movementX = eNow.screenX - ePrevious.screenX.
When Pointer lock is enabled, the standard MouseEvent properties clientX,
clientY, screenX, and screenY are held constant, as if the mouse is not
moving. The movementX and movementY properties continue to provide the
mouse's change in position. There is no limit to movementX and movementY
values if the mouse is continuously moving in a single direction.
The concept of the mouse cursor does not exist and the cursor cannot move
off the window or be clamped by a screen edge.
The parameters movementX and movementY are valid regardless of the mouse
lock state, and are available even when unlocked for convenience.
Two new parameters to mouse events—movementX and movementY—provide the change in mouse positions. The values of the parameters are the same as the difference between the values of MouseEvent properties, screenX and screenY, which are stored in two subsequent mousemove events, eNow and ePrevious. In other words, the Pointer lock parameter
movementX = eNow.screenX - ePrevious.screenX
.When Pointer lock is enabled, the standard MouseEvent properties clientX, clientY, screenX, and screenY are held constant, as if the mouse is not moving. The movementX and movementY properties continue to provide the mouse's change in position. There is no limit to movementX and movementY values if the mouse is continuously moving in a single direction. The concept of the mouse cursor does not exist and the cursor cannot move off the window or be clamped by a screen edge.
The parameters movementX and movementY are valid regardless of the mouse lock state, and are available even when unlocked for convenience.
MDN