ObjectAnimator.ofFloat can't take Int as parameters directly in kotlin

Viewed 5481

I am working on a kotlin Project and i try to convert a method in java to kotlin. I am now getting this error

None of the following functions can be called with the arguments supplied.

it occurs on the ObjectAnimator.ofFloat()

The Code is below

Code

fun animate(holder: RecyclerView.ViewHolder, goesDown: Boolean) {

    val animat = AnimatorSet()

    val objectY = ObjectAnimator.ofFloat(holder.itemView, "translationY", if (goesDown) 200 else -200, 0)
    objectY.setDuration(Kons.Duration.toLong())

    val objectX = ObjectAnimator.ofFloat(holder.itemView, "translationX", -50, 50, -30, 30, -20, 20, -5, 5, 0)
    objectX.setDuration(Kons.Duration.toLong())

    animat.playTogether(objectX, objectY)
    animat.start()
}
1 Answers
Related