//in javascript i would do something like that: var s = setInterval("move()",100); function move(){ //my code ... }