Phaser API Documentation

  Version: 
Filter

Contains information about a specific Gamepad Axis. Axis objects are created automatically by the Gamepad as they are needed.

Constructor:

new Axis(pad, index)

Parameters:

name type description
pad Phaser.Input.Gamepad.Gamepad

A reference to the Gamepad that this Axis belongs to.

index number

The index of this Axis.

Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 9)

Members

Description:

An event emitter to use to emit the axis events.

Type:
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 37)
Focus
Focus
index: number
Focus
Focus

Description:

The index of this Axis.

Type:
number
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 46)
Focus
Focus

Description:

A reference to the Gamepad that this Axis belongs to.

Type:
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 28)
Focus
Focus
threshold: number
Focus
Focus

Description:

Movement tolerance threshold below which axis values are ignored in getValue.

Type:
number
Default: 0.1
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 66)
Focus
Focus
value: number
Focus
Focus

Description:

The raw axis value, between -1 and 1 with 0 being dead center. Use the method getValue to get a normalized value with the threshold applied.

Type:
number
Default: 0
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 55)
Focus
Focus

Methods

destroy()
Focus
Focus

Description:

Destroys this Axis instance and releases external references it holds.

Since: 3.10.0
Focus
Focus
getValue()
Focus
Focus

Description:

Applies the threshold value to the axis and returns it.

Returns:
Description:

The axis value, adjusted for the movement threshold.

Type:
  • number
Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 92)
Focus
Focus
<private> update(value)
Focus
Focus

Description:

Internal update handler for this Axis. Called automatically by the Gamepad as part of its update.

Parameters:

name type description
value number

The value of the axis movement.

Since: 3.0.0
Source: src/input/gamepad/Axis.js (Line 77)
Focus
Focus