Skip to content

urish/aframe-camera-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aframe-camera-events

A-Frame helper that emit events whenever the camera position / orientation changes.

Listens to changes in your camera's orientation and position and emits rotationChanged / positionChanged events respectively.

Installation

Add the following line to your html file, just after loading A-Frame:

<script src="https://rawgit.com/urish/aframe-camera-events/master/index.js"></script>

You can also get this component through npm:

npm install --save aframe-camera-events

Usage

Add the position-listener and / or rotation-listener components to your a-camera:

<a-camera id="my-camera" position-listener rotation-listener>
</a-camera>

You can then attach event listeners to your camera, e.g.:

document.getElementById('my-camera')
  .addEventListener('rotationChanged', e => {
    console.log('New rotation:', e.detail);
  });

License

MIT.

About

A-Frame helper to emit events when camera position / orientation changes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published