【发布时间】:2019-09-25 03:13:35
【问题描述】:
我正在使用一个函数动态创建 A-FRAME 场景,该函数将图像路径作为参数并返回构建的 A-FRAME a-scene。
虽然尝试使用 ctrl + alt + i 初始化 A-FRAME 检查器不起作用,但返回的值正在工作并在 DOM 中正确显示,这主要是由于动态附加的内容。
A-FRAME 中是否有允许检查员处理动态附加内容或其他此类解决方法的标志或设置?
function buildCelestialBody(a) {
let aframe= `
<!-- AFRAME CONTENT -->
<!-- MAIN SCENE -->
<a-scene embedded
loading-screen="dotsColor: #ffffff; backgroundColor: black;"
vr-mode-ui="enabled: false fuseTimeout: 0">
<!-- ASSETS -->
<a-assets>
<img id="celestialbody" src="${a}"></img>
</a-assets>
<!-- CAMERA -->
<a-entity id='cameraWrapper' position="0 0 0" rotation="0 0 0">
<a-camera id="camera1" camera="active: true; zoom: 3.5;
spectator: false;"
look-controls="enabled: false"></a-camera>
</a-entity>
<!-- CELESTIAL BODY -->
<a-sphere src="#celestialbody"
geometry="primitive: sphere;
segmentsHeight: 100;
segmentsWidth: 100"
scale="1 1 1"
position="0 0 -8.5;"
animation="property: rotation;
dur: 200000;
from: 400 360 0;
to: 400 -360 0;
dir: reverse;
loop: true;
easing: linear"
id="celestialbody" celestialbody>
</a-sphere>
<!-- LIGHT -->
<a-entity id="light"
light="type:directional; castShadow:true;"
position="2 1 1"
animation="property: position;
dur: 2000;
from: 2 1 1;
to: -2 1 1;
dir: reverse;
loop: true;
autoplay: false;
easing: easeInQuad;">
</a-entity>
</a-entity>
<!-- LIGHT SOURCES -->
<a-light id="light_1" type="ambient" color="#9ecdf9" intensity="0.460" position="2 4 4"></a-light>
</a-scene>
<!-- AFRAME CONTENT END -->`
return aframe;
}
【问题讨论】:
标签: aframe