2014-10-06 4 views
0

Я хочу, чтобы открыть мое окно снизу вверх:анимировать окно открытия (титан)

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 
}) 
+0

сообщения об ошибке? Это единственный код, который у вас есть? Если это так, Alloy.Globals.animation.up выдает ошибку, потому что не определено no? – phil

+0

отредактирован, но если вы знаете лучший способ, дайте мне знать phil. Приветствия. – bobo2000

ответ

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(); 
Смежные вопросы