Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I rotate a View by Y-axis in android?

In my app, i would like rotate an ImageView by setRotationY(). In fact, it does. Just like from b to d, mirror effect and when i use setRotation(45) before setRotationY(), the result is that setRotationY is according to the device Y-axis, and i want the rotationY according to view self.

How? Can you guide me? Thanks!

like image 823
Guu Avatar asked Dec 02 '22 17:12

Guu


1 Answers

ObjectAnimator animation = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, 360f);
    animation.setDuration(3600);
    animation.setRepeatCount(ObjectAnimator.INFINITE);
    animation.setInterpolator(new AccelerateDecelerateInterpolator());
    animation.start();
like image 156
Dmitriy Puchkov Avatar answered Dec 19 '22 11:12

Dmitriy Puchkov