Guest User

Untitled

a guest
Mar 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. <a-plane button-interaction-handler position="3 3 -9" height="9" width="5" color="#a9957c" position="0 0 -4">
  2. <a-text value="Rectangular Plane Title" scale="2 2 2" align="center" ></a-text>
  3. </a-plane>
  4.  
  5. <html>
  6. <head>
  7. <title>Changing the Sky</title>
  8. <script src="https://aframe.io/releases/0.6.1/aframe.min.js"></script>
  9. <script>
  10. AFRAME.registerComponent('button-interaction-handler', {
  11. init: function () {
  12. var skyEl = this.el.sceneEl.querySelector('#background');
  13.  
  14. this.el.addEventListener('mouseenter', function () {
  15. skyEl.setAttribute('src', '#eyeTime');
  16. });
  17.  
  18. this.el.addEventListener('mouseleave', function () {
  19. skyEl.setAttribute('src', '#backgroundInsideHouse');
  20. });
  21. }
  22. });
  23. </script>
  24. </head>
  25. <body>
  26. <a-scene>
  27. <a-assets>
  28. <img id="backgroundInsideHouse" crossorigin="anonymous" src="https://cdn.glitch.com/e6225ccd-c32e-4cf8-b039-e78814a8cb78%2Fbg-3.jpg">
  29. <img id="eyeTime" crossorigin="anonymous" src="mainimage.jpg">
  30. </a-assets>
  31.  
  32. <a-sky id="background" src="#backgroundInsideHouse"></a-sky>
  33.  
  34. <!--
  35. Since this is inside the plane, the text position is relative to the plane's position
  36. If we use the property align wisely, we don't need to experiment with position.
  37. -->
  38. <a-plane button-interaction-handler position="3 3 -9" height="9" width="5" color="#a9957c" position="0 0 -4">
  39. <a-text value="Rectangular Plane Title" scale="2 2 2" align="center" ></a-text>
  40. </a-plane>
  41.  
  42. <!-- Camera and Cursor. -->
  43. <a-camera>
  44. <a-cursor color="#11D8C4" fuse="true" timeout="10"></a-cursor>
  45. </a-camera>
  46.  
  47. <!-- Controllers. -->
  48. <a-entity laser-controls="hand: right"></a-entity>
  49. </a-scene>
  50. </body>
  51. </html>
Add Comment
Please, Sign In to add comment