我想暂停a-entity
的渲染与利用.pause()
方法的自定义功能。这是我的Aframe组件:为什么我无法在Javascript Aframe.registerComponent中调用此方法?
<body style="margin : 0px; overflow: hidden;">
<script>
AFRAME.registerComponent('intro', {
schema: {
array: { type: "array", default: ["Hi! I'm Ducky and welcome to", "Black", "Duck"] }
},
init: function() {
const self = this;
pauseTextRender(self);
}
function pauseTextRender(component) {
component.pause();
}
});
</script>
</body>
这是最低限度。当我检查控制台时,我收到错误Uncaught SyntaxError: Unexpected token function
。我对Javascript不太熟悉,但我怎样才能为Aframe类创建一个可接受的函数?