Created
September 21, 2017 10:52
-
-
Save Strae/72effc5ced1781b2280c747675d9c707 to your computer and use it in GitHub Desktop.
Aframe zoom control test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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