bdristan
bdristan

Reputation: 1070

how transition between two drawables using rotate animation on android?

I'd like to transition from drawable1 to drawable2 using rotation by 180 degrees along Y axis. That is, I'd like to rotate drawable1 by 90 degrees, replace drawable1 with drawable2 and then continue rotation by another 90 degrees. I can accomplish the first step by the following:

ViewImage viewImage;
viewImage.setImageDrawable(drawable1);
viewImage.animate().rotateY(90).start();

How can I continue with the drawable2 so it is revealed from 90 degrees to 0?

Thanks.

Upvotes: 1

Views: 457

Answers (1)

Bartek Lipinski
Bartek Lipinski

Reputation: 31438

viewImage.animate().rotationY(90).withEndAction(new Runnable() {
        @Override
        public void run() {
            viewImage.setImageDrawable(drawable2);
            viewImage.animate().rotationY(0).start();
        }
    }).start();

Upvotes: 1

Related Questions