Skip to content

Instantly share code, notes, and snippets.

@Strae
Created September 21, 2017 10:52
Show Gist options
  • Save Strae/72effc5ced1781b2280c747675d9c707 to your computer and use it in GitHub Desktop.
Save Strae/72effc5ced1781b2280c747675d9c707 to your computer and use it in GitHub Desktop.
Aframe zoom control test
AFRAME.registerComponent( 'cth-zoom', {
schema: {
to: { type: 'string' }
},
init: function () {
var data = this.data;
var el = this.el;
var cameraEl = document.getElementById( 'cth-camera' );
el.addEventListener( 'click', function () {
var _camera = cameraEl.getAttribute( 'camera' );
_camera.zoom = data.to;
cameraEl.setAttribute( 'camera', _camera );
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment