I have an RotateAnimation with transition of views
var i = 0
for (image in imageList) {
image.translationX = translationsize[i].x
image.translationY = translationsize[i].x
val anim = RotateAnimation(
0f, 360f,
Animation.RELATIVE_TO_SELF, pivots[i].x,
Animation.RELATIVE_TO_SELF, pivots[i].y
)
anim.duration = 1500
anim.repeatCount = Animation.INFINITE
anim.repeatMode = Animation.RESTART
anim.interpolator = LinearInterpolator()
image.startAnimation(anim)
i++
}
I want to make the same animation using ObjectAnimator, but it does not work
val pvhX: PropertyValuesHolder = PropertyValuesHolder.ofFloat(TRANSLATION_X, 60f)
val pvhY: PropertyValuesHolder = PropertyValuesHolder.ofFloat(TRANSLATION_Y, 60f)
val rotate: PropertyValuesHolder = PropertyValuesHolder.ofFloat("rotation", 0f, 360f)
val animator: ObjectAnimator = ObjectAnimator.ofPropertyValuesHolder(image, pvhX, pvhY, rotate)
animator.duration = 1500
animator.repeatCount = Animation.INFINITE
animator.repeatMode = ValueAnimator.RESTART
animator.interpolator = LinearInterpolator()
animator.start()
