Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9005] Android: Not able to animate after an animation is complete

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionHold
Resolution Date2012-05-25T17:14:57.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-11 Core
ComponentsAndroid
Labelscore, parity
ReporterNeeraj Gupta
AssigneeMax Stepanov
Created2012-05-05T13:24:05.000+0000
Updated2017-03-21T21:12:54.000+0000

Description

Not able to animate after an animation completes. Same code works fine on iOS platform. Code example: http://pastebin.com/w23d43p4. Size animation also does not seem to respect which point should be the center of the animation. Again, it works on iOS as expected.

Comments

  1. Max Stepanov 2012-05-25

    Currently Android animations support code is quite complicated (and old) due to various Android bugs and versioning. Android animations as a whole needs to be reviewed for complete redesign. Regarding this particular issue, there is a workaround exists which is to update view properties after animation (as it mentioned at [Titanium.UI.View docs](http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.View-method-animate))
       var win = Ti.UI.createWindow({
           backgroundColor: 'blue'
       });
       
       var circle = Titanium.UI.createView({
       	height:100,
       	width:100,
       	borderRadius:50,
       	backgroundColor:'yellow',
       	top:10
       });
       
       win.add(circle);
       
       win.open();
       
       var RR = { UI:{ coupon: {} } };
       
       RR.UI.coupon.breatheRising = function(widget, style){
               if(!widget){ return; }
        
               widget.animate({
                               transform: Ti.UI.create2DMatrix(),
                               opacity: 1,
                               duration: 2000
                       }, function(){
                       widget.opacity = 1; // <--- add this line for workaround
                       RR.UI.coupon.breatheFalling(widget, style);
               });            
       };
       RR.UI.coupon.breatheFalling = function(widget, style){
               if(!widget){ return; }
               var animation;
               if(style == 'size'){
                       animation = {transform: Ti.UI.create2DMatrix({scale: 0.8}), duration: 2000};
               } else {
                       animation = {opacity:0.2, duration: 2000};
               }
               widget.animate(animation, function(){
       	        widget.opacity = 0.2; // <--- add this line for workaround
                       RR.UI.coupon.breatheRising(widget, style);
               });            
        
       };
        
       RR.UI.coupon.breathe = function(widget, style){
               style = style || 'size';
               if(style == 'opacity'){
                       widget.opacity = 0.2;
               } else { // size
                       widget.transform = Ti.UI.create2DMatrix({scale: 0.8});
               }
               setTimeout(function(){
                       RR.UI.coupon.breatheRising(widget, style);
               }, 1000);
        
       };
       
       RR.UI.coupon.breathe(circle, 'opacity');
       
  2. Lee Morris 2017-03-21

    Closing ticket due to the time that has passed since this was filed.

JSON Source