muneikh
muneikh

Reputation: 2107

Diagonal translation using Object AnimatorAndorid

I am trying to make a diagonal translation using object animator in Android. Following code makes a translation in Y Axis.

ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(button, "translationY", -value);

Any suggestions?

Thanks in advance

Upvotes: 2

Views: 1782

Answers (1)

Alex Curran
Alex Curran

Reputation: 8828

You can use an AnimatorSet with two ObjectAnimators, one performing the Y translation (as in the example in your question), and a very similar one doing the X translation. Make sure to use the playTogether(..) method of the AnimatorSet and you can animate both X and Y at the same time!

Upvotes: 2

Related Questions