Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24474] iOS: Animate object's opacity with animate({}) method don't change the opacity property

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-03-13T20:45:41.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsapi, ios
Reporternicolomonili
AssigneeHans Knöchel
Created2017-03-10T16:11:56.000+0000
Updated2017-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

FileDateSize
testopacityanimate.mov2017-03-10T16:10:43.000+00002567287

Comments

  1. Sharif AbuDarda 2017-03-10

    I can verify the issue with the given code in SDK 6.0.2.GA.
  2. Hans Knöchel 2017-03-10

    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();
       
  3. Samir Mohammed 2017-03-13

    Fix is present in 6.1.0.v20170313134959, test steps can be found in https://github.com/appcelerator/titanium_mobile/pull/8880 *Environement*
       Appcelerator Command-Line Interface, version 6.1.0
       Iphone 6S OS: 10.0
       Operating System Name: Mac OS X El Capitan
       Operating System Version: 10.11.6
       Node.js Version: 4.6.0
       npm: 4.2.8
       Xcode: 8.2
       Appcelerator Studio: 4.8.1.201612050850
       
  4. nicolomonili 2017-03-14

    On http://builds.appcelerator.com/ i see only the 6.1.0.v20170313171259 version
  5. nicolomonili 2017-03-14

    Sorry for the last comment. The fix is also present in the newer version 6.1.0.v20170313171259 ? Thanks
  6. Samir Mohammed 2017-03-14

    Hey [~nicolomonili] this fix should be present in 6.1.0.v20170313171259 as well

JSON Source