How do I add some sort of call back so that I can run further code after render() has completed?
function next(){
target = max;
render();
//When render complete, do some more
//change values....
//render();
}
function prev(){
target = min;
render();
//When render complete, do some more
}
var timer;
function render(){
timer = setInterval(renderIt, 40);
}
function renderIt(){
if (condition) {
clearInterval(timer);
return;
}
//Do the stuff
}