Reputation: 55
So I have square in the center of my screen. Right now i have a 2 buttons to rotate left and right.
switch (v.getId()) {
case R.id.leftClick:
square.setRotation(square.getRotation() - 90);
break;
case R.id.rightClick:
square.setRotation(square.getRotation() + 90);
break;
default:
break;
}
I'd like to change it to do so by touch. Possibly by vertical half (the horizontal bottom half) of the screen. If that make sense. I'm also curious if its possible to have an animation go along with the rotation. Any tips? Thank you in advance.
Upvotes: 0
Views: 504
Reputation: 75788
@cookiemonster: You can use RotateAnimation for your requirement . RotateAnimation An animation that controls the rotation of an object. This rotation takes place in the X-Y plane. You can specify the point to use for the center of the rotation, where (0,0) is the top left point
. If not specified, (0,0) is the default rotation point
. Please check below demo link .I hope it will help .
Upvotes: 1