GamepadButton: value property
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.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Thuộc tính GamepadButton.value của giao diện
GamepadButton trả về giá trị double dùng để biểu diễn
trạng thái hiện tại của các nút analog trên nhiều tay cầm hiện đại, chẳng hạn như các nút kích hoạt.
Các giá trị được chuẩn hóa trong phạm vi 0.0 đến 1.0, với
0.0 đại diện cho nút không được nhấn, và 1.0 đại diện cho
nút được nhấn hoàn toàn.
Ví dụ
js
let gp = navigator.getGamepads()[0];
if (gp.buttons[0].value > 0) {
// respond to analog button being pressed in
}
Giá trị
Một double.
Thông số kỹ thuật
| Specification |
|---|
| Gamepad> # dom-gamepadbutton-value> |