动画隐藏imageview [钛]

时间:2013-07-24 11:28:01

标签: view colors hide titanium-mobile

我在Titanium中创建了一个imageView,现在我想使用淡出动画隐藏它,同时更改视图的backgroundColor。

我有以下代码

var image = Titanium.UI.createImageView({
    backgroundImage:'test.png',
    width:10,
    height:10,
    top:100,
    left:205
});

image.animate({
    curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, 
    opacity:10, 
    duration:200
});

1 个答案:

答案 0 :(得分:2)

opacity属性是浮点值,从0.0(完全透明)到1.0(完全不透明)。请尝试使用此代码淡出图像。

// This code block will fade out the image to invisible
image.animate({
    curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, 
    opacity:0.0, 
    duration:200
});

或者,如果您只想隐藏视图而不使用动画,只需使用hide()和show()方法。