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
インターフェイスのプロパティで、トリガーなど、現代の多くのゲームパッドにおけるアナログボタンの現在の状態を表すために使用する double 値を返します。
値は 0.0
- 1.0
の範囲で正規化され、0.0
は押されていないボタン、1.0
は完全に押されたボタンを表します。
例
js
let gp = navigator.getGamepads()[0];
if (gp.buttons[0].value > 0) {
// アナログボタンが押されたことに対する反応
}
値
A double.
仕様書
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.