有一个奇怪的 webVR Mozilla A-Frame 问题
所以我在 a-curvedimage 标签中加载图像(里面有一些动画内容),如下所示:
<a-curvedimage src="img/wolfson.png" position="0 1 -10" radius="15.7" theta-length="90" height="10" rotation="0 100 0" scale="0.8 0.8 0.8">
<a-animation easing="linear"attribute="rotation"dur="8000"fill="backward"from="0 0 0" to="0 360 0"repeat="indefinite"></a-animation>
</a-curvedimage>
我正在检查 chrome 中的网络选项卡(在优化方面相当新,刚刚学习这些东西),我看到图像已被请求两次,一次是由我的脚本请求的,就像我预期的那样,但第二次,由“其他”请求。
我从 a-curvedimage 标记中删除了 src 属性,重新加载页面,图像的两个实例都消失了。
演示可以在http://www.forwardcreation.com查看...将鼠标悬停在底部的“我们过去的工作”部分。
我不明白为什么它被请求两次...A-Frame 有问题吗?我做错了什么(可能!)
感谢您的帮助!
最佳答案
不确定发生了什么,但作为一种解决方法(并利用浏览器缓存),也许您可以在 <a-assets>
中定义图像
<a-scene>
<a-assets>
<img id="myImg" src="img/wolfson.png">
</a-assets>
<a-curved-image src="#myImg"></a-curved-image>
</a-scene>
这样,您还可以获得浏览器缓存。
关于javascript - Mozilla A 框架加载图像两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38978890/