ViewAnimator icon indicating copy to clipboard operation
ViewAnimator copied to clipboard

Unable to repeat animation with timer

Open gensin opened this issue 6 years ago • 1 comments

I'm experimenting an issue trying to repeating an animation with a timer. I have the following method:

ViewAnimator.animate(buttonStart) .rotation(360) .duration(2000) .decelerate() .start();

And a timer which call this methods every 4 seconds. It works always the first time but never again in the sequence although the method call is working. Why is this happening? Why I only can call to the animation once? Am I doing something wrong?

gensin avatar Oct 11 '17 05:10 gensin

@gensin you can use repeatCount method for that purpose:

ViewAnimator.animate(buttonStart)
   .rotation(360)
   .duration(4000) // 4 seconds
   .decelerate()
   .repeatCount(android.view.animation.Animation.INFINITE)
   .start();

efraespada avatar Dec 20 '17 10:12 efraespada