0

I have created an imageView in Titanium and now I would like to hide it using an fade out animation along with changing the backgroundColor of the view.

I have the following code

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
});
Josiah Hester
  • 6,017
  • 1
  • 21
  • 37
user782400
  • 1,229
  • 7
  • 24
  • 43

1 Answers1

2

The opacity attribute is a floating point value from 0.0 (completely transparent) to 1.0 (completely opaque). Try this code instead, to fade out the image.

// 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
});

Alternatively, if you just want to hide the view, without animation, just use the hide() and show() methods.

Josiah Hester
  • 6,017
  • 1
  • 21
  • 37
  • Curves such as Ti.UI.ANIMATION_CURVE_EASE_IN_OUT are not supported on Android. This code will work for Android but it requires omitting the curve. – Tony Adams Aug 08 '13 at 14:20