Repeat AnimatorSet

后端 未结 7 1604
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 09:19

Is there a simple way to repeat a Android AnimatorSet (infinite)? Can I set a AnimationListener and restart the AnimatorSet by calling

7条回答
  •  面向向阳花
    2021-02-05 09:56

    Set Infinite repeat count and restart / reverse repeat mode to all child animations

    animatorSet.childAnimations.forEach {
                val animator  = it as ObjectAnimator
                animator.repeatCount = ObjectAnimator.INFINITE
                animator.repeatMode = ObjectAnimator.RESTART / REVERSE
    }
    

提交回复
热议问题