【问题标题】:I cannot add an image in aframe我无法在框架中添加图像
【发布时间】:2021-01-21 22:23:52
【问题描述】:

我正在努力解决这个问题。我已经将框架用于其他一些没有问题的事情。我正在尝试让图像显示在框架上。这是我正在使用的代码。

<!DOCTYPE html>
<html>
    <head>
       <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
    </head>
    
    <body>
        <a-scene>
            <a-assets>
                <img id="my-image" src="assets/cowboy.jpg">
            </a-assets>

            <!-- Using the asset management system. -->
            <a-image src="#my-image" width="16" height="9"></a-image>

            <!-- Defining the URL inline. Not recommended but more comfortable for web developers. -->
            <!--<a-image src="assets/cowboy.jpg" width="16" height="9"></a-image>-->
        </a-scene>
    </body>
</html>

这是托管此代码的故障页面:https://nonstop-bramble-leaf.glitch.me

代码直接取自 aframe.io。我尝试过使用在线托管的图像,也尝试使用上传到故障的资产。这是一个完全的菜鸟问题,但请帮助我理解。谢谢!

【问题讨论】:

    标签: aframe


    【解决方案1】:

    glitch 上的资产不是可用的子目录,

    <img id="my-image" src="assets/cowboy.jpg">
    

    你必须去assets文件夹,点击一个asset,复制实际的URL:

    <img id="my-image" src="https://cdn.glitch.com/59a9c00b-1ef0-4ec8-8cb6-8313232369e0%2Fcowboy.jpg">
    

    还有should be working properly

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-04-19
      • 1970-01-01
      • 2013-02-02
      • 2020-05-19
      • 2023-03-28
      • 2013-01-22
      • 1970-01-01
      相关资源
      最近更新 更多