我正在尝试使用A-Frame创建360'VR图像库。我最初遵循A-Frame主网站(https://aframe.io/docs/0.9.0/guides/building-a-360-image-gallery.html)上的指南。该功能可以在桌面视图中使用,这意味着我可以将光标移到两个图像门户上,然后将鼠标悬停在其中,以进行运输。不幸的是,当我在iPhone上以VR模式查看此图片,然后在Google纸板设备上查看时,光标不会移动-它卡在了适当的位置。
我尝试更改为最新的0.9.1版本,但似乎在VR模式下存在错误,因此我已恢复为0.9.0。
我还尝试过使用<a-entity cursor="fuse: true; fuseTimeout: 500"
而不是<a-cursor>
原语。
我已经在https://whatapalaver.github.io/javascriptings/image_play/360/gallery.html
上进行了演示我已经使用Firefox,Chrome和Safari浏览器在ios上对其进行了测试。
<html>
<head>
<meta charset="utf-8">
<title>360° Image Gallery</title>
<meta name="description" content="360° Image Gallery - A-Frame">
<script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-event-set-component@5/dist/aframe-event-set-component.min.js"></script>
<script src="https://unpkg.com/aframe-layout-component@5.3.0/dist/aframe-layout-component.min.js"></script>
<script src="https://unpkg.com/aframe-template-component@3.2.1/dist/aframe-template-component.min.js"></script>
<script src="https://unpkg.com/aframe-proxy-event-component@2.1.0/dist/aframe-proxy-event-component.min.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<!-- Images. -->
<img id="photo" src="./images/test5.jpg">
<img id="photo-thumb" src="./images/test5-thumb.png">
<img id="cast-courts" src="./images/test6.jpg">
<img id="cast-courts-thumb" src="./images/test6-thumb.png">
<!-- Image link template to be reused. -->
<script id="link" type="text/html">
<a-entity class="link"
geometry="primitive: plane; height: 1; width: 1"
material="shader: flat; src: ${thumb}"
event-set__mouseenter="scale: 1.2 1.2 1"
event-set__mouseleave="scale: 1 1 1"
event-set__click="_target: #image-360; _delay: 300; material.src: ${src}"
proxy-event="event: click; to: #image-360; as: fade">
</a-entity>
</script>
</a-assets>
<!-- 360-degree image. -->
<a-sky id="image-360" radius="10" src="#cast-courts"
animation__fade="property: components.material.material.color; type: color; from: #FFF; to: #000; dur: 300; startEvents: fade"
animation__fadeback="property: components.material.material.color; type: color; from: #000; to: #FFF; dur: 300; startEvents: animationcomplete__fade"></a-sky>
<!-- Image links. -->
<a-entity id="links" layout="type: line; margin: 1.5" position="0 -1 -4">
<a-entity template="src: #link" data-src="#photo" data-thumb="#photo-thumb"></a-entity>
<a-entity template="src: #link" data-src="#cast-courts" data-thumb="#cast-courts-thumb"></a-entity>
</a-entity>
<!-- Camera + cursor. -->
<a-entity id="camera" camera look-controls>
<a-cursor
id="cursor"
fuse=true
animation__click="property: scale; startEvents: click; from: 0.1 0.1 0.1; to: 1 1 1; dur: 150"
animation__fusing="property: fusing; startEvents: fusing; from: 1 1 1; to: 0.1 0.1 0.1; dur: 1500"
event-set__mouseenter="_event: mouseenter; color: springgreen"
event-set__mouseleave="_event: mouseleave; color: black"
material="color: blue; shader: flat"
position="0 0 -3"
raycaster="objects: .link">
</a-cursor>
</a-entity>
</a-scene>
</body>
</html>
我意识到即使在台式机版本中,光标也很小,但我希望在使用VR模式和Google纸板时能够看到它。我们应该能够将光标移至插图上并悬停以切换背景图片。