I want some ImageView to move to the right first, then down by pressing the button.
He wrote this:
private fun moveX() { ObjectAnimator.ofFloat(beatle, "translationX", getValue(curX)).apply { duration = 2000 start() } } private fun moveY() { ObjectAnimator.ofFloat(beatle, "translationY", getValue(curY)).apply { duration = 2000 start() } } private fun runClick(view: View) { while (curX + 1 < WIDTH) { curX++ moveX() } while (curY + 1 < HEIGHT) { curY++ moveY() } } still tried this:
beatle.animate().translationX(getValue(x)).translationY(getValue(y)).setDuration(2000).start() In both cases, instead of going to the right and down in succession, my picture went diagonally, executing these commands simultaneously. Is it possible to write sequential animation using these classes? If not, what should I use?