我已经阅读了一些关于AFrame的内容,我对Node.js非常熟悉.但为什么AFrame要求Node运行?我试着查看Aframe样板文件中的index.html - 它在运行或不运行Node的浏览器中运行相同.Node真的需要运行吗?什么是节点渲染?
我正在使用 a-frame 加载带有以下示例代码的全景照片。它在加载照片时显示白屏,并持续几秒钟,这会造成糟糕的用户体验。我想在加载照片时添加加载动画,但找不到任何有用的指南。有人可以帮忙吗?
<a-scene>
<a-assets>
<img id="sky" src="sky.png">
</a-assets>
<a-sky src="#sky"></a-sky>
</a-scene>Run Code Online (Sandbox Code Playgroud)
AFRAME.registerComponent('temp', {
init: function () {
var el = this.el;
var camera = this.el.getObject3D('camera');
console.log("CAMERA: "+camera);
}
});
Run Code Online (Sandbox Code Playgroud)
我有一个只有一个盒子和一个相机对象的框架场景。我试图获取对相机 object3D 的引用,但是,每当我尝试时,我都会得到一个未定义的对象。除了上述之外,我还尝试过执行 document.querySelector("#camera").object3D ,但这也不起作用。
我想知道如何使用 Aframe extras 组件的动画混合器属性来暂停/播放动画。目前,我的场景中有一个带动画的鸟的 gltf 模型。我想做的是,当单击暂停按钮时,发出一个函数并且动画将暂停,当触发播放函数时,动画将从停止的地方继续。如何才能做到这一点?当前代码:
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.1/dist/aframe-extras.min.js"></script>
<script>
function pause() {
//pause the animation
}
function play() {
//play the animation
}</script>
<button onclick="pause()" style="z-index: 10000000; position: fixed; margin-top: 0px; cursor: pointer;">
Pause
</button>
<button onclick="play()" style="z-index: 10000000; position: fixed; margin-top: 0px; cursor: pointer; margin-left: 50px;">
play
</button>
<a-scene>
<a-entity gltf-model="https://cdn.glitch.global/815f53ca-b7db-40aa-8843-e718abdfbf6d/scene%20-%202022-01-16T183239.246.glb?v=1642386788500" position="20 0 -35" rotation="0 90 0" scale="0.1 0.1 0.1" animation-mixer="clip:Take 001; loop:10000000000000000000; timeScale: 1; crossFadeDuration: 1"></a-entity>
</a-scene>
Run Code Online (Sandbox Code Playgroud)
我读到了donmccurdy在 github 上发布的一个可能的解决方案,但我不确定如何以有效的方式将其放入我的代码中。帖子链接:https://github.com/n5ro/aframe-extras/issues/222
链接到拨弄代码: …