Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9495] Android: Animation: An animated object does not animate correctly the second time

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-06-15T13:26:43.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 2.1.0, Sprint 2012-12 Core
ComponentsAndroid
Labelscore, module_animation, qe-and060112, qe-testadded, regression
ReporterSatyam Sekhri
AssigneeBill Dawson
Created2012-06-12T03:19:30.000+0000
Updated2012-07-03T15:06:56.000+0000

Description

An animated view object does not animate properly the second time. This is a regression. The behavior does not happen on 2.0.2 Steps to Reproduce: 1. Create an application with the Sample code for animation, as given below 2. Run the application 3. Click on Red View. The red view animates. 4. After the animation is completed, again click on the Red view Actual Result: The red view scales for once and stays Expected: The red view should animate each time it is clicked Sample Code
var win = Ti.UI.createWindow({
	backgroundColor:'green'
});

var box = Ti.UI.createView({
			backgroundColor : 'red',
			height : '150',
			width : '100'
		});

		box.addEventListener('click', function() {
			var matrix = Ti.UI.create2DMatrix()
			
			matrix = matrix.scale(2, 2);
			var a = Ti.UI.createAnimation({
				transform : matrix,
				duration : 2000,
				autoreverse : true,
				repeat : 3
			});
			box.animate(a);
		});
		win.add(box);
win.open();

Comments

  1. Bill Dawson 2012-06-14

    Fail Case / Test Case

    * Create an app with this app.js:
       var win = Ti.UI.createWindow({
       	backgroundColor : 'green'
       });
       
       var box = Ti.UI.createView({
       	backgroundColor : 'red',
       	height : '150dp',
       	width : '100dp',
       	top: '50dp'
       });
       
       box.addEventListener('click', function() {
       	var matrix = Ti.UI.create2DMatrix().scale(1.5, 1.5);
       	var a = Ti.UI.createAnimation({
       		transform : matrix,
       		duration : 500,
       		autoreverse : true,
       		repeat : 2
       	});
       	box.animate(a);
       });
       win.add(box);
       
       var box2 = Ti.UI.createView({
       	backgroundColor: "blue",
       	top: "285dp",
       	height: "100dp",
       	width: "100dp"
       });
       
       box2.addEventListener("click", function() {
       	var matrix = Ti.UI.create2DMatrix().rotate(97);
       	box2.animate({transform: matrix, duration: 500, autoreverse: true, repeat: 2});
       });
       win.add(box2);
       
       win.open();
       
    * Run it. * Tap the red box. It should grow and shrink twice. Tap it again: in the fail case, it will fail to do what it's supposed to (it gets stuck). In the fixed branch, it should do just like when you tapped it the first time. * Tap the green box. It should rotate forward and back twice. Tap it again: in the fail case, it will fail to do what it's supposed to (it gets stuck). In the fixed branch, it should do just like when you tapped it the first time.
  2. Bill Dawson 2012-06-14

    Pull request ready: https://github.com/appcelerator/titanium_mobile/pull/2392
  3. Michael Pettiford 2012-06-18

    Closing issue Tested with Ti Studio build 2.1.0.201206172244 Ti Mobile SDK2.1.0.v20120618134156 hash r00905cd0 OSX Lion 10.7.3 iPhone 4S OS 5.1, Nexus S OS 4.0.4 The expected behavior is shown

JSON Source