2017-08-09 54 views
0

我有一個簡單的進度條,從綠色變爲紅色。有生命的方法在那裏非常方便。但是有沒有辦法在動畫運行時添加動作(例如,在1秒後顯示標籤)?如何在使用Appcelerator的動畫方法中觸發操作?

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 
}); 

回答

1

您可以簡單地使用的setTimeout方法,不論任何動畫的運行,像這樣:

$.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); 
相關問題