[TIMOB-25978] Android: animate() called more than once on a view does not work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Yordan Banev |
Assignee | Yordan Banev |
Created | 2018-04-19T15:21:45.000+0000 |
Updated | 2018-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.
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.