I use the requestAnimationFrame inside a ES6 class such as
class MyClass{...
run(){
requestAnimationFrame(this.animate);
//also tried requestAnimationFrame(() => this.animate);
}
animate(){
//how to get I back "this" here
}
I cannot get back the reference to "this" in the callback of the requestAnimationFrame. Any idea how to do this?