Skip to content

lightgun-poc / lib/cursor / createCursorLoop

Function: createCursorLoop() ​

createCursorLoop(mouse, getRect, getTarget, onError?, tickMs?): CursorLoop

Defined in: lib/cursor.ts:54

Pull model: every tick asks getTarget() for where the cursor should be NOW (the newest phone sample) and moves only when the target pixel changed. A slow setPosition call can never queue stale positions.

Parameters ​

mouse ​

MouseLike

getRect ​

() => TargetRect

getTarget ​

() => { u: number; v: number; } | null

onError? ​

(e) => void

tickMs? ​

number = 2

Returns ​

CursorLoop

Released under the MIT License.