Titanium: how to transition Slide left/right or up/down between 2 windows

久未见 提交于 2019-12-09 23:13:02

问题


I have a problem to solve. I research some day but i cant solve yet. I want to slide the current open window to the left, and slide a new window from the right to on screen. How can i do that?


回答1:


You'll need an event to fire this animation, possibly a tap on a button or just simply a swipe event on the window. In this event you just simply animate the 2 window's left property as follows:

var win1 = Ti.UI.createWindow({
    top: 0,
    left: 0,
    width: 320,
    height: 480
});

var win2 = Ti.UI.createWindow({
    top: 0,
    left: 320,
    width: 320,
    height: 480
});

win1.addEventListener('swipe', function(){
    var anim1 = Ti.UI.createAnimation({
        left: -320,
        duration: 1000
    });
    var anim2 = Ti.UI.createAnimation({
        left: 0,
        duration: 1000
    });
    win1.animate(anim1);
    win2.animate(anim2);
});


来源:https://stackoverflow.com/questions/11135606/titanium-how-to-transition-slide-left-right-or-up-down-between-2-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!