lewismcgeary / AndroidtoAppleVectorLogo

An Android app demoing pathmorphing with AnimatedVectorDrawables
342 stars 56 forks source link

Evil eyes #2

Closed lewismcgeary closed 9 years ago

lewismcgeary commented 9 years ago

still show up after going back and forth with transitions for a long time. maybe adding in non-transition object animators could fix this, eg. on reverse transition, rather than eyes just having a startOffset, they could also have a closed state to closed state transition covering the time period when they should not be visible. May negate need to reload AnimatedVectorDrawable each time

lewismcgeary commented 9 years ago

error may be gone? reason unclear...

lewismcgeary commented 9 years ago

Seems this is to do with constantState of drawables http://android-developers.blogspot.co.uk/2009/05/drawable-mutations.html Underlying VectorDrawable is changed by the AnimatedVectorDrawable. While the cached version is used this is ok, but after leaving app and using a few others, returning to app again will present problem. AnimatedVectorDrawable loads altered version of the VectorDrawable, rather than the original.

lewismcgeary commented 9 years ago

Only ObjectAnimators using a startOffset are affected. Others will still have been altered in the underlying Drawable, but because they have an objectAnimator targeting them from the start of the AnimatedVectorDrawable this is not visible. paths targeted by an objectAnimator which uses a startOffset will show the altered state until the objectAnimator kicks in.

lewismcgeary commented 9 years ago

present solution is to use additional objectAnimators with duration of zero to set these paths back to their original state at the start of the AnimatedVectorDrawable