简体   繁体   English

如何使图像成为框架中的链接?

[英]How Do I Make an Image a link in A Frame?

I'm trying to make an augmented reality clickable icon to go to google.com.我正在尝试将增强现实可点击图标制作成 go 到 google.com。 Following the docs, I'm unable to get the link to work.按照文档,我无法获得工作链接。 I've tried so many other sites but none seem to work.我试过很多其他网站,但似乎都不起作用。 Here, I have the cleanest, non-convoluted version of what I tried.在这里,我有我尝试过的最干净、最不复杂的版本。

(I did this in 8th Wall, if that makes any difference) (我在 8th Wall 做了这个,如果有什么不同的话)

Here is what I have so far:这是我到目前为止所拥有的:

head.html头.html

<meta name="8thwall:renderer" content="aframe:1.3.0">
<meta name="8thwall:package" content="@8thwall.xrextras">
<meta name="8thwall:package" content="@8thwall.landing-page">
<meta name="8thwall:package" content="@8thwall.coaching-overlay">

body.html身体.html

<a-scene 
landing-page
xrextras-loading
xrextras-runtime-error
xrextras-gesture-detector
xrweb>

  <a-assets>
    <img id="email" src="assets/email_icon_red.png">
  </a-assets>
  
  <a-entity 
    light="
      type: directional; 
      castShadow: true; 
      color: white; 
      intensity: 0.5" 
    position="5 10 7">
  </a-entity>
  
  <a-camera position="0 2 2"></a-camera>

  
  <a-entity link="href: https://aframe.io/; image: #email"></a-entity>
<!--image does not appear when I used this, as shown on A-frame doc--> 

 <!-- <a-image src="#email"></a-image>
 --> 
  
  <a-plane 
    height="2000" 
    width="2000" 
    rotation="-90 0 0" 
    material="shader: shadow; opacity: 0.67" 
    shadow>
  </a-plane>  
</a-scene>

I think there may be a bug in A-Frame currently for the property 'visualAspectEnabled' which controls if the link should display as a Portal or other design.我认为目前 A-Frame 中可能存在一个错误,用于控制链接是否应显示为门户或其他设计的属性“visualAspectEnabled”。 It seems you can omit the property only when you have specified the geometry and material for the other design, but when you want to use the Portal you must include it inside of link as true.似乎只有当您为其他设计指定了几何形状和材料时才可以省略该属性,但是当您想要使用 Portal 时,您必须将其包含在链接中作为 true。 A-Frame Link Docs ( https://aframe.io/docs/1.3.0/components/link.html ) A-Frame 链接文档 ( https://aframe.io/docs/1.3.0/components/link.html )

These should work in your example, but you will want to adjust their position/rotation and geometry size to match your scene/camera as well.这些应该适用于您的示例,但您需要调整它们的位置/旋转和几何尺寸以匹配您的场景/相机。

<!-- Portal link w/ 360 image -->
<a-entity id="portalLink"
position="0 0 0" rotation="0 0 0" scale="1 1 1"
link="href: https://aframe.io/; image: #email; visualAspectEnabled: true;"
></a-entity>

<!-- Plane link w/ flat image -->
<a-entity id="planeLink"
position="0 0 0" rotation="0 0 0" scale="1 1 1"
geometry="primitive: plane; height: 1; width: 1;"
material="shader: flat; src: #email; side: front;"
link="href: https://aframe.io/;"
></a-entity>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM