Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25978] Android: animate() called more than once on a view does not work

GitHub Issuen/a
TypeBug
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterYordan Banev
AssigneeYordan Banev
Created2018-04-19T15:21:45.000+0000
Updated2018-04-24T12:30:00.000+0000

Description

Calling animate() on a View that has already been animated does not work. The callback is called after the duration, but the transformation is based on the initial state of the view and it is not affected by further animations. _Note:_ Adding autoReverse: true to the Ti.UI.Animation results in successfully animating the view every time. _Note2:_ anchorPoint property will work after the changes from TIMOB-16596 are applied. *Test case:* _app.js_
var win = Ti.UI.createWindow(),
    matrix = Ti.UI.create2DMatrix(),
    animation = Ti.UI.createAnimation({
      transform: matrix.rotate(90),
      duration: 1500,
      anchorPoint: {x: 0.5, y: 1}
    }),
    view = Ti.UI.createView({
      backgroundColor:'#336699',
      width:10, height:100, top: 150
    }),
    button = Ti.UI.createButton({
      title:'Rotate',
      height: 80,
      width: 300,
      bottom:30
    });

button.addEventListener('click', function(){
	button.touchEnabled = false;
	view.animate(animation, function() {
		button.touchEnabled = true;
	});
});

win.add(view);
win.add(button);
win.open();

*Result:* After the first click the view is rotate, the button disabled for the duration and enabled at the animation's end. Every following click results in *only* the button being disabled and reenabled after the animation duration. *Expected result:* The animation should be properly applied no matter how many times the button is clicked.

Comments

  1. Yordan Banev 2018-04-24

    Currently working the same way on iOS too. Will have to discuss with the team if that is something which should be addressed in the future.

JSON Source