requestAnimationFrame without loss context angualar code example
Example 1: requestAnimationFrame without loss context angualar
protected animate() {
requestAnimationFrame( this.animateCallback.callAnimate );
this.mesh.rotation.x += 1;
this.mesh.rotation.y += 1;
this.renderer.render( this.scene, this.camera );
}
Example 2: requestAnimationFrame without loss context angualar
this.animateCallback = {
callAnimate: (this.animate).bind(this)
};
this.animateCallback.callAnimate();