r brooks
r brooks

Reputation: 97

Pause/reverse a frame animation?

I have a frame animation that plays perfectly fine using AnimationDrawable. Here it is:

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/arrowframes0000" android:duration="50" />
<item android:drawable="@drawable/arrowframes0001" android:duration="50" />

...

<item android:drawable="@drawable/arrowframes0024" android:duration="50" />
<item android:drawable="@drawable/arrowframes0025" android:duration="50" />

I need to be able to reverse this frame animation while it is still playing and in other circumstances shortly after it is done.

There doesn't seem to be any way to do this using AnimationDrawable.

How else can I do this so that i can reverse the animation mid-playback? (and make it go forward again mid-reverseplayback).

Upvotes: 4

Views: 2862

Answers (2)

Shriram Panchal
Shriram Panchal

Reputation: 2086

I have done this for me in this way i.e. at last drawable "arrowframes0025" expand the duration (say 2000) this will make it stop for 2 second and continue placing your drawables in descending order with same duration (50) this will make the complete forward-reverse animation & keep oneshot as false

Upvotes: 0

CR Sardar
CR Sardar

Reputation: 1026

create another same duplicate animation with reverse frame & when you want to reverse the already running animation, stop which one you want to reverse(i.e the running one) & start duplicate reverse(i.e. 2nd) animation.

Upvotes: 1

Related Questions