aframe-toggle-controls-component
A Toggle Controls component for A-Frame. Toggle is touch and mouse click or by any other event, like from the input mapping or keydown events.
For A-Frame.
API
Multiple components may be set on the scene entity.
Property | Description | Default Value |
---|---|---|
enabled | Listen for events | false |
toggled | Initial toggled state | false |
events | List of events that are used for toggling | [] |
type | Type of the toggle. Either single or double |
single |
toggleTimeout | The time in milliseconds between to toggleEvents if the toggleType is double |
400 |
onEvents | Events to be fired when the toggle state is toggled | [] |
offEvents | Events to be fired when the toggle state is not toggled | [] |
eventCond | Check the specific event if the key meets the value. Format key=value , like keyCode=Space |
`` |
Installation
Browser
Install and use by directly including the browser files:
My A-Frame Scene
npm
Install via npm:
npm install aframe-toggle-controls-component
Then require and use.
;;