gpt4 book ai didi

javascript - A 帧 : how to change image using javascript

转载 作者:行者123 更新时间:2023-12-04 17:54:10 24 4
gpt4 key购买 nike

更改图像需要什么 JavaScript?我不知道如何定位他们:

<a-scene stats>
<a-sky src="../1/img/2.jpg"></a-sky>
<a-assets>
<img id="my-image" src="../1/img/bear.png" >
<img id="bear2" src="../1/img/bear.png" >
<img id="bear3" src="../1/img/bear.png" >
</a-assets>
<!-- Using the asset management system. -->
<a-image src="#my-image" width="10" height="10" position="-5 1 -7" rotation="0 10 0"></a-image>
<a-image src="#bear2" width="10" height="10" position="5 1 -5" rotation="0 -60 0"></a-image>
<a-image src="#bear3" width="150" height="150" position="-45 2 100"></a-image>
<!-- Defining the URL inline. Not recommended but more comfortable for web developers.-->

最佳答案

document.querySelector('#my-image').setAttribute('src', 'foo.jpg')

https://aframe.io/docs/0.4.0/guides/using-javascript-and-dom-apis.html

关于javascript - A 帧 : how to change image using javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41798613/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com