basically I have written a function:
function animation(){ setTimeout( function(){ requestAnimationFrame(animation); if (player.currentFrame == player.frames) { player.currentFrame = 0; } else { player.currentFrame++; } } , 1000 / 15); }
and I'm trying to call it with this code
animation(fps);
I tried making it like this:
function animation(fps){ setTimeout( function(){ requestAnimationFrame(animation); if (player.currentFrame == player.frames) { player.currentFrame = 0; } else { player.currentFrame++; } } , 1000 / fps); }
and tried to call it with animation(30)
but it didn't work. I tried search topic like this but non of them is excatly what I want.
Any help would be appreciated! :)