【发布时间】:2019-04-19 05:45:48
【问题描述】:
单击菜单选项之一时,我需要将图像加载到场景中。任何朝着正确方向的推动将不胜感激。如果需要更多上下文,请告诉我。
我试过用这种方法加载它,测试一个变量,重新加载时场景保持不变:
var testButton = document.getElementById('box1');
testButton.onclick = function (sceneEditor) {
sceneEditor = new Scene(img3, camera);
alert("!"); //test alert
window.location.reload();
};
html 下拉菜单:
<select id="box1" style="margin-left:120px; margin-bottom:-20px; margin-
top:-30px; padding-top:0">
<option onclick="" value="1">111</option>
<option onclick="" value="2">222</option>
<option onclick="" value="3">333</option>
<option onclick="" value="4">444</option>
</select>
图像变量和示例场景;
var img1 = 'images/111.jpg';
var img2 = 'images/222.jpg';
var img3 = 'images/333.jpg';
var img4 = 'images/444.jpg';
var sceneEditor = new Scene(img2, camera);
【问题讨论】:
-
你有几个问题基本相同。最好发布一个并坚持下去。
标签: javascript html three.js