aframe-state-restrict
v1.0.1
Published
a-frame component which pauses and hides an entity if it does not contain any of the specified states.
Downloads
1
Maintainers
Readme
Entity State Restrictor
This component pauses and hides an entity if it does not contain any of the specified states.
Using this along with aframe-vr-mode-watcher can allow you to create entities that are conditionally active only during vr or non-vr modes.
API
| Property | Description | Default Value |
| -------- | ----------- | ------------- |
| states | The name of the states within which this entity will be active. | 'vr', 'non-vr'
|
| pause | If true, will pause the entity when inactive. | true
|
| hide | If true, will hide the entity's object3D when inactive. | true
|
Installation
Browser Installation
Install and use by directly including the browser files:
<head>
<title>My A-Frame Scene</title>
<script src="https://aframe.io/releases/1.0.0/aframe.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/aframe-state-restrict.min.js"></script>
</head>
<body>
<a-scene>
<a-entity
restrict-entity="states: non-vr"
geometry="primitive: box">
</a-entity>
</a-scene>
</body>
NPM Installation
Install via NPM:
npm install aframe-state-restrict
Then register and use.
require('aframe');
require('aframe-state-restrict');