~/talk

Playing with the Gamepad API: Using Game Controllers with JS

Talkat Commit Your Code 2025 · 2025-09-25..09-26· [web-platform, javascript]
slides:none on file

Explains concrete behavior and gotchas: only two events fire so code polls with navigator.getGamepads on requestAnimationFrame; Chrome often returns an array of four with null slots; Firefox exposes six axes on some sticks; axes are -1..1 and need a deadzone (recommend ~0.2); buttons deliver continuous pressed state so track previous value; vibration APIs vary by browser; demos include Super Pepper Bros, an arenoid, and a Wacamo-style music game built in vanilla JavaScript and running locally.

AI-written summary · about

  1. 0:00Gamepad API intro
  2. 1:04What is Gamepad API
  3. 2:08Gamepad API events
  4. 3:32Proactive gamepad state
  5. 4:13Getting gamepads
  6. 5:18Gamepad properties
  7. 8:35Standard vs non-standard
  8. 9:37Multiple gamepads
  9. 10:41requestAnimationFrame vs setInterval
  10. 12:51Button press states
  11. 14:15Joystick axis values
  12. 16:46Vibration actuator
  13. 18:12Library recommendations
  14. 18:33Live demos
  15. 22:59Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.