running requestAnimationFrame from within a new object

Posted by JVE999 on Stack Overflow See other posts from Stack Overflow or by JVE999
Published on 2013-10-18T21:39:08Z Indexed on 2013/10/18 21:54 UTC
Read the original article Hit count: 268

I'm having trouble running an animation. This is inside var ob1 = function() {};. When called, it runs for a while and then I get the error Uncaught RangeError: Maximum call stack size exceeded. However, this same structure has no problems running outside of the object.

/////////////// 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("!");
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about three.js