Your Search Results

    GamepadButton.value

    This article is in need of a technical review.

    This article is in need of an editorial review.

    « GamepadButton

    The GamepadButton.value property of the GamepadButton interface returns a double value used to represent the current state of analog buttons, such as the triggers on many modern gamepads.

    The values are normalized to the range 0.01.0, with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed.

    Syntax

        readonly    attribute double  value;

    Example

    var gp = navigator.getGamepads()[0];
    
    if(gp.buttons[0].value > 0) {
      // respond to analog button being pressed in
    } 

    Value

    A double.

    Specifications

    Specification Status Comment
    Gamepad Working Draft  

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    General support 21.0 webkit 24.0 (24.0) moz
    28.0 (28.0)
    Not supported Not supported Not supported
    Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
    General support Not supported Not supported Not supported Not supported Not supported

    See also

    Using the Gamepad API

    Document Tags and Contributors

    Contributors to this page: teoli, chrisdavidmills
    Last updated by: teoli,