Hello,
could someone help me with requestAnimationFrame, how can I deal with “this” in recursion function?
ModelLoader.prototype.animate = function () {
console.log('animate, this: ' + this);
requestAnimationFrame( this.animate );
this.controls.update();
this.stats.update();
};
This console.log() first time returns:
animate, this: [object Object]
and of course next time:
animate, this: [object Window]
I would like to use prototyping. To have my code inside own “classes”.
I was sure it will be quite easy, I was wrong
Thanks,
Simon