GamepadButton.value
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Свойство GamepadButton.value
интерфейса GamepadButton
возвращает состояние аналоговой клавиши геймпада, такой, как, например триггеры.
Представляет собой дробное число в диапазоне 0.0
— 1.0
, где 0.0
показывает, что кнопка не нажата, а 1.0 - что нажата полностью.
Синтаксис
readonly attribute double value;
Пример
js
var gp = navigator.getGamepads()[0];
if (gp.buttons[0].value > 0) {
// respond to analog button being pressed in
}
Значение
Спецификации
Specification |
---|
Gamepad # dom-gamepadbutton-value |
Совместимость с браузерами
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.