0
我想創建一個奇特的「保持刷新」,其中一個泡沫的大小增長,直到例如3秒過去。加速器/鈦 - 與動畫保持倒計時?
當3秒過後,用戶可以釋放指紋並刷新頁面。
現在,我有執行許多這些事情的代碼,但我正在用定時器和大小來構造。
// HOLD REFRESH
var holdTime = 2000, timeout, startTime = 0, timer = 0, timerOk = false;
var overLay = Ti.UI.createView({
backgroundColor: '#D9266BAF',
zIndex: '50',
left: 0,
top: 0,
width: '100%',
height: '100%'
});
var overLayText = Ti.UI.createLabel({
text: 'Hold to update content..',
color: 'white',
});
var overLayImage = Ti.UI.createImageView({
image: '/images/pullRefresh_white.png',
height: '30',
bottom: '40'
});
overLay.add(overLayText);
TileData.addEventListener('touchstart', function(e){
TileData.add(overLay);
timeout = setTimeout(function(e){
timerOk = true;
overLayText.text = 'Release to update content';
overLay.add(overLayImage);
}, holdTime);
});
TileData.addEventListener('touchmove', function(e){
clearTimeout(timeout);
timer = 0;
TileData.remove(overLay);
overLay.remove(overLayImage);
overLayText.text = 'Hold to update content..';
});
TileData.addEventListener('touchend', function() {
clearTimeout(timeout);
timer = 0;
if(timerOk){
MainController.openView('dashboard');
}else{
TileData.remove(overLay);
overLay.remove(overLayImage);
overLayText.text = 'Hold to update content..';
}
});
//