Fail Case / Testing Notes
If a view's
opacity
property is set to 0.0, then is animated to 1.0, when you then animate it back to 0.0 it will happen immediately, without respect for any
duration
property you might set on the animation.
* Create an app and use this as the app.js:
Titanium.UI.setBackgroundColor('#444');
var win = Titanium.UI.createWindow({
title:'Test',
backgroundColor:'#444',
exitOnClose: true
});
var v = Ti.UI.createView({
opacity: 0, backgroundColor: "red",
top: "20%", bottom: "20%", left: "10%", right: "10%"
});
win.add(v);
var btn = Ti.UI.createButton({
bottom: "16dp", height: "48dp", left: "16dp", width: "96dp",
title: "Animate"
});
var current = -1;
btn.addEventListener("click", function() {
if (current <= 0.0) {
current = 1.0;
} else {
current = 0.0;
}
v.animate({opacity: current, duration: 3000});
});
win.add(btn);
win.open();
* After the app loads, click the "Animate" button. A view will appear (its opacity was 0) and, over the course of three seconds, will animate to be fully opaque (opacity = 1.0).
* After it is fully opaque, click the "Animate" button again.
*Expected Behavior*: The view's opacity will animate to 0.0 (transparency) over a three second period.
*Actual Behavior*: The view immediately becomes transparent (i.e., it disappears immediately.)
pull request ready https://github.com/appcelerator/titanium_mobile/pull/2625
Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120815194913 Tested with Titanium Studio: 2.1.1.201207271312 Device - Samsung GALAXY Note Android 2.3.6 Machine OS - MAC 10.7.3