I have a simple progress bar that turns from green to red. The animate method is really very handy there. But is there a way to add actions while the animation is running (e.g. show a label after 1 second)?
views.js:
<View id="progressBar" height="40%" width="100%" left="0%" backgroundColor="green" onClick="checkAnimation"/>
controller.js:
$.progressBar.animate({
left: 0,
width: "1%",
backgroundColor: "red",
duration: 2000
});
You can simply use setTimeout method irrespective of whatever animation is running, like this:
$.progressBar.animate({
left: 0,
width: "1%",
backgroundColor: "red",
duration: 2000
});
setTimeout(function(){
$.someLabel.visible = true;
// or
$.someOtherLabel.text = "Label changed while animation is running...";
}, 1000);