【问题标题】:how to add text and image over the 360 images A-Frame如何在 360 度图像 A-Frame 上添加文本和图像
【发布时间】:2017-04-13 08:59:42
【问题描述】:

我想在 A-Frame 的 360 度图像上添加文字和图像如何在 360 度以上添加文字和图像?

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!-- A-Frame standard library if needed -->
<script src="https://aframe.io/releases/latest/aframe.js"></script>
<!-- Component (includes A-Frame core) -->
<script src="dist/aframe-no-click-look-controls.min.js"></script>
</head>
<body>
<a-scene>
    <a-entity camera no-click-look-controls></a-entity>
            <h1>hello</h1>
    <a-sky src="https://cdn.glitch.com/fbc36a5e-0d0e-45d3-b6cb-
   0c1f01f6cd8e%2FMuttukadu%20Boat%20House(2K).jpg?1491283410006" 
  rotation="0 -130 0"></a-sky>
</a-scene>
</body>
</html>

【问题讨论】:

    标签: javascript html aframe 360-virtual-reality


    【解决方案1】:

    您可以将a-scene 包装在div 中并在其上设置position:relative。接下来,将另一个div 附加到第一个的内容(在a-scene 之后)并在其上设置position:absolute。这会将第二个div 的内容覆盖在a-scene 上。接下来,您需要做的就是根据需要定位第二个div,并在其中添加文本和图像。如果第二个div 内容不显示,请考虑调整它的z-index 值。

    生成的代码如下所示:

    <div style="position:relative;">
        <a-scene>
            <!-- a-scene content here -->
        </a-scene>
        <div style="position:absolute; top:0px; left:0px; z-index:1000;">
            <!-- your overlay content here -->
        </div>
    </div>
    

    【讨论】:

    • 如果我们需要将覆盖内容映射到 的特定部分呢?例如,我有一个场景,有一个海滩和一所房子。我想在房子顶部覆盖一个按钮。当我们四处移动全景图时,按钮将始终位于房屋顶部。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-17
    • 2018-01-26
    • 1970-01-01
    • 2018-04-21
    • 2018-12-30
    相关资源
    最近更新 更多