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();
错误信息?那是你唯一的代码吗?如果是这样,Alloy.Globals.animation.up会抛出一个错误,因为它没有被定义为否定的?编辑 – phil 2014-10-06 23:45:49
,但如果知道更好的方法,请让我知道菲尔。干杯。 – bobo2000 2014-10-08 12:02:10