[TIMOB-24474] iOS: Animate object's opacity with animate({}) method don't change the opacity property
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-03-13T20:45:41.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.1.0 |
| Components | iOS |
| Labels | api, ios |
| Reporter | nicolomonili |
| Assignee | Hans Knöchel |
| Created | 2017-03-10T16:11:56.000+0000 |
| Updated | 2017-03-14T16:33:49.000+0000 |
Description
Animate view's opacity with animate({}) method don't change the opacity property of the view.
Test code and video attached
var win = Ti.UI.createWindow({
backgroundColor: "white"
});
var view = Ti.UI.createView({
width : 100,
height : 100,
backgroundColor : "red",
opacity : 1.0
});
var label = Ti.UI.createLabel({
width : Ti.UI.FILL,
top : 30,
color : "red",
textAlign : "center",
font : {
fontSize : 20
}
});
var buttons = Ti.UI.iOS.createTabbedBar({
bottom : 30,
labels : ["Without animate","With animate"],
index : 0,
tintColor : "red"
});
var temp = true;
setInterval(function(e){
if(temp){
if(buttons.index == 0)
view.opacity = 0.0;
else
view.animate({ opacity : 0.0 , duration : 0});
}else{
if(buttons.index == 0)
view.opacity = 1.0;
else
view.animate({ opacity : 1.0 , duration : 0});
}
temp = !temp;
label.text = "view opacity: " + view.opacity;
},200);
win.add(label,view,buttons);
win.open();
Attachments
| File | Date | Size |
|---|---|---|
| testopacityanimate.mov | 2017-03-10T16:10:43.000+0000 | 2567287 |
I can verify the issue with the given code in SDK 6.0.2.GA.
PR: https://github.com/appcelerator/titanium_mobile/pull/8880 Test-Case (modified from above, also fixing the "backgroundColor" one:
var win = Ti.UI.createWindow({ backgroundColor: "white" }); var view = Ti.UI.createView({ width: 100, height: 100, backgroundColor: "red", opacity: 1.0 }); var label1 = Ti.UI.createLabel({ top: 30, width: Ti.UI.FILL, textAlign: "center", }); var label2 = Ti.UI.createLabel({ top: 50, width: Ti.UI.FILL, textAlign: "center", }); var buttons = Ti.UI.iOS.createTabbedBar({ bottom: 30, labels: ["Without animate", "With animate"], index: 0, tintColor: "red" }); var temp = true; setInterval(function(e) { if (temp) { if (buttons.index == 0) { view.opacity = 0.0; view.backgroundColor = "green"; label1.text = "view opacity: " + view.opacity; label2.text = "view backgroundColor: " + view.backgroundColor; } else { view.animate({ opacity: 0.0, backgroundColor: "green", duration: 0 }, function() { label1.text = "view opacity: " + view.opacity; label2.text = "view backgroundColor: " + view.backgroundColor; }); } } else { if (buttons.index == 0) { view.opacity = 1.0; view.backgroundColor = "red"; label1.text = "view opacity: " + view.opacity; label2.text = "view backgroundColor: " + view.backgroundColor; } else { view.animate({ opacity: 1.0, backgroundColor: "red", duration: 0 }, function() { label1.text = "view opacity: " + view.opacity; label2.text = "view backgroundColor: " + view.backgroundColor; }); } } temp = !temp; }, 200); win.add(label1, label2, view, buttons); win.open();Fix is present in 6.1.0.v20170313134959, test steps can be found in https://github.com/appcelerator/titanium_mobile/pull/8880 *Environement*
On http://builds.appcelerator.com/ i see only the 6.1.0.v20170313171259 version
Sorry for the last comment. The fix is also present in the newer version 6.1.0.v20170313171259 ? Thanks
Hey [~nicolomonili] this fix should be present in 6.1.0.v20170313171259 as well