Firefox Tomorrow

web api interface

GamepadHapticActuator

View on MDN ↗

The GamepadHapticActuator interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.

This interface is accessible through the hapticActuators property.

Instance properties

  • effects Read only Experimental
    • : Returns an array of enumerated values representing the different haptic effects that the actuator supports.
  • type Deprecated Read only
    • : Returns an enumerated value representing the type of the haptic hardware. This property is deprecated: use GamepadHapticActuator.effects to detect effect support.

Instance methods

  • playEffect() Read only
    • : Causes the hardware to play a specific vibration effect.
  • pulse() Read only
    • : Makes the hardware pulse at a certain intensity for a specified duration.
  • reset() Read only
    • : Stops the hardware from playing an active vibration effect.

Examples

const gamepad = navigator.getGamepads()[0];

gamepad.hapticActuators[0].pulse(1.0, 200);

gamepad.vibrationActuator.playEffect("dual-rumble", {
  startDelay: 0,
  duration: 200,
  weakMagnitude: 1.0,
  strongMagnitude: 1.0,
});

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also