Problem
When animating a view's transform, the transform will disappear, or be reset, after the animation completes on Android. It works fine on iOS.
Code to Reproduce
[
http://pastie.org/3059555](
http://pastie.org/3059555)
Just run the code listed there for both Android and iOS. On iOS, the view will animate to the bottom-right, and rotate 60 degrees. On Android, the same thing will happen, but when the animation completes, the rotation goes back to zero. The same thing happens if you apply a
scale
. All other properties, like
left
,
top
,
opacity
, etc... work fine, only the transform resets on Android.
I attempted to workaround this by setting the view's transform to the animations transform in the animation's
complete
event, but there is a very noticable flicker when this happens, very ugly.
Yeah dude, this is totally ruining my Titanium game development efforts. :)
Oh ye of little vision! I've got some pretty outside-the-box data visualization ideas actually. :)
So apparently android animation does NOT affect layouts. In other words, after the view is animated, its params stay untouched. We'll have to apply the transformation ourselves to the view..
Hieu, I mentioned it above, but just to reiterate, I tried applying the animation's transformation to the view in Javascript inside the animation's
complete
event. It kinda worked, but there's a _very_ noticeable flicker as it changes transformation.The color animation also resets after animation. Test case in TIMOB-11993.
FYI, this occurs because we re-layout the view at the end of translate (left/right/top etc) animations, and so when we re-lay-it-out then it loses its transform. And the reason we re-layout is because of *another* bug, namely TIMOB-10042. So we're in a "6 of one, etc" situation here at the moment.
Resolved as a part of https://github.com/appcelerator/titanium_mobile/pull/4398
Verified the fix with: Appc-Studio: 3.2.0.201310181700 Sdk:3.2.0.v20131018154951 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Google Nexus 7(v4.3,iphone5(v7) Xcode: 5 Transform and color does not resets after animation in both iOS and Android.