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
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!