【发布时间】:2016-03-20 09:36:08
【问题描述】:
请看以下代码 sn-p,在 Appcelerator Studio SDK 5.2.0.GA 中测试:
//
// create base UI tab and root window
//
var win0 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var label0 = Titanium.UI.createLabel({
color:'red',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
view0 = Titanium.UI.createView({
borderRadius:10
,width: 350
,height:40
,opacity:1
,color:"blue"
});
view0.add(label0);
win0.add(view0);
win0.open();
// Working
//win0.animate({backgroundColor:"blue", duration: 1000});
// Working
//view0.animate({backgroundColor:"blue", duration: 1000});
// Working
//label0.animate({backgroundColor:"blue", duration: 1000});
// "Working", but there is no duration (animation takes place right away)
label0.animate({color:"blue", duration: 1000});
// "Working", but there is no duration (animation takes place right away after the timer 5 sec timeout)
//setTimeout(function(){
// label0.animate({color:"blue", duration: 1000});
//},5000);
// If win0.open is placed before the code below, there is no animation at all.
// If win0.open is placed after the code below, there is animation, but it takes place right away.
//win0.addEventListener('postlayout', function(e){
// label0.animate({color:"blue", duration: 1000});
//});
代码创建一个窗口,其中一个视图和一个标签在视图内。
每次测试 4 行带有动画的行(即,要测试,一次取消注释)。第一个在 1 秒内为窗口的背景颜色设置动画。工作正常。第二个动画视图的背景颜色,工作正常。第三个动画标签的背景颜色,工作正常。第四个旨在为标签文本颜色设置动画。这并不像预期的那样起作用。动画发生了,但它是立即发生的,而不是在 1 秒内。
知道代码或其他东西可能有什么问题吗?
【问题讨论】:
标签: animation appcelerator appcelerator-titanium