我想使用徽标从场景内部链接到外部 URL(常规网站,而不是 VR)。这就是我所拥有的:
<a-entity link="highlighted: true; highlightedColor:#000000; portal:#ec1e1e; href: https://schatzkin.com; title: Back to website; image: assets/logo-lockup-black.png"></a-entity>
当我检查元素时,我看到链接下正确列出了图像,并且在材质下也看到了全景图像。但在实际的门户中,我看到的只是纯洋红色。
感谢您的帮助!
1)使用链接组件。前提是图像可以访问
a) 路径正确
b) 不存在 CORS 问题
设置image
属性应提供背景portal
这是link
成分。
link="highlighted: true; highlightedColor:#000000; href: https://schatzkin.com;
titleColor: black; title: Back to website;image: https://i.imgur.com/wjobVTN.jpg"
2)制作您自己的链接。任何元素都可以成为一些js的链接。
您可以创建自己的元素,这将改变window.location
点击时:
AFRAME.registerComponent("mylink", {
init: function() {
this.el.addEventListener("click", (e)=> {
window.location = this.data.href;
})
}
})
HTML
<a-text color="black" position="1 1 -2" value="goToSchatzkin"
mylink="href: https://schatzkin.com;"></a-text>
在我的中查看这两种方法fiddle https://jsfiddle.net/sj7uoLed/19/,或在下面:
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script>
AFRAME.registerComponent("mylink", {
init: function() {
this.el.addEventListener("click", (e) => {
window.location = this.data.href;
})
}
})
</script>
<a-scene cursor="rayOrigin: mouse">
<a-text color="black" position="1 1.6 -2" value="Click the text"
mylink="href: https://schatzkin.com;"></a-text>
<a-entity position="-1 1.6 -2"
link="highlighted: true;
highlightedColor:#000000; backgroundColor: red;
href: https://schatzkin.com; titleColor: black;
title: click the image below.;
image: https://i.imgur.com/wjobVTN.jpg;
visualAspectEnabled: true"></a-entity>
</a-scene>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)