All examples · Input

Gamepad

What this example shows

Every button, trigger and stick at once. You need a controller, and the browser will not show it until you press a button on it, so "no controller" is the normal state when the page opens.

useGamepad() with no number follows the first pad connected, which is what a one player game means: the ports belong to the browser, and a pad unplugged and put back usually turns up in another one. A number is for local multiplayer, where player two has to keep meaning one particular controller. Click the box to try the rumble; on macOS it often does nothing, and canRumble says so.

Starting