我在运行动画时遇到了问题。这个动画是在 var ob1 = function() {};
里面的。当调用它时,它会运行一段时间,然后出现错误 Uncaught RangeError: Maximum call stack size exceeded
。然而,这个相同的结构在对象外部运行时没有任何问题。
/////////////// Render the scene ///////////////
this.render = function (){
renderer.render(scene,camera);
if(isControls == true) controls.update(clock.getDelta());
this.animate();
//console.log(true);
requestAnimationFrame(this.render());
}
/////////////// Update objects ///////////////
this.animate = function (){
console.log("!");
}
requestAnimationFrame
需要一个回调函数,但你只传递了undefined
。 - elclanrs