I have written a javascript function that uses setInterval to manipulate a string every tenth of a second for a certain number of iterations.
function timer(
I had the same question as the original poster, did this as a solution. Not sure how efficient this is ....
interval = 5000; // initial condition
var run = setInterval(request , interval); // start setInterval as "run"
function request() {
console.log(interval); // firebug or chrome log
clearInterval(run); // stop the setInterval()
// dynamically change the run interval
if(interval>200 ){
interval = interval*.8;
}else{
interval = interval*1.2;
}
run = setInterval(request, interval); // start the setInterval()
}