1.6.3 • Published 3 years ago

aframe-haptics-component v1.6.3

Weekly downloads
302
License
MIT
Repository
github
Last release
3 years ago

aframe-haptics-component

Version License

A controller haptics (vibrations) component for A-Frame. Supported by experimental Gamepad Extensions. Read about browser support.

Demo

API

PropertyDescriptionDefault Value
actuatorIndexIndex of the actuator from the gamepad's array of actuators.0
durDuration of vibration pulse (milliseconds).100
enabledWhether the component should pulse on the event.true
eventsArray of events to listen for to trigger a pulse (e.g., triggerdown, triggerup)[]
eventsFromTarget entity to listen for events if other than the controller entity.this.el
forceIntensity of pulse (from 0 to 1)1

Methods

NameDescription
pulseManually trigger pulse (can pass in force and duration as arguments, defaults data-defined duration and force).
this.el.components.haptics.pulse();

// function pulse (force, duration)
this.el.components.haptics.pulse(0.5, 200);

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-haptics-component/dist/aframe-haptics-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity hand-controls="left"  haptics="events: triggerdown; dur: 1000; force: 0.5"></a-entity>
    <a-entity hand-controls="right" haptics="events: triggerdown; dur: 500; force: 1.0"></a-entity>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-haptics-component

Then require and use.

require('aframe');
require('aframe-haptics-component');
1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago