1.0.1 • Published 4 years ago

aframe-state-restrict v1.0.1

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

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

PropertyDescriptionDefault Value
statesThe name of the states within which this entity will be active.'vr', 'non-vr'
pauseIf true, will pause the entity when inactive.true
hideIf 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/aframe-state-restrict@1.0.1/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');