[AC-6612] iOS: Animation override not working correctly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | animation, ios |
Reporter | martin |
Assignee | Abir Mukherjee |
Created | 2020-10-01T23:20:25.000+0000 |
Updated | 2020-10-01T23:22:42.000+0000 |
Description
Overriding an animation on iOS sometimes does not work correctly. The following example, when tapping the window, should show a black view moving from left to right.
When reaching about the middle of the screen, another animation should override the first and move the view back again.
On Android it works as expected, on iOS the view pauses, jumps to the right side of the screen, animates a smal distance and finally jumps back to the left side of the screen.
const win=Ti.UI.createWindow({
backgroundColor:'white'
});
const view=Ti.UI.createView({
left:0,
width:100,
height:100,
backgroundColor:'black',
overrideCurrentAnimation:true //this is for Android
});
win.add(view);
const animate=(forward,duration)=>{
view.animate({
left:forward ? win.size.width-view.size.width : 0,
curve:Ti.UI.ANIMATION_CURVE_LINEAR,
duration:duration
});
};
const button=Ti.UI.createButton({
title:'Start',
bottom:100
});
button.addEventListener('click',()=>{
animate(true,2000); //animate the view from left to right with a duration of 2000 ms...
setTimeout(()=>animate(false,2000),1000); //... but after 1000 ms we override to animate back again
});
win.add(button);
win.open();
No comments