GamepadButton.value
特性为
GamepadButton
interface returns a double value used to represent the current state of analog buttons on many modern gamepads, such as the triggers.
The values are normalized to the range
0.0
—
1.0
,采用
0.0
representing a button that is not pressed, and 1.0 representing a button that is fully pressed.
readonly attribute double value;
var gp = navigator.getGamepads()[0];
if(gp.buttons[0].value > 0) {
// respond to analog button being pressed in
}
A
double
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
Gamepad
The definition of 'GamepadButton.value' in that specification. |
工作草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
value
|
Chrome
35
|
Edge 12 |
Firefox
29
|
IE No |
Opera
22
|
Safari 10.1 | WebView Android No | Chrome Android Yes | Firefox Android 32 |
Opera Android
22
|
Safari iOS 10.3 | Samsung Internet Android Yes |
完整支持
不支持
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。
GamepadButton
pressed
value