pub static requestPointerLock: RequestPointerLockInternalTypeExpand description
The function requestPointerLock() locks the pointer to its current position and makes it invisible. Use movedX and movedY to get the difference the mouse was moved since the last call of draw. Note that not all browsers support this feature. This enables you to create experiences that aren't limited by the mouse moving out of the screen even if it is repeatedly moved into one direction. For example, a first person perspective experience.
Examples
let cam;
function setup() {
createCanvas(100, 100, WEBGL);
requestPointerLock();
cam = createCamera();
}
function draw() {
background(255);
cam.pan(-movedX * 0.001);
cam.tilt(movedY * 0.001);
sphere(25);
}