I am developing an app which has feature that resizing and rotating the imageview by dragging its bottom right corner button.
I saw one app which has feature that if we drag the bottom right corner button diagonally imageview size had resized or else if we drag the button left or right side direction imageview had rotated as per direction. I wish to implement this feature in my app
I am struggling to implement single finger rotation as well as resizing the imageview.
Please guide me in right way.
I am trying this code, and try to apply zoom and rotate but not able to do please help me.
belove code to do zoom and rotate finger base action.
I have Design A Layout that may work as your need.
Download Demo here
and images put in drawable
please check the repository in github i create it .
count the distance from center point in the rotate and zoom view to the push point.
just use :
and count the OA/OB that value can count the view new height and width
count the angle AOB, the A is the first push point , the B is the last move point ,the O is the center of the View Point .
and then just set new height and width for view ,and count the left and top for view .
I’m assuming the rotation/scaling happens from the image center? In that case, it’s simple trigonometry to find the rotation angle and the size:
dy of the finger’s coordinates minus the center coordinates.
Math.atan2(dy, dx) is the rotation angle (in radians) and
Math.hypot(dx,dy) can be used for the relative size, or just double the dx/dy and use directly.