【发布时间】:2018-08-07 16:50:24
【问题描述】:
对于这个问题,找不到任何明确而直接的答案。我使用 Aframe 构建网站的介绍页面 (https://nightmarinparis.neocities.org/)。我遇到的问题是将旋转的 Twitter 和 Instagram 块变成链接。
我想要发生的事情:
- 当光标接触到框时,框的轮廓会突出显示
- 点击后应该会转到另一个网页(例如:google.com)
到目前为止,这就是我所拥有的所有代码。我觉得我已经尝试了一切,包括 AFrame (https://github.com/aframevr/aframe/blob/master/examples/showcase/link-traversal/js/components/link-controls.js) 提供的链接控件组件。实现这一点的任何帮助都将是惊人的。提前致谢!
<html>
<meta charset="utf-8" />
<script src="https://cdn.rawgit.com/aframevr/aframe/v0.4.0/dist/aframe-master.js"></script>
<!-- For Rain -->
<script src="https://unpkg.com/aframe-animation-component@3.2.1/dist/aframe-animation-component.min.js"></script>
<!-- For Linking -->
<script src="https://raw.githubusercontent.com/aframevr/aframe/master/examples/showcase/link-traversal/js/components/aframe-tooltip-component.js"></script>
<script src="https://raw.githubusercontent.com/aframevr/aframe/master/examples/showcase/link-traversal/js/components/camera-position.js"></script>
<script src="https://raw.githubusercontent.com/aframevr/aframe/master/examples/showcase/link-traversal/js/components/ground.js"></script>
<script src="https://raw.githubusercontent.com/aframevr/aframe/master/examples/showcase/link-traversal/js/components/link-controls.js"></script>
<script src="https://raw.githubusercontent.com/aframevr/aframe/master/examples/showcase/link-traversal/shaders/skyGradient.js"></script>
<title>Nightmares In Paris </title>
<body>
<a-scene fog="type: exponential; color: #AAA" density=".00005" raycaster="far: 100; objects: [link];" cursor="mode: mouse" camera-position>
<a-entity position="2.513 4.939 -50" id="snow" particle-system="preset: rain; color: #24CAFF; particleCount: 2000; size: .20;" opacity="3"></a-entity>
<a-assets>
<img id="sky" src="Storm.jpg">
<a-asset-item id="bat" src="bat.obj"></a-asset-item>
<a-asset-item id="bigbat" src="bigbat_morph.obj"></a-asset-item>
<a-asset-item id="tower" src="https://nightmarinparis.neocities.org/eiffel.obj"></a-asset-item>
</a-assets>
<!-- Sky -->
<a-sky src="#sky" material="" geometry=""></a-sky>
<!-- Eiffel Tower -->
<a-obj-model src="#tower" position="2.513 65 -295" material="color:#121212" obj-model="">
<a-animation attribute="rotation" dur="5000" to="0 -360 0" repeat="indefinite"></a-animation>
</a-obj-model>
<!-- ComingSoon -->
<a-box width="100" height="100" depth="100" position="2.513 4.939 -370" src="https://nightmarinparis.neocities.org/comingsoongraphic.png">
<a-animation attribute="rotation" dur="5000" to="0 360 0" repeat="indefinite"></a-animation>
</a-box>
<!-- Twitter Social Box -->
<a-box width="100" height="40" depth="100" position="2.513 -65 -370" src="https://nightmarinparis.neocities.org/twitter.png">
<a-animation attribute="rotation" dur="5000" to="0 -360 0" repeat="indefinite"></a-animation>
<a-link href="https://google.com"></a-link>
</a-box>
<!-- Instagram Social Box -->
<a-box width="100" height="40" depth="100" position="2.513 -110 -370" src="https://nightmarinparis.neocities.org/Instagram.png">
<a-animation attribute="rotation" dur="5000" to="0 360 0" repeat="indefinite"></a-animation>
<a-link href="https://google.com"></a-link>
</a-box>
<!-- Test Links -->
<!-- Bats -->
<a-obj-model src="#bigbat" mtl="bigbat_morph.mtl" position="513.517 546.477 -1655.234" rotation="-36.326 150.058 -128 .801" material="color:#121212" obj-model="">
</a-obj-model>
<a-obj-model src="#bat" position="613.517 546.477 -1655.234" rotation="-36.326 150.058 -128 .801" material="color:#121212" obj-model="">
</a-obj-model>
<a-obj-model src="#bat" position="-909.061 546.477 -2422.7" rotation="-59.01465289847479 131.6084055415501 -112.29972784564136" material="color:#121212">
</a-obj-model>
<a-obj-model src="#bat" position="-122.324 -534.864 -1486.223" rotation="26.35605857601787 27.559269945792597 31.455382952682196" material="color:#121212">
</a-obj-model>
<a-obj-model src="#bat" position="1786.062 368.994 -2422.7" rotation="31.341 29.049 34.549" material="color:#121212" obj-model="">
</a-obj-model>
<a-obj-model src="#bat" position="-234.581 1009.819 -4363.575" rotation="31.340791393656033 29.048960213132737 34.54935504638864" material="color:#121212">
</a-obj-model>
<a-entity link="href: http://cerberus-usa.net; title: Link; image: storm1.jpg"></a-entity>
<!-- Eiffel Tower -->
<!-- Buttons -->
<a-entity cursor="fuse:true;fuseTimeout:500" position="0 0 -1" geometry="primitive:ring;radiusInner:0.02;radiusOuter:0.03" material="shader:flat;color:cyan" raycaster="">
</a-entity>
<a-entity position="0.148 -10.937 0" scale="0.62 1 1" rain="count:10000;color:#5353ff;height:100;" mixin="null" texture="rainrain.png">
</a-entity>
</a-scene>
【问题讨论】:
标签: aframe