daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. AFRAME.registerComponent('markerhandler', {
  2.  
  3.     init: function() {
  4.         const animatedMarker = document.querySelector("#animated-marker");
  5.         const aEntity = document.querySelector("#animated-model");
  6.  
  7.         // every click, we make our model grow in size :)
  8.         animatedMarker.addEventListener('click', function(ev, target){
  9.             const intersectedElement = ev && ev.detail && ev.detail.intersectedEl;
  10.             if (aEntity && intersectedElement === aEntity) {
  11.                 const scale = aEntity.getAttribute('scale');
  12.                 Object.keys(scale).forEach((key) => scale[key] = scale[key] + 1);
  13.                 aEntity.setAttribute('scale', scale);
  14.             }
  15.         });
  16. }});
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top