Class: Axis

rune.input.Axis(name)

Combines action pairs and gamepad stick components into a value from -1 to 1. The strongest binding wins; ties favor the first registered binding. Stick values use the gamepad's existing dead zone. Bindings are sampled after actions.

Constructor

new Axis(name)

Creates a named analog axis owned by an Actions collection.
Parameters:
Name Type Description
name string Non-empty axis name, matched without regard to case.
Source:
Throws:
If the name is invalid.
Type
TypeError

Members

(readonly) name :string

Normalized axis name.
Type:
  • string
Source:

(readonly) value :number

Current sampled value. Reading does not resample devices.
Type:
  • number
Source:

Methods

bindActions(negative, positive) → {rune.input.Axis}

Adds an action pair. Missing actions read as released and may be created later. Duplicate bindings are ignored. Changes are sampled on the next update.
Parameters:
Name Type Description
negative string Action name for -1.
positive string Action name for 1.
Source:
Throws:
If a name is invalid or the axis is disposed.
Type
Error
Returns:
This axis.
Type
rune.input.Axis

bindStick(stick, component) → {rune.input.Axis}

Adds one stick component, retaining the gamepad's existing dead zone. Duplicate bindings are ignored. Changes are sampled on the next update.
Parameters:
Name Type Description
stick string Left or right, matched without regard to case.
component string X or y, matched without regard to case.
Source:
Throws:
If the binding is invalid or the axis is disposed.
Type
Error
Returns:
This axis.
Type
rune.input.Axis

clear() → {undefined}

Removes all bindings. The value becomes zero on the next update.
Source:
Returns:
Type
undefined

reset() → {undefined}

Resets the sampled value without changing bindings.
Source:
Returns:
Type
undefined