Interface GamepadAxis2DEvent

A 2D axis event on the gamepad.

Hierarchy

  • BaseGamepadEvent<"axis2d">
    • GamepadAxis2DEvent

Properties

control: "axis2d"

The type of control.

index: number

The (control-specific) index of the control.

Buttons correspond to the standard layout specified in https://www.w3.org/TR/gamepad/#dfn-standard-gamepad.

Axes are mapped slightly differently:

Web API Standard Gamepad This API
Axis 0 (left stick x-axis) Axis2D 0
Axis 1 (left stick y-axis) Axis2D 0
Axis 2 (right stick x-axis) Axis2D 1
Axis 3 (right stick y-axis) Axis2D 1
Axis n (for n >= 4) Axis (n - 4)
source: string | number

The identifier, unique per client + device combo.

type: "gamepad"

The event type.

value: {
    x: number;
    y: number;
}

The 2D value of the axes.

Type declaration

  • x: number

    The value on the x-axis (between -1.0 and 1.0, modeled after the Web Gamepad API)

  • y: number

    The value on the y-axis (between -1.0 and 1.0, modeled after the Web Gamepad API)

Generated using TypeDoc