动画窗口(钛)

时间:2014-10-06 16:06:39

标签: titanium-alloy

我想从下到上打开我的窗口:

var controller = Alloy.createController('test', {
        title : 'test',

    });
    var newWindow = controller.getView();
    newWindow.animate(Alloy.Globals.animations.up);

    newWindow.open({
        animated : true

    });

它似乎无法正常工作。

up : Titanium.UI.createAnimation({
    top : (Ti.Platform.Android) ? '48dp' : 0
})

1 个答案:

答案 0 :(得分:0)

var win = Titanium.UI.createWindow({
    title:"Implement an Activity Indicator",
    backgroundColor:"#FFFFFF"
});

var exploreCalifornia = Titanium.UI.createImageView({
    image:"images/exploreCalifornia.png",
    width:96,
    height:119,
    top:120
});

var animateButton = Titanium.UI.createButton({
    title:"Go!",
    height:48,
    width:60,
    bottom:12,
});

animateButton.addEventListener("click", function(e){

    exploreCalifornia.animate({top:50,duration:500});

    var t = Titanium.UI.create2DMatrix();
    t = t.rotate(20);
    t = t.scale(1.5);


    //Create an animation object and set properties to animate
    var a = Titanium.UI.createAnimation({
        top:60,
        duration:1000,//Length of the animation in MS
        transform:t//set the transform object here
    });
    //Define an event listener for animation completion
    a.addEventListener('complete', function(){
        win.backgroundColor = "#FFCC00";

        var t = Titanium.UI.create2DMatrix();
        t = t.rotate(0);
        t = t.scale(1);

        var a = Titanium.UI.createAnimation({
            top:120,
            duration:1000,//Length of the animation in MS
            transform:t//set the transform object here
        }); 

        exploreCalifornia.animate(a);
    });

    exploreCalifornia.animate(a);

});

win.add(exploreCalifornia);
win.add(animateButton);

win.open();