How can I pass argument with requestAnimationFrame?
You either need to create a reference or wrap the function call in another function like so: mainFunc: function(x) { anim.update(x); anim.redraw(x); window.requestAnimationFrame(function() { anim.mainFunc(x); }); }