繁体   English   中英

如何使用触摸旋转图像

[英]How to rotate an image using touch

任何人都可以告诉我,如何根据用户给出的触摸旋转视图....

我的意思是我想像旧电话那样做出类似的外观(按下并旋转拨号......)...... 替代文字

我很清楚如何旋转,但根据这种情况无法旋转.....

您只需要一个只有拨号图像的视图。

This view has a center C(x,y)
First, the view will be touched at coordinate T0(x,y)

if the x and y is within the circle do the tracking:
    Then the finger will move to coordinate Tn(x,y) 
    Find the angle made up by Tn(x,y) C(x,y) T0(x,y)  //(See below for a reference)
    and do the rotation using that angle as you already know ;)
else
   do nothing since the touch is not in the dial 

参考: 如何从三个点计算角度

计算起始触摸和刻度盘中心之间的角度( atan2f(y - yc, x - xc) ),并将其用作基准角度,以确定每个后续触摸事件所需的旋转。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM