Fade In Button
I'm trying to get a button image to fade in at a certain point. I want something like this, but I'm not sure how to accomplish it…
var openWin2Button = Titanium.UI.createButton({
backgroundImage:'pages/img/social_b_off.png',
backgroundSelectedImage:'pages/img/social_b_on.png',
height:34,
width:82,
top:292,
right:133
});
var buttonAnimation = Titanium.UI.createAnimation({
curve:Ti.UI.ANIMATION_CURVE_EASE_IN,
opacity:1,
duration:2000
});
win.add(openWin2Button)
1 Answer
-
try this ( untested )
var openWin2Button = Titanium.UI.createButton({ backgroundImage:'pages/img/social_b_off.png', backgroundSelectedImage:'pages/img/social_b_on.png', height:34, width:82, top:292, right:133, opacity:0 }); var buttonAnimation = Titanium.UI.createAnimation({ curve:Ti.UI.ANIMATION_CURVE_EASE_IN, opacity:1, duration:2000 }); win.add(openWin2Button); openWin2Button.animate( buttonAnimation );